@lifi/composer-sdk 0.0.1-alpha

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.
Files changed (160) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +220 -0
  3. package/dist/authoring/FlowBuilderCore.cjs +115 -0
  4. package/dist/authoring/FlowBuilderCore.cjs.map +1 -0
  5. package/dist/authoring/FlowBuilderCore.d.cts +114 -0
  6. package/dist/authoring/FlowBuilderCore.d.ts +114 -0
  7. package/dist/authoring/FlowBuilderCore.js +91 -0
  8. package/dist/authoring/FlowBuilderCore.js.map +1 -0
  9. package/dist/authoring/handles.cjs +43 -0
  10. package/dist/authoring/handles.cjs.map +1 -0
  11. package/dist/authoring/handles.d.cts +61 -0
  12. package/dist/authoring/handles.d.ts +61 -0
  13. package/dist/authoring/handles.js +17 -0
  14. package/dist/authoring/handles.js.map +1 -0
  15. package/dist/authoring/raw.cjs +41 -0
  16. package/dist/authoring/raw.cjs.map +1 -0
  17. package/dist/authoring/raw.d.cts +47 -0
  18. package/dist/authoring/raw.d.ts +47 -0
  19. package/dist/authoring/raw.js +16 -0
  20. package/dist/authoring/raw.js.map +1 -0
  21. package/dist/authoring/signatureArgs.cjs +114 -0
  22. package/dist/authoring/signatureArgs.cjs.map +1 -0
  23. package/dist/authoring/signatureArgs.d.cts +146 -0
  24. package/dist/authoring/signatureArgs.d.ts +146 -0
  25. package/dist/authoring/signatureArgs.js +87 -0
  26. package/dist/authoring/signatureArgs.js.map +1 -0
  27. package/dist/client.cjs +140 -0
  28. package/dist/client.cjs.map +1 -0
  29. package/dist/client.d.cts +67 -0
  30. package/dist/client.d.ts +67 -0
  31. package/dist/client.js +116 -0
  32. package/dist/client.js.map +1 -0
  33. package/dist/discovery.cjs +17 -0
  34. package/dist/discovery.cjs.map +1 -0
  35. package/dist/discovery.d.cts +56 -0
  36. package/dist/discovery.d.ts +56 -0
  37. package/dist/discovery.js +1 -0
  38. package/dist/discovery.js.map +1 -0
  39. package/dist/errors.cjs +91 -0
  40. package/dist/errors.cjs.map +1 -0
  41. package/dist/errors.d.cts +77 -0
  42. package/dist/errors.d.ts +77 -0
  43. package/dist/errors.js +65 -0
  44. package/dist/errors.js.map +1 -0
  45. package/dist/generated/config.generated.cjs +17 -0
  46. package/dist/generated/config.generated.cjs.map +1 -0
  47. package/dist/generated/config.generated.d.cts +144 -0
  48. package/dist/generated/config.generated.d.ts +144 -0
  49. package/dist/generated/config.generated.js +1 -0
  50. package/dist/generated/config.generated.js.map +1 -0
  51. package/dist/generated/guards.generated.cjs +32 -0
  52. package/dist/generated/guards.generated.cjs.map +1 -0
  53. package/dist/generated/guards.generated.d.cts +4 -0
  54. package/dist/generated/guards.generated.d.ts +4 -0
  55. package/dist/generated/guards.generated.js +8 -0
  56. package/dist/generated/guards.generated.js.map +1 -0
  57. package/dist/generated/materialisers.generated.cjs +44 -0
  58. package/dist/generated/materialisers.generated.cjs.map +1 -0
  59. package/dist/generated/materialisers.generated.d.cts +4 -0
  60. package/dist/generated/materialisers.generated.d.ts +4 -0
  61. package/dist/generated/materialisers.generated.js +18 -0
  62. package/dist/generated/materialisers.generated.js.map +1 -0
  63. package/dist/generated/operations.generated.cjs +110 -0
  64. package/dist/generated/operations.generated.cjs.map +1 -0
  65. package/dist/generated/operations.generated.d.cts +337 -0
  66. package/dist/generated/operations.generated.d.ts +337 -0
  67. package/dist/generated/operations.generated.js +89 -0
  68. package/dist/generated/operations.generated.js.map +1 -0
  69. package/dist/generated/preconditions.generated.cjs +44 -0
  70. package/dist/generated/preconditions.generated.cjs.map +1 -0
  71. package/dist/generated/preconditions.generated.d.cts +4 -0
  72. package/dist/generated/preconditions.generated.d.ts +4 -0
  73. package/dist/generated/preconditions.generated.js +18 -0
  74. package/dist/generated/preconditions.generated.js.map +1 -0
  75. package/dist/guards.generated-DKKDKREA.d.ts +14 -0
  76. package/dist/guards.generated-hrQ1KPNv.d.cts +14 -0
  77. package/dist/index.cjs +76 -0
  78. package/dist/index.cjs.map +1 -0
  79. package/dist/index.d.cts +99 -0
  80. package/dist/index.d.ts +99 -0
  81. package/dist/index.js +30 -0
  82. package/dist/index.js.map +1 -0
  83. package/dist/materialisers.generated-BsA1uDW8.d.ts +24 -0
  84. package/dist/materialisers.generated-nMxTAaVi.d.cts +24 -0
  85. package/dist/preconditions.generated-DblS13Wq.d.cts +24 -0
  86. package/dist/preconditions.generated-U7YpVh30.d.ts +24 -0
  87. package/dist/raw-Dj_2rBSQ.d.cts +19 -0
  88. package/dist/raw-IxCF_bSS.d.ts +19 -0
  89. package/dist/raw.cjs +34 -0
  90. package/dist/raw.cjs.map +1 -0
  91. package/dist/raw.d.cts +4 -0
  92. package/dist/raw.d.ts +4 -0
  93. package/dist/raw.js +8 -0
  94. package/dist/raw.js.map +1 -0
  95. package/dist/resources-BKlFxjo8.d.cts +56 -0
  96. package/dist/resources-CYis1_DS.d.ts +56 -0
  97. package/dist/resources.cjs +39 -0
  98. package/dist/resources.cjs.map +1 -0
  99. package/dist/resources.d.cts +3 -0
  100. package/dist/resources.d.ts +3 -0
  101. package/dist/resources.js +14 -0
  102. package/dist/resources.js.map +1 -0
  103. package/dist/run/inputs.cjs +51 -0
  104. package/dist/run/inputs.cjs.map +1 -0
  105. package/dist/run/inputs.d.cts +91 -0
  106. package/dist/run/inputs.d.ts +91 -0
  107. package/dist/run/inputs.js +26 -0
  108. package/dist/run/inputs.js.map +1 -0
  109. package/dist/sdk.cjs +60 -0
  110. package/dist/sdk.cjs.map +1 -0
  111. package/dist/sdk.d.cts +112 -0
  112. package/dist/sdk.d.ts +112 -0
  113. package/dist/sdk.js +40 -0
  114. package/dist/sdk.js.map +1 -0
  115. package/dist/types.cjs +17 -0
  116. package/dist/types.cjs.map +1 -0
  117. package/dist/types.d.cts +74 -0
  118. package/dist/types.d.ts +74 -0
  119. package/dist/types.js +1 -0
  120. package/dist/types.js.map +1 -0
  121. package/package.json +81 -0
  122. package/src/authoring/FlowBuilderCore.ts +270 -0
  123. package/src/authoring/handles.ts +81 -0
  124. package/src/authoring/raw.ts +60 -0
  125. package/src/authoring/signatureArgs.ts +249 -0
  126. package/src/client.ts +230 -0
  127. package/src/discovery.ts +51 -0
  128. package/src/errors.ts +150 -0
  129. package/src/examples/approveAndDeposit.ts +84 -0
  130. package/src/examples/callContract.ts +199 -0
  131. package/src/examples/config.ts +9 -0
  132. package/src/examples/consolidateToEth.ts +94 -0
  133. package/src/examples/consolidateToUsdc.ts +95 -0
  134. package/src/examples/depositFromProxy.ts +87 -0
  135. package/src/examples/dustSweep.ts +66 -0
  136. package/src/examples/lifiSwap.ts +56 -0
  137. package/src/examples/lifiZap.ts +60 -0
  138. package/src/examples/rawCallWithArithmetic.ts +78 -0
  139. package/src/examples/readContractState.ts +77 -0
  140. package/src/examples/run.ts +168 -0
  141. package/src/examples/splitAndZap.ts +73 -0
  142. package/src/examples/splitWithArithmetic.ts +93 -0
  143. package/src/examples/swapAndZap.ts +72 -0
  144. package/src/examples/swapToRecipient.ts +109 -0
  145. package/src/examples/swapWithAllowRevert.ts +119 -0
  146. package/src/examples/swapWithBalanceCheck.ts +73 -0
  147. package/src/examples/swapWithOutputValidation.ts +125 -0
  148. package/src/examples/transferTokens.ts +123 -0
  149. package/src/examples/untypedOpWithTypedRef.ts +77 -0
  150. package/src/generated/config.generated.ts +174 -0
  151. package/src/generated/guards.generated.ts +14 -0
  152. package/src/generated/materialisers.generated.ts +44 -0
  153. package/src/generated/operations.generated.ts +568 -0
  154. package/src/generated/preconditions.generated.ts +43 -0
  155. package/src/index.ts +149 -0
  156. package/src/raw.ts +10 -0
  157. package/src/resources.ts +61 -0
  158. package/src/run/inputs.ts +117 -0
  159. package/src/sdk.ts +173 -0
  160. package/src/types.ts +101 -0
