@glacislabs/stablegenie-zerodelta 3.3.0 → 4.0.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/{chunk-QKGRMRS4.js → chunk-ABI6ZH7O.js} +547 -76
- package/dist/{chunk-OOURZ5DL.js → chunk-FJQQLB2K.js} +795 -63
- package/dist/core/index.cjs +841 -62
- package/dist/core/index.d.cts +103 -7
- package/dist/core/index.d.ts +103 -7
- package/dist/core/index.js +1 -1
- package/dist/index.cjs +1357 -145
- package/dist/index.d.cts +23 -4
- package/dist/index.d.ts +23 -4
- package/dist/index.js +2 -2
- package/dist/{mount-DNvmtX0y.d.cts → mount-D5k_u92L.d.ts} +46 -6
- package/dist/{mount-jxrT-DMe.d.ts → mount-mcyZAzZc.d.cts} +46 -6
- package/dist/mount.cjs +1322 -145
- package/dist/mount.d.cts +2 -2
- package/dist/mount.d.ts +2 -2
- package/dist/mount.js +2 -2
- package/dist/standalone.global.js +106 -9
- package/dist/verify-C9vzpm4T.d.cts +855 -0
- package/dist/verify-C9vzpm4T.d.ts +855 -0
- package/package.json +1 -1
- package/dist/verify-7lk90Ado.d.cts +0 -367
- package/dist/verify-7lk90Ado.d.ts +0 -367
package/dist/core/index.cjs
CHANGED
|
@@ -3,8 +3,29 @@
|
|
|
3
3
|
// src/core/constants.ts
|
|
4
4
|
var DEFAULT_WIDGET_API_BASE = "/api/widget/v1";
|
|
5
5
|
var SUPPORTED_CHAIN_IDS = /* @__PURE__ */ new Set([1, 10, 42161, 8453, 57073, 130, 9745, 146, 98866]);
|
|
6
|
-
var
|
|
6
|
+
var EXECUTABLE_STABLE_ASSETS = /* @__PURE__ */ new Set(["USDC", "USDT", "USDE", "USDTB", "AUSD", "PYUSD", "USDG"]);
|
|
7
|
+
var STABLE_ASSETS = /* @__PURE__ */ new Set([...EXECUTABLE_STABLE_ASSETS, "USD1", "WM", "USDS", "DAI", "RLUSD"]);
|
|
8
|
+
var TRADEABLE_RWA_ASSETS = /* @__PURE__ */ new Set([
|
|
9
|
+
"XAUT",
|
|
10
|
+
// Nest vault shares — chained delivery on Plume, sellable from their Ethereum deployment.
|
|
11
|
+
"NALPHA",
|
|
12
|
+
"NTBILL",
|
|
13
|
+
"NBASIS",
|
|
14
|
+
"NCREDIT",
|
|
15
|
+
"NOPAL",
|
|
16
|
+
"NWISDOM",
|
|
17
|
+
"NACRDX",
|
|
18
|
+
"NLCRD",
|
|
19
|
+
"NAXI",
|
|
20
|
+
"NCLOA",
|
|
21
|
+
"NFALCON",
|
|
22
|
+
// Centrifuge deRWA pair — chained asks on Base.
|
|
23
|
+
"DEJAAA",
|
|
24
|
+
"DESPXA"
|
|
25
|
+
]);
|
|
26
|
+
var SUPPORTED_ASSETS = /* @__PURE__ */ new Set([...STABLE_ASSETS, ...TRADEABLE_RWA_ASSETS]);
|
|
7
27
|
var API_CACHE_TTL_MS = 6e4;
|
|
28
|
+
var SCREEN_CACHE_TTL_MS = 5 * 6e4;
|
|
8
29
|
var MAX_QUOTE_CANDIDATES = 8;
|
|
9
30
|
var QUOTE_BUFFER_BPS = 50;
|
|
10
31
|
var LZ_FEE_BUFFER_BPS = 1500n;
|
|
@@ -16,7 +37,41 @@ var ERC20_ALLOWANCE_SELECTOR = "0xdd62ed3e";
|
|
|
16
37
|
var ERC20_BALANCEOF_SELECTOR = "0x70a08231";
|
|
17
38
|
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
18
39
|
var PREVIEW_OWNER = "0x1111111111111111111111111111111111111111";
|
|
19
|
-
var CANONICAL_DECIMALS = {
|
|
40
|
+
var CANONICAL_DECIMALS = {
|
|
41
|
+
USDC: 6,
|
|
42
|
+
USDT: 6,
|
|
43
|
+
USDE: 18,
|
|
44
|
+
XAUT: 6,
|
|
45
|
+
// Added 2026-09-08 with the dapp-parity asset expansion. Every value below was read from the
|
|
46
|
+
// token contract itself — `eth_call decimals()` against each deployment the registry lists on the
|
|
47
|
+
// nine escrow chains — and each symbol answered the SAME number on every chain it is deployed on.
|
|
48
|
+
// The set is a deliberate mix of 6 and 18, and a copy-pasted row is wrong by a factor of 1e12
|
|
49
|
+
// while still looking entirely plausible in review; that is the bug this pin exists to prevent.
|
|
50
|
+
USDTB: 18,
|
|
51
|
+
AUSD: 6,
|
|
52
|
+
PYUSD: 6,
|
|
53
|
+
USDG: 6,
|
|
54
|
+
// The wider stable list — the bid side of an RWA trade.
|
|
55
|
+
DAI: 18,
|
|
56
|
+
RLUSD: 18,
|
|
57
|
+
USD1: 18,
|
|
58
|
+
USDS: 18,
|
|
59
|
+
WM: 6,
|
|
60
|
+
// Real-world assets. Every Nest vault share is 6; the Centrifuge pair is 18.
|
|
61
|
+
NALPHA: 6,
|
|
62
|
+
NTBILL: 6,
|
|
63
|
+
NBASIS: 6,
|
|
64
|
+
NCREDIT: 6,
|
|
65
|
+
NOPAL: 6,
|
|
66
|
+
NWISDOM: 6,
|
|
67
|
+
NACRDX: 6,
|
|
68
|
+
NLCRD: 6,
|
|
69
|
+
NAXI: 6,
|
|
70
|
+
NCLOA: 6,
|
|
71
|
+
NFALCON: 6,
|
|
72
|
+
DEJAAA: 18,
|
|
73
|
+
DESPXA: 18
|
|
74
|
+
};
|
|
20
75
|
var CANONICAL_ESCROW = Object.freeze({
|
|
21
76
|
1: "0x5e25c8ABc19b88d6A7Ab0D805C77A34987a68b40",
|
|
22
77
|
// Ethereum
|
|
@@ -46,9 +101,40 @@ var CANONICAL_INBOUND_BRIDGE = {
|
|
|
46
101
|
USDC: "cctp",
|
|
47
102
|
USDT: "layerzero",
|
|
48
103
|
USDE: "layerzero",
|
|
49
|
-
XAUT: "layerzero"
|
|
104
|
+
XAUT: "layerzero",
|
|
105
|
+
// 2026-09-08: the four assets added for dapp parity are all LayerZero V2 OFTs on every chain the
|
|
106
|
+
// registry lists them on (`standard: "LayerZeroV2OFT"`, verified against dev and prod /tokens).
|
|
107
|
+
// USDC remains the only CCTP asset.
|
|
108
|
+
USDTB: "layerzero",
|
|
109
|
+
AUSD: "layerzero",
|
|
110
|
+
PYUSD: "layerzero",
|
|
111
|
+
USDG: "layerzero",
|
|
112
|
+
// `"none"` is a POSITIVE statement, not a gap: these assets have no inbound bridge adapter at all
|
|
113
|
+
// (the registry says `bridge: "None"`, or ships no bridge field at all), so they can only ever be
|
|
114
|
+
// bid on the chain the order already executes on and can never legitimately owe a native
|
|
115
|
+
// LayerZero fee. Pinning them matters because the fallback for an UNpinned asset is the label
|
|
116
|
+
// sniff, and a hostile quote controls the label — `bridge: "layerzero"` on one of these would
|
|
117
|
+
// otherwise let it attach msg.value to an order that forwards none, stranding it in the escrow.
|
|
118
|
+
DAI: "none",
|
|
119
|
+
RLUSD: "none",
|
|
120
|
+
USD1: "none",
|
|
121
|
+
USDS: "none",
|
|
122
|
+
WM: "none",
|
|
123
|
+
NALPHA: "none",
|
|
124
|
+
NTBILL: "none",
|
|
125
|
+
NBASIS: "none",
|
|
126
|
+
NCREDIT: "none",
|
|
127
|
+
NOPAL: "none",
|
|
128
|
+
NWISDOM: "none",
|
|
129
|
+
NACRDX: "none",
|
|
130
|
+
NLCRD: "none",
|
|
131
|
+
NAXI: "none",
|
|
132
|
+
NCLOA: "none",
|
|
133
|
+
NFALCON: "none",
|
|
134
|
+
DEJAAA: "none",
|
|
135
|
+
DESPXA: "none"
|
|
50
136
|
};
|
|
51
|
-
var SAME_CLASS_STABLE =
|
|
137
|
+
var SAME_CLASS_STABLE = new Set(STABLE_ASSETS);
|
|
52
138
|
var MAX_SAME_CLASS_PAY_BPS = 30000n;
|
|
53
139
|
var BUNDLED_NATIVE_SYMBOL = {
|
|
54
140
|
1: "ETH",
|
|
@@ -71,6 +157,55 @@ var BUNDLED_RPC = {
|
|
|
71
157
|
42161: "https://arb1.arbitrum.io/rpc",
|
|
72
158
|
98866: "https://rpc.plume.org"
|
|
73
159
|
};
|
|
160
|
+
var CHAIN_DISPLAY_NAMES = Object.freeze({
|
|
161
|
+
1: "Ethereum",
|
|
162
|
+
10: "Optimism",
|
|
163
|
+
14: "Flare",
|
|
164
|
+
30: "Rootstock",
|
|
165
|
+
50: "XDC Network",
|
|
166
|
+
56: "BNB Chain",
|
|
167
|
+
88: "Viction",
|
|
168
|
+
130: "Unichain",
|
|
169
|
+
137: "Polygon",
|
|
170
|
+
143: "Monad",
|
|
171
|
+
146: "Sonic",
|
|
172
|
+
151: "Redbelly Network",
|
|
173
|
+
169: "Manta Pacific",
|
|
174
|
+
196: "X Layer",
|
|
175
|
+
252: "Fraxtal",
|
|
176
|
+
324: "zkSync Era",
|
|
177
|
+
480: "World Chain",
|
|
178
|
+
988: "Stable",
|
|
179
|
+
999: "HyperEVM",
|
|
180
|
+
1030: "Conflux eSpace",
|
|
181
|
+
1088: "Metis",
|
|
182
|
+
1135: "Lisk",
|
|
183
|
+
1329: "Sei",
|
|
184
|
+
1776: "Injective EVM",
|
|
185
|
+
1868: "Soneium",
|
|
186
|
+
1923: "Swellchain",
|
|
187
|
+
2222: "Kava",
|
|
188
|
+
2818: "Morph",
|
|
189
|
+
3343: "EDGE",
|
|
190
|
+
4326: "MegaETH",
|
|
191
|
+
5e3: "Mantle",
|
|
192
|
+
8453: "Base",
|
|
193
|
+
9745: "Plasma",
|
|
194
|
+
34443: "Mode",
|
|
195
|
+
42161: "Arbitrum One",
|
|
196
|
+
43114: "Avalanche C-Chain",
|
|
197
|
+
48900: "Zircuit",
|
|
198
|
+
57073: "Ink",
|
|
199
|
+
59144: "Linea",
|
|
200
|
+
80094: "Berachain",
|
|
201
|
+
81224: "Codex",
|
|
202
|
+
81457: "Blast",
|
|
203
|
+
98866: "Plume",
|
|
204
|
+
534352: "Scroll",
|
|
205
|
+
747474: "Katana",
|
|
206
|
+
7777777: "Zora",
|
|
207
|
+
21e6: "Corn"
|
|
208
|
+
});
|
|
74
209
|
|
|
75
210
|
// src/core/address.ts
|
|
76
211
|
function symbolKey(value) {
|
|
@@ -335,10 +470,129 @@ function applyLayerZeroBuffer(quote, option = {}) {
|
|
|
335
470
|
return gas * (10000n + LZ_FEE_BUFFER_BPS) / 10000n;
|
|
336
471
|
}
|
|
337
472
|
|
|
473
|
+
// src/core/availability.ts
|
|
474
|
+
function assetClassOf(symbol) {
|
|
475
|
+
const key = symbolKey(symbol);
|
|
476
|
+
if (TRADEABLE_RWA_ASSETS.has(key)) return "rwa";
|
|
477
|
+
if (STABLE_ASSETS.has(key)) return "stable";
|
|
478
|
+
return null;
|
|
479
|
+
}
|
|
480
|
+
function productAssets(product) {
|
|
481
|
+
return product === "rwa" ? /* @__PURE__ */ new Set([...STABLE_ASSETS, ...TRADEABLE_RWA_ASSETS]) : EXECUTABLE_STABLE_ASSETS;
|
|
482
|
+
}
|
|
483
|
+
function counterpartTokens(tokens, selected) {
|
|
484
|
+
const want = assetClassOf(selected?.symbol) === "rwa" ? "stable" : "rwa";
|
|
485
|
+
return tokens.filter((token) => assetClassOf(token.symbol) === want);
|
|
486
|
+
}
|
|
487
|
+
function tokenKey(chainId, address) {
|
|
488
|
+
return `${Number(chainId)}:${String(address || "").toLowerCase()}`;
|
|
489
|
+
}
|
|
490
|
+
function laneKey(fromChainId, fromAddress, toChainId, toAddress) {
|
|
491
|
+
return `${tokenKey(fromChainId, fromAddress)}>${tokenKey(toChainId, toAddress)}`;
|
|
492
|
+
}
|
|
493
|
+
function isExecutableBridge(descriptor) {
|
|
494
|
+
const bridge = descriptor?.bridge?.trim().toLowerCase();
|
|
495
|
+
const standard = descriptor?.standard?.replace(/[\s_-]/g, "").toLowerCase();
|
|
496
|
+
return (bridge === "circle" || bridge === "cctp") && standard === "cctpv2" || bridge === "layerzero" && standard === "layerzerov2oft";
|
|
497
|
+
}
|
|
498
|
+
function isKnownUnbridgeable(bridge) {
|
|
499
|
+
return typeof bridge === "string" && bridge.trim().toLowerCase() === "none";
|
|
500
|
+
}
|
|
501
|
+
function executableRoutes(routes) {
|
|
502
|
+
return routes.filter((route) => route.isEnabled !== false && isExecutableBridge(route));
|
|
503
|
+
}
|
|
504
|
+
function sourceKeys(routes) {
|
|
505
|
+
return new Set(routes.filter((r) => r.isEnabled !== false).map((r) => tokenKey(r.fromChainId, r.fromAddress ?? "")));
|
|
506
|
+
}
|
|
507
|
+
function destinationKeys(routes) {
|
|
508
|
+
return new Set(routes.filter((r) => r.isEnabled !== false).map((r) => tokenKey(r.toChainId, r.toAddress ?? "")));
|
|
509
|
+
}
|
|
510
|
+
function laneKeys(routes) {
|
|
511
|
+
return new Set(routes.filter((r) => r.isEnabled !== false).map((r) => laneKey(r.fromChainId, r.fromAddress ?? "", r.toChainId, r.toAddress ?? "")));
|
|
512
|
+
}
|
|
513
|
+
function executionChainIds(chains) {
|
|
514
|
+
return new Set(chains.filter((c) => c.isEnabled !== false && c.isExecutionChain === true).map((c) => Number(c.chainId)));
|
|
515
|
+
}
|
|
516
|
+
function hubDeliverableSymbols(tokens, execution) {
|
|
517
|
+
return new Set(tokens.filter((t) => execution.has(Number(t.chainId))).map((t) => symbolKey(t.symbol)));
|
|
518
|
+
}
|
|
519
|
+
function isSourceToken(token, ctx) {
|
|
520
|
+
const chainId = Number(token.chainId);
|
|
521
|
+
if (!ctx.sourceChains.has(chainId)) return false;
|
|
522
|
+
return ctx.execution.has(chainId) || !isKnownUnbridgeable(token.bridge) && ctx.source.has(tokenKey(chainId, token.address));
|
|
523
|
+
}
|
|
524
|
+
function directLaneOK(token, source, lanes) {
|
|
525
|
+
if (!source || !lanes) return true;
|
|
526
|
+
if (symbolKey(source.symbol) !== symbolKey(token.symbol)) return true;
|
|
527
|
+
if (Number(source.chainId) === Number(token.chainId)) return true;
|
|
528
|
+
return lanes.has(laneKey(source.chainId, source.address, token.chainId, token.address));
|
|
529
|
+
}
|
|
530
|
+
function brokenLaneFor(token, source, brokenLanes) {
|
|
531
|
+
if (!source || !brokenLanes) return void 0;
|
|
532
|
+
return brokenLanes.get(laneKey(source.chainId, source.address, token.chainId, token.address));
|
|
533
|
+
}
|
|
534
|
+
function destinationAvailability(token, ctx, source) {
|
|
535
|
+
if (brokenLaneFor(token, source ?? void 0, ctx.brokenLanes)) return "unreachable";
|
|
536
|
+
if (ctx.execution.has(Number(token.chainId))) return "available";
|
|
537
|
+
if (token.isChainedDestination === true) return "available";
|
|
538
|
+
if (!isKnownUnbridgeable(token.bridge) && ctx.destination.has(tokenKey(token.chainId, token.address)) && directLaneOK(token, source ?? void 0, ctx.lanes)) {
|
|
539
|
+
return "available";
|
|
540
|
+
}
|
|
541
|
+
return ctx.hubSymbols.has(symbolKey(token.symbol)) ? "hub-only" : "unreachable";
|
|
542
|
+
}
|
|
543
|
+
function hasReachableDestination(source, catalogue, ctx) {
|
|
544
|
+
if (catalogue.length === 0) return true;
|
|
545
|
+
const from = tokenKey(source.chainId, source.address);
|
|
546
|
+
for (const candidate of catalogue) {
|
|
547
|
+
if (tokenKey(candidate.chainId, candidate.address) === from) continue;
|
|
548
|
+
if (destinationAvailability(candidate, ctx, source) === "available") return true;
|
|
549
|
+
}
|
|
550
|
+
return false;
|
|
551
|
+
}
|
|
552
|
+
function buildCatalogue(input) {
|
|
553
|
+
const { chains, tokens, routes, supportedChainIds, brokenLanes } = input;
|
|
554
|
+
const product = input.product ?? "stable";
|
|
555
|
+
const universe = productAssets(product);
|
|
556
|
+
const allowedAssets = input.allowedAssets ? new Set([...input.allowedAssets].filter((a) => universe.has(a))) : universe;
|
|
557
|
+
const enabledChains = chains.filter((c) => c.isEnabled !== false);
|
|
558
|
+
const registryChainIds = new Set(enabledChains.map((c) => Number(c.chainId)));
|
|
559
|
+
const sourceChains = new Set([...registryChainIds].filter((id) => supportedChainIds.has(id)));
|
|
560
|
+
const execution = executionChainIds(enabledChains);
|
|
561
|
+
const projected = product === "rwa" ? routes.filter((route) => route.isEnabled !== false) : executableRoutes(routes);
|
|
562
|
+
const source = sourceKeys(projected);
|
|
563
|
+
const destination = destinationKeys(projected);
|
|
564
|
+
const lanes = laneKeys(projected);
|
|
565
|
+
const chainIds = new Set(sourceChains);
|
|
566
|
+
for (const route of projected) {
|
|
567
|
+
const id = Number(route.toChainId);
|
|
568
|
+
if (Number.isSafeInteger(id) && id > 0) chainIds.add(id);
|
|
569
|
+
}
|
|
570
|
+
const allowed = tokens.filter((token) => token.isEnabled !== false && allowedAssets.has(symbolKey(token.symbol)));
|
|
571
|
+
const projectedCatalogue = allowed.filter((token) => {
|
|
572
|
+
if (!chainIds.has(Number(token.chainId))) return false;
|
|
573
|
+
if (product === "rwa") return true;
|
|
574
|
+
if (!isExecutableBridge(token)) return false;
|
|
575
|
+
const key = tokenKey(token.chainId, token.address);
|
|
576
|
+
return source.has(key) || destination.has(key) || execution.has(Number(token.chainId));
|
|
577
|
+
});
|
|
578
|
+
const ready = chains.length > 0 && routes.length > 0 && projectedCatalogue.length > 0;
|
|
579
|
+
const catalogue = ready ? projectedCatalogue : allowed;
|
|
580
|
+
const hubSymbols = hubDeliverableSymbols(catalogue, execution);
|
|
581
|
+
const ctx = { source, destination, lanes, execution, sourceChains, hubSymbols, ...brokenLanes ? { brokenLanes } : {} };
|
|
582
|
+
const sources = ready ? catalogue.filter((token) => isSourceToken(token, ctx) && hasReachableDestination(token, catalogue, ctx)) : (
|
|
583
|
+
// Unprojected: the only rule we can still apply with confidence is the escrow-chain bound,
|
|
584
|
+
// which comes from this build's own pins rather than from the registry.
|
|
585
|
+
catalogue.filter((token) => sourceChains.has(Number(token.chainId)))
|
|
586
|
+
);
|
|
587
|
+
const byId = new Map(enabledChains.map((c) => [Number(c.chainId), c]));
|
|
588
|
+
for (const id of chainIds) if (!byId.has(id)) byId.set(id, { chainId: id, isEnabled: true });
|
|
589
|
+
return { ...ctx, product, tokens: catalogue, sources, chainIds, chains: [...byId.values()], ready };
|
|
590
|
+
}
|
|
591
|
+
|
|
338
592
|
// src/core/options.ts
|
|
339
593
|
function chainNameOf(chainId, chains) {
|
|
340
594
|
const chain = chains.find((item) => Number(item.chainId) === Number(chainId));
|
|
341
|
-
return chain?.displayName || chain?.name || `Chain ${chainId}`;
|
|
595
|
+
return chain?.displayName || chain?.name || CHAIN_DISPLAY_NAMES[Number(chainId)] || `Chain ${chainId}`;
|
|
342
596
|
}
|
|
343
597
|
function chainById(chains, chainId) {
|
|
344
598
|
return chains.find((chain) => Number(chain.chainId) === Number(chainId)) || null;
|
|
@@ -359,45 +613,57 @@ function findToken(tokens, chainId, symbol) {
|
|
|
359
613
|
const key = symbolKey(symbol);
|
|
360
614
|
return tokens.find((token) => tokenEnabled(token) && Number(token.chainId) === Number(chainId) && symbolKey(token.symbol) === key) || null;
|
|
361
615
|
}
|
|
362
|
-
function buildPayOptions({ invoiceAsset, invoiceChainId, tokens, routes, chains, walletChainId }) {
|
|
616
|
+
function buildPayOptions({ invoiceAsset, invoiceChainId, tokens, routes, chains, walletChainId, catalogue }) {
|
|
363
617
|
const invoiceKey = symbolKey(invoiceAsset);
|
|
364
|
-
const
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
const key = symbolKey(token.symbol);
|
|
368
|
-
if (!tokenBySymbolAndChain.has(key)) tokenBySymbolAndChain.set(key, /* @__PURE__ */ new Map());
|
|
369
|
-
tokenBySymbolAndChain.get(key).set(Number(token.chainId), token);
|
|
370
|
-
}
|
|
618
|
+
const invoiceChain = Number(invoiceChainId);
|
|
619
|
+
const live = catalogue?.ready ? catalogue : null;
|
|
620
|
+
const destinationToken = findToken(tokens, invoiceChain, invoiceKey);
|
|
371
621
|
const routeBridge = /* @__PURE__ */ new Map();
|
|
372
622
|
for (const route of routes || []) {
|
|
373
|
-
if (route.isEnabled === false || Number(route.toChainId) !==
|
|
623
|
+
if (route.isEnabled === false || Number(route.toChainId) !== invoiceChain) continue;
|
|
374
624
|
routeBridge.set(`${symbolKey(route.tokenName || route.tokenId)}:${Number(route.fromChainId)}`, route.bridge);
|
|
375
625
|
routeBridge.set(`${symbolKey(route.tokenId)}:${Number(route.fromChainId)}`, route.bridge);
|
|
376
626
|
}
|
|
377
|
-
const
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
if (!direct && (!receiveDeliverable || !isDeliverable(payKey, chainId))) continue;
|
|
387
|
-
options.push({
|
|
388
|
-
symbol: token.symbol,
|
|
389
|
-
symbolKey: payKey,
|
|
390
|
-
name: token.name || token.symbol,
|
|
391
|
-
chainId,
|
|
392
|
-
chainName: chainNameOf(chainId, chains),
|
|
393
|
-
address: token.address,
|
|
394
|
-
decimals: assetDecimals(token),
|
|
395
|
-
logoUrl: token.logoUrl,
|
|
396
|
-
bridge: routeBridge.get(`${payKey}:${chainId}`) || token.bridge,
|
|
397
|
-
sameChain: chainId === Number(invoiceChainId),
|
|
398
|
-
direct
|
|
399
|
-
});
|
|
627
|
+
const knownLanes = live?.lanes && live.lanes.size > 0 ? live.lanes : null;
|
|
628
|
+
function refusal(token) {
|
|
629
|
+
const sameSymbol = symbolKey(token.symbol) === invoiceKey;
|
|
630
|
+
const sameChain = Number(token.chainId) === invoiceChain;
|
|
631
|
+
if (sameSymbol && sameChain) return null;
|
|
632
|
+
if (live && destinationToken && brokenLaneFor(destinationToken, token, live.brokenLanes)) return "measured";
|
|
633
|
+
if (live && !isSourceToken(token, live)) return "not-a-source";
|
|
634
|
+
if (sameSymbol && knownLanes && !knownLanes.has(laneKey(token.chainId, token.address, invoiceChain, destinationToken?.address ?? ""))) {
|
|
635
|
+
return "no-direct-lane";
|
|
400
636
|
}
|
|
637
|
+
if (live && destinationToken && destinationAvailability(destinationToken, live, token) !== "available") return "undeliverable";
|
|
638
|
+
return null;
|
|
639
|
+
}
|
|
640
|
+
const options = [];
|
|
641
|
+
const seen = /* @__PURE__ */ new Set();
|
|
642
|
+
const universe = live ? live.tokens : tokens;
|
|
643
|
+
for (const token of universe) {
|
|
644
|
+
if (!tokenEnabled(token)) continue;
|
|
645
|
+
const chainId = Number(token.chainId);
|
|
646
|
+
const chain = chainById(chains, chainId);
|
|
647
|
+
if (!chainSelectable(chain, chainId)) continue;
|
|
648
|
+
const key = tokenKey(chainId, token.address);
|
|
649
|
+
if (seen.has(key)) continue;
|
|
650
|
+
if (refusal(token)) continue;
|
|
651
|
+
seen.add(key);
|
|
652
|
+
const payKey = symbolKey(token.symbol);
|
|
653
|
+
const direct = chainId === invoiceChain && payKey === invoiceKey;
|
|
654
|
+
options.push({
|
|
655
|
+
symbol: token.symbol,
|
|
656
|
+
symbolKey: payKey,
|
|
657
|
+
name: token.name || token.symbol,
|
|
658
|
+
chainId,
|
|
659
|
+
chainName: chainNameOf(chainId, chains),
|
|
660
|
+
address: token.address,
|
|
661
|
+
decimals: assetDecimals(token),
|
|
662
|
+
logoUrl: token.logoUrl,
|
|
663
|
+
bridge: routeBridge.get(`${payKey}:${chainId}`) || token.bridge,
|
|
664
|
+
sameChain: chainId === invoiceChain,
|
|
665
|
+
direct
|
|
666
|
+
});
|
|
401
667
|
}
|
|
402
668
|
options.sort((a, b) => {
|
|
403
669
|
const walletChain = Number(walletChainId || 0);
|
|
@@ -456,6 +722,368 @@ function nativeFeeShortMessage(check, symbol, chainName) {
|
|
|
456
722
|
return `This route bridges via LayerZero, which charges a ${need} ${symbol} network fee paid as part of the transaction. Your wallet holds ${have} ${symbol}${where}. Add ${symbol}${where} and try again \u2014 gas is owed on top of this fee.`;
|
|
457
723
|
}
|
|
458
724
|
|
|
725
|
+
// src/core/route-health.ts
|
|
726
|
+
var EMPTY = /* @__PURE__ */ new Map();
|
|
727
|
+
function suppressedLanes(health) {
|
|
728
|
+
if (health?.mode !== "enforce" || !Array.isArray(health.lanes)) return EMPTY;
|
|
729
|
+
const out = /* @__PURE__ */ new Map();
|
|
730
|
+
for (const lane of health.lanes) {
|
|
731
|
+
if (lane?.status !== "broken") continue;
|
|
732
|
+
const key = typeof lane.laneKey === "string" ? lane.laneKey.toLowerCase() : "";
|
|
733
|
+
if (!key) continue;
|
|
734
|
+
out.set(key, {
|
|
735
|
+
route: typeof lane.route === "string" ? lane.route : "",
|
|
736
|
+
code: typeof lane.code === "string" ? lane.code : "",
|
|
737
|
+
message: typeof lane.message === "string" ? lane.message : "",
|
|
738
|
+
...typeof lane.kind === "string" ? { kind: lane.kind } : {}
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
return out;
|
|
742
|
+
}
|
|
743
|
+
function brokenLaneReason(lane) {
|
|
744
|
+
if (!lane) return "";
|
|
745
|
+
switch (lane.kind) {
|
|
746
|
+
case "bridge-throttled":
|
|
747
|
+
return "The issuer's bridge for this pair is closed right now.";
|
|
748
|
+
case "vault-closed":
|
|
749
|
+
return "This vault is not accepting deposits right now.";
|
|
750
|
+
default:
|
|
751
|
+
return "ZeroDelta could not price this pair in its latest check.";
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
// src/core/compliance.ts
|
|
756
|
+
var COMPLIANCE_DENY_LABEL = "Compliance check failed";
|
|
757
|
+
function complianceView(compliance, hasQuote = true) {
|
|
758
|
+
if (!hasQuote) {
|
|
759
|
+
return {
|
|
760
|
+
tone: "neutral",
|
|
761
|
+
label: "Compliance checks run with your quote",
|
|
762
|
+
headline: "No compliance decision for this payment yet",
|
|
763
|
+
blocked: false,
|
|
764
|
+
needsAction: false,
|
|
765
|
+
screened: false
|
|
766
|
+
};
|
|
767
|
+
}
|
|
768
|
+
const decision = compliance?.decision;
|
|
769
|
+
const screened = compliance?.status === "SCREENED";
|
|
770
|
+
if (decision === "DENY") {
|
|
771
|
+
return {
|
|
772
|
+
tone: "blocked",
|
|
773
|
+
label: COMPLIANCE_DENY_LABEL,
|
|
774
|
+
headline: "Blocked by compliance policy",
|
|
775
|
+
blocked: true,
|
|
776
|
+
needsAction: false,
|
|
777
|
+
screened
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
if (decision === "REVIEW" || decision === "REMEDIATE") {
|
|
781
|
+
const word = decision.toLowerCase();
|
|
782
|
+
return {
|
|
783
|
+
tone: "warn",
|
|
784
|
+
label: `Compliance: ${word} required`,
|
|
785
|
+
headline: `Manual ${word} required`,
|
|
786
|
+
blocked: false,
|
|
787
|
+
needsAction: true,
|
|
788
|
+
screened
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
if (decision === "ALLOW") {
|
|
792
|
+
return {
|
|
793
|
+
tone: "ok",
|
|
794
|
+
label: screened ? "Compliance checks passed" : "Allowed \u2014 wallets not screened",
|
|
795
|
+
headline: screened ? "Wallets screened and allowed" : "Allowed \u2014 wallets not screened",
|
|
796
|
+
blocked: false,
|
|
797
|
+
needsAction: false,
|
|
798
|
+
screened
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
return {
|
|
802
|
+
tone: "neutral",
|
|
803
|
+
label: screened ? "Screened \u2014 no policy decision returned" : "No compliance decision returned",
|
|
804
|
+
headline: screened ? "Screened \u2014 no policy decision returned" : "No compliance decision returned",
|
|
805
|
+
blocked: false,
|
|
806
|
+
needsAction: false,
|
|
807
|
+
screened
|
|
808
|
+
};
|
|
809
|
+
}
|
|
810
|
+
var CATEGORY_PHRASES = {
|
|
811
|
+
SANCTIONS: "sanctions",
|
|
812
|
+
TERRORISM_FINANCING: "terrorism financing",
|
|
813
|
+
STOLEN_FUNDS: "stolen funds",
|
|
814
|
+
RANSOMWARE: "ransomware",
|
|
815
|
+
SCAM: "scam activity",
|
|
816
|
+
DARKNET: "darknet activity",
|
|
817
|
+
MIXER: "mixer usage",
|
|
818
|
+
HIGH_RISK_ENTITY: "a high-risk entity",
|
|
819
|
+
PEP: "a politically-exposed person",
|
|
820
|
+
INDIRECT_EXPOSURE: "indirect exposure",
|
|
821
|
+
UNCLASSIFIED: "an unrecognized risk",
|
|
822
|
+
UNKNOWN: "an unrecognized risk"
|
|
823
|
+
};
|
|
824
|
+
function categoryLabel(code) {
|
|
825
|
+
const key = code.trim().toUpperCase();
|
|
826
|
+
const LABELS = {
|
|
827
|
+
SANCTIONS: "Sanctions",
|
|
828
|
+
TERRORISM_FINANCING: "Terrorist financing",
|
|
829
|
+
STOLEN_FUNDS: "Stolen funds",
|
|
830
|
+
RANSOMWARE: "Ransomware",
|
|
831
|
+
SCAM: "Scam",
|
|
832
|
+
DARKNET: "Darknet services",
|
|
833
|
+
MIXER: "Mixer",
|
|
834
|
+
HIGH_RISK_ENTITY: "High-risk entity",
|
|
835
|
+
PEP: "Politically exposed person (PEP)",
|
|
836
|
+
INDIRECT_EXPOSURE: "Indirect exposure",
|
|
837
|
+
UNCLASSIFIED: "Unclassified risk",
|
|
838
|
+
UNKNOWN: "Unclassified risk"
|
|
839
|
+
};
|
|
840
|
+
return LABELS[key] ?? key.toLowerCase().replace(/_/g, " ");
|
|
841
|
+
}
|
|
842
|
+
function cleanJurisdiction(code) {
|
|
843
|
+
return code.replace(/^(OFAC|TIER\d+|SANCTIONED)_/i, "").trim();
|
|
844
|
+
}
|
|
845
|
+
function stripBundlePrefix(head) {
|
|
846
|
+
if (head.startsWith("policy_")) return { head: head.slice("policy_".length), source: "policy" };
|
|
847
|
+
if (head.startsWith("legislation_")) return { head: head.slice("legislation_".length), source: "legislation" };
|
|
848
|
+
return { head, source: null };
|
|
849
|
+
}
|
|
850
|
+
function complianceReasonHead(raw) {
|
|
851
|
+
return stripBundlePrefix((raw.split(":")[0] ?? "").trim()).head;
|
|
852
|
+
}
|
|
853
|
+
function usd(raw) {
|
|
854
|
+
const n = Number(raw);
|
|
855
|
+
if (!Number.isFinite(n)) return `$${raw}`;
|
|
856
|
+
return `$${n.toLocaleString("en-US", { maximumFractionDigits: 2 })}`;
|
|
857
|
+
}
|
|
858
|
+
function capFromDetail(detail) {
|
|
859
|
+
const m = detail.match(/>([\d.]+)/);
|
|
860
|
+
return m ? ` (${usd(m[1])})` : "";
|
|
861
|
+
}
|
|
862
|
+
function categoryPhrase(detail) {
|
|
863
|
+
const cat = detail.replace(/\s*\(.*\)$/, "").toUpperCase();
|
|
864
|
+
return CATEGORY_PHRASES[cat] ?? cat.toLowerCase().replace(/_/g, " ");
|
|
865
|
+
}
|
|
866
|
+
function humanizeComplianceReason(raw) {
|
|
867
|
+
const [headRaw, ...restParts] = raw.split(":");
|
|
868
|
+
const detail = restParts.join(":").trim();
|
|
869
|
+
const { head, source } = stripBundlePrefix((headRaw ?? "").trim());
|
|
870
|
+
const scope = source === "legislation" ? "applicable regulations" : "the applicable policy";
|
|
871
|
+
switch (head) {
|
|
872
|
+
case "asset_pair_not_allowed": {
|
|
873
|
+
const m = detail.match(/^(\S+)->(\S+)\s+in\s+(\S+)/);
|
|
874
|
+
if (m) return `${m[1]} \u2192 ${m[2]} isn't available in your region (${cleanJurisdiction(m[3])}).`;
|
|
875
|
+
return "This asset pair isn't available in your region.";
|
|
876
|
+
}
|
|
877
|
+
case "asset_not_allowed": {
|
|
878
|
+
const m = detail.match(/^(\S+?)->(\S+?)(?::|$)/);
|
|
879
|
+
if (m) return `${m[1]} \u2192 ${m[2]} isn't permitted under ${scope}.`;
|
|
880
|
+
return `This asset pair isn't permitted under ${scope}.`;
|
|
881
|
+
}
|
|
882
|
+
case "blocked_jurisdiction":
|
|
883
|
+
return `Your region (${cleanJurisdiction(detail)}) isn't supported.`;
|
|
884
|
+
case "blocked_destination_jurisdiction":
|
|
885
|
+
return `The destination region (${cleanJurisdiction(detail)}) isn't supported.`;
|
|
886
|
+
case "jurisdiction_out_of_scope":
|
|
887
|
+
return `Not covered by ${scope}.`;
|
|
888
|
+
case "ui_block":
|
|
889
|
+
return `Payments aren't available in your region (${cleanJurisdiction(detail)}).`;
|
|
890
|
+
case "blocked_corridor_mode":
|
|
891
|
+
return "This route isn't currently open for payments.";
|
|
892
|
+
case "blocked_category":
|
|
893
|
+
return `Flagged for ${categoryPhrase(detail)}.`;
|
|
894
|
+
case "amount_exceeds_max_order_usd":
|
|
895
|
+
case "amount_exceeds_max":
|
|
896
|
+
return `Amount exceeds the maximum order size${capFromDetail(detail)}.`;
|
|
897
|
+
case "amount_exceeds_actor_cap":
|
|
898
|
+
return `Amount exceeds the limit for your account type${capFromDetail(detail)}.`;
|
|
899
|
+
case "amount_exceeds_jurisdiction_max":
|
|
900
|
+
return `Amount exceeds the limit for your region${capFromDetail(detail)}.`;
|
|
901
|
+
case "source_chain_not_allowed":
|
|
902
|
+
return `The source chain isn't permitted under ${scope}.`;
|
|
903
|
+
case "dest_chain_not_allowed":
|
|
904
|
+
return `The destination chain isn't permitted under ${scope}.`;
|
|
905
|
+
default:
|
|
906
|
+
return detail ? `${head.replace(/_/g, " ")} \u2014 ${detail}` : head.replace(/_/g, " ");
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
var COMPLIANCE_CHECK_ORDER = [
|
|
910
|
+
"location",
|
|
911
|
+
"screening",
|
|
912
|
+
"risk",
|
|
913
|
+
"asset",
|
|
914
|
+
"limits"
|
|
915
|
+
];
|
|
916
|
+
var CHECK_LABELS = {
|
|
917
|
+
location: "Location and corridor permitted",
|
|
918
|
+
screening: "Both wallets screened",
|
|
919
|
+
risk: "Risk policy passed",
|
|
920
|
+
asset: "Asset and amount allowed",
|
|
921
|
+
limits: "Transaction limits verified"
|
|
922
|
+
};
|
|
923
|
+
var CHECK_HEADS = {
|
|
924
|
+
location: [
|
|
925
|
+
"blocked_jurisdiction",
|
|
926
|
+
"blocked_destination_jurisdiction",
|
|
927
|
+
"ui_block",
|
|
928
|
+
"blocked_corridor_mode",
|
|
929
|
+
"jurisdiction_out_of_scope"
|
|
930
|
+
],
|
|
931
|
+
screening: [],
|
|
932
|
+
risk: ["blocked_category"],
|
|
933
|
+
asset: ["asset_pair_not_allowed", "asset_not_allowed", "source_chain_not_allowed", "dest_chain_not_allowed"],
|
|
934
|
+
limits: [
|
|
935
|
+
"amount_exceeds_max_order_usd",
|
|
936
|
+
"amount_exceeds_max",
|
|
937
|
+
"amount_exceeds_actor_cap",
|
|
938
|
+
"amount_exceeds_jurisdiction_max"
|
|
939
|
+
]
|
|
940
|
+
};
|
|
941
|
+
function distinctScreenedWallets(compliance) {
|
|
942
|
+
const seen = /* @__PURE__ */ new Set();
|
|
943
|
+
const wallets = [];
|
|
944
|
+
for (const raw of compliance?.screenedWallets ?? []) {
|
|
945
|
+
const address = raw?.trim();
|
|
946
|
+
if (!address) continue;
|
|
947
|
+
const key = /^0x[0-9a-fA-F]+$/.test(address) ? address.toLowerCase() : address;
|
|
948
|
+
if (seen.has(key)) continue;
|
|
949
|
+
seen.add(key);
|
|
950
|
+
wallets.push(address);
|
|
951
|
+
}
|
|
952
|
+
return wallets;
|
|
953
|
+
}
|
|
954
|
+
function shortAddress(a) {
|
|
955
|
+
return a.length > 12 ? `${a.slice(0, 6)}\u2026${a.slice(-4)}` : a;
|
|
956
|
+
}
|
|
957
|
+
function screeningLabel(wallets) {
|
|
958
|
+
if (wallets === 1) return "Wallet screened";
|
|
959
|
+
if (wallets === 2) return CHECK_LABELS.screening;
|
|
960
|
+
return "Wallets screened";
|
|
961
|
+
}
|
|
962
|
+
function complianceChecks(compliance, cv = complianceView(compliance)) {
|
|
963
|
+
if (cv.tone === "neutral") return [];
|
|
964
|
+
const byControl = /* @__PURE__ */ new Map();
|
|
965
|
+
for (const raw of compliance?.reasons ?? []) {
|
|
966
|
+
const head = complianceReasonHead(raw);
|
|
967
|
+
const id = COMPLIANCE_CHECK_ORDER.find((c) => CHECK_HEADS[c].includes(head));
|
|
968
|
+
if (!id) continue;
|
|
969
|
+
byControl.set(id, [...byControl.get(id) ?? [], raw]);
|
|
970
|
+
}
|
|
971
|
+
const screenedWallets = distinctScreenedWallets(compliance);
|
|
972
|
+
const wallets = screenedWallets.length;
|
|
973
|
+
const blocking = compliance?.blockingCategories?.length ?? 0;
|
|
974
|
+
return COMPLIANCE_CHECK_ORDER.map((id) => {
|
|
975
|
+
if (id === "screening") {
|
|
976
|
+
const ok2 = cv.screened || wallets > 0;
|
|
977
|
+
const note = wallets === 1 ? shortAddress(screenedWallets[0]) : wallets > 1 ? `${wallets} wallets screened` : void 0;
|
|
978
|
+
return { id, label: ok2 ? screeningLabel(wallets) : "Wallets not screened", ok: ok2, reasons: [], note };
|
|
979
|
+
}
|
|
980
|
+
const reasons = byControl.get(id) ?? [];
|
|
981
|
+
const ok = reasons.length === 0 && !(id === "risk" && blocking > 0);
|
|
982
|
+
return { id, label: CHECK_LABELS[id], ok, reasons };
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
function unattributedComplianceReasons(compliance, cv = complianceView(compliance)) {
|
|
986
|
+
const claimed = new Set(complianceChecks(compliance, cv).flatMap((c) => c.reasons));
|
|
987
|
+
return (compliance?.reasons ?? []).filter((r) => !claimed.has(r));
|
|
988
|
+
}
|
|
989
|
+
function complianceControlsEvaluated(compliance, cv = complianceView(compliance)) {
|
|
990
|
+
const checks = complianceChecks(compliance, cv);
|
|
991
|
+
if (checks.length === 0) return 0;
|
|
992
|
+
const named = /* @__PURE__ */ new Set();
|
|
993
|
+
for (const raw of [...compliance?.appliedPolicyNames ?? [], ...compliance?.appliedLegislation ?? []]) {
|
|
994
|
+
const name = raw?.trim();
|
|
995
|
+
if (name) named.add(name.toLowerCase());
|
|
996
|
+
}
|
|
997
|
+
return checks.length + named.size;
|
|
998
|
+
}
|
|
999
|
+
function complianceControlsLine(compliance, cv = complianceView(compliance)) {
|
|
1000
|
+
if (cv.blocked || cv.needsAction) return cv.headline;
|
|
1001
|
+
const n = complianceControlsEvaluated(compliance, cv);
|
|
1002
|
+
if (n === 0) return cv.headline;
|
|
1003
|
+
return `${n} compliance control${n === 1 ? "" : "s"} evaluated for this payment`;
|
|
1004
|
+
}
|
|
1005
|
+
function directComplianceFromScreens(screens) {
|
|
1006
|
+
const blockedAny = screens.some((s) => s.blocked);
|
|
1007
|
+
const cats = (pick) => [
|
|
1008
|
+
...new Set(screens.flatMap((s) => pick(s) ?? []))
|
|
1009
|
+
];
|
|
1010
|
+
return {
|
|
1011
|
+
status: "SCREENED",
|
|
1012
|
+
decision: blockedAny ? "DENY" : "ALLOW",
|
|
1013
|
+
screenedWallets: screens.map((s) => s.address),
|
|
1014
|
+
riskCategories: cats((s) => s.riskCategories),
|
|
1015
|
+
flaggedCategories: cats((s) => s.flaggedCategories),
|
|
1016
|
+
blockingCategories: cats((s) => s.blockingCategories),
|
|
1017
|
+
reasons: blockedAny ? cats((s) => s.blockingCategories).map((c) => `blocked_category:${c}`) : []
|
|
1018
|
+
};
|
|
1019
|
+
}
|
|
1020
|
+
var DIRECT_CHECK_IDS = ["screening", "risk"];
|
|
1021
|
+
var DIRECT_SCOPE_NOTE = "Direct settlement moves your funds straight to the recipient, so wallet screening applies. Jurisdiction, corridor and amount policy are evaluated on routed payments.";
|
|
1022
|
+
var BLOCK_CATEGORY_LABELS = {
|
|
1023
|
+
STOLEN_FUNDS: "flagged as associated with stolen funds",
|
|
1024
|
+
SANCTIONS: "on a sanctions list",
|
|
1025
|
+
SANCTIONED: "on a sanctions list",
|
|
1026
|
+
OFAC: "on a sanctions list",
|
|
1027
|
+
TERRORIST_FINANCING: "flagged for terrorist financing",
|
|
1028
|
+
TERRORISM_FINANCING: "flagged for terrorist financing",
|
|
1029
|
+
FRAUD: "flagged for fraud",
|
|
1030
|
+
SCAM: "flagged as a scam address"
|
|
1031
|
+
};
|
|
1032
|
+
var BLOCK_LABEL_DEFAULT = "flagged by compliance screening";
|
|
1033
|
+
function blockLabelFor(categories) {
|
|
1034
|
+
for (const raw of categories) {
|
|
1035
|
+
const label = BLOCK_CATEGORY_LABELS[String(raw || "").trim().toUpperCase()];
|
|
1036
|
+
if (label) return label;
|
|
1037
|
+
}
|
|
1038
|
+
return BLOCK_LABEL_DEFAULT;
|
|
1039
|
+
}
|
|
1040
|
+
var REASON_TAGS = {
|
|
1041
|
+
blocked_jurisdiction: "Restricted country",
|
|
1042
|
+
ui_block: "Restricted country",
|
|
1043
|
+
blocked_destination_jurisdiction: "Restricted destination",
|
|
1044
|
+
blocked_corridor_mode: "Corridor closed",
|
|
1045
|
+
blocked_category: "Risk flag",
|
|
1046
|
+
amount_exceeds_max_order_usd: "Limit exceeded",
|
|
1047
|
+
amount_exceeds_max: "Limit exceeded",
|
|
1048
|
+
amount_exceeds_actor_cap: "Limit exceeded",
|
|
1049
|
+
amount_exceeds_jurisdiction_max: "Limit exceeded",
|
|
1050
|
+
asset_pair_not_allowed: "Asset not allowed",
|
|
1051
|
+
asset_not_allowed: "Asset not allowed",
|
|
1052
|
+
source_chain_not_allowed: "Chain not allowed",
|
|
1053
|
+
dest_chain_not_allowed: "Chain not allowed",
|
|
1054
|
+
jurisdiction_out_of_scope: "Out of scope"
|
|
1055
|
+
};
|
|
1056
|
+
function complianceReasonTag(raw) {
|
|
1057
|
+
const head = complianceReasonHead(raw);
|
|
1058
|
+
return REASON_TAGS[head] ?? head.replace(/_/g, " ");
|
|
1059
|
+
}
|
|
1060
|
+
function complianceTagOf(compliance) {
|
|
1061
|
+
const first = (compliance?.reasons ?? [])[0];
|
|
1062
|
+
return first ? complianceReasonTag(first) : "";
|
|
1063
|
+
}
|
|
1064
|
+
var FLOOR_CATEGORIES = ["SANCTIONS", "TERRORISM_FINANCING", "STOLEN_FUNDS", "RANSOMWARE"];
|
|
1065
|
+
var TUNABLE_CATEGORIES = ["SCAM", "DARKNET", "MIXER", "HIGH_RISK_ENTITY", "PEP", "INDIRECT_EXPOSURE", "UNCLASSIFIED"];
|
|
1066
|
+
var TUNED_OUTCOMES = {
|
|
1067
|
+
SCAM: "blocked",
|
|
1068
|
+
DARKNET: "blocked",
|
|
1069
|
+
MIXER: "flagged",
|
|
1070
|
+
HIGH_RISK_ENTITY: "flagged",
|
|
1071
|
+
PEP: "flagged",
|
|
1072
|
+
INDIRECT_EXPOSURE: "flagged",
|
|
1073
|
+
UNCLASSIFIED: "flagged"
|
|
1074
|
+
};
|
|
1075
|
+
function screeningOutcomeOf(category) {
|
|
1076
|
+
const key = category.trim().toUpperCase();
|
|
1077
|
+
if (FLOOR_CATEGORIES.includes(key)) return "always-blocked";
|
|
1078
|
+
return TUNED_OUTCOMES[key] ?? null;
|
|
1079
|
+
}
|
|
1080
|
+
var labelsFor = (outcome) => [...FLOOR_CATEGORIES, ...TUNABLE_CATEGORIES].filter((c) => screeningOutcomeOf(c) === outcome).map(categoryLabel);
|
|
1081
|
+
var SCREENING_BUCKETS = [
|
|
1082
|
+
{ outcome: "always-blocked", title: "Always blocked", detail: "Cannot be changed or disabled.", categories: labelsFor("always-blocked") },
|
|
1083
|
+
{ outcome: "blocked", title: "Blocked under this policy", detail: "The current policy stops the order.", categories: labelsFor("blocked") },
|
|
1084
|
+
{ outcome: "flagged", title: "Flagged", detail: "A warning is shown.", categories: labelsFor("flagged") }
|
|
1085
|
+
];
|
|
1086
|
+
|
|
459
1087
|
// src/core/solve.ts
|
|
460
1088
|
async function solveExactOut({ option, destination, destinationToken, payer, fetchQuote }) {
|
|
461
1089
|
const destDecimals = assetDecimals(destinationToken);
|
|
@@ -692,7 +1320,7 @@ function routeLabelFor(option, destinationToken, result) {
|
|
|
692
1320
|
const bridge = result.quote.bridge ? ` via ${result.quote.bridge}` : "";
|
|
693
1321
|
return `Swap ${option.symbol} to ${destinationToken.symbol} and settle on ZeroDelta${bridge}.`;
|
|
694
1322
|
}
|
|
695
|
-
async function buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote, solve = solveExactOut, amountInRaw }) {
|
|
1323
|
+
async function buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote, solve = solveExactOut, amountInRaw, compliance }) {
|
|
696
1324
|
const result = await solve({ option, destination, destinationToken, payer, fetchQuote, amountInRaw });
|
|
697
1325
|
const quote = result.quote;
|
|
698
1326
|
const destDecimals = assetDecimals(destinationToken);
|
|
@@ -739,7 +1367,11 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
739
1367
|
bridge: quote.bridge,
|
|
740
1368
|
feeBps: quote.feeBps,
|
|
741
1369
|
estimatedDuration: quote.estimatedDuration,
|
|
742
|
-
iterations: result.iterations
|
|
1370
|
+
iterations: result.iterations,
|
|
1371
|
+
// A direct transfer never reaches /quote (solve.ts short-circuits it), so there is no
|
|
1372
|
+
// gateway decision to carry. The caller screens both parties itself and passes the
|
|
1373
|
+
// synthesized verdict in — see plan.ts and compliance.ts::directComplianceFromScreens.
|
|
1374
|
+
compliance
|
|
743
1375
|
}
|
|
744
1376
|
};
|
|
745
1377
|
}
|
|
@@ -823,7 +1455,11 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
823
1455
|
gasCostSource: quote.gasCostSource,
|
|
824
1456
|
msgValue: valueRaw.toString(),
|
|
825
1457
|
deadline: order.deadline,
|
|
826
|
-
iterations: result.iterations
|
|
1458
|
+
iterations: result.iterations,
|
|
1459
|
+
// Carried verbatim from the gateway's decision on THIS wallet pair. The projection used to
|
|
1460
|
+
// drop it, which is why the widget could show a price with no evidence of the control that
|
|
1461
|
+
// produced it.
|
|
1462
|
+
compliance: quote.compliance
|
|
827
1463
|
}
|
|
828
1464
|
};
|
|
829
1465
|
}
|
|
@@ -859,25 +1495,20 @@ function apiMessage(json, fallback) {
|
|
|
859
1495
|
}
|
|
860
1496
|
return sanitizeMessage(err?.message, fallback);
|
|
861
1497
|
}
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
TERRORIST_FINANCING: "flagged for terrorist financing",
|
|
868
|
-
FRAUD: "flagged for fraud",
|
|
869
|
-
SCAM: "flagged as a scam address"
|
|
870
|
-
};
|
|
871
|
-
var BLOCK_LABEL_DEFAULT = "flagged by compliance screening";
|
|
1498
|
+
function isStructuredComplianceBlock(error) {
|
|
1499
|
+
const code = String(error?.code || "").toUpperCase();
|
|
1500
|
+
if (code === "COMPLIANCE_BLOCKED" || code === "COMPLIANCE_BLOCK") return true;
|
|
1501
|
+
return error?.status === 422 && Array.isArray(error?.reasons) && error.reasons.length > 0;
|
|
1502
|
+
}
|
|
872
1503
|
function classifyQuoteError(error) {
|
|
873
1504
|
if (!error) return null;
|
|
874
1505
|
const reasons = Array.isArray(error.reasons) ? error.reasons : [];
|
|
875
1506
|
const haystack = `${error.message || ""} ${reasons.join(" ")}`;
|
|
876
1507
|
const catMatch = /blocked_category:\s*([A-Za-z_]+)/i.exec(haystack);
|
|
877
|
-
const isBlock = !!catMatch || error.code === "blocked" || error.code === "compliance_block" || /\b(stolen|sanction(?:s|ed|ing)?|block(?:ed|list)|screen(?:ed|ing)?|compliance|ofac|denylist|blacklist)\b/i.test(haystack);
|
|
1508
|
+
const isBlock = isStructuredComplianceBlock(error) || !!catMatch || error.code === "blocked" || error.code === "compliance_block" || /\b(stolen|sanction(?:s|ed|ing)?|block(?:ed|list)|screen(?:ed|ing)?|compliance|ofac|denylist|blacklist)\b/i.test(haystack);
|
|
878
1509
|
if (!isBlock) return null;
|
|
879
1510
|
const category = (catMatch?.[1] || "").toUpperCase() || "COMPLIANCE";
|
|
880
|
-
const label =
|
|
1511
|
+
const label = blockLabelFor([category]);
|
|
881
1512
|
return {
|
|
882
1513
|
blocked: true,
|
|
883
1514
|
category,
|
|
@@ -898,8 +1529,11 @@ function createApiClient(cfg) {
|
|
|
898
1529
|
const cache = {
|
|
899
1530
|
chains: null,
|
|
900
1531
|
tokens: null,
|
|
901
|
-
routes: null
|
|
1532
|
+
routes: null,
|
|
1533
|
+
health: null
|
|
902
1534
|
};
|
|
1535
|
+
const screenCache = /* @__PURE__ */ new Map();
|
|
1536
|
+
const screenInflight = /* @__PURE__ */ new Map();
|
|
903
1537
|
const apiBase = cfg.apiBase.replace(/\/$/, "");
|
|
904
1538
|
async function apiRequest(path, init = {}) {
|
|
905
1539
|
const apiKey = await cfg.getApiKey();
|
|
@@ -968,6 +1602,18 @@ function createApiClient(cfg) {
|
|
|
968
1602
|
return [];
|
|
969
1603
|
}
|
|
970
1604
|
}
|
|
1605
|
+
async function fetchRouteHealth() {
|
|
1606
|
+
if (nowFresh(cache.health)) return cache.health.value;
|
|
1607
|
+
let value = null;
|
|
1608
|
+
try {
|
|
1609
|
+
const health = await apiRequest("/route-health", { timeoutMs: 8e3 });
|
|
1610
|
+
value = health && typeof health === "object" && !Array.isArray(health) ? health : null;
|
|
1611
|
+
} catch {
|
|
1612
|
+
value = null;
|
|
1613
|
+
}
|
|
1614
|
+
cache.health = { at: Date.now(), value };
|
|
1615
|
+
return value;
|
|
1616
|
+
}
|
|
971
1617
|
async function fetchQuote(body, retries = 1) {
|
|
972
1618
|
let lastError;
|
|
973
1619
|
for (let attempt = 0; attempt <= retries; attempt += 1) {
|
|
@@ -982,7 +1628,32 @@ function createApiClient(cfg) {
|
|
|
982
1628
|
}
|
|
983
1629
|
throw lastError;
|
|
984
1630
|
}
|
|
985
|
-
|
|
1631
|
+
async function screenWallet(address, chainId) {
|
|
1632
|
+
const addr = String(address || "").trim();
|
|
1633
|
+
if (!addr) throw apiError("An address is required to screen a wallet.", { code: "bad_request" });
|
|
1634
|
+
const key = `${/^0x[0-9a-fA-F]+$/.test(addr) ? addr.toLowerCase() : addr}|${chainId ?? ""}`;
|
|
1635
|
+
const hit = screenCache.get(key);
|
|
1636
|
+
if (hit && Date.now() - hit.at < SCREEN_CACHE_TTL_MS) return hit.value;
|
|
1637
|
+
const inflight = screenInflight.get(key);
|
|
1638
|
+
if (inflight) return inflight;
|
|
1639
|
+
const request = apiRequest("/screen/wallet", {
|
|
1640
|
+
method: "POST",
|
|
1641
|
+
body: JSON.stringify(chainId == null ? { address: addr } : { address: addr, chainId }),
|
|
1642
|
+
timeoutMs: 12e3
|
|
1643
|
+
}).then((screen) => {
|
|
1644
|
+
if (!screen || typeof screen !== "object" || typeof screen.blocked !== "boolean") {
|
|
1645
|
+
throw apiError("Compliance screening returned an unusable result.", { code: "bad_response" });
|
|
1646
|
+
}
|
|
1647
|
+
const value = { ...screen, address: screen.address || addr };
|
|
1648
|
+
screenCache.set(key, { at: Date.now(), value });
|
|
1649
|
+
return value;
|
|
1650
|
+
}).finally(() => {
|
|
1651
|
+
screenInflight.delete(key);
|
|
1652
|
+
});
|
|
1653
|
+
screenInflight.set(key, request);
|
|
1654
|
+
return request;
|
|
1655
|
+
}
|
|
1656
|
+
return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchQuote, screenWallet, apiBase };
|
|
986
1657
|
}
|
|
987
1658
|
|
|
988
1659
|
// src/core/plan.ts
|
|
@@ -1000,7 +1671,7 @@ function validateDestination(destination) {
|
|
|
1000
1671
|
assertAddress(destination.address, "Destination address");
|
|
1001
1672
|
const chainId = Number(destination.chainId);
|
|
1002
1673
|
const asset = symbolKey(destination.asset);
|
|
1003
|
-
if (!
|
|
1674
|
+
if (!Number.isSafeInteger(chainId) || chainId <= 0) throw new Error("Unsupported destination chain.");
|
|
1004
1675
|
if (!SUPPORTED_ASSETS.has(asset)) throw new Error("Unsupported destination asset.");
|
|
1005
1676
|
const normalizedAmount = normalizeDecimalText(destination.amount);
|
|
1006
1677
|
if (!/^\d+(\.\d+)?$/.test(normalizedAmount)) throw new Error("Could not detect a valid payment amount.");
|
|
@@ -1014,7 +1685,15 @@ function planErrorSummary(errors) {
|
|
|
1014
1685
|
async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances) {
|
|
1015
1686
|
validateDestination(request);
|
|
1016
1687
|
assertAddress(payer, "Payer wallet");
|
|
1017
|
-
const [chains, tokens, routes] = await Promise.all([api.fetchChains(), api.fetchTokens(), api.fetchRoutes()]);
|
|
1688
|
+
const [chains, tokens, routes, health] = await Promise.all([api.fetchChains(), api.fetchTokens(), api.fetchRoutes(), api.fetchRouteHealth()]);
|
|
1689
|
+
const catalogue = buildCatalogue({
|
|
1690
|
+
chains,
|
|
1691
|
+
tokens,
|
|
1692
|
+
routes,
|
|
1693
|
+
product: "stable",
|
|
1694
|
+
supportedChainIds: SUPPORTED_CHAIN_IDS,
|
|
1695
|
+
brokenLanes: suppressedLanes(health)
|
|
1696
|
+
});
|
|
1018
1697
|
const destination = {
|
|
1019
1698
|
...request,
|
|
1020
1699
|
chainId: Number(request.chainId),
|
|
@@ -1029,7 +1708,8 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances)
|
|
|
1029
1708
|
tokens,
|
|
1030
1709
|
routes,
|
|
1031
1710
|
chains,
|
|
1032
|
-
walletChainId: wallet?.chainId
|
|
1711
|
+
walletChainId: wallet?.chainId,
|
|
1712
|
+
catalogue
|
|
1033
1713
|
}).filter((option) => option.direct || !allowedFunding || allowedFunding.has(option.symbolKey));
|
|
1034
1714
|
if (!options.length) throw new Error(`No enabled ZeroDelta funding assets can settle ${destination.asset} on ${chainNameOf(destination.chainId, chains)}.`);
|
|
1035
1715
|
const balanceTargets = [];
|
|
@@ -1041,7 +1721,36 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances)
|
|
|
1041
1721
|
balanceTargets.push({ chainId: option.chainId, tokenAddress: option.address, decimals: option.decimals });
|
|
1042
1722
|
}
|
|
1043
1723
|
const walletBalances = readBalances ? await readBalances(payer, balanceTargets).catch(() => ({})) : {};
|
|
1044
|
-
const
|
|
1724
|
+
const directOptions = options.filter((option) => option.direct);
|
|
1725
|
+
let directCompliance = null;
|
|
1726
|
+
if (directOptions.length) {
|
|
1727
|
+
const parties = [];
|
|
1728
|
+
const seenParty = /* @__PURE__ */ new Set();
|
|
1729
|
+
for (const raw of [payer, destination.address]) {
|
|
1730
|
+
const addr = String(raw || "").trim();
|
|
1731
|
+
if (!addr) continue;
|
|
1732
|
+
const key = /^0x[0-9a-fA-F]+$/.test(addr) ? addr.toLowerCase() : addr;
|
|
1733
|
+
if (seenParty.has(key)) continue;
|
|
1734
|
+
seenParty.add(key);
|
|
1735
|
+
parties.push(addr);
|
|
1736
|
+
}
|
|
1737
|
+
try {
|
|
1738
|
+
const screens = await Promise.all(parties.map((address) => api.screenWallet(address, destination.chainId)));
|
|
1739
|
+
const blocked = screens.filter((screen) => screen.blocked);
|
|
1740
|
+
if (blocked.length) {
|
|
1741
|
+
const who = blocked.some((s) => s.address.toLowerCase() === payer.toLowerCase()) ? "your wallet" : "the recipient";
|
|
1742
|
+
const categories = [...new Set(blocked.flatMap((s) => s.blockingCategories ?? []))];
|
|
1743
|
+
throw apiError(
|
|
1744
|
+
`This payment was blocked by compliance screening \u2014 ${who} is ${blockLabelFor(categories)}. Choose a different recipient or connect a different wallet.`,
|
|
1745
|
+
{ blocked: true, blockedCategory: categories[0] || "COMPLIANCE", blockedReason: categories.join(", ") }
|
|
1746
|
+
);
|
|
1747
|
+
}
|
|
1748
|
+
directCompliance = directComplianceFromScreens(screens);
|
|
1749
|
+
} catch (error) {
|
|
1750
|
+
if (error?.blocked) throw error;
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
const candidates = directCompliance ? directOptions : [];
|
|
1045
1754
|
const heldOptions = options.filter((option) => !option.direct && hasPositiveBalance(option, walletBalances));
|
|
1046
1755
|
const heldKeys = new Set(heldOptions.map(optionBalanceKey));
|
|
1047
1756
|
const seenChains = /* @__PURE__ */ new Set();
|
|
@@ -1061,7 +1770,7 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances)
|
|
|
1061
1770
|
}
|
|
1062
1771
|
const routeErrors = [];
|
|
1063
1772
|
const routePromises = candidates.map(
|
|
1064
|
-
(option) => buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote: api.fetchQuote }).catch((error) => {
|
|
1773
|
+
(option) => buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote: api.fetchQuote, compliance: option.direct ? directCompliance ?? void 0 : void 0 }).catch((error) => {
|
|
1065
1774
|
routeErrors.push(error);
|
|
1066
1775
|
return null;
|
|
1067
1776
|
})
|
|
@@ -1111,7 +1820,8 @@ function validateSwap(swap = {}) {
|
|
|
1111
1820
|
const toChainId = Number(swap.toChainId);
|
|
1112
1821
|
const fromToken = symbolKey(swap.fromToken);
|
|
1113
1822
|
const toToken = symbolKey(swap.toToken);
|
|
1114
|
-
if (!SUPPORTED_CHAIN_IDS.has(fromChainId)
|
|
1823
|
+
if (!SUPPORTED_CHAIN_IDS.has(fromChainId)) throw new Error("Unsupported swap chain.");
|
|
1824
|
+
if (!Number.isSafeInteger(toChainId) || toChainId <= 0) throw new Error("Unsupported swap chain.");
|
|
1115
1825
|
if (!SUPPORTED_ASSETS.has(fromToken) || !SUPPORTED_ASSETS.has(toToken)) throw new Error("Unsupported swap asset.");
|
|
1116
1826
|
const amountIn = normalizeDecimalText(swap.amountIn);
|
|
1117
1827
|
if (!/^\d+(\.\d+)?$/.test(amountIn) || Number(amountIn) <= 0 || Number(amountIn) > 1e9) throw new Error("Enter a valid swap amount.");
|
|
@@ -1273,7 +1983,7 @@ async function allowanceCovers(tx, account, ethCall) {
|
|
|
1273
1983
|
var STABLEGENIE_INTENT_VERSION = 1;
|
|
1274
1984
|
var STABLEGENIE_INTENT_TTL_MS = 5 * 60 * 1e3;
|
|
1275
1985
|
var STABLEGENIE_SUPPORTED_CHAIN_IDS = Object.freeze([1, 10, 130, 146, 8453, 9745, 57073, 42161, 98866]);
|
|
1276
|
-
var STABLEGENIE_SUPPORTED_ASSETS = Object.freeze(["USDC", "USDE", "
|
|
1986
|
+
var STABLEGENIE_SUPPORTED_ASSETS = Object.freeze(["USDC", "USDT", "USDE", "USDTB", "AUSD", "PYUSD", "USDG", "USD1", "WM", "USDS", "DAI", "RLUSD", "XAUT", "NALPHA", "NTBILL", "NBASIS", "NCREDIT", "NOPAL", "NWISDOM", "NACRDX", "NLCRD", "NAXI", "NCLOA", "NFALCON", "DEJAAA", "DESPXA"]);
|
|
1277
1987
|
var stableGenieIntentSchema = {
|
|
1278
1988
|
type: "object",
|
|
1279
1989
|
additionalProperties: false,
|
|
@@ -1303,7 +2013,10 @@ var stableGenieIntentSchema = {
|
|
|
1303
2013
|
required: ["address", "chainId", "asset", "amount"],
|
|
1304
2014
|
properties: {
|
|
1305
2015
|
address: { type: "string", pattern: "^0x[a-fA-F0-9]{40}$" },
|
|
1306
|
-
|
|
2016
|
+
// A DESTINATION chain, so it is bounded by shape, not by the escrow-chain list: a payment may
|
|
2017
|
+
// be delivered on any chain the gateway publishes a route to (~31 of them), while only the
|
|
2018
|
+
// nine escrow chains can SEND one. See validateDestination in plan.ts.
|
|
2019
|
+
chainId: { type: "integer", minimum: 1 },
|
|
1307
2020
|
chainName: { type: "string", maxLength: 64 },
|
|
1308
2021
|
asset: { type: "string", enum: STABLEGENIE_SUPPORTED_ASSETS },
|
|
1309
2022
|
amount: { type: "string", pattern: "^(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?$" }
|
|
@@ -1609,7 +2322,26 @@ function createEngine(config = {}) {
|
|
|
1609
2322
|
fetchChains: api.fetchChains,
|
|
1610
2323
|
fetchTokens: api.fetchTokens,
|
|
1611
2324
|
fetchRoutes: api.fetchRoutes,
|
|
2325
|
+
fetchRouteHealth: api.fetchRouteHealth,
|
|
1612
2326
|
fetchQuote: api.fetchQuote,
|
|
2327
|
+
fetchCatalogue: async (allowedAssets, product) => {
|
|
2328
|
+
const [chains, tokens, routes, health] = await Promise.all([
|
|
2329
|
+
api.fetchChains().catch(() => []),
|
|
2330
|
+
api.fetchTokens().catch(() => []),
|
|
2331
|
+
api.fetchRoutes().catch(() => []),
|
|
2332
|
+
api.fetchRouteHealth()
|
|
2333
|
+
]);
|
|
2334
|
+
const allowed = allowedAssets?.length ? new Set([...allowedAssets].map(symbolKey).filter((a) => SUPPORTED_ASSETS.has(a))) : void 0;
|
|
2335
|
+
return buildCatalogue({
|
|
2336
|
+
chains,
|
|
2337
|
+
tokens,
|
|
2338
|
+
routes,
|
|
2339
|
+
product,
|
|
2340
|
+
...allowed ? { allowedAssets: allowed } : {},
|
|
2341
|
+
supportedChainIds: SUPPORTED_CHAIN_IDS,
|
|
2342
|
+
brokenLanes: suppressedLanes(health)
|
|
2343
|
+
});
|
|
2344
|
+
},
|
|
1613
2345
|
fetchPaymentPlan: (request, payer, wallet) => fetchPaymentPlan(api, request, payer, wallet, verifier.readBalances),
|
|
1614
2346
|
quoteSwapPreview: (swap, owner) => quoteSwapPreview(api, swap, owner),
|
|
1615
2347
|
buildSwapPlan: (swap, payer, wallet) => buildSwapPlan(api, swap, payer, wallet),
|
|
@@ -1629,16 +2361,24 @@ function createEngine(config = {}) {
|
|
|
1629
2361
|
}
|
|
1630
2362
|
|
|
1631
2363
|
exports.API_CACHE_TTL_MS = API_CACHE_TTL_MS;
|
|
2364
|
+
exports.BLOCK_LABEL_DEFAULT = BLOCK_LABEL_DEFAULT;
|
|
1632
2365
|
exports.BUNDLED_NATIVE_SYMBOL = BUNDLED_NATIVE_SYMBOL;
|
|
1633
2366
|
exports.BUNDLED_RPC = BUNDLED_RPC;
|
|
1634
2367
|
exports.CANONICAL_DECIMALS = CANONICAL_DECIMALS;
|
|
1635
2368
|
exports.CANONICAL_ESCROW = CANONICAL_ESCROW;
|
|
1636
2369
|
exports.CANONICAL_INBOUND_BRIDGE = CANONICAL_INBOUND_BRIDGE;
|
|
2370
|
+
exports.CHAIN_DISPLAY_NAMES = CHAIN_DISPLAY_NAMES;
|
|
2371
|
+
exports.COMPLIANCE_CHECK_ORDER = COMPLIANCE_CHECK_ORDER;
|
|
2372
|
+
exports.COMPLIANCE_DENY_LABEL = COMPLIANCE_DENY_LABEL;
|
|
1637
2373
|
exports.DEFAULT_WIDGET_API_BASE = DEFAULT_WIDGET_API_BASE;
|
|
2374
|
+
exports.DIRECT_CHECK_IDS = DIRECT_CHECK_IDS;
|
|
2375
|
+
exports.DIRECT_SCOPE_NOTE = DIRECT_SCOPE_NOTE;
|
|
1638
2376
|
exports.ERC20_ALLOWANCE_SELECTOR = ERC20_ALLOWANCE_SELECTOR;
|
|
1639
2377
|
exports.ERC20_APPROVE_SELECTOR = ERC20_APPROVE_SELECTOR;
|
|
1640
2378
|
exports.ERC20_BALANCEOF_SELECTOR = ERC20_BALANCEOF_SELECTOR;
|
|
1641
2379
|
exports.ERC20_TRANSFER_SELECTOR = ERC20_TRANSFER_SELECTOR;
|
|
2380
|
+
exports.EXECUTABLE_STABLE_ASSETS = EXECUTABLE_STABLE_ASSETS;
|
|
2381
|
+
exports.FLOOR_CATEGORIES = FLOOR_CATEGORIES;
|
|
1642
2382
|
exports.LZ_FEE_BUFFER_BPS = LZ_FEE_BUFFER_BPS;
|
|
1643
2383
|
exports.MAX_LZ_MSG_VALUE_WEI = MAX_LZ_MSG_VALUE_WEI;
|
|
1644
2384
|
exports.MAX_LZ_MSG_VALUE_WEI_BY_CHAIN = MAX_LZ_MSG_VALUE_WEI_BY_CHAIN;
|
|
@@ -1649,13 +2389,18 @@ exports.NO_PARTNER_ID = NO_PARTNER_ID;
|
|
|
1649
2389
|
exports.PREVIEW_OWNER = PREVIEW_OWNER;
|
|
1650
2390
|
exports.QUOTE_BUFFER_BPS = QUOTE_BUFFER_BPS;
|
|
1651
2391
|
exports.SAME_CLASS_STABLE = SAME_CLASS_STABLE;
|
|
2392
|
+
exports.SCREENING_BUCKETS = SCREENING_BUCKETS;
|
|
2393
|
+
exports.SCREEN_CACHE_TTL_MS = SCREEN_CACHE_TTL_MS;
|
|
1652
2394
|
exports.STABLEGENIE_INTENT_TTL_MS = STABLEGENIE_INTENT_TTL_MS;
|
|
1653
2395
|
exports.STABLEGENIE_INTENT_VERSION = STABLEGENIE_INTENT_VERSION;
|
|
1654
2396
|
exports.STABLEGENIE_SUPPORTED_ASSETS = STABLEGENIE_SUPPORTED_ASSETS;
|
|
1655
2397
|
exports.STABLEGENIE_SUPPORTED_CHAIN_IDS = STABLEGENIE_SUPPORTED_CHAIN_IDS;
|
|
2398
|
+
exports.STABLE_ASSETS = STABLE_ASSETS;
|
|
1656
2399
|
exports.SUBMIT_ORDER_SELECTOR = SUBMIT_ORDER_SELECTOR;
|
|
1657
2400
|
exports.SUPPORTED_ASSETS = SUPPORTED_ASSETS;
|
|
1658
2401
|
exports.SUPPORTED_CHAIN_IDS = SUPPORTED_CHAIN_IDS;
|
|
2402
|
+
exports.TRADEABLE_RWA_ASSETS = TRADEABLE_RWA_ASSETS;
|
|
2403
|
+
exports.TUNABLE_CATEGORIES = TUNABLE_CATEGORIES;
|
|
1659
2404
|
exports.ZERO_ADDRESS = ZERO_ADDRESS;
|
|
1660
2405
|
exports.addressWord = addressWord;
|
|
1661
2406
|
exports.allowanceCovers = allowanceCovers;
|
|
@@ -1663,39 +2408,67 @@ exports.apiError = apiError;
|
|
|
1663
2408
|
exports.applyLayerZeroBuffer = applyLayerZeroBuffer;
|
|
1664
2409
|
exports.assertAddress = assertAddress;
|
|
1665
2410
|
exports.assertQuoteMatchesSelection = assertQuoteMatchesSelection;
|
|
2411
|
+
exports.assetClassOf = assetClassOf;
|
|
1666
2412
|
exports.assetDecimals = assetDecimals;
|
|
2413
|
+
exports.blockLabelFor = blockLabelFor;
|
|
2414
|
+
exports.brokenLaneFor = brokenLaneFor;
|
|
2415
|
+
exports.brokenLaneReason = brokenLaneReason;
|
|
2416
|
+
exports.buildCatalogue = buildCatalogue;
|
|
1667
2417
|
exports.buildPayOptions = buildPayOptions;
|
|
1668
2418
|
exports.buildRoute = buildRoute;
|
|
1669
2419
|
exports.buildSwapPlan = buildSwapPlan;
|
|
1670
2420
|
exports.bytes32Word = bytes32Word;
|
|
1671
2421
|
exports.bytesPayload = bytesPayload;
|
|
1672
2422
|
exports.canAttachApiKey = canAttachApiKey;
|
|
2423
|
+
exports.categoryLabel = categoryLabel;
|
|
1673
2424
|
exports.chainById = chainById;
|
|
1674
2425
|
exports.chainNameOf = chainNameOf;
|
|
1675
2426
|
exports.chainSelectable = chainSelectable;
|
|
1676
2427
|
exports.checkEscrow = checkEscrow;
|
|
1677
2428
|
exports.checkNativeFee = checkNativeFee;
|
|
1678
2429
|
exports.classifyQuoteError = classifyQuoteError;
|
|
2430
|
+
exports.complianceChecks = complianceChecks;
|
|
2431
|
+
exports.complianceControlsEvaluated = complianceControlsEvaluated;
|
|
2432
|
+
exports.complianceControlsLine = complianceControlsLine;
|
|
2433
|
+
exports.complianceReasonHead = complianceReasonHead;
|
|
2434
|
+
exports.complianceReasonTag = complianceReasonTag;
|
|
2435
|
+
exports.complianceTagOf = complianceTagOf;
|
|
2436
|
+
exports.complianceView = complianceView;
|
|
2437
|
+
exports.counterpartTokens = counterpartTokens;
|
|
1679
2438
|
exports.createApiClient = createApiClient;
|
|
1680
2439
|
exports.createEngine = createEngine;
|
|
1681
2440
|
exports.createVerifier = createVerifier;
|
|
1682
2441
|
exports.decodeSubmitOrderCalldata = decodeSubmitOrderCalldata;
|
|
2442
|
+
exports.destinationAvailability = destinationAvailability;
|
|
2443
|
+
exports.destinationKeys = destinationKeys;
|
|
2444
|
+
exports.directComplianceFromScreens = directComplianceFromScreens;
|
|
2445
|
+
exports.distinctScreenedWallets = distinctScreenedWallets;
|
|
1683
2446
|
exports.encodeAllowance = encodeAllowance;
|
|
1684
2447
|
exports.encodeApprove = encodeApprove;
|
|
1685
2448
|
exports.encodeBalanceOf = encodeBalanceOf;
|
|
1686
2449
|
exports.encodeSubmitOrder = encodeSubmitOrder;
|
|
1687
2450
|
exports.encodeTransfer = encodeTransfer;
|
|
2451
|
+
exports.executableRoutes = executableRoutes;
|
|
2452
|
+
exports.executionChainIds = executionChainIds;
|
|
1688
2453
|
exports.fetchPaymentPlan = fetchPaymentPlan;
|
|
1689
2454
|
exports.finalOf = finalOf;
|
|
1690
2455
|
exports.findToken = findToken;
|
|
1691
2456
|
exports.formatNative = formatNative;
|
|
1692
2457
|
exports.formatUnits = formatUnits;
|
|
2458
|
+
exports.hasReachableDestination = hasReachableDestination;
|
|
2459
|
+
exports.hubDeliverableSymbols = hubDeliverableSymbols;
|
|
2460
|
+
exports.humanizeComplianceReason = humanizeComplianceReason;
|
|
1693
2461
|
exports.isAddress = isAddress;
|
|
1694
2462
|
exports.isDeliverable = isDeliverable;
|
|
2463
|
+
exports.isExecutableBridge = isExecutableBridge;
|
|
1695
2464
|
exports.isHexAddress = isHexAddress;
|
|
1696
2465
|
exports.isHexData = isHexData;
|
|
1697
2466
|
exports.isHexQuantity = isHexQuantity;
|
|
2467
|
+
exports.isKnownUnbridgeable = isKnownUnbridgeable;
|
|
1698
2468
|
exports.isLayerZeroRoute = isLayerZeroRoute;
|
|
2469
|
+
exports.isSourceToken = isSourceToken;
|
|
2470
|
+
exports.laneKey = laneKey;
|
|
2471
|
+
exports.laneKeys = laneKeys;
|
|
1699
2472
|
exports.maxNativeFeeWei = maxNativeFeeWei;
|
|
1700
2473
|
exports.nativeFeeShortLabel = nativeFeeShortLabel;
|
|
1701
2474
|
exports.nativeFeeShortMessage = nativeFeeShortMessage;
|
|
@@ -1708,6 +2481,7 @@ exports.parseAllowedApiBase = parseAllowedApiBase;
|
|
|
1708
2481
|
exports.parseUnitsDecimal = parseUnitsDecimal;
|
|
1709
2482
|
exports.planErrorSummary = planErrorSummary;
|
|
1710
2483
|
exports.planMsgValueHex = planMsgValueHex;
|
|
2484
|
+
exports.productAssets = productAssets;
|
|
1711
2485
|
exports.quoteSwapPreview = quoteSwapPreview;
|
|
1712
2486
|
exports.registryRpc = registryRpc;
|
|
1713
2487
|
exports.requiresNativeBridgeFee = requiresNativeBridgeFee;
|
|
@@ -1716,16 +2490,21 @@ exports.resolveConfig = resolveConfig;
|
|
|
1716
2490
|
exports.resolveSwapReceiver = resolveSwapReceiver;
|
|
1717
2491
|
exports.routeNativeValue = routeNativeValue;
|
|
1718
2492
|
exports.scaleDecimals = scaleDecimals;
|
|
2493
|
+
exports.screeningOutcomeOf = screeningOutcomeOf;
|
|
1719
2494
|
exports.solveExactIn = solveExactIn;
|
|
1720
2495
|
exports.solveExactOut = solveExactOut;
|
|
2496
|
+
exports.sourceKeys = sourceKeys;
|
|
1721
2497
|
exports.stableGenieIntentSchema = stableGenieIntentSchema;
|
|
1722
2498
|
exports.strip0x = strip0x;
|
|
2499
|
+
exports.suppressedLanes = suppressedLanes;
|
|
1723
2500
|
exports.symbolKey = symbolKey;
|
|
1724
2501
|
exports.toHexQuantity = toHexQuantity;
|
|
1725
2502
|
exports.tokenEnabled = tokenEnabled;
|
|
2503
|
+
exports.tokenKey = tokenKey;
|
|
1726
2504
|
exports.txMatchesPlan = txMatchesPlan;
|
|
1727
2505
|
exports.uint64Word = uint64Word;
|
|
1728
2506
|
exports.uintWord = uintWord;
|
|
2507
|
+
exports.unattributedComplianceReasons = unattributedComplianceReasons;
|
|
1729
2508
|
exports.validateDestination = validateDestination;
|
|
1730
2509
|
exports.validatePlannedTransaction = validatePlannedTransaction;
|
|
1731
2510
|
exports.validateSwap = validateSwap;
|