UNPKG

@lifi/composer-sdk

Version:

Public Composer SDK for building and submitting flows

547 lines (498 loc) 11.1 kB
// AUTO-GENERATED from manifest.json do not edit by hand. // Regenerate with: yarn workspace @lifi/composer-sdk generate import type { Address, IntegerStringInput } from '../types.js'; export interface CoreSplitConfig { bps: number; } /** * a positive number */ export type Positive = 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'; token: Address; chainId: Positive; }; slippage?: number; 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; }; } export interface InvariantNumericConfig { op: 'gte' | 'gt' | 'lte' | 'lt' | 'eq' | 'neq'; threshold: IntegerStringInput; } export interface InvariantNumericInRangeConfig { min: IntegerStringInput; max: IntegerStringInput; } export interface CoreBpsDownConfig { bps: number; } export interface CoreBpsUpConfig { bps: number; } export interface CoreApproveConfig { spender: Address; } export interface CoreBalanceOfConfig { token: Address; owner?: Address; } export interface CoreTransferConfig { amount?: IntegerStringInput; } export interface CoreEmitEvent1Config { signature: string; } export interface CoreEmitEvent2Config { signature: string; } export interface CoreEmitEvent3Config { signature: string; } export interface CoreEmitEvent4Config { signature: string; } export interface CoreCallConfig { target: Address; functionSignature: string; callType?: 'Call' | 'ValueCall'; args?: Unknown[]; approvals?: { spender: Address; }[]; } export interface Unknown { [k: string]: unknown; } export interface CoreStaticCallConfig { target: Address; functionSignature: string; args?: Unknown[]; } 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?: Unknown[]; } export interface CoreAsResourceConfig { resource: | { kind: 'native'; chainId: Positive; } | { kind: 'erc20'; token: Address; chainId: Positive; }; } export interface AaveBorrowConfig { pool: string; asset: string; variableDebtToken: string; amount: IntegerStringInput; referralId?: number; } export type AaveRepayConfig = | { pool: string; mode: 'exact'; } | { pool: string; mode: 'max'; }; export interface AaveRepayWithATokensConfig { pool: string; asset: string; } export interface AaveClaimRewardsConfig { rewardsController: string; assets: string[]; reward: string; amount?: IntegerStringInput; to?: string; } /** * a number between 0 and 255 */ export type Between0255 = number; export interface AaveSetEModeConfig { pool: string; category: Between0255; } export interface AaveGetHealthFactorConfig { pool: string; user?: string; } export type MorphoBlueSupplyCollateralConfig = | ( | { morpho?: string; onBehalfOf?: string; mode: 'exact'; /** * a string matching the pattern ^0x[0-9a-fA-F]{64}$ */ marketId: string; } | { morpho?: string; onBehalfOf?: string; mode: 'exact'; marketParams: { loanToken: string; collateralToken: string; oracle: string; irm: string; lltv: string; }; } ) | ( | { morpho?: string; onBehalfOf?: string; mode: 'all'; /** * a string matching the pattern ^0x[0-9a-fA-F]{64}$ */ marketId: string; } | { morpho?: string; onBehalfOf?: string; mode: 'all'; marketParams: { loanToken: string; collateralToken: string; oracle: string; irm: string; lltv: string; }; } ); export type MorphoBlueWithdrawCollateralConfig = | { morpho?: string; amount: IntegerStringInput; onBehalfOf?: string; receiver?: string; /** * a string matching the pattern ^0x[0-9a-fA-F]{64}$ */ marketId: string; } | { morpho?: string; amount: IntegerStringInput; onBehalfOf?: string; receiver?: string; marketParams: { loanToken: string; collateralToken: string; oracle: string; irm: string; lltv: string; }; }; export type MorphoBlueBorrowConfig = | { morpho?: string; amount: IntegerStringInput; onBehalfOf?: string; receiver?: string; /** * a string matching the pattern ^0x[0-9a-fA-F]{64}$ */ marketId: string; } | { morpho?: string; amount: IntegerStringInput; onBehalfOf?: string; receiver?: string; marketParams: { loanToken: string; collateralToken: string; oracle: string; irm: string; lltv: string; }; }; export type MorphoBlueRepayConfig = | ( | { morpho?: string; mode: 'exact'; /** * a string matching the pattern ^0x[0-9a-fA-F]{64}$ */ marketId: string; } | { morpho?: string; mode: 'exact'; marketParams: { loanToken: string; collateralToken: string; oracle: string; irm: string; lltv: string; }; } ) | ( | { morpho?: string; mode: 'max'; /** * a string matching the pattern ^0x[0-9a-fA-F]{64}$ */ marketId: string; } | { morpho?: string; mode: 'max'; marketParams: { loanToken: string; collateralToken: string; oracle: string; irm: string; lltv: string; }; } ); export type MorphoBlueSupplyConfig = | { morpho?: string; onBehalfOf?: string; /** * a string matching the pattern ^0x[0-9a-fA-F]{64}$ */ marketId: string; } | { morpho?: string; onBehalfOf?: string; marketParams: { loanToken: string; collateralToken: string; oracle: string; irm: string; lltv: string; }; }; export type MorphoBlueWithdrawConfig = | ( | { morpho?: string; mode: 'exact'; amount: IntegerStringInput; onBehalfOf?: string; receiver?: string; /** * a string matching the pattern ^0x[0-9a-fA-F]{64}$ */ marketId: string; } | { morpho?: string; mode: 'exact'; amount: IntegerStringInput; onBehalfOf?: string; receiver?: string; marketParams: { loanToken: string; collateralToken: string; oracle: string; irm: string; lltv: string; }; } ) | ( | { morpho?: string; mode: 'max'; onBehalfOf?: string; receiver?: string; /** * a string matching the pattern ^0x[0-9a-fA-F]{64}$ */ marketId: string; } | { morpho?: string; mode: 'max'; onBehalfOf?: string; receiver?: string; marketParams: { loanToken: string; collateralToken: string; oracle: string; irm: string; lltv: string; }; } ); export type MorphoBlueGetPositionConfig = | { morpho?: string; user?: string; /** * a string matching the pattern ^0x[0-9a-fA-F]{64}$ */ marketId: string; } | { morpho?: string; user?: string; marketParams: { loanToken: string; collateralToken: string; oracle: string; irm: string; lltv: string; }; }; export interface LifiFlashloanRepayConfig { leg: string; fee?: string; } export interface LifiZapConfig { resourceOut: | { kind: 'native'; chainId: Positive; } | { kind: 'erc20'; token: Address; chainId: Positive; }; } /** * a non-negative number */ export type GreaterThanOrEqualTo0 = number; /** * a number between 0 and 10000 */ export type Between010000 = number; export interface ParaswapBuyConfig { resourceOut: | { kind: 'native'; chainId: Positive; } | { kind: 'erc20'; token: Address; chainId: Positive; }; exactAmountOut: string; srcDecimals: GreaterThanOrEqualTo0; destDecimals: GreaterThanOrEqualTo0; maxSlippageBps?: Between010000; partner?: string; partnerAddress?: string; /** * Integrator fee in basis points; non-negative integer string capped at 9000. */ partnerFeeBps?: string; } export interface CorePeekConfig { target: Address; functionSignature: string; args?: string[]; } export interface SlippageGuardConfig { port: string; bps: Between010000; } export interface CoreNumericInvariantGuardConfig { port: string; op: 'gte' | 'gt' | 'lte' | 'lt' | 'eq' | 'neq'; threshold: IntegerStringInput; } export interface BalanceOfMaterialiserConfig { owner: Address; } export type DirectDepositMaterialiserConfig = | { amount: IntegerStringInput; allowNonExact?: false; } | { amount: IntegerStringInput; allowNonExact: true; } | { allowNonExact: true; simAmount?: string; }; export interface CallMaterialiserConfig { 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; }