UNPKG

js-moi-logic

Version:
34 lines (30 loc) 981 B
import { IxParticipant, Sender } from "js-moi-providers"; interface IRoutineOption { sequence?: number; sender?: Sender; fuelLimit?: number; fuelPrice?: number; participants?: IxParticipant[]; } export class RoutineOption implements IRoutineOption { public sequence?: number; public sender?: Sender; public fuelLimit?: number; public fuelPrice?: number; public participants?: IxParticipant[]; constructor(options: IRoutineOption = {}) { const keys = Object.keys(options) as Array<keyof IRoutineOption> for (const key of keys) { this[key as keyof this] = options[key] as any } } } /** * Creates a new RoutineOption instance with the given option object. * * @param option - The option object used to create the RoutineOption. * @returns A new RoutineOption instance. */ export const createRoutineOption = (option: IRoutineOption): RoutineOption => { return new RoutineOption(option) }