@lifi/compose-spec 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.cjs +95 -109
- package/dist/index.d.cts +450 -568
- package/dist/index.d.ts +450 -568
- package/dist/index.js +91 -105
- package/package.json +1 -1
- package/src/chainCapabilities.ts +6 -6
- package/src/compile.ts +45 -33
- package/src/continuation.ts +158 -107
- package/src/descriptor.ts +20 -72
- package/src/flow.ts +40 -4
- package/src/flowSchema.ts +26 -12
- package/src/hexPatterns.ts +0 -5
- package/src/index.ts +25 -9
- package/src/manifest.ts +1 -0
- package/src/materialiserMetadata.ts +6 -3
- package/src/output.ts +20 -13
- package/src/resource.ts +43 -30
- package/src/route.ts +10 -15
- package/src/zodSchemas.ts +58 -71
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ npm install @lifi/compose-spec
|
|
|
16
16
|
- **Continuation types** — `ContinuationIntent`, `ContinuationOutcome`, `AssertionSpec`
|
|
17
17
|
- **Resource types** — `Resource`, `Availability`, plus helpers like `erc20Token`, `foldResource`, `resourceKey`
|
|
18
18
|
- **Output types** — `Outputs`, `Output`, `ConsumedOutput`, `TerminalOutput`, `Amount`, `Estimate`, `Minimum`, `Delivery`, `EstimateBasis`, `MinimumBasis` — the per-port `outputs` record on a compile result
|
|
19
|
-
- **Manifest types** — `ComposeManifest`, `ManifestOperation`, `ManifestGuard`, `ManifestMaterialiser`, `ManifestPrecondition`
|
|
19
|
+
- **Manifest types** — `ComposeManifest`, `ManifestOperation`, `ManifestGuard`, `ManifestMaterialiser`, `ManifestPrecondition`, `ManifestRouting`
|
|
20
20
|
- **Port types** — `ResourcePort`, `HandlePort`, `OpInputPort`, `OpOutputPort`, and type guards
|
|
21
21
|
- **Request/response types** — `ComposeCompileRequest`, `ComposeCompileResult`, `ComposeRouteRequest`, `SimulateRequest`, `SimulateResult`
|
|
22
22
|
- **Ref utilities** — `ref` to build bind refs (`ref.input('amount')`, `ref.context.sender`, `ref('nodeId.port')`), plus `parseRef`, `foldRef`, `refKey` for working with flow references
|
package/dist/index.cjs
CHANGED
|
@@ -36,11 +36,11 @@ zod = __toESM(zod, 1);
|
|
|
36
36
|
*/
|
|
37
37
|
const EVM_NATIVE_SENTINEL = "0x0000000000000000000000000000000000000000";
|
|
38
38
|
/**
|
|
39
|
-
* Whether `address` is the EVM
|
|
40
|
-
* case-insensitively.
|
|
41
|
-
*
|
|
39
|
+
* Whether `address` is the EVM zero address (the native sentinel), compared
|
|
40
|
+
* case-insensitively. Inlined comparison: `compose-spec` cannot import
|
|
41
|
+
* `toAddress` from `@lifi/utils` (see `EVM_NATIVE_SENTINEL`).
|
|
42
42
|
*/
|
|
43
|
-
const
|
|
43
|
+
const isZeroAddress = (address) => address.toLowerCase() === EVM_NATIVE_SENTINEL.toLowerCase();
|
|
44
44
|
const TEMPO_CHAIN_ID = 4217;
|
|
45
45
|
const TEMPO_NATIVE_ERC20 = {
|
|
46
46
|
token: "0x20C0000000000000000000000000000000000000",
|
|
@@ -163,7 +163,7 @@ const isNativeAddressForChain = (chainId, address) => {
|
|
|
163
163
|
* `isNativeAddressForChain`, which returns `true` for the stand-in ERC-20
|
|
164
164
|
* (PathUSD on Tempo) and would wrongly route it to `msg.value`.
|
|
165
165
|
*/
|
|
166
|
-
const isMsgValueNative = (chainId, address) => !hasErc20CanonicalNative(chainId) &&
|
|
166
|
+
const isMsgValueNative = (chainId, address) => !hasErc20CanonicalNative(chainId) && isZeroAddress(address);
|
|
167
167
|
/**
|
|
168
168
|
* Rewrite a single `Resource` according to its chain's capabilities.
|
|
169
169
|
*
|
|
@@ -199,12 +199,11 @@ const normalizeResource = (r) => {
|
|
|
199
199
|
* chains whose canonical native asset is an ERC-20, the native sentinel is
|
|
200
200
|
* rewritten to the chain's stand-in ERC-20; every other address passes through.
|
|
201
201
|
*/
|
|
202
|
-
const normalizeNativeTokenAddress = (token, chainId) => hasErc20CanonicalNative(chainId) &&
|
|
202
|
+
const normalizeNativeTokenAddress = (token, chainId) => hasErc20CanonicalNative(chainId) && isZeroAddress(token) ? canonicalNativeAddress(chainId) : token;
|
|
203
203
|
//#endregion
|
|
204
204
|
//#region src/hexPatterns.ts
|
|
205
205
|
const BYTES32_LOWER_HEX = /^0x[0-9a-f]{64}$/;
|
|
206
206
|
const EVM_ADDRESS_HEX = /^0x[0-9a-fA-F]{40}$/;
|
|
207
|
-
const HEX_BYTES = /^0x(?:[0-9a-fA-F]{2})*$/;
|
|
208
207
|
const DECIMAL_UINT = /^[0-9]+$/;
|
|
209
208
|
const MAX_UINT256 = 2n ** 256n - 1n;
|
|
210
209
|
const MAX_DATE_MS = 864e13;
|
|
@@ -213,7 +212,6 @@ const MAX_DATE_MS = 864e13;
|
|
|
213
212
|
const SolTypeSchema = effect.Schema.Literal("uint8", "uint16", "uint32", "uint64", "uint128", "uint256", "int128", "int256", "address", "bool", "bytes", "bytes4", "bytes32", "string");
|
|
214
213
|
const ChainIdSchema = effect.Schema.Number.pipe(effect.Schema.int(), effect.Schema.positive());
|
|
215
214
|
const EVMAddressString = effect.Schema.String.pipe(effect.Schema.pattern(EVM_ADDRESS_HEX, { message: () => "expected a 0x-prefixed 20-byte EVM address" })).annotations({ description: "EVM address: 0x followed by 40 hex characters" });
|
|
216
|
-
const HexBytesString = effect.Schema.String.pipe(effect.Schema.pattern(HEX_BYTES, { message: () => "expected 0x-prefixed hex of whole bytes" })).annotations({ description: "Hex bytes: 0x followed by an even number of hex characters" });
|
|
217
215
|
const EpochMsSchema = effect.Schema.Number.pipe(effect.Schema.int(), effect.Schema.between(-864e13, MAX_DATE_MS));
|
|
218
216
|
const IntegerString = effect.Schema.String.pipe(effect.Schema.filter((value) => {
|
|
219
217
|
if (!DECIMAL_UINT.test(value)) return "amount must be a decimal integer string";
|
|
@@ -287,38 +285,51 @@ const LineageSchema = effect.Schema.Struct({
|
|
|
287
285
|
journeyId: UuidSchema,
|
|
288
286
|
parentRequestId: UuidSchema
|
|
289
287
|
});
|
|
288
|
+
const ForwardToSchema = effect.Schema.Union(EVMAddressString, RefSchema);
|
|
289
|
+
const EpilogueForwardSchema = effect.Schema.Struct({
|
|
290
|
+
resource: ResourceSchema,
|
|
291
|
+
to: ForwardToSchema
|
|
292
|
+
});
|
|
293
|
+
const EpilogueSchema = effect.Schema.Struct({
|
|
294
|
+
forwards: effect.Schema.optional(effect.Schema.NonEmptyArray(EpilogueForwardSchema)),
|
|
295
|
+
remainder: effect.Schema.optional(ForwardToSchema)
|
|
296
|
+
}).pipe(effect.Schema.filter((e) => e.forwards !== void 0 || e.remainder !== void 0, { message: () => "epilogue needs forwards, a remainder, or both" }));
|
|
290
297
|
const FlowSchema = effect.Schema.Struct({
|
|
291
298
|
version: effect.Schema.Literal(1),
|
|
292
299
|
id: effect.Schema.String,
|
|
293
300
|
chainId: ChainIdSchema,
|
|
294
301
|
inputs: effect.Schema.Array(FlowInputSchema),
|
|
295
302
|
nodes: effect.Schema.Array(CallSchema),
|
|
296
|
-
lineage: effect.Schema.optional(LineageSchema)
|
|
303
|
+
lineage: effect.Schema.optional(LineageSchema),
|
|
304
|
+
epilogue: effect.Schema.optional(EpilogueSchema)
|
|
297
305
|
});
|
|
298
306
|
//#endregion
|
|
299
307
|
//#region src/continuation.ts
|
|
300
308
|
const CONTINUATION_COMMITMENT_OP_ID = "continuation.commitment";
|
|
301
|
-
const
|
|
309
|
+
const outcomeFields = (minAmount) => ({
|
|
302
310
|
token: EVMAddressString,
|
|
303
|
-
minAmount
|
|
311
|
+
minAmount,
|
|
304
312
|
destination: EVMAddressString,
|
|
305
313
|
chainId: ChainIdSchema
|
|
306
314
|
});
|
|
307
|
-
const
|
|
315
|
+
const normalizingOutcome = (raw) => effect.Schema.transform(raw, effect.Schema.typeSchema(raw), {
|
|
308
316
|
strict: true,
|
|
309
|
-
decode: (
|
|
310
|
-
...
|
|
311
|
-
token: normalizeNativeTokenAddress(
|
|
317
|
+
decode: (outcome) => ({
|
|
318
|
+
...outcome,
|
|
319
|
+
token: normalizeNativeTokenAddress(outcome.token, outcome.chainId)
|
|
312
320
|
}),
|
|
313
321
|
encode: (outcome) => outcome
|
|
314
322
|
});
|
|
323
|
+
const ContinuationOutcomeSchema = normalizingOutcome(effect.Schema.Struct(outcomeFields(effect.Schema.optional(IntegerString))));
|
|
324
|
+
const CommittedOutcomeSchema = normalizingOutcome(effect.Schema.Struct(outcomeFields(IntegerString)));
|
|
315
325
|
const ContinuationIntentSchema = effect.Schema.Struct({
|
|
316
326
|
outcomes: effect.Schema.NonEmptyArray(ContinuationOutcomeSchema),
|
|
317
327
|
continuationFlow: effect.Schema.optional(FlowSchema),
|
|
318
328
|
validity: effect.Schema.Struct({ expiresAtMs: EpochMsSchema }),
|
|
319
|
-
perpetual: effect.Schema.optional(effect.Schema.Boolean),
|
|
320
329
|
provider: effect.Schema.optional(effect.Schema.String),
|
|
321
|
-
funding: effect.Schema.optional(effect.Schema.Literal("inline", "external"))
|
|
330
|
+
funding: effect.Schema.optional(effect.Schema.Literal("inline", "external")),
|
|
331
|
+
refund: effect.Schema.optional(EVMAddressString.pipe(effect.Schema.filter((address) => !isZeroAddress(address), { message: () => "refund must not be the zero address" }))),
|
|
332
|
+
exact: effect.Schema.optional(effect.Schema.Boolean)
|
|
322
333
|
});
|
|
323
334
|
const HexStringSchema = effect.Schema.String.pipe(effect.Schema.startsWith("0x"));
|
|
324
335
|
const Phase1EscrowSchema = effect.Schema.Struct({
|
|
@@ -327,20 +338,32 @@ const Phase1EscrowSchema = effect.Schema.Struct({
|
|
|
327
338
|
token: HexStringSchema,
|
|
328
339
|
amount: effect.Schema.String,
|
|
329
340
|
cap: effect.Schema.String,
|
|
341
|
+
floor: effect.Schema.String,
|
|
330
342
|
owner: HexStringSchema,
|
|
331
343
|
refund: HexStringSchema,
|
|
332
344
|
expiresAtMs: effect.Schema.Number.pipe(effect.Schema.int(), effect.Schema.positive())
|
|
333
345
|
});
|
|
346
|
+
const Phase1BindingSchema = effect.Schema.Struct({
|
|
347
|
+
executionTarget: HexStringSchema,
|
|
348
|
+
payload: HexStringSchema,
|
|
349
|
+
payloadHash: HexStringSchema,
|
|
350
|
+
calldata: HexStringSchema,
|
|
351
|
+
approvals: effect.Schema.Array(effect.Schema.Struct({
|
|
352
|
+
token: HexStringSchema,
|
|
353
|
+
spender: HexStringSchema
|
|
354
|
+
}))
|
|
355
|
+
});
|
|
334
356
|
const Phase1ArtifactSchema = effect.Schema.Union(effect.Schema.Struct({
|
|
335
357
|
kind: effect.Schema.Literal("transaction"),
|
|
336
|
-
funding: effect.Schema.Literal("inline", "external"),
|
|
358
|
+
funding: effect.Schema.Literal("inline", "external", "delivered"),
|
|
337
359
|
transactionRequest: effect.Schema.optional(effect.Schema.Struct({
|
|
338
360
|
to: effect.Schema.String,
|
|
339
361
|
data: effect.Schema.String,
|
|
340
362
|
value: effect.Schema.String,
|
|
341
363
|
chainId: effect.Schema.Number
|
|
342
364
|
})),
|
|
343
|
-
escrow: effect.Schema.optional(Phase1EscrowSchema)
|
|
365
|
+
escrow: effect.Schema.optional(Phase1EscrowSchema),
|
|
366
|
+
binding: effect.Schema.optional(Phase1BindingSchema)
|
|
344
367
|
}), effect.Schema.Struct({
|
|
345
368
|
kind: effect.Schema.Literal("signables"),
|
|
346
369
|
typedData: effect.Schema.Array(effect.Schema.Unknown)
|
|
@@ -350,22 +373,23 @@ const Erc20BalanceGteSpecSchema = effect.Schema.Struct({
|
|
|
350
373
|
kind: effect.Schema.Literal("erc20BalanceGte"),
|
|
351
374
|
chainId: ChainIdSchema,
|
|
352
375
|
token: EVMAddressString,
|
|
353
|
-
owner:
|
|
376
|
+
owner: AssertionOwnerSchema,
|
|
354
377
|
minAmount: IntegerString
|
|
355
378
|
});
|
|
356
379
|
const NativeBalanceGteSpecSchema = effect.Schema.Struct({
|
|
357
380
|
kind: effect.Schema.Literal("nativeBalanceGte"),
|
|
358
381
|
chainId: ChainIdSchema,
|
|
359
|
-
owner:
|
|
382
|
+
owner: AssertionOwnerSchema,
|
|
360
383
|
minAmount: IntegerString
|
|
361
384
|
});
|
|
362
385
|
const CallCheckSpecSchema = effect.Schema.Struct({
|
|
363
386
|
kind: effect.Schema.Literal("call"),
|
|
364
387
|
chainId: ChainIdSchema,
|
|
365
388
|
to: EVMAddressString,
|
|
366
|
-
|
|
389
|
+
signature: effect.Schema.String,
|
|
390
|
+
args: effect.Schema.Array(effect.Schema.String),
|
|
367
391
|
comparator: effect.Schema.Literal("gte", "eq", "lte"),
|
|
368
|
-
|
|
392
|
+
threshold: IntegerString
|
|
369
393
|
});
|
|
370
394
|
const asErc20BalanceGteCheck = (check, token) => ({
|
|
371
395
|
kind: "erc20BalanceGte",
|
|
@@ -382,39 +406,12 @@ const decodeNativeBalanceGte = (check, ast) => {
|
|
|
382
406
|
case "reject": return effect.ParseResult.fail(new effect.ParseResult.Type(ast, check, policy.reason));
|
|
383
407
|
}
|
|
384
408
|
};
|
|
385
|
-
const
|
|
386
|
-
kind: effect.Schema.Literal("erc20BalanceDeltaGte"),
|
|
387
|
-
chainId: ChainIdSchema,
|
|
388
|
-
token: EVMAddressString,
|
|
389
|
-
owner: AssertionOwnerSchema,
|
|
390
|
-
minDelta: IntegerString
|
|
391
|
-
});
|
|
392
|
-
const NativeBalanceDeltaGteSpecSchema = effect.Schema.Struct({
|
|
393
|
-
kind: effect.Schema.Literal("nativeBalanceDeltaGte"),
|
|
394
|
-
chainId: ChainIdSchema,
|
|
395
|
-
owner: AssertionOwnerSchema,
|
|
396
|
-
minDelta: IntegerString
|
|
397
|
-
});
|
|
398
|
-
const AssertionSpecSchema = effect.Schema.Union(Erc20BalanceGteSpecSchema, NativeBalanceGteSpecSchema, CallCheckSpecSchema, Erc20BalanceDeltaGteSpecSchema, NativeBalanceDeltaGteSpecSchema);
|
|
409
|
+
const AssertionSpecSchema = effect.Schema.Union(Erc20BalanceGteSpecSchema, NativeBalanceGteSpecSchema, CallCheckSpecSchema);
|
|
399
410
|
const settledOutcome = (intent) => intent.outcomes[0];
|
|
400
411
|
//#endregion
|
|
401
412
|
//#region src/descriptor.ts
|
|
402
413
|
const Bytes32HexSchema = effect.Schema.String.pipe(effect.Schema.pattern(BYTES32_LOWER_HEX));
|
|
403
|
-
const
|
|
404
|
-
kind: effect.Schema.Literal("erc20BalanceGte"),
|
|
405
|
-
chainId: ChainIdSchema,
|
|
406
|
-
token: EVMAddressString,
|
|
407
|
-
owner: AssertionOwnerSchema,
|
|
408
|
-
minAmount: IntegerString
|
|
409
|
-
});
|
|
410
|
-
const AssertedNativeBalanceGteSpecSchema = effect.Schema.Struct({
|
|
411
|
-
kind: effect.Schema.Literal("nativeBalanceGte"),
|
|
412
|
-
chainId: ChainIdSchema,
|
|
413
|
-
owner: AssertionOwnerSchema,
|
|
414
|
-
minAmount: IntegerString
|
|
415
|
-
});
|
|
416
|
-
const RawAssertedPredicateSchema = effect.Schema.Union(AssertedErc20BalanceGteSpecSchema, AssertedNativeBalanceGteSpecSchema, CallCheckSpecSchema, Erc20BalanceDeltaGteSpecSchema, NativeBalanceDeltaGteSpecSchema);
|
|
417
|
-
const AssertedPredicateSchema = effect.Schema.transformOrFail(RawAssertedPredicateSchema, effect.Schema.typeSchema(RawAssertedPredicateSchema), {
|
|
414
|
+
const AssertedPredicateSchema = effect.Schema.transformOrFail(AssertionSpecSchema, effect.Schema.typeSchema(AssertionSpecSchema), {
|
|
418
415
|
strict: true,
|
|
419
416
|
decode: (pred, _options, ast) => pred.kind === "nativeBalanceGte" ? decodeNativeBalanceGte(pred, ast) : effect.ParseResult.succeed(pred),
|
|
420
417
|
encode: (pred) => effect.ParseResult.succeed(pred)
|
|
@@ -458,18 +455,24 @@ const nativeResource = (chainId) => ({
|
|
|
458
455
|
const isERC20Resource = (r) => r.kind === "erc20";
|
|
459
456
|
const isNativeResource = (r) => r.kind === "native";
|
|
460
457
|
const resourcesEqual = (a, b) => {
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
458
|
+
switch (a.kind) {
|
|
459
|
+
case "native": return b.kind === "native" && a.chainId === b.chainId;
|
|
460
|
+
case "erc20": return b.kind === "erc20" && a.chainId === b.chainId && a.token.toLowerCase() === b.token.toLowerCase();
|
|
461
|
+
}
|
|
462
|
+
};
|
|
463
|
+
const foldResource = (r, cases) => {
|
|
464
|
+
switch (r.kind) {
|
|
465
|
+
case "native": return cases.native(r);
|
|
466
|
+
case "erc20": return cases.erc20(r);
|
|
467
|
+
}
|
|
464
468
|
};
|
|
465
|
-
const foldResource = (r, cases) => r.kind === "native" ? cases.native(r.chainId) : cases.erc20(r.token, r.chainId);
|
|
466
469
|
const resourceToken = (r) => foldResource(r, {
|
|
467
470
|
native: () => EVM_NATIVE_SENTINEL,
|
|
468
|
-
erc20: (token) => token
|
|
471
|
+
erc20: ({ token }) => token
|
|
469
472
|
});
|
|
470
473
|
const resourceKey = (r) => foldResource(r, {
|
|
471
|
-
native: (chainId) => `native:${chainId}`,
|
|
472
|
-
erc20: (token, chainId) => `erc20:${token.toLowerCase()}:${chainId}`
|
|
474
|
+
native: ({ chainId }) => `native:${chainId}`,
|
|
475
|
+
erc20: ({ token, chainId }) => `erc20:${token.toLowerCase()}:${chainId}`
|
|
473
476
|
});
|
|
474
477
|
const erc20Token = (r) => {
|
|
475
478
|
if (r.kind !== "erc20") throw new Error(`Expected erc20 resource, got ${r.kind}`);
|
|
@@ -752,13 +755,12 @@ const foldMaterialiserMetadata = (meta, cases) => {
|
|
|
752
755
|
if (meta.kind === "exact") return cases.exact(meta.amount);
|
|
753
756
|
if (meta.kind === "exact-native") return cases.exactNative(meta.amount);
|
|
754
757
|
if (meta.kind === "capped") return cases.capped(meta.amount, meta.min);
|
|
755
|
-
return cases.runtime();
|
|
758
|
+
return cases.runtime(meta.min);
|
|
756
759
|
};
|
|
757
760
|
//#endregion
|
|
758
761
|
//#region src/zodSchemas.ts
|
|
759
762
|
const chainIdZod = zod.default.number().int().positive();
|
|
760
763
|
const evmAddressZod = zod.default.string().regex(EVM_ADDRESS_HEX);
|
|
761
|
-
const hexBytesZod = zod.default.string().regex(HEX_BYTES);
|
|
762
764
|
const uintStringZod = zod.default.string().refine((value) => DECIMAL_UINT.test(value) && BigInt(value) <= MAX_UINT256, { message: "expected a uint256 decimal integer string" });
|
|
763
765
|
const SolTypeZod = zod.default.enum([
|
|
764
766
|
"uint8",
|
|
@@ -886,6 +888,10 @@ const ManifestPreconditionZod = zod.default.object({
|
|
|
886
888
|
description: zod.default.string().optional(),
|
|
887
889
|
configSchema: zod.default.unknown().optional()
|
|
888
890
|
});
|
|
891
|
+
const ManifestRoutingZod = zod.default.object({
|
|
892
|
+
maxRouteHops: zod.default.number().int().min(1),
|
|
893
|
+
swapHops: zod.default.enum(["head", "none"])
|
|
894
|
+
});
|
|
889
895
|
const ComposeManifestZod = zod.default.object({
|
|
890
896
|
manifestVersion: zod.default.number(),
|
|
891
897
|
manifestHash: zod.default.string(),
|
|
@@ -893,7 +899,8 @@ const ComposeManifestZod = zod.default.object({
|
|
|
893
899
|
operations: zod.default.array(ManifestOperationZod),
|
|
894
900
|
guards: zod.default.array(ManifestGuardZod),
|
|
895
901
|
materialisers: zod.default.array(ManifestMaterialiserZod),
|
|
896
|
-
preconditions: zod.default.array(ManifestPreconditionZod).optional()
|
|
902
|
+
preconditions: zod.default.array(ManifestPreconditionZod).optional(),
|
|
903
|
+
routing: ManifestRoutingZod.optional()
|
|
897
904
|
});
|
|
898
905
|
const hexStringZod = zod.default.string().startsWith("0x");
|
|
899
906
|
const SettlementEscrowZod = zod.default.object({
|
|
@@ -902,89 +909,65 @@ const SettlementEscrowZod = zod.default.object({
|
|
|
902
909
|
token: hexStringZod,
|
|
903
910
|
amount: zod.default.string(),
|
|
904
911
|
cap: zod.default.string(),
|
|
912
|
+
floor: zod.default.string(),
|
|
905
913
|
owner: hexStringZod,
|
|
906
914
|
refund: hexStringZod,
|
|
907
915
|
expiresAtMs: zod.default.number().int().positive()
|
|
908
916
|
});
|
|
917
|
+
const SettlementBindingZod = zod.default.object({
|
|
918
|
+
executionTarget: hexStringZod,
|
|
919
|
+
payload: hexStringZod,
|
|
920
|
+
payloadHash: hexStringZod,
|
|
921
|
+
calldata: hexStringZod,
|
|
922
|
+
approvals: zod.default.array(zod.default.object({
|
|
923
|
+
token: hexStringZod,
|
|
924
|
+
spender: hexStringZod
|
|
925
|
+
})).readonly()
|
|
926
|
+
});
|
|
909
927
|
const assertionOwnerZod = zod.default.union([evmAddressZod, zod.default.enum(["escrow", "delivery"])]);
|
|
910
928
|
const AssertionSpecZod = zod.default.discriminatedUnion("kind", [
|
|
911
929
|
zod.default.object({
|
|
912
930
|
kind: zod.default.literal("erc20BalanceGte"),
|
|
913
931
|
chainId: chainIdZod,
|
|
914
932
|
token: evmAddressZod,
|
|
915
|
-
owner:
|
|
933
|
+
owner: assertionOwnerZod,
|
|
916
934
|
minAmount: uintStringZod
|
|
917
935
|
}),
|
|
918
936
|
zod.default.object({
|
|
919
937
|
kind: zod.default.literal("nativeBalanceGte"),
|
|
920
938
|
chainId: chainIdZod,
|
|
921
|
-
owner:
|
|
939
|
+
owner: assertionOwnerZod,
|
|
922
940
|
minAmount: uintStringZod
|
|
923
941
|
}),
|
|
924
942
|
zod.default.object({
|
|
925
943
|
kind: zod.default.literal("call"),
|
|
926
944
|
chainId: chainIdZod,
|
|
927
945
|
to: evmAddressZod,
|
|
928
|
-
|
|
946
|
+
signature: zod.default.string(),
|
|
947
|
+
args: zod.default.array(zod.default.string()).readonly(),
|
|
929
948
|
comparator: zod.default.enum([
|
|
930
949
|
"gte",
|
|
931
950
|
"eq",
|
|
932
951
|
"lte"
|
|
933
952
|
]),
|
|
934
|
-
|
|
935
|
-
}),
|
|
936
|
-
zod.default.object({
|
|
937
|
-
kind: zod.default.literal("erc20BalanceDeltaGte"),
|
|
938
|
-
chainId: zod.default.number().int().positive(),
|
|
939
|
-
token: evmAddressZod,
|
|
940
|
-
owner: assertionOwnerZod,
|
|
941
|
-
minDelta: uintStringZod
|
|
942
|
-
}),
|
|
943
|
-
zod.default.object({
|
|
944
|
-
kind: zod.default.literal("nativeBalanceDeltaGte"),
|
|
945
|
-
chainId: zod.default.number().int().positive(),
|
|
946
|
-
owner: assertionOwnerZod,
|
|
947
|
-
minDelta: uintStringZod
|
|
953
|
+
threshold: uintStringZod
|
|
948
954
|
})
|
|
949
955
|
]);
|
|
950
|
-
const assertionSpecOptionByKind = (kind) => {
|
|
951
|
-
const option = AssertionSpecZod.options.find((o) => o.shape.kind.value === kind);
|
|
952
|
-
if (option === void 0) throw new Error(`AssertionSpecZod has no member with kind "${kind}"`);
|
|
953
|
-
return option;
|
|
954
|
-
};
|
|
955
|
-
const AssertedPredicateZod = zod.default.discriminatedUnion("kind", [
|
|
956
|
-
zod.default.object({
|
|
957
|
-
kind: zod.default.literal("erc20BalanceGte"),
|
|
958
|
-
chainId: zod.default.number().int().positive(),
|
|
959
|
-
token: evmAddressZod,
|
|
960
|
-
owner: assertionOwnerZod,
|
|
961
|
-
minAmount: uintStringZod
|
|
962
|
-
}),
|
|
963
|
-
zod.default.object({
|
|
964
|
-
kind: zod.default.literal("nativeBalanceGte"),
|
|
965
|
-
chainId: zod.default.number().int().positive(),
|
|
966
|
-
owner: assertionOwnerZod,
|
|
967
|
-
minAmount: uintStringZod
|
|
968
|
-
}),
|
|
969
|
-
assertionSpecOptionByKind("call"),
|
|
970
|
-
assertionSpecOptionByKind("erc20BalanceDeltaGte"),
|
|
971
|
-
assertionSpecOptionByKind("nativeBalanceDeltaGte")
|
|
972
|
-
]);
|
|
973
956
|
const VerificationDescriptorZod = zod.default.object({
|
|
974
957
|
validationProgramHash: zod.default.string().regex(BYTES32_LOWER_HEX),
|
|
975
958
|
paramsHash: zod.default.string().regex(BYTES32_LOWER_HEX),
|
|
976
|
-
assertedPredicate: zod.default.array(
|
|
959
|
+
assertedPredicate: zod.default.array(AssertionSpecZod).readonly()
|
|
960
|
+
});
|
|
961
|
+
const SettlementZod = zod.default.object({
|
|
962
|
+
escrow: SettlementEscrowZod.optional(),
|
|
963
|
+
binding: SettlementBindingZod.optional()
|
|
977
964
|
});
|
|
978
|
-
const SettlementZod = zod.default.object({ escrow: SettlementEscrowZod.optional() });
|
|
979
965
|
//#endregion
|
|
980
966
|
exports.ARC_CHAIN_ID = ARC_CHAIN_ID;
|
|
981
967
|
exports.ARC_NATIVE_ERC20 = ARC_NATIVE_ERC20;
|
|
982
968
|
exports.ARC_NATIVE_SCALE = ARC_NATIVE_SCALE;
|
|
983
969
|
exports.AppliedGuardSchema = AppliedGuardSchema;
|
|
984
|
-
exports.AssertedErc20BalanceGteSpecSchema = AssertedErc20BalanceGteSpecSchema;
|
|
985
|
-
exports.AssertedNativeBalanceGteSpecSchema = AssertedNativeBalanceGteSpecSchema;
|
|
986
970
|
exports.AssertedPredicateSchema = AssertedPredicateSchema;
|
|
987
|
-
exports.AssertedPredicateZod = AssertedPredicateZod;
|
|
988
971
|
exports.AssertionOwnerSchema = AssertionOwnerSchema;
|
|
989
972
|
exports.AssertionSpecSchema = AssertionSpecSchema;
|
|
990
973
|
exports.AssertionSpecZod = AssertionSpecZod;
|
|
@@ -995,15 +978,18 @@ exports.COMPOSE_VERSION_HEADER = COMPOSE_VERSION_HEADER;
|
|
|
995
978
|
exports.CONTINUATION_COMMITMENT_OP_ID = CONTINUATION_COMMITMENT_OP_ID;
|
|
996
979
|
exports.CallCheckSpecSchema = CallCheckSpecSchema;
|
|
997
980
|
exports.CallSchema = CallSchema;
|
|
981
|
+
exports.CommittedOutcomeSchema = CommittedOutcomeSchema;
|
|
998
982
|
exports.ComposeManifestZod = ComposeManifestZod;
|
|
999
983
|
exports.ContinuationIntentSchema = ContinuationIntentSchema;
|
|
1000
984
|
exports.ContinuationOutcomeSchema = ContinuationOutcomeSchema;
|
|
1001
985
|
exports.EVMAddressString = EVMAddressString;
|
|
1002
986
|
exports.EVM_NATIVE_SENTINEL = EVM_NATIVE_SENTINEL;
|
|
1003
|
-
exports.
|
|
987
|
+
exports.EpilogueForwardSchema = EpilogueForwardSchema;
|
|
988
|
+
exports.EpilogueSchema = EpilogueSchema;
|
|
1004
989
|
exports.Erc20BalanceGteSpecSchema = Erc20BalanceGteSpecSchema;
|
|
1005
990
|
exports.FlowInputSchema = FlowInputSchema;
|
|
1006
991
|
exports.FlowSchema = FlowSchema;
|
|
992
|
+
exports.ForwardToSchema = ForwardToSchema;
|
|
1007
993
|
exports.GuardCompatibilityZod = GuardCompatibilityZod;
|
|
1008
994
|
exports.GuardSelectorZod = GuardSelectorZod;
|
|
1009
995
|
exports.HANDLE_UNITS = HANDLE_UNITS;
|
|
@@ -1019,7 +1005,7 @@ exports.ManifestGuardZod = ManifestGuardZod;
|
|
|
1019
1005
|
exports.ManifestMaterialiserZod = ManifestMaterialiserZod;
|
|
1020
1006
|
exports.ManifestOperationZod = ManifestOperationZod;
|
|
1021
1007
|
exports.ManifestPreconditionZod = ManifestPreconditionZod;
|
|
1022
|
-
exports.
|
|
1008
|
+
exports.ManifestRoutingZod = ManifestRoutingZod;
|
|
1023
1009
|
exports.NativeBalanceGteSpecSchema = NativeBalanceGteSpecSchema;
|
|
1024
1010
|
exports.OutputPortZod = OutputPortZod;
|
|
1025
1011
|
exports.PROVIDER_KIND = PROVIDER_KIND;
|