@lifi/compose-spec 0.16.0 → 0.17.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 +18 -38
- package/dist/index.d.cts +5 -42
- package/dist/index.d.ts +6 -43
- package/dist/index.js +18 -36
- package/package.json +1 -1
- package/src/compile.ts +2 -0
- package/src/continuation.ts +6 -20
- package/src/flow.ts +6 -1
- package/src/index.ts +0 -1
- package/src/simulate.ts +5 -1
- package/src/version.ts +3 -1
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
2
|
+
// \0rolldown/runtime.js
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -20,11 +20,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
20
20
|
value: mod,
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
|
-
//#endregion
|
|
24
23
|
let effect = require("effect");
|
|
25
24
|
let zod = require("zod");
|
|
26
25
|
zod = __toESM(zod, 1);
|
|
27
|
-
|
|
26
|
+
// src/chainCapabilities.ts
|
|
28
27
|
/**
|
|
29
28
|
* The zero-address sentinel that represents the native gas coin on
|
|
30
29
|
* EVM-native chains. Exported so tests and call-sites can reference it
|
|
@@ -210,15 +209,13 @@ const normalizeResource = (r) => {
|
|
|
210
209
|
* rewritten to the chain's stand-in ERC-20; every other address passes through.
|
|
211
210
|
*/
|
|
212
211
|
const normalizeNativeTokenAddress = (token, chainId) => hasErc20CanonicalNative(chainId) && isZeroAddress(token) ? canonicalNativeAddress(chainId) : token;
|
|
213
|
-
|
|
214
|
-
//#region src/hexPatterns.ts
|
|
212
|
+
// src/hexPatterns.ts
|
|
215
213
|
const BYTES32_LOWER_HEX = /^0x[0-9a-f]{64}$/;
|
|
216
214
|
const EVM_ADDRESS_HEX = /^0x[0-9a-fA-F]{40}$/;
|
|
217
215
|
const DECIMAL_UINT = /^[0-9]+$/;
|
|
218
216
|
const MAX_UINT256 = 2n ** 256n - 1n;
|
|
219
217
|
const MAX_DATE_MS = 864e13;
|
|
220
|
-
|
|
221
|
-
//#region src/flowSchema.ts
|
|
218
|
+
// src/flowSchema.ts
|
|
222
219
|
const SolTypeSchema = effect.Schema.Literal("uint8", "uint16", "uint32", "uint64", "uint128", "uint256", "int128", "int256", "address", "bool", "bytes", "bytes4", "bytes32", "string");
|
|
223
220
|
const ChainIdSchema = effect.Schema.Number.pipe(effect.Schema.int(), effect.Schema.positive());
|
|
224
221
|
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" });
|
|
@@ -313,8 +310,7 @@ const FlowSchema = effect.Schema.Struct({
|
|
|
313
310
|
lineage: effect.Schema.optional(LineageSchema),
|
|
314
311
|
epilogue: effect.Schema.optional(EpilogueSchema)
|
|
315
312
|
});
|
|
316
|
-
|
|
317
|
-
//#region src/continuation.ts
|
|
313
|
+
// src/continuation.ts
|
|
318
314
|
const CONTINUATION_COMMITMENT_OP_ID = "continuation.commitment";
|
|
319
315
|
const outcomeFields = (minAmount) => ({
|
|
320
316
|
token: EVMAddressString,
|
|
@@ -417,9 +413,7 @@ const decodeNativeBalanceGte = (check, ast) => {
|
|
|
417
413
|
}
|
|
418
414
|
};
|
|
419
415
|
const AssertionSpecSchema = effect.Schema.Union(Erc20BalanceGteSpecSchema, NativeBalanceGteSpecSchema, CallCheckSpecSchema);
|
|
420
|
-
|
|
421
|
-
//#endregion
|
|
422
|
-
//#region src/descriptor.ts
|
|
416
|
+
// src/descriptor.ts
|
|
423
417
|
const Bytes32HexSchema = effect.Schema.String.pipe(effect.Schema.pattern(BYTES32_LOWER_HEX));
|
|
424
418
|
const AssertedPredicateSchema = effect.Schema.transformOrFail(AssertionSpecSchema, effect.Schema.typeSchema(AssertionSpecSchema), {
|
|
425
419
|
strict: true,
|
|
@@ -440,8 +434,7 @@ const canonicalJson = (value) => {
|
|
|
440
434
|
return JSON.stringify(value);
|
|
441
435
|
};
|
|
442
436
|
const canonicalAssertedPredicate = (specs) => canonicalJson(specs);
|
|
443
|
-
|
|
444
|
-
//#region src/flow.ts
|
|
437
|
+
// src/flow.ts
|
|
445
438
|
const isResourceInput = (input) => "resource" in input;
|
|
446
439
|
const flowInputType = (input) => isResourceInput(input) ? "uint256" : input.type;
|
|
447
440
|
const flowInputMode = (input) => isResourceInput(input) ? "linear" : "copy";
|
|
@@ -451,8 +444,7 @@ const isHandlePort = (port) => port.kind === "handle";
|
|
|
451
444
|
const isResourceOutputPort = (port) => port.kind === "resource_output";
|
|
452
445
|
const isFutureResourceOutput = (port) => isResourceOutputPort(port) && port.availability === "future";
|
|
453
446
|
const isMaterialiserInput = (s) => typeof s === "object" && s !== null && "kind" in s;
|
|
454
|
-
|
|
455
|
-
//#region src/resource.ts
|
|
447
|
+
// src/resource.ts
|
|
456
448
|
const erc20Resource = (token, chainId) => ({
|
|
457
449
|
kind: "erc20",
|
|
458
450
|
token,
|
|
@@ -492,8 +484,7 @@ const erc20Token = (r) => {
|
|
|
492
484
|
if (r.kind !== "erc20") throw new Error(`Expected erc20 resource, got ${r.kind}`);
|
|
493
485
|
return r.token;
|
|
494
486
|
};
|
|
495
|
-
|
|
496
|
-
//#region src/flashloan.ts
|
|
487
|
+
// src/flashloan.ts
|
|
497
488
|
const providerKindNames = [
|
|
498
489
|
"aave-v3",
|
|
499
490
|
"balancer-v2",
|
|
@@ -516,8 +507,7 @@ const FLASHLOAN_FEE_BPS = {
|
|
|
516
507
|
};
|
|
517
508
|
const BPS_DENOMINATOR = 10000n;
|
|
518
509
|
const flashloanMaxFee = ({ providerKind, amount, maxFee }) => maxFee !== void 0 ? BigInt(maxFee) : (BigInt(amount) * FLASHLOAN_FEE_BPS[providerKind] + BPS_DENOMINATOR - 1n) / BPS_DENOMINATOR;
|
|
519
|
-
|
|
520
|
-
//#region src/constructors.ts
|
|
510
|
+
// src/constructors.ts
|
|
521
511
|
/** Returns `{ [key]: value }` when `value` is not nullish, else `{}`. */
|
|
522
512
|
const optionalProp = (key, value) => value !== void 0 && value !== null ? { [key]: value } : {};
|
|
523
513
|
const linear = (name, type) => ({
|
|
@@ -580,8 +570,7 @@ const resourceOutput = (name, options) => {
|
|
|
580
570
|
...optionalProp("countFrom", opts?.countFrom)
|
|
581
571
|
};
|
|
582
572
|
};
|
|
583
|
-
|
|
584
|
-
//#region src/outputFamilies.ts
|
|
573
|
+
// src/outputFamilies.ts
|
|
585
574
|
const isOutputFamily = (port) => port.kind === "resource_output" && port.countFrom !== void 0;
|
|
586
575
|
const instancePortName = (family, index) => `${family}.${index}`;
|
|
587
576
|
const familySize = (family, config) => {
|
|
@@ -598,8 +587,7 @@ const expandFamily = (port, config) => {
|
|
|
598
587
|
}));
|
|
599
588
|
};
|
|
600
589
|
const expandOutputPorts = (declared, config) => declared.some(isOutputFamily) ? declared.flatMap((port) => isOutputFamily(port) ? expandFamily(port, config) : [port]) : declared;
|
|
601
|
-
|
|
602
|
-
//#region src/ref.ts
|
|
590
|
+
// src/ref.ts
|
|
603
591
|
const isContextKey = (key) => key === "sender" || key === "executionAddress";
|
|
604
592
|
/**
|
|
605
593
|
* Ref prefixes that parseRef intercepts before the fallback `output` scope.
|
|
@@ -658,8 +646,7 @@ const refKey = (ref) => foldRef(parseRef(ref), {
|
|
|
658
646
|
context: (key) => `context:${key}`,
|
|
659
647
|
output: (node, port) => `output:${node}:${port}`
|
|
660
648
|
});
|
|
661
|
-
|
|
662
|
-
//#region src/preconditions.ts
|
|
649
|
+
// src/preconditions.ts
|
|
663
650
|
const erc20Balance = (config) => ({
|
|
664
651
|
type: "Erc20Balance",
|
|
665
652
|
...config
|
|
@@ -675,8 +662,7 @@ const erc20Allowance = (config) => ({
|
|
|
675
662
|
const isErc20BalancePrecondition = (p) => p.type === "Erc20Balance";
|
|
676
663
|
const isErc20AllowancePrecondition = (p) => p.type === "Erc20Allowance";
|
|
677
664
|
const isNativeBalancePrecondition = (p) => p.type === "NativeBalance";
|
|
678
|
-
|
|
679
|
-
//#region src/simulate.ts
|
|
665
|
+
// src/simulate.ts
|
|
680
666
|
/**
|
|
681
667
|
* Maximum number of watched `(token, owner)` pairs accepted by `POST /simulate`.
|
|
682
668
|
*
|
|
@@ -698,8 +684,7 @@ const SIMULATE_MAX_TRACKED_BALANCES = 40;
|
|
|
698
684
|
* trust boundary and re-enforced server-side in `rawSimulation.ts`.
|
|
699
685
|
*/
|
|
700
686
|
const SIMULATE_MAX_REQUIREMENTS = 40;
|
|
701
|
-
|
|
702
|
-
//#region src/headers.ts
|
|
687
|
+
// src/headers.ts
|
|
703
688
|
/**
|
|
704
689
|
* HTTP header names on the compose wire.
|
|
705
690
|
*
|
|
@@ -711,8 +696,7 @@ const SIMULATE_MAX_REQUIREMENTS = 40;
|
|
|
711
696
|
const COMPOSER_SDK_VERSION_HEADER = "x-lifi-composer-sdk";
|
|
712
697
|
/** Compose contract version the backend serves. Returned on every compose response. */
|
|
713
698
|
const COMPOSE_VERSION_HEADER = "x-lifi-composer-version";
|
|
714
|
-
|
|
715
|
-
//#region src/version.ts
|
|
699
|
+
// src/version.ts
|
|
716
700
|
const SEMANTIC_VERSION_PATTERN = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
|
|
717
701
|
/**
|
|
718
702
|
* Parses the numeric triple of a semantic version. Prerelease and build
|
|
@@ -767,16 +751,14 @@ const checkCompatibility = (client, server, minimum = {
|
|
|
767
751
|
if (compareVersions(client, minimum) < 0) return "sdk_outdated";
|
|
768
752
|
return "compatible";
|
|
769
753
|
};
|
|
770
|
-
|
|
771
|
-
//#region src/materialiserMetadata.ts
|
|
754
|
+
// src/materialiserMetadata.ts
|
|
772
755
|
const foldMaterialiserMetadata = (meta, cases) => {
|
|
773
756
|
if (meta.kind === "exact") return cases.exact(meta.amount);
|
|
774
757
|
if (meta.kind === "exact-native") return cases.exactNative(meta.amount);
|
|
775
758
|
if (meta.kind === "capped") return cases.capped(meta.amount, meta.min);
|
|
776
759
|
return cases.runtime(meta.min);
|
|
777
760
|
};
|
|
778
|
-
|
|
779
|
-
//#region src/zodSchemas.ts
|
|
761
|
+
// src/zodSchemas.ts
|
|
780
762
|
const chainIdZod = zod.default.number().int().positive();
|
|
781
763
|
const evmAddressZod = zod.default.string().regex(EVM_ADDRESS_HEX);
|
|
782
764
|
const uintStringZod = zod.default.string().refine((value) => DECIMAL_UINT.test(value) && BigInt(value) <= MAX_UINT256, { message: "expected a uint256 decimal integer string" });
|
|
@@ -984,7 +966,6 @@ const ShortfallZod = zod.default.object({
|
|
|
984
966
|
required: zod.default.string(),
|
|
985
967
|
available: zod.default.string()
|
|
986
968
|
});
|
|
987
|
-
//#endregion
|
|
988
969
|
exports.ARC_CHAIN_ID = ARC_CHAIN_ID;
|
|
989
970
|
exports.ARC_NATIVE_ERC20 = ARC_NATIVE_ERC20;
|
|
990
971
|
exports.ARC_NATIVE_SCALE = ARC_NATIVE_SCALE;
|
|
@@ -1113,4 +1094,3 @@ exports.resourceKey = resourceKey;
|
|
|
1113
1094
|
exports.resourceOutput = resourceOutput;
|
|
1114
1095
|
exports.resourceToken = resourceToken;
|
|
1115
1096
|
exports.resourcesEqual = resourcesEqual;
|
|
1116
|
-
exports.settledOutcome = settledOutcome;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import z from "zod";
|
|
3
|
-
//#region src/flowSchema.d.ts
|
|
4
3
|
export declare const SolTypeSchema: Schema.Literal<["uint8", "uint16", "uint32", "uint64", "uint128", "uint256", "int128", "int256", "address", "bool", "bytes", "bytes4", "bytes32", "string"]>;
|
|
5
4
|
export declare const EVMAddressString: Schema.refine<string, typeof Schema.String>;
|
|
6
5
|
export declare const IntegerString: Schema.filter<typeof Schema.String>;
|
|
@@ -311,8 +310,6 @@ type ForwardTo = typeof ForwardToSchema.Type;
|
|
|
311
310
|
type EpilogueForward = typeof EpilogueForwardSchema.Type;
|
|
312
311
|
type Epilogue = typeof EpilogueSchema.Type;
|
|
313
312
|
type Flow = typeof FlowSchema.Type;
|
|
314
|
-
//#endregion
|
|
315
|
-
//#region src/continuation.d.ts
|
|
316
313
|
export declare const CONTINUATION_COMMITMENT_OP_ID = "continuation.commitment";
|
|
317
314
|
export declare const ContinuationOutcomeSchema: Schema.transform<Schema.Schema<{
|
|
318
315
|
readonly token: string;
|
|
@@ -563,11 +560,6 @@ type ContinuationIntent = typeof ContinuationIntentSchema.Type;
|
|
|
563
560
|
type Phase1Artifact = typeof Phase1ArtifactSchema.Type;
|
|
564
561
|
type AssertionSpec = typeof AssertionSpecSchema.Type;
|
|
565
562
|
type CallCheckSpec = typeof CallCheckSpecSchema.Type;
|
|
566
|
-
export declare const settledOutcome: <I extends {
|
|
567
|
-
readonly outcomes: readonly unknown[];
|
|
568
|
-
}>(intent: I) => I['outcomes'][number] | undefined;
|
|
569
|
-
//#endregion
|
|
570
|
-
//#region src/descriptor.d.ts
|
|
571
563
|
export declare const Bytes32HexSchema: Schema.filter<typeof Schema.String>;
|
|
572
564
|
export declare const AssertedPredicateSchema: Schema.transformOrFail<Schema.Union<[Schema.Struct<{
|
|
573
565
|
kind: Schema.Literal<["erc20BalanceGte"]>;
|
|
@@ -692,8 +684,6 @@ export declare const VerificationDescriptorSchema: Schema.Struct<{
|
|
|
692
684
|
export declare const canonicalAssertedPredicate: (specs: readonly AssertionSpec[]) => string;
|
|
693
685
|
type VerificationDescriptor = typeof VerificationDescriptorSchema.Type;
|
|
694
686
|
type AssertedPredicate = AssertionSpec;
|
|
695
|
-
//#endregion
|
|
696
|
-
//#region src/resource.d.ts
|
|
697
687
|
type Availability = 'now' | 'future';
|
|
698
688
|
interface OutputAmount {
|
|
699
689
|
readonly expected: bigint;
|
|
@@ -722,8 +712,6 @@ export declare const resourceToken: (r: Resource) => string;
|
|
|
722
712
|
export declare const resourceKey: (r: Resource) => string;
|
|
723
713
|
export declare const describeResource: (r: Resource) => string;
|
|
724
714
|
export declare const erc20Token: (r: Resource) => string;
|
|
725
|
-
//#endregion
|
|
726
|
-
//#region src/output.d.ts
|
|
727
715
|
type EstimateBasis = 'simulated' | 'quoted';
|
|
728
716
|
type MinimumBasis = 'guard' | 'op' | 'input' | 'declared';
|
|
729
717
|
interface Estimate {
|
|
@@ -761,8 +749,6 @@ interface TerminalOutput extends OutputBase {
|
|
|
761
749
|
}
|
|
762
750
|
type Output = ConsumedOutput | TerminalOutput;
|
|
763
751
|
type Outputs = Record<string, Output>;
|
|
764
|
-
//#endregion
|
|
765
|
-
//#region src/zodSchemas.d.ts
|
|
766
752
|
export declare const ResourcePortZod: z.ZodObject<{
|
|
767
753
|
kind: z.ZodLiteral<"resource">;
|
|
768
754
|
name: z.ZodString;
|
|
@@ -1485,8 +1471,6 @@ type SettlementEscrowWire = z.infer<typeof SettlementEscrowZod>;
|
|
|
1485
1471
|
type SettlementBindingWire = z.infer<typeof SettlementBindingZod>;
|
|
1486
1472
|
type SettlementWire = z.infer<typeof SettlementZod>;
|
|
1487
1473
|
type Shortfall = z.infer<typeof ShortfallZod>;
|
|
1488
|
-
//#endregion
|
|
1489
|
-
//#region src/compile.d.ts
|
|
1490
1474
|
type SimulationPolicy = 'strict' | 'allow-revert';
|
|
1491
1475
|
interface ComposeRun {
|
|
1492
1476
|
readonly inputs: Record<string, InputSpec>;
|
|
@@ -1533,6 +1517,8 @@ interface SimulationRevert {
|
|
|
1533
1517
|
readonly errorCandidates?: readonly {
|
|
1534
1518
|
readonly decodedErrorSignature: string;
|
|
1535
1519
|
readonly decodedParams: readonly string[];
|
|
1520
|
+
/** Human-readable description; present when the selector is in the backend's error registry. */
|
|
1521
|
+
readonly description?: string;
|
|
1536
1522
|
}[];
|
|
1537
1523
|
readonly error?: string;
|
|
1538
1524
|
};
|
|
@@ -1628,8 +1614,6 @@ type ComposeCompileResult = (ComposeCompileSuccessData & {
|
|
|
1628
1614
|
readonly message: string;
|
|
1629
1615
|
};
|
|
1630
1616
|
});
|
|
1631
|
-
//#endregion
|
|
1632
|
-
//#region src/flow.d.ts
|
|
1633
1617
|
interface Port {
|
|
1634
1618
|
readonly name: string;
|
|
1635
1619
|
readonly type: SolType;
|
|
@@ -1649,7 +1633,7 @@ type ComposeErrorKind = 'decode_error' | 'validation_error' | 'linearity_error'
|
|
|
1649
1633
|
/**
|
|
1650
1634
|
* Errors raised by compose routes outside the compile pipeline.
|
|
1651
1635
|
*/
|
|
1652
|
-
type ComposeRouteErrorKind = 'chain_validation_error' | 'unsupported_token' | 'zero_output' | 'service_unavailable' | 'verification_unavailable' | 'deployment_check_unavailable' | 'manifest_error' | 'sdk_outdated' | 'server_outdated';
|
|
1636
|
+
type ComposeRouteErrorKind = 'chain_validation_error' | 'unsupported_token' | 'signer_screening_rejected' | 'zero_output' | 'service_unavailable' | 'verification_unavailable' | 'deployment_check_unavailable' | 'manifest_error' | 'sdk_outdated' | 'server_outdated';
|
|
1653
1637
|
type GenericComposeErrorKind = Exclude<ComposeErrorKind, 'preparation_error' | 'simulation_revert' | 'delivery_error'>;
|
|
1654
1638
|
interface FailedPreparedOp {
|
|
1655
1639
|
readonly callId: string;
|
|
@@ -1716,8 +1700,6 @@ interface PreconditionBase {
|
|
|
1716
1700
|
type Precondition = PreconditionBase & Record<string, unknown>;
|
|
1717
1701
|
type PreconditionOf<C extends object> = PreconditionBase & C;
|
|
1718
1702
|
type PreconditionConfigOf<C extends object> = Omit<PreconditionBase, 'type'> & C;
|
|
1719
|
-
//#endregion
|
|
1720
|
-
//#region src/flashloan.d.ts
|
|
1721
1703
|
export declare const providerKindNames: readonly ['aave-v3', 'balancer-v2', 'morpho-blue'];
|
|
1722
1704
|
type ProviderKindName = (typeof providerKindNames)[number];
|
|
1723
1705
|
export declare const FlashloanConfigSchema: Schema.Struct<{
|
|
@@ -1743,8 +1725,6 @@ export declare const flashloanMaxFee: ({ providerKind, amount, maxFee }: {
|
|
|
1743
1725
|
readonly amount: string | bigint;
|
|
1744
1726
|
readonly maxFee?: string | bigint;
|
|
1745
1727
|
}) => bigint;
|
|
1746
|
-
//#endregion
|
|
1747
|
-
//#region src/constructors.d.ts
|
|
1748
1728
|
interface OpHandleOptions<Opt extends boolean = boolean> {
|
|
1749
1729
|
readonly expose?: boolean;
|
|
1750
1730
|
readonly units?: HandleUnits;
|
|
@@ -1804,8 +1784,6 @@ export declare const resourceOutput: <N extends string, const O extends Resource
|
|
|
1804
1784
|
readonly name: N;
|
|
1805
1785
|
readonly availability: OutputAvailability<O>;
|
|
1806
1786
|
} & OutputCountFrom<O>;
|
|
1807
|
-
//#endregion
|
|
1808
|
-
//#region src/outputFamilies.d.ts
|
|
1809
1787
|
type OutputFamilyPort = ResourceOutputPort & {
|
|
1810
1788
|
readonly countFrom: string;
|
|
1811
1789
|
};
|
|
@@ -1813,8 +1791,6 @@ export declare const isOutputFamily: (port: OpOutputPort) => port is OutputFamil
|
|
|
1813
1791
|
export declare const instancePortName: (family: string, index: number) => string;
|
|
1814
1792
|
export declare const familySize: (family: Pick<OutputFamilyPort, 'name' | 'countFrom'>, config: Call['config']) => number;
|
|
1815
1793
|
export declare const expandOutputPorts: (declared: readonly OpOutputPort[], config: Call['config']) => readonly OpOutputPort[];
|
|
1816
|
-
//#endregion
|
|
1817
|
-
//#region src/ref.d.ts
|
|
1818
1794
|
type ParsedRef = {
|
|
1819
1795
|
readonly scope: 'input';
|
|
1820
1796
|
readonly port: string;
|
|
@@ -1858,8 +1834,6 @@ export declare const foldRef: <R>(ref: ParsedRef, cases: {
|
|
|
1858
1834
|
readonly output: (node: string, port: string) => R;
|
|
1859
1835
|
}) => R;
|
|
1860
1836
|
export declare const refKey: (ref: Ref) => string;
|
|
1861
|
-
//#endregion
|
|
1862
|
-
//#region src/chainCapabilities.d.ts
|
|
1863
1837
|
/**
|
|
1864
1838
|
* Per-chain native-asset semantics.
|
|
1865
1839
|
*
|
|
@@ -2054,8 +2028,6 @@ export declare const normalizeResource: (r: Resource) => Resource;
|
|
|
2054
2028
|
* rewritten to the chain's stand-in ERC-20; every other address passes through.
|
|
2055
2029
|
*/
|
|
2056
2030
|
export declare const normalizeNativeTokenAddress: (token: string, chainId: number) => string;
|
|
2057
|
-
//#endregion
|
|
2058
|
-
//#region src/route.d.ts
|
|
2059
2031
|
/**
|
|
2060
2032
|
* Spend an exact amount of `fromToken`.
|
|
2061
2033
|
*
|
|
@@ -2181,8 +2153,6 @@ interface ComposeRouteRequest {
|
|
|
2181
2153
|
*/
|
|
2182
2154
|
readonly allowAsyncRoutes?: boolean;
|
|
2183
2155
|
}
|
|
2184
|
-
//#endregion
|
|
2185
|
-
//#region src/preconditions.d.ts
|
|
2186
2156
|
/**
|
|
2187
2157
|
* The three concrete precondition shapes the stack exchanges today. One
|
|
2188
2158
|
* definition serves every producer and consumer: op/materialiser declarations,
|
|
@@ -2216,8 +2186,6 @@ export declare const erc20Allowance: (config: Omit<Erc20AllowancePrecondition, '
|
|
|
2216
2186
|
export declare const isErc20BalancePrecondition: (p: Precondition) => p is Erc20BalancePrecondition;
|
|
2217
2187
|
export declare const isErc20AllowancePrecondition: (p: Precondition) => p is Erc20AllowancePrecondition;
|
|
2218
2188
|
export declare const isNativeBalancePrecondition: (p: Precondition) => p is NativeBalancePrecondition;
|
|
2219
|
-
//#endregion
|
|
2220
|
-
//#region src/simulate.d.ts
|
|
2221
2189
|
/**
|
|
2222
2190
|
* Maximum number of watched `(token, owner)` pairs accepted by `POST /simulate`.
|
|
2223
2191
|
*
|
|
@@ -2344,6 +2312,8 @@ interface SimulateRevertDecodeResult {
|
|
|
2344
2312
|
readonly errorCandidates?: {
|
|
2345
2313
|
readonly decodedErrorSignature: string;
|
|
2346
2314
|
readonly decodedParams: string[];
|
|
2315
|
+
/** Human-readable description; present when the selector is in the backend's error registry. */
|
|
2316
|
+
readonly description?: string;
|
|
2347
2317
|
}[];
|
|
2348
2318
|
readonly error?: string;
|
|
2349
2319
|
}
|
|
@@ -2373,8 +2343,6 @@ interface SimulateSetupErrorResult {
|
|
|
2373
2343
|
* one member: `ok` and `revert` come back with HTTP 200, `error` with HTTP 422.
|
|
2374
2344
|
*/
|
|
2375
2345
|
type SimulateResult = SimulateOkResult | SimulateRevertResult | SimulateSetupErrorResult;
|
|
2376
|
-
//#endregion
|
|
2377
|
-
//#region src/headers.d.ts
|
|
2378
2346
|
/**
|
|
2379
2347
|
* HTTP header names on the compose wire.
|
|
2380
2348
|
*
|
|
@@ -2386,8 +2354,6 @@ type SimulateResult = SimulateOkResult | SimulateRevertResult | SimulateSetupErr
|
|
|
2386
2354
|
export declare const COMPOSER_SDK_VERSION_HEADER = "x-lifi-composer-sdk";
|
|
2387
2355
|
/** Compose contract version the backend serves. Returned on every compose response. */
|
|
2388
2356
|
export declare const COMPOSE_VERSION_HEADER = "x-lifi-composer-version";
|
|
2389
|
-
//#endregion
|
|
2390
|
-
//#region src/version.d.ts
|
|
2391
2357
|
/**
|
|
2392
2358
|
* Compose contract version compatibility.
|
|
2393
2359
|
*
|
|
@@ -2433,8 +2399,6 @@ export declare const parseVersion: (version: string) => ComposeVersion | undefin
|
|
|
2433
2399
|
* because the server, not the client, decides how far back it serves.
|
|
2434
2400
|
*/
|
|
2435
2401
|
export declare const checkCompatibility: (client: ComposeVersion, server: ComposeVersion, minimum?: ComposeVersion) => VersionCompatibility;
|
|
2436
|
-
//#endregion
|
|
2437
|
-
//#region src/materialiserMetadata.d.ts
|
|
2438
2402
|
type MaterialiserMetadata = {
|
|
2439
2403
|
readonly kind: 'exact';
|
|
2440
2404
|
readonly amount: bigint;
|
|
@@ -2459,5 +2423,4 @@ export declare const foldMaterialiserMetadata: <R>(meta: MaterialiserMetadata, c
|
|
|
2459
2423
|
readonly capped: (amount: bigint, min: bigint | undefined) => R;
|
|
2460
2424
|
readonly runtime: (min: bigint | undefined) => R;
|
|
2461
2425
|
}) => R;
|
|
2462
|
-
//#endregion
|
|
2463
2426
|
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, Shortfall, 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
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Schema } from "effect";
|
|
2
2
|
import z from "zod";
|
|
3
|
-
//#region src/flowSchema.d.ts
|
|
4
3
|
export declare const SolTypeSchema: Schema.Literal<["uint8", "uint16", "uint32", "uint64", "uint128", "uint256", "int128", "int256", "address", "bool", "bytes", "bytes4", "bytes32", "string"]>;
|
|
5
4
|
export declare const EVMAddressString: Schema.refine<string, typeof Schema.String>;
|
|
6
5
|
export declare const IntegerString: Schema.filter<typeof Schema.String>;
|
|
@@ -311,8 +310,6 @@ type ForwardTo = typeof ForwardToSchema.Type;
|
|
|
311
310
|
type EpilogueForward = typeof EpilogueForwardSchema.Type;
|
|
312
311
|
type Epilogue = typeof EpilogueSchema.Type;
|
|
313
312
|
type Flow = typeof FlowSchema.Type;
|
|
314
|
-
//#endregion
|
|
315
|
-
//#region src/continuation.d.ts
|
|
316
313
|
export declare const CONTINUATION_COMMITMENT_OP_ID = "continuation.commitment";
|
|
317
314
|
export declare const ContinuationOutcomeSchema: Schema.transform<Schema.Schema<{
|
|
318
315
|
readonly token: string;
|
|
@@ -563,11 +560,6 @@ type ContinuationIntent = typeof ContinuationIntentSchema.Type;
|
|
|
563
560
|
type Phase1Artifact = typeof Phase1ArtifactSchema.Type;
|
|
564
561
|
type AssertionSpec = typeof AssertionSpecSchema.Type;
|
|
565
562
|
type CallCheckSpec = typeof CallCheckSpecSchema.Type;
|
|
566
|
-
export declare const settledOutcome: <I extends {
|
|
567
|
-
readonly outcomes: readonly unknown[];
|
|
568
|
-
}>(intent: I) => I['outcomes'][number] | undefined;
|
|
569
|
-
//#endregion
|
|
570
|
-
//#region src/descriptor.d.ts
|
|
571
563
|
export declare const Bytes32HexSchema: Schema.filter<typeof Schema.String>;
|
|
572
564
|
export declare const AssertedPredicateSchema: Schema.transformOrFail<Schema.Union<[Schema.Struct<{
|
|
573
565
|
kind: Schema.Literal<["erc20BalanceGte"]>;
|
|
@@ -692,8 +684,6 @@ export declare const VerificationDescriptorSchema: Schema.Struct<{
|
|
|
692
684
|
export declare const canonicalAssertedPredicate: (specs: readonly AssertionSpec[]) => string;
|
|
693
685
|
type VerificationDescriptor = typeof VerificationDescriptorSchema.Type;
|
|
694
686
|
type AssertedPredicate = AssertionSpec;
|
|
695
|
-
//#endregion
|
|
696
|
-
//#region src/resource.d.ts
|
|
697
687
|
type Availability = 'now' | 'future';
|
|
698
688
|
interface OutputAmount {
|
|
699
689
|
readonly expected: bigint;
|
|
@@ -722,8 +712,6 @@ export declare const resourceToken: (r: Resource) => string;
|
|
|
722
712
|
export declare const resourceKey: (r: Resource) => string;
|
|
723
713
|
export declare const describeResource: (r: Resource) => string;
|
|
724
714
|
export declare const erc20Token: (r: Resource) => string;
|
|
725
|
-
//#endregion
|
|
726
|
-
//#region src/output.d.ts
|
|
727
715
|
type EstimateBasis = 'simulated' | 'quoted';
|
|
728
716
|
type MinimumBasis = 'guard' | 'op' | 'input' | 'declared';
|
|
729
717
|
interface Estimate {
|
|
@@ -761,8 +749,6 @@ interface TerminalOutput extends OutputBase {
|
|
|
761
749
|
}
|
|
762
750
|
type Output = ConsumedOutput | TerminalOutput;
|
|
763
751
|
type Outputs = Record<string, Output>;
|
|
764
|
-
//#endregion
|
|
765
|
-
//#region src/zodSchemas.d.ts
|
|
766
752
|
export declare const ResourcePortZod: z.ZodObject<{
|
|
767
753
|
kind: z.ZodLiteral<"resource">;
|
|
768
754
|
name: z.ZodString;
|
|
@@ -1485,8 +1471,6 @@ type SettlementEscrowWire = z.infer<typeof SettlementEscrowZod>;
|
|
|
1485
1471
|
type SettlementBindingWire = z.infer<typeof SettlementBindingZod>;
|
|
1486
1472
|
type SettlementWire = z.infer<typeof SettlementZod>;
|
|
1487
1473
|
type Shortfall = z.infer<typeof ShortfallZod>;
|
|
1488
|
-
//#endregion
|
|
1489
|
-
//#region src/compile.d.ts
|
|
1490
1474
|
type SimulationPolicy = 'strict' | 'allow-revert';
|
|
1491
1475
|
interface ComposeRun {
|
|
1492
1476
|
readonly inputs: Record<string, InputSpec>;
|
|
@@ -1533,6 +1517,8 @@ interface SimulationRevert {
|
|
|
1533
1517
|
readonly errorCandidates?: readonly {
|
|
1534
1518
|
readonly decodedErrorSignature: string;
|
|
1535
1519
|
readonly decodedParams: readonly string[];
|
|
1520
|
+
/** Human-readable description; present when the selector is in the backend's error registry. */
|
|
1521
|
+
readonly description?: string;
|
|
1536
1522
|
}[];
|
|
1537
1523
|
readonly error?: string;
|
|
1538
1524
|
};
|
|
@@ -1628,8 +1614,6 @@ type ComposeCompileResult = (ComposeCompileSuccessData & {
|
|
|
1628
1614
|
readonly message: string;
|
|
1629
1615
|
};
|
|
1630
1616
|
});
|
|
1631
|
-
//#endregion
|
|
1632
|
-
//#region src/flow.d.ts
|
|
1633
1617
|
interface Port {
|
|
1634
1618
|
readonly name: string;
|
|
1635
1619
|
readonly type: SolType;
|
|
@@ -1649,7 +1633,7 @@ type ComposeErrorKind = 'decode_error' | 'validation_error' | 'linearity_error'
|
|
|
1649
1633
|
/**
|
|
1650
1634
|
* Errors raised by compose routes outside the compile pipeline.
|
|
1651
1635
|
*/
|
|
1652
|
-
type ComposeRouteErrorKind = 'chain_validation_error' | 'unsupported_token' | 'zero_output' | 'service_unavailable' | 'verification_unavailable' | 'deployment_check_unavailable' | 'manifest_error' | 'sdk_outdated' | 'server_outdated';
|
|
1636
|
+
type ComposeRouteErrorKind = 'chain_validation_error' | 'unsupported_token' | 'signer_screening_rejected' | 'zero_output' | 'service_unavailable' | 'verification_unavailable' | 'deployment_check_unavailable' | 'manifest_error' | 'sdk_outdated' | 'server_outdated';
|
|
1653
1637
|
type GenericComposeErrorKind = Exclude<ComposeErrorKind, 'preparation_error' | 'simulation_revert' | 'delivery_error'>;
|
|
1654
1638
|
interface FailedPreparedOp {
|
|
1655
1639
|
readonly callId: string;
|
|
@@ -1716,8 +1700,6 @@ interface PreconditionBase {
|
|
|
1716
1700
|
type Precondition = PreconditionBase & Record<string, unknown>;
|
|
1717
1701
|
type PreconditionOf<C extends object> = PreconditionBase & C;
|
|
1718
1702
|
type PreconditionConfigOf<C extends object> = Omit<PreconditionBase, 'type'> & C;
|
|
1719
|
-
//#endregion
|
|
1720
|
-
//#region src/flashloan.d.ts
|
|
1721
1703
|
export declare const providerKindNames: readonly ['aave-v3', 'balancer-v2', 'morpho-blue'];
|
|
1722
1704
|
type ProviderKindName = (typeof providerKindNames)[number];
|
|
1723
1705
|
export declare const FlashloanConfigSchema: Schema.Struct<{
|
|
@@ -1743,8 +1725,6 @@ export declare const flashloanMaxFee: ({ providerKind, amount, maxFee }: {
|
|
|
1743
1725
|
readonly amount: string | bigint;
|
|
1744
1726
|
readonly maxFee?: string | bigint;
|
|
1745
1727
|
}) => bigint;
|
|
1746
|
-
//#endregion
|
|
1747
|
-
//#region src/constructors.d.ts
|
|
1748
1728
|
interface OpHandleOptions<Opt extends boolean = boolean> {
|
|
1749
1729
|
readonly expose?: boolean;
|
|
1750
1730
|
readonly units?: HandleUnits;
|
|
@@ -1804,8 +1784,6 @@ export declare const resourceOutput: <N extends string, const O extends Resource
|
|
|
1804
1784
|
readonly name: N;
|
|
1805
1785
|
readonly availability: OutputAvailability<O>;
|
|
1806
1786
|
} & OutputCountFrom<O>;
|
|
1807
|
-
//#endregion
|
|
1808
|
-
//#region src/outputFamilies.d.ts
|
|
1809
1787
|
type OutputFamilyPort = ResourceOutputPort & {
|
|
1810
1788
|
readonly countFrom: string;
|
|
1811
1789
|
};
|
|
@@ -1813,8 +1791,6 @@ export declare const isOutputFamily: (port: OpOutputPort) => port is OutputFamil
|
|
|
1813
1791
|
export declare const instancePortName: (family: string, index: number) => string;
|
|
1814
1792
|
export declare const familySize: (family: Pick<OutputFamilyPort, 'name' | 'countFrom'>, config: Call['config']) => number;
|
|
1815
1793
|
export declare const expandOutputPorts: (declared: readonly OpOutputPort[], config: Call['config']) => readonly OpOutputPort[];
|
|
1816
|
-
//#endregion
|
|
1817
|
-
//#region src/ref.d.ts
|
|
1818
1794
|
type ParsedRef = {
|
|
1819
1795
|
readonly scope: 'input';
|
|
1820
1796
|
readonly port: string;
|
|
@@ -1858,8 +1834,6 @@ export declare const foldRef: <R>(ref: ParsedRef, cases: {
|
|
|
1858
1834
|
readonly output: (node: string, port: string) => R;
|
|
1859
1835
|
}) => R;
|
|
1860
1836
|
export declare const refKey: (ref: Ref) => string;
|
|
1861
|
-
//#endregion
|
|
1862
|
-
//#region src/chainCapabilities.d.ts
|
|
1863
1837
|
/**
|
|
1864
1838
|
* Per-chain native-asset semantics.
|
|
1865
1839
|
*
|
|
@@ -2054,8 +2028,6 @@ export declare const normalizeResource: (r: Resource) => Resource;
|
|
|
2054
2028
|
* rewritten to the chain's stand-in ERC-20; every other address passes through.
|
|
2055
2029
|
*/
|
|
2056
2030
|
export declare const normalizeNativeTokenAddress: (token: string, chainId: number) => string;
|
|
2057
|
-
//#endregion
|
|
2058
|
-
//#region src/route.d.ts
|
|
2059
2031
|
/**
|
|
2060
2032
|
* Spend an exact amount of `fromToken`.
|
|
2061
2033
|
*
|
|
@@ -2181,8 +2153,6 @@ interface ComposeRouteRequest {
|
|
|
2181
2153
|
*/
|
|
2182
2154
|
readonly allowAsyncRoutes?: boolean;
|
|
2183
2155
|
}
|
|
2184
|
-
//#endregion
|
|
2185
|
-
//#region src/preconditions.d.ts
|
|
2186
2156
|
/**
|
|
2187
2157
|
* The three concrete precondition shapes the stack exchanges today. One
|
|
2188
2158
|
* definition serves every producer and consumer: op/materialiser declarations,
|
|
@@ -2216,8 +2186,6 @@ export declare const erc20Allowance: (config: Omit<Erc20AllowancePrecondition, '
|
|
|
2216
2186
|
export declare const isErc20BalancePrecondition: (p: Precondition) => p is Erc20BalancePrecondition;
|
|
2217
2187
|
export declare const isErc20AllowancePrecondition: (p: Precondition) => p is Erc20AllowancePrecondition;
|
|
2218
2188
|
export declare const isNativeBalancePrecondition: (p: Precondition) => p is NativeBalancePrecondition;
|
|
2219
|
-
//#endregion
|
|
2220
|
-
//#region src/simulate.d.ts
|
|
2221
2189
|
/**
|
|
2222
2190
|
* Maximum number of watched `(token, owner)` pairs accepted by `POST /simulate`.
|
|
2223
2191
|
*
|
|
@@ -2344,6 +2312,8 @@ interface SimulateRevertDecodeResult {
|
|
|
2344
2312
|
readonly errorCandidates?: {
|
|
2345
2313
|
readonly decodedErrorSignature: string;
|
|
2346
2314
|
readonly decodedParams: string[];
|
|
2315
|
+
/** Human-readable description; present when the selector is in the backend's error registry. */
|
|
2316
|
+
readonly description?: string;
|
|
2347
2317
|
}[];
|
|
2348
2318
|
readonly error?: string;
|
|
2349
2319
|
}
|
|
@@ -2373,8 +2343,6 @@ interface SimulateSetupErrorResult {
|
|
|
2373
2343
|
* one member: `ok` and `revert` come back with HTTP 200, `error` with HTTP 422.
|
|
2374
2344
|
*/
|
|
2375
2345
|
type SimulateResult = SimulateOkResult | SimulateRevertResult | SimulateSetupErrorResult;
|
|
2376
|
-
//#endregion
|
|
2377
|
-
//#region src/headers.d.ts
|
|
2378
2346
|
/**
|
|
2379
2347
|
* HTTP header names on the compose wire.
|
|
2380
2348
|
*
|
|
@@ -2386,8 +2354,6 @@ type SimulateResult = SimulateOkResult | SimulateRevertResult | SimulateSetupErr
|
|
|
2386
2354
|
export declare const COMPOSER_SDK_VERSION_HEADER = "x-lifi-composer-sdk";
|
|
2387
2355
|
/** Compose contract version the backend serves. Returned on every compose response. */
|
|
2388
2356
|
export declare const COMPOSE_VERSION_HEADER = "x-lifi-composer-version";
|
|
2389
|
-
//#endregion
|
|
2390
|
-
//#region src/version.d.ts
|
|
2391
2357
|
/**
|
|
2392
2358
|
* Compose contract version compatibility.
|
|
2393
2359
|
*
|
|
@@ -2433,8 +2399,6 @@ export declare const parseVersion: (version: string) => ComposeVersion | undefin
|
|
|
2433
2399
|
* because the server, not the client, decides how far back it serves.
|
|
2434
2400
|
*/
|
|
2435
2401
|
export declare const checkCompatibility: (client: ComposeVersion, server: ComposeVersion, minimum?: ComposeVersion) => VersionCompatibility;
|
|
2436
|
-
//#endregion
|
|
2437
|
-
//#region src/materialiserMetadata.d.ts
|
|
2438
2402
|
type MaterialiserMetadata = {
|
|
2439
2403
|
readonly kind: 'exact';
|
|
2440
2404
|
readonly amount: bigint;
|
|
@@ -2459,5 +2423,4 @@ export declare const foldMaterialiserMetadata: <R>(meta: MaterialiserMetadata, c
|
|
|
2459
2423
|
readonly capped: (amount: bigint, min: bigint | undefined) => R;
|
|
2460
2424
|
readonly runtime: (min: bigint | undefined) => R;
|
|
2461
2425
|
}) => R;
|
|
2462
|
-
//#endregion
|
|
2463
2426
|
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, Shortfall, SimulateBalanceEntry, SimulateOkResult, SimulateRequest, SimulateResult, SimulateRevertDecodeResult, SimulateRevertResult, SimulateSetupErrorResult, SimulationPolicy, SimulationRevert, SimulationRevertComposeError, SlotFinderRequirement, SolType, SpendEntry, StaticSolType, TerminalOutput, TrackedBalance, VerificationDescriptor, VerificationDescriptorWire, VersionCompatibility };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ParseResult, Schema } from "effect";
|
|
2
2
|
import z from "zod";
|
|
3
|
-
|
|
3
|
+
// src/chainCapabilities.ts
|
|
4
4
|
/**
|
|
5
5
|
* The zero-address sentinel that represents the native gas coin on
|
|
6
6
|
* EVM-native chains. Exported so tests and call-sites can reference it
|
|
@@ -186,15 +186,13 @@ const normalizeResource = (r) => {
|
|
|
186
186
|
* rewritten to the chain's stand-in ERC-20; every other address passes through.
|
|
187
187
|
*/
|
|
188
188
|
const normalizeNativeTokenAddress = (token, chainId) => hasErc20CanonicalNative(chainId) && isZeroAddress(token) ? canonicalNativeAddress(chainId) : token;
|
|
189
|
-
|
|
190
|
-
//#region src/hexPatterns.ts
|
|
189
|
+
// src/hexPatterns.ts
|
|
191
190
|
const BYTES32_LOWER_HEX = /^0x[0-9a-f]{64}$/;
|
|
192
191
|
const EVM_ADDRESS_HEX = /^0x[0-9a-fA-F]{40}$/;
|
|
193
192
|
const DECIMAL_UINT = /^[0-9]+$/;
|
|
194
193
|
const MAX_UINT256 = 2n ** 256n - 1n;
|
|
195
194
|
const MAX_DATE_MS = 864e13;
|
|
196
|
-
|
|
197
|
-
//#region src/flowSchema.ts
|
|
195
|
+
// src/flowSchema.ts
|
|
198
196
|
const SolTypeSchema = Schema.Literal("uint8", "uint16", "uint32", "uint64", "uint128", "uint256", "int128", "int256", "address", "bool", "bytes", "bytes4", "bytes32", "string");
|
|
199
197
|
const ChainIdSchema = Schema.Number.pipe(Schema.int(), Schema.positive());
|
|
200
198
|
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" });
|
|
@@ -289,8 +287,7 @@ const FlowSchema = Schema.Struct({
|
|
|
289
287
|
lineage: Schema.optional(LineageSchema),
|
|
290
288
|
epilogue: Schema.optional(EpilogueSchema)
|
|
291
289
|
});
|
|
292
|
-
|
|
293
|
-
//#region src/continuation.ts
|
|
290
|
+
// src/continuation.ts
|
|
294
291
|
const CONTINUATION_COMMITMENT_OP_ID = "continuation.commitment";
|
|
295
292
|
const outcomeFields = (minAmount) => ({
|
|
296
293
|
token: EVMAddressString,
|
|
@@ -393,9 +390,7 @@ const decodeNativeBalanceGte = (check, ast) => {
|
|
|
393
390
|
}
|
|
394
391
|
};
|
|
395
392
|
const AssertionSpecSchema = Schema.Union(Erc20BalanceGteSpecSchema, NativeBalanceGteSpecSchema, CallCheckSpecSchema);
|
|
396
|
-
|
|
397
|
-
//#endregion
|
|
398
|
-
//#region src/descriptor.ts
|
|
393
|
+
// src/descriptor.ts
|
|
399
394
|
const Bytes32HexSchema = Schema.String.pipe(Schema.pattern(BYTES32_LOWER_HEX));
|
|
400
395
|
const AssertedPredicateSchema = Schema.transformOrFail(AssertionSpecSchema, Schema.typeSchema(AssertionSpecSchema), {
|
|
401
396
|
strict: true,
|
|
@@ -416,8 +411,7 @@ const canonicalJson = (value) => {
|
|
|
416
411
|
return JSON.stringify(value);
|
|
417
412
|
};
|
|
418
413
|
const canonicalAssertedPredicate = (specs) => canonicalJson(specs);
|
|
419
|
-
|
|
420
|
-
//#region src/flow.ts
|
|
414
|
+
// src/flow.ts
|
|
421
415
|
const isResourceInput = (input) => "resource" in input;
|
|
422
416
|
const flowInputType = (input) => isResourceInput(input) ? "uint256" : input.type;
|
|
423
417
|
const flowInputMode = (input) => isResourceInput(input) ? "linear" : "copy";
|
|
@@ -427,8 +421,7 @@ const isHandlePort = (port) => port.kind === "handle";
|
|
|
427
421
|
const isResourceOutputPort = (port) => port.kind === "resource_output";
|
|
428
422
|
const isFutureResourceOutput = (port) => isResourceOutputPort(port) && port.availability === "future";
|
|
429
423
|
const isMaterialiserInput = (s) => typeof s === "object" && s !== null && "kind" in s;
|
|
430
|
-
|
|
431
|
-
//#region src/resource.ts
|
|
424
|
+
// src/resource.ts
|
|
432
425
|
const erc20Resource = (token, chainId) => ({
|
|
433
426
|
kind: "erc20",
|
|
434
427
|
token,
|
|
@@ -468,8 +461,7 @@ const erc20Token = (r) => {
|
|
|
468
461
|
if (r.kind !== "erc20") throw new Error(`Expected erc20 resource, got ${r.kind}`);
|
|
469
462
|
return r.token;
|
|
470
463
|
};
|
|
471
|
-
|
|
472
|
-
//#region src/flashloan.ts
|
|
464
|
+
// src/flashloan.ts
|
|
473
465
|
const providerKindNames = [
|
|
474
466
|
"aave-v3",
|
|
475
467
|
"balancer-v2",
|
|
@@ -492,8 +484,7 @@ const FLASHLOAN_FEE_BPS = {
|
|
|
492
484
|
};
|
|
493
485
|
const BPS_DENOMINATOR = 10000n;
|
|
494
486
|
const flashloanMaxFee = ({ providerKind, amount, maxFee }) => maxFee !== void 0 ? BigInt(maxFee) : (BigInt(amount) * FLASHLOAN_FEE_BPS[providerKind] + BPS_DENOMINATOR - 1n) / BPS_DENOMINATOR;
|
|
495
|
-
|
|
496
|
-
//#region src/constructors.ts
|
|
487
|
+
// src/constructors.ts
|
|
497
488
|
/** Returns `{ [key]: value }` when `value` is not nullish, else `{}`. */
|
|
498
489
|
const optionalProp = (key, value) => value !== void 0 && value !== null ? { [key]: value } : {};
|
|
499
490
|
const linear = (name, type) => ({
|
|
@@ -556,8 +547,7 @@ const resourceOutput = (name, options) => {
|
|
|
556
547
|
...optionalProp("countFrom", opts?.countFrom)
|
|
557
548
|
};
|
|
558
549
|
};
|
|
559
|
-
|
|
560
|
-
//#region src/outputFamilies.ts
|
|
550
|
+
// src/outputFamilies.ts
|
|
561
551
|
const isOutputFamily = (port) => port.kind === "resource_output" && port.countFrom !== void 0;
|
|
562
552
|
const instancePortName = (family, index) => `${family}.${index}`;
|
|
563
553
|
const familySize = (family, config) => {
|
|
@@ -574,8 +564,7 @@ const expandFamily = (port, config) => {
|
|
|
574
564
|
}));
|
|
575
565
|
};
|
|
576
566
|
const expandOutputPorts = (declared, config) => declared.some(isOutputFamily) ? declared.flatMap((port) => isOutputFamily(port) ? expandFamily(port, config) : [port]) : declared;
|
|
577
|
-
|
|
578
|
-
//#region src/ref.ts
|
|
567
|
+
// src/ref.ts
|
|
579
568
|
const isContextKey = (key) => key === "sender" || key === "executionAddress";
|
|
580
569
|
/**
|
|
581
570
|
* Ref prefixes that parseRef intercepts before the fallback `output` scope.
|
|
@@ -634,8 +623,7 @@ const refKey = (ref) => foldRef(parseRef(ref), {
|
|
|
634
623
|
context: (key) => `context:${key}`,
|
|
635
624
|
output: (node, port) => `output:${node}:${port}`
|
|
636
625
|
});
|
|
637
|
-
|
|
638
|
-
//#region src/preconditions.ts
|
|
626
|
+
// src/preconditions.ts
|
|
639
627
|
const erc20Balance = (config) => ({
|
|
640
628
|
type: "Erc20Balance",
|
|
641
629
|
...config
|
|
@@ -651,8 +639,7 @@ const erc20Allowance = (config) => ({
|
|
|
651
639
|
const isErc20BalancePrecondition = (p) => p.type === "Erc20Balance";
|
|
652
640
|
const isErc20AllowancePrecondition = (p) => p.type === "Erc20Allowance";
|
|
653
641
|
const isNativeBalancePrecondition = (p) => p.type === "NativeBalance";
|
|
654
|
-
|
|
655
|
-
//#region src/simulate.ts
|
|
642
|
+
// src/simulate.ts
|
|
656
643
|
/**
|
|
657
644
|
* Maximum number of watched `(token, owner)` pairs accepted by `POST /simulate`.
|
|
658
645
|
*
|
|
@@ -674,8 +661,7 @@ const SIMULATE_MAX_TRACKED_BALANCES = 40;
|
|
|
674
661
|
* trust boundary and re-enforced server-side in `rawSimulation.ts`.
|
|
675
662
|
*/
|
|
676
663
|
const SIMULATE_MAX_REQUIREMENTS = 40;
|
|
677
|
-
|
|
678
|
-
//#region src/headers.ts
|
|
664
|
+
// src/headers.ts
|
|
679
665
|
/**
|
|
680
666
|
* HTTP header names on the compose wire.
|
|
681
667
|
*
|
|
@@ -687,8 +673,7 @@ const SIMULATE_MAX_REQUIREMENTS = 40;
|
|
|
687
673
|
const COMPOSER_SDK_VERSION_HEADER = "x-lifi-composer-sdk";
|
|
688
674
|
/** Compose contract version the backend serves. Returned on every compose response. */
|
|
689
675
|
const COMPOSE_VERSION_HEADER = "x-lifi-composer-version";
|
|
690
|
-
|
|
691
|
-
//#region src/version.ts
|
|
676
|
+
// src/version.ts
|
|
692
677
|
const SEMANTIC_VERSION_PATTERN = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
|
|
693
678
|
/**
|
|
694
679
|
* Parses the numeric triple of a semantic version. Prerelease and build
|
|
@@ -743,16 +728,14 @@ const checkCompatibility = (client, server, minimum = {
|
|
|
743
728
|
if (compareVersions(client, minimum) < 0) return "sdk_outdated";
|
|
744
729
|
return "compatible";
|
|
745
730
|
};
|
|
746
|
-
|
|
747
|
-
//#region src/materialiserMetadata.ts
|
|
731
|
+
// src/materialiserMetadata.ts
|
|
748
732
|
const foldMaterialiserMetadata = (meta, cases) => {
|
|
749
733
|
if (meta.kind === "exact") return cases.exact(meta.amount);
|
|
750
734
|
if (meta.kind === "exact-native") return cases.exactNative(meta.amount);
|
|
751
735
|
if (meta.kind === "capped") return cases.capped(meta.amount, meta.min);
|
|
752
736
|
return cases.runtime(meta.min);
|
|
753
737
|
};
|
|
754
|
-
|
|
755
|
-
//#region src/zodSchemas.ts
|
|
738
|
+
// src/zodSchemas.ts
|
|
756
739
|
const chainIdZod = z.number().int().positive();
|
|
757
740
|
const evmAddressZod = z.string().regex(EVM_ADDRESS_HEX);
|
|
758
741
|
const uintStringZod = z.string().refine((value) => DECIMAL_UINT.test(value) && BigInt(value) <= MAX_UINT256, { message: "expected a uint256 decimal integer string" });
|
|
@@ -960,5 +943,4 @@ const ShortfallZod = z.object({
|
|
|
960
943
|
required: z.string(),
|
|
961
944
|
available: z.string()
|
|
962
945
|
});
|
|
963
|
-
|
|
964
|
-
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, FlashloanConfigSchema, FlashloanMaterialiserInputSchema, FlowInputSchema, FlowSchema, ForwardToSchema, GuardCompatibilityZod, GuardSelectorZod, HANDLE_UNITS, HandleInputSchema, HandlePortZod, HandleUnitsZod, HexStringSchema, InputPortZod, IntegerString, LineageSchema, LiteralBindingSchema, ManifestGuardZod, ManifestMaterialiserZod, ManifestOperationZod, ManifestPreconditionZod, ManifestRoutingZod, NativeBalanceGteSpecSchema, OutputPortZod, Phase1ArtifactSchema, RESERVED_REF_SCOPES, RefSchema, ResourceInputSchema, ResourceOutputPortZod, ResourcePortZod, ResourceSchema, SIMULATE_MAX_REQUIREMENTS, SIMULATE_MAX_TRACKED_BALANCES, STATIC_SOL_TYPES, SettlementZod, ShortfallZod, SolTypeSchema, StaticSolTypeZod, TEMPO_CHAIN_ID, TEMPO_NATIVE_ERC20, UuidSchema, VerificationDescriptorSchema, VerificationDescriptorZod, canonicalAssertedPredicate, canonicalNativeAddress, checkCompatibility, copy, describeResource, erc20, erc20Allowance, erc20Balance, erc20Resource, erc20Token, expandOutputPorts, familySize, flashloanMaxFee, flowInputMode, flowInputResource, flowInputType, foldChainCapabilities, foldMaterialiserMetadata, foldRef, foldResource, getChainCapabilities, handle, hasErc20CanonicalNative, instancePortName, isAsErc20Chain, isContextKey, isERC20Resource, isErc20AllowancePrecondition, isErc20BalancePrecondition, isFlashloanMaterialiserInput, isFutureResourceOutput, isHandlePort, isMaterialiserInput, isMsgValueNative, isNativeAddressForChain, isNativeBalancePrecondition, isNativeResource, isOutputFamily, isRef, isResourceInput, isResourceOutputPort, isResourcePort, isStaticSolType, linear, native, nativeBalance, nativeCheckPolicy, nativeResource, normalizeNativeTokenAddress, normalizeResource, opHandle, parseRef, parseVersion, providerKindNames, readResource, ref, refKey, resource, resourceKey, resourceOutput, resourceToken, resourcesEqual, settledOutcome };
|
|
946
|
+
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, FlashloanConfigSchema, FlashloanMaterialiserInputSchema, FlowInputSchema, FlowSchema, ForwardToSchema, GuardCompatibilityZod, GuardSelectorZod, HANDLE_UNITS, HandleInputSchema, HandlePortZod, HandleUnitsZod, HexStringSchema, InputPortZod, IntegerString, LineageSchema, LiteralBindingSchema, ManifestGuardZod, ManifestMaterialiserZod, ManifestOperationZod, ManifestPreconditionZod, ManifestRoutingZod, NativeBalanceGteSpecSchema, OutputPortZod, Phase1ArtifactSchema, RESERVED_REF_SCOPES, RefSchema, ResourceInputSchema, ResourceOutputPortZod, ResourcePortZod, ResourceSchema, SIMULATE_MAX_REQUIREMENTS, SIMULATE_MAX_TRACKED_BALANCES, STATIC_SOL_TYPES, SettlementZod, ShortfallZod, SolTypeSchema, StaticSolTypeZod, TEMPO_CHAIN_ID, TEMPO_NATIVE_ERC20, UuidSchema, VerificationDescriptorSchema, VerificationDescriptorZod, canonicalAssertedPredicate, canonicalNativeAddress, checkCompatibility, copy, describeResource, erc20, erc20Allowance, erc20Balance, erc20Resource, erc20Token, expandOutputPorts, familySize, flashloanMaxFee, flowInputMode, flowInputResource, flowInputType, foldChainCapabilities, foldMaterialiserMetadata, foldRef, foldResource, getChainCapabilities, handle, hasErc20CanonicalNative, instancePortName, isAsErc20Chain, isContextKey, isERC20Resource, isErc20AllowancePrecondition, isErc20BalancePrecondition, isFlashloanMaterialiserInput, isFutureResourceOutput, isHandlePort, isMaterialiserInput, isMsgValueNative, isNativeAddressForChain, isNativeBalancePrecondition, isNativeResource, isOutputFamily, isRef, isResourceInput, isResourceOutputPort, isResourcePort, isStaticSolType, linear, native, nativeBalance, nativeCheckPolicy, nativeResource, normalizeNativeTokenAddress, normalizeResource, opHandle, parseRef, parseVersion, providerKindNames, readResource, ref, refKey, resource, resourceKey, resourceOutput, resourceToken, resourcesEqual };
|
package/package.json
CHANGED
package/src/compile.ts
CHANGED
|
@@ -58,6 +58,8 @@ export interface SimulationRevert {
|
|
|
58
58
|
readonly errorCandidates?: readonly {
|
|
59
59
|
readonly decodedErrorSignature: string;
|
|
60
60
|
readonly decodedParams: readonly string[];
|
|
61
|
+
/** Human-readable description; present when the selector is in the backend's error registry. */
|
|
62
|
+
readonly description?: string;
|
|
61
63
|
}[];
|
|
62
64
|
readonly error?: string;
|
|
63
65
|
};
|
package/src/continuation.ts
CHANGED
|
@@ -25,8 +25,9 @@ export const CONTINUATION_COMMITMENT_OP_ID = 'continuation.commitment';
|
|
|
25
25
|
// A single outcome of a deferred settlement: `token` must be delivered to
|
|
26
26
|
// `destination` on `chainId`. Amounts are decimal strings on the wire because
|
|
27
27
|
// JSON has no bigint; `chainId` reuses the shared `ChainIdSchema` from
|
|
28
|
-
// `flowSchema.ts`. `
|
|
29
|
-
// output and `destination` its owner, so both take the address
|
|
28
|
+
// `flowSchema.ts`. Outcome `i` becomes the `Resource` on `continuation.settle`'s
|
|
29
|
+
// `outcomes.i` output and `destination` its owner, so both take the address
|
|
30
|
+
// rule.
|
|
30
31
|
//
|
|
31
32
|
// `minAmount` is the floor the author commits to. An author may omit it: a
|
|
32
33
|
// committed provider proves the floor from the settle's `continuationFlow`,
|
|
@@ -92,9 +93,9 @@ export const CommittedOutcomeSchema = normalizingOutcome(
|
|
|
92
93
|
// `compose-spec` dependency-free.
|
|
93
94
|
export const ContinuationIntentSchema = Schema.Struct({
|
|
94
95
|
// Zero outcomes are admitted only for an exact settle, whose bound leg is its
|
|
95
|
-
// only enforcement; compose-core's first
|
|
96
|
-
// (`resolveContinuationProvider.ts:CAPABILITY_CHECKS`)
|
|
97
|
-
//
|
|
96
|
+
// only enforcement; compose-core's first capability gate
|
|
97
|
+
// (`resolveContinuationProvider.ts:CAPABILITY_CHECKS`) enforces that pairing,
|
|
98
|
+
// since the schema cannot see `exact`.
|
|
98
99
|
outcomes: Schema.Array(ContinuationOutcomeSchema),
|
|
99
100
|
continuationFlow: Schema.optional(FlowSchema),
|
|
100
101
|
validity: Schema.Struct({ expiresAtMs: EpochMsSchema }),
|
|
@@ -337,18 +338,3 @@ export type ContinuationIntent = typeof ContinuationIntentSchema.Type;
|
|
|
337
338
|
export type Phase1Artifact = typeof Phase1ArtifactSchema.Type;
|
|
338
339
|
export type AssertionSpec = typeof AssertionSpecSchema.Type;
|
|
339
340
|
export type CallCheckSpec = typeof CallCheckSpecSchema.Type;
|
|
340
|
-
|
|
341
|
-
// The outcome a `continuation.settle` node's single `output` port stands for.
|
|
342
|
-
// The wire format admits several outcomes, but the op produces one resource,
|
|
343
|
-
// discloses one owner, and every shipped provider rejects a multi-outcome
|
|
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`.
|
|
350
|
-
export const settledOutcome = <
|
|
351
|
-
I extends { readonly outcomes: readonly unknown[] },
|
|
352
|
-
>(
|
|
353
|
-
intent: I,
|
|
354
|
-
): I['outcomes'][number] | undefined => intent.outcomes[0];
|
package/src/flow.ts
CHANGED
|
@@ -94,6 +94,9 @@ export type ComposeErrorKind =
|
|
|
94
94
|
export type ComposeRouteErrorKind =
|
|
95
95
|
| 'chain_validation_error'
|
|
96
96
|
| 'unsupported_token'
|
|
97
|
+
// The signer is on a threat-intelligence list (zeroShadow) and may not use
|
|
98
|
+
// the service.
|
|
99
|
+
| 'signer_screening_rejected'
|
|
97
100
|
| 'zero_output'
|
|
98
101
|
| 'service_unavailable'
|
|
99
102
|
| 'verification_unavailable'
|
|
@@ -151,7 +154,9 @@ export interface SimulationRevertComposeError extends ComposeErrorBase {
|
|
|
151
154
|
// - `quote_failed`: the second quote (to the registered escrow) failed;
|
|
152
155
|
// `cause` is the kind of that failure and `quoted` is the first quote.
|
|
153
156
|
export type DeliveryErrorReason =
|
|
154
|
-
|
|
157
|
+
| 'floor_drift'
|
|
158
|
+
| 'eta_exceeds_expiry'
|
|
159
|
+
| 'quote_failed';
|
|
155
160
|
|
|
156
161
|
// `escrow` is present only when the failure came after the escrow was
|
|
157
162
|
// registered: the escrow is then abandoned and expires unfunded, and this
|
package/src/index.ts
CHANGED
package/src/simulate.ts
CHANGED
|
@@ -167,6 +167,8 @@ export interface SimulateRevertDecodeResult {
|
|
|
167
167
|
readonly errorCandidates?: {
|
|
168
168
|
readonly decodedErrorSignature: string;
|
|
169
169
|
readonly decodedParams: string[];
|
|
170
|
+
/** Human-readable description; present when the selector is in the backend's error registry. */
|
|
171
|
+
readonly description?: string;
|
|
170
172
|
}[];
|
|
171
173
|
readonly error?: string;
|
|
172
174
|
}
|
|
@@ -199,4 +201,6 @@ export interface SimulateSetupErrorResult {
|
|
|
199
201
|
* one member: `ok` and `revert` come back with HTTP 200, `error` with HTTP 422.
|
|
200
202
|
*/
|
|
201
203
|
export type SimulateResult =
|
|
202
|
-
|
|
204
|
+
| SimulateOkResult
|
|
205
|
+
| SimulateRevertResult
|
|
206
|
+
| SimulateSetupErrorResult;
|
package/src/version.ts
CHANGED
|
@@ -17,7 +17,9 @@ export interface ComposeVersion {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export type VersionCompatibility =
|
|
20
|
-
|
|
20
|
+
| 'compatible'
|
|
21
|
+
| 'sdk_outdated'
|
|
22
|
+
| 'server_outdated';
|
|
21
23
|
|
|
22
24
|
const SEMANTIC_VERSION_PATTERN =
|
|
23
25
|
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
|