@@ -0,0 +1,24 @@
1
+ import { MaterialiserConfigOf, MaterialiserInput } from '@lifi/compose-spec';
2
+ import { BalanceOfMaterialiserConfig, CallMaterialiserConfig, DirectDepositMaterialiserConfig } from './generated/config.generated.cjs';
3
+
4
+ type BalanceOfMaterialiserInput = MaterialiserConfigOf<BalanceOfMaterialiserConfig>;
5
+ /** Read the on-chain token balance of an address as the input amount — accepts: resource */
6
+ declare const balanceOf: (config: BalanceOfMaterialiserInput) => MaterialiserInput;
7
+ type DirectDepositMaterialiserInput = MaterialiserConfigOf<DirectDepositMaterialiserConfig>;
8
+ /** Deposit tokens into the VM — native via msg.value, ERC-20 via transferFrom — accepts: resource */
9
+ declare const directDeposit: (config: DirectDepositMaterialiserInput) => MaterialiserInput;
10
+ type CallMaterialiserInput = MaterialiserConfigOf<CallMaterialiserConfig>;
11
+ /** Execute an arbitrary contract call and measure the resulting token balance diff — accepts: resource */
12
+ declare const call: (config: CallMaterialiserInput) => MaterialiserInput;
13
+
14
+ type materialisersMod_BalanceOfMaterialiserInput = BalanceOfMaterialiserInput;
15
+ type materialisersMod_CallMaterialiserInput = CallMaterialiserInput;
16
+ type materialisersMod_DirectDepositMaterialiserInput = DirectDepositMaterialiserInput;
17
+ declare const materialisersMod_balanceOf: typeof balanceOf;
18
+ declare const materialisersMod_call: typeof call;
19
+ declare const materialisersMod_directDeposit: typeof directDeposit;
20
+ declare namespace materialisersMod {
21
+ export { type materialisersMod_BalanceOfMaterialiserInput as BalanceOfMaterialiserInput, type materialisersMod_CallMaterialiserInput as CallMaterialiserInput, type materialisersMod_DirectDepositMaterialiserInput as DirectDepositMaterialiserInput, materialisersMod_balanceOf as balanceOf, materialisersMod_call as call, materialisersMod_directDeposit as directDeposit };
22
+ }
23
+
24
+ export { type BalanceOfMaterialiserInput as B, type CallMaterialiserInput as C, type DirectDepositMaterialiserInput as D, balanceOf as b, call as c, directDeposit as d, materialisersMod as m };
@@ -0,0 +1,24 @@
1
+ import { PreconditionConfigOf, Precondition } from '@lifi/compose-spec';
2
+ import { Erc20AllowancePreconditionConfig, Erc20BalancePreconditionConfig, NativeBalancePreconditionConfig } from './generated/config.generated.cjs';
3
+
4
+ type Erc20BalancePreconditionInput = PreconditionConfigOf<Erc20BalancePreconditionConfig>;
5
+ /** Assert that a wallet holds at least a given ERC-20 token balance */
6
+ declare const erc20Balance: (config: Erc20BalancePreconditionInput) => Precondition;
7
+ type NativeBalancePreconditionInput = PreconditionConfigOf<NativeBalancePreconditionConfig>;
8
+ /** Assert that a wallet holds at least a given native coin balance */
9
+ declare const nativeBalance: (config: NativeBalancePreconditionInput) => Precondition;
10
+ type Erc20AllowancePreconditionInput = PreconditionConfigOf<Erc20AllowancePreconditionConfig>;
11
+ /** Assert that an ERC-20 allowance is at least a given amount */
12
+ declare const erc20Allowance: (config: Erc20AllowancePreconditionInput) => Precondition;
13
+
14
+ type preconditionsMod_Erc20AllowancePreconditionInput = Erc20AllowancePreconditionInput;
15
+ type preconditionsMod_Erc20BalancePreconditionInput = Erc20BalancePreconditionInput;
16
+ type preconditionsMod_NativeBalancePreconditionInput = NativeBalancePreconditionInput;
17
+ declare const preconditionsMod_erc20Allowance: typeof erc20Allowance;
18
+ declare const preconditionsMod_erc20Balance: typeof erc20Balance;
19
+ declare const preconditionsMod_nativeBalance: typeof nativeBalance;
20
+ declare namespace preconditionsMod {
21
+ export { type preconditionsMod_Erc20AllowancePreconditionInput as Erc20AllowancePreconditionInput, type preconditionsMod_Erc20BalancePreconditionInput as Erc20BalancePreconditionInput, type preconditionsMod_NativeBalancePreconditionInput as NativeBalancePreconditionInput, preconditionsMod_erc20Allowance as erc20Allowance, preconditionsMod_erc20Balance as erc20Balance, preconditionsMod_nativeBalance as nativeBalance };
22
+ }
23
+
24
+ export { type Erc20AllowancePreconditionInput as E, type NativeBalancePreconditionInput as N, type Erc20BalancePreconditionInput as a, erc20Balance as b, erc20Allowance as e, nativeBalance as n, preconditionsMod as p };
@@ -0,0 +1,24 @@
1
+ import { PreconditionConfigOf, Precondition } from '@lifi/compose-spec';
2
+ import { Erc20AllowancePreconditionConfig, Erc20BalancePreconditionConfig, NativeBalancePreconditionConfig } from './generated/config.generated.js';
3
+
4
+ type Erc20BalancePreconditionInput = PreconditionConfigOf<Erc20BalancePreconditionConfig>;
5
+ /** Assert that a wallet holds at least a given ERC-20 token balance */
6
+ declare const erc20Balance: (config: Erc20BalancePreconditionInput) => Precondition;
7
+ type NativeBalancePreconditionInput = PreconditionConfigOf<NativeBalancePreconditionConfig>;
8
+ /** Assert that a wallet holds at least a given native coin balance */
9
+ declare const nativeBalance: (config: NativeBalancePreconditionInput) => Precondition;
10
+ type Erc20AllowancePreconditionInput = PreconditionConfigOf<Erc20AllowancePreconditionConfig>;
11
+ /** Assert that an ERC-20 allowance is at least a given amount */
12
+ declare const erc20Allowance: (config: Erc20AllowancePreconditionInput) => Precondition;
13
+
14
+ type preconditionsMod_Erc20AllowancePreconditionInput = Erc20AllowancePreconditionInput;
15
+ type preconditionsMod_Erc20BalancePreconditionInput = Erc20BalancePreconditionInput;
16
+ type preconditionsMod_NativeBalancePreconditionInput = NativeBalancePreconditionInput;
17
+ declare const preconditionsMod_erc20Allowance: typeof erc20Allowance;
18
+ declare const preconditionsMod_erc20Balance: typeof erc20Balance;
19
+ declare const preconditionsMod_nativeBalance: typeof nativeBalance;
20
+ declare namespace preconditionsMod {
21
+ export { type preconditionsMod_Erc20AllowancePreconditionInput as Erc20AllowancePreconditionInput, type preconditionsMod_Erc20BalancePreconditionInput as Erc20BalancePreconditionInput, type preconditionsMod_NativeBalancePreconditionInput as NativeBalancePreconditionInput, preconditionsMod_erc20Allowance as erc20Allowance, preconditionsMod_erc20Balance as erc20Balance, preconditionsMod_nativeBalance as nativeBalance };
22
+ }
23
+
24
+ export { type Erc20AllowancePreconditionInput as E, type NativeBalancePreconditionInput as N, type Erc20BalancePreconditionInput as a, erc20Balance as b, erc20Allowance as e, nativeBalance as n, preconditionsMod as p };
@@ -0,0 +1,19 @@
1
+ import { rawGuard, ref } from './authoring/raw.cjs';
2
+ import { materialiser } from './run/inputs.cjs';
3
+
4
+ /**
5
+ * Low-level escape hatch for constructing flow nodes and guards without the
6
+ * typed builder API. Use these when working with operation kinds not covered
7
+ * by the generated methods, or when you need full control over the JSON shape.
8
+ *
9
+ * For most use cases, prefer the generated operation methods on {@link FlowBuilder}
10
+ * (e.g. `builder.lifi.swap(...)`) and the typed guard/materialiser helpers.
11
+ */
12
+
13
+ declare const rawMod_materialiser: typeof materialiser;
14
+ declare const rawMod_ref: typeof ref;
15
+ declare namespace rawMod {
16
+ export { rawGuard as guard, rawMod_materialiser as materialiser, rawMod_ref as ref };
17
+ }
18
+
19
+ export { rawMod as r };
@@ -0,0 +1,19 @@
1
+ import { rawGuard, ref } from './authoring/raw.js';
2
+ import { materialiser } from './run/inputs.js';
3
+
4
+ /**
5
+ * Low-level escape hatch for constructing flow nodes and guards without the
6
+ * typed builder API. Use these when working with operation kinds not covered
7
+ * by the generated methods, or when you need full control over the JSON shape.
8
+ *
9
+ * For most use cases, prefer the generated operation methods on {@link FlowBuilder}
10
+ * (e.g. `builder.lifi.swap(...)`) and the typed guard/materialiser helpers.
11
+ */
12
+
13
+ declare const rawMod_materialiser: typeof materialiser;
14
+ declare const rawMod_ref: typeof ref;
15
+ declare namespace rawMod {
16
+ export { rawGuard as guard, rawMod_materialiser as materialiser, rawMod_ref as ref };
17
+ }
18
+
19
+ export { rawMod as r };
package/dist/raw.cjs ADDED
@@ -0,0 +1,34 @@
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, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[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 raw_exports = {};
20
+ __export(raw_exports, {
21
+ guard: () => import_raw.rawGuard,
22
+ materialiser: () => import_inputs.materialiser,
23
+ ref: () => import_raw.ref
24
+ });
25
+ module.exports = __toCommonJS(raw_exports);
26
+ var import_raw = require("./authoring/raw.js");
27
+ var import_inputs = require("./run/inputs.js");
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ guard,
31
+ materialiser,
32
+ ref
33
+ });
34
+ //# sourceMappingURL=raw.cjs.map
@@ -0,0 +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,iBAAuC;AACvC,oBAA6B;","names":[]}
package/dist/raw.d.cts ADDED
@@ -0,0 +1,4 @@
1
+ export { rawGuard as guard, ref } from './authoring/raw.cjs';
2
+ export { materialiser } from './run/inputs.cjs';
3
+ import '@lifi/compose-spec';
4
+ import './types.cjs';
package/dist/raw.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export { rawGuard as guard, ref } from './authoring/raw.js';
2
+ export { materialiser } from './run/inputs.js';
3
+ import '@lifi/compose-spec';
4
+ import './types.js';
package/dist/raw.js ADDED
@@ -0,0 +1,8 @@
1
+ import { rawGuard, ref } from "./authoring/raw.js";
2
+ import { materialiser } from "./run/inputs.js";
3
+ export {
4
+ rawGuard as guard,
5
+ materialiser,
6
+ ref
7
+ };
8
+ //# sourceMappingURL=raw.js.map
@@ -0,0 +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;AACvC,SAAS,oBAAoB;","names":[]}
@@ -0,0 +1,56 @@
1
+ import { Address } from './types.cjs';
2
+
3
+ /** A resource declaration representing the chain's native token (e.g. ETH, MATIC). */
4
+ interface NativeResource {
5
+ readonly kind: 'native';
6
+ readonly chainId: number;
7
+ }
8
+ /** A resource declaration representing an ERC-20 token at a specific address. */
9
+ interface Erc20Resource {
10
+ readonly kind: 'erc20';
11
+ readonly token: Address;
12
+ readonly chainId: number;
13
+ }
14
+ /** A token resource — either the chain's native token or an ERC-20. */
15
+ type Resource = NativeResource | Erc20Resource;
16
+ /**
17
+ * Creates a native token resource declaration.
18
+ *
19
+ * @param chainId - The EVM chain ID the native token belongs to.
20
+ * @returns A {@link NativeResource} for use in flow input schemas.
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * const builder = sdk.flow(1, {
25
+ * inputs: { eth: native(1) },
26
+ * });
27
+ * ```
28
+ */
29
+ declare const native: (chainId: number) => NativeResource;
30
+ /**
31
+ * Creates an ERC-20 token resource declaration.
32
+ *
33
+ * @param token - The `0x`-prefixed contract address of the ERC-20 token.
34
+ * @param chainId - The EVM chain ID the token is deployed on.
35
+ * @returns An {@link Erc20Resource} for use in flow input schemas.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const USDC = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';
40
+ * const builder = sdk.flow(1, {
41
+ * inputs: { usdc: erc20(USDC, 1) },
42
+ * });
43
+ * ```
44
+ */
45
+ declare const erc20: (token: Address, chainId: number) => Erc20Resource;
46
+
47
+ type resourcesMod_Erc20Resource = Erc20Resource;
48
+ type resourcesMod_NativeResource = NativeResource;
49
+ type resourcesMod_Resource = Resource;
50
+ declare const resourcesMod_erc20: typeof erc20;
51
+ declare const resourcesMod_native: typeof native;
52
+ declare namespace resourcesMod {
53
+ export { type resourcesMod_Erc20Resource as Erc20Resource, type resourcesMod_NativeResource as NativeResource, type resourcesMod_Resource as Resource, resourcesMod_erc20 as erc20, resourcesMod_native as native };
54
+ }
55
+
56
+ export { type Erc20Resource as E, type NativeResource as N, type Resource as R, erc20 as e, native as n, resourcesMod as r };
@@ -0,0 +1,56 @@
1
+ import { Address } from './types.js';
2
+
3
+ /** A resource declaration representing the chain's native token (e.g. ETH, MATIC). */
4
+ interface NativeResource {
5
+ readonly kind: 'native';
6
+ readonly chainId: number;
7
+ }
8
+ /** A resource declaration representing an ERC-20 token at a specific address. */
9
+ interface Erc20Resource {
10
+ readonly kind: 'erc20';
11
+ readonly token: Address;
12
+ readonly chainId: number;
13
+ }
14
+ /** A token resource — either the chain's native token or an ERC-20. */
15
+ type Resource = NativeResource | Erc20Resource;
16
+ /**
17
+ * Creates a native token resource declaration.
18
+ *
19
+ * @param chainId - The EVM chain ID the native token belongs to.
20
+ * @returns A {@link NativeResource} for use in flow input schemas.
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * const builder = sdk.flow(1, {
25
+ * inputs: { eth: native(1) },
26
+ * });
27
+ * ```
28
+ */
29
+ declare const native: (chainId: number) => NativeResource;
30
+ /**
31
+ * Creates an ERC-20 token resource declaration.
32
+ *
33
+ * @param token - The `0x`-prefixed contract address of the ERC-20 token.
34
+ * @param chainId - The EVM chain ID the token is deployed on.
35
+ * @returns An {@link Erc20Resource} for use in flow input schemas.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const USDC = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';
40
+ * const builder = sdk.flow(1, {
41
+ * inputs: { usdc: erc20(USDC, 1) },
42
+ * });
43
+ * ```
44
+ */
45
+ declare const erc20: (token: Address, chainId: number) => Erc20Resource;
46
+
47
+ type resourcesMod_Erc20Resource = Erc20Resource;
48
+ type resourcesMod_NativeResource = NativeResource;
49
+ type resourcesMod_Resource = Resource;
50
+ declare const resourcesMod_erc20: typeof erc20;
51
+ declare const resourcesMod_native: typeof native;
52
+ declare namespace resourcesMod {
53
+ export { type resourcesMod_Erc20Resource as Erc20Resource, type resourcesMod_NativeResource as NativeResource, type resourcesMod_Resource as Resource, resourcesMod_erc20 as erc20, resourcesMod_native as native };
54
+ }
55
+
56
+ export { type Erc20Resource as E, type NativeResource as N, type Resource as R, erc20 as e, native as n, resourcesMod as r };
@@ -0,0 +1,39 @@
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, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[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 resources_exports = {};
20
+ __export(resources_exports, {
21
+ erc20: () => erc20,
22
+ native: () => native
23
+ });
24
+ module.exports = __toCommonJS(resources_exports);
25
+ const native = (chainId) => ({
26
+ kind: "native",
27
+ chainId
28
+ });
29
+ const erc20 = (token, chainId) => ({
30
+ kind: "erc20",
31
+ token,
32
+ chainId
33
+ });
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ erc20,
37
+ native
38
+ });
39
+ //# sourceMappingURL=resources.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/resources.ts"],"sourcesContent":["import type { Address } from './types.js';\n\n// These resource types are SDK-local declarations that mirror the shape of\n// `Resource` from `@lifi/compose-spec`. They exist so the SDK can be used\n// without directly depending on `@lifi/compose-spec` at the call site.\n// The types are structurally compatible, so they are assignable to each other.\n\n/** A resource declaration representing the chain's native token (e.g. ETH, MATIC). */\nexport interface NativeResource {\n readonly kind: 'native';\n readonly chainId: number;\n}\n\n/** A resource declaration representing an ERC-20 token at a specific address. */\nexport interface Erc20Resource {\n readonly kind: 'erc20';\n readonly token: Address;\n readonly chainId: number;\n}\n\n/** A token resource — either the chain's native token or an ERC-20. */\nexport type Resource = NativeResource | Erc20Resource;\n\n/**\n * Creates a native token resource declaration.\n *\n * @param chainId - The EVM chain ID the native token belongs to.\n * @returns A {@link NativeResource} for use in flow input schemas.\n *\n * @example\n * ```ts\n * const builder = sdk.flow(1, {\n * inputs: { eth: native(1) },\n * });\n * ```\n */\nexport const native = (chainId: number): NativeResource => ({\n kind: 'native',\n chainId,\n});\n\n/**\n * Creates an ERC-20 token resource declaration.\n *\n * @param token - The `0x`-prefixed contract address of the ERC-20 token.\n * @param chainId - The EVM chain ID the token is deployed on.\n * @returns An {@link Erc20Resource} for use in flow input schemas.\n *\n * @example\n * ```ts\n * const USDC = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';\n * const builder = sdk.flow(1, {\n * inputs: { usdc: erc20(USDC, 1) },\n * });\n * ```\n */\nexport const erc20 = (token: Address, chainId: number): Erc20Resource => ({\n kind: 'erc20',\n token,\n chainId,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoCO,MAAM,SAAS,CAAC,aAAqC;AAAA,EAC1D,MAAM;AAAA,EACN;AACF;AAiBO,MAAM,QAAQ,CAAC,OAAgB,aAAoC;AAAA,EACxE,MAAM;AAAA,EACN;AAAA,EACA;AACF;","names":[]}
@@ -0,0 +1,3 @@
1
+ import './types.cjs';
2
+ export { E as Erc20Resource, N as NativeResource, R as Resource, e as erc20, n as native } from './resources-BKlFxjo8.cjs';
3
+ import '@lifi/compose-spec';
@@ -0,0 +1,3 @@
1
+ import './types.js';
2
+ export { E as Erc20Resource, N as NativeResource, R as Resource, e as erc20, n as native } from './resources-CYis1_DS.js';
3
+ import '@lifi/compose-spec';
@@ -0,0 +1,14 @@
1
+ const native = (chainId) => ({
2
+ kind: "native",
3
+ chainId
4
+ });
5
+ const erc20 = (token, chainId) => ({
6
+ kind: "erc20",
7
+ token,
8
+ chainId
9
+ });
10
+ export {
11
+ erc20,
12
+ native
13
+ };
14
+ //# sourceMappingURL=resources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/resources.ts"],"sourcesContent":["import type { Address } from './types.js';\n\n// These resource types are SDK-local declarations that mirror the shape of\n// `Resource` from `@lifi/compose-spec`. They exist so the SDK can be used\n// without directly depending on `@lifi/compose-spec` at the call site.\n// The types are structurally compatible, so they are assignable to each other.\n\n/** A resource declaration representing the chain's native token (e.g. ETH, MATIC). */\nexport interface NativeResource {\n readonly kind: 'native';\n readonly chainId: number;\n}\n\n/** A resource declaration representing an ERC-20 token at a specific address. */\nexport interface Erc20Resource {\n readonly kind: 'erc20';\n readonly token: Address;\n readonly chainId: number;\n}\n\n/** A token resource — either the chain's native token or an ERC-20. */\nexport type Resource = NativeResource | Erc20Resource;\n\n/**\n * Creates a native token resource declaration.\n *\n * @param chainId - The EVM chain ID the native token belongs to.\n * @returns A {@link NativeResource} for use in flow input schemas.\n *\n * @example\n * ```ts\n * const builder = sdk.flow(1, {\n * inputs: { eth: native(1) },\n * });\n * ```\n */\nexport const native = (chainId: number): NativeResource => ({\n kind: 'native',\n chainId,\n});\n\n/**\n * Creates an ERC-20 token resource declaration.\n *\n * @param token - The `0x`-prefixed contract address of the ERC-20 token.\n * @param chainId - The EVM chain ID the token is deployed on.\n * @returns An {@link Erc20Resource} for use in flow input schemas.\n *\n * @example\n * ```ts\n * const USDC = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';\n * const builder = sdk.flow(1, {\n * inputs: { usdc: erc20(USDC, 1) },\n * });\n * ```\n */\nexport const erc20 = (token: Address, chainId: number): Erc20Resource => ({\n kind: 'erc20',\n token,\n chainId,\n});\n"],"mappings":"AAoCO,MAAM,SAAS,CAAC,aAAqC;AAAA,EAC1D,MAAM;AAAA,EACN;AACF;AAiBO,MAAM,QAAQ,CAAC,OAAgB,aAAoC;AAAA,EACxE,MAAM;AAAA,EACN;AAAA,EACA;AACF;","names":[]}
@@ -0,0 +1,51 @@
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, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[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 inputs_exports = {};
20
+ __export(inputs_exports, {
21
+ buildRun: () => buildRun,
22
+ materialiser: () => materialiser
23
+ });
24
+ module.exports = __toCommonJS(inputs_exports);
25
+ const materialiser = (kind, config = {}) => ({
26
+ kind,
27
+ ...config
28
+ });
29
+ const buildRun = (run) => ({
30
+ inputs: run.inputs,
31
+ ...run.preconditions?.length && { preconditions: run.preconditions },
32
+ signer: run.signer,
33
+ ...run.assumptions && { assumptions: run.assumptions },
34
+ ...run.referrer != null && { referrer: run.referrer },
35
+ ...run.maxPriceImpactBps != null && {
36
+ maxPriceImpactBps: run.maxPriceImpactBps
37
+ },
38
+ ...run.sweepTo != null && { sweepTo: run.sweepTo },
39
+ ...run.simulationPolicy != null && {
40
+ simulationPolicy: run.simulationPolicy
41
+ },
42
+ ...run.checkOnChainAllowances != null && {
43
+ checkOnChainAllowances: run.checkOnChainAllowances
44
+ }
45
+ });
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {
48
+ buildRun,
49
+ materialiser
50
+ });
51
+ //# sourceMappingURL=inputs.cjs.map
@@ -0,0 +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 /** 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 maxPriceImpactBps?: number;\n sweepTo?: SweepTo;\n simulationPolicy?: SimulationPolicy;\n checkOnChainAllowances?: boolean;\n}): ComposeRun => ({\n inputs: run.inputs,\n ...(run.preconditions?.length && { preconditions: run.preconditions }),\n signer: run.signer,\n ...(run.assumptions && { assumptions: run.assumptions }),\n ...(run.referrer != null && { referrer: run.referrer }),\n ...(run.maxPriceImpactBps != null && {\n maxPriceImpactBps: run.maxPriceImpactBps,\n }),\n ...(run.sweepTo != null && { sweepTo: run.sweepTo }),\n ...(run.simulationPolicy != null && {\n simulationPolicy: run.simulationPolicy,\n }),\n ...(run.checkOnChainAllowances != null && {\n checkOnChainAllowances: run.checkOnChainAllowances,\n }),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA4EO,MAAM,eAAe,CAC1B,MACA,SAAkC,CAAC,OACZ;AAAA,EACvB;AAAA,EACA,GAAG;AACL;AAQO,MAAM,WAAW,CAAC,SAUN;AAAA,EACjB,QAAQ,IAAI;AAAA,EACZ,GAAI,IAAI,eAAe,UAAU,EAAE,eAAe,IAAI,cAAc;AAAA,EACpE,QAAQ,IAAI;AAAA,EACZ,GAAI,IAAI,eAAe,EAAE,aAAa,IAAI,YAAY;AAAA,EACtD,GAAI,IAAI,YAAY,QAAQ,EAAE,UAAU,IAAI,SAAS;AAAA,EACrD,GAAI,IAAI,qBAAqB,QAAQ;AAAA,IACnC,mBAAmB,IAAI;AAAA,EACzB;AAAA,EACA,GAAI,IAAI,WAAW,QAAQ,EAAE,SAAS,IAAI,QAAQ;AAAA,EAClD,GAAI,IAAI,oBAAoB,QAAQ;AAAA,IAClC,kBAAkB,IAAI;AAAA,EACxB;AAAA,EACA,GAAI,IAAI,0BAA0B,QAAQ;AAAA,IACxC,wBAAwB,IAAI;AAAA,EAC9B;AACF;","names":[]}
@@ -0,0 +1,91 @@
1
+ import { Precondition, SweepTo, SimulationPolicy, MaterialiserInput, InputSpec, ComposeRun } from '@lifi/compose-spec';
2
+ import { InputSchema, InputSpecOf, Address } from '../types.cjs';
3
+
4
+ /**
5
+ * Runtime inputs for compiling a flow. Passed to `builder.compile()` or `sdk.request()`.
6
+ *
7
+ * @typeParam T - The flow's input schema, used to type-check `inputs` and `assumptions`.
8
+ */
9
+ interface ComposeRunInput<T extends InputSchema = InputSchema> {
10
+ /**
11
+ * Concrete values for each declared flow input. Resource inputs accept a
12
+ * materialiser or a literal integer amount; scalar inputs accept the matching type.
13
+ */
14
+ readonly inputs: {
15
+ readonly [K in keyof T]: InputSpecOf<T[K]>;
16
+ };
17
+ /** Optional preconditions that must hold before the flow executes (e.g. minimum balances). */
18
+ readonly preconditions?: readonly Precondition[];
19
+ /** The `0x`-prefixed address of the transaction signer. */
20
+ readonly signer: Address;
21
+ /**
22
+ * Optional assumed token amounts for resource inputs, keyed by input name.
23
+ * When a materialiser resolves amounts at execution time rather than upfront,
24
+ * assumptions let the compiler plan routes using estimated values. The keys
25
+ * must match the input names declared in the flow schema.
26
+ */
27
+ readonly assumptions?: {
28
+ readonly [K in keyof T]?: bigint;
29
+ };
30
+ /** Optional integrator referrer identifier. */
31
+ readonly referrer?: string;
32
+ /** Maximum acceptable price impact in basis points (e.g. `300` = 3%). */
33
+ readonly maxPriceImpactBps?: number;
34
+ /**
35
+ * Destination for sweeping all proxy-held terminal resources after execution.
36
+ * Pass a literal `0x`-prefixed address or `{ $ref: "context.sender" }` to
37
+ * send remaining tokens to the signer.
38
+ */
39
+ readonly sweepTo?: SweepTo;
40
+ /**
41
+ * Controls behavior when simulation detects a revert.
42
+ * `'strict'` (default) returns an error; `'allow-revert'` returns a partial
43
+ * result with the transaction and revert diagnostics.
44
+ */
45
+ readonly simulationPolicy?: SimulationPolicy;
46
+ /**
47
+ * When `true`, the server checks on-chain ERC-20 allowances and omits
48
+ * approvals that are already sufficient. Defaults to `false`.
49
+ */
50
+ readonly checkOnChainAllowances?: boolean;
51
+ }
52
+ /**
53
+ * Creates an untyped materialiser input spec. This is a low-level escape hatch
54
+ * for materialiser kinds not yet covered by the generated helpers.
55
+ *
56
+ * Prefer the typed helpers in the `materialisers` namespace (e.g.
57
+ * `materialisers.balanceOf()`, `materialisers.directDeposit()`) which provide
58
+ * compile-time config validation.
59
+ *
60
+ * @param kind - The materialiser type (e.g. `"balanceOf"`, `"directDeposit"`).
61
+ * @param config - Optional materialiser-specific configuration.
62
+ * @returns A {@link MaterialiserInput} for use in {@link ComposeRunInput.inputs}.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * const run = {
67
+ * inputs: { token: materialiser('customKind', { myParam: '0x...' }) },
68
+ * signer: '0x...',
69
+ * };
70
+ * ```
71
+ */
72
+ declare const materialiser: (kind: string, config?: Record<string, unknown>) => MaterialiserInput;
73
+ /**
74
+ * Assembles a {@link ComposeRun} object from individual parameters.
75
+ * Used internally by the SDK; prefer {@link ComposeRunInput} for external use.
76
+ *
77
+ * @internal
78
+ */
79
+ declare const buildRun: (run: {
80
+ inputs: Record<string, InputSpec>;
81
+ preconditions?: readonly Precondition[];
82
+ signer: string;
83
+ assumptions?: Record<string, bigint>;
84
+ referrer?: string;
85
+ maxPriceImpactBps?: number;
86
+ sweepTo?: SweepTo;
87
+ simulationPolicy?: SimulationPolicy;
88
+ checkOnChainAllowances?: boolean;
89
+ }) => ComposeRun;
90
+
91
+ export { type ComposeRunInput, buildRun, materialiser };
@@ -0,0 +1,91 @@
1
+ import { Precondition, SweepTo, SimulationPolicy, MaterialiserInput, InputSpec, ComposeRun } from '@lifi/compose-spec';
2
+ import { InputSchema, InputSpecOf, Address } from '../types.js';
3
+
4
+ /**
5
+ * Runtime inputs for compiling a flow. Passed to `builder.compile()` or `sdk.request()`.
6
+ *
7
+ * @typeParam T - The flow's input schema, used to type-check `inputs` and `assumptions`.
8
+ */
9
+ interface ComposeRunInput<T extends InputSchema = InputSchema> {
10
+ /**
11
+ * Concrete values for each declared flow input. Resource inputs accept a
12
+ * materialiser or a literal integer amount; scalar inputs accept the matching type.
13
+ */
14
+ readonly inputs: {
15
+ readonly [K in keyof T]: InputSpecOf<T[K]>;
16
+ };
17
+ /** Optional preconditions that must hold before the flow executes (e.g. minimum balances). */
18
+ readonly preconditions?: readonly Precondition[];
19
+ /** The `0x`-prefixed address of the transaction signer. */
20
+ readonly signer: Address;
21
+ /**
22
+ * Optional assumed token amounts for resource inputs, keyed by input name.
23
+ * When a materialiser resolves amounts at execution time rather than upfront,
24
+ * assumptions let the compiler plan routes using estimated values. The keys
25
+ * must match the input names declared in the flow schema.
26
+ */
27
+ readonly assumptions?: {
28
+ readonly [K in keyof T]?: bigint;
29
+ };
30
+ /** Optional integrator referrer identifier. */
31
+ readonly referrer?: string;
32
+ /** Maximum acceptable price impact in basis points (e.g. `300` = 3%). */
33
+ readonly maxPriceImpactBps?: number;
34
+ /**
35
+ * Destination for sweeping all proxy-held terminal resources after execution.
36
+ * Pass a literal `0x`-prefixed address or `{ $ref: "context.sender" }` to
37
+ * send remaining tokens to the signer.
38
+ */
39
+ readonly sweepTo?: SweepTo;
40
+ /**
41
+ * Controls behavior when simulation detects a revert.
42
+ * `'strict'` (default) returns an error; `'allow-revert'` returns a partial
43
+ * result with the transaction and revert diagnostics.
44
+ */
45
+ readonly simulationPolicy?: SimulationPolicy;
46
+ /**
47
+ * When `true`, the server checks on-chain ERC-20 allowances and omits
48
+ * approvals that are already sufficient. Defaults to `false`.
49
+ */
50
+ readonly checkOnChainAllowances?: boolean;
51
+ }
52
+ /**
53
+ * Creates an untyped materialiser input spec. This is a low-level escape hatch
54
+ * for materialiser kinds not yet covered by the generated helpers.
55
+ *
56
+ * Prefer the typed helpers in the `materialisers` namespace (e.g.
57
+ * `materialisers.balanceOf()`, `materialisers.directDeposit()`) which provide
58
+ * compile-time config validation.
59
+ *
60
+ * @param kind - The materialiser type (e.g. `"balanceOf"`, `"directDeposit"`).
61
+ * @param config - Optional materialiser-specific configuration.
62
+ * @returns A {@link MaterialiserInput} for use in {@link ComposeRunInput.inputs}.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * const run = {
67
+ * inputs: { token: materialiser('customKind', { myParam: '0x...' }) },
68
+ * signer: '0x...',
69
+ * };
70
+ * ```
71
+ */
72
+ declare const materialiser: (kind: string, config?: Record<string, unknown>) => MaterialiserInput;
73
+ /**
74
+ * Assembles a {@link ComposeRun} object from individual parameters.
75
+ * Used internally by the SDK; prefer {@link ComposeRunInput} for external use.
76
+ *
77
+ * @internal
78
+ */
79
+ declare const buildRun: (run: {
80
+ inputs: Record<string, InputSpec>;
81
+ preconditions?: readonly Precondition[];
82
+ signer: string;
83
+ assumptions?: Record<string, bigint>;
84
+ referrer?: string;
85
+ maxPriceImpactBps?: number;
86
+ sweepTo?: SweepTo;
87
+ simulationPolicy?: SimulationPolicy;
88
+ checkOnChainAllowances?: boolean;
89
+ }) => ComposeRun;
90
+
91
+ export { type ComposeRunInput, buildRun, materialiser };
@@ -0,0 +1,26 @@
1
+ const materialiser = (kind, config = {}) => ({
2
+ kind,
3
+ ...config
4
+ });
5
+ const buildRun = (run) => ({
6
+ inputs: run.inputs,
7
+ ...run.preconditions?.length && { preconditions: run.preconditions },
8
+ signer: run.signer,
9
+ ...run.assumptions && { assumptions: run.assumptions },
10
+ ...run.referrer != null && { referrer: run.referrer },
11
+ ...run.maxPriceImpactBps != null && {
12
+ maxPriceImpactBps: run.maxPriceImpactBps
13
+ },
14
+ ...run.sweepTo != null && { sweepTo: run.sweepTo },
15
+ ...run.simulationPolicy != null && {
16
+ simulationPolicy: run.simulationPolicy
17
+ },
18
+ ...run.checkOnChainAllowances != null && {
19
+ checkOnChainAllowances: run.checkOnChainAllowances
20
+ }
21
+ });
22
+ export {
23
+ buildRun,
24
+ materialiser
25
+ };
26
+ //# sourceMappingURL=inputs.js.map