UNPKG

@lifi/composer-sdk

Version:

Public Composer SDK for building and submitting flows

100 lines (95 loc) 5.17 kB
export { AbiTypeToOutputKind, Address, InputDecl, InputSchema, InputSpecOf, IntegerString, IntegerStringInput, OutputKind, TypedGuard, TypedRef } from './types.cjs'; export { GetZapPacksOptions, ZapPackEdge, ZapPackOverview } from './discovery.cjs'; export { ComposeError, ComposeErrorCode, isComposeError } from './errors.cjs'; export { AppliedGuard, ApprovalEntry, Call, ComposeCompilePartialData, ComposeCompileRequest, ComposeCompileResult, ComposeCompileSuccessData, ComposeContinuation, ComposeErrorKind, ComposeTransactionRequest, Flow, InputSpec, MaterialiserConfigOf, MaterialiserInput, Precondition, PreconditionConfigOf, PriceImpact, Ref, Resource, SimulationPolicy, SimulationRevert, SolType, SweepTo } from '@lifi/compose-spec'; export { AnyHandle, Bindable, InputHandle, OutputHandle, ResourceInputHandle, isInputHandle, isOutputHandle } from './authoring/handles.cjs'; export { ref } from './authoring/raw.cjs'; export { AnyBindable, FlowOptions, TypedFlow } from './authoring/FlowBuilderCore.cjs'; export { ComposeRunInput, materialiser } from './run/inputs.cjs'; export { ComposeSdk, ComposeSdkOptions, FlowBuilder, createComposeSdk } from './sdk.cjs'; import { g as guardsMod } from './guards.generated-M3VAIevI.cjs'; import { m as materialisersMod } from './materialisers.generated-BWq5oePO.cjs'; import { p as preconditionsMod } from './preconditions.generated-DblS13Wq.cjs'; import { r as rawMod } from './raw-Dj_2rBSQ.cjs'; import { r as resourcesMod } from './resources-BKlFxjo8.cjs'; export { AaveBorrowConfig, AaveClaimRewardsConfig, AaveGetHealthFactorConfig, AaveRepayConfig, AaveRepayWithATokensConfig, AaveSetEModeConfig, BalanceOfMaterialiserConfig, Between010000, Between0255, CallMaterialiserConfig, CoreApproveConfig, CoreAsResourceConfig, CoreBalanceOfConfig, CoreBpsDownConfig, CoreBpsUpConfig, CoreCallConfig, CoreEmitEvent1Config, CoreEmitEvent2Config, CoreEmitEvent3Config, CoreEmitEvent4Config, CoreInvokeConfig, CoreNumericInvariantGuardConfig, CorePeekConfig, CoreRawCallConfig, CoreSplitConfig, CoreStaticCallConfig, CoreTransferConfig, DirectDepositMaterialiserConfig, Erc20AllowancePreconditionConfig, Erc20BalancePreconditionConfig, FlashloanMaterialiserConfig, GreaterThanOrEqualTo0, InvariantNumericConfig, InvariantNumericInRangeConfig, LifiFlashloanRepayConfig, LifiSwapConfig, LifiZapConfig, MaxItems50, MaxLength64, MorphoBlueBorrowConfig, MorphoBlueGetPositionConfig, MorphoBlueRepayConfig, MorphoBlueSupplyCollateralConfig, MorphoBlueSupplyConfig, MorphoBlueWithdrawCollateralConfig, MorphoBlueWithdrawConfig, NativeBalancePreconditionConfig, ParaswapBuyConfig, Positive, SlippageGuardConfig, Unknown } from './generated/config.generated.cjs'; import './client.cjs'; import './generated/operations.generated.cjs'; import './authoring/signatureArgs.cjs'; import 'abitype'; /** * `@lifi/composer-sdk` — TypeScript SDK for building and compiling * Compose flows into executable EVM calldata. * * Start by creating an SDK instance with {@link createComposeSdk}, then use * {@link ComposeSdk.flow} to build flows and compile them. * * @packageDocumentation */ /** * Guard factories for protecting operation outputs (e.g. slippage tolerance). * Pass guards to an operation's `guards` array. * * @example * ```ts * builder.lifi.swap('swap1', { * bind: { amountIn: builder.inputs.token }, * config: { resourceOut: resources.native(1) }, * guards: [guards.slippage({ port: 'amountOut', bps: 300 })], * }); * ``` */ declare const guards: typeof guardsMod; /** * Materialiser factories that tell the runtime how to resolve token input * amounts on-chain (e.g. read a wallet balance, accept a direct deposit). * * @example * ```ts * await builder.compile({ * inputs: { token: materialisers.balanceOf({}) }, * signer: '0x...', * }); * ``` */ declare const materialisers: typeof materialisersMod; /** * Precondition factories for asserting on-chain state before a flow executes * (e.g. minimum token balances, ERC-20 allowances). * * @example * ```ts * await builder.compile({ * inputs: { token: materialisers.balanceOf({}) }, * preconditions: [ * preconditions.erc20Balance({ wallet: '0x...', token: '0x...', balance: 1000n }), * ], * signer: '0x...', * }); * ``` */ declare const preconditions: typeof preconditionsMod; /** * Resource declaration helpers for defining token inputs in a flow schema. * Use {@link resources.erc20} for ERC-20 tokens and {@link resources.native} * for the chain's native coin (ETH, MATIC, etc.). * * @example * ```ts * const builder = sdk.flow(1, { * inputs: { * usdc: resources.erc20('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', 1), * eth: resources.native(1), * }, * }); * ``` */ declare const resources: typeof resourcesMod; /** * Low-level escape hatch for constructing flow nodes, guards, and materialiser * inputs without the typed builder API. Prefer the generated operation methods * on {@link FlowBuilder} and the typed `guards`/`materialisers` namespaces * for most use cases. */ declare const raw: typeof rawMod; export { guards, materialisers, preconditions, raw, resources };