@lifi/composer-sdk 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -365,7 +365,8 @@ switch (result.status) {
365
365
  }
366
366
  ```
367
367
 
368
- - `requirements` entries are `Erc20Balance`, `NativeBalance`, or `Erc20Allowance`. Use the zero address as a `trackedBalances` token to watch the native balance.
368
+ - `requirements` entries are `Erc20Balance`, `NativeBalance`, `Erc20Allowance`, or `Permit2Allowance`. Use the zero address as a `trackedBalances` token to watch the native balance.
369
+ - `Permit2Allowance` (`owner`, `token`, `spender`, `amount`) lets `spender` pull `token` from `owner` through Uniswap Permit2's `transferFrom`. The simulation also grants the ERC-20 allowance `owner` → Permit2, but not the owner's balance: fund it with an `Erc20Balance`. Only the canonical Permit2 address `0x000000000022D473030F116dDEE9F6B43aC78BA3` is supported; on a chain without it, `simulate` returns `status: 'error'` with a message that names Permit2 and the chain.
369
370
  - Amount fields accept `bigint` or decimal strings.
370
371
  - `SIMULATE_MAX_TRACKED_BALANCES` and `SIMULATE_MAX_REQUIREMENTS` (both `40`) are exported.
371
372
  - A `revert` is returned, not thrown. Only transport failures and HTTP 400/401/403/404/429/5xx throw `ComposeError`.
@@ -519,6 +520,7 @@ Each file in `src/examples/` is a complete flow:
519
520
  - **simulateRawTransaction** / **simulateCompiledSwap**: raw and compiled simulation
520
521
  - **continuationSettle**: swap USDC to WETH on Base, then escrow the WETH for a deferred settlement whose leg supplies it to Aave and delivers the aBasWETH position
521
522
  - **continuationBridgeSettle**: bridge USDC from Arbitrum into a settle escrow on Base; when the delivery lands, the leg supplies it to Aave and delivers the aBasUSDC position
523
+ - **continuationExactInvoice**: escrow USDC on Base for an exact leg (`exact: true`) that pays a Request Network invoice through `core.call` and returns the surplus; a second builder funds the same leg from a WETH-to-USDC swap, and a third from Arbitrum ETH swapped to USDC and delivered by an exact-output `lifiIntents.order` (`exactAmountOut`) into the escrow at exactly the invoice total, with no outcome (`outcomes: []`)
522
524
 
523
525
  ## Staging channel
524
526
 
package/dist/client.cjs CHANGED
@@ -3,7 +3,7 @@ const require_responseSchemas = require("./responseSchemas.cjs");
3
3
  const require_errors = require("./errors.cjs");
4
4
  let _lifi_compose_spec = require("@lifi/compose-spec");
5
5
  //#region src/client.ts
6
- const SDK_VERSION = "0.12.0";
6
+ const SDK_VERSION = "0.13.0";
7
7
  const SDK_VERSION_TRIPLE = (0, _lifi_compose_spec.parseVersion)(SDK_VERSION);
8
8
  /**
9
9
  * `JSON.stringify` replacer that renders `bigint` amounts as decimal strings.
package/dist/client.js CHANGED
@@ -2,7 +2,7 @@ import { parseCompilePartialEnvelope, parseSimulateResult } from "./responseSche
2
2
  import { ComposeError, errorFromHttpResponse } from "./errors.js";
3
3
  import { COMPOSER_SDK_VERSION_HEADER, COMPOSE_VERSION_HEADER, checkCompatibility, parseVersion } from "@lifi/compose-spec";
4
4
  //#region src/client.ts
5
- const SDK_VERSION = "0.12.0";
5
+ const SDK_VERSION = "0.13.0";
6
6
  const SDK_VERSION_TRIPLE = parseVersion(SDK_VERSION);
7
7
  /**
8
8
  * `JSON.stringify` replacer that renders `bigint` amounts as decimal strings.
@@ -885,21 +885,7 @@ export interface FlySwapConfig {
885
885
  */
886
886
  export type Between86400000000000008640000000000000 = number;
887
887
  export interface ContinuationSettleConfig {
888
- /**
889
- * @minItems 1
890
- */
891
- outcomes: [{
892
- /**
893
- * EVM address: 0x followed by 40 hex characters
894
- */
895
- token: Address;
896
- minAmount?: IntegerStringInput;
897
- /**
898
- * EVM address: 0x followed by 40 hex characters
899
- */
900
- destination: Address;
901
- chainId: Positive;
902
- }, ...{
888
+ outcomes: {
903
889
  /**
904
890
  * EVM address: 0x followed by 40 hex characters
905
891
  */
@@ -910,7 +896,7 @@ export interface ContinuationSettleConfig {
910
896
  */
911
897
  destination: Address;
912
898
  chainId: Positive;
913
- }[]];
899
+ }[];
914
900
  continuationFlow?: Flow;
915
901
  validity: {
916
902
  expiresAtMs: Between86400000000000008640000000000000;
@@ -1023,6 +1009,7 @@ export interface LifiIntentsOrderConfig {
1023
1009
  slippage?: LessThan1;
1024
1010
  validitySeconds?: Between1300;
1025
1011
  exclusiveSeconds?: Between0120;
1012
+ exactAmountOut?: string;
1026
1013
  }
1027
1014
  export interface LifiIntentsRefundConfig {
1028
1015
  /**
@@ -885,21 +885,7 @@ export interface FlySwapConfig {
885
885
  */
886
886
  export type Between86400000000000008640000000000000 = number;
887
887
  export interface ContinuationSettleConfig {
888
- /**
889
- * @minItems 1
890
- */
891
- outcomes: [{
892
- /**
893
- * EVM address: 0x followed by 40 hex characters
894
- */
895
- token: Address;
896
- minAmount?: IntegerStringInput;
897
- /**
898
- * EVM address: 0x followed by 40 hex characters
899
- */
900
- destination: Address;
901
- chainId: Positive;
902
- }, ...{
888
+ outcomes: {
903
889
  /**
904
890
  * EVM address: 0x followed by 40 hex characters
905
891
  */
@@ -910,7 +896,7 @@ export interface ContinuationSettleConfig {
910
896
  */
911
897
  destination: Address;
912
898
  chainId: Positive;
913
- }[]];
899
+ }[];
914
900
  continuationFlow?: Flow;
915
901
  validity: {
916
902
  expiresAtMs: Between86400000000000008640000000000000;
@@ -1023,6 +1009,7 @@ export interface LifiIntentsOrderConfig {
1023
1009
  slippage?: LessThan1;
1024
1010
  validitySeconds?: Between1300;
1025
1011
  exclusiveSeconds?: Between0120;
1012
+ exactAmountOut?: string;
1026
1013
  }
1027
1014
  export interface LifiIntentsRefundConfig {
1028
1015
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["guardsMod","materialisersMod","preconditionsMod","resourcesMod","routeAmountMod","rawMod"],"sources":["../src/index.ts"],"sourcesContent":["/**\n * `@lifi/composer-sdk` — TypeScript SDK for building and compiling\n * Compose flows into executable EVM calldata.\n *\n * Start by creating an SDK instance with {@link createComposeSdk}, then use\n * {@link ComposeSdk.flow} to build flows and compile them.\n *\n * @packageDocumentation\n */\n\nexport type {\n AbiTypeToOutputKind,\n Address,\n InputDecl,\n InputSchema,\n InputSpecOf,\n IntegerString,\n IntegerStringInput,\n OutputKind,\n TypedGuard,\n TypedRef,\n TypedLiteral,\n} from './types.js';\n\nexport type {\n ChainSummary,\n GetZapPacksOptions,\n ZapPackEdge,\n ZapPackOverview,\n} from './discovery.js';\nexport type {\n Reachability,\n ReachabilityOptions,\n RoutablePair,\n TokenRef,\n} from './reachability.js';\nexport { buildReachability } from './reachability.js';\nexport type {\n ComposeError,\n ComposeErrorCode,\n ComposeSdkOutdated,\n ComposeServerOutdated,\n ComposePreparationOps,\n} from './errors.js';\nexport type {\n AppliedGuard,\n ApprovalEntry,\n Call,\n ComposeCompilePartialData,\n ComposeAction,\n ComposeFill,\n ComposeUserProgramSimulation,\n ComposeWarning,\n ComposeCompileRequest,\n ComposeCompileResult,\n ComposeCompileSuccessData,\n ComposeErrorKind,\n ComposeRouteRequest,\n ComposeTransactionRequest,\n FailedPreparedOp,\n Flow,\n InputSpec,\n MaterialiserConfigOf,\n MaterialiserInput,\n OutputAmount,\n Amount,\n ConsumedOutput,\n Delivery,\n Estimate,\n EstimateBasis,\n Minimum,\n MinimumBasis,\n Output,\n Outputs,\n TerminalOutput,\n Precondition,\n PreconditionConfigOf,\n PriceImpact,\n Ref,\n Resource,\n RouteAmount,\n RouteAmountAll,\n RouteAmountExact,\n SimulationPolicy,\n SimulationRevert,\n DeliveryErrorDetails,\n DeliveryErrorReason,\n SolType,\n ForwardTo,\n SimulateRequest,\n SimulateResult,\n SimulateOkResult,\n SimulateRevertResult,\n SimulateRevertDecodeResult,\n SimulateSetupErrorResult,\n SimulateBalanceEntry,\n TrackedBalance,\n SlotFinderRequirement,\n Erc20BalanceRequirement,\n NativeBalanceRequirement,\n Erc20AllowanceRequirement,\n ContinuationIntent,\n ContinuationOutcome,\n SettlementWire,\n SettlementEscrowWire,\n SettlementBindingWire,\n} from '@lifi/compose-spec';\nexport {\n SIMULATE_MAX_TRACKED_BALANCES,\n SIMULATE_MAX_REQUIREMENTS,\n} from '@lifi/compose-spec';\nexport {\n isComposeDeliveryError,\n isComposeError,\n isComposePreparationError,\n isComposeSdkOutdatedError,\n isComposeServerOutdatedError,\n} from './errors.js';\n\nexport type {\n Bindable,\n RefBindable,\n AnyRefBindable,\n InputHandle,\n ResourceInputHandle,\n OutputHandle,\n OutputFamilyHandles,\n FamilyCount,\n FamilySource,\n AnyHandle,\n} from './authoring/handles.js';\nexport { isInputHandle, isOutputHandle } from './authoring/handles.js';\nexport { ref } from './authoring/raw.js';\n\nexport type { AnyBindable } from './authoring/FlowBuilderCore.js';\nexport type { TypedFlow, FlowOptions } from './authoring/FlowBuilderCore.js';\n\nexport type { ComposeRunInput } from './run/inputs.js';\nexport { materialiser } from './run/inputs.js';\n\nexport { buildSimulateRequest } from './run/simulate.js';\nexport type { BuildSimulateRequestInput } from './run/simulate.js';\n\nexport { terminalOutputs } from './outputs.js';\n\nexport { createComposeSdk } from './sdk.js';\nexport type { ComposeSdk, ComposeSdkOptions, FlowBuilder } from './sdk.js';\n\nimport * as guardsMod from './generated/guards.generated.js';\nimport * as materialisersMod from './generated/materialisers.generated.js';\nimport * as preconditionsMod from './generated/preconditions.generated.js';\nimport * as rawMod from './raw.js';\nimport * as resourcesMod from './resources.js';\nimport * as routeAmountMod from './routeAmount.js';\n\n/**\n * Guard factories for protecting operation outputs (e.g. slippage tolerance).\n * Pass guards to an operation's `guards` array.\n *\n * @example\n * ```ts\n * builder.lifi.swap('swap1', {\n * bind: { amountIn: builder.inputs.token },\n * config: { resourceOut: resources.native(1) },\n * guards: [guards.slippage({ port: 'amountOut', bps: 300 })],\n * });\n * ```\n */\nexport const guards: typeof guardsMod = guardsMod;\n/**\n * Materialiser factories that tell the runtime how to resolve token input\n * amounts on-chain (e.g. read a wallet balance, accept a direct deposit).\n *\n * @example\n * ```ts\n * await builder.compile({\n * inputs: { token: materialisers.balanceOf({}) },\n * signer: '0x...',\n * });\n * ```\n */\nexport const materialisers: typeof materialisersMod = materialisersMod;\n/**\n * Precondition factories for asserting on-chain state before a flow executes\n * (e.g. minimum token balances, ERC-20 allowances).\n *\n * @example\n * ```ts\n * await builder.compile({\n * inputs: { token: materialisers.balanceOf({}) },\n * preconditions: [\n * preconditions.erc20Balance({ wallet: '0x...', token: '0x...', balance: 1000n }),\n * ],\n * signer: '0x...',\n * });\n * ```\n */\nexport const preconditions: typeof preconditionsMod = preconditionsMod;\n/**\n * Resource declaration helpers for defining token inputs in a flow schema.\n * Use {@link resources.erc20} for ERC-20 tokens and {@link resources.native}\n * for the chain's native coin (ETH, MATIC, etc.).\n *\n * @example\n * ```ts\n * const builder = sdk.flow(1, {\n * inputs: {\n * usdc: resources.erc20('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', 1),\n * eth: resources.native(1),\n * },\n * });\n * ```\n */\nexport const resources: typeof resourcesMod = resourcesMod;\n/**\n * Amount constructors for {@link ComposeSdk.route}. Use\n * {@link routeAmount.exact} to spend a fixed amount of the `fromToken`, and\n * {@link routeAmount.all} to spend the signer's whole balance.\n *\n * @example\n * ```ts\n * // USDC into the Aave v3 aEthUSDC position — one routing-catalog edge.\n * const result = await sdk.route({\n * chainId: 1,\n * fromToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',\n * toToken: '0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c',\n * amount: routeAmount.exact(1_000_000n),\n * signer: '0xYourAddress...',\n * });\n * ```\n */\nexport const routeAmount: typeof routeAmountMod = routeAmountMod;\nexport * from './generated/config.generated.js';\n\n/**\n * Low-level escape hatch for constructing flow nodes, guards, and materialiser\n * inputs without the typed builder API. Prefer the generated operation methods\n * on {@link FlowBuilder} and the typed `guards`/`materialisers` namespaces\n * for most use cases.\n */\nexport const raw: typeof rawMod = rawMod;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwKA,MAAa,SAA2BA,mCAAAA;;;;;;;;;;;;;AAaxC,MAAa,gBAAyCC,0CAAAA;;;;;;;;;;;;;;;;AAgBtD,MAAa,gBAAyCC,0CAAAA;;;;;;;;;;;;;;;;AAgBtD,MAAa,YAAiCC,kBAAAA;;;;;;;;;;;;;;;;;;AAkB9C,MAAa,cAAqCC,oBAAAA;;;;;;;AASlD,MAAa,MAAqBC,YAAAA"}
1
+ {"version":3,"file":"index.cjs","names":["guardsMod","materialisersMod","preconditionsMod","resourcesMod","routeAmountMod","rawMod"],"sources":["../src/index.ts"],"sourcesContent":["/**\n * `@lifi/composer-sdk` — TypeScript SDK for building and compiling\n * Compose flows into executable EVM calldata.\n *\n * Start by creating an SDK instance with {@link createComposeSdk}, then use\n * {@link ComposeSdk.flow} to build flows and compile them.\n *\n * @packageDocumentation\n */\n\nexport type {\n AbiTypeToOutputKind,\n Address,\n InputDecl,\n InputSchema,\n InputSpecOf,\n IntegerString,\n IntegerStringInput,\n OutputKind,\n TypedGuard,\n TypedRef,\n TypedLiteral,\n} from './types.js';\n\nexport type {\n ChainSummary,\n GetZapPacksOptions,\n ZapPackEdge,\n ZapPackOverview,\n} from './discovery.js';\nexport type {\n Reachability,\n ReachabilityOptions,\n RoutablePair,\n TokenRef,\n} from './reachability.js';\nexport { buildReachability } from './reachability.js';\nexport type {\n ComposeError,\n ComposeErrorCode,\n ComposeSdkOutdated,\n ComposeServerOutdated,\n ComposePreparationOps,\n} from './errors.js';\nexport type {\n AppliedGuard,\n ApprovalEntry,\n Call,\n ComposeCompilePartialData,\n ComposeAction,\n ComposeFill,\n ComposeUserProgramSimulation,\n ComposeWarning,\n ComposeCompileRequest,\n ComposeCompileResult,\n ComposeCompileSuccessData,\n ComposeErrorKind,\n ComposeRouteRequest,\n ComposeTransactionRequest,\n FailedPreparedOp,\n Flow,\n InputSpec,\n MaterialiserConfigOf,\n MaterialiserInput,\n OutputAmount,\n Amount,\n ConsumedOutput,\n Delivery,\n Estimate,\n EstimateBasis,\n Minimum,\n MinimumBasis,\n Output,\n Outputs,\n TerminalOutput,\n Precondition,\n PreconditionConfigOf,\n PriceImpact,\n Ref,\n Resource,\n RouteAmount,\n RouteAmountAll,\n RouteAmountExact,\n SimulationPolicy,\n SimulationRevert,\n DeliveryErrorDetails,\n DeliveryErrorReason,\n SolType,\n ForwardTo,\n SimulateRequest,\n SimulateResult,\n SimulateOkResult,\n SimulateRevertResult,\n SimulateRevertDecodeResult,\n SimulateSetupErrorResult,\n SimulateBalanceEntry,\n TrackedBalance,\n SlotFinderRequirement,\n Erc20BalanceRequirement,\n NativeBalanceRequirement,\n Erc20AllowanceRequirement,\n Permit2AllowanceRequirement,\n ContinuationIntent,\n ContinuationOutcome,\n SettlementWire,\n SettlementEscrowWire,\n SettlementBindingWire,\n} from '@lifi/compose-spec';\nexport {\n SIMULATE_MAX_TRACKED_BALANCES,\n SIMULATE_MAX_REQUIREMENTS,\n} from '@lifi/compose-spec';\nexport {\n isComposeDeliveryError,\n isComposeError,\n isComposePreparationError,\n isComposeSdkOutdatedError,\n isComposeServerOutdatedError,\n} from './errors.js';\n\nexport type {\n Bindable,\n RefBindable,\n AnyRefBindable,\n InputHandle,\n ResourceInputHandle,\n OutputHandle,\n OutputFamilyHandles,\n FamilyCount,\n FamilySource,\n AnyHandle,\n} from './authoring/handles.js';\nexport { isInputHandle, isOutputHandle } from './authoring/handles.js';\nexport { ref } from './authoring/raw.js';\n\nexport type { AnyBindable } from './authoring/FlowBuilderCore.js';\nexport type { TypedFlow, FlowOptions } from './authoring/FlowBuilderCore.js';\n\nexport type { ComposeRunInput } from './run/inputs.js';\nexport { materialiser } from './run/inputs.js';\n\nexport { buildSimulateRequest } from './run/simulate.js';\nexport type { BuildSimulateRequestInput } from './run/simulate.js';\n\nexport { terminalOutputs } from './outputs.js';\n\nexport { createComposeSdk } from './sdk.js';\nexport type { ComposeSdk, ComposeSdkOptions, FlowBuilder } from './sdk.js';\n\nimport * as guardsMod from './generated/guards.generated.js';\nimport * as materialisersMod from './generated/materialisers.generated.js';\nimport * as preconditionsMod from './generated/preconditions.generated.js';\nimport * as rawMod from './raw.js';\nimport * as resourcesMod from './resources.js';\nimport * as routeAmountMod from './routeAmount.js';\n\n/**\n * Guard factories for protecting operation outputs (e.g. slippage tolerance).\n * Pass guards to an operation's `guards` array.\n *\n * @example\n * ```ts\n * builder.lifi.swap('swap1', {\n * bind: { amountIn: builder.inputs.token },\n * config: { resourceOut: resources.native(1) },\n * guards: [guards.slippage({ port: 'amountOut', bps: 300 })],\n * });\n * ```\n */\nexport const guards: typeof guardsMod = guardsMod;\n/**\n * Materialiser factories that tell the runtime how to resolve token input\n * amounts on-chain (e.g. read a wallet balance, accept a direct deposit).\n *\n * @example\n * ```ts\n * await builder.compile({\n * inputs: { token: materialisers.balanceOf({}) },\n * signer: '0x...',\n * });\n * ```\n */\nexport const materialisers: typeof materialisersMod = materialisersMod;\n/**\n * Precondition factories for asserting on-chain state before a flow executes\n * (e.g. minimum token balances, ERC-20 allowances).\n *\n * @example\n * ```ts\n * await builder.compile({\n * inputs: { token: materialisers.balanceOf({}) },\n * preconditions: [\n * preconditions.erc20Balance({ wallet: '0x...', token: '0x...', balance: 1000n }),\n * ],\n * signer: '0x...',\n * });\n * ```\n */\nexport const preconditions: typeof preconditionsMod = preconditionsMod;\n/**\n * Resource declaration helpers for defining token inputs in a flow schema.\n * Use {@link resources.erc20} for ERC-20 tokens and {@link resources.native}\n * for the chain's native coin (ETH, MATIC, etc.).\n *\n * @example\n * ```ts\n * const builder = sdk.flow(1, {\n * inputs: {\n * usdc: resources.erc20('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', 1),\n * eth: resources.native(1),\n * },\n * });\n * ```\n */\nexport const resources: typeof resourcesMod = resourcesMod;\n/**\n * Amount constructors for {@link ComposeSdk.route}. Use\n * {@link routeAmount.exact} to spend a fixed amount of the `fromToken`, and\n * {@link routeAmount.all} to spend the signer's whole balance.\n *\n * @example\n * ```ts\n * // USDC into the Aave v3 aEthUSDC position — one routing-catalog edge.\n * const result = await sdk.route({\n * chainId: 1,\n * fromToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',\n * toToken: '0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c',\n * amount: routeAmount.exact(1_000_000n),\n * signer: '0xYourAddress...',\n * });\n * ```\n */\nexport const routeAmount: typeof routeAmountMod = routeAmountMod;\nexport * from './generated/config.generated.js';\n\n/**\n * Low-level escape hatch for constructing flow nodes, guards, and materialiser\n * inputs without the typed builder API. Prefer the generated operation methods\n * on {@link FlowBuilder} and the typed `guards`/`materialisers` namespaces\n * for most use cases.\n */\nexport const raw: typeof rawMod = rawMod;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyKA,MAAa,SAA2BA,mCAAAA;;;;;;;;;;;;;AAaxC,MAAa,gBAAyCC,0CAAAA;;;;;;;;;;;;;;;;AAgBtD,MAAa,gBAAyCC,0CAAAA;;;;;;;;;;;;;;;;AAgBtD,MAAa,YAAiCC,kBAAAA;;;;;;;;;;;;;;;;;;AAkB9C,MAAa,cAAqCC,oBAAAA;;;;;;;AASlD,MAAa,MAAqBC,YAAAA"}
package/dist/index.d.cts CHANGED
@@ -16,7 +16,7 @@ import { ComposeSdk, ComposeSdkOptions, FlowBuilder, createComposeSdk } from "./
16
16
  import { raw_d_exports } from "./raw.cjs";
17
17
  import { resources_d_exports } from "./resources.cjs";
18
18
  import { routeAmount_d_exports } from "./routeAmount.cjs";
19
- import { Amount, AppliedGuard, ApprovalEntry, Call, ComposeAction, ComposeCompilePartialData, ComposeCompileRequest, ComposeCompileResult, ComposeCompileSuccessData, ComposeErrorKind, ComposeFill, ComposeRouteRequest, ComposeTransactionRequest, ComposeUserProgramSimulation, ComposeWarning, ConsumedOutput, ContinuationIntent, ContinuationOutcome, Delivery, DeliveryErrorDetails, DeliveryErrorReason, Erc20AllowanceRequirement, Erc20BalanceRequirement, Estimate, EstimateBasis, FailedPreparedOp, Flow, ForwardTo, InputSpec, MaterialiserConfigOf, MaterialiserInput, Minimum, MinimumBasis, NativeBalanceRequirement, Output, OutputAmount, Outputs, Precondition, PreconditionConfigOf, PriceImpact, Ref, Resource, RouteAmount, RouteAmountAll, RouteAmountExact, SIMULATE_MAX_REQUIREMENTS, SIMULATE_MAX_TRACKED_BALANCES, SettlementBindingWire, SettlementEscrowWire, SettlementWire, SimulateBalanceEntry, SimulateOkResult, SimulateRequest, SimulateResult, SimulateRevertDecodeResult, SimulateRevertResult, SimulateSetupErrorResult, SimulationPolicy, SimulationRevert, SlotFinderRequirement, SolType, TerminalOutput, TrackedBalance } from "@lifi/compose-spec";
19
+ import { Amount, AppliedGuard, ApprovalEntry, Call, ComposeAction, ComposeCompilePartialData, ComposeCompileRequest, ComposeCompileResult, ComposeCompileSuccessData, ComposeErrorKind, ComposeFill, ComposeRouteRequest, ComposeTransactionRequest, ComposeUserProgramSimulation, ComposeWarning, ConsumedOutput, ContinuationIntent, ContinuationOutcome, Delivery, DeliveryErrorDetails, DeliveryErrorReason, Erc20AllowanceRequirement, Erc20BalanceRequirement, Estimate, EstimateBasis, FailedPreparedOp, Flow, ForwardTo, InputSpec, MaterialiserConfigOf, MaterialiserInput, Minimum, MinimumBasis, NativeBalanceRequirement, Output, OutputAmount, Outputs, Permit2AllowanceRequirement, Precondition, PreconditionConfigOf, PriceImpact, Ref, Resource, RouteAmount, RouteAmountAll, RouteAmountExact, SIMULATE_MAX_REQUIREMENTS, SIMULATE_MAX_TRACKED_BALANCES, SettlementBindingWire, SettlementEscrowWire, SettlementWire, SimulateBalanceEntry, SimulateOkResult, SimulateRequest, SimulateResult, SimulateRevertDecodeResult, SimulateRevertResult, SimulateSetupErrorResult, SimulationPolicy, SimulationRevert, SlotFinderRequirement, SolType, TerminalOutput, TrackedBalance } from "@lifi/compose-spec";
20
20
  //#region src/index.d.ts
21
21
  /**
22
22
  * Guard factories for protecting operation outputs (e.g. slippage tolerance).
@@ -103,5 +103,5 @@ export declare const routeAmount: typeof routeAmount_d_exports;
103
103
  */
104
104
  export declare const raw: typeof raw_d_exports;
105
105
  //#endregion
106
- export { AaveBorrowConfig, AaveClaimRewardsConfig, AaveGetHealthFactorConfig, AaveRepayConfig, AaveRepayWithATokensConfig, AaveSetEModeConfig, type AbiTypeToOutputKind, type Address, type Amount, type AnyBindable, type AnyHandle, type AnyRefBindable, type AppliedGuard, type ApprovalEntry, BalanceOfMaterialiserConfig, BandGuardConfig, Between01, Between010000, Between0120, Between0255, Between03318, Between05000, Between0999999, Between1300, Between19999, Between86400000000000008640000000000000, Between887272887272, type Bindable, type BuildSimulateRequestInput, type Call, CallMaterialiserConfig, type ChainSummary, type ComposeAction, type ComposeCompilePartialData, type ComposeCompileRequest, type ComposeCompileResult, type ComposeCompileSuccessData, type ComposeError, type ComposeErrorCode, type ComposeErrorKind, type ComposeFill, type ComposePreparationOps, type ComposeRouteRequest, type ComposeRunInput, type ComposeSdk, type ComposeSdkOptions, type ComposeSdkOutdated, type ComposeServerOutdated, type ComposeTransactionRequest, type ComposeUserProgramSimulation, type ComposeWarning, type ConsumedOutput, type ContinuationIntent, type ContinuationOutcome, ContinuationSettleConfig, CoreApproveConfig, CoreAsResourceConfig, CoreBalanceOfConfig, CoreBpsDownConfig, CoreBpsUpConfig, CoreCallConfig, CoreEmitEvent1Config, CoreEmitEvent2Config, CoreEmitEvent3Config, CoreEmitEvent4Config, CoreInvokeConfig, CoreNumericInvariantGuardConfig, CorePartitionConfig, CorePeekConfig, CoreRawCallConfig, CoreSplitAtConfig, CoreSplitConfig, CoreStaticCallConfig, CoreTransferConfig, type Delivery, type DeliveryErrorDetails, type DeliveryErrorReason, DirectDepositMaterialiserConfig, Erc20AllowancePreconditionConfig, type Erc20AllowanceRequirement, Erc20BalancePreconditionConfig, type Erc20BalanceRequirement, type Estimate, type EstimateBasis, type FailedPreparedOp, type FamilyCount, type FamilySource, FlashloanMaterialiserConfig, type Flow, type FlowBuilder, type FlowOptions, FlySwapConfig, type ForwardTo, type GetZapPacksOptions, type InputDecl, type InputHandle, type InputSchema, type InputSpec, type InputSpecOf, type IntegerString, type IntegerStringInput, InvariantEqConfig, InvariantGtConfig, InvariantGteConfig, InvariantLtConfig, InvariantLteConfig, InvariantNeqConfig, InvariantNumericConfig, InvariantNumericInRangeConfig, LessThan1, LifiBridgeConfig, LifiFlashloanRepayConfig, LifiIntentsAttestNonFillConfig, LifiIntentsOrderConfig, LifiIntentsRefundConfig, LifiIntentsRefundOnNonFillConfig, LifiSwapConfig, LifiZapAsyncConfig, LifiZapConfig, type MaterialiserConfigOf, type MaterialiserInput, MaxItems16, MaxItems50, MaxLength64, MaxLength65536, type Minimum, type MinimumBasis, MorphoBlueBorrowConfig, MorphoBlueGetPositionConfig, MorphoBlueRepayConfig, MorphoBlueSupplyCollateralConfig, MorphoBlueSupplyConfig, MorphoBlueWithdrawCollateralConfig, MorphoBlueWithdrawConfig, NativeBalancePreconditionConfig, type NativeBalanceRequirement, NonNegative, type Output, type OutputAmount, type OutputFamilyHandles, type OutputHandle, type OutputKind, type Outputs, ParaswapBuyConfig, Positive, type Precondition, type PreconditionConfigOf, type PriceImpact, type Reachability, type ReachabilityOptions, type Ref, type RefBindable, type Resource, type ResourceInputHandle, type RoutablePair, type RouteAmount, type RouteAmountAll, type RouteAmountExact, SIMULATE_MAX_REQUIREMENTS, SIMULATE_MAX_TRACKED_BALANCES, type SettlementBindingWire, type SettlementEscrowWire, type SettlementWire, type SimulateBalanceEntry, type SimulateOkResult, type SimulateRequest, type SimulateResult, type SimulateRevertDecodeResult, type SimulateRevertResult, type SimulateSetupErrorResult, type SimulationPolicy, type SimulationRevert, SlippageGuardConfig, type SlotFinderRequirement, type SolType, StartsWith0X, type TerminalOutput, type TokenRef, type TrackedBalance, type TypedFlow, type TypedGuard, type TypedLiteral, type TypedRef, UniswapV2AddLiquidityConfig, UniswapV2RemoveLiquidityConfig, UniswapV3IncreaseLiquidityConfig, UniswapV3MintConfig, type ZapPackEdge, type ZapPackOverview, buildReachability, buildSimulateRequest, createComposeSdk, isComposeDeliveryError, isComposeError, isComposePreparationError, isComposeSdkOutdatedError, isComposeServerOutdatedError, isInputHandle, isOutputHandle, materialiser, ref, terminalOutputs };
106
+ export { AaveBorrowConfig, AaveClaimRewardsConfig, AaveGetHealthFactorConfig, AaveRepayConfig, AaveRepayWithATokensConfig, AaveSetEModeConfig, type AbiTypeToOutputKind, type Address, type Amount, type AnyBindable, type AnyHandle, type AnyRefBindable, type AppliedGuard, type ApprovalEntry, BalanceOfMaterialiserConfig, BandGuardConfig, Between01, Between010000, Between0120, Between0255, Between03318, Between05000, Between0999999, Between1300, Between19999, Between86400000000000008640000000000000, Between887272887272, type Bindable, type BuildSimulateRequestInput, type Call, CallMaterialiserConfig, type ChainSummary, type ComposeAction, type ComposeCompilePartialData, type ComposeCompileRequest, type ComposeCompileResult, type ComposeCompileSuccessData, type ComposeError, type ComposeErrorCode, type ComposeErrorKind, type ComposeFill, type ComposePreparationOps, type ComposeRouteRequest, type ComposeRunInput, type ComposeSdk, type ComposeSdkOptions, type ComposeSdkOutdated, type ComposeServerOutdated, type ComposeTransactionRequest, type ComposeUserProgramSimulation, type ComposeWarning, type ConsumedOutput, type ContinuationIntent, type ContinuationOutcome, ContinuationSettleConfig, CoreApproveConfig, CoreAsResourceConfig, CoreBalanceOfConfig, CoreBpsDownConfig, CoreBpsUpConfig, CoreCallConfig, CoreEmitEvent1Config, CoreEmitEvent2Config, CoreEmitEvent3Config, CoreEmitEvent4Config, CoreInvokeConfig, CoreNumericInvariantGuardConfig, CorePartitionConfig, CorePeekConfig, CoreRawCallConfig, CoreSplitAtConfig, CoreSplitConfig, CoreStaticCallConfig, CoreTransferConfig, type Delivery, type DeliveryErrorDetails, type DeliveryErrorReason, DirectDepositMaterialiserConfig, Erc20AllowancePreconditionConfig, type Erc20AllowanceRequirement, Erc20BalancePreconditionConfig, type Erc20BalanceRequirement, type Estimate, type EstimateBasis, type FailedPreparedOp, type FamilyCount, type FamilySource, FlashloanMaterialiserConfig, type Flow, type FlowBuilder, type FlowOptions, FlySwapConfig, type ForwardTo, type GetZapPacksOptions, type InputDecl, type InputHandle, type InputSchema, type InputSpec, type InputSpecOf, type IntegerString, type IntegerStringInput, InvariantEqConfig, InvariantGtConfig, InvariantGteConfig, InvariantLtConfig, InvariantLteConfig, InvariantNeqConfig, InvariantNumericConfig, InvariantNumericInRangeConfig, LessThan1, LifiBridgeConfig, LifiFlashloanRepayConfig, LifiIntentsAttestNonFillConfig, LifiIntentsOrderConfig, LifiIntentsRefundConfig, LifiIntentsRefundOnNonFillConfig, LifiSwapConfig, LifiZapAsyncConfig, LifiZapConfig, type MaterialiserConfigOf, type MaterialiserInput, MaxItems16, MaxItems50, MaxLength64, MaxLength65536, type Minimum, type MinimumBasis, MorphoBlueBorrowConfig, MorphoBlueGetPositionConfig, MorphoBlueRepayConfig, MorphoBlueSupplyCollateralConfig, MorphoBlueSupplyConfig, MorphoBlueWithdrawCollateralConfig, MorphoBlueWithdrawConfig, NativeBalancePreconditionConfig, type NativeBalanceRequirement, NonNegative, type Output, type OutputAmount, type OutputFamilyHandles, type OutputHandle, type OutputKind, type Outputs, ParaswapBuyConfig, type Permit2AllowanceRequirement, Positive, type Precondition, type PreconditionConfigOf, type PriceImpact, type Reachability, type ReachabilityOptions, type Ref, type RefBindable, type Resource, type ResourceInputHandle, type RoutablePair, type RouteAmount, type RouteAmountAll, type RouteAmountExact, SIMULATE_MAX_REQUIREMENTS, SIMULATE_MAX_TRACKED_BALANCES, type SettlementBindingWire, type SettlementEscrowWire, type SettlementWire, type SimulateBalanceEntry, type SimulateOkResult, type SimulateRequest, type SimulateResult, type SimulateRevertDecodeResult, type SimulateRevertResult, type SimulateSetupErrorResult, type SimulationPolicy, type SimulationRevert, SlippageGuardConfig, type SlotFinderRequirement, type SolType, StartsWith0X, type TerminalOutput, type TokenRef, type TrackedBalance, type TypedFlow, type TypedGuard, type TypedLiteral, type TypedRef, UniswapV2AddLiquidityConfig, UniswapV2RemoveLiquidityConfig, UniswapV3IncreaseLiquidityConfig, UniswapV3MintConfig, type ZapPackEdge, type ZapPackOverview, buildReachability, buildSimulateRequest, createComposeSdk, isComposeDeliveryError, isComposeError, isComposePreparationError, isComposeSdkOutdatedError, isComposeServerOutdatedError, isInputHandle, isOutputHandle, materialiser, ref, terminalOutputs };
107
107
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -16,7 +16,7 @@ import { ComposeSdk, ComposeSdkOptions, FlowBuilder, createComposeSdk } from "./
16
16
  import { raw_d_exports } from "./raw.js";
17
17
  import { resources_d_exports } from "./resources.js";
18
18
  import { routeAmount_d_exports } from "./routeAmount.js";
19
- import { Amount, AppliedGuard, ApprovalEntry, Call, ComposeAction, ComposeCompilePartialData, ComposeCompileRequest, ComposeCompileResult, ComposeCompileSuccessData, ComposeErrorKind, ComposeFill, ComposeRouteRequest, ComposeTransactionRequest, ComposeUserProgramSimulation, ComposeWarning, ConsumedOutput, ContinuationIntent, ContinuationOutcome, Delivery, DeliveryErrorDetails, DeliveryErrorReason, Erc20AllowanceRequirement, Erc20BalanceRequirement, Estimate, EstimateBasis, FailedPreparedOp, Flow, ForwardTo, InputSpec, MaterialiserConfigOf, MaterialiserInput, Minimum, MinimumBasis, NativeBalanceRequirement, Output, OutputAmount, Outputs, Precondition, PreconditionConfigOf, PriceImpact, Ref, Resource, RouteAmount, RouteAmountAll, RouteAmountExact, SIMULATE_MAX_REQUIREMENTS, SIMULATE_MAX_TRACKED_BALANCES, SettlementBindingWire, SettlementEscrowWire, SettlementWire, SimulateBalanceEntry, SimulateOkResult, SimulateRequest, SimulateResult, SimulateRevertDecodeResult, SimulateRevertResult, SimulateSetupErrorResult, SimulationPolicy, SimulationRevert, SlotFinderRequirement, SolType, TerminalOutput, TrackedBalance } from "@lifi/compose-spec";
19
+ import { Amount, AppliedGuard, ApprovalEntry, Call, ComposeAction, ComposeCompilePartialData, ComposeCompileRequest, ComposeCompileResult, ComposeCompileSuccessData, ComposeErrorKind, ComposeFill, ComposeRouteRequest, ComposeTransactionRequest, ComposeUserProgramSimulation, ComposeWarning, ConsumedOutput, ContinuationIntent, ContinuationOutcome, Delivery, DeliveryErrorDetails, DeliveryErrorReason, Erc20AllowanceRequirement, Erc20BalanceRequirement, Estimate, EstimateBasis, FailedPreparedOp, Flow, ForwardTo, InputSpec, MaterialiserConfigOf, MaterialiserInput, Minimum, MinimumBasis, NativeBalanceRequirement, Output, OutputAmount, Outputs, Permit2AllowanceRequirement, Precondition, PreconditionConfigOf, PriceImpact, Ref, Resource, RouteAmount, RouteAmountAll, RouteAmountExact, SIMULATE_MAX_REQUIREMENTS, SIMULATE_MAX_TRACKED_BALANCES, SettlementBindingWire, SettlementEscrowWire, SettlementWire, SimulateBalanceEntry, SimulateOkResult, SimulateRequest, SimulateResult, SimulateRevertDecodeResult, SimulateRevertResult, SimulateSetupErrorResult, SimulationPolicy, SimulationRevert, SlotFinderRequirement, SolType, TerminalOutput, TrackedBalance } from "@lifi/compose-spec";
20
20
  //#region src/index.d.ts
21
21
  /**
22
22
  * Guard factories for protecting operation outputs (e.g. slippage tolerance).
@@ -103,5 +103,5 @@ export declare const routeAmount: typeof routeAmount_d_exports;
103
103
  */
104
104
  export declare const raw: typeof raw_d_exports;
105
105
  //#endregion
106
- export { AaveBorrowConfig, AaveClaimRewardsConfig, AaveGetHealthFactorConfig, AaveRepayConfig, AaveRepayWithATokensConfig, AaveSetEModeConfig, type AbiTypeToOutputKind, type Address, type Amount, type AnyBindable, type AnyHandle, type AnyRefBindable, type AppliedGuard, type ApprovalEntry, BalanceOfMaterialiserConfig, BandGuardConfig, Between01, Between010000, Between0120, Between0255, Between03318, Between05000, Between0999999, Between1300, Between19999, Between86400000000000008640000000000000, Between887272887272, type Bindable, type BuildSimulateRequestInput, type Call, CallMaterialiserConfig, type ChainSummary, type ComposeAction, type ComposeCompilePartialData, type ComposeCompileRequest, type ComposeCompileResult, type ComposeCompileSuccessData, type ComposeError, type ComposeErrorCode, type ComposeErrorKind, type ComposeFill, type ComposePreparationOps, type ComposeRouteRequest, type ComposeRunInput, type ComposeSdk, type ComposeSdkOptions, type ComposeSdkOutdated, type ComposeServerOutdated, type ComposeTransactionRequest, type ComposeUserProgramSimulation, type ComposeWarning, type ConsumedOutput, type ContinuationIntent, type ContinuationOutcome, ContinuationSettleConfig, CoreApproveConfig, CoreAsResourceConfig, CoreBalanceOfConfig, CoreBpsDownConfig, CoreBpsUpConfig, CoreCallConfig, CoreEmitEvent1Config, CoreEmitEvent2Config, CoreEmitEvent3Config, CoreEmitEvent4Config, CoreInvokeConfig, CoreNumericInvariantGuardConfig, CorePartitionConfig, CorePeekConfig, CoreRawCallConfig, CoreSplitAtConfig, CoreSplitConfig, CoreStaticCallConfig, CoreTransferConfig, type Delivery, type DeliveryErrorDetails, type DeliveryErrorReason, DirectDepositMaterialiserConfig, Erc20AllowancePreconditionConfig, type Erc20AllowanceRequirement, Erc20BalancePreconditionConfig, type Erc20BalanceRequirement, type Estimate, type EstimateBasis, type FailedPreparedOp, type FamilyCount, type FamilySource, FlashloanMaterialiserConfig, type Flow, type FlowBuilder, type FlowOptions, FlySwapConfig, type ForwardTo, type GetZapPacksOptions, type InputDecl, type InputHandle, type InputSchema, type InputSpec, type InputSpecOf, type IntegerString, type IntegerStringInput, InvariantEqConfig, InvariantGtConfig, InvariantGteConfig, InvariantLtConfig, InvariantLteConfig, InvariantNeqConfig, InvariantNumericConfig, InvariantNumericInRangeConfig, LessThan1, LifiBridgeConfig, LifiFlashloanRepayConfig, LifiIntentsAttestNonFillConfig, LifiIntentsOrderConfig, LifiIntentsRefundConfig, LifiIntentsRefundOnNonFillConfig, LifiSwapConfig, LifiZapAsyncConfig, LifiZapConfig, type MaterialiserConfigOf, type MaterialiserInput, MaxItems16, MaxItems50, MaxLength64, MaxLength65536, type Minimum, type MinimumBasis, MorphoBlueBorrowConfig, MorphoBlueGetPositionConfig, MorphoBlueRepayConfig, MorphoBlueSupplyCollateralConfig, MorphoBlueSupplyConfig, MorphoBlueWithdrawCollateralConfig, MorphoBlueWithdrawConfig, NativeBalancePreconditionConfig, type NativeBalanceRequirement, NonNegative, type Output, type OutputAmount, type OutputFamilyHandles, type OutputHandle, type OutputKind, type Outputs, ParaswapBuyConfig, Positive, type Precondition, type PreconditionConfigOf, type PriceImpact, type Reachability, type ReachabilityOptions, type Ref, type RefBindable, type Resource, type ResourceInputHandle, type RoutablePair, type RouteAmount, type RouteAmountAll, type RouteAmountExact, SIMULATE_MAX_REQUIREMENTS, SIMULATE_MAX_TRACKED_BALANCES, type SettlementBindingWire, type SettlementEscrowWire, type SettlementWire, type SimulateBalanceEntry, type SimulateOkResult, type SimulateRequest, type SimulateResult, type SimulateRevertDecodeResult, type SimulateRevertResult, type SimulateSetupErrorResult, type SimulationPolicy, type SimulationRevert, SlippageGuardConfig, type SlotFinderRequirement, type SolType, StartsWith0X, type TerminalOutput, type TokenRef, type TrackedBalance, type TypedFlow, type TypedGuard, type TypedLiteral, type TypedRef, UniswapV2AddLiquidityConfig, UniswapV2RemoveLiquidityConfig, UniswapV3IncreaseLiquidityConfig, UniswapV3MintConfig, type ZapPackEdge, type ZapPackOverview, buildReachability, buildSimulateRequest, createComposeSdk, isComposeDeliveryError, isComposeError, isComposePreparationError, isComposeSdkOutdatedError, isComposeServerOutdatedError, isInputHandle, isOutputHandle, materialiser, ref, terminalOutputs };
106
+ export { AaveBorrowConfig, AaveClaimRewardsConfig, AaveGetHealthFactorConfig, AaveRepayConfig, AaveRepayWithATokensConfig, AaveSetEModeConfig, type AbiTypeToOutputKind, type Address, type Amount, type AnyBindable, type AnyHandle, type AnyRefBindable, type AppliedGuard, type ApprovalEntry, BalanceOfMaterialiserConfig, BandGuardConfig, Between01, Between010000, Between0120, Between0255, Between03318, Between05000, Between0999999, Between1300, Between19999, Between86400000000000008640000000000000, Between887272887272, type Bindable, type BuildSimulateRequestInput, type Call, CallMaterialiserConfig, type ChainSummary, type ComposeAction, type ComposeCompilePartialData, type ComposeCompileRequest, type ComposeCompileResult, type ComposeCompileSuccessData, type ComposeError, type ComposeErrorCode, type ComposeErrorKind, type ComposeFill, type ComposePreparationOps, type ComposeRouteRequest, type ComposeRunInput, type ComposeSdk, type ComposeSdkOptions, type ComposeSdkOutdated, type ComposeServerOutdated, type ComposeTransactionRequest, type ComposeUserProgramSimulation, type ComposeWarning, type ConsumedOutput, type ContinuationIntent, type ContinuationOutcome, ContinuationSettleConfig, CoreApproveConfig, CoreAsResourceConfig, CoreBalanceOfConfig, CoreBpsDownConfig, CoreBpsUpConfig, CoreCallConfig, CoreEmitEvent1Config, CoreEmitEvent2Config, CoreEmitEvent3Config, CoreEmitEvent4Config, CoreInvokeConfig, CoreNumericInvariantGuardConfig, CorePartitionConfig, CorePeekConfig, CoreRawCallConfig, CoreSplitAtConfig, CoreSplitConfig, CoreStaticCallConfig, CoreTransferConfig, type Delivery, type DeliveryErrorDetails, type DeliveryErrorReason, DirectDepositMaterialiserConfig, Erc20AllowancePreconditionConfig, type Erc20AllowanceRequirement, Erc20BalancePreconditionConfig, type Erc20BalanceRequirement, type Estimate, type EstimateBasis, type FailedPreparedOp, type FamilyCount, type FamilySource, FlashloanMaterialiserConfig, type Flow, type FlowBuilder, type FlowOptions, FlySwapConfig, type ForwardTo, type GetZapPacksOptions, type InputDecl, type InputHandle, type InputSchema, type InputSpec, type InputSpecOf, type IntegerString, type IntegerStringInput, InvariantEqConfig, InvariantGtConfig, InvariantGteConfig, InvariantLtConfig, InvariantLteConfig, InvariantNeqConfig, InvariantNumericConfig, InvariantNumericInRangeConfig, LessThan1, LifiBridgeConfig, LifiFlashloanRepayConfig, LifiIntentsAttestNonFillConfig, LifiIntentsOrderConfig, LifiIntentsRefundConfig, LifiIntentsRefundOnNonFillConfig, LifiSwapConfig, LifiZapAsyncConfig, LifiZapConfig, type MaterialiserConfigOf, type MaterialiserInput, MaxItems16, MaxItems50, MaxLength64, MaxLength65536, type Minimum, type MinimumBasis, MorphoBlueBorrowConfig, MorphoBlueGetPositionConfig, MorphoBlueRepayConfig, MorphoBlueSupplyCollateralConfig, MorphoBlueSupplyConfig, MorphoBlueWithdrawCollateralConfig, MorphoBlueWithdrawConfig, NativeBalancePreconditionConfig, type NativeBalanceRequirement, NonNegative, type Output, type OutputAmount, type OutputFamilyHandles, type OutputHandle, type OutputKind, type Outputs, ParaswapBuyConfig, type Permit2AllowanceRequirement, Positive, type Precondition, type PreconditionConfigOf, type PriceImpact, type Reachability, type ReachabilityOptions, type Ref, type RefBindable, type Resource, type ResourceInputHandle, type RoutablePair, type RouteAmount, type RouteAmountAll, type RouteAmountExact, SIMULATE_MAX_REQUIREMENTS, SIMULATE_MAX_TRACKED_BALANCES, type SettlementBindingWire, type SettlementEscrowWire, type SettlementWire, type SimulateBalanceEntry, type SimulateOkResult, type SimulateRequest, type SimulateResult, type SimulateRevertDecodeResult, type SimulateRevertResult, type SimulateSetupErrorResult, type SimulationPolicy, type SimulationRevert, SlippageGuardConfig, type SlotFinderRequirement, type SolType, StartsWith0X, type TerminalOutput, type TokenRef, type TrackedBalance, type TypedFlow, type TypedGuard, type TypedLiteral, type TypedRef, UniswapV2AddLiquidityConfig, UniswapV2RemoveLiquidityConfig, UniswapV3IncreaseLiquidityConfig, UniswapV3MintConfig, type ZapPackEdge, type ZapPackOverview, buildReachability, buildSimulateRequest, createComposeSdk, isComposeDeliveryError, isComposeError, isComposePreparationError, isComposeSdkOutdatedError, isComposeServerOutdatedError, isInputHandle, isOutputHandle, materialiser, ref, terminalOutputs };
107
107
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["guardsMod","materialisersMod","preconditionsMod","resourcesMod","routeAmountMod","rawMod"],"sources":["../src/index.ts"],"sourcesContent":["/**\n * `@lifi/composer-sdk` — TypeScript SDK for building and compiling\n * Compose flows into executable EVM calldata.\n *\n * Start by creating an SDK instance with {@link createComposeSdk}, then use\n * {@link ComposeSdk.flow} to build flows and compile them.\n *\n * @packageDocumentation\n */\n\nexport type {\n AbiTypeToOutputKind,\n Address,\n InputDecl,\n InputSchema,\n InputSpecOf,\n IntegerString,\n IntegerStringInput,\n OutputKind,\n TypedGuard,\n TypedRef,\n TypedLiteral,\n} from './types.js';\n\nexport type {\n ChainSummary,\n GetZapPacksOptions,\n ZapPackEdge,\n ZapPackOverview,\n} from './discovery.js';\nexport type {\n Reachability,\n ReachabilityOptions,\n RoutablePair,\n TokenRef,\n} from './reachability.js';\nexport { buildReachability } from './reachability.js';\nexport type {\n ComposeError,\n ComposeErrorCode,\n ComposeSdkOutdated,\n ComposeServerOutdated,\n ComposePreparationOps,\n} from './errors.js';\nexport type {\n AppliedGuard,\n ApprovalEntry,\n Call,\n ComposeCompilePartialData,\n ComposeAction,\n ComposeFill,\n ComposeUserProgramSimulation,\n ComposeWarning,\n ComposeCompileRequest,\n ComposeCompileResult,\n ComposeCompileSuccessData,\n ComposeErrorKind,\n ComposeRouteRequest,\n ComposeTransactionRequest,\n FailedPreparedOp,\n Flow,\n InputSpec,\n MaterialiserConfigOf,\n MaterialiserInput,\n OutputAmount,\n Amount,\n ConsumedOutput,\n Delivery,\n Estimate,\n EstimateBasis,\n Minimum,\n MinimumBasis,\n Output,\n Outputs,\n TerminalOutput,\n Precondition,\n PreconditionConfigOf,\n PriceImpact,\n Ref,\n Resource,\n RouteAmount,\n RouteAmountAll,\n RouteAmountExact,\n SimulationPolicy,\n SimulationRevert,\n DeliveryErrorDetails,\n DeliveryErrorReason,\n SolType,\n ForwardTo,\n SimulateRequest,\n SimulateResult,\n SimulateOkResult,\n SimulateRevertResult,\n SimulateRevertDecodeResult,\n SimulateSetupErrorResult,\n SimulateBalanceEntry,\n TrackedBalance,\n SlotFinderRequirement,\n Erc20BalanceRequirement,\n NativeBalanceRequirement,\n Erc20AllowanceRequirement,\n ContinuationIntent,\n ContinuationOutcome,\n SettlementWire,\n SettlementEscrowWire,\n SettlementBindingWire,\n} from '@lifi/compose-spec';\nexport {\n SIMULATE_MAX_TRACKED_BALANCES,\n SIMULATE_MAX_REQUIREMENTS,\n} from '@lifi/compose-spec';\nexport {\n isComposeDeliveryError,\n isComposeError,\n isComposePreparationError,\n isComposeSdkOutdatedError,\n isComposeServerOutdatedError,\n} from './errors.js';\n\nexport type {\n Bindable,\n RefBindable,\n AnyRefBindable,\n InputHandle,\n ResourceInputHandle,\n OutputHandle,\n OutputFamilyHandles,\n FamilyCount,\n FamilySource,\n AnyHandle,\n} from './authoring/handles.js';\nexport { isInputHandle, isOutputHandle } from './authoring/handles.js';\nexport { ref } from './authoring/raw.js';\n\nexport type { AnyBindable } from './authoring/FlowBuilderCore.js';\nexport type { TypedFlow, FlowOptions } from './authoring/FlowBuilderCore.js';\n\nexport type { ComposeRunInput } from './run/inputs.js';\nexport { materialiser } from './run/inputs.js';\n\nexport { buildSimulateRequest } from './run/simulate.js';\nexport type { BuildSimulateRequestInput } from './run/simulate.js';\n\nexport { terminalOutputs } from './outputs.js';\n\nexport { createComposeSdk } from './sdk.js';\nexport type { ComposeSdk, ComposeSdkOptions, FlowBuilder } from './sdk.js';\n\nimport * as guardsMod from './generated/guards.generated.js';\nimport * as materialisersMod from './generated/materialisers.generated.js';\nimport * as preconditionsMod from './generated/preconditions.generated.js';\nimport * as rawMod from './raw.js';\nimport * as resourcesMod from './resources.js';\nimport * as routeAmountMod from './routeAmount.js';\n\n/**\n * Guard factories for protecting operation outputs (e.g. slippage tolerance).\n * Pass guards to an operation's `guards` array.\n *\n * @example\n * ```ts\n * builder.lifi.swap('swap1', {\n * bind: { amountIn: builder.inputs.token },\n * config: { resourceOut: resources.native(1) },\n * guards: [guards.slippage({ port: 'amountOut', bps: 300 })],\n * });\n * ```\n */\nexport const guards: typeof guardsMod = guardsMod;\n/**\n * Materialiser factories that tell the runtime how to resolve token input\n * amounts on-chain (e.g. read a wallet balance, accept a direct deposit).\n *\n * @example\n * ```ts\n * await builder.compile({\n * inputs: { token: materialisers.balanceOf({}) },\n * signer: '0x...',\n * });\n * ```\n */\nexport const materialisers: typeof materialisersMod = materialisersMod;\n/**\n * Precondition factories for asserting on-chain state before a flow executes\n * (e.g. minimum token balances, ERC-20 allowances).\n *\n * @example\n * ```ts\n * await builder.compile({\n * inputs: { token: materialisers.balanceOf({}) },\n * preconditions: [\n * preconditions.erc20Balance({ wallet: '0x...', token: '0x...', balance: 1000n }),\n * ],\n * signer: '0x...',\n * });\n * ```\n */\nexport const preconditions: typeof preconditionsMod = preconditionsMod;\n/**\n * Resource declaration helpers for defining token inputs in a flow schema.\n * Use {@link resources.erc20} for ERC-20 tokens and {@link resources.native}\n * for the chain's native coin (ETH, MATIC, etc.).\n *\n * @example\n * ```ts\n * const builder = sdk.flow(1, {\n * inputs: {\n * usdc: resources.erc20('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', 1),\n * eth: resources.native(1),\n * },\n * });\n * ```\n */\nexport const resources: typeof resourcesMod = resourcesMod;\n/**\n * Amount constructors for {@link ComposeSdk.route}. Use\n * {@link routeAmount.exact} to spend a fixed amount of the `fromToken`, and\n * {@link routeAmount.all} to spend the signer's whole balance.\n *\n * @example\n * ```ts\n * // USDC into the Aave v3 aEthUSDC position — one routing-catalog edge.\n * const result = await sdk.route({\n * chainId: 1,\n * fromToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',\n * toToken: '0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c',\n * amount: routeAmount.exact(1_000_000n),\n * signer: '0xYourAddress...',\n * });\n * ```\n */\nexport const routeAmount: typeof routeAmountMod = routeAmountMod;\nexport * from './generated/config.generated.js';\n\n/**\n * Low-level escape hatch for constructing flow nodes, guards, and materialiser\n * inputs without the typed builder API. Prefer the generated operation methods\n * on {@link FlowBuilder} and the typed `guards`/`materialisers` namespaces\n * for most use cases.\n */\nexport const raw: typeof rawMod = rawMod;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwKA,MAAa,SAA2BA;;;;;;;;;;;;;AAaxC,MAAa,gBAAyCC;;;;;;;;;;;;;;;;AAgBtD,MAAa,gBAAyCC;;;;;;;;;;;;;;;;AAgBtD,MAAa,YAAiCC;;;;;;;;;;;;;;;;;;AAkB9C,MAAa,cAAqCC;;;;;;;AASlD,MAAa,MAAqBC"}
1
+ {"version":3,"file":"index.js","names":["guardsMod","materialisersMod","preconditionsMod","resourcesMod","routeAmountMod","rawMod"],"sources":["../src/index.ts"],"sourcesContent":["/**\n * `@lifi/composer-sdk` — TypeScript SDK for building and compiling\n * Compose flows into executable EVM calldata.\n *\n * Start by creating an SDK instance with {@link createComposeSdk}, then use\n * {@link ComposeSdk.flow} to build flows and compile them.\n *\n * @packageDocumentation\n */\n\nexport type {\n AbiTypeToOutputKind,\n Address,\n InputDecl,\n InputSchema,\n InputSpecOf,\n IntegerString,\n IntegerStringInput,\n OutputKind,\n TypedGuard,\n TypedRef,\n TypedLiteral,\n} from './types.js';\n\nexport type {\n ChainSummary,\n GetZapPacksOptions,\n ZapPackEdge,\n ZapPackOverview,\n} from './discovery.js';\nexport type {\n Reachability,\n ReachabilityOptions,\n RoutablePair,\n TokenRef,\n} from './reachability.js';\nexport { buildReachability } from './reachability.js';\nexport type {\n ComposeError,\n ComposeErrorCode,\n ComposeSdkOutdated,\n ComposeServerOutdated,\n ComposePreparationOps,\n} from './errors.js';\nexport type {\n AppliedGuard,\n ApprovalEntry,\n Call,\n ComposeCompilePartialData,\n ComposeAction,\n ComposeFill,\n ComposeUserProgramSimulation,\n ComposeWarning,\n ComposeCompileRequest,\n ComposeCompileResult,\n ComposeCompileSuccessData,\n ComposeErrorKind,\n ComposeRouteRequest,\n ComposeTransactionRequest,\n FailedPreparedOp,\n Flow,\n InputSpec,\n MaterialiserConfigOf,\n MaterialiserInput,\n OutputAmount,\n Amount,\n ConsumedOutput,\n Delivery,\n Estimate,\n EstimateBasis,\n Minimum,\n MinimumBasis,\n Output,\n Outputs,\n TerminalOutput,\n Precondition,\n PreconditionConfigOf,\n PriceImpact,\n Ref,\n Resource,\n RouteAmount,\n RouteAmountAll,\n RouteAmountExact,\n SimulationPolicy,\n SimulationRevert,\n DeliveryErrorDetails,\n DeliveryErrorReason,\n SolType,\n ForwardTo,\n SimulateRequest,\n SimulateResult,\n SimulateOkResult,\n SimulateRevertResult,\n SimulateRevertDecodeResult,\n SimulateSetupErrorResult,\n SimulateBalanceEntry,\n TrackedBalance,\n SlotFinderRequirement,\n Erc20BalanceRequirement,\n NativeBalanceRequirement,\n Erc20AllowanceRequirement,\n Permit2AllowanceRequirement,\n ContinuationIntent,\n ContinuationOutcome,\n SettlementWire,\n SettlementEscrowWire,\n SettlementBindingWire,\n} from '@lifi/compose-spec';\nexport {\n SIMULATE_MAX_TRACKED_BALANCES,\n SIMULATE_MAX_REQUIREMENTS,\n} from '@lifi/compose-spec';\nexport {\n isComposeDeliveryError,\n isComposeError,\n isComposePreparationError,\n isComposeSdkOutdatedError,\n isComposeServerOutdatedError,\n} from './errors.js';\n\nexport type {\n Bindable,\n RefBindable,\n AnyRefBindable,\n InputHandle,\n ResourceInputHandle,\n OutputHandle,\n OutputFamilyHandles,\n FamilyCount,\n FamilySource,\n AnyHandle,\n} from './authoring/handles.js';\nexport { isInputHandle, isOutputHandle } from './authoring/handles.js';\nexport { ref } from './authoring/raw.js';\n\nexport type { AnyBindable } from './authoring/FlowBuilderCore.js';\nexport type { TypedFlow, FlowOptions } from './authoring/FlowBuilderCore.js';\n\nexport type { ComposeRunInput } from './run/inputs.js';\nexport { materialiser } from './run/inputs.js';\n\nexport { buildSimulateRequest } from './run/simulate.js';\nexport type { BuildSimulateRequestInput } from './run/simulate.js';\n\nexport { terminalOutputs } from './outputs.js';\n\nexport { createComposeSdk } from './sdk.js';\nexport type { ComposeSdk, ComposeSdkOptions, FlowBuilder } from './sdk.js';\n\nimport * as guardsMod from './generated/guards.generated.js';\nimport * as materialisersMod from './generated/materialisers.generated.js';\nimport * as preconditionsMod from './generated/preconditions.generated.js';\nimport * as rawMod from './raw.js';\nimport * as resourcesMod from './resources.js';\nimport * as routeAmountMod from './routeAmount.js';\n\n/**\n * Guard factories for protecting operation outputs (e.g. slippage tolerance).\n * Pass guards to an operation's `guards` array.\n *\n * @example\n * ```ts\n * builder.lifi.swap('swap1', {\n * bind: { amountIn: builder.inputs.token },\n * config: { resourceOut: resources.native(1) },\n * guards: [guards.slippage({ port: 'amountOut', bps: 300 })],\n * });\n * ```\n */\nexport const guards: typeof guardsMod = guardsMod;\n/**\n * Materialiser factories that tell the runtime how to resolve token input\n * amounts on-chain (e.g. read a wallet balance, accept a direct deposit).\n *\n * @example\n * ```ts\n * await builder.compile({\n * inputs: { token: materialisers.balanceOf({}) },\n * signer: '0x...',\n * });\n * ```\n */\nexport const materialisers: typeof materialisersMod = materialisersMod;\n/**\n * Precondition factories for asserting on-chain state before a flow executes\n * (e.g. minimum token balances, ERC-20 allowances).\n *\n * @example\n * ```ts\n * await builder.compile({\n * inputs: { token: materialisers.balanceOf({}) },\n * preconditions: [\n * preconditions.erc20Balance({ wallet: '0x...', token: '0x...', balance: 1000n }),\n * ],\n * signer: '0x...',\n * });\n * ```\n */\nexport const preconditions: typeof preconditionsMod = preconditionsMod;\n/**\n * Resource declaration helpers for defining token inputs in a flow schema.\n * Use {@link resources.erc20} for ERC-20 tokens and {@link resources.native}\n * for the chain's native coin (ETH, MATIC, etc.).\n *\n * @example\n * ```ts\n * const builder = sdk.flow(1, {\n * inputs: {\n * usdc: resources.erc20('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', 1),\n * eth: resources.native(1),\n * },\n * });\n * ```\n */\nexport const resources: typeof resourcesMod = resourcesMod;\n/**\n * Amount constructors for {@link ComposeSdk.route}. Use\n * {@link routeAmount.exact} to spend a fixed amount of the `fromToken`, and\n * {@link routeAmount.all} to spend the signer's whole balance.\n *\n * @example\n * ```ts\n * // USDC into the Aave v3 aEthUSDC position — one routing-catalog edge.\n * const result = await sdk.route({\n * chainId: 1,\n * fromToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',\n * toToken: '0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c',\n * amount: routeAmount.exact(1_000_000n),\n * signer: '0xYourAddress...',\n * });\n * ```\n */\nexport const routeAmount: typeof routeAmountMod = routeAmountMod;\nexport * from './generated/config.generated.js';\n\n/**\n * Low-level escape hatch for constructing flow nodes, guards, and materialiser\n * inputs without the typed builder API. Prefer the generated operation methods\n * on {@link FlowBuilder} and the typed `guards`/`materialisers` namespaces\n * for most use cases.\n */\nexport const raw: typeof rawMod = rawMod;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyKA,MAAa,SAA2BA;;;;;;;;;;;;;AAaxC,MAAa,gBAAyCC;;;;;;;;;;;;;;;;AAgBtD,MAAa,gBAAyCC;;;;;;;;;;;;;;;;AAgBtD,MAAa,YAAiCC;;;;;;;;;;;;;;;;;;AAkB9C,MAAa,cAAqCC;;;;;;;AASlD,MAAa,MAAqBC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/composer-sdk",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Public Composer SDK for building and submitting flows",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -47,7 +47,7 @@
47
47
  "example:staged": "tsx src/examples/run.ts --staged"
48
48
  },
49
49
  "peerDependencies": {
50
- "@lifi/compose-spec": "0.12.0"
50
+ "@lifi/compose-spec": "0.13.0"
51
51
  },
52
52
  "dependencies": {
53
53
  "abitype": "^1.2.3",
@@ -0,0 +1,341 @@
1
+ import type { ComposeCompileRequest, Flow } from '@lifi/compose-spec';
2
+
3
+ import {
4
+ type ComposeSdk,
5
+ type ContinuationSettleConfig,
6
+ createComposeSdk,
7
+ materialisers,
8
+ raw,
9
+ resources,
10
+ } from '../index.js';
11
+ import type { Address } from '../types.js';
12
+
13
+ import { API_KEY, BASE_URL, RECIPIENT } from './config.js';
14
+
15
+ const ARBITRUM = 42161;
16
+ const BASE = 8453;
17
+ const ARB_USDC = '0xaf88d065e77c8cC2239327C5EDb3A432268e5831';
18
+ const USDC = '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913';
19
+ const WETH = '0x4200000000000000000000000000000000000006';
20
+ // Request Network's ERC20FeeProxy on Base. It moves `amount` to `to` and
21
+ // `feeAmount` to `feeAddress` from the caller with `transferFrom`, and emits
22
+ // `TransferWithReferenceAndFee` with the payment reference: the event that
23
+ // marks the invoice paid.
24
+ const ERC20_FEE_PROXY = '0x1892196E80C4c17ea5100Da765Ab48c1fE2Fb814';
25
+ const VALIDITY_WINDOW_MS = 3_600_000;
26
+
27
+ /** A Request Network invoice payable in USDC on Base. */
28
+ export interface UsdcInvoice {
29
+ readonly payee: Address;
30
+ // USDC base units (6 decimals) paid to `payee`.
31
+ readonly amount: bigint;
32
+ // USDC base units paid to `feeAddress`; may be 0.
33
+ readonly fee: bigint;
34
+ readonly feeAddress: Address;
35
+ // The invoice's payment reference (8 bytes for Request Network).
36
+ readonly paymentReference: `0x${string}`;
37
+ }
38
+
39
+ // A sample invoice for the examples: 990 USDC to the payee plus a 10 USDC fee.
40
+ export const SAMPLE_INVOICE: UsdcInvoice = {
41
+ payee: RECIPIENT,
42
+ amount: 990_000_000n,
43
+ fee: 10_000_000n,
44
+ feeAddress: '0x2222222222222222222222222222222222222222',
45
+ paymentReference: '0x8c6f1d3b4a5e7c21',
46
+ };
47
+
48
+ export interface ContinuationExactInvoiceInput {
49
+ readonly owner: Address;
50
+ readonly invoice: UsdcInvoice;
51
+ // USDC base units the escrow is funded with. Must exceed
52
+ // `invoice.amount + invoice.fee`: the surplus, the settle's only outcome,
53
+ // returns to `owner`, and an outcome must commit a positive floor.
54
+ readonly usdcAmount: `${bigint}`;
55
+ }
56
+
57
+ export interface ContinuationExactSwapInvoiceInput {
58
+ readonly owner: Address;
59
+ readonly invoice: UsdcInvoice;
60
+ // WETH base units (18 decimals) swapped to USDC. The swap's guaranteed
61
+ // minimum output must exceed `invoice.amount + invoice.fee`, for the same
62
+ // reason as `usdcAmount` above.
63
+ readonly wethAmount: `${bigint}`;
64
+ }
65
+
66
+ export interface ContinuationExactIntentInvoiceInput {
67
+ readonly owner: Address;
68
+ readonly invoice: UsdcInvoice;
69
+ // Native ETH base units (18 decimals) on Arbitrum, swapped to Arbitrum
70
+ // USDC. The swap's guaranteed minimum output must cover the input the
71
+ // solver asks for the invoice total plus one unit; the rest returns to
72
+ // `owner`.
73
+ readonly ethAmount: `${bigint}`;
74
+ }
75
+
76
+ /**
77
+ * The leg every example settles: split the invoice total off the escrowed
78
+ * USDC, pay it through `ERC20FeeProxy`, and leave the surplus in the leg's
79
+ * proxy as the settle's outcome, if the settle commits one.
80
+ *
81
+ * `core.call` declares no settlement verification, so only an exact settle
82
+ * may run it. The invoice terms are constants of the leg document, so each
83
+ * argument is a `raw.literal` of the parameter's Solidity type. The leg names
84
+ * no funding amount: at fill the executor's proxy sweeps the escrowed USDC
85
+ * into `input.funding`.
86
+ */
87
+ const buildInvoiceLeg = (sdk: ComposeSdk, invoice: UsdcInvoice): Flow => {
88
+ const leg = sdk.flow(BASE, {
89
+ name: 'pay-invoice-leg',
90
+ inputs: { funding: resources.erc20(USDC, BASE) },
91
+ });
92
+ // `head` is the invoice total; `tail`, the surplus, stays in the proxy.
93
+ const { head } = leg.core.splitAt('invoice', {
94
+ bind: { source: leg.inputs.funding },
95
+ config: { amount: `${invoice.amount + invoice.fee}` },
96
+ });
97
+ leg.core.call('pay', {
98
+ resource: head,
99
+ bind: {
100
+ tokenAddress: raw.literal('address', USDC),
101
+ to: raw.literal('address', invoice.payee),
102
+ amount: raw.literal('uint256', `${invoice.amount}`),
103
+ paymentReference: raw.literal('bytes', invoice.paymentReference),
104
+ feeAmount: raw.literal('uint256', `${invoice.fee}`),
105
+ feeAddress: raw.literal('address', invoice.feeAddress),
106
+ },
107
+ config: {
108
+ target: ERC20_FEE_PROXY,
109
+ functionSignature:
110
+ 'function transferFromWithReferenceAndFee(address tokenAddress, address to, uint256 amount, bytes paymentReference, uint256 feeAmount, address feeAddress)',
111
+ // The fee proxy pulls the USDC with `transferFrom`.
112
+ approvals: [{ spender: ERC20_FEE_PROXY }],
113
+ },
114
+ });
115
+ return leg.build();
116
+ };
117
+
118
+ /**
119
+ * The exact settle config every example shares: the leg's leftover USDC
120
+ * returns to `owner` on Base, and so does the escrow if it expires unfilled.
121
+ */
122
+ const invoiceSettleConfig = (
123
+ sdk: ComposeSdk,
124
+ owner: Address,
125
+ invoice: UsdcInvoice,
126
+ ): ContinuationSettleConfig => ({
127
+ exact: true,
128
+ outcomes: [{ token: USDC, destination: owner, chainId: BASE }],
129
+ validity: { expiresAtMs: Date.now() + VALIDITY_WINDOW_MS },
130
+ provider: 'intent-factory',
131
+ refund: owner,
132
+ continuationFlow: buildInvoiceLeg(sdk, invoice),
133
+ });
134
+
135
+ /**
136
+ * Escrow USDC on Base for an exact continuation leg that pays a Request
137
+ * Network invoice, and return the surplus to the owner.
138
+ *
139
+ * Demonstrates:
140
+ * - `exact: true` on `continuation.settle`: the escrow is bound to the leg's
141
+ * compiled calldata, so the solver runs exactly those bytes and chooses
142
+ * nothing. A committed (non-exact) leg rejects `core.call`, because a
143
+ * balance cannot prove that an invoice was paid; an exact leg admits it.
144
+ * - A leg that pays a third party (`invoice.payee`), which only an exact leg
145
+ * may do: its bytes are fixed at compile time.
146
+ * - The surplus (`usdcAmount` minus the invoice total) as the outcome. The
147
+ * compile proves its floor at the escrow's funding floor, so `minAmount` is
148
+ * omitted. A surplus of 0 proves no floor, and the compile rejects it.
149
+ * - Funding from a declared input, transferred into the escrow inline by the
150
+ * user's transaction.
151
+ *
152
+ * Reading the response:
153
+ * - `settlements.settle.escrow` holds the registered escrow. `binding` holds
154
+ * what the escrow is bound to: the solver's executor (`executionTarget`),
155
+ * the compiled leg (`calldata`), its `approvals`, and the `payload` the
156
+ * settlement service hashes into `payloadHash`.
157
+ * - Inline funding means the user's `execute` transaction funds the escrow.
158
+ * Before submitting it, check that `payloadHash` is the hash of `payload`,
159
+ * for example with viem:
160
+ * `keccak256(binding.payload) === binding.payloadHash.toLowerCase()`.
161
+ * On a mismatch, do not submit.
162
+ *
163
+ * The exact-leg rules:
164
+ * - No leg node may quote off-chain or declare an expiring route:
165
+ * `lifi.swap`, `paraswap.buy`, `core.peek` and any prepared op fail
166
+ * `validation_error` at the leg node, because the bound bytes cannot be
167
+ * re-quoted at fill.
168
+ * - The settle's funding must be an ERC-20 from a declared input, an upstream
169
+ * output, or a `lifi.bridge` or `lifiIntents.order` delivery into the
170
+ * escrow: native funding fails `validation_error`.
171
+ * - The deployment must serve exact legs (an intent-factory provider
172
+ * configured with the solver's executor); elsewhere the settle fails
173
+ * `validation_error` before any registration.
174
+ */
175
+ export const buildContinuationExactInvoiceExample = ({
176
+ owner,
177
+ invoice,
178
+ usdcAmount,
179
+ }: ContinuationExactInvoiceInput): {
180
+ flow: Flow;
181
+ request: ComposeCompileRequest;
182
+ } => {
183
+ const sdk = createComposeSdk({ baseUrl: BASE_URL, apiKey: API_KEY });
184
+
185
+ const builder = sdk.flow(BASE, {
186
+ name: 'pay-invoice',
187
+ inputs: { usdc: resources.erc20(USDC, BASE) },
188
+ });
189
+ builder.continuation.settle('settle', {
190
+ bind: { input: builder.inputs.usdc },
191
+ config: invoiceSettleConfig(sdk, owner, invoice),
192
+ });
193
+
194
+ const flow = builder.build();
195
+
196
+ // No `sweepTo`: the funding moves into the escrow, and the surplus reaches
197
+ // the owner through the settlement, never through the user's proxy.
198
+ const request = sdk.request(flow, {
199
+ signer: owner,
200
+ inputs: {
201
+ usdc: materialisers.directDeposit({ amount: usdcAmount }),
202
+ },
203
+ // The price-impact check compares the flow's input value with its output
204
+ // value. The invoice payment leaves the flow, so the check would count it
205
+ // as lost value (1,050 USDC in, a 50 USDC surplus out: 95% impact) and
206
+ // reject the compile. `0` disables the check.
207
+ maxPriceImpactBps: 0,
208
+ });
209
+
210
+ return { flow, request };
211
+ };
212
+
213
+ /**
214
+ * Pay the same USDC invoice from WETH: the user's transaction swaps WETH to
215
+ * USDC and escrows the swap output for the exact leg.
216
+ *
217
+ * Demonstrates:
218
+ * - An exact settle funded by an upstream output (`swap.amountOut`). The
219
+ * escrow's funding floor is the swap's guaranteed minimum output, and the
220
+ * leg is proven at that floor, so the minimum must exceed the invoice total.
221
+ * - The quote rule applies to the leg only. The main flow runs inside the
222
+ * user's transaction, so its `lifi.swap` may quote; the leg, bound to fixed
223
+ * bytes until the fill, may not.
224
+ */
225
+ export const buildContinuationExactSwapInvoiceExample = ({
226
+ owner,
227
+ invoice,
228
+ wethAmount,
229
+ }: ContinuationExactSwapInvoiceInput): {
230
+ flow: Flow;
231
+ request: ComposeCompileRequest;
232
+ } => {
233
+ const sdk = createComposeSdk({ baseUrl: BASE_URL, apiKey: API_KEY });
234
+
235
+ const builder = sdk.flow(BASE, {
236
+ name: 'swap-and-pay-invoice',
237
+ inputs: { weth: resources.erc20(WETH, BASE) },
238
+ });
239
+ const swap = builder.lifi.swap('swap', {
240
+ bind: { amountIn: builder.inputs.weth },
241
+ config: { resourceOut: resources.erc20(USDC, BASE) },
242
+ });
243
+ builder.continuation.settle('settle', {
244
+ bind: { input: swap.amountOut },
245
+ config: invoiceSettleConfig(sdk, owner, invoice),
246
+ });
247
+
248
+ const flow = builder.build();
249
+
250
+ const request = sdk.request(flow, {
251
+ signer: owner,
252
+ inputs: {
253
+ weth: materialisers.directDeposit({ amount: wethAmount }),
254
+ },
255
+ // The invoice payment leaves the flow, so the price-impact check would
256
+ // count it as lost value. `0` disables the check, and with it the only
257
+ // bound on the swap's price against the market. The swap's minimum output
258
+ // bounds only slippage against its own quote. Before signing, compare
259
+ // that minimum (`settlements.settle.escrow.floor` in the response) with
260
+ // an independent WETH price.
261
+ maxPriceImpactBps: 0,
262
+ });
263
+
264
+ return { flow, request };
265
+ };
266
+
267
+ /**
268
+ * Pay the same USDC invoice on Base from ETH on Arbitrum: the user's
269
+ * transaction swaps ETH to Arbitrum USDC and opens an exact-output LI.FI
270
+ * Intents order whose solver delivers Base USDC into the escrow.
271
+ *
272
+ * Demonstrates:
273
+ * - An exact settle funded by a `lifiIntents.order` delivery: the order omits
274
+ * `destination`, the solver delivers into the escrow on Base, and the user
275
+ * signs one transaction on Arbitrum.
276
+ * - `exactAmountOut` `T`, the invoice total, and `outcomes: []`. The leg pays
277
+ * all of `T`, so nothing is left on Base and the settle commits no outcome.
278
+ * An outcome would need a positive floor, so it would cost an extra unit of
279
+ * funding that only lands on Base as dust.
280
+ * - The escrow registers at `T` itself, with no drift margin: an exact-output
281
+ * order delivers exactly `T` on both of the compile's quotes, so the leg
282
+ * compiles at `T`.
283
+ *
284
+ * Sizing the deposit:
285
+ * - The solver quotes the Arbitrum USDC input `X` it needs for exactly `T`,
286
+ * and the order pulls exactly `X`. The swap's minimum output must cover
287
+ * `X`, or the compile fails with a 422 `preparation_error` whose failed op
288
+ * is a `validation_error` naming both amounts. Deposit enough ETH for the
289
+ * swap's minimum to clear `X` with room to spare.
290
+ * - The rest of the swap output (`order.unspentIn`) returns to `owner` as
291
+ * Arbitrum USDC through `sweepTo`, in the same transaction. All slack
292
+ * (swap slippage, the solver's price, the sizing buffer) lands there, not
293
+ * on Base.
294
+ */
295
+ export const buildContinuationExactIntentInvoiceExample = ({
296
+ owner,
297
+ invoice,
298
+ ethAmount,
299
+ }: ContinuationExactIntentInvoiceInput): {
300
+ flow: Flow;
301
+ request: ComposeCompileRequest;
302
+ } => {
303
+ const sdk = createComposeSdk({ baseUrl: BASE_URL, apiKey: API_KEY });
304
+
305
+ const builder = sdk.flow(ARBITRUM, {
306
+ name: 'intent-and-pay-invoice',
307
+ inputs: { eth: resources.native(ARBITRUM) },
308
+ });
309
+ const swap = builder.lifi.swap('swap', {
310
+ bind: { amountIn: builder.inputs.eth },
311
+ config: { resourceOut: resources.erc20(ARB_USDC, ARBITRUM) },
312
+ });
313
+ const order = builder.lifiIntents.order('order', {
314
+ bind: { amountIn: swap.amountOut },
315
+ config: {
316
+ resourceOut: resources.erc20(USDC, BASE),
317
+ exactAmountOut: `${invoice.amount + invoice.fee}`,
318
+ },
319
+ });
320
+ builder.continuation.settle('settle', {
321
+ bind: { input: order.amountOut },
322
+ config: { ...invoiceSettleConfig(sdk, owner, invoice), outcomes: [] },
323
+ });
324
+
325
+ const flow = builder.build();
326
+
327
+ const request = sdk.request(flow, {
328
+ signer: owner,
329
+ inputs: {
330
+ eth: materialisers.directDeposit({ amount: ethAmount }),
331
+ },
332
+ // Returns the order's unspent Arbitrum USDC to the owner.
333
+ sweepTo: owner,
334
+ // The invoice payment leaves the flow, so the price-impact check would
335
+ // count it as lost value. `0` disables the check; the swap is then bounded
336
+ // only by its slippage against its own quote.
337
+ maxPriceImpactBps: 0,
338
+ });
339
+
340
+ return { flow, request };
341
+ };
@@ -18,6 +18,9 @@
18
18
  * consolidate-eth — consolidate ERC-20 balances to native ETH
19
19
  * continuation-settle — swap USDC to WETH on Base, escrow it for a deferred settlement
20
20
  * continuation-bridge-settle — bridge Arbitrum USDC into a Base settlement escrow
21
+ * continuation-exact-invoice — escrow USDC on Base for an exact leg that pays a Request Network invoice
22
+ * continuation-exact-swap-invoice — swap WETH to USDC on Base, escrow it for the same exact invoice leg
23
+ * continuation-exact-intent-invoice — swap Arbitrum ETH to USDC, order exactly the invoice total on Base for the same exact leg, with no outcome
21
24
  * deposit-proxy — deposit tokens already on the proxy into Aave
22
25
  * dust-sweep — split USDC 80/20 and sweep leftover dust
23
26
  * swap — swap WETH to USDC via LI.FI
@@ -65,6 +68,12 @@ import { API_KEY, BASE_URL, OWNER, PROXY, RECIPIENT } from './config.js';
65
68
  import { buildConsolidateToEth } from './consolidateToEth.js';
66
69
  import { buildConsolidateStablesToUsdc } from './consolidateToUsdc.js';
67
70
  import { buildContinuationBridgeSettleExample } from './continuationBridgeSettle.js';
71
+ import {
72
+ buildContinuationExactIntentInvoiceExample,
73
+ buildContinuationExactInvoiceExample,
74
+ buildContinuationExactSwapInvoiceExample,
75
+ SAMPLE_INVOICE,
76
+ } from './continuationExactInvoice.js';
68
77
  import { buildContinuationSettleExample } from './continuationSettle.js';
69
78
  import { buildDepositFromProxy } from './depositFromProxy.js';
70
79
  import { buildDustSweepExample } from './dustSweep.js';
@@ -142,6 +151,24 @@ const EXAMPLES: Record<string, () => ComposeCompileRequest> = {
142
151
  buildContinuationSettleExample({ owner: OWNER }).request,
143
152
  'continuation-bridge-settle': () =>
144
153
  buildContinuationBridgeSettleExample({ owner: OWNER }).request,
154
+ 'continuation-exact-invoice': () =>
155
+ buildContinuationExactInvoiceExample({
156
+ owner: OWNER,
157
+ invoice: SAMPLE_INVOICE,
158
+ usdcAmount: '1050000000',
159
+ }).request,
160
+ 'continuation-exact-swap-invoice': () =>
161
+ buildContinuationExactSwapInvoiceExample({
162
+ owner: OWNER,
163
+ invoice: SAMPLE_INVOICE,
164
+ wethAmount: '1000000000000000000',
165
+ }).request,
166
+ 'continuation-exact-intent-invoice': () =>
167
+ buildContinuationExactIntentInvoiceExample({
168
+ owner: OWNER,
169
+ invoice: SAMPLE_INVOICE,
170
+ ethAmount: '500000000000000000',
171
+ }).request,
145
172
  'deposit-proxy': () =>
146
173
  buildDepositFromProxy({
147
174
  owner: OWNER,
@@ -1286,35 +1286,18 @@ export interface FlySwapConfig {
1286
1286
  export type Between86400000000000008640000000000000 = number;
1287
1287
 
1288
1288
  export interface ContinuationSettleConfig {
1289
- /**
1290
- * @minItems 1
1291
- */
1292
- outcomes: [
1293
- {
1294
- /**
1295
- * EVM address: 0x followed by 40 hex characters
1296
- */
1297
- token: Address;
1298
- minAmount?: IntegerStringInput;
1299
- /**
1300
- * EVM address: 0x followed by 40 hex characters
1301
- */
1302
- destination: Address;
1303
- chainId: Positive;
1304
- },
1305
- ...{
1306
- /**
1307
- * EVM address: 0x followed by 40 hex characters
1308
- */
1309
- token: Address;
1310
- minAmount?: IntegerStringInput;
1311
- /**
1312
- * EVM address: 0x followed by 40 hex characters
1313
- */
1314
- destination: Address;
1315
- chainId: Positive;
1316
- }[],
1317
- ];
1289
+ outcomes: {
1290
+ /**
1291
+ * EVM address: 0x followed by 40 hex characters
1292
+ */
1293
+ token: Address;
1294
+ minAmount?: IntegerStringInput;
1295
+ /**
1296
+ * EVM address: 0x followed by 40 hex characters
1297
+ */
1298
+ destination: Address;
1299
+ chainId: Positive;
1300
+ }[];
1318
1301
  continuationFlow?: Flow;
1319
1302
  validity: {
1320
1303
  expiresAtMs: Between86400000000000008640000000000000;
@@ -1436,6 +1419,7 @@ export interface LifiIntentsOrderConfig {
1436
1419
  slippage?: LessThan1;
1437
1420
  validitySeconds?: Between1300;
1438
1421
  exclusiveSeconds?: Between0120;
1422
+ exactAmountOut?: string;
1439
1423
  }
1440
1424
 
1441
1425
  export interface LifiIntentsRefundConfig {
package/src/index.ts CHANGED
@@ -99,6 +99,7 @@ export type {
99
99
  Erc20BalanceRequirement,
100
100
  NativeBalanceRequirement,
101
101
  Erc20AllowanceRequirement,
102
+ Permit2AllowanceRequirement,
102
103
  ContinuationIntent,
103
104
  ContinuationOutcome,
104
105
  SettlementWire,