@lifi/compose-spec 0.2.0-staging.5 → 0.3.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/dist/index.d.ts CHANGED
@@ -2,24 +2,69 @@ import { Schema } from 'effect';
2
2
  import z from 'zod';
3
3
 
4
4
  declare const SolTypeSchema: Schema.Literal<["uint8", "uint16", "uint32", "uint64", "uint128", "uint256", "int128", "int256", "address", "bool", "bytes", "bytes4", "bytes32", "string"]>;
5
- declare const ResourceSchema: Schema.Union<[Schema.Struct<{
5
+ /**
6
+ * THE chain-capabilities chokepoint.
7
+ *
8
+ * `ResourceSchema` is a decode transform: it parses the plain `native | erc20`
9
+ * wire union (`RawResourceSchema`) and then runs `normalizeResource`, so on
10
+ * `as-erc20` chains (e.g. Tempo) a `{ kind: "native", chainId }` resource is
11
+ * rewritten to its ERC-20 form (PathUSD) before any application code sees it.
12
+ * Because every Resource-bearing schema embeds this one — `FlowSchema` for flow
13
+ * inputs, op `configSchema`s for op configs — making the schema itself
14
+ * chain-aware covers every parsed entry point in one place.
15
+ *
16
+ * The `encode` direction is the identity: the ERC-20 form is itself valid wire
17
+ * format, and the rewrite is deliberately not reversible (we never want to
18
+ * re-introduce a `native` resource when serialising). `JSONSchema.make` derives
19
+ * the published wire format from the encoded (`from`) side, so the manifest
20
+ * keeps advertising the plain union with both arms.
21
+ */
22
+ declare const ResourceSchema: Schema.transform<Schema.Union<[Schema.Struct<{
6
23
  kind: Schema.Literal<["native"]>;
7
24
  chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
8
25
  }>, Schema.Struct<{
9
26
  kind: Schema.Literal<["erc20"]>;
10
27
  token: typeof Schema.String;
11
28
  chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
12
- }>]>;
29
+ }>]>, Schema.SchemaClass<{
30
+ readonly kind: "native";
31
+ readonly chainId: number;
32
+ } | {
33
+ readonly token: string;
34
+ readonly kind: "erc20";
35
+ readonly chainId: number;
36
+ }, {
37
+ readonly kind: "native";
38
+ readonly chainId: number;
39
+ } | {
40
+ readonly token: string;
41
+ readonly kind: "erc20";
42
+ readonly chainId: number;
43
+ }, never>>;
13
44
  declare const ResourceInputSchema: Schema.Struct<{
14
45
  name: typeof Schema.String;
15
- resource: Schema.Union<[Schema.Struct<{
46
+ resource: Schema.transform<Schema.Union<[Schema.Struct<{
16
47
  kind: Schema.Literal<["native"]>;
17
48
  chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
18
49
  }>, Schema.Struct<{
19
50
  kind: Schema.Literal<["erc20"]>;
20
51
  token: typeof Schema.String;
21
52
  chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
22
- }>]>;
53
+ }>]>, Schema.SchemaClass<{
54
+ readonly kind: "native";
55
+ readonly chainId: number;
56
+ } | {
57
+ readonly token: string;
58
+ readonly kind: "erc20";
59
+ readonly chainId: number;
60
+ }, {
61
+ readonly kind: "native";
62
+ readonly chainId: number;
63
+ } | {
64
+ readonly token: string;
65
+ readonly kind: "erc20";
66
+ readonly chainId: number;
67
+ }, never>>;
23
68
  }>;
