@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,337 @@
1
+ import { FlowBuilderInternal } from '../authoring/FlowBuilderCore.cjs';
2
+ import { Bindable, OutputHandle } from '../authoring/handles.cjs';
3
+ import { SignatureBind, CoreCallResult, StaticCallResult } from '../authoring/signatureArgs.cjs';
4
+ import { TypedGuard } from '../types.cjs';
5
+ import { CoreSplitConfig, CoreBpsDownConfig, CoreBpsUpConfig, CoreApproveConfig, CoreBalanceOfConfig, CoreTransferConfig, CoreCallConfig, CoreStaticCallConfig, CoreRawCallConfig, CoreAsResourceConfig, CorePeekConfig, LifiSwapConfig, LifiZapConfig } from './config.generated.cjs';
6
+ import '@lifi/compose-spec';
7
+ import 'abitype';
8
+
9
+ /** Split a resource into two outputs by basis-point ratio */
10
+ interface CoreSplitArgs {
11
+ readonly bind: {
12
+ readonly source: Bindable<'resource'>;
13
+ };
14
+ readonly config: CoreSplitConfig;
15
+ readonly guards?: readonly TypedGuard<'a' | 'b'>[];
16
+ }
17
+ /** Merge two same-token resources into one by addition */
18
+ interface CoreMergeArgs {
19
+ readonly bind: {
20
+ readonly a: Bindable<'resource'>;
21
+ readonly b: Bindable<'resource'>;
22
+ };
23
+ readonly guards?: readonly TypedGuard<'merged'>[];
24
+ }
25
+ /** Swap tokens via the LI.FI aggregator API */
26
+ interface LifiSwapArgs {
27
+ readonly bind: {
28
+ readonly amountIn: Bindable<'resource'>;
29
+ };
30
+ readonly config: LifiSwapConfig;
31
+ readonly guards?: readonly TypedGuard<'unspentIn'>[];
32
+ }
33
+ /** Assert that an account holds at least a minimum token balance */
34
+ interface InvariantBalanceAtLeastArgs {
35
+ readonly bind: {
36
+ readonly minimumAmount: Bindable<'resource'>;
37
+ readonly account: Bindable<'address'>;
38
+ };
39
+ readonly guards?: readonly TypedGuard<never>[];
40
+ }
41
+ /** Route tokens into a DeFi protocol position via the edge catalog */
42
+ interface LifiZapArgs {
43
+ readonly bind: {
44
+ readonly amountIn: Bindable<'resource'>;
45
+ };
46
+ readonly config: LifiZapConfig;
47
+ readonly guards?: readonly TypedGuard<'amountOut'>[];
48
+ }
49
+ /** Add two unsigned integers (a + b) */
50
+ interface CoreAddArgs {
51
+ readonly bind: {
52
+ readonly a: Bindable<'uint256'>;
53
+ readonly b: Bindable<'uint256'>;
54
+ };
55
+ readonly guards?: readonly TypedGuard<'result'>[];
56
+ }
57
+ /** Subtract b from a (a - b); reverts on underflow */
58
+ interface CoreSubtractArgs {
59
+ readonly bind: {
60
+ readonly a: Bindable<'uint256'>;
61
+ readonly b: Bindable<'uint256'>;
62
+ };
63
+ readonly guards?: readonly TypedGuard<'result'>[];
64
+ }
65
+ /** Multiply two unsigned integers (a * b) */
66
+ interface CoreMultiplyArgs {
67
+ readonly bind: {
68
+ readonly a: Bindable<'uint256'>;
69
+ readonly b: Bindable<'uint256'>;
70
+ };
71
+ readonly guards?: readonly TypedGuard<'result'>[];
72
+ }
73
+ /** Divide a by b, rounding toward zero */
74
+ interface CoreDivideDownArgs {
75
+ readonly bind: {
76
+ readonly a: Bindable<'uint256'>;
77
+ readonly b: Bindable<'uint256'>;
78
+ };
79
+ readonly guards?: readonly TypedGuard<'result'>[];
80
+ }
81
+ /** Divide a by b, rounding away from zero */
82
+ interface CoreDivideUpArgs {
83
+ readonly bind: {
84
+ readonly a: Bindable<'uint256'>;
85
+ readonly b: Bindable<'uint256'>;
86
+ };
87
+ readonly guards?: readonly TypedGuard<'result'>[];
88
+ }
89
+ /** Multiply value by basis points and divide by 10000, rounding down */
90
+ interface CoreBpsDownArgs {
91
+ readonly bind: {
92
+ readonly value: Bindable<'uint256'>;
93
+ };
94
+ readonly config: CoreBpsDownConfig;
95
+ readonly guards?: readonly TypedGuard<'result'>[];
96
+ }
97
+ /** Multiply value by basis points and divide by 10000, rounding up */
98
+ interface CoreBpsUpArgs {
99
+ readonly bind: {
100
+ readonly value: Bindable<'uint256'>;
101
+ };
102
+ readonly config: CoreBpsUpConfig;
103
+ readonly guards?: readonly TypedGuard<'result'>[];
104
+ }
105
+ /** Assert a == b; reverts if not equal */
106
+ interface CoreAssertEqualArgs {
107
+ readonly bind: {
108
+ readonly a: Bindable<'uint256'>;
109
+ readonly b: Bindable<'uint256'>;
110
+ };
111
+ readonly guards?: readonly TypedGuard<never>[];
112
+ }
113
+ /** Assert a != b; reverts if equal */
114
+ interface CoreAssertNotEqualArgs {
115
+ readonly bind: {
116
+ readonly a: Bindable<'uint256'>;
117
+ readonly b: Bindable<'uint256'>;
118
+ };
119
+ readonly guards?: readonly TypedGuard<never>[];
120
+ }
121
+ /** Assert a > b; reverts if a <= b */
122
+ interface CoreAssertGtArgs {
123
+ readonly bind: {
124
+ readonly a: Bindable<'uint256'>;
125
+ readonly b: Bindable<'uint256'>;
126
+ };
127
+ readonly guards?: readonly TypedGuard<never>[];
128
+ }
129
+ /** Assert a >= b; reverts if a < b */
130
+ interface CoreAssertGteArgs {
131
+ readonly bind: {
132
+ readonly a: Bindable<'uint256'>;
133
+ readonly b: Bindable<'uint256'>;
134
+ };
135
+ readonly guards?: readonly TypedGuard<never>[];
136
+ }
137
+ /** Assert a < b; reverts if a >= b */
138
+ interface CoreAssertLtArgs {
139
+ readonly bind: {
140
+ readonly a: Bindable<'uint256'>;
141
+ readonly b: Bindable<'uint256'>;
142
+ };
143
+ readonly guards?: readonly TypedGuard<never>[];
144
+ }
145
+ /** Assert a <= b; reverts if a > b */
146
+ interface CoreAssertLteArgs {
147
+ readonly bind: {
148
+ readonly a: Bindable<'uint256'>;
149
+ readonly b: Bindable<'uint256'>;
150
+ };
151
+ readonly guards?: readonly TypedGuard<never>[];
152
+ }
153
+ /** Assert min <= value <= max; reverts if value is outside the range */
154
+ interface CoreAssertInRangeArgs {
155
+ readonly bind: {
156
+ readonly value: Bindable<'uint256'>;
157
+ readonly min: Bindable<'uint256'>;
158
+ readonly max: Bindable<'uint256'>;
159
+ };
160
+ readonly guards?: readonly TypedGuard<never>[];
161
+ }
162
+ /** Approve an ERC20 spender for the given token and amount */
163
+ interface CoreApproveArgs {
164
+ readonly bind: {
165
+ readonly amount: Bindable<'resource'>;
166
+ };
167
+ readonly config: CoreApproveConfig;
168
+ readonly guards?: readonly TypedGuard<never>[];
169
+ }
170
+ /** Read an ERC20 balance, producing a resource */
171
+ interface CoreBalanceOfArgs {
172
+ readonly bind: Record<string, never>;
173
+ readonly config: CoreBalanceOfConfig;
174
+ readonly guards?: readonly TypedGuard<'balance'>[];
175
+ }
176
+ /** Transfer tokens to a recipient address, optionally specifying a partial amount */
177
+ interface CoreTransferArgs {
178
+ readonly bind: {
179
+ readonly amount: Bindable<'resource'>;
180
+ readonly recipient: Bindable<'address'>;
181
+ };
182
+ readonly config: CoreTransferConfig;
183
+ readonly guards?: readonly TypedGuard<'transferred' | 'remainder'>[];
184
+ }
185
+ /** Invoke a smart contract function, optionally spending a token resource */
186
+ interface CoreCallArgs<TSig extends string = string> {
187
+ readonly resource?: Bindable<'resource'>;
188
+ readonly bind: SignatureBind<TSig>;
189
+ readonly config: Omit<CoreCallConfig, 'args' | 'functionSignature'> & {
190
+ readonly functionSignature: TSig;
191
+ };
192
+ readonly guards?: readonly TypedGuard<'result'>[];
193
+ }
194
+ /** Read from a smart contract at runtime (StaticCall); result is fresh at execution time */
195
+ interface CoreStaticCallArgs<TSig extends string = string> {
196
+ readonly bind: SignatureBind<TSig>;
197
+ readonly config: Omit<CoreStaticCallConfig, 'args' | 'functionSignature'> & {
198
+ readonly functionSignature: TSig;
199
+ };
200
+ readonly guards?: readonly TypedGuard<'result'>[];
201
+ }
202
+ /** Invoke a contract with pre-encoded calldata */
203
+ interface CoreRawCallArgs {
204
+ readonly bind: Record<string, never>;
205
+ readonly config: CoreRawCallConfig;
206
+ readonly guards?: readonly TypedGuard<'result'>[];
207
+ }
208
+ /** Graduate a raw handle to a resource, enabling slippage surfacing and linearity tracking */
209
+ interface CoreAsResourceArgs {
210
+ readonly bind: {
211
+ readonly handle: Bindable<'uint256'>;
212
+ };
213
+ readonly config: CoreAsResourceConfig;
214
+ readonly guards?: readonly TypedGuard<'resource'>[];
215
+ }
216
+ /** Read a smart contract value at compile time (off-chain eth_call); result is baked as a literal */
217
+ interface CorePeekArgs {
218
+ readonly bind: Record<string, never>;
219
+ readonly config: CorePeekConfig;
220
+ readonly guards?: readonly TypedGuard<'result'>[];
221
+ }
222
+ interface CoreSplitOutputs {
223
+ readonly a: OutputHandle<'resource'>;
224
+ readonly b: OutputHandle<'resource'>;
225
+ }
226
+ interface CoreMergeOutputs {
227
+ readonly merged: OutputHandle<'resource'>;
228
+ }
229
+ interface LifiSwapOutputs {
230
+ readonly amountOut: OutputHandle<'resource'>;
231
+ readonly unspentIn: OutputHandle<'resource'>;
232
+ }
233
+ interface LifiZapOutputs {
234
+ readonly amountOut: OutputHandle<'resource'>;
235
+ }
236
+ interface CoreAddOutputs {
237
+ readonly result: OutputHandle<'uint256'>;
238
+ }
239
+ interface CoreSubtractOutputs {
240
+ readonly result: OutputHandle<'uint256'>;
241
+ }
242
+ interface CoreMultiplyOutputs {
243
+ readonly result: OutputHandle<'uint256'>;
244
+ }
245
+ interface CoreDivideDownOutputs {
246
+ readonly result: OutputHandle<'uint256'>;
247
+ }
248
+ interface CoreDivideUpOutputs {
249
+ readonly result: OutputHandle<'uint256'>;
250
+ }
251
+ interface CoreBpsDownOutputs {
252
+ readonly result: OutputHandle<'uint256'>;
253
+ }
254
+ interface CoreBpsUpOutputs {
255
+ readonly result: OutputHandle<'uint256'>;
256
+ }
257
+ interface CoreBalanceOfOutputs {
258
+ readonly balance: OutputHandle<'resource'>;
259
+ }
260
+ interface CoreTransferOutputs {
261
+ readonly transferred: OutputHandle<'resource'>;
262
+ readonly remainder: OutputHandle<'resource'>;
263
+ }
264
+ interface CoreRawCallOutputs {
265
+ readonly result: OutputHandle<'uint256'>;
266
+ }
267
+ interface CoreAsResourceOutputs {
268
+ readonly resource: OutputHandle<'resource'>;
269
+ }
270
+ interface CorePeekOutputs {
271
+ readonly result: OutputHandle<'uint256'>;
272
+ }
273
+ type GeneratedOps = {
274
+ readonly core: {
275
+ /** Split a resource into two outputs by basis-point ratio — original id: "core.split" */
276
+ readonly split: (nodeId: string, args: CoreSplitArgs) => CoreSplitOutputs;
277
+ /** Merge two same-token resources into one by addition — original id: "core.merge" */
278
+ readonly merge: (nodeId: string, args: CoreMergeArgs) => CoreMergeOutputs;
279
+ /** Add two unsigned integers (a + b) — original id: "core.add" */
280
+ readonly add: (nodeId: string, args: CoreAddArgs) => CoreAddOutputs;
281
+ /** Subtract b from a (a - b); reverts on underflow — original id: "core.subtract" */
282
+ readonly subtract: (nodeId: string, args: CoreSubtractArgs) => CoreSubtractOutputs;
283
+ /** Multiply two unsigned integers (a * b) — original id: "core.multiply" */
284
+ readonly multiply: (nodeId: string, args: CoreMultiplyArgs) => CoreMultiplyOutputs;
285
+ /** Divide a by b, rounding toward zero — original id: "core.divideDown" */
286
+ readonly divideDown: (nodeId: string, args: CoreDivideDownArgs) => CoreDivideDownOutputs;
287
+ /** Divide a by b, rounding away from zero — original id: "core.divideUp" */
288
+ readonly divideUp: (nodeId: string, args: CoreDivideUpArgs) => CoreDivideUpOutputs;
289
+ /** Multiply value by basis points and divide by 10000, rounding down — original id: "core.bpsDown" */
290
+ readonly bpsDown: (nodeId: string, args: CoreBpsDownArgs) => CoreBpsDownOutputs;
291
+ /** Multiply value by basis points and divide by 10000, rounding up — original id: "core.bpsUp" */
292
+ readonly bpsUp: (nodeId: string, args: CoreBpsUpArgs) => CoreBpsUpOutputs;
293
+ /** Assert a == b; reverts if not equal — original id: "core.assertEqual" */
294
+ readonly assertEqual: (nodeId: string, args: CoreAssertEqualArgs) => void;
295
+ /** Assert a != b; reverts if equal — original id: "core.assertNotEqual" */
296
+ readonly assertNotEqual: (nodeId: string, args: CoreAssertNotEqualArgs) => void;
297
+ /** Assert a > b; reverts if a <= b — original id: "core.assertGt" */
298
+ readonly assertGt: (nodeId: string, args: CoreAssertGtArgs) => void;
299
+ /** Assert a >= b; reverts if a < b — original id: "core.assertGte" */
300
+ readonly assertGte: (nodeId: string, args: CoreAssertGteArgs) => void;
301
+ /** Assert a < b; reverts if a >= b — original id: "core.assertLt" */
302
+ readonly assertLt: (nodeId: string, args: CoreAssertLtArgs) => void;
303
+ /** Assert a <= b; reverts if a > b — original id: "core.assertLte" */
304
+ readonly assertLte: (nodeId: string, args: CoreAssertLteArgs) => void;
305
+ /** Assert min <= value <= max; reverts if value is outside the range — original id: "core.assertInRange" */
306
+ readonly assertInRange: (nodeId: string, args: CoreAssertInRangeArgs) => void;
307
+ /** Approve an ERC20 spender for the given token and amount — original id: "core.approve" */
308
+ readonly approve: (nodeId: string, args: CoreApproveArgs) => void;
309
+ /** Read an ERC20 balance, producing a resource — original id: "core.balanceOf" */
310
+ readonly balanceOf: (nodeId: string, args: CoreBalanceOfArgs) => CoreBalanceOfOutputs;
311
+ /** Transfer tokens to a recipient address, optionally specifying a partial amount — original id: "core.transfer" */
312
+ readonly transfer: (nodeId: string, args: CoreTransferArgs) => CoreTransferOutputs;
313
+ /** Invoke a smart contract function, optionally spending a token resource — original id: "core.call" */
314
+ readonly call: <TSig extends string>(nodeId: string, args: CoreCallArgs<TSig>) => CoreCallResult<TSig>;
315
+ /** Read from a smart contract at runtime (StaticCall); result is fresh at execution time — original id: "core.staticCall" */
316
+ readonly staticCall: <TSig extends string>(nodeId: string, args: CoreStaticCallArgs<TSig>) => StaticCallResult<TSig>;
317
+ /** Invoke a contract with pre-encoded calldata — original id: "core.rawCall" */
318
+ readonly rawCall: (nodeId: string, args: CoreRawCallArgs) => CoreRawCallOutputs;
319
+ /** Graduate a raw handle to a resource, enabling slippage surfacing and linearity tracking — original id: "core.asResource" */
320
+ readonly asResource: (nodeId: string, args: CoreAsResourceArgs) => CoreAsResourceOutputs;
321
+ /** Read a smart contract value at compile time (off-chain eth_call); result is baked as a literal — original id: "core.peek" */
322
+ readonly peek: (nodeId: string, args: CorePeekArgs) => CorePeekOutputs;
323
+ };
324
+ readonly lifi: {
325
+ /** Swap tokens via the LI.FI aggregator API — original id: "lifi.swap" */
326
+ readonly swap: (nodeId: string, args: LifiSwapArgs) => LifiSwapOutputs;
327
+ /** Route tokens into a DeFi protocol position via the edge catalog — original id: "lifi.zap" */
328
+ readonly zap: (nodeId: string, args: LifiZapArgs) => LifiZapOutputs;
329
+ };
330
+ readonly invariant: {
331
+ /** Assert that an account holds at least a minimum token balance — original id: "invariant.balanceAtLeast" */
332
+ readonly balanceAtLeast: (nodeId: string, args: InvariantBalanceAtLeastArgs) => void;
333
+ };
334
+ };
335
+ declare const bindGeneratedOps: (builder: FlowBuilderInternal) => GeneratedOps;
336
+
337
+ export { type CoreAddArgs, type CoreAddOutputs, type CoreApproveArgs, type CoreAsResourceArgs, type CoreAsResourceOutputs, type CoreAssertEqualArgs, type CoreAssertGtArgs, type CoreAssertGteArgs, type CoreAssertInRangeArgs, type CoreAssertLtArgs, type CoreAssertLteArgs, type CoreAssertNotEqualArgs, type CoreBalanceOfArgs, type CoreBalanceOfOutputs, type CoreBpsDownArgs, type CoreBpsDownOutputs, type CoreBpsUpArgs, type CoreBpsUpOutputs, type CoreCallArgs, type CoreDivideDownArgs, type CoreDivideDownOutputs, type CoreDivideUpArgs, type CoreDivideUpOutputs, type CoreMergeArgs, type CoreMergeOutputs, type CoreMultiplyArgs, type CoreMultiplyOutputs, type CorePeekArgs, type CorePeekOutputs, type CoreRawCallArgs, type CoreRawCallOutputs, type CoreSplitArgs, type CoreSplitOutputs, type CoreStaticCallArgs, type CoreSubtractArgs, type CoreSubtractOutputs, type CoreTransferArgs, type CoreTransferOutputs, type GeneratedOps, type InvariantBalanceAtLeastArgs, type LifiSwapArgs, type LifiSwapOutputs, type LifiZapArgs, type LifiZapOutputs, bindGeneratedOps };
@@ -0,0 +1,337 @@
1
+ import { FlowBuilderInternal } from '../authoring/FlowBuilderCore.js';
2
+ import { Bindable, OutputHandle } from '../authoring/handles.js';
3
+ import { SignatureBind, CoreCallResult, StaticCallResult } from '../authoring/signatureArgs.js';
4
+ import { TypedGuard } from '../types.js';
5
+ import { CoreSplitConfig, CoreBpsDownConfig, CoreBpsUpConfig, CoreApproveConfig, CoreBalanceOfConfig, CoreTransferConfig, CoreCallConfig, CoreStaticCallConfig, CoreRawCallConfig, CoreAsResourceConfig, CorePeekConfig, LifiSwapConfig, LifiZapConfig } from './config.generated.js';
6
+ import '@lifi/compose-spec';
7
+ import 'abitype';
8
+
9
+ /** Split a resource into two outputs by basis-point ratio */
10
+ interface CoreSplitArgs {
11
+ readonly bind: {
12
+ readonly source: Bindable<'resource'>;
13
+ };
14
+ readonly config: CoreSplitConfig;
15
+ readonly guards?: readonly TypedGuard<'a' | 'b'>[];
16
+ }
17
+ /** Merge two same-token resources into one by addition */
18
+ interface CoreMergeArgs {
19
+ readonly bind: {
20
+ readonly a: Bindable<'resource'>;
21
+ readonly b: Bindable<'resource'>;
22
+ };
23
+ readonly guards?: readonly TypedGuard<'merged'>[];
24
+ }
25
+ /** Swap tokens via the LI.FI aggregator API */
26
+ interface LifiSwapArgs {
27
+ readonly bind: {
28
+ readonly amountIn: Bindable<'resource'>;
29
+ };
30
+ readonly config: LifiSwapConfig;
31
+ readonly guards?: readonly TypedGuard<'unspentIn'>[];
32
+ }
33
+ /** Assert that an account holds at least a minimum token balance */
34
+ interface InvariantBalanceAtLeastArgs {
35
+ readonly bind: {
36
+ readonly minimumAmount: Bindable<'resource'>;
37
+ readonly account: Bindable<'address'>;
38
+ };
39
+ readonly guards?: readonly TypedGuard<never>[];
40
+ }
41
+ /** Route tokens into a DeFi protocol position via the edge catalog */
42
+ interface LifiZapArgs {
43
+ readonly bind: {
44
+ readonly amountIn: Bindable<'resource'>;
45
+ };
46
+ readonly config: LifiZapConfig;
47
+ readonly guards?: readonly TypedGuard<'amountOut'>[];
48
+ }
49
+ /** Add two unsigned integers (a + b) */
50
+ interface CoreAddArgs {
51
+ readonly bind: {
52
+ readonly a: Bindable<'uint256'>;
53
+ readonly b: Bindable<'uint256'>;
54
+ };
55
+ readonly guards?: readonly TypedGuard<'result'>[];
56
+ }
57
+ /** Subtract b from a (a - b); reverts on underflow */
58
+ interface CoreSubtractArgs {
59
+ readonly bind: {
60
+ readonly a: Bindable<'uint256'>;
61
+ readonly b: Bindable<'uint256'>;
62
+ };
63
+ readonly guards?: readonly TypedGuard<'result'>[];
64
+ }
65
+ /** Multiply two unsigned integers (a * b) */
66
+ interface CoreMultiplyArgs {
67
+ readonly bind: {
68
+ readonly a: Bindable<'uint256'>;
69
+ readonly b: Bindable<'uint256'>;
70
+ };
71
+ readonly guards?: readonly TypedGuard<'result'>[];
72
+ }
73
+ /** Divide a by b, rounding toward zero */
74
+ interface CoreDivideDownArgs {
75
+ readonly bind: {
76
+ readonly a: Bindable<'uint256'>;
77
+ readonly b: Bindable<'uint256'>;
78
+ };
79
+ readonly guards?: readonly TypedGuard<'result'>[];
80
+ }
81
+ /** Divide a by b, rounding away from zero */
82
+ interface CoreDivideUpArgs {
83
+ readonly bind: {
84
+ readonly a: Bindable<'uint256'>;
85
+ readonly b: Bindable<'uint256'>;
86
+ };
87
+ readonly guards?: readonly TypedGuard<'result'>[];
88
+ }
89
+ /** Multiply value by basis points and divide by 10000, rounding down */
90
+ interface CoreBpsDownArgs {
91
+ readonly bind: {
92
+ readonly value: Bindable<'uint256'>;
93
+ };
94
+ readonly config: CoreBpsDownConfig;
95
+ readonly guards?: readonly TypedGuard<'result'>[];
96
+ }
97
+ /** Multiply value by basis points and divide by 10000, rounding up */
98
+ interface CoreBpsUpArgs {
99
+ readonly bind: {
100
+ readonly value: Bindable<'uint256'>;
101
+ };
102
+ readonly config: CoreBpsUpConfig;
103
+ readonly guards?: readonly TypedGuard<'result'>[];
104
+ }
105
+ /** Assert a == b; reverts if not equal */
106
+ interface CoreAssertEqualArgs {
107
+ readonly bind: {
108
+ readonly a: Bindable<'uint256'>;
109
+ readonly b: Bindable<'uint256'>;
110
+ };
111
+ readonly guards?: readonly TypedGuard<never>[];
112
+ }
113
+ /** Assert a != b; reverts if equal */
114
+ interface CoreAssertNotEqualArgs {
115
+ readonly bind: {
116
+ readonly a: Bindable<'uint256'>;
117
+ readonly b: Bindable<'uint256'>;
118
+ };
119
+ readonly guards?: readonly TypedGuard<never>[];
120
+ }
121
+ /** Assert a > b; reverts if a <= b */
122
+ interface CoreAssertGtArgs {
123
+ readonly bind: {
124
+ readonly a: Bindable<'uint256'>;
125
+ readonly b: Bindable<'uint256'>;
126
+ };
127
+ readonly guards?: readonly TypedGuard<never>[];
128
+ }
129
+ /** Assert a >= b; reverts if a < b */
130
+ interface CoreAssertGteArgs {
131
+ readonly bind: {
132
+ readonly a: Bindable<'uint256'>;
133
+ readonly b: Bindable<'uint256'>;
134
+ };
135
+ readonly guards?: readonly TypedGuard<never>[];
136
+ }
137
+ /** Assert a < b; reverts if a >= b */
138
+ interface CoreAssertLtArgs {
139
+ readonly bind: {
140
+ readonly a: Bindable<'uint256'>;
141
+ readonly b: Bindable<'uint256'>;
142
+ };
143
+ readonly guards?: readonly TypedGuard<never>[];
144
+ }
145
+ /** Assert a <= b; reverts if a > b */
146
+ interface CoreAssertLteArgs {
147
+ readonly bind: {
148
+ readonly a: Bindable<'uint256'>;
149
+ readonly b: Bindable<'uint256'>;
150
+ };
151
+ readonly guards?: readonly TypedGuard<never>[];
152
+ }
153
+ /** Assert min <= value <= max; reverts if value is outside the range */
154
+ interface CoreAssertInRangeArgs {
155
+ readonly bind: {
156
+ readonly value: Bindable<'uint256'>;
157
+ readonly min: Bindable<'uint256'>;
158
+ readonly max: Bindable<'uint256'>;
159
+ };
160
+ readonly guards?: readonly TypedGuard<never>[];
161
+ }
162
+ /** Approve an ERC20 spender for the given token and amount */
163
+ interface CoreApproveArgs {
164
+ readonly bind: {
165
+ readonly amount: Bindable<'resource'>;
166
+ };
167
+ readonly config: CoreApproveConfig;
168
+ readonly guards?: readonly TypedGuard<never>[];
169
+ }
170
+ /** Read an ERC20 balance, producing a resource */
171
+ interface CoreBalanceOfArgs {
172
+ readonly bind: Record<string, never>;
173
+ readonly config: CoreBalanceOfConfig;
174
+ readonly guards?: readonly TypedGuard<'balance'>[];
175
+ }
176
+ /** Transfer tokens to a recipient address, optionally specifying a partial amount */
177
+ interface CoreTransferArgs {
178
+ readonly bind: {
179
+ readonly amount: Bindable<'resource'>;
180
+ readonly recipient: Bindable<'address'>;
181
+ };
182
+ readonly config: CoreTransferConfig;
183
+ readonly guards?: readonly TypedGuard<'transferred' | 'remainder'>[];
184
+ }
185
+ /** Invoke a smart contract function, optionally spending a token resource */
186
+ interface CoreCallArgs<TSig extends string = string> {
187
+ readonly resource?: Bindable<'resource'>;
188
+ readonly bind: SignatureBind<TSig>;
189
+ readonly config: Omit<CoreCallConfig, 'args' | 'functionSignature'> & {
190
+ readonly functionSignature: TSig;
191
+ };
192
+ readonly guards?: readonly TypedGuard<'result'>[];
193
+ }
194
+ /** Read from a smart contract at runtime (StaticCall); result is fresh at execution time */
195
+ interface CoreStaticCallArgs<TSig extends string = string> {
196
+ readonly bind: SignatureBind<TSig>;
197
+ readonly config: Omit<CoreStaticCallConfig, 'args' | 'functionSignature'> & {
198
+ readonly functionSignature: TSig;
199
+ };
200
+ readonly guards?: readonly TypedGuard<'result'>[];
201
+ }
202
+ /** Invoke a contract with pre-encoded calldata */
203
+ interface CoreRawCallArgs {
204
+ readonly bind: Record<string, never>;
205
+ readonly config: CoreRawCallConfig;
206
+ readonly guards?: readonly TypedGuard<'result'>[];
207
+ }
208
+ /** Graduate a raw handle to a resource, enabling slippage surfacing and linearity tracking */
209
+ interface CoreAsResourceArgs {
210
+ readonly bind: {
211
+ readonly handle: Bindable<'uint256'>;
212
+ };
213
+ readonly config: CoreAsResourceConfig;
214
+ readonly guards?: readonly TypedGuard<'resource'>[];
215
+ }
216
+ /** Read a smart contract value at compile time (off-chain eth_call); result is baked as a literal */
217
+ interface CorePeekArgs {
218
+ readonly bind: Record<string, never>;
219
+ readonly config: CorePeekConfig;
220
+ readonly guards?: readonly TypedGuard<'result'>[];
221
+ }
222
+ interface CoreSplitOutputs {
223
+ readonly a: OutputHandle<'resource'>;
224
+ readonly b: OutputHandle<'resource'>;
225
+ }
226
+ interface CoreMergeOutputs {
227
+ readonly merged: OutputHandle<'resource'>;
228
+ }
229
+ interface LifiSwapOutputs {
230
+ readonly amountOut: OutputHandle<'resource'>;
231
+ readonly unspentIn: OutputHandle<'resource'>;
232
+ }
233
+ interface LifiZapOutputs {
234
+ readonly amountOut: OutputHandle<'resource'>;
235
+ }
236
+ interface CoreAddOutputs {
237
+ readonly result: OutputHandle<'uint256'>;
238
+ }
239
+ interface CoreSubtractOutputs {
240
+ readonly result: OutputHandle<'uint256'>;
241
+ }
242
+ interface CoreMultiplyOutputs {
243
+ readonly result: OutputHandle<'uint256'>;
244
+ }
245
+ interface CoreDivideDownOutputs {
246
+ readonly result: OutputHandle<'uint256'>;
247
+ }
248
+ interface CoreDivideUpOutputs {
249
+ readonly result: OutputHandle<'uint256'>;
250
+ }
251
+ interface CoreBpsDownOutputs {
252
+ readonly result: OutputHandle<'uint256'>;
253
+ }
254
+ interface CoreBpsUpOutputs {
255
+ readonly result: OutputHandle<'uint256'>;
256
+ }
257
+ interface CoreBalanceOfOutputs {
258
+ readonly balance: OutputHandle<'resource'>;
259
+ }
260
+ interface CoreTransferOutputs {
261
+ readonly transferred: OutputHandle<'resource'>;
262
+ readonly remainder: OutputHandle<'resource'>;
263
+ }
264
+ interface CoreRawCallOutputs {
265
+ readonly result: OutputHandle<'uint256'>;
266
+ }
267
+ interface CoreAsResourceOutputs {
268
+ readonly resource: OutputHandle<'resource'>;
269
+ }
270
+ interface CorePeekOutputs {
271
+ readonly result: OutputHandle<'uint256'>;
272
+ }
273
+ type GeneratedOps = {
274
+ readonly core: {
275
+ /** Split a resource into two outputs by basis-point ratio — original id: "core.split" */
276
+ readonly split: (nodeId: string, args: CoreSplitArgs) => CoreSplitOutputs;
277
+ /** Merge two same-token resources into one by addition — original id: "core.merge" */
278
+ readonly merge: (nodeId: string, args: CoreMergeArgs) => CoreMergeOutputs;
279
+ /** Add two unsigned integers (a + b) — original id: "core.add" */
280
+ readonly add: (nodeId: string, args: CoreAddArgs) => CoreAddOutputs;
281
+ /** Subtract b from a (a - b); reverts on underflow — original id: "core.subtract" */
282
+ readonly subtract: (nodeId: string, args: CoreSubtractArgs) => CoreSubtractOutputs;
283
+ /** Multiply two unsigned integers (a * b) — original id: "core.multiply" */
284
+ readonly multiply: (nodeId: string, args: CoreMultiplyArgs) => CoreMultiplyOutputs;
285
+ /** Divide a by b, rounding toward zero — original id: "core.divideDown" */
286
+ readonly divideDown: (nodeId: string, args: CoreDivideDownArgs) => CoreDivideDownOutputs;
287
+ /** Divide a by b, rounding away from zero — original id: "core.divideUp" */
288
+ readonly divideUp: (nodeId: string, args: CoreDivideUpArgs) => CoreDivideUpOutputs;
289
+ /** Multiply value by basis points and divide by 10000, rounding down — original id: "core.bpsDown" */
290
+ readonly bpsDown: (nodeId: string, args: CoreBpsDownArgs) => CoreBpsDownOutputs;
291
+ /** Multiply value by basis points and divide by 10000, rounding up — original id: "core.bpsUp" */
292
+ readonly bpsUp: (nodeId: string, args: CoreBpsUpArgs) => CoreBpsUpOutputs;
293
+ /** Assert a == b; reverts if not equal — original id: "core.assertEqual" */
294
+ readonly assertEqual: (nodeId: string, args: CoreAssertEqualArgs) => void;
295
+ /** Assert a != b; reverts if equal — original id: "core.assertNotEqual" */
296
+ readonly assertNotEqual: (nodeId: string, args: CoreAssertNotEqualArgs) => void;
297
+ /** Assert a > b; reverts if a <= b — original id: "core.assertGt" */
298
+ readonly assertGt: (nodeId: string, args: CoreAssertGtArgs) => void;
299
+ /** Assert a >= b; reverts if a < b — original id: "core.assertGte" */
300
+ readonly assertGte: (nodeId: string, args: CoreAssertGteArgs) => void;
301
+ /** Assert a < b; reverts if a >= b — original id: "core.assertLt" */
302
+ readonly assertLt: (nodeId: string, args: CoreAssertLtArgs) => void;
303
+ /** Assert a <= b; reverts if a > b — original id: "core.assertLte" */
304
+ readonly assertLte: (nodeId: string, args: CoreAssertLteArgs) => void;
305
+ /** Assert min <= value <= max; reverts if value is outside the range — original id: "core.assertInRange" */
306
+ readonly assertInRange: (nodeId: string, args: CoreAssertInRangeArgs) => void;
307
+ /** Approve an ERC20 spender for the given token and amount — original id: "core.approve" */
308
+ readonly approve: (nodeId: string, args: CoreApproveArgs) => void;
309
+ /** Read an ERC20 balance, producing a resource — original id: "core.balanceOf" */
310
+ readonly balanceOf: (nodeId: string, args: CoreBalanceOfArgs) => CoreBalanceOfOutputs;
311
+ /** Transfer tokens to a recipient address, optionally specifying a partial amount — original id: "core.transfer" */
312
+ readonly transfer: (nodeId: string, args: CoreTransferArgs) => CoreTransferOutputs;
313
+ /** Invoke a smart contract function, optionally spending a token resource — original id: "core.call" */
314
+ readonly call: <TSig extends string>(nodeId: string, args: CoreCallArgs<TSig>) => CoreCallResult<TSig>;
315
+ /** Read from a smart contract at runtime (StaticCall); result is fresh at execution time — original id: "core.staticCall" */
316
+ readonly staticCall: <TSig extends string>(nodeId: string, args: CoreStaticCallArgs<TSig>) => StaticCallResult<TSig>;
317
+ /** Invoke a contract with pre-encoded calldata — original id: "core.rawCall" */
318
+ readonly rawCall: (nodeId: string, args: CoreRawCallArgs) => CoreRawCallOutputs;
319
+ /** Graduate a raw handle to a resource, enabling slippage surfacing and linearity tracking — original id: "core.asResource" */
320
+ readonly asResource: (nodeId: string, args: CoreAsResourceArgs) => CoreAsResourceOutputs;
321
+ /** Read a smart contract value at compile time (off-chain eth_call); result is baked as a literal — original id: "core.peek" */
322
+ readonly peek: (nodeId: string, args: CorePeekArgs) => CorePeekOutputs;
323
+ };
324
+ readonly lifi: {
325
+ /** Swap tokens via the LI.FI aggregator API — original id: "lifi.swap" */
326
+ readonly swap: (nodeId: string, args: LifiSwapArgs) => LifiSwapOutputs;
327
+ /** Route tokens into a DeFi protocol position via the edge catalog — original id: "lifi.zap" */
328
+ readonly zap: (nodeId: string, args: LifiZapArgs) => LifiZapOutputs;
329
+ };
330
+ readonly invariant: {
331
+ /** Assert that an account holds at least a minimum token balance — original id: "invariant.balanceAtLeast" */
332
+ readonly balanceAtLeast: (nodeId: string, args: InvariantBalanceAtLeastArgs) => void;
333
+ };
334
+ };
335
+ declare const bindGeneratedOps: (builder: FlowBuilderInternal) => GeneratedOps;
336
+
337
+ export { type CoreAddArgs, type CoreAddOutputs, type CoreApproveArgs, type CoreAsResourceArgs, type CoreAsResourceOutputs, type CoreAssertEqualArgs, type CoreAssertGtArgs, type CoreAssertGteArgs, type CoreAssertInRangeArgs, type CoreAssertLtArgs, type CoreAssertLteArgs, type CoreAssertNotEqualArgs, type CoreBalanceOfArgs, type CoreBalanceOfOutputs, type CoreBpsDownArgs, type CoreBpsDownOutputs, type CoreBpsUpArgs, type CoreBpsUpOutputs, type CoreCallArgs, type CoreDivideDownArgs, type CoreDivideDownOutputs, type CoreDivideUpArgs, type CoreDivideUpOutputs, type CoreMergeArgs, type CoreMergeOutputs, type CoreMultiplyArgs, type CoreMultiplyOutputs, type CorePeekArgs, type CorePeekOutputs, type CoreRawCallArgs, type CoreRawCallOutputs, type CoreSplitArgs, type CoreSplitOutputs, type CoreStaticCallArgs, type CoreSubtractArgs, type CoreSubtractOutputs, type CoreTransferArgs, type CoreTransferOutputs, type GeneratedOps, type InvariantBalanceAtLeastArgs, type LifiSwapArgs, type LifiSwapOutputs, type LifiZapArgs, type LifiZapOutputs, bindGeneratedOps };