@lifi/composer-sdk 0.10.0 → 0.12.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 +36 -4
- package/dist/authoring/raw.cjs +21 -8
- package/dist/authoring/raw.cjs.map +1 -1
- package/dist/authoring/raw.d.cts +21 -8
- package/dist/authoring/raw.d.ts +21 -8
- package/dist/authoring/raw.js +21 -8
- package/dist/authoring/raw.js.map +1 -1
- package/dist/authoring/signatureArgs.cjs +10 -3
- package/dist/authoring/signatureArgs.cjs.map +1 -1
- package/dist/authoring/signatureArgs.d.cts +23 -16
- package/dist/authoring/signatureArgs.d.ts +23 -16
- package/dist/authoring/signatureArgs.js +10 -3
- package/dist/authoring/signatureArgs.js.map +1 -1
- package/dist/client.cjs +11 -1
- package/dist/client.cjs.map +1 -1
- package/dist/client.js +11 -1
- package/dist/client.js.map +1 -1
- package/dist/errors.cjs +35 -13
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts +19 -1
- package/dist/errors.d.ts +19 -1
- package/dist/errors.js +35 -14
- package/dist/errors.js.map +1 -1
- package/dist/generated/config.generated.d.cts +98 -2
- package/dist/generated/config.generated.d.ts +98 -2
- package/dist/generated/operations.generated.cjs +10 -0
- package/dist/generated/operations.generated.cjs.map +1 -1
- package/dist/generated/operations.generated.d.cts +57 -2
- package/dist/generated/operations.generated.d.ts +57 -2
- package/dist/generated/operations.generated.js +10 -0
- package/dist/generated/operations.generated.js.map +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/outputs.cjs +3 -2
- package/dist/outputs.cjs.map +1 -1
- package/dist/outputs.d.cts +3 -2
- package/dist/outputs.d.ts +3 -2
- package/dist/outputs.js +3 -2
- package/dist/outputs.js.map +1 -1
- package/dist/responseSchemas.cjs.map +1 -1
- package/dist/responseSchemas.d.cts +2 -2
- package/dist/responseSchemas.d.ts +2 -2
- package/dist/responseSchemas.js.map +1 -1
- package/dist/run/inputs.cjs +0 -1
- package/dist/run/inputs.cjs.map +1 -1
- package/dist/run/inputs.d.cts +3 -11
- package/dist/run/inputs.d.ts +3 -11
- package/dist/run/inputs.js +0 -1
- package/dist/run/inputs.js.map +1 -1
- package/dist/sdk.cjs +0 -1
- package/dist/sdk.cjs.map +1 -1
- package/dist/sdk.js +0 -1
- package/dist/sdk.js.map +1 -1
- package/package.json +2 -2
- package/src/authoring/raw.ts +21 -8
- package/src/authoring/signatureArgs.ts +53 -23
- package/src/client.ts +24 -1
- package/src/errors.ts +48 -17
- package/src/examples/continuationBridgeSettle.ts +99 -0
- package/src/examples/continuationSettle.ts +113 -0
- package/src/examples/run.ts +8 -0
- package/src/generated/config.generated.ts +111 -2
- package/src/generated/operations.generated.ts +99 -1
- package/src/index.ts +6 -2
- package/src/outputs.ts +3 -2
- package/src/responseSchemas.ts +9 -5
- package/src/run/inputs.ts +3 -12
- package/src/sdk.ts +0 -1
- package/src/examples/swapWithFee.ts +0 -59
package/dist/index.d.cts
CHANGED
|
@@ -3,8 +3,8 @@ import { AnyHandle, AnyRefBindable, Bindable, FamilyCount, FamilySource, InputHa
|
|
|
3
3
|
import { AnyBindable, FlowOptions, TypedFlow } from "./authoring/FlowBuilderCore.cjs";
|
|
4
4
|
import { ref } from "./authoring/raw.cjs";
|
|
5
5
|
import { ChainSummary, GetZapPacksOptions, ZapPackEdge, ZapPackOverview } from "./discovery.cjs";
|
|
6
|
-
import { ComposeError, ComposeErrorCode, ComposePreparationOps, ComposeSdkOutdated, ComposeServerOutdated, isComposeError, isComposePreparationError, isComposeSdkOutdatedError, isComposeServerOutdatedError } from "./errors.cjs";
|
|
7
|
-
import { AaveBorrowConfig, AaveClaimRewardsConfig, AaveGetHealthFactorConfig, AaveRepayConfig, AaveRepayWithATokensConfig, AaveSetEModeConfig, BalanceOfMaterialiserConfig, BandGuardConfig, Between01, Between010000, Between0255, Between03318, Between05000, Between0999999, Between19999, Between887272887272, CallMaterialiserConfig, CoreApproveConfig, CoreAsResourceConfig, CoreBalanceOfConfig, CoreBpsDownConfig, CoreBpsUpConfig, CoreCallConfig, CoreEmitEvent1Config, CoreEmitEvent2Config, CoreEmitEvent3Config, CoreEmitEvent4Config, CoreInvokeConfig, CoreNumericInvariantGuardConfig, CorePartitionConfig, CorePeekConfig, CoreRawCallConfig, CoreSplitAtConfig, CoreSplitConfig, CoreStaticCallConfig, CoreTransferConfig, DirectDepositMaterialiserConfig, Erc20AllowancePreconditionConfig, Erc20BalancePreconditionConfig, FlashloanMaterialiserConfig, FlySwapConfig, InvariantEqConfig, InvariantGtConfig, InvariantGteConfig, InvariantLtConfig, InvariantLteConfig, InvariantNeqConfig, InvariantNumericConfig, InvariantNumericInRangeConfig, LifiBridgeConfig, LifiFlashloanRepayConfig, LifiSwapConfig, LifiZapAsyncConfig, LifiZapConfig, MaxItems16, MaxItems50, MaxLength64, MaxLength65536, MorphoBlueBorrowConfig, MorphoBlueGetPositionConfig, MorphoBlueRepayConfig, MorphoBlueSupplyCollateralConfig, MorphoBlueSupplyConfig, MorphoBlueWithdrawCollateralConfig, MorphoBlueWithdrawConfig, NativeBalancePreconditionConfig, NonNegative, ParaswapBuyConfig, Positive, SlippageGuardConfig, StartsWith0X, UniswapV2AddLiquidityConfig, UniswapV2RemoveLiquidityConfig, UniswapV3IncreaseLiquidityConfig, UniswapV3MintConfig } from "./generated/config.generated.cjs";
|
|
6
|
+
import { ComposeError, ComposeErrorCode, ComposePreparationOps, ComposeSdkOutdated, ComposeServerOutdated, isComposeDeliveryError, isComposeError, isComposePreparationError, isComposeSdkOutdatedError, isComposeServerOutdatedError } from "./errors.cjs";
|
|
7
|
+
import { AaveBorrowConfig, AaveClaimRewardsConfig, AaveGetHealthFactorConfig, AaveRepayConfig, AaveRepayWithATokensConfig, AaveSetEModeConfig, BalanceOfMaterialiserConfig, BandGuardConfig, Between01, Between010000, Between0120, Between0255, Between03318, Between05000, Between0999999, Between1300, Between19999, Between86400000000000008640000000000000, Between887272887272, CallMaterialiserConfig, ContinuationSettleConfig, CoreApproveConfig, CoreAsResourceConfig, CoreBalanceOfConfig, CoreBpsDownConfig, CoreBpsUpConfig, CoreCallConfig, CoreEmitEvent1Config, CoreEmitEvent2Config, CoreEmitEvent3Config, CoreEmitEvent4Config, CoreInvokeConfig, CoreNumericInvariantGuardConfig, CorePartitionConfig, CorePeekConfig, CoreRawCallConfig, CoreSplitAtConfig, CoreSplitConfig, CoreStaticCallConfig, CoreTransferConfig, DirectDepositMaterialiserConfig, Erc20AllowancePreconditionConfig, Erc20BalancePreconditionConfig, FlashloanMaterialiserConfig, FlySwapConfig, InvariantEqConfig, InvariantGtConfig, InvariantGteConfig, InvariantLtConfig, InvariantLteConfig, InvariantNeqConfig, InvariantNumericConfig, InvariantNumericInRangeConfig, LessThan1, LifiBridgeConfig, LifiFlashloanRepayConfig, LifiIntentsAttestNonFillConfig, LifiIntentsOrderConfig, LifiIntentsRefundConfig, LifiIntentsRefundOnNonFillConfig, LifiSwapConfig, LifiZapAsyncConfig, LifiZapConfig, MaxItems16, MaxItems50, MaxLength64, MaxLength65536, MorphoBlueBorrowConfig, MorphoBlueGetPositionConfig, MorphoBlueRepayConfig, MorphoBlueSupplyCollateralConfig, MorphoBlueSupplyConfig, MorphoBlueWithdrawCollateralConfig, MorphoBlueWithdrawConfig, NativeBalancePreconditionConfig, NonNegative, ParaswapBuyConfig, Positive, SlippageGuardConfig, StartsWith0X, UniswapV2AddLiquidityConfig, UniswapV2RemoveLiquidityConfig, UniswapV3IncreaseLiquidityConfig, UniswapV3MintConfig } from "./generated/config.generated.cjs";
|
|
8
8
|
import { guards_generated_d_exports } from "./generated/guards.generated.cjs";
|
|
9
9
|
import { materialisers_generated_d_exports } from "./generated/materialisers.generated.cjs";
|
|
10
10
|
import { preconditions_generated_d_exports } from "./generated/preconditions.generated.cjs";
|
|
@@ -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,
|
|
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";
|
|
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, Between0255, Between03318, Between05000, Between0999999, Between19999, 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
|
|
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 };
|
|
107
107
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { AnyHandle, AnyRefBindable, Bindable, FamilyCount, FamilySource, InputHa
|
|
|
3
3
|
import { AnyBindable, FlowOptions, TypedFlow } from "./authoring/FlowBuilderCore.js";
|
|
4
4
|
import { ref } from "./authoring/raw.js";
|
|
5
5
|
import { ChainSummary, GetZapPacksOptions, ZapPackEdge, ZapPackOverview } from "./discovery.js";
|
|
6
|
-
import { ComposeError, ComposeErrorCode, ComposePreparationOps, ComposeSdkOutdated, ComposeServerOutdated, isComposeError, isComposePreparationError, isComposeSdkOutdatedError, isComposeServerOutdatedError } from "./errors.js";
|
|
7
|
-
import { AaveBorrowConfig, AaveClaimRewardsConfig, AaveGetHealthFactorConfig, AaveRepayConfig, AaveRepayWithATokensConfig, AaveSetEModeConfig, BalanceOfMaterialiserConfig, BandGuardConfig, Between01, Between010000, Between0255, Between03318, Between05000, Between0999999, Between19999, Between887272887272, CallMaterialiserConfig, CoreApproveConfig, CoreAsResourceConfig, CoreBalanceOfConfig, CoreBpsDownConfig, CoreBpsUpConfig, CoreCallConfig, CoreEmitEvent1Config, CoreEmitEvent2Config, CoreEmitEvent3Config, CoreEmitEvent4Config, CoreInvokeConfig, CoreNumericInvariantGuardConfig, CorePartitionConfig, CorePeekConfig, CoreRawCallConfig, CoreSplitAtConfig, CoreSplitConfig, CoreStaticCallConfig, CoreTransferConfig, DirectDepositMaterialiserConfig, Erc20AllowancePreconditionConfig, Erc20BalancePreconditionConfig, FlashloanMaterialiserConfig, FlySwapConfig, InvariantEqConfig, InvariantGtConfig, InvariantGteConfig, InvariantLtConfig, InvariantLteConfig, InvariantNeqConfig, InvariantNumericConfig, InvariantNumericInRangeConfig, LifiBridgeConfig, LifiFlashloanRepayConfig, LifiSwapConfig, LifiZapAsyncConfig, LifiZapConfig, MaxItems16, MaxItems50, MaxLength64, MaxLength65536, MorphoBlueBorrowConfig, MorphoBlueGetPositionConfig, MorphoBlueRepayConfig, MorphoBlueSupplyCollateralConfig, MorphoBlueSupplyConfig, MorphoBlueWithdrawCollateralConfig, MorphoBlueWithdrawConfig, NativeBalancePreconditionConfig, NonNegative, ParaswapBuyConfig, Positive, SlippageGuardConfig, StartsWith0X, UniswapV2AddLiquidityConfig, UniswapV2RemoveLiquidityConfig, UniswapV3IncreaseLiquidityConfig, UniswapV3MintConfig } from "./generated/config.generated.js";
|
|
6
|
+
import { ComposeError, ComposeErrorCode, ComposePreparationOps, ComposeSdkOutdated, ComposeServerOutdated, isComposeDeliveryError, isComposeError, isComposePreparationError, isComposeSdkOutdatedError, isComposeServerOutdatedError } from "./errors.js";
|
|
7
|
+
import { AaveBorrowConfig, AaveClaimRewardsConfig, AaveGetHealthFactorConfig, AaveRepayConfig, AaveRepayWithATokensConfig, AaveSetEModeConfig, BalanceOfMaterialiserConfig, BandGuardConfig, Between01, Between010000, Between0120, Between0255, Between03318, Between05000, Between0999999, Between1300, Between19999, Between86400000000000008640000000000000, Between887272887272, CallMaterialiserConfig, ContinuationSettleConfig, CoreApproveConfig, CoreAsResourceConfig, CoreBalanceOfConfig, CoreBpsDownConfig, CoreBpsUpConfig, CoreCallConfig, CoreEmitEvent1Config, CoreEmitEvent2Config, CoreEmitEvent3Config, CoreEmitEvent4Config, CoreInvokeConfig, CoreNumericInvariantGuardConfig, CorePartitionConfig, CorePeekConfig, CoreRawCallConfig, CoreSplitAtConfig, CoreSplitConfig, CoreStaticCallConfig, CoreTransferConfig, DirectDepositMaterialiserConfig, Erc20AllowancePreconditionConfig, Erc20BalancePreconditionConfig, FlashloanMaterialiserConfig, FlySwapConfig, InvariantEqConfig, InvariantGtConfig, InvariantGteConfig, InvariantLtConfig, InvariantLteConfig, InvariantNeqConfig, InvariantNumericConfig, InvariantNumericInRangeConfig, LessThan1, LifiBridgeConfig, LifiFlashloanRepayConfig, LifiIntentsAttestNonFillConfig, LifiIntentsOrderConfig, LifiIntentsRefundConfig, LifiIntentsRefundOnNonFillConfig, LifiSwapConfig, LifiZapAsyncConfig, LifiZapConfig, MaxItems16, MaxItems50, MaxLength64, MaxLength65536, MorphoBlueBorrowConfig, MorphoBlueGetPositionConfig, MorphoBlueRepayConfig, MorphoBlueSupplyCollateralConfig, MorphoBlueSupplyConfig, MorphoBlueWithdrawCollateralConfig, MorphoBlueWithdrawConfig, NativeBalancePreconditionConfig, NonNegative, ParaswapBuyConfig, Positive, SlippageGuardConfig, StartsWith0X, UniswapV2AddLiquidityConfig, UniswapV2RemoveLiquidityConfig, UniswapV3IncreaseLiquidityConfig, UniswapV3MintConfig } from "./generated/config.generated.js";
|
|
8
8
|
import { guards_generated_d_exports } from "./generated/guards.generated.js";
|
|
9
9
|
import { materialisers_generated_d_exports } from "./generated/materialisers.generated.js";
|
|
10
10
|
import { preconditions_generated_d_exports } from "./generated/preconditions.generated.js";
|
|
@@ -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,
|
|
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";
|
|
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, Between0255, Between03318, Between05000, Between0999999, Between19999, 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
|
|
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 };
|
|
107
107
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isComposeError, isComposePreparationError, isComposeSdkOutdatedError, isComposeServerOutdatedError } from "./errors.js";
|
|
1
|
+
import { isComposeDeliveryError, isComposeError, isComposePreparationError, isComposeSdkOutdatedError, isComposeServerOutdatedError } from "./errors.js";
|
|
2
2
|
import { buildReachability } from "./reachability.js";
|
|
3
3
|
import { isInputHandle, isOutputHandle } from "./authoring/handles.js";
|
|
4
4
|
import { ref } from "./authoring/raw.js";
|
|
@@ -99,6 +99,6 @@ const routeAmount = routeAmount_exports;
|
|
|
99
99
|
*/
|
|
100
100
|
const raw = raw_exports;
|
|
101
101
|
//#endregion
|
|
102
|
-
export { SIMULATE_MAX_REQUIREMENTS, SIMULATE_MAX_TRACKED_BALANCES, buildReachability, buildSimulateRequest, createComposeSdk, guards, isComposeError, isComposePreparationError, isComposeSdkOutdatedError, isComposeServerOutdatedError, isInputHandle, isOutputHandle, materialiser, materialisers, preconditions, raw, ref, resources, routeAmount, terminalOutputs };
|
|
102
|
+
export { SIMULATE_MAX_REQUIREMENTS, SIMULATE_MAX_TRACKED_BALANCES, buildReachability, buildSimulateRequest, createComposeSdk, guards, isComposeDeliveryError, isComposeError, isComposePreparationError, isComposeSdkOutdatedError, isComposeServerOutdatedError, isInputHandle, isOutputHandle, materialiser, materialisers, preconditions, raw, ref, resources, routeAmount, terminalOutputs };
|
|
103
103
|
|
|
104
104
|
//# sourceMappingURL=index.js.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
|
|
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"}
|
package/dist/outputs.cjs
CHANGED
|
@@ -2,8 +2,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
//#region src/outputs.ts
|
|
3
3
|
/**
|
|
4
4
|
* The entries of `outputs` the caller actually receives: every port no later
|
|
5
|
-
* node spends, keyed `<nodeId>.<portName>` as on the wire
|
|
6
|
-
*
|
|
5
|
+
* node spends, keyed `<nodeId>.<portName>` as on the wire, and every resource
|
|
6
|
+
* input no node spends, keyed `input.<name>`. Consumed ports (intermediate
|
|
7
|
+
* amounts a later op takes as input) are dropped.
|
|
7
8
|
*/
|
|
8
9
|
const terminalOutputs = (outputs) => Object.fromEntries(Object.entries(outputs).filter((entry) => entry[1].role === "terminal"));
|
|
9
10
|
//#endregion
|
package/dist/outputs.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outputs.cjs","names":[],"sources":["../src/outputs.ts"],"sourcesContent":["import type { Outputs, TerminalOutput } from '@lifi/compose-spec';\n\n/**\n * The entries of `outputs` the caller actually receives: every port no later\n * node spends, keyed `<nodeId>.<portName>` as on the wire
|
|
1
|
+
{"version":3,"file":"outputs.cjs","names":[],"sources":["../src/outputs.ts"],"sourcesContent":["import type { Outputs, TerminalOutput } from '@lifi/compose-spec';\n\n/**\n * The entries of `outputs` the caller actually receives: every port no later\n * node spends, keyed `<nodeId>.<portName>` as on the wire, and every resource\n * input no node spends, keyed `input.<name>`. Consumed ports (intermediate\n * amounts a later op takes as input) are dropped.\n */\nexport const terminalOutputs = (\n outputs: Outputs,\n): Record<string, TerminalOutput> =>\n Object.fromEntries(\n Object.entries(outputs).filter(\n (entry): entry is [string, TerminalOutput] =>\n entry[1].role === 'terminal',\n ),\n );\n"],"mappings":";;;;;;;;AAQA,MAAa,mBACX,YAEA,OAAO,YACL,OAAO,QAAQ,OAAO,CAAC,CAAC,QACrB,UACC,MAAM,EAAE,CAAC,SAAS,UACtB,CACF"}
|
package/dist/outputs.d.cts
CHANGED
|
@@ -2,8 +2,9 @@ import { Outputs, TerminalOutput } from "@lifi/compose-spec";
|
|
|
2
2
|
//#region src/outputs.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* The entries of `outputs` the caller actually receives: every port no later
|
|
5
|
-
* node spends, keyed `<nodeId>.<portName>` as on the wire
|
|
6
|
-
*
|
|
5
|
+
* node spends, keyed `<nodeId>.<portName>` as on the wire, and every resource
|
|
6
|
+
* input no node spends, keyed `input.<name>`. Consumed ports (intermediate
|
|
7
|
+
* amounts a later op takes as input) are dropped.
|
|
7
8
|
*/
|
|
8
9
|
export declare const terminalOutputs: (outputs: Outputs) => Record<string, TerminalOutput>;
|
|
9
10
|
//#endregion
|
package/dist/outputs.d.ts
CHANGED
|
@@ -2,8 +2,9 @@ import { Outputs, TerminalOutput } from "@lifi/compose-spec";
|
|
|
2
2
|
//#region src/outputs.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* The entries of `outputs` the caller actually receives: every port no later
|
|
5
|
-
* node spends, keyed `<nodeId>.<portName>` as on the wire
|
|
6
|
-
*
|
|
5
|
+
* node spends, keyed `<nodeId>.<portName>` as on the wire, and every resource
|
|
6
|
+
* input no node spends, keyed `input.<name>`. Consumed ports (intermediate
|
|
7
|
+
* amounts a later op takes as input) are dropped.
|
|
7
8
|
*/
|
|
8
9
|
export declare const terminalOutputs: (outputs: Outputs) => Record<string, TerminalOutput>;
|
|
9
10
|
//#endregion
|
package/dist/outputs.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
//#region src/outputs.ts
|
|
2
2
|
/**
|
|
3
3
|
* The entries of `outputs` the caller actually receives: every port no later
|
|
4
|
-
* node spends, keyed `<nodeId>.<portName>` as on the wire
|
|
5
|
-
*
|
|
4
|
+
* node spends, keyed `<nodeId>.<portName>` as on the wire, and every resource
|
|
5
|
+
* input no node spends, keyed `input.<name>`. Consumed ports (intermediate
|
|
6
|
+
* amounts a later op takes as input) are dropped.
|
|
6
7
|
*/
|
|
7
8
|
const terminalOutputs = (outputs) => Object.fromEntries(Object.entries(outputs).filter((entry) => entry[1].role === "terminal"));
|
|
8
9
|
//#endregion
|
package/dist/outputs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outputs.js","names":[],"sources":["../src/outputs.ts"],"sourcesContent":["import type { Outputs, TerminalOutput } from '@lifi/compose-spec';\n\n/**\n * The entries of `outputs` the caller actually receives: every port no later\n * node spends, keyed `<nodeId>.<portName>` as on the wire
|
|
1
|
+
{"version":3,"file":"outputs.js","names":[],"sources":["../src/outputs.ts"],"sourcesContent":["import type { Outputs, TerminalOutput } from '@lifi/compose-spec';\n\n/**\n * The entries of `outputs` the caller actually receives: every port no later\n * node spends, keyed `<nodeId>.<portName>` as on the wire, and every resource\n * input no node spends, keyed `input.<name>`. Consumed ports (intermediate\n * amounts a later op takes as input) are dropped.\n */\nexport const terminalOutputs = (\n outputs: Outputs,\n): Record<string, TerminalOutput> =>\n Object.fromEntries(\n Object.entries(outputs).filter(\n (entry): entry is [string, TerminalOutput] =>\n entry[1].role === 'terminal',\n ),\n );\n"],"mappings":";;;;;;;AAQA,MAAa,mBACX,YAEA,OAAO,YACL,OAAO,QAAQ,OAAO,CAAC,CAAC,QACrB,UACC,MAAM,EAAE,CAAC,SAAS,UACtB,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responseSchemas.cjs","names":["z"],"sources":["../src/responseSchemas.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"responseSchemas.cjs","names":["z"],"sources":["../src/responseSchemas.ts"],"sourcesContent":["import type {\n DeliveryErrorDetails,\n SimulateResult,\n SimulationRevert,\n} from '@lifi/compose-spec';\nimport z from 'zod';\n\n/**\n * Zod-backed parsers for Compose API response bodies.\n *\n * Server responses are untrusted input crossing into the SDK, so the shapes the\n * client reads back are validated here rather than asserted with `as` casts. The\n * schemas are module-private (the package builds with `--isolatedDeclarations`,\n * which forbids exporting un-annotated complex values); the public surface is\n * the typed `parse*` helpers, whose explicit return types double as the contract.\n *\n * The simulate union is the one response the SDK fully owns and parses itself\n * (it is un-enveloped, unlike `/compose`), so it gets a complete schema kept in\n * lockstep with the canonical `SimulateResult` in `@lifi/compose-spec` by the\n * compile-time assertion below — the same anchoring `@lifi/api-schemas` uses for\n * its server-side simulate schema, so the two cannot silently drift.\n */\n\nconst balanceEntrySchema = z.object({\n token: z.string(),\n owner: z.string(),\n amount: z.string(),\n});\n\nconst simulateOkSchema = z.object({\n status: z.literal('ok'),\n block: z.number(),\n timestamp: z.number(),\n balancesBefore: z.array(balanceEntrySchema),\n balancesAfter: z.array(balanceEntrySchema),\n deltas: z.array(balanceEntrySchema),\n gasUsed: z.string(),\n});\n\nconst simulateRevertDecodeResultSchema = z.object({\n errorCandidates: z\n .array(\n z.object({\n decodedErrorSignature: z.string(),\n decodedParams: z.array(z.string()),\n }),\n )\n .optional(),\n error: z.string().optional(),\n});\n\nconst simulateRevertSchema = z.object({\n status: z.literal('revert'),\n block: z.number(),\n timestamp: z.number(),\n revertReason: z.string().optional(),\n code: z.number().optional(),\n rawErrorBytes: z.string().optional(),\n decodeResult: simulateRevertDecodeResultSchema.optional(),\n});\n\nconst simulateSetupErrorSchema = z.object({\n status: z.literal('error'),\n message: z.string(),\n});\n\nconst simulateResultSchema = z.discriminatedUnion('status', [\n simulateOkSchema,\n simulateRevertSchema,\n simulateSetupErrorSchema,\n]);\n\n// The type the schema actually parses out. Kept private (referencing it from an\n// exported declaration would break `--isolatedDeclarations`) and pinned to the\n// canonical `SimulateResult` inside `parseSimulateResult` below.\ntype SimulateResultWire = z.infer<typeof simulateResultSchema>;\n\n/**\n * Parses a `POST /simulate` body into a {@link SimulateResult}. Returns `null`\n * when the body does not match the `ok`/`revert`/`error` union, letting the\n * caller raise a transport-level error.\n */\nexport const parseSimulateResult = (body: unknown): SimulateResult | null => {\n const parsed = simulateResultSchema.safeParse(body);\n if (!parsed.success) return null;\n // Pin the schema to the canonical contract in both directions, so it cannot\n // silently drift (mirroring the conformance assertion `@lifi/api-schemas` runs\n // on its server-side simulate schema). Assigning the inferred wire value to a\n // `SimulateResult` checks wire→spec; `satisfies SimulateResultWire` checks\n // spec→wire. A missing or mistyped field on either side fails to compile.\n const result: SimulateResult = parsed.data;\n return result satisfies SimulateResultWire;\n};\n\n/**\n * The validated members of an HTTP 206 partial compile envelope. `data` is\n * verified to be an object at runtime but left `unknown` here — compose-spec\n * owns its full shape (`ComposeCompilePartialData`) as a hand-authored type, so\n * the caller narrows it in one step. `error` is fully validated.\n */\nexport interface CompilePartialEnvelope {\n readonly data: unknown;\n readonly error: { readonly kind: string; readonly message: string };\n}\n\nconst compilePartialEnvelopeSchema = z.object({\n data: z.record(z.string(), z.unknown()),\n error: z.object({ kind: z.string(), message: z.string() }),\n});\n\n/** Parses an HTTP 206 partial compile envelope; `null` when it does not match. */\nexport const parseCompilePartialEnvelope = (\n body: unknown,\n): CompilePartialEnvelope | null => {\n const parsed = compilePartialEnvelopeSchema.safeParse(body);\n return parsed.success ? parsed.data : null;\n};\n\n/**\n * A single prepared-op failure inside a `preparation_error` envelope. `kind` is\n * kept as `string` here — the narrowing to `GenericComposeErrorKind` happens in\n * `errorFromHttpResponse`, where the value is lifted onto `ComposeError`.\n */\nexport interface ServerFailedPreparedOp {\n readonly callId: string;\n readonly op: string;\n readonly kind: string;\n readonly message: string;\n readonly path?: string;\n readonly port?: string;\n readonly fix?: string;\n}\n\n/** Error envelope returned on non-2xx responses. */\nexport interface ServerErrorBody {\n readonly error?: {\n readonly kind?: string;\n readonly message?: string;\n readonly path?: string;\n readonly port?: string;\n readonly fix?: string;\n readonly sdkVersion?: string;\n readonly serverVersion?: string;\n readonly minimumSdkVersion?: string;\n readonly details?: SimulationRevert | DeliveryErrorDetails;\n readonly failedOps?: readonly ServerFailedPreparedOp[];\n readonly succeededOps?: readonly string[];\n };\n}\n\nconst failedPreparedOpSchema = z.object({\n callId: z.string(),\n op: z.string(),\n kind: z.string(),\n message: z.string(),\n path: z.string().optional(),\n port: z.string().optional(),\n fix: z.string().optional(),\n});\n\n// `details` is passed through (`z.custom`) rather than parsed: the SDK does not\n// own the `SimulationRevert` or `DeliveryErrorDetails` schemas and forwards\n// the field verbatim onto `ComposeError`.\n//\n// `failedOps`/`succeededOps` are optional here because every error kind shares\n// this envelope; they are only populated for `preparation_error` (422). Zod\n// strips undeclared keys, so omitting them would silently drop them — which is\n// also why `port` and `fix`, set on every author-caused `validation_error`,\n// have to be declared here to reach the caller.\nconst serverErrorBodySchema = z.object({\n error: z\n .object({\n kind: z.string().optional(),\n message: z.string().optional(),\n path: z.string().optional(),\n port: z.string().optional(),\n fix: z.string().optional(),\n sdkVersion: z.string().optional(),\n serverVersion: z.string().optional(),\n minimumSdkVersion: z.string().optional(),\n details: z.custom<SimulationRevert | DeliveryErrorDetails>().optional(),\n failedOps: z.array(failedPreparedOpSchema).readonly().optional(),\n succeededOps: z.array(z.string()).readonly().optional(),\n })\n .optional(),\n});\n\n/** Validates an already-parsed error envelope; `null` when it does not match. */\nexport const parseServerErrorBody = (json: unknown): ServerErrorBody | null => {\n const parsed = serverErrorBodySchema.safeParse(json);\n return parsed.success ? parsed.data : null;\n};\n"],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SimulateResult, SimulationRevert } from "@lifi/compose-spec";
|
|
1
|
+
import { DeliveryErrorDetails, SimulateResult, SimulationRevert } from "@lifi/compose-spec";
|
|
2
2
|
//#region src/responseSchemas.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Parses a `POST /simulate` body into a {@link SimulateResult}. Returns `null`
|
|
@@ -46,7 +46,7 @@ export interface ServerErrorBody {
|
|
|
46
46
|
readonly sdkVersion?: string;
|
|
47
47
|
readonly serverVersion?: string;
|
|
48
48
|
readonly minimumSdkVersion?: string;
|
|
49
|
-
readonly details?: SimulationRevert;
|
|
49
|
+
readonly details?: SimulationRevert | DeliveryErrorDetails;
|
|
50
50
|
readonly failedOps?: readonly ServerFailedPreparedOp[];
|
|
51
51
|
readonly succeededOps?: readonly string[];
|
|
52
52
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SimulateResult, SimulationRevert } from "@lifi/compose-spec";
|
|
1
|
+
import { DeliveryErrorDetails, SimulateResult, SimulationRevert } from "@lifi/compose-spec";
|
|
2
2
|
//#region src/responseSchemas.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Parses a `POST /simulate` body into a {@link SimulateResult}. Returns `null`
|
|
@@ -46,7 +46,7 @@ export interface ServerErrorBody {
|
|
|
46
46
|
readonly sdkVersion?: string;
|
|
47
47
|
readonly serverVersion?: string;
|
|
48
48
|
readonly minimumSdkVersion?: string;
|
|
49
|
-
readonly details?: SimulationRevert;
|
|
49
|
+
readonly details?: SimulationRevert | DeliveryErrorDetails;
|
|
50
50
|
readonly failedOps?: readonly ServerFailedPreparedOp[];
|
|
51
51
|
readonly succeededOps?: readonly string[];
|
|
52
52
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responseSchemas.js","names":[],"sources":["../src/responseSchemas.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"responseSchemas.js","names":[],"sources":["../src/responseSchemas.ts"],"sourcesContent":["import type {\n DeliveryErrorDetails,\n SimulateResult,\n SimulationRevert,\n} from '@lifi/compose-spec';\nimport z from 'zod';\n\n/**\n * Zod-backed parsers for Compose API response bodies.\n *\n * Server responses are untrusted input crossing into the SDK, so the shapes the\n * client reads back are validated here rather than asserted with `as` casts. The\n * schemas are module-private (the package builds with `--isolatedDeclarations`,\n * which forbids exporting un-annotated complex values); the public surface is\n * the typed `parse*` helpers, whose explicit return types double as the contract.\n *\n * The simulate union is the one response the SDK fully owns and parses itself\n * (it is un-enveloped, unlike `/compose`), so it gets a complete schema kept in\n * lockstep with the canonical `SimulateResult` in `@lifi/compose-spec` by the\n * compile-time assertion below — the same anchoring `@lifi/api-schemas` uses for\n * its server-side simulate schema, so the two cannot silently drift.\n */\n\nconst balanceEntrySchema = z.object({\n token: z.string(),\n owner: z.string(),\n amount: z.string(),\n});\n\nconst simulateOkSchema = z.object({\n status: z.literal('ok'),\n block: z.number(),\n timestamp: z.number(),\n balancesBefore: z.array(balanceEntrySchema),\n balancesAfter: z.array(balanceEntrySchema),\n deltas: z.array(balanceEntrySchema),\n gasUsed: z.string(),\n});\n\nconst simulateRevertDecodeResultSchema = z.object({\n errorCandidates: z\n .array(\n z.object({\n decodedErrorSignature: z.string(),\n decodedParams: z.array(z.string()),\n }),\n )\n .optional(),\n error: z.string().optional(),\n});\n\nconst simulateRevertSchema = z.object({\n status: z.literal('revert'),\n block: z.number(),\n timestamp: z.number(),\n revertReason: z.string().optional(),\n code: z.number().optional(),\n rawErrorBytes: z.string().optional(),\n decodeResult: simulateRevertDecodeResultSchema.optional(),\n});\n\nconst simulateSetupErrorSchema = z.object({\n status: z.literal('error'),\n message: z.string(),\n});\n\nconst simulateResultSchema = z.discriminatedUnion('status', [\n simulateOkSchema,\n simulateRevertSchema,\n simulateSetupErrorSchema,\n]);\n\n// The type the schema actually parses out. Kept private (referencing it from an\n// exported declaration would break `--isolatedDeclarations`) and pinned to the\n// canonical `SimulateResult` inside `parseSimulateResult` below.\ntype SimulateResultWire = z.infer<typeof simulateResultSchema>;\n\n/**\n * Parses a `POST /simulate` body into a {@link SimulateResult}. Returns `null`\n * when the body does not match the `ok`/`revert`/`error` union, letting the\n * caller raise a transport-level error.\n */\nexport const parseSimulateResult = (body: unknown): SimulateResult | null => {\n const parsed = simulateResultSchema.safeParse(body);\n if (!parsed.success) return null;\n // Pin the schema to the canonical contract in both directions, so it cannot\n // silently drift (mirroring the conformance assertion `@lifi/api-schemas` runs\n // on its server-side simulate schema). Assigning the inferred wire value to a\n // `SimulateResult` checks wire→spec; `satisfies SimulateResultWire` checks\n // spec→wire. A missing or mistyped field on either side fails to compile.\n const result: SimulateResult = parsed.data;\n return result satisfies SimulateResultWire;\n};\n\n/**\n * The validated members of an HTTP 206 partial compile envelope. `data` is\n * verified to be an object at runtime but left `unknown` here — compose-spec\n * owns its full shape (`ComposeCompilePartialData`) as a hand-authored type, so\n * the caller narrows it in one step. `error` is fully validated.\n */\nexport interface CompilePartialEnvelope {\n readonly data: unknown;\n readonly error: { readonly kind: string; readonly message: string };\n}\n\nconst compilePartialEnvelopeSchema = z.object({\n data: z.record(z.string(), z.unknown()),\n error: z.object({ kind: z.string(), message: z.string() }),\n});\n\n/** Parses an HTTP 206 partial compile envelope; `null` when it does not match. */\nexport const parseCompilePartialEnvelope = (\n body: unknown,\n): CompilePartialEnvelope | null => {\n const parsed = compilePartialEnvelopeSchema.safeParse(body);\n return parsed.success ? parsed.data : null;\n};\n\n/**\n * A single prepared-op failure inside a `preparation_error` envelope. `kind` is\n * kept as `string` here — the narrowing to `GenericComposeErrorKind` happens in\n * `errorFromHttpResponse`, where the value is lifted onto `ComposeError`.\n */\nexport interface ServerFailedPreparedOp {\n readonly callId: string;\n readonly op: string;\n readonly kind: string;\n readonly message: string;\n readonly path?: string;\n readonly port?: string;\n readonly fix?: string;\n}\n\n/** Error envelope returned on non-2xx responses. */\nexport interface ServerErrorBody {\n readonly error?: {\n readonly kind?: string;\n readonly message?: string;\n readonly path?: string;\n readonly port?: string;\n readonly fix?: string;\n readonly sdkVersion?: string;\n readonly serverVersion?: string;\n readonly minimumSdkVersion?: string;\n readonly details?: SimulationRevert | DeliveryErrorDetails;\n readonly failedOps?: readonly ServerFailedPreparedOp[];\n readonly succeededOps?: readonly string[];\n };\n}\n\nconst failedPreparedOpSchema = z.object({\n callId: z.string(),\n op: z.string(),\n kind: z.string(),\n message: z.string(),\n path: z.string().optional(),\n port: z.string().optional(),\n fix: z.string().optional(),\n});\n\n// `details` is passed through (`z.custom`) rather than parsed: the SDK does not\n// own the `SimulationRevert` or `DeliveryErrorDetails` schemas and forwards\n// the field verbatim onto `ComposeError`.\n//\n// `failedOps`/`succeededOps` are optional here because every error kind shares\n// this envelope; they are only populated for `preparation_error` (422). Zod\n// strips undeclared keys, so omitting them would silently drop them — which is\n// also why `port` and `fix`, set on every author-caused `validation_error`,\n// have to be declared here to reach the caller.\nconst serverErrorBodySchema = z.object({\n error: z\n .object({\n kind: z.string().optional(),\n message: z.string().optional(),\n path: z.string().optional(),\n port: z.string().optional(),\n fix: z.string().optional(),\n sdkVersion: z.string().optional(),\n serverVersion: z.string().optional(),\n minimumSdkVersion: z.string().optional(),\n details: z.custom<SimulationRevert | DeliveryErrorDetails>().optional(),\n failedOps: z.array(failedPreparedOpSchema).readonly().optional(),\n succeededOps: z.array(z.string()).readonly().optional(),\n })\n .optional(),\n});\n\n/** Validates an already-parsed error envelope; `null` when it does not match. */\nexport const parseServerErrorBody = (json: unknown): ServerErrorBody | null => {\n const parsed = serverErrorBodySchema.safeParse(json);\n return parsed.success ? parsed.data : null;\n};\n"],"mappings":"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"}
|
package/dist/run/inputs.cjs
CHANGED
|
@@ -46,7 +46,6 @@ const buildRun = (run) => ({
|
|
|
46
46
|
preconditions: run.preconditions?.length ? run.preconditions : void 0,
|
|
47
47
|
assumptions: run.assumptions,
|
|
48
48
|
referrer: run.referrer,
|
|
49
|
-
integratorFeeBps: run.integratorFeeBps,
|
|
50
49
|
maxPriceImpactBps: run.maxPriceImpactBps,
|
|
51
50
|
sweepTo: run.sweepTo,
|
|
52
51
|
simulationPolicy: run.simulationPolicy,
|
package/dist/run/inputs.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputs.cjs","names":[],"sources":["../../src/run/inputs.ts"],"sourcesContent":["import type {\n ComposeRun,\n InputSpec,\n MaterialiserInput,\n Precondition,\n SimulationPolicy,\n
|
|
1
|
+
{"version":3,"file":"inputs.cjs","names":[],"sources":["../../src/run/inputs.ts"],"sourcesContent":["import type {\n ComposeRun,\n ForwardTo,\n InputSpec,\n MaterialiserInput,\n Precondition,\n SimulationPolicy,\n} from '@lifi/compose-spec';\n\nimport type { Address, InputSchema, InputSpecOf } from '../types.js';\n\n/**\n * Runtime inputs for compiling a flow. Passed to `builder.compile()` or `sdk.request()`.\n *\n * @typeParam T - The flow's input schema, used to type-check `inputs` and `assumptions`.\n */\nexport interface ComposeRunInput<T extends InputSchema = InputSchema> {\n /**\n * Concrete values for each declared flow input. Resource inputs accept a\n * materialiser or a literal integer amount; scalar inputs accept the matching type.\n */\n readonly inputs: { readonly [K in keyof T]: InputSpecOf<T[K]> };\n /** Optional preconditions that must hold before the flow executes (e.g. minimum balances). */\n readonly preconditions?: readonly Precondition[];\n /** The `0x`-prefixed address of the transaction signer. */\n readonly signer: Address;\n /**\n * Optional assumed token amounts for resource inputs, keyed by input name.\n * When a materialiser resolves amounts at execution time rather than upfront,\n * assumptions let the compiler plan routes using estimated values. The keys\n * must match the input names declared in the flow schema.\n */\n readonly assumptions?: { readonly [K in keyof T]?: bigint };\n /** Optional integrator referrer identifier. */\n readonly referrer?: string;\n /** Maximum acceptable price impact in basis points (e.g. `300` = 3%). */\n readonly maxPriceImpactBps?: number;\n /**\n * Destination for sweeping all proxy-held terminal resources after execution.\n * Pass a literal `0x`-prefixed address or `{ $ref: \"context.sender\" }` to\n * send remaining tokens to the signer.\n */\n readonly sweepTo?: ForwardTo;\n /**\n * Controls behavior when simulation detects a revert.\n * `'strict'` (default) returns an error; `'allow-revert'` returns a partial\n * result with the transaction and revert diagnostics.\n */\n readonly simulationPolicy?: SimulationPolicy;\n /**\n * When `true`, the server also simulates the final user-facing transaction\n * after the structured simulation succeeds; reverts honour\n * `simulationPolicy`. On success the result is echoed back on the response as\n * `userProgramSimulation`. Defaults to `false`.\n */\n readonly simulateUserProgram?: boolean;\n /**\n * When `true`, the server checks on-chain ERC-20 allowances and omits\n * approvals that are already sufficient. Defaults to `false`.\n */\n readonly checkOnChainAllowances?: boolean;\n}\n\n/**\n * Creates an untyped materialiser input spec. This is a low-level escape hatch\n * for materialiser kinds not yet covered by the generated helpers.\n *\n * Prefer the typed helpers in the `materialisers` namespace (e.g.\n * `materialisers.balanceOf()`, `materialisers.directDeposit()`) which provide\n * compile-time config validation.\n *\n * @param kind - The materialiser type (e.g. `\"balanceOf\"`, `\"directDeposit\"`).\n * @param config - Optional materialiser-specific configuration.\n * @returns A {@link MaterialiserInput} for use in {@link ComposeRunInput.inputs}.\n *\n * @example\n * ```ts\n * const run = {\n * inputs: { token: materialiser('customKind', { myParam: '0x...' }) },\n * signer: '0x...',\n * };\n * ```\n */\nexport const materialiser = (\n kind: string,\n config: Record<string, unknown> = {},\n): MaterialiserInput => ({\n kind,\n ...config,\n});\n\n/**\n * Drops the keys whose value is `undefined`, so optional fields are omitted\n * from the wire payload rather than serialized as `null`.\n *\n * A local copy of `pickDefined` from `@lifi/utils`: this package is published\n * to npm and `@lifi/utils` is a private workspace package, so it cannot be a\n * runtime dependency here.\n */\nconst pickDefined = <S extends Record<string, unknown>>(\n obj: S,\n): Partial<{ [K in keyof S]: Exclude<S[K], undefined> }> =>\n Object.fromEntries(\n Object.entries(obj).filter(([, value]) => value !== undefined),\n ) as Partial<{ [K in keyof S]: Exclude<S[K], undefined> }>;\n\n/**\n * Assembles a {@link ComposeRun} object from individual parameters.\n * Used internally by the SDK; prefer {@link ComposeRunInput} for external use.\n *\n * @internal\n */\nexport const buildRun = (run: {\n inputs: Record<string, InputSpec>;\n preconditions?: readonly Precondition[];\n signer: string;\n assumptions?: Record<string, bigint>;\n referrer?: string;\n maxPriceImpactBps?: number;\n sweepTo?: ForwardTo;\n simulationPolicy?: SimulationPolicy;\n simulateUserProgram?: boolean;\n checkOnChainAllowances?: boolean;\n}): ComposeRun => ({\n inputs: run.inputs,\n signer: run.signer,\n ...pickDefined({\n // An empty precondition list is the same as none, so drop it too.\n preconditions: run.preconditions?.length ? run.preconditions : undefined,\n assumptions: run.assumptions,\n referrer: run.referrer,\n maxPriceImpactBps: run.maxPriceImpactBps,\n sweepTo: run.sweepTo,\n simulationPolicy: run.simulationPolicy,\n simulateUserProgram: run.simulateUserProgram,\n checkOnChainAllowances: run.checkOnChainAllowances,\n }),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmFA,MAAa,gBACX,MACA,SAAkC,CAAC,OACZ;CACvB;CACA,GAAG;AACL;;;;;;;;;AAUA,MAAM,eACJ,QAEA,OAAO,YACL,OAAO,QAAQ,GAAG,CAAC,CAAC,QAAQ,GAAG,WAAW,UAAU,KAAA,CAAS,CAC/D;;;;;;;AAQF,MAAa,YAAY,SAWN;CACjB,QAAQ,IAAI;CACZ,QAAQ,IAAI;CACZ,GAAG,YAAY;EAEb,eAAe,IAAI,eAAe,SAAS,IAAI,gBAAgB,KAAA;EAC/D,aAAa,IAAI;EACjB,UAAU,IAAI;EACd,mBAAmB,IAAI;EACvB,SAAS,IAAI;EACb,kBAAkB,IAAI;EACtB,qBAAqB,IAAI;EACzB,wBAAwB,IAAI;CAC9B,CAAC;AACH"}
|
package/dist/run/inputs.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, InputSchema, InputSpecOf } from "../types.cjs";
|
|
2
|
-
import { ComposeRun, InputSpec, MaterialiserInput, Precondition, SimulationPolicy
|
|
2
|
+
import { ComposeRun, ForwardTo, InputSpec, MaterialiserInput, Precondition, SimulationPolicy } from "@lifi/compose-spec";
|
|
3
3
|
//#region src/run/inputs.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Runtime inputs for compiling a flow. Passed to `builder.compile()` or `sdk.request()`.
|
|
@@ -25,13 +25,6 @@ export interface ComposeRunInput<T extends InputSchema = InputSchema> {
|
|
|
25
25
|
readonly assumptions?: { readonly [K in keyof T]?: bigint; };
|
|
26
26
|
/** Optional integrator referrer identifier. */
|
|
27
27
|
readonly referrer?: string;
|
|
28
|
-
/**
|
|
29
|
-
* Optional integrator fee in basis points (1bp = 0.01%, max `9000` = 90%).
|
|
30
|
-
* A non-zero value requires the request to be authenticated with an
|
|
31
|
-
* integration-scoped API key — the integration is derived from the key, not
|
|
32
|
-
* this field. Defaults to `0` (no fee) when omitted.
|
|
33
|
-
*/
|
|
34
|
-
readonly integratorFeeBps?: number;
|
|
35
28
|
/** Maximum acceptable price impact in basis points (e.g. `300` = 3%). */
|
|
36
29
|
readonly maxPriceImpactBps?: number;
|
|
37
30
|
/**
|
|
@@ -39,7 +32,7 @@ export interface ComposeRunInput<T extends InputSchema = InputSchema> {
|
|
|
39
32
|
* Pass a literal `0x`-prefixed address or `{ $ref: "context.sender" }` to
|
|
40
33
|
* send remaining tokens to the signer.
|
|
41
34
|
*/
|
|
42
|
-
readonly sweepTo?:
|
|
35
|
+
readonly sweepTo?: ForwardTo;
|
|
43
36
|
/**
|
|
44
37
|
* Controls behavior when simulation detects a revert.
|
|
45
38
|
* `'strict'` (default) returns an error; `'allow-revert'` returns a partial
|
|
@@ -92,9 +85,8 @@ export declare const buildRun: (run: {
|
|
|
92
85
|
signer: string;
|
|
93
86
|
assumptions?: Record<string, bigint>;
|
|
94
87
|
referrer?: string;
|
|
95
|
-
integratorFeeBps?: number;
|
|
96
88
|
maxPriceImpactBps?: number;
|
|
97
|
-
sweepTo?:
|
|
89
|
+
sweepTo?: ForwardTo;
|
|
98
90
|
simulationPolicy?: SimulationPolicy;
|
|
99
91
|
simulateUserProgram?: boolean;
|
|
100
92
|
checkOnChainAllowances?: boolean;
|
package/dist/run/inputs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, InputSchema, InputSpecOf } from "../types.js";
|
|
2
|
-
import { ComposeRun, InputSpec, MaterialiserInput, Precondition, SimulationPolicy
|
|
2
|
+
import { ComposeRun, ForwardTo, InputSpec, MaterialiserInput, Precondition, SimulationPolicy } from "@lifi/compose-spec";
|
|
3
3
|
//#region src/run/inputs.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Runtime inputs for compiling a flow. Passed to `builder.compile()` or `sdk.request()`.
|
|
@@ -25,13 +25,6 @@ export interface ComposeRunInput<T extends InputSchema = InputSchema> {
|
|
|
25
25
|
readonly assumptions?: { readonly [K in keyof T]?: bigint; };
|
|
26
26
|
/** Optional integrator referrer identifier. */
|
|
27
27
|
readonly referrer?: string;
|
|
28
|
-
/**
|
|
29
|
-
* Optional integrator fee in basis points (1bp = 0.01%, max `9000` = 90%).
|
|
30
|
-
* A non-zero value requires the request to be authenticated with an
|
|
31
|
-
* integration-scoped API key — the integration is derived from the key, not
|
|
32
|
-
* this field. Defaults to `0` (no fee) when omitted.
|
|
33
|
-
*/
|
|
34
|
-
readonly integratorFeeBps?: number;
|
|
35
28
|
/** Maximum acceptable price impact in basis points (e.g. `300` = 3%). */
|
|
36
29
|
readonly maxPriceImpactBps?: number;
|
|
37
30
|
/**
|
|
@@ -39,7 +32,7 @@ export interface ComposeRunInput<T extends InputSchema = InputSchema> {
|
|
|
39
32
|
* Pass a literal `0x`-prefixed address or `{ $ref: "context.sender" }` to
|
|
40
33
|
* send remaining tokens to the signer.
|
|
41
34
|
*/
|
|
42
|
-
readonly sweepTo?:
|
|
35
|
+
readonly sweepTo?: ForwardTo;
|
|
43
36
|
/**
|
|
44
37
|
* Controls behavior when simulation detects a revert.
|
|
45
38
|
* `'strict'` (default) returns an error; `'allow-revert'` returns a partial
|
|
@@ -92,9 +85,8 @@ export declare const buildRun: (run: {
|
|
|
92
85
|
signer: string;
|
|
93
86
|
assumptions?: Record<string, bigint>;
|
|
94
87
|
referrer?: string;
|
|
95
|
-
integratorFeeBps?: number;
|
|
96
88
|
maxPriceImpactBps?: number;
|
|
97
|
-
sweepTo?:
|
|
89
|
+
sweepTo?: ForwardTo;
|
|
98
90
|
simulationPolicy?: SimulationPolicy;
|
|
99
91
|
simulateUserProgram?: boolean;
|
|
100
92
|
checkOnChainAllowances?: boolean;
|
package/dist/run/inputs.js
CHANGED
|
@@ -45,7 +45,6 @@ const buildRun = (run) => ({
|
|
|
45
45
|
preconditions: run.preconditions?.length ? run.preconditions : void 0,
|
|
46
46
|
assumptions: run.assumptions,
|
|
47
47
|
referrer: run.referrer,
|
|
48
|
-
integratorFeeBps: run.integratorFeeBps,
|
|
49
48
|
maxPriceImpactBps: run.maxPriceImpactBps,
|
|
50
49
|
sweepTo: run.sweepTo,
|
|
51
50
|
simulationPolicy: run.simulationPolicy,
|
package/dist/run/inputs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputs.js","names":[],"sources":["../../src/run/inputs.ts"],"sourcesContent":["import type {\n ComposeRun,\n InputSpec,\n MaterialiserInput,\n Precondition,\n SimulationPolicy,\n
|
|
1
|
+
{"version":3,"file":"inputs.js","names":[],"sources":["../../src/run/inputs.ts"],"sourcesContent":["import type {\n ComposeRun,\n ForwardTo,\n InputSpec,\n MaterialiserInput,\n Precondition,\n SimulationPolicy,\n} from '@lifi/compose-spec';\n\nimport type { Address, InputSchema, InputSpecOf } from '../types.js';\n\n/**\n * Runtime inputs for compiling a flow. Passed to `builder.compile()` or `sdk.request()`.\n *\n * @typeParam T - The flow's input schema, used to type-check `inputs` and `assumptions`.\n */\nexport interface ComposeRunInput<T extends InputSchema = InputSchema> {\n /**\n * Concrete values for each declared flow input. Resource inputs accept a\n * materialiser or a literal integer amount; scalar inputs accept the matching type.\n */\n readonly inputs: { readonly [K in keyof T]: InputSpecOf<T[K]> };\n /** Optional preconditions that must hold before the flow executes (e.g. minimum balances). */\n readonly preconditions?: readonly Precondition[];\n /** The `0x`-prefixed address of the transaction signer. */\n readonly signer: Address;\n /**\n * Optional assumed token amounts for resource inputs, keyed by input name.\n * When a materialiser resolves amounts at execution time rather than upfront,\n * assumptions let the compiler plan routes using estimated values. The keys\n * must match the input names declared in the flow schema.\n */\n readonly assumptions?: { readonly [K in keyof T]?: bigint };\n /** Optional integrator referrer identifier. */\n readonly referrer?: string;\n /** Maximum acceptable price impact in basis points (e.g. `300` = 3%). */\n readonly maxPriceImpactBps?: number;\n /**\n * Destination for sweeping all proxy-held terminal resources after execution.\n * Pass a literal `0x`-prefixed address or `{ $ref: \"context.sender\" }` to\n * send remaining tokens to the signer.\n */\n readonly sweepTo?: ForwardTo;\n /**\n * Controls behavior when simulation detects a revert.\n * `'strict'` (default) returns an error; `'allow-revert'` returns a partial\n * result with the transaction and revert diagnostics.\n */\n readonly simulationPolicy?: SimulationPolicy;\n /**\n * When `true`, the server also simulates the final user-facing transaction\n * after the structured simulation succeeds; reverts honour\n * `simulationPolicy`. On success the result is echoed back on the response as\n * `userProgramSimulation`. Defaults to `false`.\n */\n readonly simulateUserProgram?: boolean;\n /**\n * When `true`, the server checks on-chain ERC-20 allowances and omits\n * approvals that are already sufficient. Defaults to `false`.\n */\n readonly checkOnChainAllowances?: boolean;\n}\n\n/**\n * Creates an untyped materialiser input spec. This is a low-level escape hatch\n * for materialiser kinds not yet covered by the generated helpers.\n *\n * Prefer the typed helpers in the `materialisers` namespace (e.g.\n * `materialisers.balanceOf()`, `materialisers.directDeposit()`) which provide\n * compile-time config validation.\n *\n * @param kind - The materialiser type (e.g. `\"balanceOf\"`, `\"directDeposit\"`).\n * @param config - Optional materialiser-specific configuration.\n * @returns A {@link MaterialiserInput} for use in {@link ComposeRunInput.inputs}.\n *\n * @example\n * ```ts\n * const run = {\n * inputs: { token: materialiser('customKind', { myParam: '0x...' }) },\n * signer: '0x...',\n * };\n * ```\n */\nexport const materialiser = (\n kind: string,\n config: Record<string, unknown> = {},\n): MaterialiserInput => ({\n kind,\n ...config,\n});\n\n/**\n * Drops the keys whose value is `undefined`, so optional fields are omitted\n * from the wire payload rather than serialized as `null`.\n *\n * A local copy of `pickDefined` from `@lifi/utils`: this package is published\n * to npm and `@lifi/utils` is a private workspace package, so it cannot be a\n * runtime dependency here.\n */\nconst pickDefined = <S extends Record<string, unknown>>(\n obj: S,\n): Partial<{ [K in keyof S]: Exclude<S[K], undefined> }> =>\n Object.fromEntries(\n Object.entries(obj).filter(([, value]) => value !== undefined),\n ) as Partial<{ [K in keyof S]: Exclude<S[K], undefined> }>;\n\n/**\n * Assembles a {@link ComposeRun} object from individual parameters.\n * Used internally by the SDK; prefer {@link ComposeRunInput} for external use.\n *\n * @internal\n */\nexport const buildRun = (run: {\n inputs: Record<string, InputSpec>;\n preconditions?: readonly Precondition[];\n signer: string;\n assumptions?: Record<string, bigint>;\n referrer?: string;\n maxPriceImpactBps?: number;\n sweepTo?: ForwardTo;\n simulationPolicy?: SimulationPolicy;\n simulateUserProgram?: boolean;\n checkOnChainAllowances?: boolean;\n}): ComposeRun => ({\n inputs: run.inputs,\n signer: run.signer,\n ...pickDefined({\n // An empty precondition list is the same as none, so drop it too.\n preconditions: run.preconditions?.length ? run.preconditions : undefined,\n assumptions: run.assumptions,\n referrer: run.referrer,\n maxPriceImpactBps: run.maxPriceImpactBps,\n sweepTo: run.sweepTo,\n simulationPolicy: run.simulationPolicy,\n simulateUserProgram: run.simulateUserProgram,\n checkOnChainAllowances: run.checkOnChainAllowances,\n }),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmFA,MAAa,gBACX,MACA,SAAkC,CAAC,OACZ;CACvB;CACA,GAAG;AACL;;;;;;;;;AAUA,MAAM,eACJ,QAEA,OAAO,YACL,OAAO,QAAQ,GAAG,CAAC,CAAC,QAAQ,GAAG,WAAW,UAAU,KAAA,CAAS,CAC/D;;;;;;;AAQF,MAAa,YAAY,SAWN;CACjB,QAAQ,IAAI;CACZ,QAAQ,IAAI;CACZ,GAAG,YAAY;EAEb,eAAe,IAAI,eAAe,SAAS,IAAI,gBAAgB,KAAA;EAC/D,aAAa,IAAI;EACjB,UAAU,IAAI;EACd,mBAAmB,IAAI;EACvB,SAAS,IAAI;EACb,kBAAkB,IAAI;EACtB,qBAAqB,IAAI;EACzB,wBAAwB,IAAI;CAC9B,CAAC;AACH"}
|
package/dist/sdk.cjs
CHANGED
|
@@ -25,7 +25,6 @@ const createComposeSdk = (options) => {
|
|
|
25
25
|
signer: run.signer,
|
|
26
26
|
assumptions: run.assumptions,
|
|
27
27
|
referrer: run.referrer,
|
|
28
|
-
integratorFeeBps: run.integratorFeeBps,
|
|
29
28
|
maxPriceImpactBps: run.maxPriceImpactBps,
|
|
30
29
|
sweepTo: run.sweepTo,
|
|
31
30
|
simulationPolicy: run.simulationPolicy,
|
package/dist/sdk.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.cjs","names":["createComposeClient","buildRun","createFlowBuilderCore","bindGeneratedOps"],"sources":["../src/sdk.ts"],"sourcesContent":["import type {\n ComposeCompileRequest,\n ComposeCompileResult,\n ComposeRouteRequest,\n InputSpec,\n SimulateRequest,\n SimulateResult,\n} from '@lifi/compose-spec';\n\nimport {\n createFlowBuilderCore,\n type FlowBuilderCore,\n type FlowOptions,\n type TypedFlow,\n} from './authoring/FlowBuilderCore.js';\nimport { type ComposeClient, createComposeClient } from './client.js';\nimport type { ChainSummary } from './discovery.js';\nimport {\n bindGeneratedOps,\n type GeneratedOps,\n} from './generated/operations.generated.js';\nimport { buildRun, type ComposeRunInput } from './run/inputs.js';\nimport type { InputSchema } from './types.js';\n\nexport type { ComposeRunInput };\n\n/**\n * A flow builder augmented with generated operation methods and a `compile` method\n * that submits the flow to the Compose backend for compilation.\n *\n * Created via {@link ComposeSdk.flow}.\n *\n * @typeParam T - The input schema describing the flow's required inputs.\n */\nexport type FlowBuilder<T extends InputSchema = InputSchema> =\n FlowBuilderCore<T> &\n GeneratedOps & {\n /**\n * Builds the flow document from the current builder state and submits it\n * to the Compose API for compilation.\n *\n * @param run - Runtime inputs, preconditions, and signer address.\n * @returns The compiled transaction calldata and metadata.\n * @throws {@link ComposeError} on network, validation, or server errors.\n *\n * @example\n * ```ts\n * const result = await builder.compile({\n * inputs: { token: materialisers.balanceOf({}) },\n * signer: '0xYourAddress...',\n * });\n * console.log(result.calldata);\n * ```\n */\n readonly compile: (\n run: ComposeRunInput<T>,\n ) => Promise<ComposeCompileResult>;\n };\n\n/**\n * Configuration for creating a Compose SDK instance.\n */\nexport interface ComposeSdkOptions {\n /** Base URL of the Compose API (e.g. `\"https://li.quest\"`). */\n readonly baseUrl: string;\n /** Optional custom `fetch` implementation. Defaults to `globalThis.fetch`. */\n readonly fetch?: typeof globalThis.fetch;\n /** LI.FI API key, sent as the `x-lifi-api-key` header on every request. Required — the Compose API rejects unauthenticated requests. */\n readonly apiKey: string;\n}\n\n/**\n * The top-level Compose SDK interface.\n *\n * Provides methods to build flows, compile them into executable calldata, and\n * interact with the Compose API directly.\n *\n * @example\n * ```ts\n * import { createComposeSdk, resources, materialisers } from '@lifi/composer-sdk';\n *\n * const sdk = createComposeSdk({ baseUrl: 'https://li.quest', apiKey: 'YOUR_API_KEY' });\n *\n * const builder = sdk.flow(1, {\n * inputs: { usdc: resources.erc20('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', 1) },\n * });\n *\n * builder.lifi.swap('swap1', {\n * bind: { amountIn: builder.inputs.usdc },\n * config: { resourceOut: resources.native(1) },\n * });\n *\n * const result = await builder.compile({\n * inputs: { usdc: materialisers.balanceOf({}) },\n * signer: '0xYourAddress...',\n * });\n * ```\n */\nexport interface ComposeSdk {\n /** Low-level HTTP client for the Compose API. */\n readonly client: ComposeClient;\n /**\n * Creates a new flow builder targeting the given chain.\n * @param chainId - The EVM chain ID (e.g. `1` for Ethereum mainnet).\n * @param options - Flow configuration including input declarations.\n * @returns A {@link FlowBuilder} with generated operation methods and a `compile` method.\n * @throws Error if any resource input's `chainId` doesn't match the flow's `chainId`.\n */\n readonly flow: <T extends InputSchema>(\n chainId: number,\n options: FlowOptions<T>,\n ) => FlowBuilder<T>;\n /**\n * Fetches the chains this Compose deployment supports, ascending by\n * `chainId`. Thin pass-through to {@link ComposeClient.getChains}; see it\n * for what \"supported\" means and for the caching caveat.\n *\n * Each entry pairs the `chainId` with a display `name`, so one call both\n * gates a chain selector and labels it. Key on `chainId`; `name` is a\n * deployment-maintained label that can change.\n *\n * Use it to fail fast before building a flow for a chain the server would\n * reject.\n *\n * @returns The supported chains, ascending by `chainId`.\n * @throws {@link ComposeError} on network or server errors.\n *\n * @example\n * ```ts\n * const chains = await sdk.getSupportedChains();\n * if (!chains.some((c) => c.chainId === 8453)) {\n * throw new Error('Base is not supported');\n * }\n * for (const { chainId, name } of chains) {\n * console.log(`${name} (${chainId})`);\n * }\n * ```\n */\n readonly getSupportedChains: () => Promise<readonly ChainSummary[]>;\n /**\n * Builds a raw compile request without sending it. Useful for inspecting the\n * request payload or submitting it through a custom transport.\n * @param flow - A built flow document (from `builder.build()`).\n * @param run - Runtime inputs, preconditions, and signer address.\n * @returns A {@link ComposeCompileRequest} ready to send to the Compose API.\n */\n readonly request: <T extends InputSchema>(\n flow: TypedFlow<T>,\n run: ComposeRunInput<T>,\n ) => ComposeCompileRequest;\n /**\n * Compiles a token pair on one chain into a submit-ready transaction. Thin\n * pass-through to {@link ComposeClient.route}; see it for the short chain of\n * catalog edges the server plans, when to prefer `flow(...).compile(...)`,\n * the `success` / `partial` discrimination, and error behaviour. Build the\n * `amount` with `routeAmount.exact(...)` / `routeAmount.all(...)`.\n *\n * @param request - The from/to token pair, amount, signer, and route options.\n * @returns A discriminated result: `status: 'success'` or `status: 'partial'`.\n * @throws {@link ComposeError} on network, validation, or server errors.\n */\n readonly route: (\n request: ComposeRouteRequest,\n ) => Promise<ComposeCompileResult>;\n /**\n * Simulates a raw, pre-encoded transaction. Thin pass-through to\n * {@link ComposeClient.simulate}; see it for the `ok` / `revert` / `error`\n * result discrimination and error behaviour. Pair with `buildSimulateRequest`\n * to assemble the request from a compile result.\n *\n * @param request - The raw transaction plus funding `requirements` and\n * `trackedBalances`.\n * @returns A {@link SimulateResult} (`ok` / `revert` / `error`).\n * @throws {@link ComposeError} on network, validation, or server errors.\n */\n readonly simulate: (request: SimulateRequest) => Promise<SimulateResult>;\n}\n\n/**\n * Creates a new Compose SDK instance.\n *\n * @param options - SDK configuration including the API base URL, required API key, and optional fetch implementation.\n * @returns A {@link ComposeSdk} instance.\n *\n * @example\n * ```ts\n * const sdk = createComposeSdk({ baseUrl: 'https://li.quest', apiKey: 'YOUR_API_KEY' });\n * ```\n */\nexport const createComposeSdk = (options: ComposeSdkOptions): ComposeSdk => {\n const composeClient = createComposeClient(options);\n\n const request = <T extends InputSchema>(\n flowDoc: TypedFlow<T>,\n run: ComposeRunInput<T>,\n ): ComposeCompileRequest => ({\n flow: flowDoc,\n run: buildRun({\n inputs: run.inputs as Record<string, InputSpec>,\n preconditions: run.preconditions,\n signer: run.signer,\n assumptions: run.assumptions as Record<string, bigint> | undefined,\n referrer: run.referrer,\n
|
|
1
|
+
{"version":3,"file":"sdk.cjs","names":["createComposeClient","buildRun","createFlowBuilderCore","bindGeneratedOps"],"sources":["../src/sdk.ts"],"sourcesContent":["import type {\n ComposeCompileRequest,\n ComposeCompileResult,\n ComposeRouteRequest,\n InputSpec,\n SimulateRequest,\n SimulateResult,\n} from '@lifi/compose-spec';\n\nimport {\n createFlowBuilderCore,\n type FlowBuilderCore,\n type FlowOptions,\n type TypedFlow,\n} from './authoring/FlowBuilderCore.js';\nimport { type ComposeClient, createComposeClient } from './client.js';\nimport type { ChainSummary } from './discovery.js';\nimport {\n bindGeneratedOps,\n type GeneratedOps,\n} from './generated/operations.generated.js';\nimport { buildRun, type ComposeRunInput } from './run/inputs.js';\nimport type { InputSchema } from './types.js';\n\nexport type { ComposeRunInput };\n\n/**\n * A flow builder augmented with generated operation methods and a `compile` method\n * that submits the flow to the Compose backend for compilation.\n *\n * Created via {@link ComposeSdk.flow}.\n *\n * @typeParam T - The input schema describing the flow's required inputs.\n */\nexport type FlowBuilder<T extends InputSchema = InputSchema> =\n FlowBuilderCore<T> &\n GeneratedOps & {\n /**\n * Builds the flow document from the current builder state and submits it\n * to the Compose API for compilation.\n *\n * @param run - Runtime inputs, preconditions, and signer address.\n * @returns The compiled transaction calldata and metadata.\n * @throws {@link ComposeError} on network, validation, or server errors.\n *\n * @example\n * ```ts\n * const result = await builder.compile({\n * inputs: { token: materialisers.balanceOf({}) },\n * signer: '0xYourAddress...',\n * });\n * console.log(result.calldata);\n * ```\n */\n readonly compile: (\n run: ComposeRunInput<T>,\n ) => Promise<ComposeCompileResult>;\n };\n\n/**\n * Configuration for creating a Compose SDK instance.\n */\nexport interface ComposeSdkOptions {\n /** Base URL of the Compose API (e.g. `\"https://li.quest\"`). */\n readonly baseUrl: string;\n /** Optional custom `fetch` implementation. Defaults to `globalThis.fetch`. */\n readonly fetch?: typeof globalThis.fetch;\n /** LI.FI API key, sent as the `x-lifi-api-key` header on every request. Required — the Compose API rejects unauthenticated requests. */\n readonly apiKey: string;\n}\n\n/**\n * The top-level Compose SDK interface.\n *\n * Provides methods to build flows, compile them into executable calldata, and\n * interact with the Compose API directly.\n *\n * @example\n * ```ts\n * import { createComposeSdk, resources, materialisers } from '@lifi/composer-sdk';\n *\n * const sdk = createComposeSdk({ baseUrl: 'https://li.quest', apiKey: 'YOUR_API_KEY' });\n *\n * const builder = sdk.flow(1, {\n * inputs: { usdc: resources.erc20('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', 1) },\n * });\n *\n * builder.lifi.swap('swap1', {\n * bind: { amountIn: builder.inputs.usdc },\n * config: { resourceOut: resources.native(1) },\n * });\n *\n * const result = await builder.compile({\n * inputs: { usdc: materialisers.balanceOf({}) },\n * signer: '0xYourAddress...',\n * });\n * ```\n */\nexport interface ComposeSdk {\n /** Low-level HTTP client for the Compose API. */\n readonly client: ComposeClient;\n /**\n * Creates a new flow builder targeting the given chain.\n * @param chainId - The EVM chain ID (e.g. `1` for Ethereum mainnet).\n * @param options - Flow configuration including input declarations.\n * @returns A {@link FlowBuilder} with generated operation methods and a `compile` method.\n * @throws Error if any resource input's `chainId` doesn't match the flow's `chainId`.\n */\n readonly flow: <T extends InputSchema>(\n chainId: number,\n options: FlowOptions<T>,\n ) => FlowBuilder<T>;\n /**\n * Fetches the chains this Compose deployment supports, ascending by\n * `chainId`. Thin pass-through to {@link ComposeClient.getChains}; see it\n * for what \"supported\" means and for the caching caveat.\n *\n * Each entry pairs the `chainId` with a display `name`, so one call both\n * gates a chain selector and labels it. Key on `chainId`; `name` is a\n * deployment-maintained label that can change.\n *\n * Use it to fail fast before building a flow for a chain the server would\n * reject.\n *\n * @returns The supported chains, ascending by `chainId`.\n * @throws {@link ComposeError} on network or server errors.\n *\n * @example\n * ```ts\n * const chains = await sdk.getSupportedChains();\n * if (!chains.some((c) => c.chainId === 8453)) {\n * throw new Error('Base is not supported');\n * }\n * for (const { chainId, name } of chains) {\n * console.log(`${name} (${chainId})`);\n * }\n * ```\n */\n readonly getSupportedChains: () => Promise<readonly ChainSummary[]>;\n /**\n * Builds a raw compile request without sending it. Useful for inspecting the\n * request payload or submitting it through a custom transport.\n * @param flow - A built flow document (from `builder.build()`).\n * @param run - Runtime inputs, preconditions, and signer address.\n * @returns A {@link ComposeCompileRequest} ready to send to the Compose API.\n */\n readonly request: <T extends InputSchema>(\n flow: TypedFlow<T>,\n run: ComposeRunInput<T>,\n ) => ComposeCompileRequest;\n /**\n * Compiles a token pair on one chain into a submit-ready transaction. Thin\n * pass-through to {@link ComposeClient.route}; see it for the short chain of\n * catalog edges the server plans, when to prefer `flow(...).compile(...)`,\n * the `success` / `partial` discrimination, and error behaviour. Build the\n * `amount` with `routeAmount.exact(...)` / `routeAmount.all(...)`.\n *\n * @param request - The from/to token pair, amount, signer, and route options.\n * @returns A discriminated result: `status: 'success'` or `status: 'partial'`.\n * @throws {@link ComposeError} on network, validation, or server errors.\n */\n readonly route: (\n request: ComposeRouteRequest,\n ) => Promise<ComposeCompileResult>;\n /**\n * Simulates a raw, pre-encoded transaction. Thin pass-through to\n * {@link ComposeClient.simulate}; see it for the `ok` / `revert` / `error`\n * result discrimination and error behaviour. Pair with `buildSimulateRequest`\n * to assemble the request from a compile result.\n *\n * @param request - The raw transaction plus funding `requirements` and\n * `trackedBalances`.\n * @returns A {@link SimulateResult} (`ok` / `revert` / `error`).\n * @throws {@link ComposeError} on network, validation, or server errors.\n */\n readonly simulate: (request: SimulateRequest) => Promise<SimulateResult>;\n}\n\n/**\n * Creates a new Compose SDK instance.\n *\n * @param options - SDK configuration including the API base URL, required API key, and optional fetch implementation.\n * @returns A {@link ComposeSdk} instance.\n *\n * @example\n * ```ts\n * const sdk = createComposeSdk({ baseUrl: 'https://li.quest', apiKey: 'YOUR_API_KEY' });\n * ```\n */\nexport const createComposeSdk = (options: ComposeSdkOptions): ComposeSdk => {\n const composeClient = createComposeClient(options);\n\n const request = <T extends InputSchema>(\n flowDoc: TypedFlow<T>,\n run: ComposeRunInput<T>,\n ): ComposeCompileRequest => ({\n flow: flowDoc,\n run: buildRun({\n inputs: run.inputs as Record<string, InputSpec>,\n preconditions: run.preconditions,\n signer: run.signer,\n assumptions: run.assumptions as Record<string, bigint> | undefined,\n referrer: run.referrer,\n maxPriceImpactBps: run.maxPriceImpactBps,\n sweepTo: run.sweepTo,\n simulationPolicy: run.simulationPolicy,\n simulateUserProgram: run.simulateUserProgram,\n checkOnChainAllowances: run.checkOnChainAllowances,\n }),\n });\n\n const flow = <T extends InputSchema>(\n chainId: number,\n opts: FlowOptions<T>,\n ): FlowBuilder<T> => {\n const core = createFlowBuilderCore(chainId, opts);\n const builder = Object.assign(core, bindGeneratedOps(core));\n\n const compile = async (\n run: ComposeRunInput<T>,\n ): Promise<ComposeCompileResult> => {\n const flowDoc = builder.build();\n const req = request(flowDoc, run);\n return composeClient.compile(req);\n };\n\n return Object.assign(builder, { compile });\n };\n\n return {\n client: composeClient,\n flow,\n getSupportedChains: composeClient.getChains,\n request,\n route: composeClient.route,\n simulate: composeClient.simulate,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AA6LA,MAAa,oBAAoB,YAA2C;CAC1E,MAAM,gBAAgBA,eAAAA,oBAAoB,OAAO;CAEjD,MAAM,WACJ,SACA,SAC2B;EAC3B,MAAM;EACN,KAAKC,mBAAAA,SAAS;GACZ,QAAQ,IAAI;GACZ,eAAe,IAAI;GACnB,QAAQ,IAAI;GACZ,aAAa,IAAI;GACjB,UAAU,IAAI;GACd,mBAAmB,IAAI;GACvB,SAAS,IAAI;GACb,kBAAkB,IAAI;GACtB,qBAAqB,IAAI;GACzB,wBAAwB,IAAI;EAC9B,CAAC;CACH;CAEA,MAAM,QACJ,SACA,SACmB;EACnB,MAAM,OAAOC,kCAAAA,sBAAsB,SAAS,IAAI;EAChD,MAAM,UAAU,OAAO,OAAO,MAAMC,uCAAAA,iBAAiB,IAAI,CAAC;EAE1D,MAAM,UAAU,OACd,QACkC;GAClC,MAAM,UAAU,QAAQ,MAAM;GAC9B,MAAM,MAAM,QAAQ,SAAS,GAAG;GAChC,OAAO,cAAc,QAAQ,GAAG;EAClC;EAEA,OAAO,OAAO,OAAO,SAAS,EAAE,QAAQ,CAAC;CAC3C;CAEA,OAAO;EACL,QAAQ;EACR;EACA,oBAAoB,cAAc;EAClC;EACA,OAAO,cAAc;EACrB,UAAU,cAAc;CAC1B;AACF"}
|