UNPKG

astra-universal-router-sdk

Version:

sdk for integrating with the Astra Router contracts

59 lines (58 loc) 1.57 kB
/** * CommandTypes * @description Flags that modify a command's execution * @enum {number} */ export declare enum CommandType { CL_SWAP_EXACT_IN = 0, CL_SWAP_EXACT_OUT = 1, PERMIT2_TRANSFER_FROM = 2, PERMIT2_PERMIT_BATCH = 3, SWEEP = 4, TRANSFER = 5, PAY_PORTION = 6, CLASSIC_SWAP_EXACT_IN = 8, CLASSIC_SWAP_EXACT_OUT = 9, PERMIT2_PERMIT = 10, WRAP_AMB = 11, UNWRAP_SAMB = 12, PERMIT2_TRANSFER_FROM_BATCH = 13, BALANCE_CHECK_ERC20 = 14, CL_POSITION_MANAGER_PERMIT = 17, CL_POSITION_MANAGER_CALL = 18, EXECUTE_SUB_PLAN = 33 } export declare enum Subparser { CLPathExactIn = 0, CLPathExactOut = 1 } export declare enum Parser { Abi = 0, CLActions = 1 } export declare type ParamType = { readonly name: string; readonly type: string; readonly subparser?: Subparser; }; export declare type CommandDefinition = { parser: Parser.Abi; params: ParamType[]; } | { parser: Parser.CLActions; }; export declare const COMMAND_DEFINITION: { [key in CommandType]: CommandDefinition; }; export declare class RoutePlanner { commands: string; inputs: string[]; constructor(); addSubPlan(subplan: RoutePlanner): RoutePlanner; addCommand(type: CommandType, parameters: any[], allowRevert?: boolean): RoutePlanner; } export declare type RouterCommand = { type: CommandType; encodedInput: string; }; export declare function createCommand(type: CommandType, parameters: any[]): RouterCommand;