@lifi/compose-spec 0.11.3 → 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 +63 -98
- package/dist/index.d.cts +132 -436
- package/dist/index.d.ts +132 -436
- package/dist/index.js +64 -94
- package/package.json +1 -1
- package/src/chainCapabilities.ts +13 -0
- package/src/compile.ts +0 -23
- package/src/continuation.ts +100 -89
- package/src/descriptor.ts +20 -72
- package/src/flow.ts +0 -2
- package/src/flowSchema.ts +0 -12
- package/src/hexPatterns.ts +0 -5
- package/src/index.ts +3 -7
- package/src/materialiserMetadata.ts +6 -3
- package/src/route.ts +7 -13
- package/src/simulate.ts +30 -2
- package/src/zodSchemas.ts +41 -71
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
|
|
@@ -180,7 +190,6 @@ const normalizeNativeTokenAddress = (token, chainId) => hasErc20CanonicalNative(
|
|
|
180
190
|
//#region src/hexPatterns.ts
|
|
181
191
|
const BYTES32_LOWER_HEX = /^0x[0-9a-f]{64}$/;
|
|
182
192
|
const EVM_ADDRESS_HEX = /^0x[0-9a-fA-F]{40}$/;
|
|
183
|
-
const HEX_BYTES = /^0x(?:[0-9a-fA-F]{2})*$/;
|
|
184
193
|
const DECIMAL_UINT = /^[0-9]+$/;
|
|
185
194
|
const MAX_UINT256 = 2n ** 256n - 1n;
|
|
186
195
|
const MAX_DATE_MS = 864e13;
|
|
@@ -189,7 +198,6 @@ const MAX_DATE_MS = 864e13;
|
|
|
189
198
|
const SolTypeSchema = Schema.Literal("uint8", "uint16", "uint32", "uint64", "uint128", "uint256", "int128", "int256", "address", "bool", "bytes", "bytes4", "bytes32", "string");
|
|
190
199
|
const ChainIdSchema = Schema.Number.pipe(Schema.int(), Schema.positive());
|
|
191
200
|
const EVMAddressString = Schema.String.pipe(Schema.pattern(EVM_ADDRESS_HEX, { message: () => "expected a 0x-prefixed 20-byte EVM address" })).annotations({ description: "EVM address: 0x followed by 40 hex characters" });
|
|
192
|
-
const HexBytesString = Schema.String.pipe(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" });
|
|
193
201
|
const EpochMsSchema = Schema.Number.pipe(Schema.int(), Schema.between(-864e13, MAX_DATE_MS));
|
|
194
202
|
const IntegerString = Schema.String.pipe(Schema.filter((value) => {
|
|
195
203
|
if (!DECIMAL_UINT.test(value)) return "amount must be a decimal integer string";
|
|
@@ -301,13 +309,13 @@ const normalizingOutcome = (raw) => Schema.transform(raw, Schema.typeSchema(raw)
|
|
|
301
309
|
const ContinuationOutcomeSchema = normalizingOutcome(Schema.Struct(outcomeFields(Schema.optional(IntegerString))));
|
|
302
310
|
const CommittedOutcomeSchema = normalizingOutcome(Schema.Struct(outcomeFields(IntegerString)));
|
|
303
311
|
const ContinuationIntentSchema = Schema.Struct({
|
|
304
|
-
outcomes: Schema.
|
|
312
|
+
outcomes: Schema.Array(ContinuationOutcomeSchema),
|
|
305
313
|
continuationFlow: Schema.optional(FlowSchema),
|
|
306
314
|
validity: Schema.Struct({ expiresAtMs: EpochMsSchema }),
|
|
307
|
-
perpetual: Schema.optional(Schema.Boolean),
|
|
308
315
|
provider: Schema.optional(Schema.String),
|
|
309
316
|
funding: Schema.optional(Schema.Literal("inline", "external")),
|
|
310
|
-
refund: Schema.optional(EVMAddressString.pipe(Schema.filter((address) => !isZeroAddress(address), { message: () => "refund must not be the zero address" })))
|
|
317
|
+
refund: Schema.optional(EVMAddressString.pipe(Schema.filter((address) => !isZeroAddress(address), { message: () => "refund must not be the zero address" }))),
|
|
318
|
+
exact: Schema.optional(Schema.Boolean)
|
|
311
319
|
});
|
|
312
320
|
const HexStringSchema = Schema.String.pipe(Schema.startsWith("0x"));
|
|
313
321
|
const Phase1EscrowSchema = Schema.Struct({
|
|
@@ -321,6 +329,16 @@ const Phase1EscrowSchema = Schema.Struct({
|
|
|
321
329
|
refund: HexStringSchema,
|
|
322
330
|
expiresAtMs: Schema.Number.pipe(Schema.int(), Schema.positive())
|
|
323
331
|
});
|
|
332
|
+
const Phase1BindingSchema = Schema.Struct({
|
|
333
|
+
executionTarget: HexStringSchema,
|
|
334
|
+
payload: HexStringSchema,
|
|
335
|
+
payloadHash: HexStringSchema,
|
|
336
|
+
calldata: HexStringSchema,
|
|
337
|
+
approvals: Schema.Array(Schema.Struct({
|
|
338
|
+
token: HexStringSchema,
|
|
339
|
+
spender: HexStringSchema
|
|
340
|
+
}))
|
|
341
|
+
});
|
|
324
342
|
const Phase1ArtifactSchema = Schema.Union(Schema.Struct({
|
|
325
343
|
kind: Schema.Literal("transaction"),
|
|
326
344
|
funding: Schema.Literal("inline", "external", "delivered"),
|
|
@@ -330,7 +348,8 @@ const Phase1ArtifactSchema = Schema.Union(Schema.Struct({
|
|
|
330
348
|
value: Schema.String,
|
|
331
349
|
chainId: Schema.Number
|
|
332
350
|
})),
|
|
333
|
-
escrow: Schema.optional(Phase1EscrowSchema)
|
|
351
|
+
escrow: Schema.optional(Phase1EscrowSchema),
|
|
352
|
+
binding: Schema.optional(Phase1BindingSchema)
|
|
334
353
|
}), Schema.Struct({
|
|
335
354
|
kind: Schema.Literal("signables"),
|
|
336
355
|
typedData: Schema.Array(Schema.Unknown)
|
|
@@ -340,22 +359,23 @@ const Erc20BalanceGteSpecSchema = Schema.Struct({
|
|
|
340
359
|
kind: Schema.Literal("erc20BalanceGte"),
|
|
341
360
|
chainId: ChainIdSchema,
|
|
342
361
|
token: EVMAddressString,
|
|
343
|
-
owner:
|
|
362
|
+
owner: AssertionOwnerSchema,
|
|
344
363
|
minAmount: IntegerString
|
|
345
364
|
});
|
|
346
365
|
const NativeBalanceGteSpecSchema = Schema.Struct({
|
|
347
366
|
kind: Schema.Literal("nativeBalanceGte"),
|
|
348
367
|
chainId: ChainIdSchema,
|
|
349
|
-
owner:
|
|
368
|
+
owner: AssertionOwnerSchema,
|
|
350
369
|
minAmount: IntegerString
|
|
351
370
|
});
|
|
352
371
|
const CallCheckSpecSchema = Schema.Struct({
|
|
353
372
|
kind: Schema.Literal("call"),
|
|
354
373
|
chainId: ChainIdSchema,
|
|
355
374
|
to: EVMAddressString,
|
|
356
|
-
|
|
375
|
+
signature: Schema.String,
|
|
376
|
+
args: Schema.Array(Schema.String),
|
|
357
377
|
comparator: Schema.Literal("gte", "eq", "lte"),
|
|
358
|
-
|
|
378
|
+
threshold: IntegerString
|
|
359
379
|
});
|
|
360
380
|
const asErc20BalanceGteCheck = (check, token) => ({
|
|
361
381
|
kind: "erc20BalanceGte",
|
|
@@ -372,39 +392,12 @@ const decodeNativeBalanceGte = (check, ast) => {
|
|
|
372
392
|
case "reject": return ParseResult.fail(new ParseResult.Type(ast, check, policy.reason));
|
|
373
393
|
}
|
|
374
394
|
};
|
|
375
|
-
const
|
|
376
|
-
kind: Schema.Literal("erc20BalanceDeltaGte"),
|
|
377
|
-
chainId: ChainIdSchema,
|
|
378
|
-
token: EVMAddressString,
|
|
379
|
-
owner: AssertionOwnerSchema,
|
|
380
|
-
minDelta: IntegerString
|
|
381
|
-
});
|
|
382
|
-
const NativeBalanceDeltaGteSpecSchema = Schema.Struct({
|
|
383
|
-
kind: Schema.Literal("nativeBalanceDeltaGte"),
|
|
384
|
-
chainId: ChainIdSchema,
|
|
385
|
-
owner: AssertionOwnerSchema,
|
|
386
|
-
minDelta: IntegerString
|
|
387
|
-
});
|
|
388
|
-
const AssertionSpecSchema = Schema.Union(Erc20BalanceGteSpecSchema, NativeBalanceGteSpecSchema, CallCheckSpecSchema, Erc20BalanceDeltaGteSpecSchema, NativeBalanceDeltaGteSpecSchema);
|
|
395
|
+
const AssertionSpecSchema = Schema.Union(Erc20BalanceGteSpecSchema, NativeBalanceGteSpecSchema, CallCheckSpecSchema);
|
|
389
396
|
const settledOutcome = (intent) => intent.outcomes[0];
|
|
390
397
|
//#endregion
|
|
391
398
|
//#region src/descriptor.ts
|
|
392
399
|
const Bytes32HexSchema = Schema.String.pipe(Schema.pattern(BYTES32_LOWER_HEX));
|
|
393
|
-
const
|
|
394
|
-
kind: Schema.Literal("erc20BalanceGte"),
|
|
395
|
-
chainId: ChainIdSchema,
|
|
396
|
-
token: EVMAddressString,
|
|
397
|
-
owner: AssertionOwnerSchema,
|
|
398
|
-
minAmount: IntegerString
|
|
399
|
-
});
|
|
400
|
-
const AssertedNativeBalanceGteSpecSchema = Schema.Struct({
|
|
401
|
-
kind: Schema.Literal("nativeBalanceGte"),
|
|
402
|
-
chainId: ChainIdSchema,
|
|
403
|
-
owner: AssertionOwnerSchema,
|
|
404
|
-
minAmount: IntegerString
|
|
405
|
-
});
|
|
406
|
-
const RawAssertedPredicateSchema = Schema.Union(AssertedErc20BalanceGteSpecSchema, AssertedNativeBalanceGteSpecSchema, CallCheckSpecSchema, Erc20BalanceDeltaGteSpecSchema, NativeBalanceDeltaGteSpecSchema);
|
|
407
|
-
const AssertedPredicateSchema = Schema.transformOrFail(RawAssertedPredicateSchema, Schema.typeSchema(RawAssertedPredicateSchema), {
|
|
400
|
+
const AssertedPredicateSchema = Schema.transformOrFail(AssertionSpecSchema, Schema.typeSchema(AssertionSpecSchema), {
|
|
408
401
|
strict: true,
|
|
409
402
|
decode: (pred, _options, ast) => pred.kind === "nativeBalanceGte" ? decodeNativeBalanceGte(pred, ast) : ParseResult.succeed(pred),
|
|
410
403
|
encode: (pred) => ParseResult.succeed(pred)
|
|
@@ -748,13 +741,12 @@ const foldMaterialiserMetadata = (meta, cases) => {
|
|
|
748
741
|
if (meta.kind === "exact") return cases.exact(meta.amount);
|
|
749
742
|
if (meta.kind === "exact-native") return cases.exactNative(meta.amount);
|
|
750
743
|
if (meta.kind === "capped") return cases.capped(meta.amount, meta.min);
|
|
751
|
-
return cases.runtime();
|
|
744
|
+
return cases.runtime(meta.min);
|
|
752
745
|
};
|
|
753
746
|
//#endregion
|
|
754
747
|
//#region src/zodSchemas.ts
|
|
755
748
|
const chainIdZod = z.number().int().positive();
|
|
756
749
|
const evmAddressZod = z.string().regex(EVM_ADDRESS_HEX);
|
|
757
|
-
const hexBytesZod = z.string().regex(HEX_BYTES);
|
|
758
750
|
const uintStringZod = z.string().refine((value) => DECIMAL_UINT.test(value) && BigInt(value) <= MAX_UINT256, { message: "expected a uint256 decimal integer string" });
|
|
759
751
|
const SolTypeZod = z.enum([
|
|
760
752
|
"uint8",
|
|
@@ -908,75 +900,53 @@ const SettlementEscrowZod = z.object({
|
|
|
908
900
|
refund: hexStringZod,
|
|
909
901
|
expiresAtMs: z.number().int().positive()
|
|
910
902
|
});
|
|
903
|
+
const SettlementBindingZod = z.object({
|
|
904
|
+
executionTarget: hexStringZod,
|
|
905
|
+
payload: hexStringZod,
|
|
906
|
+
payloadHash: hexStringZod,
|
|
907
|
+
calldata: hexStringZod,
|
|
908
|
+
approvals: z.array(z.object({
|
|
909
|
+
token: hexStringZod,
|
|
910
|
+
spender: hexStringZod
|
|
911
|
+
})).readonly()
|
|
912
|
+
});
|
|
911
913
|
const assertionOwnerZod = z.union([evmAddressZod, z.enum(["escrow", "delivery"])]);
|
|
912
914
|
const AssertionSpecZod = z.discriminatedUnion("kind", [
|
|
913
915
|
z.object({
|
|
914
916
|
kind: z.literal("erc20BalanceGte"),
|
|
915
917
|
chainId: chainIdZod,
|
|
916
918
|
token: evmAddressZod,
|
|
917
|
-
owner:
|
|
919
|
+
owner: assertionOwnerZod,
|
|
918
920
|
minAmount: uintStringZod
|
|
919
921
|
}),
|
|
920
922
|
z.object({
|
|
921
923
|
kind: z.literal("nativeBalanceGte"),
|
|
922
924
|
chainId: chainIdZod,
|
|
923
|
-
owner:
|
|
925
|
+
owner: assertionOwnerZod,
|
|
924
926
|
minAmount: uintStringZod
|
|
925
927
|
}),
|
|
926
928
|
z.object({
|
|
927
929
|
kind: z.literal("call"),
|
|
928
930
|
chainId: chainIdZod,
|
|
929
931
|
to: evmAddressZod,
|
|
930
|
-
|
|
932
|
+
signature: z.string(),
|
|
933
|
+
args: z.array(z.string()).readonly(),
|
|
931
934
|
comparator: z.enum([
|
|
932
935
|
"gte",
|
|
933
936
|
"eq",
|
|
934
937
|
"lte"
|
|
935
938
|
]),
|
|
936
|
-
|
|
937
|
-
}),
|
|
938
|
-
z.object({
|
|
939
|
-
kind: z.literal("erc20BalanceDeltaGte"),
|
|
940
|
-
chainId: z.number().int().positive(),
|
|
941
|
-
token: evmAddressZod,
|
|
942
|
-
owner: assertionOwnerZod,
|
|
943
|
-
minDelta: uintStringZod
|
|
944
|
-
}),
|
|
945
|
-
z.object({
|
|
946
|
-
kind: z.literal("nativeBalanceDeltaGte"),
|
|
947
|
-
chainId: z.number().int().positive(),
|
|
948
|
-
owner: assertionOwnerZod,
|
|
949
|
-
minDelta: uintStringZod
|
|
939
|
+
threshold: uintStringZod
|
|
950
940
|
})
|
|
951
941
|
]);
|
|
952
|
-
const assertionSpecOptionByKind = (kind) => {
|
|
953
|
-
const option = AssertionSpecZod.options.find((o) => o.shape.kind.value === kind);
|
|
954
|
-
if (option === void 0) throw new Error(`AssertionSpecZod has no member with kind "${kind}"`);
|
|
955
|
-
return option;
|
|
956
|
-
};
|
|
957
|
-
const AssertedPredicateZod = z.discriminatedUnion("kind", [
|
|
958
|
-
z.object({
|
|
959
|
-
kind: z.literal("erc20BalanceGte"),
|
|
960
|
-
chainId: z.number().int().positive(),
|
|
961
|
-
token: evmAddressZod,
|
|
962
|
-
owner: assertionOwnerZod,
|
|
963
|
-
minAmount: uintStringZod
|
|
964
|
-
}),
|
|
965
|
-
z.object({
|
|
966
|
-
kind: z.literal("nativeBalanceGte"),
|
|
967
|
-
chainId: z.number().int().positive(),
|
|
968
|
-
owner: assertionOwnerZod,
|
|
969
|
-
minAmount: uintStringZod
|
|
970
|
-
}),
|
|
971
|
-
assertionSpecOptionByKind("call"),
|
|
972
|
-
assertionSpecOptionByKind("erc20BalanceDeltaGte"),
|
|
973
|
-
assertionSpecOptionByKind("nativeBalanceDeltaGte")
|
|
974
|
-
]);
|
|
975
942
|
const VerificationDescriptorZod = z.object({
|
|
976
943
|
validationProgramHash: z.string().regex(BYTES32_LOWER_HEX),
|
|
977
944
|
paramsHash: z.string().regex(BYTES32_LOWER_HEX),
|
|
978
|
-
assertedPredicate: z.array(
|
|
945
|
+
assertedPredicate: z.array(AssertionSpecZod).readonly()
|
|
946
|
+
});
|
|
947
|
+
const SettlementZod = z.object({
|
|
948
|
+
escrow: SettlementEscrowZod.optional(),
|
|
949
|
+
binding: SettlementBindingZod.optional()
|
|
979
950
|
});
|
|
980
|
-
const SettlementZod = z.object({ escrow: SettlementEscrowZod.optional() });
|
|
981
951
|
//#endregion
|
|
982
|
-
export { ARC_CHAIN_ID, ARC_NATIVE_ERC20, ARC_NATIVE_SCALE, AppliedGuardSchema,
|
|
952
|
+
export { ARC_CHAIN_ID, ARC_NATIVE_ERC20, ARC_NATIVE_SCALE, AppliedGuardSchema, AssertedPredicateSchema, AssertionOwnerSchema, AssertionSpecSchema, AssertionSpecZod, BindValueSchema, Bytes32HexSchema, COMPOSER_SDK_VERSION_HEADER, COMPOSE_VERSION_HEADER, CONTINUATION_COMMITMENT_OP_ID, CallCheckSpecSchema, CallSchema, CommittedOutcomeSchema, ComposeManifestZod, ContinuationIntentSchema, ContinuationOutcomeSchema, EVMAddressString, EVM_NATIVE_SENTINEL, EpilogueForwardSchema, EpilogueSchema, Erc20BalanceGteSpecSchema, FlowInputSchema, FlowSchema, ForwardToSchema, GuardCompatibilityZod, GuardSelectorZod, HANDLE_UNITS, HandleInputSchema, HandlePortZod, HandleUnitsZod, HexStringSchema, InputPortZod, IntegerString, LineageSchema, LiteralBindingSchema, ManifestGuardZod, ManifestMaterialiserZod, ManifestOperationZod, ManifestPreconditionZod, ManifestRoutingZod, NativeBalanceGteSpecSchema, OutputPortZod, PROVIDER_KIND, Phase1ArtifactSchema, RESERVED_REF_SCOPES, RefSchema, ResourceInputSchema, ResourceOutputPortZod, ResourcePortZod, ResourceSchema, SIMULATE_MAX_REQUIREMENTS, SIMULATE_MAX_TRACKED_BALANCES, STATIC_SOL_TYPES, SettlementZod, SolTypeSchema, StaticSolTypeZod, TEMPO_CHAIN_ID, TEMPO_NATIVE_ERC20, UuidSchema, VerificationDescriptorSchema, VerificationDescriptorZod, canonicalAssertedPredicate, canonicalNativeAddress, checkCompatibility, copy, erc20, erc20Allowance, erc20Balance, erc20Resource, erc20Token, expandOutputPorts, familySize, flowInputMode, flowInputResource, flowInputType, foldChainCapabilities, foldMaterialiserMetadata, foldRef, foldResource, getChainCapabilities, handle, hasErc20CanonicalNative, instancePortName, isAsErc20Chain, isContextKey, isERC20Resource, isErc20AllowancePrecondition, isErc20BalancePrecondition, isFutureResourceOutput, isHandlePort, isMaterialiserInput, isMsgValueNative, isNativeAddressForChain, isNativeBalancePrecondition, isNativeResource, isOutputFamily, isRef, isResourceInput, isResourceOutputPort, isResourcePort, isStaticSolType, linear, native, nativeBalance, nativeCheckPolicy, nativeResource, normalizeNativeTokenAddress, normalizeResource, opHandle, parseRef, parseVersion, providerKindByName, providerKindNames, readResource, ref, refKey, resource, resourceKey, resourceOutput, resourceToken, resourcesEqual, settledOutcome };
|
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/compile.ts
CHANGED
|
@@ -13,7 +13,6 @@ export interface ComposeRun {
|
|
|
13
13
|
readonly signer: string;
|
|
14
14
|
readonly assumptions?: Record<string, bigint>;
|
|
15
15
|
readonly referrer?: string;
|
|
16
|
-
readonly integratorFeeBps?: number;
|
|
17
16
|
readonly maxPriceImpactBps?: number;
|
|
18
17
|
// Sugar for `flow.epilogue.remainder`; zap-backend desugars it before the
|
|
19
18
|
// compile.
|
|
@@ -121,22 +120,6 @@ export interface SpendEntry {
|
|
|
121
120
|
readonly nodeId?: string;
|
|
122
121
|
}
|
|
123
122
|
|
|
124
|
-
// One fee row per (input, recipient), as the compiled fill charges it.
|
|
125
|
-
// Hand-mirrored from api-schemas' `ComposeFeeSchema` (the OpenAPI source of
|
|
126
|
-
// truth; this package cannot depend on it). `recipient` names WHO is charged
|
|
127
|
-
// — never an address; the address is the sibling `recipientAddress`. `amount`
|
|
128
|
-
// is absent when the gross is only known on-chain at execution time (a
|
|
129
|
-
// balance-materialiser input).
|
|
130
|
-
export interface ComposeFee {
|
|
131
|
-
readonly input: string;
|
|
132
|
-
// Zero address for native, otherwise the ERC-20 contract.
|
|
133
|
-
readonly token: string;
|
|
134
|
-
readonly recipient: 'lifi' | 'integrator';
|
|
135
|
-
readonly recipientAddress: string;
|
|
136
|
-
readonly bps: number;
|
|
137
|
-
readonly amount?: string;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
123
|
// The optional user-program simulation result, present only when the request
|
|
141
124
|
// opted in via `run.simulateUserProgram` and the simulation succeeded.
|
|
142
125
|
// Hand-mirrored from api-schemas' `ComposeUserProgramSimulationOkSchema`.
|
|
@@ -204,9 +187,6 @@ export interface ComposeCompileSuccessData extends ComposeContinuationData {
|
|
|
204
187
|
readonly userProxy: string;
|
|
205
188
|
readonly priceImpact?: PriceImpact;
|
|
206
189
|
readonly approvals?: readonly ApprovalEntry[];
|
|
207
|
-
// The per-(input, recipient) fee rows the compiled fill charges. Absent when
|
|
208
|
-
// no fee applies.
|
|
209
|
-
readonly fees?: readonly ComposeFee[];
|
|
210
190
|
// The optional user-program simulation echo, present only when the request
|
|
211
191
|
// opted in via `run.simulateUserProgram` and the simulation succeeded.
|
|
212
192
|
readonly userProgramSimulation?: ComposeUserProgramSimulation;
|
|
@@ -235,9 +215,6 @@ export interface ComposeCompilePartialData extends ComposeContinuationData {
|
|
|
235
215
|
readonly simulationRevert: SimulationRevert;
|
|
236
216
|
readonly approvals?: readonly ApprovalEntry[];
|
|
237
217
|
readonly actions?: readonly ComposeAction[];
|
|
238
|
-
// The per-(input, recipient) fee rows the compiled fill charges. Absent when
|
|
239
|
-
// no fee applies.
|
|
240
|
-
readonly fees?: readonly ComposeFee[];
|
|
241
218
|
// The optional user-program simulation echo, present only when the request
|
|
242
219
|
// opted in via `run.simulateUserProgram` and the simulation succeeded.
|
|
243
220
|
readonly userProgramSimulation?: ComposeUserProgramSimulation;
|