@lifi/composer-sdk
Version:
Public Composer SDK for building and submitting flows
100 lines (95 loc) • 5.15 kB
TypeScript
export { AbiTypeToOutputKind, Address, InputDecl, InputSchema, InputSpecOf, IntegerString, IntegerStringInput, OutputKind, TypedGuard, TypedRef } from './types.js';
export { GetZapPacksOptions, ZapPackEdge, ZapPackOverview } from './discovery.js';
export { ComposeError, ComposeErrorCode, isComposeError } from './errors.js';
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.js';
export { ref } from './authoring/raw.js';
export { AnyBindable, FlowOptions, TypedFlow } from './authoring/FlowBuilderCore.js';
export { ComposeRunInput, materialiser } from './run/inputs.js';
export { ComposeSdk, ComposeSdkOptions, FlowBuilder, createComposeSdk } from './sdk.js';
import { g as guardsMod } from './guards.generated-BPLFwe7y.js';
import { m as materialisersMod } from './materialisers.generated-BMkBQgWZ.js';
import { p as preconditionsMod } from './preconditions.generated-U7YpVh30.js';
import { r as rawMod } from './raw-IxCF_bSS.js';
import { r as resourcesMod } from './resources-CYis1_DS.js';
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.js';
import './client.js';
import './generated/operations.generated.js';
import './authoring/signatureArgs.js';
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 };