@lifi/composer-sdk 0.8.1 → 0.10.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 +4 -3
- package/dist/_virtual/_rolldown/runtime.cjs +33 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/authoring/FlowBuilderCore.cjs +102 -120
- package/dist/authoring/FlowBuilderCore.cjs.map +1 -1
- package/dist/authoring/FlowBuilderCore.d.cts +58 -61
- package/dist/authoring/FlowBuilderCore.d.ts +58 -61
- package/dist/authoring/FlowBuilderCore.js +99 -97
- package/dist/authoring/FlowBuilderCore.js.map +1 -1
- package/dist/authoring/handles.cjs +25 -40
- package/dist/authoring/handles.cjs.map +1 -1
- package/dist/authoring/handles.d.cts +33 -34
- package/dist/authoring/handles.d.ts +33 -34
- package/dist/authoring/handles.js +21 -13
- package/dist/authoring/handles.js.map +1 -1
- package/dist/authoring/raw.cjs +85 -44
- package/dist/authoring/raw.cjs.map +1 -1
- package/dist/authoring/raw.d.cts +8 -8
- package/dist/authoring/raw.d.ts +8 -8
- package/dist/authoring/raw.js +83 -19
- package/dist/authoring/raw.js.map +1 -1
- package/dist/authoring/signatureArgs.cjs +81 -103
- package/dist/authoring/signatureArgs.cjs.map +1 -1
- package/dist/authoring/signatureArgs.d.cts +63 -64
- package/dist/authoring/signatureArgs.d.ts +63 -64
- package/dist/authoring/signatureArgs.js +76 -75
- package/dist/authoring/signatureArgs.js.map +1 -1
- package/dist/client.cjs +172 -220
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +131 -131
- package/dist/client.d.ts +131 -131
- package/dist/client.js +165 -198
- package/dist/client.js.map +1 -1
- package/dist/discovery.cjs +0 -17
- package/dist/discovery.d.cts +57 -56
- package/dist/discovery.d.ts +57 -56
- package/dist/discovery.js +1 -1
- package/dist/errors.cjs +211 -159
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts +84 -84
- package/dist/errors.d.ts +84 -84
- package/dist/errors.js +201 -120
- package/dist/errors.js.map +1 -1
- package/dist/generated/config.generated.cjs +0 -17
- package/dist/generated/config.generated.d.cts +804 -936
- package/dist/generated/config.generated.d.ts +804 -936
- package/dist/generated/config.generated.js +1 -1
- package/dist/generated/guards.generated.cjs +25 -35
- package/dist/generated/guards.generated.cjs.map +1 -1
- package/dist/generated/guards.generated.d.cts +20 -4
- package/dist/generated/guards.generated.d.ts +20 -4
- package/dist/generated/guards.generated.js +19 -11
- package/dist/generated/guards.generated.js.map +1 -1
- package/dist/generated/materialisers.generated.cjs +25 -35
- package/dist/generated/materialisers.generated.cjs.map +1 -1
- package/dist/generated/materialisers.generated.d.cts +17 -4
- package/dist/generated/materialisers.generated.d.ts +17 -4
- package/dist/generated/materialisers.generated.js +19 -11
- package/dist/generated/materialisers.generated.js.map +1 -1
- package/dist/generated/operations.generated.cjs +236 -277
- package/dist/generated/operations.generated.cjs.map +1 -1
- package/dist/generated/operations.generated.d.cts +719 -708
- package/dist/generated/operations.generated.d.ts +719 -708
- package/dist/generated/operations.generated.js +235 -256
- package/dist/generated/operations.generated.js.map +1 -1
- package/dist/generated/preconditions.generated.cjs +25 -35
- package/dist/generated/preconditions.generated.cjs.map +1 -1
- package/dist/generated/preconditions.generated.d.cts +17 -4
- package/dist/generated/preconditions.generated.d.ts +17 -4
- package/dist/generated/preconditions.generated.js +19 -11
- package/dist/generated/preconditions.generated.js.map +1 -1
- package/dist/index.cjs +131 -97
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -43
- package/dist/index.d.ts +29 -43
- package/dist/index.js +96 -45
- package/dist/index.js.map +1 -1
- package/dist/outputs.cjs +11 -32
- package/dist/outputs.cjs.map +1 -1
- package/dist/outputs.d.cts +5 -5
- package/dist/outputs.d.ts +5 -5
- package/dist/outputs.js +10 -8
- package/dist/outputs.js.map +1 -1
- package/dist/raw.cjs +21 -33
- package/dist/raw.cjs.map +1 -1
- package/dist/raw.d.cts +8 -4
- package/dist/raw.d.ts +8 -4
- package/dist/raw.js +12 -7
- package/dist/raw.js.map +1 -1
- package/dist/reachability.cjs +82 -112
- package/dist/reachability.cjs.map +1 -1
- package/dist/reachability.d.cts +33 -59
- package/dist/reachability.d.ts +33 -59
- package/dist/reachability.js +81 -88
- package/dist/reachability.js.map +1 -1
- package/dist/resources.cjs +47 -32
- package/dist/resources.cjs.map +1 -1
- package/dist/resources.d.cts +50 -3
- package/dist/resources.d.ts +50 -3
- package/dist/resources.js +42 -9
- package/dist/resources.js.map +1 -1
- package/dist/responseSchemas.cjs +99 -111
- package/dist/responseSchemas.cjs.map +1 -1
- package/dist/responseSchemas.d.cts +34 -34
- package/dist/responseSchemas.d.ts +34 -34
- package/dist/responseSchemas.js +85 -66
- package/dist/responseSchemas.js.map +1 -1
- package/dist/routeAmount.cjs +61 -31
- package/dist/routeAmount.cjs.map +1 -1
- package/dist/routeAmount.d.cts +52 -2
- package/dist/routeAmount.d.ts +52 -2
- package/dist/routeAmount.js +56 -8
- package/dist/routeAmount.js.map +1 -1
- package/dist/run/inputs.cjs +56 -48
- package/dist/run/inputs.cjs.map +1 -1
- package/dist/run/inputs.d.cts +70 -74
- package/dist/run/inputs.d.ts +70 -74
- package/dist/run/inputs.js +54 -23
- package/dist/run/inputs.js.map +1 -1
- package/dist/run/simulate.cjs +38 -43
- package/dist/run/simulate.cjs.map +1 -1
- package/dist/run/simulate.d.cts +36 -36
- package/dist/run/simulate.d.ts +36 -36
- package/dist/run/simulate.js +37 -19
- package/dist/run/simulate.js.map +1 -1
- package/dist/sdk.cjs +55 -66
- package/dist/sdk.cjs.map +1 -1
- package/dist/sdk.d.cts +108 -111
- package/dist/sdk.d.ts +108 -111
- package/dist/sdk.js +52 -44
- package/dist/sdk.js.map +1 -1
- package/dist/types.cjs +0 -17
- package/dist/types.d.cts +22 -22
- package/dist/types.d.ts +22 -22
- package/dist/types.js +1 -1
- package/package.json +5 -5
- package/src/client.ts +2 -2
- package/src/examples/aaveClaimRewards.ts +2 -1
- package/src/examples/emitCustomEvent.ts +1 -2
- package/src/examples/run.ts +1 -1
- package/src/examples/transferTokens.ts +21 -17
- package/src/generated/config.generated.ts +20 -9
- package/src/generated/operations.generated.ts +28 -5
- package/dist/discovery.cjs.map +0 -1
- package/dist/discovery.js.map +0 -1
- package/dist/generated/config.generated.cjs.map +0 -1
- package/dist/generated/config.generated.js.map +0 -1
- package/dist/guards.generated-CDCgYGZo.d.cts +0 -24
- package/dist/guards.generated-CdYcs4h0.d.ts +0 -24
- package/dist/materialisers.generated-BMkBQgWZ.d.ts +0 -24
- package/dist/materialisers.generated-BWq5oePO.d.cts +0 -24
- package/dist/preconditions.generated-DblS13Wq.d.cts +0 -24
- package/dist/preconditions.generated-U7YpVh30.d.ts +0 -24
- package/dist/raw-BvRghN3r.d.ts +0 -20
- package/dist/raw-s1rer8X3.d.cts +0 -20
- package/dist/resources-BKlFxjo8.d.cts +0 -56
- package/dist/resources-CYis1_DS.d.ts +0 -56
- package/dist/routeAmount-DdbJYJyM.d.cts +0 -55
- package/dist/routeAmount-DdbJYJyM.d.ts +0 -55
- package/dist/types.cjs.map +0 -1
- package/dist/types.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,100 +1,134 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_errors = require("./errors.cjs");
|
|
3
|
+
const require_reachability = require("./reachability.cjs");
|
|
4
|
+
const require_authoring_handles = require("./authoring/handles.cjs");
|
|
5
|
+
const require_authoring_raw = require("./authoring/raw.cjs");
|
|
6
|
+
const require_run_inputs = require("./run/inputs.cjs");
|
|
7
|
+
const require_run_simulate = require("./run/simulate.cjs");
|
|
8
|
+
const require_outputs = require("./outputs.cjs");
|
|
9
|
+
const require_sdk = require("./sdk.cjs");
|
|
10
|
+
const require_generated_guards_generated = require("./generated/guards.generated.cjs");
|
|
11
|
+
const require_generated_materialisers_generated = require("./generated/materialisers.generated.cjs");
|
|
12
|
+
const require_generated_preconditions_generated = require("./generated/preconditions.generated.cjs");
|
|
13
|
+
const require_raw = require("./raw.cjs");
|
|
14
|
+
const require_resources = require("./resources.cjs");
|
|
15
|
+
const require_routeAmount = require("./routeAmount.cjs");
|
|
16
|
+
let _lifi_compose_spec = require("@lifi/compose-spec");
|
|
17
|
+
//#region src/index.ts
|
|
18
|
+
/**
|
|
19
|
+
* Guard factories for protecting operation outputs (e.g. slippage tolerance).
|
|
20
|
+
* Pass guards to an operation's `guards` array.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* builder.lifi.swap('swap1', {
|
|
25
|
+
* bind: { amountIn: builder.inputs.token },
|
|
26
|
+
* config: { resourceOut: resources.native(1) },
|
|
27
|
+
* guards: [guards.slippage({ port: 'amountOut', bps: 300 })],
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
const guards = require_generated_guards_generated.guards_generated_exports;
|
|
32
|
+
/**
|
|
33
|
+
* Materialiser factories that tell the runtime how to resolve token input
|
|
34
|
+
* amounts on-chain (e.g. read a wallet balance, accept a direct deposit).
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* await builder.compile({
|
|
39
|
+
* inputs: { token: materialisers.balanceOf({}) },
|
|
40
|
+
* signer: '0x...',
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
const materialisers = require_generated_materialisers_generated.materialisers_generated_exports;
|
|
45
|
+
/**
|
|
46
|
+
* Precondition factories for asserting on-chain state before a flow executes
|
|
47
|
+
* (e.g. minimum token balances, ERC-20 allowances).
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* await builder.compile({
|
|
52
|
+
* inputs: { token: materialisers.balanceOf({}) },
|
|
53
|
+
* preconditions: [
|
|
54
|
+
* preconditions.erc20Balance({ wallet: '0x...', token: '0x...', balance: 1000n }),
|
|
55
|
+
* ],
|
|
56
|
+
* signer: '0x...',
|
|
57
|
+
* });
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
const preconditions = require_generated_preconditions_generated.preconditions_generated_exports;
|
|
61
|
+
/**
|
|
62
|
+
* Resource declaration helpers for defining token inputs in a flow schema.
|
|
63
|
+
* Use {@link resources.erc20} for ERC-20 tokens and {@link resources.native}
|
|
64
|
+
* for the chain's native coin (ETH, MATIC, etc.).
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* const builder = sdk.flow(1, {
|
|
69
|
+
* inputs: {
|
|
70
|
+
* usdc: resources.erc20('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', 1),
|
|
71
|
+
* eth: resources.native(1),
|
|
72
|
+
* },
|
|
73
|
+
* });
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
const resources = require_resources.resources_exports;
|
|
77
|
+
/**
|
|
78
|
+
* Amount constructors for {@link ComposeSdk.route}. Use
|
|
79
|
+
* {@link routeAmount.exact} to spend a fixed amount of the `fromToken`, and
|
|
80
|
+
* {@link routeAmount.all} to spend the signer's whole balance.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* // USDC into the Aave v3 aEthUSDC position — one routing-catalog edge.
|
|
85
|
+
* const result = await sdk.route({
|
|
86
|
+
* chainId: 1,
|
|
87
|
+
* fromToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
88
|
+
* toToken: '0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c',
|
|
89
|
+
* amount: routeAmount.exact(1_000_000n),
|
|
90
|
+
* signer: '0xYourAddress...',
|
|
91
|
+
* });
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
const routeAmount = require_routeAmount.routeAmount_exports;
|
|
95
|
+
/**
|
|
96
|
+
* Low-level escape hatch for constructing flow nodes, guards, and materialiser
|
|
97
|
+
* inputs without the typed builder API. Prefer the generated operation methods
|
|
98
|
+
* on {@link FlowBuilder} and the typed `guards`/`materialisers` namespaces
|
|
99
|
+
* for most use cases.
|
|
100
|
+
*/
|
|
101
|
+
const raw = require_raw.raw_exports;
|
|
102
|
+
//#endregion
|
|
103
|
+
Object.defineProperty(exports, "SIMULATE_MAX_REQUIREMENTS", {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
get: function() {
|
|
106
|
+
return _lifi_compose_spec.SIMULATE_MAX_REQUIREMENTS;
|
|
107
|
+
}
|
|
52
108
|
});
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
var import_raw = require("./authoring/raw.js");
|
|
59
|
-
var import_inputs = require("./run/inputs.js");
|
|
60
|
-
var import_simulate = require("./run/simulate.js");
|
|
61
|
-
var import_outputs = require("./outputs.js");
|
|
62
|
-
var import_sdk = require("./sdk.js");
|
|
63
|
-
var guardsMod = __toESM(require("./generated/guards.generated.js"), 1);
|
|
64
|
-
var materialisersMod = __toESM(require("./generated/materialisers.generated.js"), 1);
|
|
65
|
-
var preconditionsMod = __toESM(require("./generated/preconditions.generated.js"), 1);
|
|
66
|
-
var rawMod = __toESM(require("./raw.js"), 1);
|
|
67
|
-
var resourcesMod = __toESM(require("./resources.js"), 1);
|
|
68
|
-
var routeAmountMod = __toESM(require("./routeAmount.js"), 1);
|
|
69
|
-
__reExport(index_exports, require("./generated/config.generated.js"), module.exports);
|
|
70
|
-
const guards = guardsMod;
|
|
71
|
-
const materialisers = materialisersMod;
|
|
72
|
-
const preconditions = preconditionsMod;
|
|
73
|
-
const resources = resourcesMod;
|
|
74
|
-
const routeAmount = routeAmountMod;
|
|
75
|
-
const raw = rawMod;
|
|
76
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
77
|
-
0 && (module.exports = {
|
|
78
|
-
SIMULATE_MAX_REQUIREMENTS,
|
|
79
|
-
SIMULATE_MAX_TRACKED_BALANCES,
|
|
80
|
-
buildReachability,
|
|
81
|
-
buildSimulateRequest,
|
|
82
|
-
createComposeSdk,
|
|
83
|
-
guards,
|
|
84
|
-
isComposeError,
|
|
85
|
-
isComposePreparationError,
|
|
86
|
-
isComposeSdkOutdatedError,
|
|
87
|
-
isComposeServerOutdatedError,
|
|
88
|
-
isInputHandle,
|
|
89
|
-
isOutputHandle,
|
|
90
|
-
materialiser,
|
|
91
|
-
materialisers,
|
|
92
|
-
preconditions,
|
|
93
|
-
raw,
|
|
94
|
-
ref,
|
|
95
|
-
resources,
|
|
96
|
-
routeAmount,
|
|
97
|
-
terminalOutputs,
|
|
98
|
-
...require("./generated/config.generated.js")
|
|
109
|
+
Object.defineProperty(exports, "SIMULATE_MAX_TRACKED_BALANCES", {
|
|
110
|
+
enumerable: true,
|
|
111
|
+
get: function() {
|
|
112
|
+
return _lifi_compose_spec.SIMULATE_MAX_TRACKED_BALANCES;
|
|
113
|
+
}
|
|
99
114
|
});
|
|
115
|
+
exports.buildReachability = require_reachability.buildReachability;
|
|
116
|
+
exports.buildSimulateRequest = require_run_simulate.buildSimulateRequest;
|
|
117
|
+
exports.createComposeSdk = require_sdk.createComposeSdk;
|
|
118
|
+
exports.guards = guards;
|
|
119
|
+
exports.isComposeError = require_errors.isComposeError;
|
|
120
|
+
exports.isComposePreparationError = require_errors.isComposePreparationError;
|
|
121
|
+
exports.isComposeSdkOutdatedError = require_errors.isComposeSdkOutdatedError;
|
|
122
|
+
exports.isComposeServerOutdatedError = require_errors.isComposeServerOutdatedError;
|
|
123
|
+
exports.isInputHandle = require_authoring_handles.isInputHandle;
|
|
124
|
+
exports.isOutputHandle = require_authoring_handles.isOutputHandle;
|
|
125
|
+
exports.materialiser = require_run_inputs.materialiser;
|
|
126
|
+
exports.materialisers = materialisers;
|
|
127
|
+
exports.preconditions = preconditions;
|
|
128
|
+
exports.raw = raw;
|
|
129
|
+
exports.ref = require_authoring_raw.ref;
|
|
130
|
+
exports.resources = resources;
|
|
131
|
+
exports.routeAmount = routeAmount;
|
|
132
|
+
exports.terminalOutputs = require_outputs.terminalOutputs;
|
|
133
|
+
|
|
100
134
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.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 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 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 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 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 SettlementWire,\n SettlementEscrowWire,\n} from '@lifi/compose-spec';\nexport {\n SIMULATE_MAX_TRACKED_BALANCES,\n SIMULATE_MAX_REQUIREMENTS,\n} from '@lifi/compose-spec';\nexport {\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":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["guardsMod","materialisersMod","preconditionsMod","resourcesMod","routeAmountMod","rawMod"],"sources":["../src/index.ts"],"sourcesContent":["/**\n * `@lifi/composer-sdk` — TypeScript SDK for building and compiling\n * Compose flows into executable EVM calldata.\n *\n * Start by creating an SDK instance with {@link createComposeSdk}, then use\n * {@link ComposeSdk.flow} to build flows and compile them.\n *\n * @packageDocumentation\n */\n\nexport type {\n AbiTypeToOutputKind,\n Address,\n InputDecl,\n InputSchema,\n InputSpecOf,\n IntegerString,\n IntegerStringInput,\n OutputKind,\n TypedGuard,\n TypedRef,\n TypedLiteral,\n} from './types.js';\n\nexport type {\n ChainSummary,\n GetZapPacksOptions,\n ZapPackEdge,\n ZapPackOverview,\n} from './discovery.js';\nexport type {\n Reachability,\n ReachabilityOptions,\n RoutablePair,\n TokenRef,\n} from './reachability.js';\nexport { buildReachability } from './reachability.js';\nexport type {\n ComposeError,\n ComposeErrorCode,\n ComposeSdkOutdated,\n ComposeServerOutdated,\n ComposePreparationOps,\n} from './errors.js';\nexport type {\n AppliedGuard,\n ApprovalEntry,\n Call,\n ComposeCompilePartialData,\n ComposeAction,\n ComposeFill,\n 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 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 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 SettlementWire,\n SettlementEscrowWire,\n} from '@lifi/compose-spec';\nexport {\n SIMULATE_MAX_TRACKED_BALANCES,\n SIMULATE_MAX_REQUIREMENTS,\n} from '@lifi/compose-spec';\nexport {\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoKA,MAAa,SAA2BA,mCAAAA;;;;;;;;;;;;;AAaxC,MAAa,gBAAyCC,0CAAAA;;;;;;;;;;;;;;;;AAgBtD,MAAa,gBAAyCC,0CAAAA;;;;;;;;;;;;;;;;AAgBtD,MAAa,YAAiCC,kBAAAA;;;;;;;;;;;;;;;;;;AAkB9C,MAAa,cAAqCC,oBAAAA;;;;;;;AASlD,MAAa,MAAqBC,YAAAA"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,37 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
import './generated/operations.generated.cjs';
|
|
22
|
-
import './authoring/signatureArgs.cjs';
|
|
23
|
-
import 'abitype';
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* `@lifi/composer-sdk` — TypeScript SDK for building and compiling
|
|
27
|
-
* Compose flows into executable EVM calldata.
|
|
28
|
-
*
|
|
29
|
-
* Start by creating an SDK instance with {@link createComposeSdk}, then use
|
|
30
|
-
* {@link ComposeSdk.flow} to build flows and compile them.
|
|
31
|
-
*
|
|
32
|
-
* @packageDocumentation
|
|
33
|
-
*/
|
|
34
|
-
|
|
1
|
+
import { AbiTypeToOutputKind, Address, InputDecl, InputSchema, InputSpecOf, IntegerString, IntegerStringInput, OutputKind, TypedGuard, TypedLiteral, TypedRef } from "./types.cjs";
|
|
2
|
+
import { AnyHandle, AnyRefBindable, Bindable, FamilyCount, FamilySource, InputHandle, OutputFamilyHandles, OutputHandle, RefBindable, ResourceInputHandle, isInputHandle, isOutputHandle } from "./authoring/handles.cjs";
|
|
3
|
+
import { AnyBindable, FlowOptions, TypedFlow } from "./authoring/FlowBuilderCore.cjs";
|
|
4
|
+
import { ref } from "./authoring/raw.cjs";
|
|
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";
|
|
8
|
+
import { guards_generated_d_exports } from "./generated/guards.generated.cjs";
|
|
9
|
+
import { materialisers_generated_d_exports } from "./generated/materialisers.generated.cjs";
|
|
10
|
+
import { preconditions_generated_d_exports } from "./generated/preconditions.generated.cjs";
|
|
11
|
+
import { Reachability, ReachabilityOptions, RoutablePair, TokenRef, buildReachability } from "./reachability.cjs";
|
|
12
|
+
import { ComposeRunInput, materialiser } from "./run/inputs.cjs";
|
|
13
|
+
import { BuildSimulateRequestInput, buildSimulateRequest } from "./run/simulate.cjs";
|
|
14
|
+
import { terminalOutputs } from "./outputs.cjs";
|
|
15
|
+
import { ComposeSdk, ComposeSdkOptions, FlowBuilder, createComposeSdk } from "./sdk.cjs";
|
|
16
|
+
import { raw_d_exports } from "./raw.cjs";
|
|
17
|
+
import { resources_d_exports } from "./resources.cjs";
|
|
18
|
+
import { routeAmount_d_exports } from "./routeAmount.cjs";
|
|
19
|
+
import { Amount, AppliedGuard, ApprovalEntry, Call, ComposeAction, ComposeCompilePartialData, ComposeCompileRequest, ComposeCompileResult, ComposeCompileSuccessData, ComposeErrorKind, ComposeFee, ComposeFill, ComposeRouteRequest, ComposeTransactionRequest, ComposeUserProgramSimulation, ConsumedOutput, ContinuationIntent, ContinuationOutcome, Delivery, Erc20AllowanceRequirement, Erc20BalanceRequirement, Estimate, EstimateBasis, FailedPreparedOp, Flow, InputSpec, MaterialiserConfigOf, MaterialiserInput, Minimum, MinimumBasis, NativeBalanceRequirement, Output, OutputAmount, Outputs, Precondition, PreconditionConfigOf, PriceImpact, Ref, Resource, RouteAmount, RouteAmountAll, RouteAmountExact, SIMULATE_MAX_REQUIREMENTS, SIMULATE_MAX_TRACKED_BALANCES, SettlementEscrowWire, SettlementWire, SimulateBalanceEntry, SimulateOkResult, SimulateRequest, SimulateResult, SimulateRevertDecodeResult, SimulateRevertResult, SimulateSetupErrorResult, SimulationPolicy, SimulationRevert, SlotFinderRequirement, SolType, SweepTo, TerminalOutput, TrackedBalance } from "@lifi/compose-spec";
|
|
20
|
+
//#region src/index.d.ts
|
|
35
21
|
/**
|
|
36
22
|
* Guard factories for protecting operation outputs (e.g. slippage tolerance).
|
|
37
23
|
* Pass guards to an operation's `guards` array.
|
|
@@ -45,7 +31,7 @@ import 'abitype';
|
|
|
45
31
|
* });
|
|
46
32
|
* ```
|
|
47
33
|
*/
|
|
48
|
-
declare const guards: typeof
|
|
34
|
+
export declare const guards: typeof guards_generated_d_exports;
|
|
49
35
|
/**
|
|
50
36
|
* Materialiser factories that tell the runtime how to resolve token input
|
|
51
37
|
* amounts on-chain (e.g. read a wallet balance, accept a direct deposit).
|
|
@@ -58,7 +44,7 @@ declare const guards: typeof guardsMod;
|
|
|
58
44
|
* });
|
|
59
45
|
* ```
|
|
60
46
|
*/
|
|
61
|
-
declare const materialisers: typeof
|
|
47
|
+
export declare const materialisers: typeof materialisers_generated_d_exports;
|
|
62
48
|
/**
|
|
63
49
|
* Precondition factories for asserting on-chain state before a flow executes
|
|
64
50
|
* (e.g. minimum token balances, ERC-20 allowances).
|
|
@@ -74,7 +60,7 @@ declare const materialisers: typeof materialisersMod;
|
|
|
74
60
|
* });
|
|
75
61
|
* ```
|
|
76
62
|
*/
|
|
77
|
-
declare const preconditions: typeof
|
|
63
|
+
export declare const preconditions: typeof preconditions_generated_d_exports;
|
|
78
64
|
/**
|
|
79
65
|
* Resource declaration helpers for defining token inputs in a flow schema.
|
|
80
66
|
* Use {@link resources.erc20} for ERC-20 tokens and {@link resources.native}
|
|
@@ -90,7 +76,7 @@ declare const preconditions: typeof preconditionsMod;
|
|
|
90
76
|
* });
|
|
91
77
|
* ```
|
|
92
78
|
*/
|
|
93
|
-
declare const resources: typeof
|
|
79
|
+
export declare const resources: typeof resources_d_exports;
|
|
94
80
|
/**
|
|
95
81
|
* Amount constructors for {@link ComposeSdk.route}. Use
|
|
96
82
|
* {@link routeAmount.exact} to spend a fixed amount of the `fromToken`, and
|
|
@@ -108,14 +94,14 @@ declare const resources: typeof resourcesMod;
|
|
|
108
94
|
* });
|
|
109
95
|
* ```
|
|
110
96
|
*/
|
|
111
|
-
declare const routeAmount: typeof
|
|
112
|
-
|
|
97
|
+
export declare const routeAmount: typeof routeAmount_d_exports;
|
|
113
98
|
/**
|
|
114
99
|
* Low-level escape hatch for constructing flow nodes, guards, and materialiser
|
|
115
100
|
* inputs without the typed builder API. Prefer the generated operation methods
|
|
116
101
|
* on {@link FlowBuilder} and the typed `guards`/`materialisers` namespaces
|
|
117
102
|
* for most use cases.
|
|
118
103
|
*/
|
|
119
|
-
declare const raw: typeof
|
|
120
|
-
|
|
121
|
-
export {
|
|
104
|
+
export declare const raw: typeof raw_d_exports;
|
|
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 ComposeFee, type ComposeFill, type ComposePreparationOps, type ComposeRouteRequest, type ComposeRunInput, type ComposeSdk, type ComposeSdkOptions, type ComposeSdkOutdated, type ComposeServerOutdated, type ComposeTransactionRequest, type ComposeUserProgramSimulation, type ConsumedOutput, type ContinuationIntent, type ContinuationOutcome, CoreApproveConfig, CoreAsResourceConfig, CoreBalanceOfConfig, CoreBpsDownConfig, CoreBpsUpConfig, CoreCallConfig, CoreEmitEvent1Config, CoreEmitEvent2Config, CoreEmitEvent3Config, CoreEmitEvent4Config, CoreInvokeConfig, CoreNumericInvariantGuardConfig, CorePartitionConfig, CorePeekConfig, CoreRawCallConfig, CoreSplitAtConfig, CoreSplitConfig, CoreStaticCallConfig, CoreTransferConfig, type Delivery, 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 GetZapPacksOptions, type InputDecl, type InputHandle, type InputSchema, type InputSpec, type InputSpecOf, type IntegerString, type IntegerStringInput, InvariantEqConfig, InvariantGtConfig, InvariantGteConfig, InvariantLtConfig, InvariantLteConfig, InvariantNeqConfig, InvariantNumericConfig, InvariantNumericInRangeConfig, LifiBridgeConfig, LifiFlashloanRepayConfig, 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 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 SweepTo, 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, isComposeError, isComposePreparationError, isComposeSdkOutdatedError, isComposeServerOutdatedError, isInputHandle, isOutputHandle, materialiser, ref, terminalOutputs };
|
|
107
|
+
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,37 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
import './generated/operations.generated.js';
|
|
22
|
-
import './authoring/signatureArgs.js';
|
|
23
|
-
import 'abitype';
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* `@lifi/composer-sdk` — TypeScript SDK for building and compiling
|
|
27
|
-
* Compose flows into executable EVM calldata.
|
|
28
|
-
*
|
|
29
|
-
* Start by creating an SDK instance with {@link createComposeSdk}, then use
|
|
30
|
-
* {@link ComposeSdk.flow} to build flows and compile them.
|
|
31
|
-
*
|
|
32
|
-
* @packageDocumentation
|
|
33
|
-
*/
|
|
34
|
-
|
|
1
|
+
import { AbiTypeToOutputKind, Address, InputDecl, InputSchema, InputSpecOf, IntegerString, IntegerStringInput, OutputKind, TypedGuard, TypedLiteral, TypedRef } from "./types.js";
|
|
2
|
+
import { AnyHandle, AnyRefBindable, Bindable, FamilyCount, FamilySource, InputHandle, OutputFamilyHandles, OutputHandle, RefBindable, ResourceInputHandle, isInputHandle, isOutputHandle } from "./authoring/handles.js";
|
|
3
|
+
import { AnyBindable, FlowOptions, TypedFlow } from "./authoring/FlowBuilderCore.js";
|
|
4
|
+
import { ref } from "./authoring/raw.js";
|
|
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";
|
|
8
|
+
import { guards_generated_d_exports } from "./generated/guards.generated.js";
|
|
9
|
+
import { materialisers_generated_d_exports } from "./generated/materialisers.generated.js";
|
|
10
|
+
import { preconditions_generated_d_exports } from "./generated/preconditions.generated.js";
|
|
11
|
+
import { Reachability, ReachabilityOptions, RoutablePair, TokenRef, buildReachability } from "./reachability.js";
|
|
12
|
+
import { ComposeRunInput, materialiser } from "./run/inputs.js";
|
|
13
|
+
import { BuildSimulateRequestInput, buildSimulateRequest } from "./run/simulate.js";
|
|
14
|
+
import { terminalOutputs } from "./outputs.js";
|
|
15
|
+
import { ComposeSdk, ComposeSdkOptions, FlowBuilder, createComposeSdk } from "./sdk.js";
|
|
16
|
+
import { raw_d_exports } from "./raw.js";
|
|
17
|
+
import { resources_d_exports } from "./resources.js";
|
|
18
|
+
import { routeAmount_d_exports } from "./routeAmount.js";
|
|
19
|
+
import { Amount, AppliedGuard, ApprovalEntry, Call, ComposeAction, ComposeCompilePartialData, ComposeCompileRequest, ComposeCompileResult, ComposeCompileSuccessData, ComposeErrorKind, ComposeFee, ComposeFill, ComposeRouteRequest, ComposeTransactionRequest, ComposeUserProgramSimulation, ConsumedOutput, ContinuationIntent, ContinuationOutcome, Delivery, Erc20AllowanceRequirement, Erc20BalanceRequirement, Estimate, EstimateBasis, FailedPreparedOp, Flow, InputSpec, MaterialiserConfigOf, MaterialiserInput, Minimum, MinimumBasis, NativeBalanceRequirement, Output, OutputAmount, Outputs, Precondition, PreconditionConfigOf, PriceImpact, Ref, Resource, RouteAmount, RouteAmountAll, RouteAmountExact, SIMULATE_MAX_REQUIREMENTS, SIMULATE_MAX_TRACKED_BALANCES, SettlementEscrowWire, SettlementWire, SimulateBalanceEntry, SimulateOkResult, SimulateRequest, SimulateResult, SimulateRevertDecodeResult, SimulateRevertResult, SimulateSetupErrorResult, SimulationPolicy, SimulationRevert, SlotFinderRequirement, SolType, SweepTo, TerminalOutput, TrackedBalance } from "@lifi/compose-spec";
|
|
20
|
+
//#region src/index.d.ts
|
|
35
21
|
/**
|
|
36
22
|
* Guard factories for protecting operation outputs (e.g. slippage tolerance).
|
|
37
23
|
* Pass guards to an operation's `guards` array.
|
|
@@ -45,7 +31,7 @@ import 'abitype';
|
|
|
45
31
|
* });
|
|
46
32
|
* ```
|
|
47
33
|
*/
|
|
48
|
-
declare const guards: typeof
|
|
34
|
+
export declare const guards: typeof guards_generated_d_exports;
|
|
49
35
|
/**
|
|
50
36
|
* Materialiser factories that tell the runtime how to resolve token input
|
|
51
37
|
* amounts on-chain (e.g. read a wallet balance, accept a direct deposit).
|
|
@@ -58,7 +44,7 @@ declare const guards: typeof guardsMod;
|
|
|
58
44
|
* });
|
|
59
45
|
* ```
|
|
60
46
|
*/
|
|
61
|
-
declare const materialisers: typeof
|
|
47
|
+
export declare const materialisers: typeof materialisers_generated_d_exports;
|
|
62
48
|
/**
|
|
63
49
|
* Precondition factories for asserting on-chain state before a flow executes
|
|
64
50
|
* (e.g. minimum token balances, ERC-20 allowances).
|
|
@@ -74,7 +60,7 @@ declare const materialisers: typeof materialisersMod;
|
|
|
74
60
|
* });
|
|
75
61
|
* ```
|
|
76
62
|
*/
|
|
77
|
-
declare const preconditions: typeof
|
|
63
|
+
export declare const preconditions: typeof preconditions_generated_d_exports;
|
|
78
64
|
/**
|
|
79
65
|
* Resource declaration helpers for defining token inputs in a flow schema.
|
|
80
66
|
* Use {@link resources.erc20} for ERC-20 tokens and {@link resources.native}
|
|
@@ -90,7 +76,7 @@ declare const preconditions: typeof preconditionsMod;
|
|
|
90
76
|
* });
|
|
91
77
|
* ```
|
|
92
78
|
*/
|
|
93
|
-
declare const resources: typeof
|
|
79
|
+
export declare const resources: typeof resources_d_exports;
|
|
94
80
|
/**
|
|
95
81
|
* Amount constructors for {@link ComposeSdk.route}. Use
|
|
96
82
|
* {@link routeAmount.exact} to spend a fixed amount of the `fromToken`, and
|
|
@@ -108,14 +94,14 @@ declare const resources: typeof resourcesMod;
|
|
|
108
94
|
* });
|
|
109
95
|
* ```
|
|
110
96
|
*/
|
|
111
|
-
declare const routeAmount: typeof
|
|
112
|
-
|
|
97
|
+
export declare const routeAmount: typeof routeAmount_d_exports;
|
|
113
98
|
/**
|
|
114
99
|
* Low-level escape hatch for constructing flow nodes, guards, and materialiser
|
|
115
100
|
* inputs without the typed builder API. Prefer the generated operation methods
|
|
116
101
|
* on {@link FlowBuilder} and the typed `guards`/`materialisers` namespaces
|
|
117
102
|
* for most use cases.
|
|
118
103
|
*/
|
|
119
|
-
declare const raw: typeof
|
|
120
|
-
|
|
121
|
-
export {
|
|
104
|
+
export declare const raw: typeof raw_d_exports;
|
|
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 ComposeFee, type ComposeFill, type ComposePreparationOps, type ComposeRouteRequest, type ComposeRunInput, type ComposeSdk, type ComposeSdkOptions, type ComposeSdkOutdated, type ComposeServerOutdated, type ComposeTransactionRequest, type ComposeUserProgramSimulation, type ConsumedOutput, type ContinuationIntent, type ContinuationOutcome, CoreApproveConfig, CoreAsResourceConfig, CoreBalanceOfConfig, CoreBpsDownConfig, CoreBpsUpConfig, CoreCallConfig, CoreEmitEvent1Config, CoreEmitEvent2Config, CoreEmitEvent3Config, CoreEmitEvent4Config, CoreInvokeConfig, CoreNumericInvariantGuardConfig, CorePartitionConfig, CorePeekConfig, CoreRawCallConfig, CoreSplitAtConfig, CoreSplitConfig, CoreStaticCallConfig, CoreTransferConfig, type Delivery, 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 GetZapPacksOptions, type InputDecl, type InputHandle, type InputSchema, type InputSpec, type InputSpecOf, type IntegerString, type IntegerStringInput, InvariantEqConfig, InvariantGtConfig, InvariantGteConfig, InvariantLtConfig, InvariantLteConfig, InvariantNeqConfig, InvariantNumericConfig, InvariantNumericInRangeConfig, LifiBridgeConfig, LifiFlashloanRepayConfig, 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 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 SweepTo, 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, isComposeError, isComposePreparationError, isComposeSdkOutdatedError, isComposeServerOutdatedError, isInputHandle, isOutputHandle, materialiser, ref, terminalOutputs };
|
|
107
|
+
//# sourceMappingURL=index.d.ts.map
|