@lifi/composer-sdk 0.4.0 → 0.5.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 +98 -5
- package/dist/authoring/FlowBuilderCore.cjs +1 -5
- package/dist/authoring/FlowBuilderCore.cjs.map +1 -1
- package/dist/authoring/FlowBuilderCore.d.cts +9 -7
- package/dist/authoring/FlowBuilderCore.d.ts +9 -7
- package/dist/authoring/FlowBuilderCore.js +2 -6
- package/dist/authoring/FlowBuilderCore.js.map +1 -1
- package/dist/authoring/handles.cjs +5 -2
- package/dist/authoring/handles.cjs.map +1 -1
- package/dist/authoring/handles.d.cts +25 -6
- package/dist/authoring/handles.d.ts +25 -6
- package/dist/authoring/handles.js +3 -1
- package/dist/authoring/handles.js.map +1 -1
- package/dist/authoring/raw.cjs +6 -1
- package/dist/authoring/raw.cjs.map +1 -1
- package/dist/authoring/raw.d.cts +33 -3
- package/dist/authoring/raw.d.ts +33 -3
- package/dist/authoring/raw.js +5 -1
- package/dist/authoring/raw.js.map +1 -1
- package/dist/authoring/signatureArgs.cjs.map +1 -1
- package/dist/authoring/signatureArgs.d.cts +16 -12
- package/dist/authoring/signatureArgs.d.ts +16 -12
- package/dist/authoring/signatureArgs.js.map +1 -1
- package/dist/client.cjs +94 -58
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +61 -2
- package/dist/client.d.ts +61 -2
- package/dist/client.js +94 -58
- package/dist/client.js.map +1 -1
- package/dist/discovery.cjs.map +1 -1
- package/dist/discovery.d.cts +31 -2
- package/dist/discovery.d.ts +31 -2
- package/dist/generated/config.generated.cjs.map +1 -1
- package/dist/generated/config.generated.d.cts +35 -3
- package/dist/generated/config.generated.d.ts +35 -3
- package/dist/generated/operations.generated.cjs +9 -0
- package/dist/generated/operations.generated.cjs.map +1 -1
- package/dist/generated/operations.generated.d.cts +33 -2
- package/dist/generated/operations.generated.d.ts +33 -2
- package/dist/generated/operations.generated.js +9 -0
- package/dist/generated/operations.generated.js.map +1 -1
- package/dist/index.cjs +5 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -7
- package/dist/index.d.ts +26 -7
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/{raw-IxCF_bSS.d.ts → raw-BvRghN3r.d.ts} +3 -2
- package/dist/{raw-Dj_2rBSQ.d.cts → raw-s1rer8X3.d.cts} +3 -2
- package/dist/raw.cjs +2 -0
- package/dist/raw.cjs.map +1 -1
- package/dist/raw.d.cts +1 -1
- package/dist/raw.d.ts +1 -1
- package/dist/raw.js +2 -1
- package/dist/raw.js.map +1 -1
- package/dist/routeAmount-DdbJYJyM.d.cts +55 -0
- package/dist/routeAmount-DdbJYJyM.d.ts +55 -0
- package/dist/routeAmount.cjs +38 -0
- package/dist/routeAmount.cjs.map +1 -0
- package/dist/routeAmount.d.cts +2 -0
- package/dist/routeAmount.d.ts +2 -0
- package/dist/routeAmount.js +13 -0
- package/dist/routeAmount.js.map +1 -0
- package/dist/run/inputs.cjs +14 -15
- package/dist/run/inputs.cjs.map +1 -1
- package/dist/run/inputs.d.cts +8 -0
- package/dist/run/inputs.d.ts +8 -0
- package/dist/run/inputs.js +14 -15
- package/dist/run/inputs.js.map +1 -1
- package/dist/run/simulate.cjs +5 -0
- package/dist/run/simulate.cjs.map +1 -1
- package/dist/run/simulate.d.cts +5 -2
- package/dist/run/simulate.d.ts +5 -2
- package/dist/run/simulate.js +5 -0
- package/dist/run/simulate.js.map +1 -1
- package/dist/sdk.cjs +3 -0
- package/dist/sdk.cjs.map +1 -1
- package/dist/sdk.d.cts +42 -2
- package/dist/sdk.d.ts +42 -2
- package/dist/sdk.js +3 -0
- package/dist/sdk.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +18 -2
- package/dist/types.d.ts +18 -2
- package/package.json +6 -13
- package/src/authoring/FlowBuilderCore.ts +13 -15
- package/src/authoring/handles.ts +41 -5
- package/src/authoring/raw.ts +39 -4
- package/src/authoring/signatureArgs.ts +17 -13
- package/src/client.ts +204 -58
- package/src/discovery.ts +31 -1
- package/src/examples/flySwap.ts +167 -0
- package/src/examples/lifiZap.ts +4 -0
- package/src/examples/lifiZapAsync.ts +88 -0
- package/src/examples/routeTokenPair.ts +58 -0
- package/src/examples/run.ts +56 -6
- package/src/examples/supportedChains.ts +122 -0
- package/src/generated/config.generated.ts +45 -3
- package/src/generated/operations.generated.ts +56 -8
- package/src/index.ts +33 -1
- package/src/raw.ts +1 -1
- package/src/routeAmount.ts +61 -0
- package/src/run/inputs.ts +30 -11
- package/src/run/simulate.ts +14 -2
- package/src/sdk.ts +47 -0
- package/src/types.ts +20 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { AbiTypeToOutputKind, Address, InputDecl, InputSchema, InputSpecOf, IntegerString, IntegerStringInput, OutputKind, TypedGuard, TypedRef } from './types.js';
|
|
2
|
-
export { GetZapPacksOptions, ZapPackEdge, ZapPackOverview } from './discovery.js';
|
|
1
|
+
export { AbiTypeToOutputKind, Address, InputDecl, InputSchema, InputSpecOf, IntegerString, IntegerStringInput, OutputKind, TypedGuard, TypedLiteral, TypedRef } from './types.js';
|
|
2
|
+
export { ChainSummary, GetZapPacksOptions, ZapPackEdge, ZapPackOverview } from './discovery.js';
|
|
3
3
|
export { ComposeError, ComposeErrorCode, ComposePreparationOps, isComposeError, isComposePreparationError } from './errors.js';
|
|
4
|
-
export { AppliedGuard, ApprovalEntry, Call, Check, CheckComparator, ComposeCompilePartialData, ComposeCompileRequest, ComposeCompileResult, ComposeCompileSuccessData,
|
|
5
|
-
export { AnyHandle, Bindable, InputHandle, OutputHandle, ResourceInputHandle, isInputHandle, isOutputHandle } from './authoring/handles.js';
|
|
4
|
+
export { AppliedGuard, ApprovalEntry, Call, Check, CheckComparator, ComposeAction, ComposeCompilePartialData, ComposeCompileRequest, ComposeCompileResult, ComposeCompileSuccessData, ComposeErrorKind, ComposeFee, ComposeFill, ComposeRouteRequest, ComposeTransactionRequest, ComposeUserProgramSimulation, ContinuationIntent, ContinuationOutcome, ContinuationPlanWire, Erc20AllowanceRequirement, Erc20BalanceRequirement, FailedPreparedOp, Flow, InputSpec, MaterialiserConfigOf, MaterialiserInput, NativeBalanceRequirement, Phase1ArtifactWire, Precondition, PreconditionConfigOf, PriceImpact, ProducedResource, Ref, Resource, RouteAmount, RouteAmountAll, RouteAmountExact, SIMULATE_MAX_REQUIREMENTS, SIMULATE_MAX_TRACKED_BALANCES, SimulateBalanceEntry, SimulateOkResult, SimulateRequest, SimulateResult, SimulateRevertDecodeResult, SimulateRevertResult, SimulateSetupErrorResult, SimulatedAmounts, SimulationPolicy, SimulationRevert, SlotFinderRequirement, SolType, SweepTo, TrackedBalance } from '@lifi/compose-spec';
|
|
5
|
+
export { AnyHandle, AnyRefBindable, Bindable, InputHandle, OutputHandle, RefBindable, ResourceInputHandle, isInputHandle, isOutputHandle } from './authoring/handles.js';
|
|
6
6
|
export { ref } from './authoring/raw.js';
|
|
7
7
|
export { AnyBindable, FlowOptions, TypedFlow } from './authoring/FlowBuilderCore.js';
|
|
8
8
|
export { ComposeRunInput, materialiser } from './run/inputs.js';
|
|
@@ -11,9 +11,10 @@ export { ComposeSdk, ComposeSdkOptions, FlowBuilder, createComposeSdk } from './
|
|
|
11
11
|
import { g as guardsMod } from './guards.generated-BPLFwe7y.js';
|
|
12
12
|
import { m as materialisersMod } from './materialisers.generated-BMkBQgWZ.js';
|
|
13
13
|
import { p as preconditionsMod } from './preconditions.generated-U7YpVh30.js';
|
|
14
|
-
import { r as rawMod } from './raw-
|
|
14
|
+
import { r as rawMod } from './raw-BvRghN3r.js';
|
|
15
15
|
import { r as resourcesMod } from './resources-CYis1_DS.js';
|
|
16
|
-
|
|
16
|
+
import { r as routeAmountMod } from './routeAmount-DdbJYJyM.js';
|
|
17
|
+
export { AaveBorrowConfig, AaveClaimRewardsConfig, AaveGetHealthFactorConfig, AaveRepayConfig, AaveRepayWithATokensConfig, AaveSetEModeConfig, BalanceOfMaterialiserConfig, Between010000, Between0255, Between03318, Between05000, CallMaterialiserConfig, ContinuationAssertReadyConfig, CoreApproveConfig, CoreAsResourceConfig, CoreBalanceOfConfig, CoreBpsDownConfig, CoreBpsUpConfig, CoreCallConfig, CoreEmitEvent1Config, CoreEmitEvent2Config, CoreEmitEvent3Config, CoreEmitEvent4Config, CoreInvokeConfig, CoreNumericInvariantGuardConfig, CorePeekConfig, CoreRawCallConfig, CoreSplitConfig, CoreStaticCallConfig, CoreTransferConfig, DirectDepositMaterialiserConfig, Erc20AllowancePreconditionConfig, Erc20BalancePreconditionConfig, FlashloanMaterialiserConfig, FlySwapConfig, InvariantEqConfig, InvariantGtConfig, InvariantGteConfig, InvariantLtConfig, InvariantLteConfig, InvariantNeqConfig, InvariantNumericConfig, InvariantNumericInRangeConfig, LifiFlashloanRepayConfig, LifiSwapConfig, LifiZapAsyncConfig, LifiZapConfig, MaxItems50, MaxLength64, MaxLength65536, MorphoBlueBorrowConfig, MorphoBlueGetPositionConfig, MorphoBlueRepayConfig, MorphoBlueSupplyCollateralConfig, MorphoBlueSupplyConfig, MorphoBlueWithdrawCollateralConfig, MorphoBlueWithdrawConfig, NativeBalancePreconditionConfig, NonNegative, ParaswapBuyConfig, Positive, SlippageGuardConfig, StartsWith0X } from './generated/config.generated.js';
|
|
17
18
|
import './client.js';
|
|
18
19
|
import './generated/operations.generated.js';
|
|
19
20
|
import './authoring/signatureArgs.js';
|
|
@@ -88,6 +89,24 @@ declare const preconditions: typeof preconditionsMod;
|
|
|
88
89
|
* ```
|
|
89
90
|
*/
|
|
90
91
|
declare const resources: typeof resourcesMod;
|
|
92
|
+
/**
|
|
93
|
+
* Amount constructors for {@link ComposeSdk.route}. Use
|
|
94
|
+
* {@link routeAmount.exact} to spend a fixed amount of the `fromToken`, and
|
|
95
|
+
* {@link routeAmount.all} to spend the signer's whole balance.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* // USDC into the Aave v3 aEthUSDC position — one routing-catalog edge.
|
|
100
|
+
* const result = await sdk.route({
|
|
101
|
+
* chainId: 1,
|
|
102
|
+
* fromToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
103
|
+
* toToken: '0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c',
|
|
104
|
+
* amount: routeAmount.exact(1_000_000n),
|
|
105
|
+
* signer: '0xYourAddress...',
|
|
106
|
+
* });
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
declare const routeAmount: typeof routeAmountMod;
|
|
91
110
|
|
|
92
111
|
/**
|
|
93
112
|
* Low-level escape hatch for constructing flow nodes, guards, and materialiser
|
|
@@ -97,4 +116,4 @@ declare const resources: typeof resourcesMod;
|
|
|
97
116
|
*/
|
|
98
117
|
declare const raw: typeof rawMod;
|
|
99
118
|
|
|
100
|
-
export { guards, materialisers, preconditions, raw, resources };
|
|
119
|
+
export { guards, materialisers, preconditions, raw, resources, routeAmount };
|
package/dist/index.js
CHANGED
|
@@ -13,10 +13,12 @@ import * as materialisersMod from "./generated/materialisers.generated.js";
|
|
|
13
13
|
import * as preconditionsMod from "./generated/preconditions.generated.js";
|
|
14
14
|
import * as rawMod from "./raw.js";
|
|
15
15
|
import * as resourcesMod from "./resources.js";
|
|
16
|
+
import * as routeAmountMod from "./routeAmount.js";
|
|
16
17
|
const guards = guardsMod;
|
|
17
18
|
const materialisers = materialisersMod;
|
|
18
19
|
const preconditions = preconditionsMod;
|
|
19
20
|
const resources = resourcesMod;
|
|
21
|
+
const routeAmount = routeAmountMod;
|
|
20
22
|
export * from "./generated/config.generated.js";
|
|
21
23
|
const raw = rawMod;
|
|
22
24
|
export {
|
|
@@ -34,6 +36,7 @@ export {
|
|
|
34
36
|
preconditions,
|
|
35
37
|
raw,
|
|
36
38
|
ref,
|
|
37
|
-
resources
|
|
39
|
+
resources,
|
|
40
|
+
routeAmount
|
|
38
41
|
};
|
|
39
42
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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} from './types.js';\n\nexport type {\n GetZapPacksOptions,\n ZapPackEdge,\n ZapPackOverview,\n} from './discovery.js';\nexport type {\n ComposeError,\n ComposeErrorCode,\n ComposePreparationOps,\n} from './errors.js';\nexport type {\n AppliedGuard,\n ApprovalEntry,\n Call,\n ComposeCompilePartialData,\n ComposeCompileRequest,\n ComposeCompileResult,\n ComposeCompileSuccessData,\n
|
|
1
|
+
{"version":3,"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 ComposeError,\n ComposeErrorCode,\n ComposePreparationOps,\n} from './errors.js';\nexport type {\n AppliedGuard,\n ApprovalEntry,\n Call,\n ComposeCompilePartialData,\n ComposeAction,\n ComposeFill,\n ComposeFee,\n ComposeUserProgramSimulation,\n ComposeCompileRequest,\n ComposeCompileResult,\n ComposeCompileSuccessData,\n ComposeErrorKind,\n ComposeRouteRequest,\n ComposeTransactionRequest,\n FailedPreparedOp,\n Flow,\n InputSpec,\n MaterialiserConfigOf,\n MaterialiserInput,\n Precondition,\n PreconditionConfigOf,\n PriceImpact,\n ProducedResource,\n Ref,\n Resource,\n RouteAmount,\n RouteAmountAll,\n RouteAmountExact,\n SimulatedAmounts,\n SimulationPolicy,\n SimulationRevert,\n SolType,\n SweepTo,\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 Check,\n CheckComparator,\n Phase1ArtifactWire,\n ContinuationPlanWire,\n} from '@lifi/compose-spec';\nexport {\n SIMULATE_MAX_TRACKED_BALANCES,\n SIMULATE_MAX_REQUIREMENTS,\n} from '@lifi/compose-spec';\nexport { isComposeError, isComposePreparationError } from './errors.js';\n\nexport type {\n Bindable,\n RefBindable,\n AnyRefBindable,\n InputHandle,\n ResourceInputHandle,\n OutputHandle,\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 { 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":"AAwFA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,gBAAgB,iCAAiC;AAW1D,SAAS,eAAe,sBAAsB;AAC9C,SAAS,WAAW;AAMpB,SAAS,oBAAoB;AAE7B,SAAS,4BAA4B;AAGrC,SAAS,wBAAwB;AAGjC,YAAY,eAAe;AAC3B,YAAY,sBAAsB;AAClC,YAAY,sBAAsB;AAClC,YAAY,YAAY;AACxB,YAAY,kBAAkB;AAC9B,YAAY,oBAAoB;AAezB,MAAM,SAA2B;AAajC,MAAM,gBAAyC;AAgB/C,MAAM,gBAAyC;AAgB/C,MAAM,YAAiC;AAkBvC,MAAM,cAAqC;AAClD,cAAc;AAQP,MAAM,MAAqB;","names":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { rawGuard, ref } from './authoring/raw.js';
|
|
1
|
+
import { rawGuard, literal, ref } from './authoring/raw.js';
|
|
2
2
|
import { materialiser } from './run/inputs.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -10,10 +10,11 @@ import { materialiser } from './run/inputs.js';
|
|
|
10
10
|
* (e.g. `builder.lifi.swap(...)`) and the typed guard/materialiser helpers.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
declare const rawMod_literal: typeof literal;
|
|
13
14
|
declare const rawMod_materialiser: typeof materialiser;
|
|
14
15
|
declare const rawMod_ref: typeof ref;
|
|
15
16
|
declare namespace rawMod {
|
|
16
|
-
export { rawGuard as guard, rawMod_materialiser as materialiser, rawMod_ref as ref };
|
|
17
|
+
export { rawGuard as guard, rawMod_literal as literal, rawMod_materialiser as materialiser, rawMod_ref as ref };
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
export { rawMod as r };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { rawGuard, ref } from './authoring/raw.cjs';
|
|
1
|
+
import { rawGuard, literal, ref } from './authoring/raw.cjs';
|
|
2
2
|
import { materialiser } from './run/inputs.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -10,10 +10,11 @@ import { materialiser } from './run/inputs.cjs';
|
|
|
10
10
|
* (e.g. `builder.lifi.swap(...)`) and the typed guard/materialiser helpers.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
declare const rawMod_literal: typeof literal;
|
|
13
14
|
declare const rawMod_materialiser: typeof materialiser;
|
|
14
15
|
declare const rawMod_ref: typeof ref;
|
|
15
16
|
declare namespace rawMod {
|
|
16
|
-
export { rawGuard as guard, rawMod_materialiser as materialiser, rawMod_ref as ref };
|
|
17
|
+
export { rawGuard as guard, rawMod_literal as literal, rawMod_materialiser as materialiser, rawMod_ref as ref };
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
export { rawMod as r };
|
package/dist/raw.cjs
CHANGED
|
@@ -19,6 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var raw_exports = {};
|
|
20
20
|
__export(raw_exports, {
|
|
21
21
|
guard: () => import_raw.rawGuard,
|
|
22
|
+
literal: () => import_raw.literal,
|
|
22
23
|
materialiser: () => import_inputs.materialiser,
|
|
23
24
|
ref: () => import_raw.ref
|
|
24
25
|
});
|
|
@@ -28,6 +29,7 @@ var import_inputs = require("./run/inputs.js");
|
|
|
28
29
|
// Annotate the CommonJS export names for ESM import in node:
|
|
29
30
|
0 && (module.exports = {
|
|
30
31
|
guard,
|
|
32
|
+
literal,
|
|
31
33
|
materialiser,
|
|
32
34
|
ref
|
|
33
35
|
});
|
package/dist/raw.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/raw.ts"],"sourcesContent":["/**\n * Low-level escape hatch for constructing flow nodes and guards without the\n * typed builder API. Use these when working with operation kinds not covered\n * by the generated methods, or when you need full control over the JSON shape.\n *\n * For most use cases, prefer the generated operation methods on {@link FlowBuilder}\n * (e.g. `builder.lifi.swap(...)`) and the typed guard/materialiser helpers.\n */\nexport { rawGuard as guard, ref } from './authoring/raw.js';\nexport { materialiser } from './run/inputs.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,
|
|
1
|
+
{"version":3,"sources":["../src/raw.ts"],"sourcesContent":["/**\n * Low-level escape hatch for constructing flow nodes and guards without the\n * typed builder API. Use these when working with operation kinds not covered\n * by the generated methods, or when you need full control over the JSON shape.\n *\n * For most use cases, prefer the generated operation methods on {@link FlowBuilder}\n * (e.g. `builder.lifi.swap(...)`) and the typed guard/materialiser helpers.\n */\nexport { rawGuard as guard, literal, ref } from './authoring/raw.js';\nexport { materialiser } from './run/inputs.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,iBAAgD;AAChD,oBAA6B;","names":[]}
|
package/dist/raw.d.cts
CHANGED
package/dist/raw.d.ts
CHANGED
package/dist/raw.js
CHANGED
package/dist/raw.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/raw.ts"],"sourcesContent":["/**\n * Low-level escape hatch for constructing flow nodes and guards without the\n * typed builder API. Use these when working with operation kinds not covered\n * by the generated methods, or when you need full control over the JSON shape.\n *\n * For most use cases, prefer the generated operation methods on {@link FlowBuilder}\n * (e.g. `builder.lifi.swap(...)`) and the typed guard/materialiser helpers.\n */\nexport { rawGuard as guard, ref } from './authoring/raw.js';\nexport { materialiser } from './run/inputs.js';\n"],"mappings":"AAQA,SAAqB,UAAO,WAAW;
|
|
1
|
+
{"version":3,"sources":["../src/raw.ts"],"sourcesContent":["/**\n * Low-level escape hatch for constructing flow nodes and guards without the\n * typed builder API. Use these when working with operation kinds not covered\n * by the generated methods, or when you need full control over the JSON shape.\n *\n * For most use cases, prefer the generated operation methods on {@link FlowBuilder}\n * (e.g. `builder.lifi.swap(...)`) and the typed guard/materialiser helpers.\n */\nexport { rawGuard as guard, literal, ref } from './authoring/raw.js';\nexport { materialiser } from './run/inputs.js';\n"],"mappings":"AAQA,SAAqB,UAAO,SAAS,WAAW;AAChD,SAAS,oBAAoB;","names":[]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { RouteAmountAll, RouteAmountExact } from '@lifi/compose-spec';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Spend an exact amount of the route's `fromToken`.
|
|
5
|
+
*
|
|
6
|
+
* @param amount - Amount in the token's smallest unit. `bigint` is serialised
|
|
7
|
+
* to a decimal string when the request is sent.
|
|
8
|
+
* @returns The `EXACT` member of the route amount union.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const result = await sdk.route({
|
|
13
|
+
* chainId: 1,
|
|
14
|
+
* fromToken: NATIVE_ETH,
|
|
15
|
+
* toToken: WETH,
|
|
16
|
+
* amount: routeAmount.exact(10n ** 17n), // 0.1 ETH, wrapped
|
|
17
|
+
* signer: OWNER,
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
declare const exact: (amount: bigint | string) => RouteAmountExact;
|
|
22
|
+
/**
|
|
23
|
+
* Spend the signer's entire `fromToken` balance, resolved on-chain at execution
|
|
24
|
+
* time.
|
|
25
|
+
*
|
|
26
|
+
* Not supported when `fromToken` is the chain's native sentinel — the server
|
|
27
|
+
* rejects it. A gas coin is sent via `msg.value`, so there is no on-chain
|
|
28
|
+
* balance to sweep; use {@link exact} for native inputs.
|
|
29
|
+
*
|
|
30
|
+
* @param simAmount - A realistic estimate of that balance, in the token's
|
|
31
|
+
* smallest unit. The server quotes and simulates against this value, so it
|
|
32
|
+
* shapes the returned quote and preconditions — but the amount actually moved
|
|
33
|
+
* is whatever the balance turns out to be.
|
|
34
|
+
* @returns The `ALL` member of the route amount union.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const result = await sdk.route({
|
|
39
|
+
* chainId: 1,
|
|
40
|
+
* fromToken: USDC,
|
|
41
|
+
* toToken: A_ETH_USDC,
|
|
42
|
+
* amount: routeAmount.all(1_000_000n), // estimate: ~1 USDC on hand
|
|
43
|
+
* signer: OWNER,
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
declare const all: (simAmount: bigint | string) => RouteAmountAll;
|
|
48
|
+
|
|
49
|
+
declare const routeAmountMod_all: typeof all;
|
|
50
|
+
declare const routeAmountMod_exact: typeof exact;
|
|
51
|
+
declare namespace routeAmountMod {
|
|
52
|
+
export { routeAmountMod_all as all, routeAmountMod_exact as exact };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { all as a, exact as e, routeAmountMod as r };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { RouteAmountAll, RouteAmountExact } from '@lifi/compose-spec';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Spend an exact amount of the route's `fromToken`.
|
|
5
|
+
*
|
|
6
|
+
* @param amount - Amount in the token's smallest unit. `bigint` is serialised
|
|
7
|
+
* to a decimal string when the request is sent.
|
|
8
|
+
* @returns The `EXACT` member of the route amount union.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const result = await sdk.route({
|
|
13
|
+
* chainId: 1,
|
|
14
|
+
* fromToken: NATIVE_ETH,
|
|
15
|
+
* toToken: WETH,
|
|
16
|
+
* amount: routeAmount.exact(10n ** 17n), // 0.1 ETH, wrapped
|
|
17
|
+
* signer: OWNER,
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
declare const exact: (amount: bigint | string) => RouteAmountExact;
|
|
22
|
+
/**
|
|
23
|
+
* Spend the signer's entire `fromToken` balance, resolved on-chain at execution
|
|
24
|
+
* time.
|
|
25
|
+
*
|
|
26
|
+
* Not supported when `fromToken` is the chain's native sentinel — the server
|
|
27
|
+
* rejects it. A gas coin is sent via `msg.value`, so there is no on-chain
|
|
28
|
+
* balance to sweep; use {@link exact} for native inputs.
|
|
29
|
+
*
|
|
30
|
+
* @param simAmount - A realistic estimate of that balance, in the token's
|
|
31
|
+
* smallest unit. The server quotes and simulates against this value, so it
|
|
32
|
+
* shapes the returned quote and preconditions — but the amount actually moved
|
|
33
|
+
* is whatever the balance turns out to be.
|
|
34
|
+
* @returns The `ALL` member of the route amount union.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const result = await sdk.route({
|
|
39
|
+
* chainId: 1,
|
|
40
|
+
* fromToken: USDC,
|
|
41
|
+
* toToken: A_ETH_USDC,
|
|
42
|
+
* amount: routeAmount.all(1_000_000n), // estimate: ~1 USDC on hand
|
|
43
|
+
* signer: OWNER,
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
declare const all: (simAmount: bigint | string) => RouteAmountAll;
|
|
48
|
+
|
|
49
|
+
declare const routeAmountMod_all: typeof all;
|
|
50
|
+
declare const routeAmountMod_exact: typeof exact;
|
|
51
|
+
declare namespace routeAmountMod {
|
|
52
|
+
export { routeAmountMod_all as all, routeAmountMod_exact as exact };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { all as a, exact as e, routeAmountMod as r };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all2) => {
|
|
7
|
+
for (var name in all2)
|
|
8
|
+
__defProp(target, name, { get: all2[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var routeAmount_exports = {};
|
|
20
|
+
__export(routeAmount_exports, {
|
|
21
|
+
all: () => all,
|
|
22
|
+
exact: () => exact
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(routeAmount_exports);
|
|
25
|
+
const exact = (amount) => ({
|
|
26
|
+
type: "EXACT",
|
|
27
|
+
amount
|
|
28
|
+
});
|
|
29
|
+
const all = (simAmount) => ({
|
|
30
|
+
type: "ALL",
|
|
31
|
+
simAmount
|
|
32
|
+
});
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
all,
|
|
36
|
+
exact
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=routeAmount.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/routeAmount.ts"],"sourcesContent":["import type { RouteAmountAll, RouteAmountExact } from '@lifi/compose-spec';\n\n// Constructors for the `amount` member of a `ComposeRouteRequest`. The wire\n// union is discriminated by `type` and — deliberately, because the two variants\n// mean different things — names its payload field differently in each variant:\n// `amount` is the sum actually moved, `simAmount` is only a quoting stand-in for\n// a balance resolved on-chain. These helpers keep call sites from having to\n// remember which name goes with which discriminant.\n\n/**\n * Spend an exact amount of the route's `fromToken`.\n *\n * @param amount - Amount in the token's smallest unit. `bigint` is serialised\n * to a decimal string when the request is sent.\n * @returns The `EXACT` member of the route amount union.\n *\n * @example\n * ```ts\n * const result = await sdk.route({\n * chainId: 1,\n * fromToken: NATIVE_ETH,\n * toToken: WETH,\n * amount: routeAmount.exact(10n ** 17n), // 0.1 ETH, wrapped\n * signer: OWNER,\n * });\n * ```\n */\nexport const exact = (amount: bigint | string): RouteAmountExact => ({\n type: 'EXACT',\n amount,\n});\n\n/**\n * Spend the signer's entire `fromToken` balance, resolved on-chain at execution\n * time.\n *\n * Not supported when `fromToken` is the chain's native sentinel — the server\n * rejects it. A gas coin is sent via `msg.value`, so there is no on-chain\n * balance to sweep; use {@link exact} for native inputs.\n *\n * @param simAmount - A realistic estimate of that balance, in the token's\n * smallest unit. The server quotes and simulates against this value, so it\n * shapes the returned quote and preconditions — but the amount actually moved\n * is whatever the balance turns out to be.\n * @returns The `ALL` member of the route amount union.\n *\n * @example\n * ```ts\n * const result = await sdk.route({\n * chainId: 1,\n * fromToken: USDC,\n * toToken: A_ETH_USDC,\n * amount: routeAmount.all(1_000_000n), // estimate: ~1 USDC on hand\n * signer: OWNER,\n * });\n * ```\n */\nexport const all = (simAmount: bigint | string): RouteAmountAll => ({\n type: 'ALL',\n simAmount,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BO,MAAM,QAAQ,CAAC,YAA+C;AAAA,EACnE,MAAM;AAAA,EACN;AACF;AA2BO,MAAM,MAAM,CAAC,eAAgD;AAAA,EAClE,MAAM;AAAA,EACN;AACF;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/routeAmount.ts"],"sourcesContent":["import type { RouteAmountAll, RouteAmountExact } from '@lifi/compose-spec';\n\n// Constructors for the `amount` member of a `ComposeRouteRequest`. The wire\n// union is discriminated by `type` and — deliberately, because the two variants\n// mean different things — names its payload field differently in each variant:\n// `amount` is the sum actually moved, `simAmount` is only a quoting stand-in for\n// a balance resolved on-chain. These helpers keep call sites from having to\n// remember which name goes with which discriminant.\n\n/**\n * Spend an exact amount of the route's `fromToken`.\n *\n * @param amount - Amount in the token's smallest unit. `bigint` is serialised\n * to a decimal string when the request is sent.\n * @returns The `EXACT` member of the route amount union.\n *\n * @example\n * ```ts\n * const result = await sdk.route({\n * chainId: 1,\n * fromToken: NATIVE_ETH,\n * toToken: WETH,\n * amount: routeAmount.exact(10n ** 17n), // 0.1 ETH, wrapped\n * signer: OWNER,\n * });\n * ```\n */\nexport const exact = (amount: bigint | string): RouteAmountExact => ({\n type: 'EXACT',\n amount,\n});\n\n/**\n * Spend the signer's entire `fromToken` balance, resolved on-chain at execution\n * time.\n *\n * Not supported when `fromToken` is the chain's native sentinel — the server\n * rejects it. A gas coin is sent via `msg.value`, so there is no on-chain\n * balance to sweep; use {@link exact} for native inputs.\n *\n * @param simAmount - A realistic estimate of that balance, in the token's\n * smallest unit. The server quotes and simulates against this value, so it\n * shapes the returned quote and preconditions — but the amount actually moved\n * is whatever the balance turns out to be.\n * @returns The `ALL` member of the route amount union.\n *\n * @example\n * ```ts\n * const result = await sdk.route({\n * chainId: 1,\n * fromToken: USDC,\n * toToken: A_ETH_USDC,\n * amount: routeAmount.all(1_000_000n), // estimate: ~1 USDC on hand\n * signer: OWNER,\n * });\n * ```\n */\nexport const all = (simAmount: bigint | string): RouteAmountAll => ({\n type: 'ALL',\n simAmount,\n});\n"],"mappings":"AA2BO,MAAM,QAAQ,CAAC,YAA+C;AAAA,EACnE,MAAM;AAAA,EACN;AACF;AA2BO,MAAM,MAAM,CAAC,eAAgD;AAAA,EAClE,MAAM;AAAA,EACN;AACF;","names":[]}
|
package/dist/run/inputs.cjs
CHANGED
|
@@ -26,25 +26,24 @@ const materialiser = (kind, config = {}) => ({
|
|
|
26
26
|
kind,
|
|
27
27
|
...config
|
|
28
28
|
});
|
|
29
|
+
const pickDefined = (obj) => Object.fromEntries(
|
|
30
|
+
Object.entries(obj).filter(([, value]) => value !== void 0)
|
|
31
|
+
);
|
|
29
32
|
const buildRun = (run) => ({
|
|
30
33
|
inputs: run.inputs,
|
|
31
|
-
...run.preconditions?.length && { preconditions: run.preconditions },
|
|
32
34
|
signer: run.signer,
|
|
33
|
-
...
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
maxPriceImpactBps: run.maxPriceImpactBps
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
simulationPolicy: run.simulationPolicy
|
|
44
|
-
},
|
|
45
|
-
...run.checkOnChainAllowances !== void 0 && {
|
|
35
|
+
...pickDefined({
|
|
36
|
+
// An empty precondition list is the same as none, so drop it too.
|
|
37
|
+
preconditions: run.preconditions?.length ? run.preconditions : void 0,
|
|
38
|
+
assumptions: run.assumptions,
|
|
39
|
+
referrer: run.referrer,
|
|
40
|
+
integratorFeeBps: run.integratorFeeBps,
|
|
41
|
+
maxPriceImpactBps: run.maxPriceImpactBps,
|
|
42
|
+
sweepTo: run.sweepTo,
|
|
43
|
+
simulationPolicy: run.simulationPolicy,
|
|
44
|
+
simulateUserProgram: run.simulateUserProgram,
|
|
46
45
|
checkOnChainAllowances: run.checkOnChainAllowances
|
|
47
|
-
}
|
|
46
|
+
})
|
|
48
47
|
});
|
|
49
48
|
// Annotate the CommonJS export names for ESM import in node:
|
|
50
49
|
0 && (module.exports = {
|
package/dist/run/inputs.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/run/inputs.ts"],"sourcesContent":["import type {\n ComposeRun,\n InputSpec,\n MaterialiserInput,\n Precondition,\n SimulationPolicy,\n SweepTo,\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 /**\n * Optional integrator fee in basis points (1bp = 0.01%, max `9000` = 90%).\n * A non-zero value requires the request to be authenticated with an\n * integration-scoped API key — the integration is derived from the key, not\n * this field. Defaults to `0` (no fee) when omitted.\n */\n readonly integratorFeeBps?: number;\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?: SweepTo;\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 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 * 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 integratorFeeBps?: number;\n maxPriceImpactBps?: number;\n sweepTo?: SweepTo;\n simulationPolicy?: SimulationPolicy;\n checkOnChainAllowances?: boolean;\n}): ComposeRun => ({\n inputs: run.inputs,\n
|
|
1
|
+
{"version":3,"sources":["../../src/run/inputs.ts"],"sourcesContent":["import type {\n ComposeRun,\n InputSpec,\n MaterialiserInput,\n Precondition,\n SimulationPolicy,\n SweepTo,\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 /**\n * Optional integrator fee in basis points (1bp = 0.01%, max `9000` = 90%).\n * A non-zero value requires the request to be authenticated with an\n * integration-scoped API key — the integration is derived from the key, not\n * this field. Defaults to `0` (no fee) when omitted.\n */\n readonly integratorFeeBps?: number;\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?: SweepTo;\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 integratorFeeBps?: number;\n maxPriceImpactBps?: number;\n sweepTo?: SweepTo;\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 integratorFeeBps: run.integratorFeeBps,\n maxPriceImpactBps: run.maxPriceImpactBps,\n sweepTo: run.sweepTo,\n simulationPolicy: run.simulationPolicy,\n simulateUserProgram: run.simulateUserProgram,\n checkOnChainAllowances: run.checkOnChainAllowances,\n }),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0FO,MAAM,eAAe,CAC1B,MACA,SAAkC,CAAC,OACZ;AAAA,EACvB;AAAA,EACA,GAAG;AACL;AAUA,MAAM,cAAc,CAClB,QAEA,OAAO;AAAA,EACL,OAAO,QAAQ,GAAG,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,UAAU,MAAS;AAC/D;AAQK,MAAM,WAAW,CAAC,SAYN;AAAA,EACjB,QAAQ,IAAI;AAAA,EACZ,QAAQ,IAAI;AAAA,EACZ,GAAG,YAAY;AAAA;AAAA,IAEb,eAAe,IAAI,eAAe,SAAS,IAAI,gBAAgB;AAAA,IAC/D,aAAa,IAAI;AAAA,IACjB,UAAU,IAAI;AAAA,IACd,kBAAkB,IAAI;AAAA,IACtB,mBAAmB,IAAI;AAAA,IACvB,SAAS,IAAI;AAAA,IACb,kBAAkB,IAAI;AAAA,IACtB,qBAAqB,IAAI;AAAA,IACzB,wBAAwB,IAAI;AAAA,EAC9B,CAAC;AACH;","names":[]}
|
package/dist/run/inputs.d.cts
CHANGED
|
@@ -50,6 +50,13 @@ interface ComposeRunInput<T extends InputSchema = InputSchema> {
|
|
|
50
50
|
* result with the transaction and revert diagnostics.
|
|
51
51
|
*/
|
|
52
52
|
readonly simulationPolicy?: SimulationPolicy;
|
|
53
|
+
/**
|
|
54
|
+
* When `true`, the server also simulates the final user-facing transaction
|
|
55
|
+
* after the structured simulation succeeds; reverts honour
|
|
56
|
+
* `simulationPolicy`. On success the result is echoed back on the response as
|
|
57
|
+
* `userProgramSimulation`. Defaults to `false`.
|
|
58
|
+
*/
|
|
59
|
+
readonly simulateUserProgram?: boolean;
|
|
53
60
|
/**
|
|
54
61
|
* When `true`, the server checks on-chain ERC-20 allowances and omits
|
|
55
62
|
* approvals that are already sufficient. Defaults to `false`.
|
|
@@ -93,6 +100,7 @@ declare const buildRun: (run: {
|
|
|
93
100
|
maxPriceImpactBps?: number;
|
|
94
101
|
sweepTo?: SweepTo;
|
|
95
102
|
simulationPolicy?: SimulationPolicy;
|
|
103
|
+
simulateUserProgram?: boolean;
|
|
96
104
|
checkOnChainAllowances?: boolean;
|
|
97
105
|
}) => ComposeRun;
|
|
98
106
|
|
package/dist/run/inputs.d.ts
CHANGED
|
@@ -50,6 +50,13 @@ interface ComposeRunInput<T extends InputSchema = InputSchema> {
|
|
|
50
50
|
* result with the transaction and revert diagnostics.
|
|
51
51
|
*/
|
|
52
52
|
readonly simulationPolicy?: SimulationPolicy;
|
|
53
|
+
/**
|
|
54
|
+
* When `true`, the server also simulates the final user-facing transaction
|
|
55
|
+
* after the structured simulation succeeds; reverts honour
|
|
56
|
+
* `simulationPolicy`. On success the result is echoed back on the response as
|
|
57
|
+
* `userProgramSimulation`. Defaults to `false`.
|
|
58
|
+
*/
|
|
59
|
+
readonly simulateUserProgram?: boolean;
|
|
53
60
|
/**
|
|
54
61
|
* When `true`, the server checks on-chain ERC-20 allowances and omits
|
|
55
62
|
* approvals that are already sufficient. Defaults to `false`.
|
|
@@ -93,6 +100,7 @@ declare const buildRun: (run: {
|
|
|
93
100
|
maxPriceImpactBps?: number;
|
|
94
101
|
sweepTo?: SweepTo;
|
|
95
102
|
simulationPolicy?: SimulationPolicy;
|
|
103
|
+
simulateUserProgram?: boolean;
|
|
96
104
|
checkOnChainAllowances?: boolean;
|
|
97
105
|
}) => ComposeRun;
|
|
98
106
|
|
package/dist/run/inputs.js
CHANGED
|
@@ -2,25 +2,24 @@ const materialiser = (kind, config = {}) => ({
|
|
|
2
2
|
kind,
|
|
3
3
|
...config
|
|
4
4
|
});
|
|
5
|
+
const pickDefined = (obj) => Object.fromEntries(
|
|
6
|
+
Object.entries(obj).filter(([, value]) => value !== void 0)
|
|
7
|
+
);
|
|
5
8
|
const buildRun = (run) => ({
|
|
6
9
|
inputs: run.inputs,
|
|
7
|
-
...run.preconditions?.length && { preconditions: run.preconditions },
|
|
8
10
|
signer: run.signer,
|
|
9
|
-
...
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
maxPriceImpactBps: run.maxPriceImpactBps
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
simulationPolicy: run.simulationPolicy
|
|
20
|
-
},
|
|
21
|
-
...run.checkOnChainAllowances !== void 0 && {
|
|
11
|
+
...pickDefined({
|
|
12
|
+
// An empty precondition list is the same as none, so drop it too.
|
|
13
|
+
preconditions: run.preconditions?.length ? run.preconditions : void 0,
|
|
14
|
+
assumptions: run.assumptions,
|
|
15
|
+
referrer: run.referrer,
|
|
16
|
+
integratorFeeBps: run.integratorFeeBps,
|
|
17
|
+
maxPriceImpactBps: run.maxPriceImpactBps,
|
|
18
|
+
sweepTo: run.sweepTo,
|
|
19
|
+
simulationPolicy: run.simulationPolicy,
|
|
20
|
+
simulateUserProgram: run.simulateUserProgram,
|
|
22
21
|
checkOnChainAllowances: run.checkOnChainAllowances
|
|
23
|
-
}
|
|
22
|
+
})
|
|
24
23
|
});
|
|
25
24
|
export {
|
|
26
25
|
buildRun,
|
package/dist/run/inputs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/run/inputs.ts"],"sourcesContent":["import type {\n ComposeRun,\n InputSpec,\n MaterialiserInput,\n Precondition,\n SimulationPolicy,\n SweepTo,\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 /**\n * Optional integrator fee in basis points (1bp = 0.01%, max `9000` = 90%).\n * A non-zero value requires the request to be authenticated with an\n * integration-scoped API key — the integration is derived from the key, not\n * this field. Defaults to `0` (no fee) when omitted.\n */\n readonly integratorFeeBps?: number;\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?: SweepTo;\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 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 * 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 integratorFeeBps?: number;\n maxPriceImpactBps?: number;\n sweepTo?: SweepTo;\n simulationPolicy?: SimulationPolicy;\n checkOnChainAllowances?: boolean;\n}): ComposeRun => ({\n inputs: run.inputs,\n
|
|
1
|
+
{"version":3,"sources":["../../src/run/inputs.ts"],"sourcesContent":["import type {\n ComposeRun,\n InputSpec,\n MaterialiserInput,\n Precondition,\n SimulationPolicy,\n SweepTo,\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 /**\n * Optional integrator fee in basis points (1bp = 0.01%, max `9000` = 90%).\n * A non-zero value requires the request to be authenticated with an\n * integration-scoped API key — the integration is derived from the key, not\n * this field. Defaults to `0` (no fee) when omitted.\n */\n readonly integratorFeeBps?: number;\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?: SweepTo;\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 integratorFeeBps?: number;\n maxPriceImpactBps?: number;\n sweepTo?: SweepTo;\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 integratorFeeBps: run.integratorFeeBps,\n maxPriceImpactBps: run.maxPriceImpactBps,\n sweepTo: run.sweepTo,\n simulationPolicy: run.simulationPolicy,\n simulateUserProgram: run.simulateUserProgram,\n checkOnChainAllowances: run.checkOnChainAllowances,\n }),\n});\n"],"mappings":"AA0FO,MAAM,eAAe,CAC1B,MACA,SAAkC,CAAC,OACZ;AAAA,EACvB;AAAA,EACA,GAAG;AACL;AAUA,MAAM,cAAc,CAClB,QAEA,OAAO;AAAA,EACL,OAAO,QAAQ,GAAG,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,UAAU,MAAS;AAC/D;AAQK,MAAM,WAAW,CAAC,SAYN;AAAA,EACjB,QAAQ,IAAI;AAAA,EACZ,QAAQ,IAAI;AAAA,EACZ,GAAG,YAAY;AAAA;AAAA,IAEb,eAAe,IAAI,eAAe,SAAS,IAAI,gBAAgB;AAAA,IAC/D,aAAa,IAAI;AAAA,IACjB,UAAU,IAAI;AAAA,IACd,kBAAkB,IAAI;AAAA,IACtB,mBAAmB,IAAI;AAAA,IACvB,SAAS,IAAI;AAAA,IACb,kBAAkB,IAAI;AAAA,IACtB,qBAAqB,IAAI;AAAA,IACzB,wBAAwB,IAAI;AAAA,EAC9B,CAAC;AACH;","names":[]}
|
package/dist/run/simulate.cjs
CHANGED
|
@@ -23,6 +23,11 @@ __export(simulate_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(simulate_exports);
|
|
24
24
|
const buildSimulateRequest = (input) => {
|
|
25
25
|
const { result, chainId, signer, trackedBalances, requirements, block } = input;
|
|
26
|
+
if (result.transactionRequest === void 0) {
|
|
27
|
+
throw new Error(
|
|
28
|
+
"buildSimulateRequest: the compile result has no transactionRequest (empty compiled program \u2014 a settle-only external-funding flow); submit the `actions` entries instead of simulating"
|
|
29
|
+
);
|
|
30
|
+
}
|
|
26
31
|
return {
|
|
27
32
|
chainId,
|
|
28
33
|
from: signer,
|