@lifi/composer-sdk
Version:
Public Composer SDK for building and submitting flows
120 lines (115 loc) • 6.68 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, ComposePreparationOps, isComposeError, isComposePreparationError } from './errors.js';
export { AppliedGuard, ApprovalEntry, Call, Check, CheckComparator, ComposeCompilePartialData, ComposeCompileRequest, ComposeCompileResult, ComposeCompileSuccessData, ComposeContinuation, ComposeErrorKind, ComposeRouteRequest, ComposeTransactionRequest, ContinuationIntent, ContinuationOutcome, ContinuationPlanWire, Erc20AllowanceRequirement, Erc20BalanceRequirement, FailedPreparedOp, Flow, InputSpec, MaterialiserConfigOf, MaterialiserInput, NativeBalanceRequirement, Phase1ArtifactWire, Precondition, PreconditionConfigOf, PriceImpact, Ref, Resource, RouteAmount, RouteAmountAll, RouteAmountExact, SIMULATE_MAX_REQUIREMENTS, SIMULATE_MAX_TRACKED_BALANCES, SimulateBalanceEntry, SimulateOkResult, SimulateRequest, SimulateResult, SimulateRevertDecodeResult, SimulateRevertResult, SimulateSetupErrorResult, SimulationPolicy, SimulationRevert, SlotFinderRequirement, SolType, SweepTo, TrackedBalance } 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 { BuildSimulateRequestInput, buildSimulateRequest } from './run/simulate.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';
import { r as routeAmountMod } from './routeAmount-DdbJYJyM.js';
export { AaveBorrowConfig, AaveClaimRewardsConfig, AaveGetHealthFactorConfig, AaveRepayConfig, AaveRepayWithATokensConfig, AaveSetEModeConfig, BalanceOfMaterialiserConfig, Between010000, Between0255, CallMaterialiserConfig, ContinuationAssertReadyConfig, CoreApproveConfig, CoreAsResourceConfig, CoreBalanceOfConfig, CoreBpsDownConfig, CoreBpsUpConfig, CoreCallConfig, CoreEmitEvent1Config, CoreEmitEvent2Config, CoreEmitEvent3Config, CoreEmitEvent4Config, CoreInvokeConfig, CoreNumericInvariantGuardConfig, CorePeekConfig, CoreRawCallConfig, CoreSplitConfig, CoreStaticCallConfig, CoreTransferConfig, DirectDepositMaterialiserConfig, Erc20AllowancePreconditionConfig, Erc20BalancePreconditionConfig, FlashloanMaterialiserConfig, InvariantEqConfig, InvariantGtConfig, InvariantGteConfig, InvariantLtConfig, InvariantLteConfig, InvariantNeqConfig, InvariantNumericConfig, InvariantNumericInRangeConfig, LifiFlashloanRepayConfig, LifiSwapConfig, LifiZapAsyncConfig, LifiZapConfig, MaxItems50, MaxLength64, MaxLength65536, MorphoBlueBorrowConfig, MorphoBlueGetPositionConfig, MorphoBlueRepayConfig, MorphoBlueSupplyCollateralConfig, MorphoBlueSupplyConfig, MorphoBlueWithdrawCollateralConfig, MorphoBlueWithdrawConfig, NativeBalancePreconditionConfig, NonNegative, ParaswapBuyConfig, Positive, SlippageGuardConfig, StartsWith0X } 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;
/**
* Amount constructors for {@link ComposeSdk.route}. Use
* {@link routeAmount.exact} to spend a fixed amount of the `fromToken`, and
* {@link routeAmount.all} to spend the signer's whole balance.
*
* @example
* ```ts
* // USDC into the Aave v3 aEthUSDC position — one routing-catalog edge.
* const result = await sdk.route({
* chainId: 1,
* fromToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
* toToken: '0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c',
* amount: routeAmount.exact(1_000_000n),
* signer: '0xYourAddress...',
* });
* ```
*/
declare const routeAmount: typeof routeAmountMod;
/**
* 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, routeAmount };