@lifi/compose-spec 0.5.1 → 0.6.1
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 +2 -1
- package/dist/index.cjs +96 -30
- package/dist/index.d.cts +184 -58
- package/dist/index.d.ts +184 -58
- package/dist/index.js +90 -32
- package/package.json +1 -1
- package/src/chainCapabilities.ts +187 -38
- package/src/compile.ts +9 -3
- package/src/continuation.ts +65 -36
- package/src/descriptor.ts +13 -17
- package/src/index.ts +27 -8
- package/src/output.ts +67 -0
- package/src/preconditions.ts +4 -0
- package/src/resource.ts +0 -16
- package/src/route.ts +2 -2
- package/src/version.ts +23 -15
package/dist/index.d.cts
CHANGED
|
@@ -337,7 +337,7 @@ declare const CallCheckSpecSchema: Schema.Struct<{
|
|
|
337
337
|
comparator: Schema.Literal<["gte", "eq", "lte"]>;
|
|
338
338
|
value: typeof Schema.String;
|
|
339
339
|
}>;
|
|
340
|
-
declare const CheckSchema: Schema.
|
|
340
|
+
declare const CheckSchema: Schema.transformOrFail<Schema.Union<[Schema.Struct<{
|
|
341
341
|
kind: Schema.Literal<["erc20BalanceGte"]>;
|
|
342
342
|
chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
|
|
343
343
|
token: Schema.filter<typeof Schema.String>;
|
|
@@ -391,7 +391,7 @@ declare const CheckSchema: Schema.transform<Schema.Union<[Schema.Struct<{
|
|
|
391
391
|
readonly to: string;
|
|
392
392
|
readonly calldata: string;
|
|
393
393
|
readonly comparator: "gte" | "eq" | "lte";
|
|
394
|
-
}, never
|
|
394
|
+
}, never>, never>;
|
|
395
395
|
declare const Erc20BalanceDeltaGteSpecSchema: Schema.Struct<{
|
|
396
396
|
kind: Schema.Literal<["erc20BalanceDeltaGte"]>;
|
|
397
397
|
chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
|
|
@@ -491,7 +491,7 @@ declare const ContinuationPlanSchema: Schema.Struct<{
|
|
|
491
491
|
}]>>>;
|
|
492
492
|
}>>;
|
|
493
493
|
}>;
|
|
494
|
-
check: Schema.
|
|
494
|
+
check: Schema.transformOrFail<Schema.Union<[Schema.Struct<{
|
|
495
495
|
kind: Schema.Literal<["erc20BalanceGte"]>;
|
|
496
496
|
chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
|
|
497
497
|
token: Schema.filter<typeof Schema.String>;
|
|
@@ -545,7 +545,7 @@ declare const ContinuationPlanSchema: Schema.Struct<{
|
|
|
545
545
|
readonly to: string;
|
|
546
546
|
readonly calldata: string;
|
|
547
547
|
readonly comparator: "gte" | "eq" | "lte";
|
|
548
|
-
}, never
|
|
548
|
+
}, never>, never>;
|
|
549
549
|
validity: Schema.Struct<{
|
|
550
550
|
expiresAtMs: typeof Schema.Number;
|
|
551
551
|
}>;
|
|
@@ -557,6 +557,7 @@ type Phase1Artifact = typeof Phase1ArtifactSchema.Type;
|
|
|
557
557
|
type Check = typeof CheckSchema.Type;
|
|
558
558
|
type AssertionSpec = typeof AssertionSpecSchema.Type;
|
|
559
559
|
type ContinuationPlan = typeof ContinuationPlanSchema.Type;
|
|
560
|
+
declare const settledOutcome: (intent: ContinuationIntent) => ContinuationOutcome;
|
|
560
561
|
type CheckComparator = 'gte' | 'eq' | 'lte';
|
|
561
562
|
declare const isGTECheck: (check: Check) => boolean;
|
|
562
563
|
declare const isLTECheck: (check: Check) => boolean;
|
|
@@ -576,7 +577,7 @@ declare const AssertedNativeBalanceGteSpecSchema: Schema.Struct<{
|
|
|
576
577
|
owner: Schema.Union<[Schema.filter<typeof Schema.String>, Schema.Literal<["escrow", "delivery"]>]>;
|
|
577
578
|
minAmount: typeof Schema.String;
|
|
578
579
|
}>;
|
|
579
|
-
declare const AssertedPredicateSchema: Schema.
|
|
580
|
+
declare const AssertedPredicateSchema: Schema.transformOrFail<Schema.Union<[Schema.Struct<{
|
|
580
581
|
kind: Schema.Literal<["erc20BalanceGte"]>;
|
|
581
582
|
chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
|
|
582
583
|
token: Schema.filter<typeof Schema.String>;
|
|
@@ -663,11 +664,11 @@ declare const AssertedPredicateSchema: Schema.transform<Schema.Union<[Schema.Str
|
|
|
663
664
|
readonly chainId: number;
|
|
664
665
|
readonly minAmount: string;
|
|
665
666
|
readonly owner: string;
|
|
666
|
-
}, never
|
|
667
|
+
}, never>, never>;
|
|
667
668
|
declare const VerificationDescriptorSchema: Schema.Struct<{
|
|
668
669
|
validationProgramHash: Schema.filter<typeof Schema.String>;
|
|
669
670
|
paramsHash: Schema.filter<typeof Schema.String>;
|
|
670
|
-
assertedPredicate: Schema.Array$<Schema.
|
|
671
|
+
assertedPredicate: Schema.Array$<Schema.transformOrFail<Schema.Union<[Schema.Struct<{
|
|
671
672
|
kind: Schema.Literal<["erc20BalanceGte"]>;
|
|
672
673
|
chainId: Schema.filter<Schema.filter<typeof Schema.Number>>;
|
|
673
674
|
token: Schema.filter<typeof Schema.String>;
|
|
@@ -754,7 +755,7 @@ declare const VerificationDescriptorSchema: Schema.Struct<{
|
|
|
754
755
|
readonly chainId: number;
|
|
755
756
|
readonly minAmount: string;
|
|
756
757
|
readonly owner: string;
|
|
757
|
-
}, never
|
|
758
|
+
}, never>, never>>;
|
|
758
759
|
}>;
|
|
759
760
|
declare const canonicalAssertedPredicate: (specs: readonly AssertionSpec[]) => string;
|
|
760
761
|
type VerificationDescriptor = typeof VerificationDescriptorSchema.Type;
|
|
@@ -773,16 +774,6 @@ type Resource = {
|
|
|
773
774
|
readonly token: string;
|
|
774
775
|
readonly chainId: number;
|
|
775
776
|
};
|
|
776
|
-
type SimulatedAmounts = {
|
|
777
|
-
readonly amountOut: bigint;
|
|
778
|
-
readonly amountOutMin?: bigint;
|
|
779
|
-
};
|
|
780
|
-
type ProducedResource = Resource & {
|
|
781
|
-
readonly availability: Availability;
|
|
782
|
-
readonly simulated?: SimulatedAmounts;
|
|
783
|
-
readonly owner: string;
|
|
784
|
-
readonly etaSeconds?: number;
|
|
785
|
-
};
|
|
786
777
|
declare const erc20Resource: (token: string, chainId: number) => Resource;
|
|
787
778
|
declare const nativeResource: (chainId: number) => Resource;
|
|
788
779
|
declare const isERC20Resource: (r: Resource) => r is Extract<Resource, {
|
|
@@ -800,6 +791,43 @@ declare const resourceToken: (r: Resource) => string;
|
|
|
800
791
|
declare const resourceKey: (r: Resource) => string;
|
|
801
792
|
declare const erc20Token: (r: Resource) => string;
|
|
802
793
|
|
|
794
|
+
type EstimateBasis = 'simulated' | 'quoted';
|
|
795
|
+
type MinimumBasis = 'guard' | 'op' | 'declared';
|
|
796
|
+
interface Estimate {
|
|
797
|
+
readonly basis: EstimateBasis;
|
|
798
|
+
readonly value: bigint;
|
|
799
|
+
}
|
|
800
|
+
interface Minimum {
|
|
801
|
+
readonly basis: MinimumBasis;
|
|
802
|
+
readonly value: bigint;
|
|
803
|
+
}
|
|
804
|
+
interface Amount {
|
|
805
|
+
readonly estimate?: Estimate;
|
|
806
|
+
readonly minimum?: Minimum;
|
|
807
|
+
}
|
|
808
|
+
type Delivery = {
|
|
809
|
+
readonly when: 'now';
|
|
810
|
+
} | {
|
|
811
|
+
readonly when: 'future';
|
|
812
|
+
readonly etaSeconds?: number;
|
|
813
|
+
readonly provider?: string;
|
|
814
|
+
};
|
|
815
|
+
interface OutputBase {
|
|
816
|
+
readonly resource: Resource;
|
|
817
|
+
readonly amount: Amount;
|
|
818
|
+
}
|
|
819
|
+
interface ConsumedOutput extends OutputBase {
|
|
820
|
+
readonly role: 'consumed';
|
|
821
|
+
readonly consumedBy: string;
|
|
822
|
+
}
|
|
823
|
+
interface TerminalOutput extends OutputBase {
|
|
824
|
+
readonly role: 'terminal';
|
|
825
|
+
readonly owner: string;
|
|
826
|
+
readonly delivery: Delivery;
|
|
827
|
+
}
|
|
828
|
+
type Output = ConsumedOutput | TerminalOutput;
|
|
829
|
+
type Outputs = Record<string, Output>;
|
|
830
|
+
|
|
803
831
|
declare const ResourcePortZod: z.ZodObject<{
|
|
804
832
|
kind: z.ZodLiteral<"resource">;
|
|
805
833
|
name: z.ZodString;
|
|
@@ -1872,7 +1900,7 @@ interface ComposeFill {
|
|
|
1872
1900
|
readonly validUntilMs?: number;
|
|
1873
1901
|
}
|
|
1874
1902
|
interface ComposeCompileSuccessData extends ComposeContinuationData {
|
|
1875
|
-
readonly
|
|
1903
|
+
readonly outputs: Outputs;
|
|
1876
1904
|
readonly transactionRequest?: ComposeTransactionRequest;
|
|
1877
1905
|
readonly actions?: readonly ComposeAction[];
|
|
1878
1906
|
readonly userProxy: string;
|
|
@@ -1884,7 +1912,7 @@ interface ComposeCompileSuccessData extends ComposeContinuationData {
|
|
|
1884
1912
|
readonly verificationByNode?: Record<string, VerificationDescriptor>;
|
|
1885
1913
|
}
|
|
1886
1914
|
interface ComposeCompilePartialData extends ComposeContinuationData {
|
|
1887
|
-
readonly
|
|
1915
|
+
readonly outputs: Outputs;
|
|
1888
1916
|
readonly transactionRequest: ComposeTransactionRequest;
|
|
1889
1917
|
readonly userProxy: string;
|
|
1890
1918
|
readonly simulationRevert: SimulationRevert;
|
|
@@ -2083,15 +2111,26 @@ declare const refKey: (ref: Ref) => string;
|
|
|
2083
2111
|
* Per-chain native-asset semantics.
|
|
2084
2112
|
*
|
|
2085
2113
|
* Most EVM chains have an ETH-style native gas coin sent via `msg.value` (the
|
|
2086
|
-
* `evm-native` policy). A small number
|
|
2087
|
-
*
|
|
2088
|
-
*
|
|
2089
|
-
*
|
|
2114
|
+
* `evm-native` policy). A small number express their "native" coin as an
|
|
2115
|
+
* ERC-20 token: on `as-erc20` chains (Tempo) no `msg.value` coin exists at
|
|
2116
|
+
* all, while on `native-mirrored-erc20` chains (Arc) a real `msg.value` coin
|
|
2117
|
+
* exists but is canonically routed through an ERC-20 facade that mirrors the
|
|
2118
|
+
* native balance (`balanceOf == native wei / nativeScale`, with no balance
|
|
2119
|
+
* storage of its own). Code that needs to lower or simulate a `Resource` of
|
|
2120
|
+
* kind `"native"` should consult `getChainCapabilities(chainId)` rather than
|
|
2121
|
+
* hardcoding chain IDs.
|
|
2090
2122
|
*
|
|
2091
2123
|
* The compose compiler uses this registry to transparently normalise native
|
|
2092
|
-
* resources into ERC-20 resources on
|
|
2093
|
-
* (see `normalizeResource` below and the `ResourceSchema`
|
|
2094
|
-
* `flowSchema.ts`).
|
|
2124
|
+
* resources into ERC-20 resources on both ERC-20-canonical kinds at
|
|
2125
|
+
* schema-decode time (see `normalizeResource` below and the `ResourceSchema`
|
|
2126
|
+
* transform in `flowSchema.ts`).
|
|
2127
|
+
*
|
|
2128
|
+
* The two ERC-20-canonical kinds behave identically at the resource level —
|
|
2129
|
+
* `hasErc20CanonicalNative` is the predicate for that shared behaviour. They
|
|
2130
|
+
* diverge only at the simulation layer: `as-erc20` balances live in ordinary
|
|
2131
|
+
* token storage, while `native-mirrored-erc20` balances have no storage slot
|
|
2132
|
+
* and are satisfied by a native balance override scaled by `nativeScale`
|
|
2133
|
+
* (see compose-core's `rewritePreconditions`).
|
|
2095
2134
|
*
|
|
2096
2135
|
* This union is the extension point for future native-asset policies. A chain
|
|
2097
2136
|
* with no canonical native asset would get a `reject-native` arm, under which a
|
|
@@ -2105,6 +2144,12 @@ type ChainCapabilities = {
|
|
|
2105
2144
|
readonly kind: 'as-erc20';
|
|
2106
2145
|
readonly chainId: number;
|
|
2107
2146
|
readonly nativeErc20: NativeErc20;
|
|
2147
|
+
} | {
|
|
2148
|
+
readonly kind: 'native-mirrored-erc20';
|
|
2149
|
+
readonly chainId: number;
|
|
2150
|
+
readonly nativeErc20: NativeErc20;
|
|
2151
|
+
/** Native wei per 1 unit of the facade ERC-20 (1e12 on Arc: 18-dec native, 6-dec USDC). */
|
|
2152
|
+
readonly nativeScale: bigint;
|
|
2108
2153
|
};
|
|
2109
2154
|
interface NativeErc20 {
|
|
2110
2155
|
readonly token: `0x${string}`;
|
|
@@ -2123,21 +2168,93 @@ interface NativeErc20 {
|
|
|
2123
2168
|
declare const EVM_NATIVE_SENTINEL: `0x${string}`;
|
|
2124
2169
|
declare const TEMPO_CHAIN_ID = 4217;
|
|
2125
2170
|
declare const TEMPO_NATIVE_ERC20: NativeErc20;
|
|
2171
|
+
declare const ARC_CHAIN_ID = 5042;
|
|
2172
|
+
/**
|
|
2173
|
+
* Arc's native gas coin is USDC (18-decimal wei at the EVM level). The USDC
|
|
2174
|
+
* ERC-20 at this address is a view over native balances: `balanceOf` returns
|
|
2175
|
+
* `native wei / 1e12` and has no balance storage slot; allowances live in
|
|
2176
|
+
* regular storage. The composer interacts with USDC exclusively through this
|
|
2177
|
+
* facade, never via `msg.value`.
|
|
2178
|
+
*/
|
|
2179
|
+
declare const ARC_NATIVE_ERC20: NativeErc20;
|
|
2180
|
+
declare const ARC_NATIVE_SCALE: bigint;
|
|
2126
2181
|
declare const getChainCapabilities: (chainId: number) => ChainCapabilities;
|
|
2182
|
+
/**
|
|
2183
|
+
* Structural fold over the `ChainCapabilities` union — the capabilities
|
|
2184
|
+
* counterpart of `foldResource`/`foldRef`. Dispatches on `kind` and hands each
|
|
2185
|
+
* case its narrowed fields, so consumers that must branch on the native-asset
|
|
2186
|
+
* policy (e.g. compose-core's `rewritePreconditions`) do so through one
|
|
2187
|
+
* combinator whose exhaustiveness the compiler enforces: adding a new arm to
|
|
2188
|
+
* the union above turns every `foldChainCapabilities` call into a type error
|
|
2189
|
+
* until it handles the new case.
|
|
2190
|
+
*/
|
|
2191
|
+
declare const foldChainCapabilities: <R>(caps: ChainCapabilities, cases: {
|
|
2192
|
+
readonly evmNative: (chainId: number) => R;
|
|
2193
|
+
readonly asErc20: (nativeErc20: NativeErc20, chainId: number) => R;
|
|
2194
|
+
readonly nativeMirroredErc20: (nativeErc20: NativeErc20, nativeScale: bigint, chainId: number) => R;
|
|
2195
|
+
}) => R;
|
|
2196
|
+
/**
|
|
2197
|
+
* What a wire-level native-balance check (`nativeBalanceGte`) must become on
|
|
2198
|
+
* a chain, decided once here from the native-asset policy:
|
|
2199
|
+
*
|
|
2200
|
+
* - `keep` — `evm-native`: the native read is the right read.
|
|
2201
|
+
* - `rewrite` — `as-erc20` (Tempo): no `msg.value` coin exists, so the check
|
|
2202
|
+
* becomes an `erc20BalanceGte` of `token`, the stand-in ERC-20. Amounts were
|
|
2203
|
+
* always facade-denominated, so `minAmount` carries over verbatim.
|
|
2204
|
+
* - `reject` — `native-mirrored-erc20` (Arc): a native read returns real
|
|
2205
|
+
* 18-decimal wei, `nativeScale`× the facade's units, so no interpretation of
|
|
2206
|
+
* `minAmount` is safe — reusing it on a facade read is 1e12 too strict for a
|
|
2207
|
+
* wei-denominated check, keeping the native read lets a facade-denominated
|
|
2208
|
+
* check pass 1e12 too easily. The check must be authored as
|
|
2209
|
+
* `erc20BalanceGte` of the facade; `reason` says so.
|
|
2210
|
+
*
|
|
2211
|
+
* Consumers (the `CheckSchema` / `AssertedPredicateSchema` decodes and
|
|
2212
|
+
* compose-core's derive backstop) are adapters over this result, so the unit
|
|
2213
|
+
* rule lives in one place and the fold's exhaustiveness reaches every site.
|
|
2214
|
+
*/
|
|
2215
|
+
type NativeCheckPolicy = {
|
|
2216
|
+
readonly kind: 'keep';
|
|
2217
|
+
} | {
|
|
2218
|
+
readonly kind: 'rewrite';
|
|
2219
|
+
readonly token: `0x${string}`;
|
|
2220
|
+
} | {
|
|
2221
|
+
readonly kind: 'reject';
|
|
2222
|
+
readonly reason: string;
|
|
2223
|
+
};
|
|
2224
|
+
declare const nativeCheckPolicy: (chainId: number) => NativeCheckPolicy;
|
|
2225
|
+
/**
|
|
2226
|
+
* Exact-kind check for `as-erc20` (currently Tempo only) — the rare case that
|
|
2227
|
+
* genuinely means "no `msg.value` coin exists on this chain". Most consumers
|
|
2228
|
+
* want `hasErc20CanonicalNative` instead, which also covers
|
|
2229
|
+
* `native-mirrored-erc20` chains (Arc), where the composer's ERC-20-only
|
|
2230
|
+
* policy applies even though `msg.value` works. Code that must treat the two
|
|
2231
|
+
* ERC-20-native kinds differently goes through `foldChainCapabilities` or
|
|
2232
|
+
* `nativeCheckPolicy`, never a second exact-kind predicate.
|
|
2233
|
+
*/
|
|
2127
2234
|
declare const isAsErc20Chain: (chainId: number) => boolean;
|
|
2235
|
+
/**
|
|
2236
|
+
* Whether the chain's canonical native asset is an ERC-20 — true for both
|
|
2237
|
+
* `as-erc20` chains (Tempo: no `msg.value` coin exists) and
|
|
2238
|
+
* `native-mirrored-erc20` chains (Arc: `msg.value` exists but is never used).
|
|
2239
|
+
* This is the predicate for the shared resource-level behaviour: native
|
|
2240
|
+
* resources are rewritten to the ERC-20, native routing edges are dropped, and
|
|
2241
|
+
* a surviving native resource is a compile error.
|
|
2242
|
+
*/
|
|
2243
|
+
declare const hasErc20CanonicalNative: (chainId: number) => boolean;
|
|
2128
2244
|
/**
|
|
2129
2245
|
* The address that represents the chain's native asset.
|
|
2130
2246
|
*
|
|
2131
|
-
* On EVM-native chains this is the zero-address sentinel `0x0…0`. On
|
|
2132
|
-
*
|
|
2247
|
+
* On EVM-native chains this is the zero-address sentinel `0x0…0`. On chains
|
|
2248
|
+
* whose canonical native asset is an ERC-20 it is the chain's stand-in token
|
|
2249
|
+
* (PathUSD on Tempo, the USDC facade on Arc).
|
|
2133
2250
|
*/
|
|
2134
2251
|
declare const canonicalNativeAddress: (chainId: number) => `0x${string}`;
|
|
2135
2252
|
/**
|
|
2136
2253
|
* Whether `address` represents the native asset of `chainId`.
|
|
2137
2254
|
*
|
|
2138
2255
|
* On EVM-native chains, this is the case-insensitive zero-address check. On
|
|
2139
|
-
*
|
|
2140
|
-
* chain's stand-in ERC-20 address matches.
|
|
2256
|
+
* chains whose canonical native asset is an ERC-20, the literal zero address
|
|
2257
|
+
* returns `false` — only the chain's stand-in ERC-20 address matches.
|
|
2141
2258
|
*/
|
|
2142
2259
|
declare const isNativeAddressForChain: (chainId: number, address: string) => boolean;
|
|
2143
2260
|
/**
|
|
@@ -2147,28 +2264,30 @@ declare const isNativeAddressForChain: (chainId: number, address: string) => boo
|
|
|
2147
2264
|
* This is the single predicate that gates `msg.value` semantics — choosing a
|
|
2148
2265
|
* `NativeBalance` over an `Erc20Balance` simulation requirement, and skipping
|
|
2149
2266
|
* the ERC-20 approval a native input would otherwise need. It returns `false`
|
|
2150
|
-
* for every address on
|
|
2151
|
-
*
|
|
2152
|
-
* never `msg.value
|
|
2153
|
-
*
|
|
2154
|
-
*
|
|
2155
|
-
*
|
|
2156
|
-
* `
|
|
2267
|
+
* for every address on a chain whose canonical native asset is an ERC-20
|
|
2268
|
+
* (including the zero sentinel): on `as-erc20` chains the "native" coin is a
|
|
2269
|
+
* real ERC-20 moved via `transferFrom`, never `msg.value`, and on
|
|
2270
|
+
* `native-mirrored-erc20` chains `msg.value` works but the composer's policy
|
|
2271
|
+
* is to move the coin exclusively through the ERC-20 facade. Use this rather
|
|
2272
|
+
* than re-deriving the check at call sites, and rather than
|
|
2273
|
+
* `isNativeAddressForChain`, which returns `true` for the stand-in ERC-20
|
|
2274
|
+
* (PathUSD on Tempo) and would wrongly route it to `msg.value`.
|
|
2157
2275
|
*/
|
|
2158
2276
|
declare const isMsgValueNative: (chainId: number, address: string) => boolean;
|
|
2159
2277
|
/**
|
|
2160
2278
|
* Rewrite a single `Resource` according to its chain's capabilities.
|
|
2161
2279
|
*
|
|
2162
2280
|
* On chains with the default `evm-native` policy, every resource is returned
|
|
2163
|
-
* unchanged. On
|
|
2164
|
-
* resource of kind `"native"` is
|
|
2165
|
-
* resource pointing at the chain's
|
|
2281
|
+
* unchanged. On chains whose canonical native asset is an ERC-20 (`as-erc20`
|
|
2282
|
+
* Tempo, `native-mirrored-erc20` Arc), a resource of kind `"native"` is
|
|
2283
|
+
* rewritten into the equivalent ERC-20 resource pointing at the chain's
|
|
2284
|
+
* stand-in token (PathUSD on Tempo, the USDC facade on Arc).
|
|
2166
2285
|
*
|
|
2167
2286
|
* This is the rewrite primitive behind the `ResourceSchema` decode transform
|
|
2168
2287
|
* (see `flowSchema.ts`), which is THE chokepoint: it runs every time a
|
|
2169
2288
|
* `Resource` is parsed — flow inputs via `FlowSchema`, op configs via
|
|
2170
2289
|
* `decodeConfig` — so every downstream pass (`normalizeFlow`, `resolve`,
|
|
2171
|
-
* `lower`, `simulate`) sees only ERC-20 resources on
|
|
2290
|
+
* `lower`, `simulate`) sees only ERC-20 resources on those chains.
|
|
2172
2291
|
*
|
|
2173
2292
|
* The function preserves referential identity when nothing changes (returns the
|
|
2174
2293
|
* input `r` unchanged on evm-native chains and for ERC-20 resources) and is
|
|
@@ -2178,8 +2297,8 @@ declare const normalizeResource: (r: Resource) => Resource;
|
|
|
2178
2297
|
/**
|
|
2179
2298
|
* Address-level counterpart of `normalizeResource` for wire fields that carry a
|
|
2180
2299
|
* native asset as a bare token string (a continuation outcome's `token`). On
|
|
2181
|
-
*
|
|
2182
|
-
* ERC-20; every other address passes through.
|
|
2300
|
+
* chains whose canonical native asset is an ERC-20, the native sentinel is
|
|
2301
|
+
* rewritten to the chain's stand-in ERC-20; every other address passes through.
|
|
2183
2302
|
*/
|
|
2184
2303
|
declare const normalizeNativeTokenAddress: (token: string, chainId: number) => string;
|
|
2185
2304
|
|
|
@@ -2308,12 +2427,12 @@ interface ComposeRouteRequest {
|
|
|
2308
2427
|
readonly checkOnChainAllowances?: boolean;
|
|
2309
2428
|
/**
|
|
2310
2429
|
* Accept a route whose output is delivered only after the initiating
|
|
2311
|
-
* transaction settles (`
|
|
2430
|
+
* transaction settles (`delivery.when: 'future'` on the terminal output).
|
|
2312
2431
|
* Such a route obliges you to track settlement rather than treat the
|
|
2313
2432
|
* transaction as completing the job, and carries no slippage floor, so it is
|
|
2314
2433
|
* opt-in. Defaults to `false` server-side, which leaves a pair reachable
|
|
2315
2434
|
* only asynchronously rejected with `no_route_error` and guarantees every
|
|
2316
|
-
*
|
|
2435
|
+
* terminal output is `delivery.when: 'now'`.
|
|
2317
2436
|
*/
|
|
2318
2437
|
readonly allowAsyncRoutes?: boolean;
|
|
2319
2438
|
}
|
|
@@ -2348,6 +2467,7 @@ type Erc20AllowancePrecondition = {
|
|
|
2348
2467
|
declare const erc20Balance: (config: Omit<Erc20BalancePrecondition, "type">) => Erc20BalancePrecondition;
|
|
2349
2468
|
declare const nativeBalance: (config: Omit<NativeBalancePrecondition, "type">) => NativeBalancePrecondition;
|
|
2350
2469
|
declare const erc20Allowance: (config: Omit<Erc20AllowancePrecondition, "type">) => Erc20AllowancePrecondition;
|
|
2470
|
+
declare const isErc20BalancePrecondition: (p: Precondition) => p is Erc20BalancePrecondition;
|
|
2351
2471
|
declare const isErc20AllowancePrecondition: (p: Precondition) => p is Erc20AllowancePrecondition;
|
|
2352
2472
|
declare const isNativeBalancePrecondition: (p: Precondition) => p is NativeBalancePrecondition;
|
|
2353
2473
|
|
|
@@ -2537,19 +2657,25 @@ type VersionCompatibility = 'compatible' | 'sdk_outdated' | 'server_outdated';
|
|
|
2537
2657
|
declare const parseVersion: (version: string) => ComposeVersion | undefined;
|
|
2538
2658
|
/**
|
|
2539
2659
|
* Decides whether a client built against `client` may talk to a server that
|
|
2540
|
-
* serves `server`.
|
|
2660
|
+
* serves `server` and accepts clients down to `minimum`.
|
|
2661
|
+
*
|
|
2662
|
+
* - A client ahead of the server in any component is `server_outdated`. Even
|
|
2663
|
+
* a patch-ahead client may send a field the server has never seen, and the
|
|
2664
|
+
* guarantee must not depend on every server schema staying strict. This is
|
|
2665
|
+
* the rollout window between an npm publish and the prod image bump.
|
|
2666
|
+
* - A client below `minimum` is `sdk_outdated`: the server no longer serves
|
|
2667
|
+
* the contract that client speaks.
|
|
2668
|
+
* - Anything in between is compatible. Patch releases only add, so a client
|
|
2669
|
+
* at or behind the server's patch never emits anything the server lacks;
|
|
2670
|
+
* a client on an older minor is served because the server still emits the
|
|
2671
|
+
* shapes that minor reads.
|
|
2541
2672
|
*
|
|
2542
|
-
*
|
|
2543
|
-
*
|
|
2544
|
-
*
|
|
2545
|
-
*
|
|
2546
|
-
* made a breaking change the client does not know about.
|
|
2547
|
-
* - A client ahead in any component is `server_outdated`. Even a patch-ahead
|
|
2548
|
-
* client may send a field the server has never seen, and the guarantee must
|
|
2549
|
-
* not depend on every server schema staying strict. This is the rollout
|
|
2550
|
-
* window between an npm publish and the prod image bump.
|
|
2673
|
+
* `minimum` defaults to the server's own `major.minor.0`, which makes every
|
|
2674
|
+
* minor bump a hard cutover. The backend passes its explicit floor so a minor
|
|
2675
|
+
* bump can ship with the previous line still accepted; the SDK passes no floor
|
|
2676
|
+
* because the server, not the client, decides how far back it serves.
|
|
2551
2677
|
*/
|
|
2552
|
-
declare const checkCompatibility: (client: ComposeVersion, server: ComposeVersion) => VersionCompatibility;
|
|
2678
|
+
declare const checkCompatibility: (client: ComposeVersion, server: ComposeVersion, minimum?: ComposeVersion) => VersionCompatibility;
|
|
2553
2679
|
|
|
2554
2680
|
type MaterialiserMetadata = {
|
|
2555
2681
|
readonly kind: 'exact';
|
|
@@ -2570,4 +2696,4 @@ declare const foldMaterialiserMetadata: <R>(meta: MaterialiserMetadata, cases: {
|
|
|
2570
2696
|
readonly runtime: () => R;
|
|
2571
2697
|
}) => R;
|
|
2572
2698
|
|
|
2573
|
-
export { type AppliedGuard, AppliedGuardSchema, type ApprovalEntry, AssertedErc20BalanceGteSpecSchema, AssertedNativeBalanceGteSpecSchema, type AssertedPredicate, AssertedPredicateSchema, type AssertedPredicateWire, AssertedPredicateZod, type AssertionOwner, AssertionOwnerSchema, type AssertionSpec, AssertionSpecSchema, type AssertionSpecWire, AssertionSpecZod, type Availability, type BindValue, BindValueSchema, Bytes32HexSchema, COMPOSER_SDK_VERSION_HEADER, COMPOSE_VERSION_HEADER, CONTINUATION_COMMITMENT_OP_ID, type Call, CallCheckSpecSchema, CallSchema, type ChainCapabilities, type Check, type CheckComparator, CheckSchema, CheckZod, type ComposeAction, type ComposeCompilePartialData, type ComposeCompileRequest, type ComposeCompileResult, type ComposeCompileSuccessData, type ComposeError, type ComposeErrorKind, type ComposeFee, type ComposeFill, type ComposeManifest, ComposeManifestZod, type ComposeRouteErrorKind, type ComposeRouteRequest, type ComposeRun, type ComposeTransactionRequest, type ComposeUserProgramSimulation, type ComposeVersion, type ContextKey, type ContinuationIntent, ContinuationIntentSchema, type ContinuationOutcome, ContinuationOutcomeSchema, type ContinuationPlan, ContinuationPlanSchema, type ContinuationPlanWire, ContinuationPlanZod, EVM_NATIVE_SENTINEL, type Erc20AllowancePrecondition, type Erc20AllowanceRequirement, Erc20BalanceDeltaGteSpecSchema, Erc20BalanceGteSpecSchema, type Erc20BalancePrecondition, type Erc20BalanceRequirement, type FailedPreparedOp, type FlashloanMaterialiserInput, type Flow, type FlowInput, FlowInputSchema, FlowSchema, type GenericComposeError, type GenericComposeErrorKind, type GuardCompatibility, GuardCompatibilityZod, type GuardSelector, GuardSelectorZod, HANDLE_UNITS, type HandleInput, HandleInputSchema, type HandlePort, HandlePortZod, type HandleUnits, HandleUnitsZod, HexStringSchema, InputPortZod, type InputSpec, type LiteralBinding, LiteralBindingSchema, type ManifestGuard, ManifestGuardZod, type ManifestMaterialiser, ManifestMaterialiserZod, type ManifestOperation, ManifestOperationZod, type ManifestPrecondition, ManifestPreconditionZod, type MaterialiserConfigOf, type MaterialiserInput, type MaterialiserInputBase, type MaterialiserInputOf, type MaterialiserMetadata, type MaterialiserResolution, NativeBalanceDeltaGteSpecSchema, NativeBalanceGteSpecSchema, type NativeBalancePrecondition, type NativeBalanceRequirement, type NativeErc20, type OpInputPort, type OpOutputPort, type OutputAmount, OutputPortZod, PROVIDER_KIND, type ParsedRef, type Phase1Artifact, Phase1ArtifactSchema, type Phase1ArtifactWire, Phase1ArtifactZod, type Port, type Precondition, type PreconditionBase, type PreconditionConfigOf, type PreconditionOf, type PreparationComposeError, type PriceImpact, type
|
|
2699
|
+
export { ARC_CHAIN_ID, ARC_NATIVE_ERC20, ARC_NATIVE_SCALE, type Amount, type AppliedGuard, AppliedGuardSchema, type ApprovalEntry, AssertedErc20BalanceGteSpecSchema, AssertedNativeBalanceGteSpecSchema, type AssertedPredicate, AssertedPredicateSchema, type AssertedPredicateWire, AssertedPredicateZod, type AssertionOwner, AssertionOwnerSchema, type AssertionSpec, AssertionSpecSchema, type AssertionSpecWire, AssertionSpecZod, type Availability, type BindValue, BindValueSchema, Bytes32HexSchema, COMPOSER_SDK_VERSION_HEADER, COMPOSE_VERSION_HEADER, CONTINUATION_COMMITMENT_OP_ID, type Call, CallCheckSpecSchema, CallSchema, type ChainCapabilities, type Check, type CheckComparator, CheckSchema, CheckZod, type ComposeAction, type ComposeCompilePartialData, type ComposeCompileRequest, type ComposeCompileResult, type ComposeCompileSuccessData, type ComposeError, type ComposeErrorKind, type ComposeFee, type ComposeFill, type ComposeManifest, ComposeManifestZod, type ComposeRouteErrorKind, type ComposeRouteRequest, type ComposeRun, type ComposeTransactionRequest, type ComposeUserProgramSimulation, type ComposeVersion, type ConsumedOutput, type ContextKey, type ContinuationIntent, ContinuationIntentSchema, type ContinuationOutcome, ContinuationOutcomeSchema, type ContinuationPlan, ContinuationPlanSchema, type ContinuationPlanWire, ContinuationPlanZod, type Delivery, EVM_NATIVE_SENTINEL, type Erc20AllowancePrecondition, type Erc20AllowanceRequirement, Erc20BalanceDeltaGteSpecSchema, Erc20BalanceGteSpecSchema, type Erc20BalancePrecondition, type Erc20BalanceRequirement, type Estimate, type EstimateBasis, type FailedPreparedOp, type FlashloanMaterialiserInput, type Flow, type FlowInput, FlowInputSchema, FlowSchema, type GenericComposeError, type GenericComposeErrorKind, type GuardCompatibility, GuardCompatibilityZod, type GuardSelector, GuardSelectorZod, HANDLE_UNITS, type HandleInput, HandleInputSchema, type HandlePort, HandlePortZod, type HandleUnits, HandleUnitsZod, HexStringSchema, InputPortZod, type InputSpec, type LiteralBinding, LiteralBindingSchema, type ManifestGuard, ManifestGuardZod, type ManifestMaterialiser, ManifestMaterialiserZod, type ManifestOperation, ManifestOperationZod, type ManifestPrecondition, ManifestPreconditionZod, type MaterialiserConfigOf, type MaterialiserInput, type MaterialiserInputBase, type MaterialiserInputOf, type MaterialiserMetadata, type MaterialiserResolution, type Minimum, type MinimumBasis, NativeBalanceDeltaGteSpecSchema, NativeBalanceGteSpecSchema, type NativeBalancePrecondition, type NativeBalanceRequirement, type NativeCheckPolicy, type NativeErc20, type OpInputPort, type OpOutputPort, type Output, type OutputAmount, OutputPortZod, type Outputs, PROVIDER_KIND, type ParsedRef, type Phase1Artifact, Phase1ArtifactSchema, type Phase1ArtifactWire, Phase1ArtifactZod, type Port, type Precondition, type PreconditionBase, type PreconditionConfigOf, type PreconditionOf, type PreparationComposeError, type PriceImpact, type ProviderKindName, RESERVED_REF_SCOPES, type Ref, type RefBuilder, type RefPath, RefSchema, type RefScope, type Resource, type ResourceInput, ResourceInputSchema, type ResourceOutputPort, ResourceOutputPortZod, type ResourcePort, ResourcePortZod, ResourceSchema, type RouteAmount, type RouteAmountAll, type RouteAmountExact, SIMULATE_MAX_REQUIREMENTS, SIMULATE_MAX_TRACKED_BALANCES, STATIC_SOL_TYPES, type SimulateBalanceEntry, type SimulateOkResult, type SimulateRequest, type SimulateResult, type SimulateRevertDecodeResult, type SimulateRevertResult, type SimulateSetupErrorResult, type SimulationPolicy, type SimulationRevert, type SimulationRevertComposeError, type SlotFinderRequirement, type SolType, SolTypeSchema, type SpendEntry, type StaticSolType, StaticSolTypeZod, type SweepTo, TEMPO_CHAIN_ID, TEMPO_NATIVE_ERC20, type TerminalOutput, type TrackedBalance, type VerificationDescriptor, VerificationDescriptorSchema, type VerificationDescriptorWire, VerificationDescriptorZod, type VersionCompatibility, canonicalAssertedPredicate, canonicalNativeAddress, checkCompatibility, copy, erc20, erc20Allowance, erc20Balance, erc20Resource, erc20Token, flowInputMode, flowInputResource, flowInputType, foldChainCapabilities, foldMaterialiserMetadata, foldRef, foldResource, getChainCapabilities, handle, hasErc20CanonicalNative, isAsErc20Chain, isContextKey, isEQCheck, isERC20Resource, isErc20AllowancePrecondition, isErc20BalancePrecondition, isFutureResourceOutput, isGTECheck, isHandlePort, isLTECheck, isMaterialiserInput, isMsgValueNative, isNativeAddressForChain, isNativeBalancePrecondition, isNativeResource, 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 };
|