24
69
  declare const HandleInputSchema: Schema.Struct<{
25
70
  name: typeof Schema.String;
@@ -27,14 +72,28 @@ declare const HandleInputSchema: Schema.Struct<{
27
72
  }>;
28
73
  declare const FlowInputSchema: Schema.Union<[Schema.Struct<{
29
74
  name: typeof Schema.String;
30
- resource: Schema.Union<[Schema.Struct<{
75
+ resource: Schema.transform<Schema.Union<[Schema.Struct<{
31
76
  kind: Schema.Literal<["native"]>;
32
77
  chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
33
78
  }>, Schema.Struct<{
34
79
  kind: Schema.Literal<["erc20"]>;
35
80
  token: typeof Schema.String;
36
81
  chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
37
- }>]>;
82
+ }>]>, Schema.SchemaClass<{
83
+ readonly kind: "native";
84
+ readonly chainId: number;
85
+ } | {
86
+ readonly token: string;
87
+ readonly kind: "erc20";
88
+ readonly chainId: number;
89
+ }, {
90
+ readonly kind: "native";
91
+ readonly chainId: number;
92
+ } | {
93
+ readonly token: string;
94
+ readonly kind: "erc20";
95
+ readonly chainId: number;
96
+ }, never>>;
38
97
  }>, Schema.Struct<{
39
98
  name: typeof Schema.String;
40
99
  type: Schema.Literal<["uint8", "uint16", "uint32", "uint64", "uint128", "uint256", "int128", "int256", "address", "bool", "bytes", "bytes4", "bytes32", "string"]>;
@@ -89,14 +148,28 @@ declare const FlowSchema: Schema.Struct<{
89
148
  chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
90
149
  inputs: Schema.Array$<Schema.Union<[Schema.Struct<{
91
150
  name: typeof Schema.String;
92
- resource: Schema.Union<[Schema.Struct<{
151
+ resource: Schema.transform<Schema.Union<[Schema.Struct<{
93
152
  kind: Schema.Literal<["native"]>;
94
153
  chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
95
154
  }>, Schema.Struct<{
96
155
  kind: Schema.Literal<["erc20"]>;
97
156
  token: typeof Schema.String;
98
157
  chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
99
- }>]>;
158
+ }>]>, Schema.SchemaClass<{
159
+ readonly kind: "native";
160
+ readonly chainId: number;
161
+ } | {
162
+ readonly token: string;
163
+ readonly kind: "erc20";
164
+ readonly chainId: number;
165
+ }, {
166
+ readonly kind: "native";
167
+ readonly chainId: number;
168
+ } | {
169
+ readonly token: string;
170
+ readonly kind: "erc20";
171
+ readonly chainId: number;
172
+ }, never>>;
100
173
  }>, Schema.Struct<{
101
174
  name: typeof Schema.String;
102
175
  type: Schema.Literal<["uint8", "uint16", "uint32", "uint64", "uint128", "uint256", "int128", "int256", "address", "bool", "bytes", "bytes4", "bytes32", "string"]>;
@@ -122,10 +195,10 @@ declare const FlowSchema: Schema.Struct<{
122
195
  readonly value: typeof Schema.Unknown;
123
196
  }]>>>;
124
197
  }>>;
125
- continuation: Schema.optional<Schema.Struct<{
198
+ continuations: Schema.optional<Schema.Array$<Schema.Struct<{
126
199
  awaits: typeof Schema.String;
127
200
  flowId: typeof Schema.String;
128
- }>>;
201
+ }>>>;
129
202
  }>;
130
203
  type SolType = typeof SolTypeSchema.Type;
131
204
  type ResourceInput = typeof ResourceInputSchema.Type;
@@ -139,16 +212,578 @@ type Call = typeof CallSchema.Type;
139
212
  type Continuation = typeof ContinuationSchema.Type;
140
213
  type Flow = typeof FlowSchema.Type;
141
214
 
142
- type Availability = "now" | "future";
215
+ declare const CONTINUATION_COMMITMENT_OP_ID = "continuation.commitment";
216
+ declare const ContinuationOutcomeSchema: Schema.transform<Schema.Struct<{
217
+ token: typeof Schema.String;
218
+ minAmount: typeof Schema.String;
219
+ destination: typeof Schema.String;
220
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
221
+ }>, Schema.SchemaClass<{
222
+ readonly token: string;
223
+ readonly chainId: number;
224
+ readonly minAmount: string;
225
+ readonly destination: string;
226
+ }, {
227
+ readonly token: string;
228
+ readonly chainId: number;
229
+ readonly minAmount: string;
230
+ readonly destination: string;
231
+ }, never>>;
232
+ declare const ContinuationIntentSchema: Schema.Struct<{
233
+ outcomes: Schema.NonEmptyArray<Schema.transform<Schema.Struct<{
234
+ token: typeof Schema.String;
235
+ minAmount: typeof Schema.String;
236
+ destination: typeof Schema.String;
237
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
238
+ }>, Schema.SchemaClass<{
239
+ readonly token: string;
240
+ readonly chainId: number;
241
+ readonly minAmount: string;
242
+ readonly destination: string;
243
+ }, {
244
+ readonly token: string;
245
+ readonly chainId: number;
246
+ readonly minAmount: string;
247
+ readonly destination: string;
248
+ }, never>>>;
249
+ continuationFlow: Schema.optional<Schema.Struct<{
250
+ version: Schema.Literal<[1]>;
251
+ id: typeof Schema.String;
252
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
253
+ inputs: Schema.Array$<Schema.Union<[Schema.Struct<{
254
+ name: typeof Schema.String;
255
+ resource: Schema.transform<Schema.Union<[Schema.Struct<{
256
+ kind: Schema.Literal<["native"]>;
257
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
258
+ }>, Schema.Struct<{
259
+ kind: Schema.Literal<["erc20"]>;
260
+ token: typeof Schema.String;
261
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
262
+ }>]>, Schema.SchemaClass<{
263
+ readonly kind: "native";
264
+ readonly chainId: number;
265
+ } | {
266
+ readonly token: string;
267
+ readonly kind: "erc20";
268
+ readonly chainId: number;
269
+ }, {
270
+ readonly kind: "native";
271
+ readonly chainId: number;
272
+ } | {
273
+ readonly token: string;
274
+ readonly kind: "erc20";
275
+ readonly chainId: number;
276
+ }, never>>;
277
+ }>, Schema.Struct<{
278
+ name: typeof Schema.String;
279
+ type: Schema.Literal<["uint8", "uint16", "uint32", "uint64", "uint128", "uint256", "int128", "int256", "address", "bool", "bytes", "bytes4", "bytes32", "string"]>;
280
+ }>]>>;
281
+ nodes: Schema.Array$<Schema.Struct<{
282
+ id: typeof Schema.String;
283
+ op: typeof Schema.String;
284
+ bind: Schema.optionalWith<Schema.Record$<typeof Schema.String, Schema.Union<[Schema.Struct<{
285
+ $ref: Schema.filter<typeof Schema.String>;
286
+ }>, Schema.Struct<{
287
+ kind: Schema.Literal<["uint8", "uint16", "uint32", "uint64", "uint128", "uint256", "int128", "int256", "address", "bool", "bytes", "bytes4", "bytes32", "string"]>;
288
+ value: typeof Schema.String;
289
+ }>]>>, {
290
+ default: () => {};
291
+ }>;
292
+ config: Schema.optionalWith<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>, {
293
+ default: () => {};
294
+ }>;
295
+ guards: Schema.optional<Schema.Array$<Schema.TypeLiteral<{
296
+ kind: typeof Schema.String;
297
+ }, readonly [{
298
+ readonly key: typeof Schema.String;
299
+ readonly value: typeof Schema.Unknown;
300
+ }]>>>;
301
+ }>>;
302
+ continuations: Schema.optional<Schema.Array$<Schema.Struct<{
303
+ awaits: typeof Schema.String;
304
+ flowId: typeof Schema.String;
305
+ }>>>;
306
+ }>>;
307
+ validity: Schema.Struct<{
308
+ expiresAtMs: typeof Schema.Number;
309
+ }>;
310
+ perpetual: Schema.optional<typeof Schema.Boolean>;
311
+ provider: Schema.optional<typeof Schema.String>;
312
+ }>;
313
+ declare const Phase1ArtifactSchema: Schema.Union<[Schema.Struct<{
314
+ kind: Schema.Literal<["transaction"]>;
315
+ transactionRequest: Schema.optional<Schema.Struct<{
316
+ to: typeof Schema.String;
317
+ data: typeof Schema.String;
318
+ value: typeof Schema.String;
319
+ }>>;
320
+ }>, Schema.Struct<{
321
+ kind: Schema.Literal<["signables"]>;
322
+ typedData: Schema.Array$<typeof Schema.Unknown>;
323
+ }>, Schema.Struct<{
324
+ kind: Schema.Literal<["none"]>;
325
+ }>]>;
326
+ declare const HexStringSchema: Schema.filter<typeof Schema.String>;
327
+ declare const AssertionOwnerSchema: Schema.Union<[Schema.filter<typeof Schema.String>, Schema.Literal<["escrow", "delivery"]>]>;
328
+ type AssertionOwner = typeof AssertionOwnerSchema.Type;
329
+ declare const Erc20BalanceGteSpecSchema: Schema.Struct<{
330
+ kind: Schema.Literal<["erc20BalanceGte"]>;
331
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
332
+ token: Schema.filter<typeof Schema.String>;
333
+ owner: Schema.filter<typeof Schema.String>;
334
+ minAmount: typeof Schema.String;
335
+ }>;
336
+ declare const NativeBalanceGteSpecSchema: Schema.Struct<{
337
+ kind: Schema.Literal<["nativeBalanceGte"]>;
338
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
339
+ owner: Schema.filter<typeof Schema.String>;
340
+ minAmount: typeof Schema.String;
341
+ }>;
342
+ declare const CallCheckSpecSchema: Schema.Struct<{
343
+ kind: Schema.Literal<["call"]>;
344
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
345
+ to: Schema.filter<typeof Schema.String>;
346
+ calldata: Schema.filter<typeof Schema.String>;
347
+ comparator: Schema.Literal<["gte", "eq", "lte"]>;
348
+ value: typeof Schema.String;
349
+ }>;
350
+ declare const CheckSchema: Schema.transform<Schema.Union<[Schema.Struct<{
351
+ kind: Schema.Literal<["erc20BalanceGte"]>;
352
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
353
+ token: Schema.filter<typeof Schema.String>;
354
+ owner: Schema.filter<typeof Schema.String>;
355
+ minAmount: typeof Schema.String;
356
+ }>, Schema.Struct<{
357
+ kind: Schema.Literal<["nativeBalanceGte"]>;
358
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
359
+ owner: Schema.filter<typeof Schema.String>;
360
+ minAmount: typeof Schema.String;
361
+ }>, Schema.Struct<{
362
+ kind: Schema.Literal<["call"]>;
363
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
364
+ to: Schema.filter<typeof Schema.String>;
365
+ calldata: Schema.filter<typeof Schema.String>;
366
+ comparator: Schema.Literal<["gte", "eq", "lte"]>;
367
+ value: typeof Schema.String;
368
+ }>]>, Schema.SchemaClass<{
369
+ readonly token: string;
370
+ readonly kind: "erc20BalanceGte";
371
+ readonly chainId: number;
372
+ readonly minAmount: string;
373
+ readonly owner: string;
374
+ } | {
375
+ readonly kind: "nativeBalanceGte";
376
+ readonly chainId: number;
377
+ readonly minAmount: string;
378
+ readonly owner: string;
379
+ } | {
380
+ readonly kind: "call";
381
+ readonly chainId: number;
382
+ readonly value: string;
383
+ readonly to: string;
384
+ readonly calldata: string;
385
+ readonly comparator: "gte" | "eq" | "lte";
386
+ }, {
387
+ readonly token: string;
388
+ readonly kind: "erc20BalanceGte";
389
+ readonly chainId: number;
390
+ readonly minAmount: string;
391
+ readonly owner: string;
392
+ } | {
393
+ readonly kind: "nativeBalanceGte";
394
+ readonly chainId: number;
395
+ readonly minAmount: string;
396
+ readonly owner: string;
397
+ } | {
398
+ readonly kind: "call";
399
+ readonly chainId: number;
400
+ readonly value: string;
401
+ readonly to: string;
402
+ readonly calldata: string;
403
+ readonly comparator: "gte" | "eq" | "lte";
404
+ }, never>>;
405
+ declare const Erc20BalanceDeltaGteSpecSchema: Schema.Struct<{
406
+ kind: Schema.Literal<["erc20BalanceDeltaGte"]>;
407
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
408
+ token: Schema.filter<typeof Schema.String>;
409
+ owner: Schema.Union<[Schema.filter<typeof Schema.String>, Schema.Literal<["escrow", "delivery"]>]>;
410
+ minDelta: typeof Schema.String;
411
+ }>;
412
+ declare const NativeBalanceDeltaGteSpecSchema: Schema.Struct<{
413
+ kind: Schema.Literal<["nativeBalanceDeltaGte"]>;
414
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
415
+ owner: Schema.Union<[Schema.filter<typeof Schema.String>, Schema.Literal<["escrow", "delivery"]>]>;
416
+ minDelta: typeof Schema.String;
417
+ }>;
418
+ declare const AssertionSpecSchema: Schema.Union<[Schema.Struct<{
419
+ kind: Schema.Literal<["erc20BalanceGte"]>;
420
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
421
+ token: Schema.filter<typeof Schema.String>;
422
+ owner: Schema.filter<typeof Schema.String>;
423
+ minAmount: typeof Schema.String;
424
+ }>, Schema.Struct<{
425
+ kind: Schema.Literal<["nativeBalanceGte"]>;
426
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
427
+ owner: Schema.filter<typeof Schema.String>;
428
+ minAmount: typeof Schema.String;
429
+ }>, Schema.Struct<{
430
+ kind: Schema.Literal<["call"]>;
431
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
432
+ to: Schema.filter<typeof Schema.String>;
433
+ calldata: Schema.filter<typeof Schema.String>;
434
+ comparator: Schema.Literal<["gte", "eq", "lte"]>;
435
+ value: typeof Schema.String;
436
+ }>, Schema.Struct<{
437
+ kind: Schema.Literal<["erc20BalanceDeltaGte"]>;
438
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
439
+ token: Schema.filter<typeof Schema.String>;
440
+ owner: Schema.Union<[Schema.filter<typeof Schema.String>, Schema.Literal<["escrow", "delivery"]>]>;
441
+ minDelta: typeof Schema.String;
442
+ }>, Schema.Struct<{
443
+ kind: Schema.Literal<["nativeBalanceDeltaGte"]>;
444
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
445
+ owner: Schema.Union<[Schema.filter<typeof Schema.String>, Schema.Literal<["escrow", "delivery"]>]>;
446
+ minDelta: typeof Schema.String;
447
+ }>]>;
448
+ declare const ContinuationPlanSchema: Schema.Struct<{
449
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
450
+ nextFlow: Schema.Struct<{
451
+ version: Schema.Literal<[1]>;
452
+ id: typeof Schema.String;
453
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
454
+ inputs: Schema.Array$<Schema.Union<[Schema.Struct<{
455
+ name: typeof Schema.String;
456
+ resource: Schema.transform<Schema.Union<[Schema.Struct<{
457
+ kind: Schema.Literal<["native"]>;
458
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
459
+ }>, Schema.Struct<{
460
+ kind: Schema.Literal<["erc20"]>;
461
+ token: typeof Schema.String;
462
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
463
+ }>]>, Schema.SchemaClass<{
464
+ readonly kind: "native";
465
+ readonly chainId: number;
466
+ } | {
467
+ readonly token: string;
468
+ readonly kind: "erc20";
469
+ readonly chainId: number;
470
+ }, {
471
+ readonly kind: "native";
472
+ readonly chainId: number;
473
+ } | {
474
+ readonly token: string;
475
+ readonly kind: "erc20";
476
+ readonly chainId: number;
477
+ }, never>>;
478
+ }>, Schema.Struct<{
479
+ name: typeof Schema.String;
480
+ type: Schema.Literal<["uint8", "uint16", "uint32", "uint64", "uint128", "uint256", "int128", "int256", "address", "bool", "bytes", "bytes4", "bytes32", "string"]>;
481
+ }>]>>;
482
+ nodes: Schema.Array$<Schema.Struct<{
483
+ id: typeof Schema.String;
484
+ op: typeof Schema.String;
485
+ bind: Schema.optionalWith<Schema.Record$<typeof Schema.String, Schema.Union<[Schema.Struct<{
486
+ $ref: Schema.filter<typeof Schema.String>;
487
+ }>, Schema.Struct<{
488
+ kind: Schema.Literal<["uint8", "uint16", "uint32", "uint64", "uint128", "uint256", "int128", "int256", "address", "bool", "bytes", "bytes4", "bytes32", "string"]>;
489
+ value: typeof Schema.String;
490
+ }>]>>, {
491
+ default: () => {};
492
+ }>;
493
+ config: Schema.optionalWith<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>, {
494
+ default: () => {};
495
+ }>;
496
+ guards: Schema.optional<Schema.Array$<Schema.TypeLiteral<{
497
+ kind: typeof Schema.String;
498
+ }, readonly [{
499
+ readonly key: typeof Schema.String;
500
+ readonly value: typeof Schema.Unknown;
501
+ }]>>>;
502
+ }>>;
503
+ continuations: Schema.optional<Schema.Array$<Schema.Struct<{
504
+ awaits: typeof Schema.String;
505
+ flowId: typeof Schema.String;
506
+ }>>>;
507
+ }>;
508
+ check: Schema.transform<Schema.Union<[Schema.Struct<{
509
+ kind: Schema.Literal<["erc20BalanceGte"]>;
510
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
511
+ token: Schema.filter<typeof Schema.String>;
512
+ owner: Schema.filter<typeof Schema.String>;
513
+ minAmount: typeof Schema.String;
514
+ }>, Schema.Struct<{
515
+ kind: Schema.Literal<["nativeBalanceGte"]>;
516
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
517
+ owner: Schema.filter<typeof Schema.String>;
518
+ minAmount: typeof Schema.String;
519
+ }>, Schema.Struct<{
520
+ kind: Schema.Literal<["call"]>;
521
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
522
+ to: Schema.filter<typeof Schema.String>;
523
+ calldata: Schema.filter<typeof Schema.String>;
524
+ comparator: Schema.Literal<["gte", "eq", "lte"]>;
525
+ value: typeof Schema.String;
526
+ }>]>, Schema.SchemaClass<{
527
+ readonly token: string;
528
+ readonly kind: "erc20BalanceGte";
529
+ readonly chainId: number;
530
+ readonly minAmount: string;
531
+ readonly owner: string;
532
+ } | {
533
+ readonly kind: "nativeBalanceGte";
534
+ readonly chainId: number;
535
+ readonly minAmount: string;
536
+ readonly owner: string;
537
+ } | {
538
+ readonly kind: "call";
539
+ readonly chainId: number;
540
+ readonly value: string;
541
+ readonly to: string;
542
+ readonly calldata: string;
543
+ readonly comparator: "gte" | "eq" | "lte";
544
+ }, {
545
+ readonly token: string;
546
+ readonly kind: "erc20BalanceGte";
547
+ readonly chainId: number;
548
+ readonly minAmount: string;
549
+ readonly owner: string;
550
+ } | {
551
+ readonly kind: "nativeBalanceGte";
552
+ readonly chainId: number;
553
+ readonly minAmount: string;
554
+ readonly owner: string;
555
+ } | {
556
+ readonly kind: "call";
557
+ readonly chainId: number;
558
+ readonly value: string;
559
+ readonly to: string;
560
+ readonly calldata: string;
561
+ readonly comparator: "gte" | "eq" | "lte";
562
+ }, never>>;
563
+ validity: Schema.Struct<{
564
+ expiresAtMs: typeof Schema.Number;
565
+ }>;
566
+ correlationId: Schema.optional<typeof Schema.String>;
567
+ }>;
568
+ type ContinuationOutcome = typeof ContinuationOutcomeSchema.Type;
569
+ type ContinuationIntent = typeof ContinuationIntentSchema.Type;
570
+ type Phase1Artifact = typeof Phase1ArtifactSchema.Type;
571
+ type Check = typeof CheckSchema.Type;
572
+ type AssertionSpec = typeof AssertionSpecSchema.Type;
573
+ type ContinuationPlan = typeof ContinuationPlanSchema.Type;
574
+ type CheckComparator = 'gte' | 'eq' | 'lte';
575
+ declare const isGTECheck: (check: Check) => boolean;
576
+ declare const isLTECheck: (check: Check) => boolean;
577
+ declare const isEQCheck: (check: Check) => boolean;
578
+
579
+ declare const Bytes32HexSchema: Schema.filter<typeof Schema.String>;
580
+ declare const AssertedErc20BalanceGteSpecSchema: Schema.Struct<{
581
+ kind: Schema.Literal<["erc20BalanceGte"]>;
582
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
583
+ token: Schema.filter<typeof Schema.String>;
584
+ owner: Schema.Union<[Schema.filter<typeof Schema.String>, Schema.Literal<["escrow", "delivery"]>]>;
585
+ minAmount: typeof Schema.String;
586
+ }>;
587
+ declare const AssertedNativeBalanceGteSpecSchema: Schema.Struct<{
588
+ kind: Schema.Literal<["nativeBalanceGte"]>;
589
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
590
+ owner: Schema.Union<[Schema.filter<typeof Schema.String>, Schema.Literal<["escrow", "delivery"]>]>;
591
+ minAmount: typeof Schema.String;
592
+ }>;
593
+ declare const AssertedPredicateSchema: Schema.transform<Schema.Union<[Schema.Struct<{
594
+ kind: Schema.Literal<["erc20BalanceGte"]>;
595
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
596
+ token: Schema.filter<typeof Schema.String>;
597
+ owner: Schema.Union<[Schema.filter<typeof Schema.String>, Schema.Literal<["escrow", "delivery"]>]>;
598
+ minAmount: typeof Schema.String;
599
+ }>, Schema.Struct<{
600
+ kind: Schema.Literal<["nativeBalanceGte"]>;
601
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
602
+ owner: Schema.Union<[Schema.filter<typeof Schema.String>, Schema.Literal<["escrow", "delivery"]>]>;
603
+ minAmount: typeof Schema.String;
604
+ }>, Schema.Struct<{
605
+ kind: Schema.Literal<["call"]>;
606
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
607
+ to: Schema.filter<typeof Schema.String>;
608
+ calldata: Schema.filter<typeof Schema.String>;
609
+ comparator: Schema.Literal<["gte", "eq", "lte"]>;
610
+ value: typeof Schema.String;
611
+ }>, Schema.Struct<{
612
+ kind: Schema.Literal<["erc20BalanceDeltaGte"]>;
613
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
614
+ token: Schema.filter<typeof Schema.String>;
615
+ owner: Schema.Union<[Schema.filter<typeof Schema.String>, Schema.Literal<["escrow", "delivery"]>]>;
616
+ minDelta: typeof Schema.String;
617
+ }>, Schema.Struct<{
618
+ kind: Schema.Literal<["nativeBalanceDeltaGte"]>;
619
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
620
+ owner: Schema.Union<[Schema.filter<typeof Schema.String>, Schema.Literal<["escrow", "delivery"]>]>;
621
+ minDelta: typeof Schema.String;
622
+ }>]>, Schema.SchemaClass<{
623
+ readonly kind: "call";
624
+ readonly chainId: number;
625
+ readonly value: string;
626
+ readonly to: string;
627
+ readonly calldata: string;
628
+ readonly comparator: "gte" | "eq" | "lte";
629
+ } | {
630
+ readonly token: string;
631
+ readonly kind: "erc20BalanceDeltaGte";
632
+ readonly chainId: number;
633
+ readonly owner: string;
634
+ readonly minDelta: string;
635
+ } | {
636
+ readonly kind: "nativeBalanceDeltaGte";
637
+ readonly chainId: number;
638
+ readonly owner: string;
639
+ readonly minDelta: string;
640
+ } | {
641
+ readonly token: string;
642
+ readonly kind: "erc20BalanceGte";
643
+ readonly chainId: number;
644
+ readonly minAmount: string;
645
+ readonly owner: string;
646
+ } | {
647
+ readonly kind: "nativeBalanceGte";
648
+ readonly chainId: number;
649
+ readonly minAmount: string;
650
+ readonly owner: string;
651
+ }, {
652
+ readonly kind: "call";
653
+ readonly chainId: number;
654
+ readonly value: string;
655
+ readonly to: string;
656
+ readonly calldata: string;
657
+ readonly comparator: "gte" | "eq" | "lte";
658
+ } | {
659
+ readonly token: string;
660
+ readonly kind: "erc20BalanceDeltaGte";
661
+ readonly chainId: number;
662
+ readonly owner: string;
663
+ readonly minDelta: string;
664
+ } | {
665
+ readonly kind: "nativeBalanceDeltaGte";
666
+ readonly chainId: number;
667
+ readonly owner: string;
668
+ readonly minDelta: string;
669
+ } | {
670
+ readonly token: string;
671
+ readonly kind: "erc20BalanceGte";
672
+ readonly chainId: number;
673
+ readonly minAmount: string;
674
+ readonly owner: string;
675
+ } | {
676
+ readonly kind: "nativeBalanceGte";
677
+ readonly chainId: number;
678
+ readonly minAmount: string;
679
+ readonly owner: string;
680
+ }, never>>;
681
+ declare const VerificationDescriptorSchema: Schema.Struct<{
682
+ validationProgramHash: Schema.filter<typeof Schema.String>;
683
+ paramsHash: Schema.filter<typeof Schema.String>;
684
+ assertedPredicate: Schema.Array$<Schema.transform<Schema.Union<[Schema.Struct<{
685
+ kind: Schema.Literal<["erc20BalanceGte"]>;
686
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
687
+ token: Schema.filter<typeof Schema.String>;
688
+ owner: Schema.Union<[Schema.filter<typeof Schema.String>, Schema.Literal<["escrow", "delivery"]>]>;
689
+ minAmount: typeof Schema.String;
690
+ }>, Schema.Struct<{
691
+ kind: Schema.Literal<["nativeBalanceGte"]>;
692
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
693
+ owner: Schema.Union<[Schema.filter<typeof Schema.String>, Schema.Literal<["escrow", "delivery"]>]>;
694
+ minAmount: typeof Schema.String;
695
+ }>, Schema.Struct<{
696
+ kind: Schema.Literal<["call"]>;
697
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
698
+ to: Schema.filter<typeof Schema.String>;
699
+ calldata: Schema.filter<typeof Schema.String>;
700
+ comparator: Schema.Literal<["gte", "eq", "lte"]>;
701
+ value: typeof Schema.String;
702
+ }>, Schema.Struct<{
703
+ kind: Schema.Literal<["erc20BalanceDeltaGte"]>;
704
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
705
+ token: Schema.filter<typeof Schema.String>;
706
+ owner: Schema.Union<[Schema.filter<typeof Schema.String>, Schema.Literal<["escrow", "delivery"]>]>;
707
+ minDelta: typeof Schema.String;
708
+ }>, Schema.Struct<{
709
+ kind: Schema.Literal<["nativeBalanceDeltaGte"]>;
710
+ chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
711
+ owner: Schema.Union<[Schema.filter<typeof Schema.String>, Schema.Literal<["escrow", "delivery"]>]>;
712
+ minDelta: typeof Schema.String;
713
+ }>]>, Schema.SchemaClass<{
714
+ readonly kind: "call";
715
+ readonly chainId: number;
716
+ readonly value: string;
717
+ readonly to: string;
718
+ readonly calldata: string;
719
+ readonly comparator: "gte" | "eq" | "lte";
720
+ } | {
721
+ readonly token: string;
722
+ readonly kind: "erc20BalanceDeltaGte";
723
+ readonly chainId: number;
724
+ readonly owner: string;
725
+ readonly minDelta: string;
726
+ } | {
727
+ readonly kind: "nativeBalanceDeltaGte";
728
+ readonly chainId: number;
729
+ readonly owner: string;
730
+ readonly minDelta: string;
731
+ } | {
732
+ readonly token: string;
733
+ readonly kind: "erc20BalanceGte";
734
+ readonly chainId: number;
735
+ readonly minAmount: string;
736
+ readonly owner: string;
737
+ } | {
738
+ readonly kind: "nativeBalanceGte";
739
+ readonly chainId: number;
740
+ readonly minAmount: string;
741
+ readonly owner: string;
742
+ }, {
743
+ readonly kind: "call";
744
+ readonly chainId: number;
745
+ readonly value: string;
746
+ readonly to: string;
747
+ readonly calldata: string;
748
+ readonly comparator: "gte" | "eq" | "lte";
749
+ } | {
750
+ readonly token: string;
751
+ readonly kind: "erc20BalanceDeltaGte";
752
+ readonly chainId: number;
753
+ readonly owner: string;
754
+ readonly minDelta: string;
755
+ } | {
756
+ readonly kind: "nativeBalanceDeltaGte";
757
+ readonly chainId: number;
758
+ readonly owner: string;
759
+ readonly minDelta: string;
760
+ } | {
761
+ readonly token: string;
762
+ readonly kind: "erc20BalanceGte";
763
+ readonly chainId: number;
764
+ readonly minAmount: string;
765
+ readonly owner: string;
766
+ } | {
767
+ readonly kind: "nativeBalanceGte";
768
+ readonly chainId: number;
769
+ readonly minAmount: string;
770
+ readonly owner: string;
771
+ }, never>>>;
772
+ }>;
773
+ declare const canonicalAssertedPredicate: (specs: readonly AssertionSpec[]) => string;
774
+ type VerificationDescriptor = typeof VerificationDescriptorSchema.Type;
775
+ type AssertedPredicate = AssertionSpec;
776
+
777
+ type Availability = 'now' | 'future';
143
778
  interface OutputAmount {
144
779
  readonly expected: bigint;
145
780
  readonly min?: bigint;
146
781
  }
147
782
  type Resource = {
148
- readonly kind: "native";
783
+ readonly kind: 'native';
149
784
  readonly chainId: number;
150
785
  } | {
151
- readonly kind: "erc20";
786
+ readonly kind: 'erc20';
152
787
  readonly token: string;
153
788
  readonly chainId: number;
154
789
  };
@@ -174,98 +809,10 @@ declare const foldResource: <R>(r: Resource, cases: {
174
809
  readonly native: (chainId: number) => R;
175
810
  readonly erc20: (token: string, chainId: number) => R;
176
811
  }) => R;
812
+ declare const resourceToken: (r: Resource) => string;
177
813
  declare const resourceKey: (r: Resource) => string;
178
814
  declare const erc20Token: (r: Resource) => string;
179
815
 
180
- type SimulationPolicy = "strict" | "allow-revert";
181
- /**
182
- * Destination for sweeping proxy-held terminal resources after execution.
183
- * Either a literal EVM address or a `{ $ref }` context reference
184
- * (e.g. `{ $ref: "context.sender" }`).
185
- */
186
- type SweepTo = string | {
187
- readonly $ref: string;
188
- };
189
- interface ComposeRun {
190
- readonly inputs: Record<string, InputSpec>;
191
- readonly preconditions?: readonly Precondition[];
192
- readonly signer: string;
193
- readonly assumptions?: Record<string, bigint>;
194
- readonly referrer?: string;
195
- readonly integratorFeeBps?: number;
196
- readonly maxPriceImpactBps?: number;
197
- readonly sweepTo?: SweepTo;
198
- readonly simulationPolicy?: SimulationPolicy;
199
- readonly checkOnChainAllowances?: boolean;
200
- }
201
- interface ComposeCompileRequest {
202
- readonly flow: Flow;
203
- readonly run: ComposeRun;
204
- }
205
- interface PriceImpact {
206
- readonly inputValueUsd: number;
207
- readonly outputValueUsd: number;
208
- readonly impactBps: number;
209
- readonly unpricedInputs: readonly string[];
210
- readonly unpricedOutputs: readonly string[];
211
- }
212
- interface ApprovalEntry {
213
- readonly token: string;
214
- readonly spender: string;
215
- readonly amount: string;
216
- readonly transactionRequest: {
217
- readonly to: string;
218
- readonly data: string;
219
- readonly value: "0";
220
- };
221
- }
222
- interface SimulationRevert {
223
- readonly code: number;
224
- readonly rawErrorBytes: string;
225
- readonly decodeResult?: {
226
- readonly errorCandidates?: readonly {
227
- readonly decodedErrorSignature: string;
228
- readonly decodedParams: readonly string[];
229
- }[];
230
- readonly error?: string;
231
- };
232
- }
233
- interface ComposeTransactionRequest {
234
- readonly to: string;
235
- readonly data: string;
236
- readonly value: string;
237
- readonly gasLimit?: string;
238
- }
239
- interface ComposeContinuation {
240
- readonly awaits: string;
241
- readonly flowId: string;
242
- }
243
- interface ComposeCompileSuccessData {
244
- readonly producedResources: Record<string, ProducedResource>;
245
- readonly transactionRequest: ComposeTransactionRequest;
246
- readonly userProxy: string;
247
- readonly priceImpact?: PriceImpact;
248
- readonly approvals?: readonly ApprovalEntry[];
249
- readonly continuation?: ComposeContinuation;
250
- }
251
- interface ComposeCompilePartialData {
252
- readonly producedResources: Record<string, ProducedResource>;
253
- readonly transactionRequest: ComposeTransactionRequest;
254
- readonly userProxy: string;
255
- readonly simulationRevert: SimulationRevert;
256
- readonly approvals?: readonly ApprovalEntry[];
257
- readonly continuation?: ComposeContinuation;
258
- }
259
- type ComposeCompileResult = (ComposeCompileSuccessData & {
260
- readonly status: "success";
261
- }) | (ComposeCompilePartialData & {
262
- readonly status: "partial";
263
- readonly error: {
264
- readonly kind: string;
265
- readonly message: string;
266
- };
267
- });
268
-
269
816
  declare const ResourcePortZod: z.ZodObject<{
270
817
  kind: z.ZodLiteral<"resource">;
271
818
  name: z.ZodString;
@@ -830,6 +1377,390 @@ declare const ComposeManifestZod: z.ZodObject<{
830
1377
  configSchema: z.ZodOptional<z.ZodUnknown>;
831
1378
  }, z.core.$strip>>>;
832
1379
  }, z.core.$strip>;
1380
+ declare const Phase1ArtifactZod: z.ZodDiscriminatedUnion<[z.ZodObject<{
1381
+ kind: z.ZodLiteral<"transaction">;
1382
+ transactionRequest: z.ZodOptional<z.ZodObject<{
1383
+ to: z.ZodString;
1384
+ data: z.ZodString;
1385
+ value: z.ZodString;
1386
+ }, z.core.$strip>>;
1387
+ }, z.core.$strip>, z.ZodObject<{
1388
+ kind: z.ZodLiteral<"signables">;
1389
+ typedData: z.ZodArray<z.ZodUnknown>;
1390
+ }, z.core.$strip>, z.ZodObject<{
1391
+ kind: z.ZodLiteral<"none">;
1392
+ }, z.core.$strip>], "kind">;
1393
+ declare const CheckZod: z.ZodDiscriminatedUnion<[z.ZodObject<{
1394
+ kind: z.ZodLiteral<"erc20BalanceGte">;
1395
+ chainId: z.ZodNumber;
1396
+ token: z.ZodString;
1397
+ owner: z.ZodString;
1398
+ minAmount: z.ZodString;
1399
+ }, z.core.$strip>, z.ZodObject<{
1400
+ kind: z.ZodLiteral<"nativeBalanceGte">;
1401
+ chainId: z.ZodNumber;
1402
+ owner: z.ZodString;
1403
+ minAmount: z.ZodString;
1404
+ }, z.core.$strip>, z.ZodObject<{
1405
+ kind: z.ZodLiteral<"call">;
1406
+ chainId: z.ZodNumber;
1407
+ to: z.ZodString;
1408
+ calldata: z.ZodString;
1409
+ comparator: z.ZodEnum<{
1410
+ gte: "gte";
1411
+ eq: "eq";
1412
+ lte: "lte";
1413
+ }>;
1414
+ value: z.ZodString;
1415
+ }, z.core.$strip>], "kind">;
1416
+ declare const AssertionSpecZod: z.ZodDiscriminatedUnion<[z.ZodObject<{
1417
+ kind: z.ZodLiteral<"erc20BalanceGte">;
1418
+ chainId: z.ZodNumber;
1419
+ token: z.ZodString;
1420
+ owner: z.ZodString;
1421
+ minAmount: z.ZodString;
1422
+ }, z.core.$strip>, z.ZodObject<{
1423
+ kind: z.ZodLiteral<"nativeBalanceGte">;
1424
+ chainId: z.ZodNumber;
1425
+ owner: z.ZodString;
1426
+ minAmount: z.ZodString;
1427
+ }, z.core.$strip>, z.ZodObject<{
1428
+ kind: z.ZodLiteral<"call">;
1429
+ chainId: z.ZodNumber;
1430
+ to: z.ZodString;
1431
+ calldata: z.ZodString;
1432
+ comparator: z.ZodEnum<{
1433
+ gte: "gte";
1434
+ eq: "eq";
1435
+ lte: "lte";
1436
+ }>;
1437
+ value: z.ZodString;
1438
+ }, z.core.$strip>, z.ZodObject<{
1439
+ kind: z.ZodLiteral<"erc20BalanceDeltaGte">;
1440
+ chainId: z.ZodNumber;
1441
+ token: z.ZodString;
1442
+ owner: z.ZodUnion<readonly [z.ZodString, z.ZodEnum<{
1443
+ escrow: "escrow";
1444
+ delivery: "delivery";
1445
+ }>]>;
1446
+ minDelta: z.ZodString;
1447
+ }, z.core.$strip>, z.ZodObject<{
1448
+ kind: z.ZodLiteral<"nativeBalanceDeltaGte">;
1449
+ chainId: z.ZodNumber;
1450
+ owner: z.ZodUnion<readonly [z.ZodString, z.ZodEnum<{
1451
+ escrow: "escrow";
1452
+ delivery: "delivery";
1453
+ }>]>;
1454
+ minDelta: z.ZodString;
1455
+ }, z.core.$strip>], "kind">;
1456
+ type AssertionSpecWire = z.infer<typeof AssertionSpecZod>;
1457
+ declare const AssertedPredicateZod: z.ZodDiscriminatedUnion<[z.ZodObject<{
1458
+ kind: z.ZodLiteral<"erc20BalanceGte">;
1459
+ chainId: z.ZodNumber;
1460
+ token: z.ZodString;
1461
+ owner: z.ZodUnion<readonly [z.ZodString, z.ZodEnum<{
1462
+ escrow: "escrow";
1463
+ delivery: "delivery";
1464
+ }>]>;
1465
+ minAmount: z.ZodString;
1466
+ }, z.core.$strip>, z.ZodObject<{
1467
+ kind: z.ZodLiteral<"nativeBalanceGte">;
1468
+ chainId: z.ZodNumber;
1469
+ owner: z.ZodUnion<readonly [z.ZodString, z.ZodEnum<{
1470
+ escrow: "escrow";
1471
+ delivery: "delivery";
1472
+ }>]>;
1473
+ minAmount: z.ZodString;
1474
+ }, z.core.$strip>, z.ZodObject<{
1475
+ kind: z.ZodLiteral<"erc20BalanceGte">;
1476
+ chainId: z.ZodNumber;
1477
+ token: z.ZodString;
1478
+ owner: z.ZodString;
1479
+ minAmount: z.ZodString;
1480
+ }, z.core.$strip> | z.ZodObject<{
1481
+ kind: z.ZodLiteral<"nativeBalanceGte">;
1482
+ chainId: z.ZodNumber;
1483
+ owner: z.ZodString;
1484
+ minAmount: z.ZodString;
1485
+ }, z.core.$strip> | z.ZodObject<{
1486
+ kind: z.ZodLiteral<"call">;
1487
+ chainId: z.ZodNumber;
1488
+ to: z.ZodString;
1489
+ calldata: z.ZodString;
1490
+ comparator: z.ZodEnum<{
1491
+ gte: "gte";
1492
+ eq: "eq";
1493
+ lte: "lte";
1494
+ }>;
1495
+ value: z.ZodString;
1496
+ }, z.core.$strip> | z.ZodObject<{
1497
+ kind: z.ZodLiteral<"erc20BalanceDeltaGte">;
1498
+ chainId: z.ZodNumber;
1499
+ token: z.ZodString;
1500
+ owner: z.ZodUnion<readonly [z.ZodString, z.ZodEnum<{
1501
+ escrow: "escrow";
1502
+ delivery: "delivery";
1503
+ }>]>;
1504
+ minDelta: z.ZodString;
1505
+ }, z.core.$strip> | z.ZodObject<{
1506
+ kind: z.ZodLiteral<"nativeBalanceDeltaGte">;
1507
+ chainId: z.ZodNumber;
1508
+ owner: z.ZodUnion<readonly [z.ZodString, z.ZodEnum<{
1509
+ escrow: "escrow";
1510
+ delivery: "delivery";
1511
+ }>]>;
1512
+ minDelta: z.ZodString;
1513
+ }, z.core.$strip>, z.ZodObject<{
1514
+ kind: z.ZodLiteral<"erc20BalanceGte">;
1515
+ chainId: z.ZodNumber;
1516
+ token: z.ZodString;
1517
+ owner: z.ZodString;
1518
+ minAmount: z.ZodString;
1519
+ }, z.core.$strip> | z.ZodObject<{
1520
+ kind: z.ZodLiteral<"nativeBalanceGte">;
1521
+ chainId: z.ZodNumber;
1522
+ owner: z.ZodString;
1523
+ minAmount: z.ZodString;
1524
+ }, z.core.$strip> | z.ZodObject<{
1525
+ kind: z.ZodLiteral<"call">;
1526
+ chainId: z.ZodNumber;
1527
+ to: z.ZodString;
1528
+ calldata: z.ZodString;
1529
+ comparator: z.ZodEnum<{
1530
+ gte: "gte";
1531
+ eq: "eq";
1532
+ lte: "lte";
1533
+ }>;
1534
+ value: z.ZodString;
1535
+ }, z.core.$strip> | z.ZodObject<{
1536
+ kind: z.ZodLiteral<"erc20BalanceDeltaGte">;
1537
+ chainId: z.ZodNumber;
1538
+ token: z.ZodString;
1539
+ owner: z.ZodUnion<readonly [z.ZodString, z.ZodEnum<{
1540
+ escrow: "escrow";
1541
+ delivery: "delivery";
1542
+ }>]>;
1543
+ minDelta: z.ZodString;
1544
+ }, z.core.$strip> | z.ZodObject<{
1545
+ kind: z.ZodLiteral<"nativeBalanceDeltaGte">;
1546
+ chainId: z.ZodNumber;
1547
+ owner: z.ZodUnion<readonly [z.ZodString, z.ZodEnum<{
1548
+ escrow: "escrow";
1549
+ delivery: "delivery";
1550
+ }>]>;
1551
+ minDelta: z.ZodString;
1552
+ }, z.core.$strip>, z.ZodObject<{
1553
+ kind: z.ZodLiteral<"erc20BalanceGte">;
1554
+ chainId: z.ZodNumber;
1555
+ token: z.ZodString;
1556
+ owner: z.ZodString;
1557
+ minAmount: z.ZodString;
1558
+ }, z.core.$strip> | z.ZodObject<{
1559
+ kind: z.ZodLiteral<"nativeBalanceGte">;
1560
+ chainId: z.ZodNumber;
1561
+ owner: z.ZodString;
1562
+ minAmount: z.ZodString;
1563
+ }, z.core.$strip> | z.ZodObject<{
1564
+ kind: z.ZodLiteral<"call">;
1565
+ chainId: z.ZodNumber;
1566
+ to: z.ZodString;
1567
+ calldata: z.ZodString;
1568
+ comparator: z.ZodEnum<{
1569
+ gte: "gte";
1570
+ eq: "eq";
1571
+ lte: "lte";
1572
+ }>;
1573
+ value: z.ZodString;
1574
+ }, z.core.$strip> | z.ZodObject<{
1575
+ kind: z.ZodLiteral<"erc20BalanceDeltaGte">;
1576
+ chainId: z.ZodNumber;
1577
+ token: z.ZodString;
1578
+ owner: z.ZodUnion<readonly [z.ZodString, z.ZodEnum<{
1579
+ escrow: "escrow";
1580
+ delivery: "delivery";
1581
+ }>]>;
1582
+ minDelta: z.ZodString;
1583
+ }, z.core.$strip> | z.ZodObject<{
1584
+ kind: z.ZodLiteral<"nativeBalanceDeltaGte">;
1585
+ chainId: z.ZodNumber;
1586
+ owner: z.ZodUnion<readonly [z.ZodString, z.ZodEnum<{
1587
+ escrow: "escrow";
1588
+ delivery: "delivery";
1589
+ }>]>;
1590
+ minDelta: z.ZodString;
1591
+ }, z.core.$strip>], "kind">;
1592
+ declare const VerificationDescriptorZod: z.ZodObject<{
1593
+ validationProgramHash: z.ZodString;
1594
+ paramsHash: z.ZodString;
1595
+ assertedPredicate: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1596
+ kind: z.ZodLiteral<"erc20BalanceGte">;
1597
+ chainId: z.ZodNumber;
1598
+ token: z.ZodString;
1599
+ owner: z.ZodUnion<readonly [z.ZodString, z.ZodEnum<{
1600
+ escrow: "escrow";
1601
+ delivery: "delivery";
1602
+ }>]>;
1603
+ minAmount: z.ZodString;
1604
+ }, z.core.$strip>, z.ZodObject<{
1605
+ kind: z.ZodLiteral<"nativeBalanceGte">;
1606
+ chainId: z.ZodNumber;
1607
+ owner: z.ZodUnion<readonly [z.ZodString, z.ZodEnum<{
1608
+ escrow: "escrow";
1609
+ delivery: "delivery";
1610
+ }>]>;
1611
+ minAmount: z.ZodString;
1612
+ }, z.core.$strip>, z.ZodObject<{
1613
+ kind: z.ZodLiteral<"erc20BalanceGte">;
1614
+ chainId: z.ZodNumber;
1615
+ token: z.ZodString;
1616
+ owner: z.ZodString;
1617
+ minAmount: z.ZodString;
1618
+ }, z.core.$strip> | z.ZodObject<{
1619
+ kind: z.ZodLiteral<"nativeBalanceGte">;
1620
+ chainId: z.ZodNumber;
1621
+ owner: z.ZodString;
1622
+ minAmount: z.ZodString;
1623
+ }, z.core.$strip> | z.ZodObject<{
1624
+ kind: z.ZodLiteral<"call">;
1625
+ chainId: z.ZodNumber;
1626
+ to: z.ZodString;
1627
+ calldata: z.ZodString;
1628
+ comparator: z.ZodEnum<{
1629
+ gte: "gte";
1630
+ eq: "eq";
1631
+ lte: "lte";
1632
+ }>;
1633
+ value: z.ZodString;
1634
+ }, z.core.$strip> | z.ZodObject<{
1635
+ kind: z.ZodLiteral<"erc20BalanceDeltaGte">;
1636
+ chainId: z.ZodNumber;
1637
+ token: z.ZodString;
1638
+ owner: z.ZodUnion<readonly [z.ZodString, z.ZodEnum<{
1639
+ escrow: "escrow";
1640
+ delivery: "delivery";
1641
+ }>]>;
1642
+ minDelta: z.ZodString;
1643
+ }, z.core.$strip> | z.ZodObject<{
1644
+ kind: z.ZodLiteral<"nativeBalanceDeltaGte">;
1645
+ chainId: z.ZodNumber;
1646
+ owner: z.ZodUnion<readonly [z.ZodString, z.ZodEnum<{
1647
+ escrow: "escrow";
1648
+ delivery: "delivery";
1649
+ }>]>;
1650
+ minDelta: z.ZodString;
1651
+ }, z.core.$strip>, z.ZodObject<{
1652
+ kind: z.ZodLiteral<"erc20BalanceGte">;
1653
+ chainId: z.ZodNumber;
1654
+ token: z.ZodString;
1655
+ owner: z.ZodString;
1656
+ minAmount: z.ZodString;
1657
+ }, z.core.$strip> | z.ZodObject<{
1658
+ kind: z.ZodLiteral<"nativeBalanceGte">;
1659
+ chainId: z.ZodNumber;
1660
+ owner: z.ZodString;
1661
+ minAmount: z.ZodString;
1662
+ }, z.core.$strip> | z.ZodObject<{
1663
+ kind: z.ZodLiteral<"call">;
1664
+ chainId: z.ZodNumber;
1665
+ to: z.ZodString;
1666
+ calldata: z.ZodString;
1667
+ comparator: z.ZodEnum<{
1668
+ gte: "gte";
1669
+ eq: "eq";
1670
+ lte: "lte";
1671
+ }>;
1672
+ value: z.ZodString;
1673
+ }, z.core.$strip> | z.ZodObject<{
1674
+ kind: z.ZodLiteral<"erc20BalanceDeltaGte">;
1675
+ chainId: z.ZodNumber;
1676
+ token: z.ZodString;
1677
+ owner: z.ZodUnion<readonly [z.ZodString, z.ZodEnum<{
1678
+ escrow: "escrow";
1679
+ delivery: "delivery";
1680
+ }>]>;
1681
+ minDelta: z.ZodString;
1682
+ }, z.core.$strip> | z.ZodObject<{
1683
+ kind: z.ZodLiteral<"nativeBalanceDeltaGte">;
1684
+ chainId: z.ZodNumber;
1685
+ owner: z.ZodUnion<readonly [z.ZodString, z.ZodEnum<{
1686
+ escrow: "escrow";
1687
+ delivery: "delivery";
1688
+ }>]>;
1689
+ minDelta: z.ZodString;
1690
+ }, z.core.$strip>, z.ZodObject<{
1691
+ kind: z.ZodLiteral<"erc20BalanceGte">;
1692
+ chainId: z.ZodNumber;
1693
+ token: z.ZodString;
1694
+ owner: z.ZodString;
1695
+ minAmount: z.ZodString;
1696
+ }, z.core.$strip> | z.ZodObject<{
1697
+ kind: z.ZodLiteral<"nativeBalanceGte">;
1698
+ chainId: z.ZodNumber;
1699
+ owner: z.ZodString;
1700
+ minAmount: z.ZodString;
1701
+ }, z.core.$strip> | z.ZodObject<{
1702
+ kind: z.ZodLiteral<"call">;
1703
+ chainId: z.ZodNumber;
1704
+ to: z.ZodString;
1705
+ calldata: z.ZodString;
1706
+ comparator: z.ZodEnum<{
1707
+ gte: "gte";
1708
+ eq: "eq";
1709
+ lte: "lte";
1710
+ }>;
1711
+ value: z.ZodString;
1712
+ }, z.core.$strip> | z.ZodObject<{
1713
+ kind: z.ZodLiteral<"erc20BalanceDeltaGte">;
1714
+ chainId: z.ZodNumber;
1715
+ token: z.ZodString;
1716
+ owner: z.ZodUnion<readonly [z.ZodString, z.ZodEnum<{
1717
+ escrow: "escrow";
1718
+ delivery: "delivery";
1719
+ }>]>;
1720
+ minDelta: z.ZodString;
1721
+ }, z.core.$strip> | z.ZodObject<{
1722
+ kind: z.ZodLiteral<"nativeBalanceDeltaGte">;
1723
+ chainId: z.ZodNumber;
1724
+ owner: z.ZodUnion<readonly [z.ZodString, z.ZodEnum<{
1725
+ escrow: "escrow";
1726
+ delivery: "delivery";
1727
+ }>]>;
1728
+ minDelta: z.ZodString;
1729
+ }, z.core.$strip>], "kind">>;
1730
+ }, z.core.$strip>;
1731
+ type AssertedPredicateWire = z.infer<typeof AssertedPredicateZod>;
1732
+ type VerificationDescriptorWire = z.infer<typeof VerificationDescriptorZod>;
1733
+ declare const ContinuationPlanZod: z.ZodObject<{
1734
+ chainId: z.ZodNumber;
1735
+ nextFlow: z.ZodUnknown;
1736
+ check: z.ZodDiscriminatedUnion<[z.ZodObject<{
1737
+ kind: z.ZodLiteral<"erc20BalanceGte">;
1738
+ chainId: z.ZodNumber;
1739
+ token: z.ZodString;
1740
+ owner: z.ZodString;
1741
+ minAmount: z.ZodString;
1742
+ }, z.core.$strip>, z.ZodObject<{
1743
+ kind: z.ZodLiteral<"nativeBalanceGte">;
1744
+ chainId: z.ZodNumber;
1745
+ owner: z.ZodString;
1746
+ minAmount: z.ZodString;
1747
+ }, z.core.$strip>, z.ZodObject<{
1748
+ kind: z.ZodLiteral<"call">;
1749
+ chainId: z.ZodNumber;
1750
+ to: z.ZodString;
1751
+ calldata: z.ZodString;
1752
+ comparator: z.ZodEnum<{
1753
+ gte: "gte";
1754
+ eq: "eq";
1755
+ lte: "lte";
1756
+ }>;
1757
+ value: z.ZodString;
1758
+ }, z.core.$strip>], "kind">;
1759
+ validity: z.ZodObject<{
1760
+ expiresAtMs: z.ZodNumber;
1761
+ }, z.core.$strip>;
1762
+ correlationId: z.ZodOptional<z.ZodString>;
1763
+ }, z.core.$strip>;
833
1764
  type ResourcePort = z.infer<typeof ResourcePortZod>;
834
1765
  type HandlePort = z.infer<typeof HandlePortZod>;
835
1766
  type HandleUnits = z.infer<typeof HandleUnitsZod>;
@@ -844,11 +1775,114 @@ type ManifestGuard = z.infer<typeof ManifestGuardZod>;
844
1775
  type ManifestMaterialiser = z.infer<typeof ManifestMaterialiserZod>;
845
1776
  type ManifestPrecondition = z.infer<typeof ManifestPreconditionZod>;
846
1777
  type ComposeManifest = z.infer<typeof ComposeManifestZod>;
1778
+ type Phase1ArtifactWire = z.infer<typeof Phase1ArtifactZod>;
1779
+ type ContinuationPlanWire = z.infer<typeof ContinuationPlanZod>;
1780
+
1781
+ type SimulationPolicy = 'strict' | 'allow-revert';
1782
+ /**
1783
+ * Destination for sweeping proxy-held terminal resources after execution.
1784
+ * Either a literal EVM address or a `{ $ref }` context reference
1785
+ * (e.g. `{ $ref: "context.sender" }`).
1786
+ */
1787
+ type SweepTo = string | {
1788
+ readonly $ref: string;
1789
+ };
1790
+ interface ComposeRun {
1791
+ readonly inputs: Record<string, InputSpec>;
1792
+ readonly preconditions?: readonly Precondition[];
1793
+ readonly signer: string;
1794
+ readonly assumptions?: Record<string, bigint>;
1795
+ readonly referrer?: string;
1796
+ readonly integratorFeeBps?: number;
1797
+ readonly maxPriceImpactBps?: number;
1798
+ readonly sweepTo?: SweepTo;
1799
+ readonly simulationPolicy?: SimulationPolicy;
1800
+ readonly checkOnChainAllowances?: boolean;
1801
+ }
1802
+ interface ComposeCompileRequest {
1803
+ readonly flow: Flow;
1804
+ readonly run: ComposeRun;
1805
+ }
1806
+ interface PriceImpact {
1807
+ readonly inputValueUsd: number;
1808
+ readonly outputValueUsd: number;
1809
+ readonly impactBps: number;
1810
+ readonly unpricedInputs: readonly string[];
1811
+ readonly unpricedOutputs: readonly string[];
1812
+ }
1813
+ interface ApprovalEntry {
1814
+ readonly token: string;
1815
+ readonly spender: string;
1816
+ readonly amount: string;
1817
+ readonly transactionRequest: {
1818
+ readonly to: string;
1819
+ readonly data: string;
1820
+ readonly value: '0';
1821
+ };
1822
+ }
1823
+ interface SimulationRevert {
1824
+ readonly code: number;
1825
+ readonly rawErrorBytes: string;
1826
+ readonly decodeResult?: {
1827
+ readonly errorCandidates?: readonly {
1828
+ readonly decodedErrorSignature: string;
1829
+ readonly decodedParams: readonly string[];
1830
+ }[];
1831
+ readonly error?: string;
1832
+ };
1833
+ }
1834
+ interface ComposeTransactionRequest {
1835
+ readonly to: string;
1836
+ readonly data: string;
1837
+ readonly value: string;
1838
+ readonly gasLimit?: string;
1839
+ }
1840
+ interface ComposeContinuation {
1841
+ readonly awaits: string;
1842
+ readonly flowId: string;
1843
+ }
1844
+ interface ComposeContinuationData {
1845
+ readonly continuations?: readonly ComposeContinuation[];
1846
+ readonly phase1ByNode?: Record<string, Phase1ArtifactWire>;
1847
+ readonly continuationPlans?: Record<string, ContinuationPlanWire>;
1848
+ }
1849
+ interface SpendEntry {
1850
+ readonly token: string;
1851
+ readonly amount: string;
1852
+ }
1853
+ interface ComposeCompileSuccessData extends ComposeContinuationData {
1854
+ readonly producedResources: Record<string, ProducedResource>;
1855
+ readonly transactionRequest: ComposeTransactionRequest;
1856
+ readonly userProxy: string;
1857
+ readonly priceImpact?: PriceImpact;
1858
+ readonly approvals?: readonly ApprovalEntry[];
1859
+ readonly spends?: readonly SpendEntry[];
1860
+ readonly quote?: {
1861
+ readonly validUntilMs: number;
1862
+ };
1863
+ readonly verificationDescriptor?: VerificationDescriptor;
1864
+ }
1865
+ interface ComposeCompilePartialData extends ComposeContinuationData {
1866
+ readonly producedResources: Record<string, ProducedResource>;
1867
+ readonly transactionRequest: ComposeTransactionRequest;
1868
+ readonly userProxy: string;
1869
+ readonly simulationRevert: SimulationRevert;
1870
+ readonly approvals?: readonly ApprovalEntry[];
1871
+ }
1872
+ type ComposeCompileResult = (ComposeCompileSuccessData & {
1873
+ readonly status: 'success';
1874
+ }) | (ComposeCompilePartialData & {
1875
+ readonly status: 'partial';
1876
+ readonly error: {
1877
+ readonly kind: string;
1878
+ readonly message: string;
1879
+ };
1880
+ });
847
1881
 
848
1882
  interface Port {
849
1883
  readonly name: string;
850
1884
  readonly type: SolType;
851
- readonly mode: "linear" | "copy";
1885
+ readonly mode: 'linear' | 'copy';
852
1886
  readonly availability?: Availability;
853
1887
  readonly resource?: Resource;
854
1888
  }
@@ -859,8 +1893,8 @@ declare const flowInputResource: (input: FlowInput) => Resource | undefined;
859
1893
  declare const isResourcePort: (port: OpInputPort) => port is ResourcePort;
860
1894
  declare const isHandlePort: (port: OpInputPort | OpOutputPort) => port is HandlePort;
861
1895
  declare const isResourceOutputPort: (port: OpInputPort | OpOutputPort) => port is ResourceOutputPort;
862
- type ComposeErrorKind = "decode_error" | "validation_error" | "linearity_error" | "resolve_error" | "preparation_error" | "provider_error" | "no_route_error" | "lowering_error" | "simulation_error" | "simulation_setup_error" | "simulation_revert" | "subgraph_simulation_revert" | "guard_error" | "continuation_error" | "compilation_error" | "verification_error" | "price_impact_exceeded" | "fee_resolution_error" | "fee_resolution_unavailable" | "flashloan_unauthorized";
863
- type GenericComposeErrorKind = Exclude<ComposeErrorKind, "preparation_error" | "simulation_revert">;
1896
+ type ComposeErrorKind = 'decode_error' | 'validation_error' | 'linearity_error' | 'resolve_error' | 'preparation_error' | 'provider_error' | 'no_route_error' | 'resolution_error' | 'lowering_error' | 'empty_program' | 'simulation_error' | 'simulation_setup_error' | 'simulation_rpc_error' | 'simulation_revert' | 'subgraph_simulation_revert' | 'guard_error' | 'continuation_error' | 'compilation_error' | 'verification_error' | 'price_impact_exceeded' | 'fee_resolution_error' | 'fee_resolution_unavailable' | 'flashloan_unauthorized';
1897
+ type GenericComposeErrorKind = Exclude<ComposeErrorKind, 'preparation_error' | 'simulation_revert'>;
864
1898
  interface FailedPreparedOp {
865
1899
  readonly callId: string;
866
1900
  readonly op: string;
@@ -873,12 +1907,12 @@ interface ComposeErrorBase {
873
1907
  readonly path?: string;
874
1908
  }
875
1909
  interface PreparationComposeError extends ComposeErrorBase {
876
- readonly kind: "preparation_error";
1910
+ readonly kind: 'preparation_error';
877
1911
  readonly failedOps: readonly FailedPreparedOp[];
878
1912
  readonly succeededOps: readonly string[];
879
1913
  }
880
1914
  interface SimulationRevertComposeError extends ComposeErrorBase {
881
- readonly kind: "simulation_revert";
1915
+ readonly kind: 'simulation_revert';
882
1916
  readonly details?: SimulationRevert;
883
1917
  }
884
1918
  interface GenericComposeError extends ComposeErrorBase {
@@ -899,7 +1933,7 @@ interface PreconditionBase {
899
1933
  }
900
1934
  type Precondition = PreconditionBase & Record<string, unknown>;
901
1935
  type PreconditionOf<C extends object> = PreconditionBase & C;
902
- type PreconditionConfigOf<C extends object> = Omit<PreconditionBase, "type"> & C;
1936
+ type PreconditionConfigOf<C extends object> = Omit<PreconditionBase, 'type'> & C;
903
1937
 
904
1938
  declare const PROVIDER_KIND: {
905
1939
  readonly AAVE_V3: 0;
@@ -911,7 +1945,7 @@ declare const providerKindNames: readonly ["aave-v3", "erc3156", "balancer-v2",
911
1945
  type ProviderKindName = (typeof providerKindNames)[number];
912
1946
  declare const providerKindByName: Record<ProviderKindName, number>;
913
1947
  interface FlashloanMaterialiserInput {
914
- readonly kind: "flashloan";
1948
+ readonly kind: 'flashloan';
915
1949
  readonly providerKind: ProviderKindName;
916
1950
  readonly amount: string;
917
1951
  }
@@ -966,18 +2000,18 @@ declare const resourceOutput: <N extends string>(name: N, options?: Availability
966
2000
  };
967
2001
 
968
2002
  type ParsedRef = {
969
- readonly scope: "input";
2003
+ readonly scope: 'input';
970
2004
  readonly port: string;
971
2005
  } | {
972
- readonly scope: "output";
2006
+ readonly scope: 'output';
973
2007
  readonly node: string;
974
2008
  readonly port: string;
975
2009
  } | {
976
- readonly scope: "context";
2010
+ readonly scope: 'context';
977
2011
  readonly key: ContextKey;
978
2012
  };
979
- type RefScope = ParsedRef["scope"];
980
- type ContextKey = "sender" | "executionAddress";
2013
+ type RefScope = ParsedRef['scope'];
2014
+ type ContextKey = 'sender' | 'executionAddress';
981
2015
  declare const isContextKey: (key: string) => key is ContextKey;
982
2016
  /**
983
2017
  * Ref prefixes that parseRef intercepts before the fallback `output` scope.
@@ -995,6 +2029,276 @@ declare const foldRef: <R>(ref: ParsedRef, cases: {
995
2029
  }) => R;
996
2030
  declare const refKey: (ref: Ref) => string;
997
2031
 
2032
+ /**
2033
+ * Per-chain native-asset semantics.
2034
+ *
2035
+ * Most EVM chains have an ETH-style native gas coin sent via `msg.value` (the
2036
+ * `evm-native` policy). A small number — currently only Tempo — express their
2037
+ * "native" coin as an ERC-20 token (the `as-erc20` policy). Code that needs to
2038
+ * lower or simulate a `Resource` of kind `"native"` should consult
2039
+ * `getChainCapabilities(chainId)` rather than hardcoding chain IDs.
2040
+ *
2041
+ * The compose compiler uses this registry to transparently normalise native
2042
+ * resources into ERC-20 resources on `as-erc20` chains at schema-decode time
2043
+ * (see `normalizeResource` below and the `ResourceSchema` transform in
2044
+ * `flowSchema.ts`).
2045
+ *
2046
+ * This union is the extension point for future native-asset policies. A chain
2047
+ * with no canonical native asset would get a `reject-native` arm, under which a
2048
+ * `{ kind: "native" }` resource becomes a validation error rather than being
2049
+ * rewritten. No such chain exists yet, so the arm is not defined here.
2050
+ */
2051
+ type ChainCapabilities = {
2052
+ readonly kind: 'evm-native';
2053
+ readonly chainId: number;
2054
+ } | {
2055
+ readonly kind: 'as-erc20';
2056
+ readonly chainId: number;
2057
+ readonly nativeErc20: NativeErc20;
2058
+ };
2059
+ interface NativeErc20 {
2060
+ readonly token: `0x${string}`;
2061
+ readonly symbol: string;
2062
+ readonly decimals: number;
2063
+ }
2064
+ /**
2065
+ * The zero-address sentinel that represents the native gas coin on
2066
+ * EVM-native chains. Exported so tests and call-sites can reference it
2067
+ * by name rather than inlining 40 zeros.
2068
+ *
2069
+ * Inlined as a literal rather than imported from `@lifi/utils`: `compose-spec`
2070
+ * is the wire-format leaf package and carries no `@lifi/*` dependencies
2071
+ * (enforced by `scripts/check-compose-boundaries.mjs`).
2072
+ */
2073
+ declare const EVM_NATIVE_SENTINEL: `0x${string}`;
2074
+ declare const TEMPO_CHAIN_ID = 4217;
2075
+ declare const TEMPO_NATIVE_ERC20: NativeErc20;
2076
+ declare const getChainCapabilities: (chainId: number) => ChainCapabilities;
2077
+ declare const isAsErc20Chain: (chainId: number) => boolean;
2078
+ /**
2079
+ * The address that represents the chain's native asset.
2080
+ *
2081
+ * On EVM-native chains this is the zero-address sentinel `0x0…0`. On
2082
+ * `as-erc20` chains it is the chain's stand-in ERC-20 (e.g. PathUSD on Tempo).
2083
+ */
2084
+ declare const canonicalNativeAddress: (chainId: number) => `0x${string}`;
2085
+ /**
2086
+ * Whether `address` represents the native asset of `chainId`.
2087
+ *
2088
+ * On EVM-native chains, this is the case-insensitive zero-address check. On
2089
+ * `as-erc20` chains, the literal zero address returns `false` — only the
2090
+ * chain's stand-in ERC-20 address matches.
2091
+ */
2092
+ declare const isNativeAddressForChain: (chainId: number, address: string) => boolean;
2093
+ /**
2094
+ * Whether `address` on `chainId` is the genuine `msg.value`-style native coin:
2095
+ * an `evm-native` chain's zero-address sentinel.
2096
+ *
2097
+ * This is the single predicate that gates `msg.value` semantics — choosing a
2098
+ * `NativeBalance` over an `Erc20Balance` simulation requirement, and skipping
2099
+ * the ERC-20 approval a native input would otherwise need. It returns `false`
2100
+ * for every address on an `as-erc20` chain (including the zero sentinel),
2101
+ * because there the "native" coin is a real ERC-20 moved via `transferFrom`,
2102
+ * never `msg.value`. Use this rather than re-deriving
2103
+ * `!isAsErc20Chain(chainId) && address === EVM_NATIVE_SENTINEL` at call sites,
2104
+ * and rather than `isNativeAddressForChain`, which returns `true` for the
2105
+ * stand-in ERC-20 (PathUSD) on `as-erc20` chains and would wrongly route it to
2106
+ * `msg.value`.
2107
+ */
2108
+ declare const isMsgValueNative: (chainId: number, address: string) => boolean;
2109
+ /**
2110
+ * Rewrite a single `Resource` according to its chain's capabilities.
2111
+ *
2112
+ * On chains with the default `evm-native` policy, every resource is returned
2113
+ * unchanged. On `as-erc20` chains (currently only Tempo, chainId 4217), a
2114
+ * resource of kind `"native"` is rewritten into the equivalent ERC-20
2115
+ * resource pointing at the chain's stand-in token (PathUSD for Tempo).
2116
+ *
2117
+ * This is the rewrite primitive behind the `ResourceSchema` decode transform
2118
+ * (see `flowSchema.ts`), which is THE chokepoint: it runs every time a
2119
+ * `Resource` is parsed — flow inputs via `FlowSchema`, op configs via
2120
+ * `decodeConfig` — so every downstream pass (`normalizeFlow`, `resolve`,
2121
+ * `lower`, `simulate`) sees only ERC-20 resources on `as-erc20` chains.
2122
+ *
2123
+ * The function preserves referential identity when nothing changes (returns the
2124
+ * input `r` unchanged on evm-native chains and for ERC-20 resources) and is
2125
+ * idempotent: running it on an already-rewritten resource is a no-op.
2126
+ */
2127
+ declare const normalizeResource: (r: Resource) => Resource;
2128
+ /**
2129
+ * Address-level counterpart of `normalizeResource` for wire fields that carry a
2130
+ * native asset as a bare token string (a continuation outcome's `token`). On
2131
+ * `as-erc20` chains the native sentinel is rewritten to the chain's stand-in
2132
+ * ERC-20; every other address passes through.
2133
+ */
2134
+ declare const normalizeNativeTokenAddress: (token: string, chainId: number) => string;
2135
+
2136
+ /**
2137
+ * Canonical wire-format types for the standalone `POST /simulate` endpoint.
2138
+ *
2139
+ * `/simulate` takes a raw, pre-encoded transaction (a `to` address, hex `data`,
2140
+ * optional native `value`), funds a sender, runs it in one `eth_call`, and
2141
+ * reports the watched balances before and after, their signed deltas, and the
2142
+ * inner-call gas. Unlike `POST /compose`, its response body is **un-enveloped**:
2143
+ * `{ status, block, timestamp, ... }` lives at the top level (no `{ data }`
2144
+ * wrapper).
2145
+ *
2146
+ * These are the single source of truth for the request/response shapes. The
2147
+ * server-side Zod schemas in `@lifi/api-schemas` (`src/routes/simulate.ts`)
2148
+ * validate the same contract and are kept in lockstep by a compile-time
2149
+ * conformance assertion (`src/routes/simulate.typecheck.ts`).
2150
+ *
2151
+ * Mirrors the hand-authored style of `src/compile.ts`.
2152
+ */
2153
+ /**
2154
+ * Maximum number of watched `(token, owner)` pairs accepted by `POST /simulate`.
2155
+ *
2156
+ * The limit comes from the VM's hard register budget (~123 usable registers,
2157
+ * checked on the final ISA layout). Each pair costs two result registers — a
2158
+ * before-read and an after-read — that are both live at the closing abi-encode,
2159
+ * so the compiler cannot coalesce them; that `2 × N` is the cost that scales.
2160
+ * Token and owner address literals do not scale it, since constant-propagation
2161
+ * merges identical-valued literals into one register. The cap leaves headroom
2162
+ * for the inner-call / gas-measurement / abi-encode scaffolding.
2163
+ */
2164
+ declare const SIMULATE_MAX_TRACKED_BALANCES = 40;
2165
+ /**
2166
+ * Maximum number of funding `requirements` accepted by `POST /simulate`.
2167
+ *
2168
+ * Each requirement triggers a slot-discovery cycle (access-list probe + sentinel
2169
+ * verification + RPC round trips) in slot-finder, so an unbounded array lets a
2170
+ * single request amplify into arbitrary upstream RPC work. Bounded here at the
2171
+ * trust boundary and re-enforced server-side in `rawSimulation.ts`.
2172
+ */
2173
+ declare const SIMULATE_MAX_REQUIREMENTS = 40;
2174
+ /** A `(token, owner)` pair whose balance is watched across the simulation. */
2175
+ interface TrackedBalance {
2176
+ /** Token to watch (use the zero address for native balance). */
2177
+ readonly token: string;
2178
+ /** Account whose balance of `token` is watched. */
2179
+ readonly owner: string;
2180
+ }
2181
+ /**
2182
+ * Funding instruction: seed an ERC-20 balance on a wallet before simulation.
2183
+ * Amounts accept `bigint | string` — the SDK serialises `bigint` to a decimal
2184
+ * string; the string side covers values already stringified.
2185
+ */
2186
+ interface Erc20BalanceRequirement {
2187
+ readonly type: 'Erc20Balance';
2188
+ readonly wallet: string;
2189
+ readonly token: string;
2190
+ readonly balance: bigint | string;
2191
+ }
2192
+ /** Funding instruction: seed a native balance on a wallet before simulation. */
2193
+ interface NativeBalanceRequirement {
2194
+ readonly type: 'NativeBalance';
2195
+ readonly wallet: string;
2196
+ readonly balance: bigint | string;
2197
+ }
2198
+ /** Funding instruction: seed an ERC-20 allowance before simulation. */
2199
+ interface Erc20AllowanceRequirement {
2200
+ readonly type: 'Erc20Allowance';
2201
+ readonly owner: string;
2202
+ readonly spender: string;
2203
+ readonly token: string;
2204
+ readonly allowance: bigint | string;
2205
+ }
2206
+ /**
2207
+ * The funding-instruction union applied before a simulation. Three variants,
2208
+ * discriminated by `type`.
2209
+ */
2210
+ type SlotFinderRequirement = Erc20BalanceRequirement | NativeBalanceRequirement | Erc20AllowanceRequirement;
2211
+ /** Request body for `POST /simulate`. */
2212
+ interface SimulateRequest {
2213
+ /** EVM chain id. */
2214
+ readonly chainId: number;
2215
+ /**
2216
+ * Sender of the simulated transaction. The VM bytecode is injected here so
2217
+ * the inner call carries `msg.sender == from`.
2218
+ */
2219
+ readonly from: string;
2220
+ /** Target contract of the raw transaction. */
2221
+ readonly to: string;
2222
+ /** Pre-encoded transaction calldata (`0x`-prefixed hex). */
2223
+ readonly data: string;
2224
+ /**
2225
+ * Native value (wei) sent with the inner call. Accepts `bigint | string`;
2226
+ * defaults to `"0"` server-side when omitted.
2227
+ */
2228
+ readonly value?: bigint | string;
2229
+ /**
2230
+ * Block number to simulate against. Omitted ⇒ the chain head. Named tags
2231
+ * (e.g. "latest") are rejected with HTTP 400.
2232
+ */
2233
+ readonly block?: number;
2234
+ /** Funding instructions applied before simulation (max 40). */
2235
+ readonly requirements?: readonly SlotFinderRequirement[];
2236
+ /** Balances to read before and after the transaction (1–40 pairs). */
2237
+ readonly trackedBalances: readonly TrackedBalance[];
2238
+ }
2239
+ /**
2240
+ * One watched balance in a simulation response. `amount` is a decimal string;
2241
+ * for `deltas` it is signed (`after - before`).
2242
+ */
2243
+ interface SimulateBalanceEntry {
2244
+ readonly token: string;
2245
+ readonly owner: string;
2246
+ readonly amount: string;
2247
+ }
2248
+ /**
2249
+ * HTTP 200, `status: "ok"`: the simulation ran successfully. Balance arrays are
2250
+ * ordered to match the request `trackedBalances`. `gasUsed` is inner-call
2251
+ * execution gas only.
2252
+ *
2253
+ * Note: the array element types are intentionally mutable (`SimulateBalanceEntry[]`,
2254
+ * not `readonly SimulateBalanceEntry[]`) so they stay structurally identical to
2255
+ * the Zod-inferred wire types, which `z.array(...)` infers as mutable `T[]`. The
2256
+ * bidirectional conformance assertion in `@lifi/api-schemas` relies on this.
2257
+ */
2258
+ interface SimulateOkResult {
2259
+ readonly status: 'ok';
2260
+ readonly block: number;
2261
+ readonly timestamp: number;
2262
+ readonly balancesBefore: SimulateBalanceEntry[];
2263
+ readonly balancesAfter: SimulateBalanceEntry[];
2264
+ readonly deltas: SimulateBalanceEntry[];
2265
+ readonly gasUsed: string;
2266
+ }
2267
+ /** Decoded revert diagnostics, when slot-finder can parse the revert reason. */
2268
+ interface SimulateRevertDecodeResult {
2269
+ readonly errorCandidates?: {
2270
+ readonly decodedErrorSignature: string;
2271
+ readonly decodedParams: string[];
2272
+ }[];
2273
+ readonly error?: string;
2274
+ }
2275
+ /**
2276
+ * HTTP 200, `status: "revert"`: the simulation ran but the transaction reverted
2277
+ * on-chain. A revert is a *successful simulation*, not a transport error.
2278
+ */
2279
+ interface SimulateRevertResult {
2280
+ readonly status: 'revert';
2281
+ readonly block: number;
2282
+ readonly timestamp: number;
2283
+ readonly revertReason?: string;
2284
+ readonly code?: number;
2285
+ readonly rawErrorBytes?: string;
2286
+ readonly decodeResult?: SimulateRevertDecodeResult;
2287
+ }
2288
+ /**
2289
+ * HTTP 422, `status: "error"`: the request was well-formed but the simulation
2290
+ * could not be set up or run. `message` is intentionally generic.
2291
+ */
2292
+ interface SimulateSetupErrorResult {
2293
+ readonly status: 'error';
2294
+ readonly message: string;
2295
+ }
2296
+ /**
2297
+ * Discriminated result of `POST /simulate`. `switch (result.status)` narrows to
2298
+ * one member: `ok` and `revert` come back with HTTP 200, `error` with HTTP 422.
2299
+ */
2300
+ type SimulateResult = SimulateOkResult | SimulateRevertResult | SimulateSetupErrorResult;
2301
+
998
2302
  type MaterialiserMetadata = {
999
2303
  readonly kind: 'exact';
1000
2304
  readonly amount: bigint;
@@ -1014,4 +2318,4 @@ declare const foldMaterialiserMetadata: <R>(meta: MaterialiserMetadata, cases: {
1014
2318
  readonly runtime: () => R;
1015
2319
  }) => R;
1016
2320
 
1017
- export { type AppliedGuard, AppliedGuardSchema, type ApprovalEntry, type Availability, type BindValue, BindValueSchema, type Call, CallSchema, type ComposeCompilePartialData, type ComposeCompileRequest, type ComposeCompileResult, type ComposeCompileSuccessData, type ComposeContinuation, type ComposeError, type ComposeErrorKind, type ComposeManifest, ComposeManifestZod, type ComposeRun, type ComposeTransactionRequest, type ContextKey, type Continuation, ContinuationSchema, type FailedPreparedOp, type FlashloanMaterialiserInput, type Flow, type FlowInput, FlowInputSchema, FlowSchema, type GenericComposeError, type GenericComposeErrorKind, type GuardCompatibility, GuardCompatibilityZod, type GuardSelector, GuardSelectorZod, HANDLE_UNITS, type HandleInput, HandleInputSchema, type HandlePort, HandlePortZod, type HandleUnits, HandleUnitsZod, InputPortZod, type InputSpec, type LiteralBinding, LiteralBindingSchema, type ManifestGuard, ManifestGuardZod, type ManifestMaterialiser, ManifestMaterialiserZod, type ManifestOperation, ManifestOperationZod, type ManifestPrecondition, ManifestPreconditionZod, type MaterialiserConfigOf, type MaterialiserInput, type MaterialiserInputBase, type MaterialiserInputOf, type MaterialiserMetadata, type MaterialiserResolution, type OpInputPort, type OpOutputPort, type OutputAmount, OutputPortZod, PROVIDER_KIND, type ParsedRef, type Port, type Precondition, type PreconditionBase, type PreconditionConfigOf, type PreconditionOf, type PreparationComposeError, type PriceImpact, type ProducedResource, type ProviderKindName, RESERVED_REF_SCOPES, type Ref, RefSchema, type RefScope, type Resource, type ResourceInput, ResourceInputSchema, type ResourceOutputPort, ResourceOutputPortZod, type ResourcePort, ResourcePortZod, ResourceSchema, STATIC_SOL_TYPES, type SimulatedAmounts, type SimulationPolicy, type SimulationRevert, type SimulationRevertComposeError, type SolType, SolTypeSchema, type StaticSolType, StaticSolTypeZod, type SweepTo, copy, erc20, erc20Resource, erc20Token, flowInputMode, flowInputResource, flowInputType, foldMaterialiserMetadata, foldRef, foldResource, handle, inputRef, isContextKey, isERC20Resource, isHandlePort, isMaterialiserInput, isNativeResource, isRef, isResourceInput, isResourceOutputPort, isResourcePort, isStaticSolType, linear, native, nativeResource, opHandle, outputRef, parseRef, providerKindByName, providerKindNames, readResource, refKey, resource, resourceKey, resourceOutput, resourcesEqual };
2321
+ export { type AppliedGuard, AppliedGuardSchema, type ApprovalEntry, AssertedErc20BalanceGteSpecSchema, AssertedNativeBalanceGteSpecSchema, type AssertedPredicate, AssertedPredicateSchema, type AssertedPredicateWire, AssertedPredicateZod, type AssertionOwner, AssertionOwnerSchema, type AssertionSpec, AssertionSpecSchema, type AssertionSpecWire, AssertionSpecZod, type Availability, type BindValue, BindValueSchema, Bytes32HexSchema, CONTINUATION_COMMITMENT_OP_ID, type Call, CallCheckSpecSchema, CallSchema, type ChainCapabilities, type Check, type CheckComparator, CheckSchema, CheckZod, type ComposeCompilePartialData, type ComposeCompileRequest, type ComposeCompileResult, type ComposeCompileSuccessData, type ComposeContinuation, type ComposeError, type ComposeErrorKind, type ComposeManifest, ComposeManifestZod, type ComposeRun, type ComposeTransactionRequest, type ContextKey, type Continuation, type ContinuationIntent, ContinuationIntentSchema, type ContinuationOutcome, ContinuationOutcomeSchema, type ContinuationPlan, ContinuationPlanSchema, type ContinuationPlanWire, ContinuationPlanZod, ContinuationSchema, EVM_NATIVE_SENTINEL, type Erc20AllowanceRequirement, Erc20BalanceDeltaGteSpecSchema, Erc20BalanceGteSpecSchema, type Erc20BalanceRequirement, type FailedPreparedOp, type FlashloanMaterialiserInput, type Flow, type FlowInput, FlowInputSchema, FlowSchema, type GenericComposeError, type GenericComposeErrorKind, type GuardCompatibility, GuardCompatibilityZod, type GuardSelector, GuardSelectorZod, HANDLE_UNITS, type HandleInput, HandleInputSchema, type HandlePort, HandlePortZod, type HandleUnits, HandleUnitsZod, HexStringSchema, InputPortZod, type InputSpec, type LiteralBinding, LiteralBindingSchema, type ManifestGuard, ManifestGuardZod, type ManifestMaterialiser, ManifestMaterialiserZod, type ManifestOperation, ManifestOperationZod, type ManifestPrecondition, ManifestPreconditionZod, type MaterialiserConfigOf, type MaterialiserInput, type MaterialiserInputBase, type MaterialiserInputOf, type MaterialiserMetadata, type MaterialiserResolution, NativeBalanceDeltaGteSpecSchema, NativeBalanceGteSpecSchema, type NativeBalanceRequirement, type NativeErc20, type OpInputPort, type OpOutputPort, type OutputAmount, OutputPortZod, PROVIDER_KIND, type ParsedRef, type Phase1Artifact, Phase1ArtifactSchema, type Phase1ArtifactWire, Phase1ArtifactZod, type Port, type Precondition, type PreconditionBase, type PreconditionConfigOf, type PreconditionOf, type PreparationComposeError, type PriceImpact, type ProducedResource, type ProviderKindName, RESERVED_REF_SCOPES, type Ref, RefSchema, type RefScope, type Resource, type ResourceInput, ResourceInputSchema, type ResourceOutputPort, ResourceOutputPortZod, type ResourcePort, ResourcePortZod, ResourceSchema, SIMULATE_MAX_REQUIREMENTS, SIMULATE_MAX_TRACKED_BALANCES, STATIC_SOL_TYPES, type SimulateBalanceEntry, type SimulateOkResult, type SimulateRequest, type SimulateResult, type SimulateRevertDecodeResult, type SimulateRevertResult, type SimulateSetupErrorResult, type SimulatedAmounts, type SimulationPolicy, type SimulationRevert, type SimulationRevertComposeError, type SlotFinderRequirement, type SolType, SolTypeSchema, type SpendEntry, type StaticSolType, StaticSolTypeZod, type SweepTo, TEMPO_CHAIN_ID, TEMPO_NATIVE_ERC20, type TrackedBalance, type VerificationDescriptor, VerificationDescriptorSchema, type VerificationDescriptorWire, VerificationDescriptorZod, canonicalAssertedPredicate, canonicalNativeAddress, copy, erc20, erc20Resource, erc20Token, flowInputMode, flowInputResource, flowInputType, foldMaterialiserMetadata, foldRef, foldResource, getChainCapabilities, handle, inputRef, isAsErc20Chain, isContextKey, isEQCheck, isERC20Resource, isGTECheck, isHandlePort, isLTECheck, isMaterialiserInput, isMsgValueNative, isNativeAddressForChain, isNativeResource, isRef, isResourceInput, isResourceOutputPort, isResourcePort, isStaticSolType, linear, native, nativeResource, normalizeNativeTokenAddress, normalizeResource, opHandle, outputRef, parseRef, providerKindByName, providerKindNames, readResource, refKey, resource, resourceKey, resourceOutput, resourceToken, resourcesEqual };