UNPKG

@lifi/composer-sdk

Version:

Public Composer SDK for building and submitting flows

1,518 lines (1,439 loc) • 33.2 kB
// AUTO-GENERATED from manifest.json — do not edit by hand. // Regenerate with: yarn workspace @lifi/composer-sdk generate import type { Flow } from '@lifi/compose-spec'; import type { Address, IntegerStringInput } from '../types.js'; /** * a number between 0 and 10000 */ export type Between010000 = number; export interface CoreSplitConfig { bps: Between010000; } export interface CoreSplitAtConfig { amount: IntegerStringInput; } /** * an array of at most 16 item(s) * * @minItems 2 * @maxItems 16 */ export type MaxItems16 = | [Between19999, Between19999] | [Between19999, Between19999, Between19999] | [Between19999, Between19999, Between19999, Between19999] | [Between19999, Between19999, Between19999, Between19999, Between19999] | [ Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, ] | [ Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, ] | [ Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, ] | [ Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, ] | [ Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, ] | [ Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, ] | [ Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, ] | [ Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, ] | [ Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, ] | [ Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, ] | [ Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, Between19999, ]; /** * a number between 1 and 9999 */ export type Between19999 = number; export interface CorePartitionConfig { bps: MaxItems16; } /** * a positive number */ export type Positive = number; /** * a number between 0 and 1 */ export type Between01 = number; /** * a string at most 64 character(s) long */ export type MaxLength64 = string; /** * an array of at most 50 item(s) * * @maxItems 50 */ export type MaxItems50 = MaxLength64[]; export interface LifiSwapConfig { resourceOut: | { kind: 'native'; chainId: Positive; } | { kind: 'erc20'; /** * EVM address: 0x followed by 40 hex characters */ token: Address; chainId: Positive; }; slippage?: Between01; timing?: { swapStepTimingStrategies?: { strategy: 'minWaitTime'; minWaitTimeMs: number; startingExpectedResults: number; reduceEveryMs: number; }[]; routeTimingStrategies?: { strategy: 'minWaitTime'; minWaitTimeMs: number; startingExpectedResults: number; reduceEveryMs: number; }[]; }; exchanges?: { allow?: MaxItems50; deny?: MaxItems50; prefer?: MaxItems50; }; } /** * a string starting with "0x" */ export type StartsWith0X = string; export interface LifiBridgeConfig { resourceOut: | { kind: 'native'; chainId: Positive; } | { kind: 'erc20'; /** * EVM address: 0x followed by 40 hex characters */ token: Address; chainId: Positive; }; destination?: StartsWith0X; slippage?: Between01; timing?: { swapStepTimingStrategies?: { strategy: 'minWaitTime'; minWaitTimeMs: number; startingExpectedResults: number; reduceEveryMs: number; }[]; routeTimingStrategies?: { strategy: 'minWaitTime'; minWaitTimeMs: number; startingExpectedResults: number; reduceEveryMs: number; }[]; }; bridges?: { allow?: MaxItems50; deny?: MaxItems50; prefer?: MaxItems50; }; exchanges?: { allow?: MaxItems50; deny?: MaxItems50; prefer?: MaxItems50; }; order?: 'FASTEST' | 'CHEAPEST'; } export interface InvariantNumericConfig { op: 'gte' | 'gt' | 'lte' | 'lt' | 'eq' | 'neq'; threshold: IntegerStringInput; } export interface InvariantNumericInRangeConfig { min: IntegerStringInput; max: IntegerStringInput; } export interface InvariantGteConfig { threshold: IntegerStringInput; } export interface InvariantGtConfig { threshold: IntegerStringInput; } export interface InvariantLteConfig { threshold: IntegerStringInput; } export interface InvariantLtConfig { threshold: IntegerStringInput; } export interface InvariantEqConfig { threshold: IntegerStringInput; } export interface InvariantNeqConfig { threshold: IntegerStringInput; } /** * a non-negative number */ export type NonNegative = number; export interface CoreBpsDownConfig { bps: NonNegative; } export interface CoreBpsUpConfig { bps: NonNegative; } export interface CoreApproveConfig { /** * EVM address: 0x followed by 40 hex characters */ spender: Address; } export interface CoreBalanceOfConfig { /** * EVM address: 0x followed by 40 hex characters */ token: Address; /** * EVM address: 0x followed by 40 hex characters */ owner?: Address; } export type CoreTransferConfig = Record<string, never>; export interface CoreEmitEvent1Config { signature: string; } export interface CoreEmitEvent2Config { signature: string; } export interface CoreEmitEvent3Config { signature: string; } export interface CoreEmitEvent4Config { signature: string; } /** * a string at most 65536 character(s) long */ export type MaxLength65536 = string; export interface CoreCallConfig { target: Address; functionSignature: string; callType?: 'Call' | 'ValueCall'; args?: ( | ( | MaxLength65536 | number | boolean | { $ref: string; } ) | ( | ( | MaxLength65536 | number | boolean | { $ref: string; } ) | ( | ( | MaxLength65536 | number | boolean | { $ref: string; } ) | ( | ( | MaxLength65536 | number | boolean | { $ref: string; } ) | ( | ( | MaxLength65536 | number | boolean | { $ref: string; } ) | ( | MaxLength65536 | number | boolean | { $ref: string; } )[] )[] )[] )[] )[] )[]; approvals?: ( | { spender: Address; } | { from: 'sender'; } )[]; } export interface CoreStaticCallConfig { target: Address; functionSignature: string; args?: ( | ( | MaxLength65536 | number | boolean | { $ref: string; } ) | ( | ( | MaxLength65536 | number | boolean | { $ref: string; } ) | ( | ( | MaxLength65536 | number | boolean | { $ref: string; } ) | ( | ( | MaxLength65536 | number | boolean | { $ref: string; } ) | ( | ( | MaxLength65536 | number | boolean | { $ref: string; } ) | ( | MaxLength65536 | number | boolean | { $ref: string; } )[] )[] )[] )[] )[] )[]; } export interface CoreRawCallConfig { target: Address; calldata: string; callType?: 'Call' | 'StaticCall' | 'ValueCall' | 'DelegateCall'; resultType?: string; } export interface CoreInvokeConfig { target: Address; functionSignature: string; callType?: 'Call' | 'ValueCall'; args?: ( | ( | MaxLength65536 | number | boolean | { $ref: string; } ) | ( | ( | MaxLength65536 | number | boolean | { $ref: string; } ) | ( | ( | MaxLength65536 | number | boolean | { $ref: string; } ) | ( | ( | MaxLength65536 | number | boolean | { $ref: string; } ) | ( | ( | MaxLength65536 | number | boolean | { $ref: string; } ) | ( | MaxLength65536 | number | boolean | { $ref: string; } )[] )[] )[] )[] )[] )[]; } export interface CoreAsResourceConfig { resource: | { kind: 'native'; chainId: Positive; } | { kind: 'erc20'; /** * EVM address: 0x followed by 40 hex characters */ token: Address; chainId: Positive; }; } export interface AaveBorrowConfig { /** * EVM address: 0x followed by 40 hex characters */ pool: string; /** * EVM address: 0x followed by 40 hex characters */ asset: string; /** * EVM address: 0x followed by 40 hex characters */ variableDebtToken: string; amount: IntegerStringInput; referralId?: number; } export type AaveRepayConfig = | { /** * EVM address: 0x followed by 40 hex characters */ pool: string; mode: 'exact'; } | { /** * EVM address: 0x followed by 40 hex characters */ pool: string; mode: 'max'; }; export interface AaveRepayWithATokensConfig { /** * EVM address: 0x followed by 40 hex characters */ pool: string; /** * EVM address: 0x followed by 40 hex characters */ asset: string; } export interface AaveClaimRewardsConfig { /** * EVM address: 0x followed by 40 hex characters */ rewardsController: string; assets: string[]; /** * EVM address: 0x followed by 40 hex characters */ reward: string; amount?: IntegerStringInput; /** * EVM address: 0x followed by 40 hex characters */ to?: string; } /** * a number between 0 and 255 */ export type Between0255 = number; export interface AaveSetEModeConfig { /** * EVM address: 0x followed by 40 hex characters */ pool: string; category: Between0255; } export interface AaveGetHealthFactorConfig { /** * EVM address: 0x followed by 40 hex characters */ pool: string; /** * EVM address: 0x followed by 40 hex characters */ user?: string; } export type MorphoBlueSupplyCollateralConfig = | ( | { /** * EVM address: 0x followed by 40 hex characters */ morpho?: string; /** * EVM address: 0x followed by 40 hex characters */ onBehalfOf?: string; mode: 'exact'; /** * a string matching the pattern ^0x[0-9a-fA-F]{64}$ */ marketId: string; } | { /** * EVM address: 0x followed by 40 hex characters */ morpho?: string; /** * EVM address: 0x followed by 40 hex characters */ onBehalfOf?: string; mode: 'exact'; marketParams: { /** * EVM address: 0x followed by 40 hex characters */ loanToken: string; /** * EVM address: 0x followed by 40 hex characters */ collateralToken: string; /** * EVM address: 0x followed by 40 hex characters */ oracle: string; /** * EVM address: 0x followed by 40 hex characters */ irm: string; lltv: string; }; } ) | ( | { /** * EVM address: 0x followed by 40 hex characters */ morpho?: string; /** * EVM address: 0x followed by 40 hex characters */ onBehalfOf?: string; mode: 'all'; /** * a string matching the pattern ^0x[0-9a-fA-F]{64}$ */ marketId: string; } | { /** * EVM address: 0x followed by 40 hex characters */ morpho?: string; /** * EVM address: 0x followed by 40 hex characters */ onBehalfOf?: string; mode: 'all'; marketParams: { /** * EVM address: 0x followed by 40 hex characters */ loanToken: string; /** * EVM address: 0x followed by 40 hex characters */ collateralToken: string; /** * EVM address: 0x followed by 40 hex characters */ oracle: string; /** * EVM address: 0x followed by 40 hex characters */ irm: string; lltv: string; }; } ); export type MorphoBlueWithdrawCollateralConfig = | { /** * EVM address: 0x followed by 40 hex characters */ morpho?: string; amount: IntegerStringInput; /** * EVM address: 0x followed by 40 hex characters */ onBehalfOf?: string; /** * EVM address: 0x followed by 40 hex characters */ receiver?: string; /** * a string matching the pattern ^0x[0-9a-fA-F]{64}$ */ marketId: string; } | { /** * EVM address: 0x followed by 40 hex characters */ morpho?: string; amount: IntegerStringInput; /** * EVM address: 0x followed by 40 hex characters */ onBehalfOf?: string; /** * EVM address: 0x followed by 40 hex characters */ receiver?: string; marketParams: { /** * EVM address: 0x followed by 40 hex characters */ loanToken: string; /** * EVM address: 0x followed by 40 hex characters */ collateralToken: string; /** * EVM address: 0x followed by 40 hex characters */ oracle: string; /** * EVM address: 0x followed by 40 hex characters */ irm: string; lltv: string; }; }; export type MorphoBlueBorrowConfig = | { /** * EVM address: 0x followed by 40 hex characters */ morpho?: string; amount: IntegerStringInput; /** * EVM address: 0x followed by 40 hex characters */ onBehalfOf?: string; /** * EVM address: 0x followed by 40 hex characters */ receiver?: string; /** * a string matching the pattern ^0x[0-9a-fA-F]{64}$ */ marketId: string; } | { /** * EVM address: 0x followed by 40 hex characters */ morpho?: string; amount: IntegerStringInput; /** * EVM address: 0x followed by 40 hex characters */ onBehalfOf?: string; /** * EVM address: 0x followed by 40 hex characters */ receiver?: string; marketParams: { /** * EVM address: 0x followed by 40 hex characters */ loanToken: string; /** * EVM address: 0x followed by 40 hex characters */ collateralToken: string; /** * EVM address: 0x followed by 40 hex characters */ oracle: string; /** * EVM address: 0x followed by 40 hex characters */ irm: string; lltv: string; }; }; export type MorphoBlueRepayConfig = | ( | { /** * EVM address: 0x followed by 40 hex characters */ morpho?: string; mode: 'exact'; /** * a string matching the pattern ^0x[0-9a-fA-F]{64}$ */ marketId: string; } | { /** * EVM address: 0x followed by 40 hex characters */ morpho?: string; mode: 'exact'; marketParams: { /** * EVM address: 0x followed by 40 hex characters */ loanToken: string; /** * EVM address: 0x followed by 40 hex characters */ collateralToken: string; /** * EVM address: 0x followed by 40 hex characters */ oracle: string; /** * EVM address: 0x followed by 40 hex characters */ irm: string; lltv: string; }; } ) | ( | { /** * EVM address: 0x followed by 40 hex characters */ morpho?: string; mode: 'max'; /** * a string matching the pattern ^0x[0-9a-fA-F]{64}$ */ marketId: string; } | { /** * EVM address: 0x followed by 40 hex characters */ morpho?: string; mode: 'max'; marketParams: { /** * EVM address: 0x followed by 40 hex characters */ loanToken: string; /** * EVM address: 0x followed by 40 hex characters */ collateralToken: string; /** * EVM address: 0x followed by 40 hex characters */ oracle: string; /** * EVM address: 0x followed by 40 hex characters */ irm: string; lltv: string; }; } ); export type MorphoBlueSupplyConfig = | { /** * EVM address: 0x followed by 40 hex characters */ morpho?: string; /** * EVM address: 0x followed by 40 hex characters */ onBehalfOf?: string; /** * a string matching the pattern ^0x[0-9a-fA-F]{64}$ */ marketId: string; } | { /** * EVM address: 0x followed by 40 hex characters */ morpho?: string; /** * EVM address: 0x followed by 40 hex characters */ onBehalfOf?: string; marketParams: { /** * EVM address: 0x followed by 40 hex characters */ loanToken: string; /** * EVM address: 0x followed by 40 hex characters */ collateralToken: string; /** * EVM address: 0x followed by 40 hex characters */ oracle: string; /** * EVM address: 0x followed by 40 hex characters */ irm: string; lltv: string; }; }; export type MorphoBlueWithdrawConfig = | ( | { /** * EVM address: 0x followed by 40 hex characters */ morpho?: string; mode: 'exact'; amount: IntegerStringInput; /** * EVM address: 0x followed by 40 hex characters */ onBehalfOf?: string; /** * EVM address: 0x followed by 40 hex characters */ receiver?: string; /** * a string matching the pattern ^0x[0-9a-fA-F]{64}$ */ marketId: string; } | { /** * EVM address: 0x followed by 40 hex characters */ morpho?: string; mode: 'exact'; amount: IntegerStringInput; /** * EVM address: 0x followed by 40 hex characters */ onBehalfOf?: string; /** * EVM address: 0x followed by 40 hex characters */ receiver?: string; marketParams: { /** * EVM address: 0x followed by 40 hex characters */ loanToken: string; /** * EVM address: 0x followed by 40 hex characters */ collateralToken: string; /** * EVM address: 0x followed by 40 hex characters */ oracle: string; /** * EVM address: 0x followed by 40 hex characters */ irm: string; lltv: string; }; } ) | ( | { /** * EVM address: 0x followed by 40 hex characters */ morpho?: string; mode: 'max'; /** * EVM address: 0x followed by 40 hex characters */ onBehalfOf?: string; /** * EVM address: 0x followed by 40 hex characters */ receiver?: string; /** * a string matching the pattern ^0x[0-9a-fA-F]{64}$ */ marketId: string; } | { /** * EVM address: 0x followed by 40 hex characters */ morpho?: string; mode: 'max'; /** * EVM address: 0x followed by 40 hex characters */ onBehalfOf?: string; /** * EVM address: 0x followed by 40 hex characters */ receiver?: string; marketParams: { /** * EVM address: 0x followed by 40 hex characters */ loanToken: string; /** * EVM address: 0x followed by 40 hex characters */ collateralToken: string; /** * EVM address: 0x followed by 40 hex characters */ oracle: string; /** * EVM address: 0x followed by 40 hex characters */ irm: string; lltv: string; }; } ); export type MorphoBlueGetPositionConfig = | { /** * EVM address: 0x followed by 40 hex characters */ morpho?: string; /** * EVM address: 0x followed by 40 hex characters */ user?: string; /** * a string matching the pattern ^0x[0-9a-fA-F]{64}$ */ marketId: string; } | { /** * EVM address: 0x followed by 40 hex characters */ morpho?: string; /** * EVM address: 0x followed by 40 hex characters */ user?: string; marketParams: { /** * EVM address: 0x followed by 40 hex characters */ loanToken: string; /** * EVM address: 0x followed by 40 hex characters */ collateralToken: string; /** * EVM address: 0x followed by 40 hex characters */ oracle: string; /** * EVM address: 0x followed by 40 hex characters */ irm: string; lltv: string; }; }; export interface LifiFlashloanRepayConfig { leg: string; fee?: string; } export interface LifiZapConfig { resourceOut: | { kind: 'native'; chainId: Positive; } | { kind: 'erc20'; /** * EVM address: 0x followed by 40 hex characters */ token: Address; chainId: Positive; }; } export interface LifiZapAsyncConfig { resourceOut: | { kind: 'native'; chainId: Positive; } | { kind: 'erc20'; /** * EVM address: 0x followed by 40 hex characters */ token: Address; chainId: Positive; }; } export interface ParaswapBuyConfig { resourceOut: | { kind: 'native'; chainId: Positive; } | { kind: 'erc20'; /** * EVM address: 0x followed by 40 hex characters */ token: Address; chainId: Positive; }; exactAmountOut: string; srcDecimals: NonNegative; destDecimals: NonNegative; maxSlippageBps?: Between010000; partner?: string; /** * EVM address: 0x followed by 40 hex characters */ partnerAddress?: string; /** * Paraswap partner fee in basis points; non-negative integer string capped at 9000. */ partnerFeeBps?: string; } export interface CorePeekConfig { /** * EVM address: 0x followed by 40 hex characters */ target: Address; functionSignature: string; args?: ( | MaxLength65536 | ( | MaxLength65536 | ( | MaxLength65536 | (MaxLength65536 | (MaxLength65536 | MaxLength65536[])[])[] )[] )[] )[]; } /** * a number between 0 and 3318 */ export type Between03318 = number; /** * a number between 0 and 5000 */ export type Between05000 = number; export interface FlySwapConfig { resourceOut: | { kind: 'native'; chainId: Positive; } | { kind: 'erc20'; /** * EVM address: 0x followed by 40 hex characters */ token: Address; chainId: Positive; }; inputVarianceBps?: Between03318; maxSlippageBps?: Between05000; } /** * a number between -8640000000000000 and 8640000000000000 */ export type Between86400000000000008640000000000000 = number; export interface ContinuationSettleConfig { outcomes: { /** * EVM address: 0x followed by 40 hex characters */ token: Address; minAmount?: IntegerStringInput; /** * EVM address: 0x followed by 40 hex characters */ destination: Address; chainId: Positive; }[]; continuationFlow?: Flow; validity: { expiresAtMs: Between86400000000000008640000000000000; }; provider?: string; funding?: 'inline' | 'external'; /** * EVM address: 0x followed by 40 hex characters */ refund?: Address; exact?: boolean; } export interface UniswapV2AddLiquidityConfig { /** * EVM address: 0x followed by 40 hex characters */ router: string; /** * EVM address: 0x followed by 40 hex characters */ factory: string; /** * EVM address: 0x followed by 40 hex characters */ pair: string; } export interface UniswapV2RemoveLiquidityConfig { /** * EVM address: 0x followed by 40 hex characters */ router: string; /** * EVM address: 0x followed by 40 hex characters */ factory: string; /** * EVM address: 0x followed by 40 hex characters */ tokenA: string; /** * EVM address: 0x followed by 40 hex characters */ tokenB: string; } /** * a number between 0 and 999999 */ export type Between0999999 = number; /** * a number between -887272 and 887272 */ export type Between887272887272 = number; export interface UniswapV3MintConfig { /** * EVM address: 0x followed by 40 hex characters */ positionManager: string; /** * EVM address: 0x followed by 40 hex characters */ factory: string; /** * EVM address: 0x followed by 40 hex characters */ pool: string; fee: Between0999999; tickLower: Between887272887272; tickUpper: Between887272887272; } export interface UniswapV3IncreaseLiquidityConfig { /** * EVM address: 0x followed by 40 hex characters */ positionManager: string; /** * EVM address: 0x followed by 40 hex characters */ factory: string; /** * EVM address: 0x followed by 40 hex characters */ pool: string; tokenId: string; } /** * a number less than 1 */ export type LessThan1 = number; /** * a number between 1 and 300 */ export type Between1300 = number; /** * a number between 0 and 120 */ export type Between0120 = number; export interface LifiIntentsOrderConfig { resourceOut: | { kind: 'native'; chainId: Positive; } | { kind: 'erc20'; /** * EVM address: 0x followed by 40 hex characters */ token: Address; chainId: Positive; }; destination?: StartsWith0X; slippage?: LessThan1; validitySeconds?: Between1300; exclusiveSeconds?: Between0120; exactAmountOut?: string; } export interface LifiIntentsRefundConfig { /** * The order id: lifiIntents.order's delivery.trackingId, or topic1 of the escrow's Open log */ orderId: string; } export interface LifiIntentsAttestNonFillConfig { /** * The order id: lifiIntents.order's delivery.trackingId, or topic1 of the escrow's Open log */ orderId: string; } export interface LifiIntentsRefundOnNonFillConfig { /** * The order id: lifiIntents.order's delivery.trackingId, or topic1 of the escrow's Open log */ orderId: string; /** * The output-chain transaction of lifiIntents.attestNonFill */ attestationTxHash: string; } export interface SlippageGuardConfig { port: string; bps: Between010000; } export interface CoreNumericInvariantGuardConfig { port: string; op: 'gte' | 'gt' | 'lte' | 'lt' | 'eq' | 'neq'; threshold: IntegerStringInput; } export interface BandGuardConfig { port: string; bps: Between010000; } export interface BalanceOfMaterialiserConfig { /** * EVM address: 0x followed by 40 hex characters */ owner: Address; } export type DirectDepositMaterialiserConfig = | { amount: IntegerStringInput; allowNonExact?: false; } | { amount: IntegerStringInput; allowNonExact: true; } | { allowNonExact: true; simAmount?: string; minAmount?: IntegerStringInput; }; export interface CallMaterialiserConfig { /** * EVM address: 0x followed by 40 hex characters */ target: Address; calldata: string; } export interface FlashloanMaterialiserConfig { providerKind: 'aave-v3' | 'erc3156' | 'balancer-v2' | 'morpho-blue'; amount: IntegerStringInput; } export interface Erc20BalancePreconditionConfig { wallet: Address; token: Address; balance: IntegerStringInput; } export interface NativeBalancePreconditionConfig { wallet: Address; balance: IntegerStringInput; } export interface Erc20AllowancePreconditionConfig { owner: Address; spender: Address; token: Address; allowance: IntegerStringInput; }