@lifi/compose-spec 0.12.0 → 0.13.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.cjs +21 -11
- package/dist/index.d.cts +122 -96
- package/dist/index.d.ts +122 -96
- package/dist/index.js +21 -11
- package/package.json +1 -1
- package/src/chainCapabilities.ts +13 -0
- package/src/continuation.ts +13 -8
- package/src/index.ts +1 -0
- package/src/simulate.ts +30 -2
package/dist/index.cjs
CHANGED
|
@@ -61,16 +61,26 @@ const ARC_NATIVE_ERC20 = {
|
|
|
61
61
|
decimals: 6
|
|
62
62
|
};
|
|
63
63
|
const ARC_NATIVE_SCALE = 10n ** BigInt(18 - ARC_NATIVE_ERC20.decimals);
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
64
|
+
const ARC_TESTNET_CHAIN_ID = 5042002;
|
|
65
|
+
const REGISTRY = /* @__PURE__ */ new Map([
|
|
66
|
+
[TEMPO_CHAIN_ID, {
|
|
67
|
+
kind: "as-erc20",
|
|
68
|
+
chainId: TEMPO_CHAIN_ID,
|
|
69
|
+
nativeErc20: TEMPO_NATIVE_ERC20
|
|
70
|
+
}],
|
|
71
|
+
[ARC_CHAIN_ID, {
|
|
72
|
+
kind: "native-mirrored-erc20",
|
|
73
|
+
chainId: ARC_CHAIN_ID,
|
|
74
|
+
nativeErc20: ARC_NATIVE_ERC20,
|
|
75
|
+
nativeScale: ARC_NATIVE_SCALE
|
|
76
|
+
}],
|
|
77
|
+
[ARC_TESTNET_CHAIN_ID, {
|
|
78
|
+
kind: "native-mirrored-erc20",
|
|
79
|
+
chainId: ARC_TESTNET_CHAIN_ID,
|
|
80
|
+
nativeErc20: ARC_NATIVE_ERC20,
|
|
81
|
+
nativeScale: ARC_NATIVE_SCALE
|
|
82
|
+
}]
|
|
83
|
+
]);
|
|
74
84
|
const getChainCapabilities = (chainId) => REGISTRY.get(chainId) ?? {
|
|
75
85
|
kind: "evm-native",
|
|
76
86
|
chainId
|
|
@@ -323,7 +333,7 @@ const normalizingOutcome = (raw) => effect.Schema.transform(raw, effect.Schema.t
|
|
|
323
333
|
const ContinuationOutcomeSchema = normalizingOutcome(effect.Schema.Struct(outcomeFields(effect.Schema.optional(IntegerString))));
|
|
324
334
|
const CommittedOutcomeSchema = normalizingOutcome(effect.Schema.Struct(outcomeFields(IntegerString)));
|
|
325
335
|
const ContinuationIntentSchema = effect.Schema.Struct({
|
|
326
|
-
outcomes: effect.Schema.
|
|
336
|
+
outcomes: effect.Schema.Array(ContinuationOutcomeSchema),
|
|
327
337
|
continuationFlow: effect.Schema.optional(FlowSchema),
|
|
328
338
|
validity: effect.Schema.Struct({ expiresAtMs: EpochMsSchema }),
|
|
329
339
|
provider: effect.Schema.optional(effect.Schema.String),
|
package/dist/index.d.cts
CHANGED
|
@@ -29,19 +29,19 @@ export declare const ResourceSchema: Schema.transform<Schema.Union<[Schema.Struc
|
|
|
29
29
|
token: Schema.refine<string, typeof Schema.String>;
|
|
30
30
|
chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
|
|
31
31
|
}>]>, Schema.SchemaClass<{
|
|
32
|
-
readonly chainId: number;
|
|
33
32
|
readonly kind: "native";
|
|
34
|
-
} | {
|
|
35
|
-
readonly token: string;
|
|
36
33
|
readonly chainId: number;
|
|
34
|
+
} | {
|
|
37
35
|
readonly kind: "erc20";
|
|
38
|
-
}, {
|
|
39
36
|
readonly chainId: number;
|
|
40
|
-
readonly kind: "native";
|
|
41
|
-
} | {
|
|
42
37
|
readonly token: string;
|
|
38
|
+
}, {
|
|
39
|
+
readonly kind: "native";
|
|
43
40
|
readonly chainId: number;
|
|
41
|
+
} | {
|
|
44
42
|
readonly kind: "erc20";
|
|
43
|
+
readonly chainId: number;
|
|
44
|
+
readonly token: string;
|
|
45
45
|
}, never>>;
|
|
46
46
|
export declare const ResourceInputSchema: Schema.Struct<{
|
|
47
47
|
name: typeof Schema.String;
|
|
@@ -53,19 +53,19 @@ export declare const ResourceInputSchema: Schema.Struct<{
|
|
|
53
53
|
token: Schema.refine<string, typeof Schema.String>;
|
|
54
54
|
chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
|
|
55
55
|
}>]>, Schema.SchemaClass<{
|
|
56
|
-
readonly chainId: number;
|
|
57
56
|
readonly kind: "native";
|
|
58
|
-
} | {
|
|
59
|
-
readonly token: string;
|
|
60
57
|
readonly chainId: number;
|
|
58
|
+
} | {
|
|
61
59
|
readonly kind: "erc20";
|
|
62
|
-
}, {
|
|
63
60
|
readonly chainId: number;
|
|
64
|
-
readonly kind: "native";
|
|
65
|
-
} | {
|
|
66
61
|
readonly token: string;
|
|
62
|
+
}, {
|
|
63
|
+
readonly kind: "native";
|
|
67
64
|
readonly chainId: number;
|
|
65
|
+
} | {
|
|
68
66
|
readonly kind: "erc20";
|
|
67
|
+
readonly chainId: number;
|
|
68
|
+
readonly token: string;
|
|
69
69
|
}, never>>;
|
|
70
70
|
}>;
|
|
71
71
|
export declare const HandleInputSchema: Schema.Struct<{
|
|
@@ -82,19 +82,19 @@ export declare const FlowInputSchema: Schema.Union<[Schema.Struct<{
|
|
|
82
82
|
token: Schema.refine<string, typeof Schema.String>;
|
|
83
83
|
chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
|
|
84
84
|
}>]>, Schema.SchemaClass<{
|
|
85
|
-
readonly chainId: number;
|
|
86
85
|
readonly kind: "native";
|
|
87
|
-
} | {
|
|
88
|
-
readonly token: string;
|
|
89
86
|
readonly chainId: number;
|
|
87
|
+
} | {
|
|
90
88
|
readonly kind: "erc20";
|
|
91
|
-
}, {
|
|
92
89
|
readonly chainId: number;
|
|
93
|
-
readonly kind: "native";
|
|
94
|
-
} | {
|
|
95
90
|
readonly token: string;
|
|
91
|
+
}, {
|
|
92
|
+
readonly kind: "native";
|
|
96
93
|
readonly chainId: number;
|
|
94
|
+
} | {
|
|
97
95
|
readonly kind: "erc20";
|
|
96
|
+
readonly chainId: number;
|
|
97
|
+
readonly token: string;
|
|
98
98
|
}, never>>;
|
|
99
99
|
}>, Schema.Struct<{
|
|
100
100
|
name: typeof Schema.String;
|
|
@@ -157,19 +157,19 @@ export declare const EpilogueForwardSchema: Schema.Struct<{
|
|
|
157
157
|
token: Schema.refine<string, typeof Schema.String>;
|
|
158
158
|
chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
|
|
159
159
|
}>]>, Schema.SchemaClass<{
|
|
160
|
-
readonly chainId: number;
|
|
161
160
|
readonly kind: "native";
|
|
162
|
-
} | {
|
|
163
|
-
readonly token: string;
|
|
164
161
|
readonly chainId: number;
|
|
162
|
+
} | {
|
|
165
163
|
readonly kind: "erc20";
|
|
166
|
-
}, {
|
|
167
164
|
readonly chainId: number;
|
|
168
|
-
readonly kind: "native";
|
|
169
|
-
} | {
|
|
170
165
|
readonly token: string;
|
|
166
|
+
}, {
|
|
167
|
+
readonly kind: "native";
|
|
171
168
|
readonly chainId: number;
|
|
169
|
+
} | {
|
|
172
170
|
readonly kind: "erc20";
|
|
171
|
+
readonly chainId: number;
|
|
172
|
+
readonly token: string;
|
|
173
173
|
}, never>>;
|
|
174
174
|
to: Schema.Union<[Schema.refine<string, typeof Schema.String>, Schema.Struct<{
|
|
175
175
|
$ref: Schema.filter<typeof Schema.String>;
|
|
@@ -185,19 +185,19 @@ export declare const EpilogueSchema: Schema.filter<Schema.Struct<{
|
|
|
185
185
|
token: Schema.refine<string, typeof Schema.String>;
|
|
186
186
|
chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
|
|
187
187
|
}>]>, Schema.SchemaClass<{
|
|
188
|
-
readonly chainId: number;
|
|
189
188
|
readonly kind: "native";
|
|
190
|
-
} | {
|
|
191
|
-
readonly token: string;
|
|
192
189
|
readonly chainId: number;
|
|
190
|
+
} | {
|
|
193
191
|
readonly kind: "erc20";
|
|
194
|
-
}, {
|
|
195
192
|
readonly chainId: number;
|
|
196
|
-
readonly kind: "native";
|
|
197
|
-
} | {
|
|
198
193
|
readonly token: string;
|
|
194
|
+
}, {
|
|
195
|
+
readonly kind: "native";
|
|
199
196
|
readonly chainId: number;
|
|
197
|
+
} | {
|
|
200
198
|
readonly kind: "erc20";
|
|
199
|
+
readonly chainId: number;
|
|
200
|
+
readonly token: string;
|
|
201
201
|
}, never>>;
|
|
202
202
|
to: Schema.Union<[Schema.refine<string, typeof Schema.String>, Schema.Struct<{
|
|
203
203
|
$ref: Schema.filter<typeof Schema.String>;
|
|
@@ -221,19 +221,19 @@ export declare const FlowSchema: Schema.Struct<{
|
|
|
221
221
|
token: Schema.refine<string, typeof Schema.String>;
|
|
222
222
|
chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
|
|
223
223
|
}>]>, Schema.SchemaClass<{
|
|
224
|
-
readonly chainId: number;
|
|
225
224
|
readonly kind: "native";
|
|
226
|
-
} | {
|
|
227
|
-
readonly token: string;
|
|
228
225
|
readonly chainId: number;
|
|
226
|
+
} | {
|
|
229
227
|
readonly kind: "erc20";
|
|
230
|
-
}, {
|
|
231
228
|
readonly chainId: number;
|
|
232
|
-
readonly kind: "native";
|
|
233
|
-
} | {
|
|
234
229
|
readonly token: string;
|
|
230
|
+
}, {
|
|
231
|
+
readonly kind: "native";
|
|
235
232
|
readonly chainId: number;
|
|
233
|
+
} | {
|
|
236
234
|
readonly kind: "erc20";
|
|
235
|
+
readonly chainId: number;
|
|
236
|
+
readonly token: string;
|
|
237
237
|
}, never>>;
|
|
238
238
|
}>, Schema.Struct<{
|
|
239
239
|
name: typeof Schema.String;
|
|
@@ -274,19 +274,19 @@ export declare const FlowSchema: Schema.Struct<{
|
|
|
274
274
|
token: Schema.refine<string, typeof Schema.String>;
|
|
275
275
|
chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
|
|
276
276
|
}>]>, Schema.SchemaClass<{
|
|
277
|
-
readonly chainId: number;
|
|
278
277
|
readonly kind: "native";
|
|
279
|
-
} | {
|
|
280
|
-
readonly token: string;
|
|
281
278
|
readonly chainId: number;
|
|
279
|
+
} | {
|
|
282
280
|
readonly kind: "erc20";
|
|
283
|
-
}, {
|
|
284
281
|
readonly chainId: number;
|
|
285
|
-
readonly kind: "native";
|
|
286
|
-
} | {
|
|
287
282
|
readonly token: string;
|
|
283
|
+
}, {
|
|
284
|
+
readonly kind: "native";
|
|
288
285
|
readonly chainId: number;
|
|
286
|
+
} | {
|
|
289
287
|
readonly kind: "erc20";
|
|
288
|
+
readonly chainId: number;
|
|
289
|
+
readonly token: string;
|
|
290
290
|
}, never>>;
|
|
291
291
|
to: Schema.Union<[Schema.refine<string, typeof Schema.String>, Schema.Struct<{
|
|
292
292
|
$ref: Schema.filter<typeof Schema.String>;
|
|
@@ -315,68 +315,68 @@ type Flow = typeof FlowSchema.Type;
|
|
|
315
315
|
//#region src/continuation.d.ts
|
|
316
316
|
export declare const CONTINUATION_COMMITMENT_OP_ID = "continuation.commitment";
|
|
317
317
|
export declare const ContinuationOutcomeSchema: Schema.transform<Schema.Schema<{
|
|
318
|
+
readonly chainId: number;
|
|
318
319
|
readonly token: string;
|
|
319
320
|
readonly minAmount?: string | undefined;
|
|
320
321
|
readonly destination: string;
|
|
321
|
-
readonly chainId: number;
|
|
322
322
|
}, {
|
|
323
|
+
readonly chainId: number;
|
|
323
324
|
readonly token: string;
|
|
324
325
|
readonly destination: string;
|
|
325
|
-
readonly chainId: number;
|
|
326
326
|
readonly minAmount?: string | undefined;
|
|
327
327
|
}, never>, Schema.SchemaClass<{
|
|
328
|
+
readonly chainId: number;
|
|
328
329
|
readonly token: string;
|
|
329
330
|
readonly minAmount?: string | undefined;
|
|
330
331
|
readonly destination: string;
|
|
331
|
-
readonly chainId: number;
|
|
332
332
|
}, {
|
|
333
|
+
readonly chainId: number;
|
|
333
334
|
readonly token: string;
|
|
334
335
|
readonly minAmount?: string | undefined;
|
|
335
336
|
readonly destination: string;
|
|
336
|
-
readonly chainId: number;
|
|
337
337
|
}, never>>;
|
|
338
338
|
export declare const CommittedOutcomeSchema: Schema.transform<Schema.Schema<{
|
|
339
|
+
readonly chainId: number;
|
|
339
340
|
readonly token: string;
|
|
340
341
|
readonly minAmount: string;
|
|
341
342
|
readonly destination: string;
|
|
342
|
-
readonly chainId: number;
|
|
343
343
|
}, {
|
|
344
|
+
readonly chainId: number;
|
|
344
345
|
readonly token: string;
|
|
345
346
|
readonly minAmount: string;
|
|
346
347
|
readonly destination: string;
|
|
347
|
-
readonly chainId: number;
|
|
348
348
|
}, never>, Schema.SchemaClass<{
|
|
349
|
+
readonly chainId: number;
|
|
349
350
|
readonly token: string;
|
|
350
351
|
readonly minAmount: string;
|
|
351
352
|
readonly destination: string;
|
|
352
|
-
readonly chainId: number;
|
|
353
353
|
}, {
|
|
354
|
+
readonly chainId: number;
|
|
354
355
|
readonly token: string;
|
|
355
356
|
readonly minAmount: string;
|
|
356
357
|
readonly destination: string;
|
|
357
|
-
readonly chainId: number;
|
|
358
358
|
}, never>>;
|
|
359
359
|
export declare const ContinuationIntentSchema: Schema.Struct<{
|
|
360
|
-
outcomes: Schema.
|
|
360
|
+
outcomes: Schema.Array$<Schema.transform<Schema.Schema<{
|
|
361
|
+
readonly chainId: number;
|
|
361
362
|
readonly token: string;
|
|
362
363
|
readonly minAmount?: string | undefined;
|
|
363
364
|
readonly destination: string;
|
|
364
|
-
readonly chainId: number;
|
|
365
365
|
}, {
|
|
366
|
+
readonly chainId: number;
|
|
366
367
|
readonly token: string;
|
|
367
368
|
readonly destination: string;
|
|
368
|
-
readonly chainId: number;
|
|
369
369
|
readonly minAmount?: string | undefined;
|
|
370
370
|
}, never>, Schema.SchemaClass<{
|
|
371
|
+
readonly chainId: number;
|
|
371
372
|
readonly token: string;
|
|
372
373
|
readonly minAmount?: string | undefined;
|
|
373
374
|
readonly destination: string;
|
|
374
|
-
readonly chainId: number;
|
|
375
375
|
}, {
|
|
376
|
+
readonly chainId: number;
|
|
376
377
|
readonly token: string;
|
|
377
378
|
readonly minAmount?: string | undefined;
|
|
378
379
|
readonly destination: string;
|
|
379
|
-
readonly chainId: number;
|
|
380
380
|
}, never>>>;
|
|
381
381
|
continuationFlow: Schema.optional<Schema.Struct<{
|
|
382
382
|
version: Schema.Literal<[1]>;
|
|
@@ -392,19 +392,19 @@ export declare const ContinuationIntentSchema: Schema.Struct<{
|
|
|
392
392
|
token: Schema.refine<string, typeof Schema.String>;
|
|
393
393
|
chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
|
|
394
394
|
}>]>, Schema.SchemaClass<{
|
|
395
|
-
readonly chainId: number;
|
|
396
395
|
readonly kind: "native";
|
|
397
|
-
} | {
|
|
398
|
-
readonly token: string;
|
|
399
396
|
readonly chainId: number;
|
|
397
|
+
} | {
|
|
400
398
|
readonly kind: "erc20";
|
|
401
|
-
}, {
|
|
402
399
|
readonly chainId: number;
|
|
403
|
-
readonly kind: "native";
|
|
404
|
-
} | {
|
|
405
400
|
readonly token: string;
|
|
401
|
+
}, {
|
|
402
|
+
readonly kind: "native";
|
|
406
403
|
readonly chainId: number;
|
|
404
|
+
} | {
|
|
407
405
|
readonly kind: "erc20";
|
|
406
|
+
readonly chainId: number;
|
|
407
|
+
readonly token: string;
|
|
408
408
|
}, never>>;
|
|
409
409
|
}>, Schema.Struct<{
|
|
410
410
|
name: typeof Schema.String;
|
|
@@ -445,19 +445,19 @@ export declare const ContinuationIntentSchema: Schema.Struct<{
|
|
|
445
445
|
token: Schema.refine<string, typeof Schema.String>;
|
|
446
446
|
chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
|
|
447
447
|
}>]>, Schema.SchemaClass<{
|
|
448
|
-
readonly chainId: number;
|
|
449
448
|
readonly kind: "native";
|
|
450
|
-
} | {
|
|
451
|
-
readonly token: string;
|
|
452
449
|
readonly chainId: number;
|
|
450
|
+
} | {
|
|
453
451
|
readonly kind: "erc20";
|
|
454
|
-
}, {
|
|
455
452
|
readonly chainId: number;
|
|
456
|
-
readonly kind: "native";
|
|
457
|
-
} | {
|
|
458
453
|
readonly token: string;
|
|
454
|
+
}, {
|
|
455
|
+
readonly kind: "native";
|
|
459
456
|
readonly chainId: number;
|
|
457
|
+
} | {
|
|
460
458
|
readonly kind: "erc20";
|
|
459
|
+
readonly chainId: number;
|
|
460
|
+
readonly token: string;
|
|
461
461
|
}, never>>;
|
|
462
462
|
to: Schema.Union<[Schema.refine<string, typeof Schema.String>, Schema.Struct<{
|
|
463
463
|
$ref: Schema.filter<typeof Schema.String>;
|
|
@@ -564,8 +564,8 @@ type Phase1Artifact = typeof Phase1ArtifactSchema.Type;
|
|
|
564
564
|
type AssertionSpec = typeof AssertionSpecSchema.Type;
|
|
565
565
|
type CallCheckSpec = typeof CallCheckSpecSchema.Type;
|
|
566
566
|
export declare const settledOutcome: <I extends {
|
|
567
|
-
readonly outcomes: readonly
|
|
568
|
-
}>(intent: I) => I["outcomes"][
|
|
567
|
+
readonly outcomes: readonly unknown[];
|
|
568
|
+
}>(intent: I) => I["outcomes"][number] | undefined;
|
|
569
569
|
//#endregion
|
|
570
570
|
//#region src/descriptor.d.ts
|
|
571
571
|
export declare const Bytes32HexSchema: Schema.filter<typeof Schema.String>;
|
|
@@ -589,38 +589,38 @@ export declare const AssertedPredicateSchema: Schema.transformOrFail<Schema.Unio
|
|
|
589
589
|
comparator: Schema.Literal<["gte", "eq", "lte"]>;
|
|
590
590
|
threshold: Schema.filter<typeof Schema.String>;
|
|
591
591
|
}>]>, Schema.SchemaClass<{
|
|
592
|
-
readonly
|
|
592
|
+
readonly kind: "erc20BalanceGte";
|
|
593
593
|
readonly chainId: number;
|
|
594
|
-
readonly kind: "nativeBalanceGte";
|
|
595
|
-
readonly owner: string;
|
|
596
|
-
} | {
|
|
597
594
|
readonly token: string;
|
|
595
|
+
readonly owner: string;
|
|
598
596
|
readonly minAmount: string;
|
|
597
|
+
} | {
|
|
598
|
+
readonly kind: "nativeBalanceGte";
|
|
599
599
|
readonly chainId: number;
|
|
600
|
-
readonly kind: "erc20BalanceGte";
|
|
601
600
|
readonly owner: string;
|
|
601
|
+
readonly minAmount: string;
|
|
602
602
|
} | {
|
|
603
|
-
readonly chainId: number;
|
|
604
603
|
readonly kind: "call";
|
|
604
|
+
readonly chainId: number;
|
|
605
605
|
readonly to: string;
|
|
606
606
|
readonly signature: string;
|
|
607
607
|
readonly args: readonly string[];
|
|
608
608
|
readonly comparator: "gte" | "eq" | "lte";
|
|
609
609
|
readonly threshold: string;
|
|
610
610
|
}, {
|
|
611
|
-
readonly
|
|
611
|
+
readonly kind: "erc20BalanceGte";
|
|
612
612
|
readonly chainId: number;
|
|
613
|
-
readonly kind: "nativeBalanceGte";
|
|
614
|
-
readonly owner: string;
|
|
615
|
-
} | {
|
|
616
613
|
readonly token: string;
|
|
614
|
+
readonly owner: string;
|
|
617
615
|
readonly minAmount: string;
|
|
616
|
+
} | {
|
|
617
|
+
readonly kind: "nativeBalanceGte";
|
|
618
618
|
readonly chainId: number;
|
|
619
|
-
readonly kind: "erc20BalanceGte";
|
|
620
619
|
readonly owner: string;
|
|
620
|
+
readonly minAmount: string;
|
|
621
621
|
} | {
|
|
622
|
-
readonly chainId: number;
|
|
623
622
|
readonly kind: "call";
|
|
623
|
+
readonly chainId: number;
|
|
624
624
|
readonly to: string;
|
|
625
625
|
readonly signature: string;
|
|
626
626
|
readonly args: readonly string[];
|
|
@@ -650,38 +650,38 @@ export declare const VerificationDescriptorSchema: Schema.Struct<{
|
|
|
650
650
|
comparator: Schema.Literal<["gte", "eq", "lte"]>;
|
|
651
651
|
threshold: Schema.filter<typeof Schema.String>;
|
|
652
652
|
}>]>, Schema.SchemaClass<{
|
|
653
|
-
readonly
|
|
653
|
+
readonly kind: "erc20BalanceGte";
|
|
654
654
|
readonly chainId: number;
|
|
655
|
-
readonly kind: "nativeBalanceGte";
|
|
656
|
-
readonly owner: string;
|
|
657
|
-
} | {
|
|
658
655
|
readonly token: string;
|
|
656
|
+
readonly owner: string;
|
|
659
657
|
readonly minAmount: string;
|
|
658
|
+
} | {
|
|
659
|
+
readonly kind: "nativeBalanceGte";
|
|
660
660
|
readonly chainId: number;
|
|
661
|
-
readonly kind: "erc20BalanceGte";
|
|
662
661
|
readonly owner: string;
|
|
662
|
+
readonly minAmount: string;
|
|
663
663
|
} | {
|
|
664
|
-
readonly chainId: number;
|
|
665
664
|
readonly kind: "call";
|
|
665
|
+
readonly chainId: number;
|
|
666
666
|
readonly to: string;
|
|
667
667
|
readonly signature: string;
|
|
668
668
|
readonly args: readonly string[];
|
|
669
669
|
readonly comparator: "gte" | "eq" | "lte";
|
|
670
670
|
readonly threshold: string;
|
|
671
671
|
}, {
|
|
672
|
-
readonly
|
|
672
|
+
readonly kind: "erc20BalanceGte";
|
|
673
673
|
readonly chainId: number;
|
|
674
|
-
readonly kind: "nativeBalanceGte";
|
|
675
|
-
readonly owner: string;
|
|
676
|
-
} | {
|
|
677
674
|
readonly token: string;
|
|
675
|
+
readonly owner: string;
|
|
678
676
|
readonly minAmount: string;
|
|
677
|
+
} | {
|
|
678
|
+
readonly kind: "nativeBalanceGte";
|
|
679
679
|
readonly chainId: number;
|
|
680
|
-
readonly kind: "erc20BalanceGte";
|
|
681
680
|
readonly owner: string;
|
|
681
|
+
readonly minAmount: string;
|
|
682
682
|
} | {
|
|
683
|
-
readonly chainId: number;
|
|
684
683
|
readonly kind: "call";
|
|
684
|
+
readonly chainId: number;
|
|
685
685
|
readonly to: string;
|
|
686
686
|
readonly signature: string;
|
|
687
687
|
readonly args: readonly string[];
|
|
@@ -2234,10 +2234,36 @@ type NativeBalanceRequirement = NativeBalancePrecondition;
|
|
|
2234
2234
|
/** Funding instruction: seed an ERC-20 allowance before simulation. */
|
|
2235
2235
|
type Erc20AllowanceRequirement = Erc20AllowancePrecondition;
|
|
2236
2236
|
/**
|
|
2237
|
-
*
|
|
2237
|
+
* Funding instruction: seed a Uniswap Permit2 `AllowanceTransfer` allowance
|
|
2238
|
+
* before simulation, so a `Permit2.transferFrom(owner, _, amount, token)` sent
|
|
2239
|
+
* by `spender` passes Permit2's own check.
|
|
2240
|
+
*
|
|
2241
|
+
* slot-finder writes two overrides: Permit2's `allowance[owner][token][spender]`
|
|
2242
|
+
* (no expiry, the owner's live nonce kept) and the ERC-20 allowance
|
|
2243
|
+
* `owner` → Permit2 that the pull spends. It does not fund the owner's token
|
|
2244
|
+
* balance: add an `Erc20Balance` for that. Only the canonical Permit2 address
|
|
2245
|
+
* `0x000000000022D473030F116dDEE9F6B43aC78BA3` is supported; on a chain
|
|
2246
|
+
* without code there the simulation answers HTTP 422.
|
|
2247
|
+
*
|
|
2248
|
+
* Unlike the other variants this is not a compile precondition: no op declares
|
|
2249
|
+
* a Permit2 allowance, so only a `POST /simulate` caller sends one.
|
|
2250
|
+
*/
|
|
2251
|
+
type Permit2AllowanceRequirement = {
|
|
2252
|
+
readonly type: 'Permit2Allowance';
|
|
2253
|
+
/** Address whose tokens Permit2 pulls. */
|
|
2254
|
+
readonly owner: string;
|
|
2255
|
+
/** ERC-20 token Permit2 pulls. */
|
|
2256
|
+
readonly token: string;
|
|
2257
|
+
/** Address that calls `Permit2.transferFrom`. */
|
|
2258
|
+
readonly spender: string;
|
|
2259
|
+
/** Permit2 allowance amount, in the token's base units. */
|
|
2260
|
+
readonly amount: bigint | string;
|
|
2261
|
+
};
|
|
2262
|
+
/**
|
|
2263
|
+
* The funding-instruction union applied before a simulation. Four variants,
|
|
2238
2264
|
* discriminated by `type`.
|
|
2239
2265
|
*/
|
|
2240
|
-
type SlotFinderRequirement = Erc20BalanceRequirement | NativeBalanceRequirement | Erc20AllowanceRequirement;
|
|
2266
|
+
type SlotFinderRequirement = Erc20BalanceRequirement | NativeBalanceRequirement | Erc20AllowanceRequirement | Permit2AllowanceRequirement;
|
|
2241
2267
|
/** Request body for `POST /simulate`. */
|
|
2242
2268
|
interface SimulateRequest {
|
|
2243
2269
|
/** EVM chain id. */
|
|
@@ -2415,4 +2441,4 @@ export declare const foldMaterialiserMetadata: <R>(meta: MaterialiserMetadata, c
|
|
|
2415
2441
|
readonly runtime: (min: bigint | undefined) => R;
|
|
2416
2442
|
}) => R;
|
|
2417
2443
|
//#endregion
|
|
2418
|
-
export type { Amount, AppliedGuard, ApprovalEntry, AssertedPredicate, AssertionOwner, AssertionSpec, AssertionSpecWire, Availability, BindValue, Call, CallCheckSpec, ChainCapabilities, CommittedOutcome, ComposeAction, ComposeCompilePartialData, ComposeCompileRequest, ComposeCompileResult, ComposeCompileSuccessData, ComposeError, ComposeErrorKind, ComposeFill, ComposeManifest, ComposeRouteErrorKind, ComposeRouteRequest, ComposeRun, ComposeTransactionRequest, ComposeUserProgramSimulation, ComposeVersion, ComposeWarning, ConsumedOutput, ContextKey, ContinuationIntent, ContinuationOutcome, Delivery, DeliveryComposeError, DeliveryErrorDetails, DeliveryErrorReason, ERC20Resource, Epilogue, EpilogueForward, Erc20AllowancePrecondition, Erc20AllowanceRequirement, Erc20BalancePrecondition, Erc20BalanceRequirement, Estimate, EstimateBasis, ExecutedEpilogue, ExecutedForward, FailedPreparedOp, FlashloanMaterialiserInput, Flow, FlowInput, ForwardTo, GenericComposeError, GenericComposeErrorKind, GuardCompatibility, GuardSelector, HandleInput, HandlePort, HandleUnits, InputSpec, Lineage, LiteralBinding, ManifestGuard, ManifestMaterialiser, ManifestOperation, ManifestPrecondition, ManifestRouting, MaterialiserConfigOf, MaterialiserInput, MaterialiserInputBase, MaterialiserInputOf, MaterialiserMetadata, MaterialiserResolution, Minimum, MinimumBasis, NativeBalancePrecondition, NativeBalanceRequirement, NativeCheckPolicy, NativeErc20, NativeResource, OpInputPort, OpOutputPort, Output, OutputAmount, OutputFamilyPort, Outputs, ParsedRef, Phase1Artifact, Port, Precondition, PreconditionBase, PreconditionConfigOf, PreconditionOf, PreparationComposeError, PriceImpact, ProviderKindName, Ref, RefBuilder, RefPath, RefScope, Resource, ResourceInput, ResourceOutputPort, ResourcePort, RouteAmount, RouteAmountAll, RouteAmountExact, SettlementBindingWire, SettlementEscrowWire, SettlementWire, SimulateBalanceEntry, SimulateOkResult, SimulateRequest, SimulateResult, SimulateRevertDecodeResult, SimulateRevertResult, SimulateSetupErrorResult, SimulationPolicy, SimulationRevert, SimulationRevertComposeError, SlotFinderRequirement, SolType, SpendEntry, StaticSolType, TerminalOutput, TrackedBalance, VerificationDescriptor, VerificationDescriptorWire, VersionCompatibility };
|
|
2444
|
+
export type { Amount, AppliedGuard, ApprovalEntry, AssertedPredicate, AssertionOwner, AssertionSpec, AssertionSpecWire, Availability, BindValue, Call, CallCheckSpec, ChainCapabilities, CommittedOutcome, ComposeAction, ComposeCompilePartialData, ComposeCompileRequest, ComposeCompileResult, ComposeCompileSuccessData, ComposeError, ComposeErrorKind, ComposeFill, ComposeManifest, ComposeRouteErrorKind, ComposeRouteRequest, ComposeRun, ComposeTransactionRequest, ComposeUserProgramSimulation, ComposeVersion, ComposeWarning, ConsumedOutput, ContextKey, ContinuationIntent, ContinuationOutcome, Delivery, DeliveryComposeError, DeliveryErrorDetails, DeliveryErrorReason, ERC20Resource, Epilogue, EpilogueForward, Erc20AllowancePrecondition, Erc20AllowanceRequirement, Erc20BalancePrecondition, Erc20BalanceRequirement, Estimate, EstimateBasis, ExecutedEpilogue, ExecutedForward, FailedPreparedOp, FlashloanMaterialiserInput, Flow, FlowInput, ForwardTo, GenericComposeError, GenericComposeErrorKind, GuardCompatibility, GuardSelector, HandleInput, HandlePort, HandleUnits, InputSpec, Lineage, LiteralBinding, ManifestGuard, ManifestMaterialiser, ManifestOperation, ManifestPrecondition, ManifestRouting, MaterialiserConfigOf, MaterialiserInput, MaterialiserInputBase, MaterialiserInputOf, MaterialiserMetadata, MaterialiserResolution, Minimum, MinimumBasis, NativeBalancePrecondition, NativeBalanceRequirement, NativeCheckPolicy, NativeErc20, NativeResource, OpInputPort, OpOutputPort, Output, OutputAmount, OutputFamilyPort, Outputs, ParsedRef, Permit2AllowanceRequirement, Phase1Artifact, Port, Precondition, PreconditionBase, PreconditionConfigOf, PreconditionOf, PreparationComposeError, PriceImpact, ProviderKindName, Ref, RefBuilder, RefPath, RefScope, Resource, ResourceInput, ResourceOutputPort, ResourcePort, RouteAmount, RouteAmountAll, RouteAmountExact, SettlementBindingWire, SettlementEscrowWire, SettlementWire, SimulateBalanceEntry, SimulateOkResult, SimulateRequest, SimulateResult, SimulateRevertDecodeResult, SimulateRevertResult, SimulateSetupErrorResult, SimulationPolicy, SimulationRevert, SimulationRevertComposeError, SlotFinderRequirement, SolType, SpendEntry, StaticSolType, TerminalOutput, TrackedBalance, VerificationDescriptor, VerificationDescriptorWire, VersionCompatibility };
|
package/dist/index.d.ts
CHANGED
|
@@ -29,19 +29,19 @@ export declare const ResourceSchema: Schema.transform<Schema.Union<[Schema.Struc
|
|
|
29
29
|
token: Schema.refine<string, typeof Schema.String>;
|
|
30
30
|
chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
|
|
31
31
|
}>]>, Schema.SchemaClass<{
|
|
32
|
-
readonly chainId: number;
|
|
33
32
|
readonly kind: "native";
|
|
34
|
-
} | {
|
|
35
|
-
readonly token: string;
|
|
36
33
|
readonly chainId: number;
|
|
34
|
+
} | {
|
|
37
35
|
readonly kind: "erc20";
|
|
38
|
-
}, {
|
|
39
36
|
readonly chainId: number;
|
|
40
|
-
readonly kind: "native";
|
|
41
|
-
} | {
|
|
42
37
|
readonly token: string;
|
|
38
|
+
}, {
|
|
39
|
+
readonly kind: "native";
|
|
43
40
|
readonly chainId: number;
|
|
41
|
+
} | {
|
|
44
42
|
readonly kind: "erc20";
|
|
43
|
+
readonly chainId: number;
|
|
44
|
+
readonly token: string;
|
|
45
45
|
}, never>>;
|
|
46
46
|
export declare const ResourceInputSchema: Schema.Struct<{
|
|
47
47
|
name: typeof Schema.String;
|
|
@@ -53,19 +53,19 @@ export declare const ResourceInputSchema: Schema.Struct<{
|
|
|
53
53
|
token: Schema.refine<string, typeof Schema.String>;
|
|
54
54
|
chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
|
|
55
55
|
}>]>, Schema.SchemaClass<{
|
|
56
|
-
readonly chainId: number;
|
|
57
56
|
readonly kind: "native";
|
|
58
|
-
} | {
|
|
59
|
-
readonly token: string;
|
|
60
57
|
readonly chainId: number;
|
|
58
|
+
} | {
|
|
61
59
|
readonly kind: "erc20";
|
|
62
|
-
}, {
|
|
63
60
|
readonly chainId: number;
|
|
64
|
-
readonly kind: "native";
|
|
65
|
-
} | {
|
|
66
61
|
readonly token: string;
|
|
62
|
+
}, {
|
|
63
|
+
readonly kind: "native";
|
|
67
64
|
readonly chainId: number;
|
|
65
|
+
} | {
|
|
68
66
|
readonly kind: "erc20";
|
|
67
|
+
readonly chainId: number;
|
|
68
|
+
readonly token: string;
|
|
69
69
|
}, never>>;
|
|
70
70
|
}>;
|
|
71
71
|
export declare const HandleInputSchema: Schema.Struct<{
|
|
@@ -82,19 +82,19 @@ export declare const FlowInputSchema: Schema.Union<[Schema.Struct<{
|
|
|
82
82
|
token: Schema.refine<string, typeof Schema.String>;
|
|
83
83
|
chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
|
|
84
84
|
}>]>, Schema.SchemaClass<{
|
|
85
|
-
readonly chainId: number;
|
|
86
85
|
readonly kind: "native";
|
|
87
|
-
} | {
|
|
88
|
-
readonly token: string;
|
|
89
86
|
readonly chainId: number;
|
|
87
|
+
} | {
|
|
90
88
|
readonly kind: "erc20";
|
|
91
|
-
}, {
|
|
92
89
|
readonly chainId: number;
|
|
93
|
-
readonly kind: "native";
|
|
94
|
-
} | {
|
|
95
90
|
readonly token: string;
|
|
91
|
+
}, {
|
|
92
|
+
readonly kind: "native";
|
|
96
93
|
readonly chainId: number;
|
|
94
|
+
} | {
|
|
97
95
|
readonly kind: "erc20";
|
|
96
|
+
readonly chainId: number;
|
|
97
|
+
readonly token: string;
|
|
98
98
|
}, never>>;
|
|
99
99
|
}>, Schema.Struct<{
|
|
100
100
|
name: typeof Schema.String;
|
|
@@ -157,19 +157,19 @@ export declare const EpilogueForwardSchema: Schema.Struct<{
|
|
|
157
157
|
token: Schema.refine<string, typeof Schema.String>;
|
|
158
158
|
chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
|
|
159
159
|
}>]>, Schema.SchemaClass<{
|
|
160
|
-
readonly chainId: number;
|
|
161
160
|
readonly kind: "native";
|
|
162
|
-
} | {
|
|
163
|
-
readonly token: string;
|
|
164
161
|
readonly chainId: number;
|
|
162
|
+
} | {
|
|
165
163
|
readonly kind: "erc20";
|
|
166
|
-
}, {
|
|
167
164
|
readonly chainId: number;
|
|
168
|
-
readonly kind: "native";
|
|
169
|
-
} | {
|
|
170
165
|
readonly token: string;
|
|
166
|
+
}, {
|
|
167
|
+
readonly kind: "native";
|
|
171
168
|
readonly chainId: number;
|
|
169
|
+
} | {
|
|
172
170
|
readonly kind: "erc20";
|
|
171
|
+
readonly chainId: number;
|
|
172
|
+
readonly token: string;
|
|
173
173
|
}, never>>;
|
|
174
174
|
to: Schema.Union<[Schema.refine<string, typeof Schema.String>, Schema.Struct<{
|
|
175
175
|
$ref: Schema.filter<typeof Schema.String>;
|
|
@@ -185,19 +185,19 @@ export declare const EpilogueSchema: Schema.filter<Schema.Struct<{
|
|
|
185
185
|
token: Schema.refine<string, typeof Schema.String>;
|
|
186
186
|
chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
|
|
187
187
|
}>]>, Schema.SchemaClass<{
|
|
188
|
-
readonly chainId: number;
|
|
189
188
|
readonly kind: "native";
|
|
190
|
-
} | {
|
|
191
|
-
readonly token: string;
|
|
192
189
|
readonly chainId: number;
|
|
190
|
+
} | {
|
|
193
191
|
readonly kind: "erc20";
|
|
194
|
-
}, {
|
|
195
192
|
readonly chainId: number;
|
|
196
|
-
readonly kind: "native";
|
|
197
|
-
} | {
|
|
198
193
|
readonly token: string;
|
|
194
|
+
}, {
|
|
195
|
+
readonly kind: "native";
|
|
199
196
|
readonly chainId: number;
|
|
197
|
+
} | {
|
|
200
198
|
readonly kind: "erc20";
|
|
199
|
+
readonly chainId: number;
|
|
200
|
+
readonly token: string;
|
|
201
201
|
}, never>>;
|
|
202
202
|
to: Schema.Union<[Schema.refine<string, typeof Schema.String>, Schema.Struct<{
|
|
203
203
|
$ref: Schema.filter<typeof Schema.String>;
|
|
@@ -221,19 +221,19 @@ export declare const FlowSchema: Schema.Struct<{
|
|
|
221
221
|
token: Schema.refine<string, typeof Schema.String>;
|
|
222
222
|
chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
|
|
223
223
|
}>]>, Schema.SchemaClass<{
|
|
224
|
-
readonly chainId: number;
|
|
225
224
|
readonly kind: "native";
|
|
226
|
-
} | {
|
|
227
|
-
readonly token: string;
|
|
228
225
|
readonly chainId: number;
|
|
226
|
+
} | {
|
|
229
227
|
readonly kind: "erc20";
|
|
230
|
-
}, {
|
|
231
228
|
readonly chainId: number;
|
|
232
|
-
readonly kind: "native";
|
|
233
|
-
} | {
|
|
234
229
|
readonly token: string;
|
|
230
|
+
}, {
|
|
231
|
+
readonly kind: "native";
|
|
235
232
|
readonly chainId: number;
|
|
233
|
+
} | {
|
|
236
234
|
readonly kind: "erc20";
|
|
235
|
+
readonly chainId: number;
|
|
236
|
+
readonly token: string;
|
|
237
237
|
}, never>>;
|
|
238
238
|
}>, Schema.Struct<{
|
|
239
239
|
name: typeof Schema.String;
|
|
@@ -274,19 +274,19 @@ export declare const FlowSchema: Schema.Struct<{
|
|
|
274
274
|
token: Schema.refine<string, typeof Schema.String>;
|
|
275
275
|
chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
|
|
276
276
|
}>]>, Schema.SchemaClass<{
|
|
277
|
-
readonly chainId: number;
|
|
278
277
|
readonly kind: "native";
|
|
279
|
-
} | {
|
|
280
|
-
readonly token: string;
|
|
281
278
|
readonly chainId: number;
|
|
279
|
+
} | {
|
|
282
280
|
readonly kind: "erc20";
|
|
283
|
-
}, {
|
|
284
281
|
readonly chainId: number;
|
|
285
|
-
readonly kind: "native";
|
|
286
|
-
} | {
|
|
287
282
|
readonly token: string;
|
|
283
|
+
}, {
|
|
284
|
+
readonly kind: "native";
|
|
288
285
|
readonly chainId: number;
|
|
286
|
+
} | {
|
|
289
287
|
readonly kind: "erc20";
|
|
288
|
+
readonly chainId: number;
|
|
289
|
+
readonly token: string;
|
|
290
290
|
}, never>>;
|
|
291
291
|
to: Schema.Union<[Schema.refine<string, typeof Schema.String>, Schema.Struct<{
|
|
292
292
|
$ref: Schema.filter<typeof Schema.String>;
|
|
@@ -315,68 +315,68 @@ type Flow = typeof FlowSchema.Type;
|
|
|
315
315
|
//#region src/continuation.d.ts
|
|
316
316
|
export declare const CONTINUATION_COMMITMENT_OP_ID = "continuation.commitment";
|
|
317
317
|
export declare const ContinuationOutcomeSchema: Schema.transform<Schema.Schema<{
|
|
318
|
+
readonly chainId: number;
|
|
318
319
|
readonly token: string;
|
|
319
320
|
readonly minAmount?: string | undefined;
|
|
320
321
|
readonly destination: string;
|
|
321
|
-
readonly chainId: number;
|
|
322
322
|
}, {
|
|
323
|
+
readonly chainId: number;
|
|
323
324
|
readonly token: string;
|
|
324
325
|
readonly destination: string;
|
|
325
|
-
readonly chainId: number;
|
|
326
326
|
readonly minAmount?: string | undefined;
|
|
327
327
|
}, never>, Schema.SchemaClass<{
|
|
328
|
+
readonly chainId: number;
|
|
328
329
|
readonly token: string;
|
|
329
330
|
readonly minAmount?: string | undefined;
|
|
330
331
|
readonly destination: string;
|
|
331
|
-
readonly chainId: number;
|
|
332
332
|
}, {
|
|
333
|
+
readonly chainId: number;
|
|
333
334
|
readonly token: string;
|
|
334
335
|
readonly minAmount?: string | undefined;
|
|
335
336
|
readonly destination: string;
|
|
336
|
-
readonly chainId: number;
|
|
337
337
|
}, never>>;
|
|
338
338
|
export declare const CommittedOutcomeSchema: Schema.transform<Schema.Schema<{
|
|
339
|
+
readonly chainId: number;
|
|
339
340
|
readonly token: string;
|
|
340
341
|
readonly minAmount: string;
|
|
341
342
|
readonly destination: string;
|
|
342
|
-
readonly chainId: number;
|
|
343
343
|
}, {
|
|
344
|
+
readonly chainId: number;
|
|
344
345
|
readonly token: string;
|
|
345
346
|
readonly minAmount: string;
|
|
346
347
|
readonly destination: string;
|
|
347
|
-
readonly chainId: number;
|
|
348
348
|
}, never>, Schema.SchemaClass<{
|
|
349
|
+
readonly chainId: number;
|
|
349
350
|
readonly token: string;
|
|
350
351
|
readonly minAmount: string;
|
|
351
352
|
readonly destination: string;
|
|
352
|
-
readonly chainId: number;
|
|
353
353
|
}, {
|
|
354
|
+
readonly chainId: number;
|
|
354
355
|
readonly token: string;
|
|
355
356
|
readonly minAmount: string;
|
|
356
357
|
readonly destination: string;
|
|
357
|
-
readonly chainId: number;
|
|
358
358
|
}, never>>;
|
|
359
359
|
export declare const ContinuationIntentSchema: Schema.Struct<{
|
|
360
|
-
outcomes: Schema.
|
|
360
|
+
outcomes: Schema.Array$<Schema.transform<Schema.Schema<{
|
|
361
|
+
readonly chainId: number;
|
|
361
362
|
readonly token: string;
|
|
362
363
|
readonly minAmount?: string | undefined;
|
|
363
364
|
readonly destination: string;
|
|
364
|
-
readonly chainId: number;
|
|
365
365
|
}, {
|
|
366
|
+
readonly chainId: number;
|
|
366
367
|
readonly token: string;
|
|
367
368
|
readonly destination: string;
|
|
368
|
-
readonly chainId: number;
|
|
369
369
|
readonly minAmount?: string | undefined;
|
|
370
370
|
}, never>, Schema.SchemaClass<{
|
|
371
|
+
readonly chainId: number;
|
|
371
372
|
readonly token: string;
|
|
372
373
|
readonly minAmount?: string | undefined;
|
|
373
374
|
readonly destination: string;
|
|
374
|
-
readonly chainId: number;
|
|
375
375
|
}, {
|
|
376
|
+
readonly chainId: number;
|
|
376
377
|
readonly token: string;
|
|
377
378
|
readonly minAmount?: string | undefined;
|
|
378
379
|
readonly destination: string;
|
|
379
|
-
readonly chainId: number;
|
|
380
380
|
}, never>>>;
|
|
381
381
|
continuationFlow: Schema.optional<Schema.Struct<{
|
|
382
382
|
version: Schema.Literal<[1]>;
|
|
@@ -392,19 +392,19 @@ export declare const ContinuationIntentSchema: Schema.Struct<{
|
|
|
392
392
|
token: Schema.refine<string, typeof Schema.String>;
|
|
393
393
|
chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
|
|
394
394
|
}>]>, Schema.SchemaClass<{
|
|
395
|
-
readonly chainId: number;
|
|
396
395
|
readonly kind: "native";
|
|
397
|
-
} | {
|
|
398
|
-
readonly token: string;
|
|
399
396
|
readonly chainId: number;
|
|
397
|
+
} | {
|
|
400
398
|
readonly kind: "erc20";
|
|
401
|
-
}, {
|
|
402
399
|
readonly chainId: number;
|
|
403
|
-
readonly kind: "native";
|
|
404
|
-
} | {
|
|
405
400
|
readonly token: string;
|
|
401
|
+
}, {
|
|
402
|
+
readonly kind: "native";
|
|
406
403
|
readonly chainId: number;
|
|
404
|
+
} | {
|
|
407
405
|
readonly kind: "erc20";
|
|
406
|
+
readonly chainId: number;
|
|
407
|
+
readonly token: string;
|
|
408
408
|
}, never>>;
|
|
409
409
|
}>, Schema.Struct<{
|
|
410
410
|
name: typeof Schema.String;
|
|
@@ -445,19 +445,19 @@ export declare const ContinuationIntentSchema: Schema.Struct<{
|
|
|
445
445
|
token: Schema.refine<string, typeof Schema.String>;
|
|
446
446
|
chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
|
|
447
447
|
}>]>, Schema.SchemaClass<{
|
|
448
|
-
readonly chainId: number;
|
|
449
448
|
readonly kind: "native";
|
|
450
|
-
} | {
|
|
451
|
-
readonly token: string;
|
|
452
449
|
readonly chainId: number;
|
|
450
|
+
} | {
|
|
453
451
|
readonly kind: "erc20";
|
|
454
|
-
}, {
|
|
455
452
|
readonly chainId: number;
|
|
456
|
-
readonly kind: "native";
|
|
457
|
-
} | {
|
|
458
453
|
readonly token: string;
|
|
454
|
+
}, {
|
|
455
|
+
readonly kind: "native";
|
|
459
456
|
readonly chainId: number;
|
|
457
|
+
} | {
|
|
460
458
|
readonly kind: "erc20";
|
|
459
|
+
readonly chainId: number;
|
|
460
|
+
readonly token: string;
|
|
461
461
|
}, never>>;
|
|
462
462
|
to: Schema.Union<[Schema.refine<string, typeof Schema.String>, Schema.Struct<{
|
|
463
463
|
$ref: Schema.filter<typeof Schema.String>;
|
|
@@ -564,8 +564,8 @@ type Phase1Artifact = typeof Phase1ArtifactSchema.Type;
|
|
|
564
564
|
type AssertionSpec = typeof AssertionSpecSchema.Type;
|
|
565
565
|
type CallCheckSpec = typeof CallCheckSpecSchema.Type;
|
|
566
566
|
export declare const settledOutcome: <I extends {
|
|
567
|
-
readonly outcomes: readonly
|
|
568
|
-
}>(intent: I) => I["outcomes"][
|
|
567
|
+
readonly outcomes: readonly unknown[];
|
|
568
|
+
}>(intent: I) => I["outcomes"][number] | undefined;
|
|
569
569
|
//#endregion
|
|
570
570
|
//#region src/descriptor.d.ts
|
|
571
571
|
export declare const Bytes32HexSchema: Schema.filter<typeof Schema.String>;
|
|
@@ -589,38 +589,38 @@ export declare const AssertedPredicateSchema: Schema.transformOrFail<Schema.Unio
|
|
|
589
589
|
comparator: Schema.Literal<["gte", "eq", "lte"]>;
|
|
590
590
|
threshold: Schema.filter<typeof Schema.String>;
|
|
591
591
|
}>]>, Schema.SchemaClass<{
|
|
592
|
-
readonly
|
|
592
|
+
readonly kind: "erc20BalanceGte";
|
|
593
593
|
readonly chainId: number;
|
|
594
|
-
readonly kind: "nativeBalanceGte";
|
|
595
|
-
readonly owner: string;
|
|
596
|
-
} | {
|
|
597
594
|
readonly token: string;
|
|
595
|
+
readonly owner: string;
|
|
598
596
|
readonly minAmount: string;
|
|
597
|
+
} | {
|
|
598
|
+
readonly kind: "nativeBalanceGte";
|
|
599
599
|
readonly chainId: number;
|
|
600
|
-
readonly kind: "erc20BalanceGte";
|
|
601
600
|
readonly owner: string;
|
|
601
|
+
readonly minAmount: string;
|
|
602
602
|
} | {
|
|
603
|
-
readonly chainId: number;
|
|
604
603
|
readonly kind: "call";
|
|
604
|
+
readonly chainId: number;
|
|
605
605
|
readonly to: string;
|
|
606
606
|
readonly signature: string;
|
|
607
607
|
readonly args: readonly string[];
|
|
608
608
|
readonly comparator: "gte" | "eq" | "lte";
|
|
609
609
|
readonly threshold: string;
|
|
610
610
|
}, {
|
|
611
|
-
readonly
|
|
611
|
+
readonly kind: "erc20BalanceGte";
|
|
612
612
|
readonly chainId: number;
|
|
613
|
-
readonly kind: "nativeBalanceGte";
|
|
614
|
-
readonly owner: string;
|
|
615
|
-
} | {
|
|
616
613
|
readonly token: string;
|
|
614
|
+
readonly owner: string;
|
|
617
615
|
readonly minAmount: string;
|
|
616
|
+
} | {
|
|
617
|
+
readonly kind: "nativeBalanceGte";
|
|
618
618
|
readonly chainId: number;
|
|
619
|
-
readonly kind: "erc20BalanceGte";
|
|
620
619
|
readonly owner: string;
|
|
620
|
+
readonly minAmount: string;
|
|
621
621
|
} | {
|
|
622
|
-
readonly chainId: number;
|
|
623
622
|
readonly kind: "call";
|
|
623
|
+
readonly chainId: number;
|
|
624
624
|
readonly to: string;
|
|
625
625
|
readonly signature: string;
|
|
626
626
|
readonly args: readonly string[];
|
|
@@ -650,38 +650,38 @@ export declare const VerificationDescriptorSchema: Schema.Struct<{
|
|
|
650
650
|
comparator: Schema.Literal<["gte", "eq", "lte"]>;
|
|
651
651
|
threshold: Schema.filter<typeof Schema.String>;
|
|
652
652
|
}>]>, Schema.SchemaClass<{
|
|
653
|
-
readonly
|
|
653
|
+
readonly kind: "erc20BalanceGte";
|
|
654
654
|
readonly chainId: number;
|
|
655
|
-
readonly kind: "nativeBalanceGte";
|
|
656
|
-
readonly owner: string;
|
|
657
|
-
} | {
|
|
658
655
|
readonly token: string;
|
|
656
|
+
readonly owner: string;
|
|
659
657
|
readonly minAmount: string;
|
|
658
|
+
} | {
|
|
659
|
+
readonly kind: "nativeBalanceGte";
|
|
660
660
|
readonly chainId: number;
|
|
661
|
-
readonly kind: "erc20BalanceGte";
|
|
662
661
|
readonly owner: string;
|
|
662
|
+
readonly minAmount: string;
|
|
663
663
|
} | {
|
|
664
|
-
readonly chainId: number;
|
|
665
664
|
readonly kind: "call";
|
|
665
|
+
readonly chainId: number;
|
|
666
666
|
readonly to: string;
|
|
667
667
|
readonly signature: string;
|
|
668
668
|
readonly args: readonly string[];
|
|
669
669
|
readonly comparator: "gte" | "eq" | "lte";
|
|
670
670
|
readonly threshold: string;
|
|
671
671
|
}, {
|
|
672
|
-
readonly
|
|
672
|
+
readonly kind: "erc20BalanceGte";
|
|
673
673
|
readonly chainId: number;
|
|
674
|
-
readonly kind: "nativeBalanceGte";
|
|
675
|
-
readonly owner: string;
|
|
676
|
-
} | {
|
|
677
674
|
readonly token: string;
|
|
675
|
+
readonly owner: string;
|
|
678
676
|
readonly minAmount: string;
|
|
677
|
+
} | {
|
|
678
|
+
readonly kind: "nativeBalanceGte";
|
|
679
679
|
readonly chainId: number;
|
|
680
|
-
readonly kind: "erc20BalanceGte";
|
|
681
680
|
readonly owner: string;
|
|
681
|
+
readonly minAmount: string;
|
|
682
682
|
} | {
|
|
683
|
-
readonly chainId: number;
|
|
684
683
|
readonly kind: "call";
|
|
684
|
+
readonly chainId: number;
|
|
685
685
|
readonly to: string;
|
|
686
686
|
readonly signature: string;
|
|
687
687
|
readonly args: readonly string[];
|
|
@@ -2234,10 +2234,36 @@ type NativeBalanceRequirement = NativeBalancePrecondition;
|
|
|
2234
2234
|
/** Funding instruction: seed an ERC-20 allowance before simulation. */
|
|
2235
2235
|
type Erc20AllowanceRequirement = Erc20AllowancePrecondition;
|
|
2236
2236
|
/**
|
|
2237
|
-
*
|
|
2237
|
+
* Funding instruction: seed a Uniswap Permit2 `AllowanceTransfer` allowance
|
|
2238
|
+
* before simulation, so a `Permit2.transferFrom(owner, _, amount, token)` sent
|
|
2239
|
+
* by `spender` passes Permit2's own check.
|
|
2240
|
+
*
|
|
2241
|
+
* slot-finder writes two overrides: Permit2's `allowance[owner][token][spender]`
|
|
2242
|
+
* (no expiry, the owner's live nonce kept) and the ERC-20 allowance
|
|
2243
|
+
* `owner` → Permit2 that the pull spends. It does not fund the owner's token
|
|
2244
|
+
* balance: add an `Erc20Balance` for that. Only the canonical Permit2 address
|
|
2245
|
+
* `0x000000000022D473030F116dDEE9F6B43aC78BA3` is supported; on a chain
|
|
2246
|
+
* without code there the simulation answers HTTP 422.
|
|
2247
|
+
*
|
|
2248
|
+
* Unlike the other variants this is not a compile precondition: no op declares
|
|
2249
|
+
* a Permit2 allowance, so only a `POST /simulate` caller sends one.
|
|
2250
|
+
*/
|
|
2251
|
+
type Permit2AllowanceRequirement = {
|
|
2252
|
+
readonly type: 'Permit2Allowance';
|
|
2253
|
+
/** Address whose tokens Permit2 pulls. */
|
|
2254
|
+
readonly owner: string;
|
|
2255
|
+
/** ERC-20 token Permit2 pulls. */
|
|
2256
|
+
readonly token: string;
|
|
2257
|
+
/** Address that calls `Permit2.transferFrom`. */
|
|
2258
|
+
readonly spender: string;
|
|
2259
|
+
/** Permit2 allowance amount, in the token's base units. */
|
|
2260
|
+
readonly amount: bigint | string;
|
|
2261
|
+
};
|
|
2262
|
+
/**
|
|
2263
|
+
* The funding-instruction union applied before a simulation. Four variants,
|
|
2238
2264
|
* discriminated by `type`.
|
|
2239
2265
|
*/
|
|
2240
|
-
type SlotFinderRequirement = Erc20BalanceRequirement | NativeBalanceRequirement | Erc20AllowanceRequirement;
|
|
2266
|
+
type SlotFinderRequirement = Erc20BalanceRequirement | NativeBalanceRequirement | Erc20AllowanceRequirement | Permit2AllowanceRequirement;
|
|
2241
2267
|
/** Request body for `POST /simulate`. */
|
|
2242
2268
|
interface SimulateRequest {
|
|
2243
2269
|
/** EVM chain id. */
|
|
@@ -2415,4 +2441,4 @@ export declare const foldMaterialiserMetadata: <R>(meta: MaterialiserMetadata, c
|
|
|
2415
2441
|
readonly runtime: (min: bigint | undefined) => R;
|
|
2416
2442
|
}) => R;
|
|
2417
2443
|
//#endregion
|
|
2418
|
-
export type { Amount, AppliedGuard, ApprovalEntry, AssertedPredicate, AssertionOwner, AssertionSpec, AssertionSpecWire, Availability, BindValue, Call, CallCheckSpec, ChainCapabilities, CommittedOutcome, ComposeAction, ComposeCompilePartialData, ComposeCompileRequest, ComposeCompileResult, ComposeCompileSuccessData, ComposeError, ComposeErrorKind, ComposeFill, ComposeManifest, ComposeRouteErrorKind, ComposeRouteRequest, ComposeRun, ComposeTransactionRequest, ComposeUserProgramSimulation, ComposeVersion, ComposeWarning, ConsumedOutput, ContextKey, ContinuationIntent, ContinuationOutcome, Delivery, DeliveryComposeError, DeliveryErrorDetails, DeliveryErrorReason, ERC20Resource, Epilogue, EpilogueForward, Erc20AllowancePrecondition, Erc20AllowanceRequirement, Erc20BalancePrecondition, Erc20BalanceRequirement, Estimate, EstimateBasis, ExecutedEpilogue, ExecutedForward, FailedPreparedOp, FlashloanMaterialiserInput, Flow, FlowInput, ForwardTo, GenericComposeError, GenericComposeErrorKind, GuardCompatibility, GuardSelector, HandleInput, HandlePort, HandleUnits, InputSpec, Lineage, LiteralBinding, ManifestGuard, ManifestMaterialiser, ManifestOperation, ManifestPrecondition, ManifestRouting, MaterialiserConfigOf, MaterialiserInput, MaterialiserInputBase, MaterialiserInputOf, MaterialiserMetadata, MaterialiserResolution, Minimum, MinimumBasis, NativeBalancePrecondition, NativeBalanceRequirement, NativeCheckPolicy, NativeErc20, NativeResource, OpInputPort, OpOutputPort, Output, OutputAmount, OutputFamilyPort, Outputs, ParsedRef, Phase1Artifact, Port, Precondition, PreconditionBase, PreconditionConfigOf, PreconditionOf, PreparationComposeError, PriceImpact, ProviderKindName, Ref, RefBuilder, RefPath, RefScope, Resource, ResourceInput, ResourceOutputPort, ResourcePort, RouteAmount, RouteAmountAll, RouteAmountExact, SettlementBindingWire, SettlementEscrowWire, SettlementWire, SimulateBalanceEntry, SimulateOkResult, SimulateRequest, SimulateResult, SimulateRevertDecodeResult, SimulateRevertResult, SimulateSetupErrorResult, SimulationPolicy, SimulationRevert, SimulationRevertComposeError, SlotFinderRequirement, SolType, SpendEntry, StaticSolType, TerminalOutput, TrackedBalance, VerificationDescriptor, VerificationDescriptorWire, VersionCompatibility };
|
|
2444
|
+
export type { Amount, AppliedGuard, ApprovalEntry, AssertedPredicate, AssertionOwner, AssertionSpec, AssertionSpecWire, Availability, BindValue, Call, CallCheckSpec, ChainCapabilities, CommittedOutcome, ComposeAction, ComposeCompilePartialData, ComposeCompileRequest, ComposeCompileResult, ComposeCompileSuccessData, ComposeError, ComposeErrorKind, ComposeFill, ComposeManifest, ComposeRouteErrorKind, ComposeRouteRequest, ComposeRun, ComposeTransactionRequest, ComposeUserProgramSimulation, ComposeVersion, ComposeWarning, ConsumedOutput, ContextKey, ContinuationIntent, ContinuationOutcome, Delivery, DeliveryComposeError, DeliveryErrorDetails, DeliveryErrorReason, ERC20Resource, Epilogue, EpilogueForward, Erc20AllowancePrecondition, Erc20AllowanceRequirement, Erc20BalancePrecondition, Erc20BalanceRequirement, Estimate, EstimateBasis, ExecutedEpilogue, ExecutedForward, FailedPreparedOp, FlashloanMaterialiserInput, Flow, FlowInput, ForwardTo, GenericComposeError, GenericComposeErrorKind, GuardCompatibility, GuardSelector, HandleInput, HandlePort, HandleUnits, InputSpec, Lineage, LiteralBinding, ManifestGuard, ManifestMaterialiser, ManifestOperation, ManifestPrecondition, ManifestRouting, MaterialiserConfigOf, MaterialiserInput, MaterialiserInputBase, MaterialiserInputOf, MaterialiserMetadata, MaterialiserResolution, Minimum, MinimumBasis, NativeBalancePrecondition, NativeBalanceRequirement, NativeCheckPolicy, NativeErc20, NativeResource, OpInputPort, OpOutputPort, Output, OutputAmount, OutputFamilyPort, Outputs, ParsedRef, Permit2AllowanceRequirement, Phase1Artifact, Port, Precondition, PreconditionBase, PreconditionConfigOf, PreconditionOf, PreparationComposeError, PriceImpact, ProviderKindName, Ref, RefBuilder, RefPath, RefScope, Resource, ResourceInput, ResourceOutputPort, ResourcePort, RouteAmount, RouteAmountAll, RouteAmountExact, SettlementBindingWire, SettlementEscrowWire, SettlementWire, SimulateBalanceEntry, SimulateOkResult, SimulateRequest, SimulateResult, SimulateRevertDecodeResult, SimulateRevertResult, SimulateSetupErrorResult, SimulationPolicy, SimulationRevert, SimulationRevertComposeError, SlotFinderRequirement, SolType, SpendEntry, StaticSolType, TerminalOutput, TrackedBalance, VerificationDescriptor, VerificationDescriptorWire, VersionCompatibility };
|
package/dist/index.js
CHANGED
|
@@ -37,16 +37,26 @@ const ARC_NATIVE_ERC20 = {
|
|
|
37
37
|
decimals: 6
|
|
38
38
|
};
|
|
39
39
|
const ARC_NATIVE_SCALE = 10n ** BigInt(18 - ARC_NATIVE_ERC20.decimals);
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
const ARC_TESTNET_CHAIN_ID = 5042002;
|
|
41
|
+
const REGISTRY = /* @__PURE__ */ new Map([
|
|
42
|
+
[TEMPO_CHAIN_ID, {
|
|
43
|
+
kind: "as-erc20",
|
|
44
|
+
chainId: TEMPO_CHAIN_ID,
|
|
45
|
+
nativeErc20: TEMPO_NATIVE_ERC20
|
|
46
|
+
}],
|
|
47
|
+
[ARC_CHAIN_ID, {
|
|
48
|
+
kind: "native-mirrored-erc20",
|
|
49
|
+
chainId: ARC_CHAIN_ID,
|
|
50
|
+
nativeErc20: ARC_NATIVE_ERC20,
|
|
51
|
+
nativeScale: ARC_NATIVE_SCALE
|
|
52
|
+
}],
|
|
53
|
+
[ARC_TESTNET_CHAIN_ID, {
|
|
54
|
+
kind: "native-mirrored-erc20",
|
|
55
|
+
chainId: ARC_TESTNET_CHAIN_ID,
|
|
56
|
+
nativeErc20: ARC_NATIVE_ERC20,
|
|
57
|
+
nativeScale: ARC_NATIVE_SCALE
|
|
58
|
+
}]
|
|
59
|
+
]);
|
|
50
60
|
const getChainCapabilities = (chainId) => REGISTRY.get(chainId) ?? {
|
|
51
61
|
kind: "evm-native",
|
|
52
62
|
chainId
|
|
@@ -299,7 +309,7 @@ const normalizingOutcome = (raw) => Schema.transform(raw, Schema.typeSchema(raw)
|
|
|
299
309
|
const ContinuationOutcomeSchema = normalizingOutcome(Schema.Struct(outcomeFields(Schema.optional(IntegerString))));
|
|
300
310
|
const CommittedOutcomeSchema = normalizingOutcome(Schema.Struct(outcomeFields(IntegerString)));
|
|
301
311
|
const ContinuationIntentSchema = Schema.Struct({
|
|
302
|
-
outcomes: Schema.
|
|
312
|
+
outcomes: Schema.Array(ContinuationOutcomeSchema),
|
|
303
313
|
continuationFlow: Schema.optional(FlowSchema),
|
|
304
314
|
validity: Schema.Struct({ expiresAtMs: EpochMsSchema }),
|
|
305
315
|
provider: Schema.optional(Schema.String),
|
package/package.json
CHANGED
package/src/chainCapabilities.ts
CHANGED
|
@@ -99,6 +99,10 @@ export const ARC_NATIVE_ERC20: NativeErc20 = {
|
|
|
99
99
|
// the scale silently wrong. Native wei is 18-decimal at the EVM level.
|
|
100
100
|
export const ARC_NATIVE_SCALE = 10n ** BigInt(18 - ARC_NATIVE_ERC20.decimals);
|
|
101
101
|
|
|
102
|
+
// Arc Testnet runs the same USDC facade at the same address, so it reuses
|
|
103
|
+
// Arc's facts rather than carrying a second copy.
|
|
104
|
+
export const ARC_TESTNET_CHAIN_ID = 5042002;
|
|
105
|
+
|
|
102
106
|
const REGISTRY: ReadonlyMap<number, ChainCapabilities> = new Map<
|
|
103
107
|
number,
|
|
104
108
|
ChainCapabilities
|
|
@@ -120,6 +124,15 @@ const REGISTRY: ReadonlyMap<number, ChainCapabilities> = new Map<
|
|
|
120
124
|
nativeScale: ARC_NATIVE_SCALE,
|
|
121
125
|
},
|
|
122
126
|
],
|
|
127
|
+
[
|
|
128
|
+
ARC_TESTNET_CHAIN_ID,
|
|
129
|
+
{
|
|
130
|
+
kind: 'native-mirrored-erc20',
|
|
131
|
+
chainId: ARC_TESTNET_CHAIN_ID,
|
|
132
|
+
nativeErc20: ARC_NATIVE_ERC20,
|
|
133
|
+
nativeScale: ARC_NATIVE_SCALE,
|
|
134
|
+
},
|
|
135
|
+
],
|
|
123
136
|
]);
|
|
124
137
|
|
|
125
138
|
/**
|
package/src/continuation.ts
CHANGED
|
@@ -91,8 +91,11 @@ export const CommittedOutcomeSchema = normalizingOutcome(
|
|
|
91
91
|
// pointer. `FlowSchema` lives in the same package, so importing it here keeps
|
|
92
92
|
// `compose-spec` dependency-free.
|
|
93
93
|
export const ContinuationIntentSchema = Schema.Struct({
|
|
94
|
-
//
|
|
95
|
-
|
|
94
|
+
// Zero outcomes are admitted only for an exact settle, whose bound leg is its
|
|
95
|
+
// only enforcement; compose-core's first two capability gates
|
|
96
|
+
// (`resolveContinuationProvider.ts:CAPABILITY_CHECKS`) enforce that pairing
|
|
97
|
+
// and the one-outcome maximum, since the schema cannot see `exact`.
|
|
98
|
+
outcomes: Schema.Array(ContinuationOutcomeSchema),
|
|
96
99
|
continuationFlow: Schema.optional(FlowSchema),
|
|
97
100
|
validity: Schema.Struct({ expiresAtMs: EpochMsSchema }),
|
|
98
101
|
provider: Schema.optional(Schema.String),
|
|
@@ -338,12 +341,14 @@ export type CallCheckSpec = typeof CallCheckSpecSchema.Type;
|
|
|
338
341
|
// The outcome a `continuation.settle` node's single `output` port stands for.
|
|
339
342
|
// The wire format admits several outcomes, but the op produces one resource,
|
|
340
343
|
// discloses one owner, and every shipped provider rejects a multi-outcome
|
|
341
|
-
// intent, so the first outcome is the settled one everywhere. `
|
|
342
|
-
//
|
|
343
|
-
//
|
|
344
|
-
//
|
|
344
|
+
// intent, so the first outcome is the settled one everywhere. `undefined`
|
|
345
|
+
// means a zero-outcome exact settle: the bound leg consumes the funding and
|
|
346
|
+
// delivers nothing, so the `output` port carries no resource. Keep this the
|
|
347
|
+
// only place that picks `[0]`: a multi-outcome design changes one accessor,
|
|
348
|
+
// not a scatter of `[0]`s. Generic over the intent so a `CommittedIntent`
|
|
349
|
+
// yields a `CommittedOutcome`.
|
|
345
350
|
export const settledOutcome = <
|
|
346
|
-
I extends { readonly outcomes: readonly
|
|
351
|
+
I extends { readonly outcomes: readonly unknown[] },
|
|
347
352
|
>(
|
|
348
353
|
intent: I,
|
|
349
|
-
): I['outcomes'][
|
|
354
|
+
): I['outcomes'][number] | undefined => intent.outcomes[0];
|
package/src/index.ts
CHANGED
package/src/simulate.ts
CHANGED
|
@@ -67,13 +67,41 @@ export type NativeBalanceRequirement = NativeBalancePrecondition;
|
|
|
67
67
|
export type Erc20AllowanceRequirement = Erc20AllowancePrecondition;
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
|
-
*
|
|
70
|
+
* Funding instruction: seed a Uniswap Permit2 `AllowanceTransfer` allowance
|
|
71
|
+
* before simulation, so a `Permit2.transferFrom(owner, _, amount, token)` sent
|
|
72
|
+
* by `spender` passes Permit2's own check.
|
|
73
|
+
*
|
|
74
|
+
* slot-finder writes two overrides: Permit2's `allowance[owner][token][spender]`
|
|
75
|
+
* (no expiry, the owner's live nonce kept) and the ERC-20 allowance
|
|
76
|
+
* `owner` → Permit2 that the pull spends. It does not fund the owner's token
|
|
77
|
+
* balance: add an `Erc20Balance` for that. Only the canonical Permit2 address
|
|
78
|
+
* `0x000000000022D473030F116dDEE9F6B43aC78BA3` is supported; on a chain
|
|
79
|
+
* without code there the simulation answers HTTP 422.
|
|
80
|
+
*
|
|
81
|
+
* Unlike the other variants this is not a compile precondition: no op declares
|
|
82
|
+
* a Permit2 allowance, so only a `POST /simulate` caller sends one.
|
|
83
|
+
*/
|
|
84
|
+
export type Permit2AllowanceRequirement = {
|
|
85
|
+
readonly type: 'Permit2Allowance';
|
|
86
|
+
/** Address whose tokens Permit2 pulls. */
|
|
87
|
+
readonly owner: string;
|
|
88
|
+
/** ERC-20 token Permit2 pulls. */
|
|
89
|
+
readonly token: string;
|
|
90
|
+
/** Address that calls `Permit2.transferFrom`. */
|
|
91
|
+
readonly spender: string;
|
|
92
|
+
/** Permit2 allowance amount, in the token's base units. */
|
|
93
|
+
readonly amount: bigint | string;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The funding-instruction union applied before a simulation. Four variants,
|
|
71
98
|
* discriminated by `type`.
|
|
72
99
|
*/
|
|
73
100
|
export type SlotFinderRequirement =
|
|
74
101
|
| Erc20BalanceRequirement
|
|
75
102
|
| NativeBalanceRequirement
|
|
76
|
-
| Erc20AllowanceRequirement
|
|
103
|
+
| Erc20AllowanceRequirement
|
|
104
|
+
| Permit2AllowanceRequirement;
|
|
77
105
|
|
|
78
106
|
/** Request body for `POST /simulate`. */
|
|
79
107
|
export interface SimulateRequest {
|