@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/mount.cjs
CHANGED
|
@@ -14,8 +14,29 @@ function useMergedConfig(local) {
|
|
|
14
14
|
// src/core/constants.ts
|
|
15
15
|
var DEFAULT_WIDGET_API_BASE = "/api/widget/v1";
|
|
16
16
|
var SUPPORTED_CHAIN_IDS = /* @__PURE__ */ new Set([1, 10, 42161, 8453, 57073, 130, 9745, 146, 98866]);
|
|
17
|
-
var
|
|
17
|
+
var EXECUTABLE_STABLE_ASSETS = /* @__PURE__ */ new Set(["USDC", "USDT", "USDE", "USDTB", "AUSD", "PYUSD", "USDG"]);
|
|
18
|
+
var STABLE_ASSETS = /* @__PURE__ */ new Set([...EXECUTABLE_STABLE_ASSETS, "USD1", "WM", "USDS", "DAI", "RLUSD"]);
|
|
19
|
+
var TRADEABLE_RWA_ASSETS = /* @__PURE__ */ new Set([
|
|
20
|
+
"XAUT",
|
|
21
|
+
// Nest vault shares — chained delivery on Plume, sellable from their Ethereum deployment.
|
|
22
|
+
"NALPHA",
|
|
23
|
+
"NTBILL",
|
|
24
|
+
"NBASIS",
|
|
25
|
+
"NCREDIT",
|
|
26
|
+
"NOPAL",
|
|
27
|
+
"NWISDOM",
|
|
28
|
+
"NACRDX",
|
|
29
|
+
"NLCRD",
|
|
30
|
+
"NAXI",
|
|
31
|
+
"NCLOA",
|
|
32
|
+
"NFALCON",
|
|
33
|
+
// Centrifuge deRWA pair — chained asks on Base.
|
|
34
|
+
"DEJAAA",
|
|
35
|
+
"DESPXA"
|
|
36
|
+
]);
|
|
37
|
+
var SUPPORTED_ASSETS = /* @__PURE__ */ new Set([...STABLE_ASSETS, ...TRADEABLE_RWA_ASSETS]);
|
|
18
38
|
var API_CACHE_TTL_MS = 6e4;
|
|
39
|
+
var SCREEN_CACHE_TTL_MS = 5 * 6e4;
|
|
19
40
|
var MAX_QUOTE_CANDIDATES = 8;
|
|
20
41
|
var QUOTE_BUFFER_BPS = 50;
|
|
21
42
|
var LZ_FEE_BUFFER_BPS = 1500n;
|
|
@@ -27,7 +48,41 @@ var ERC20_ALLOWANCE_SELECTOR = "0xdd62ed3e";
|
|
|
27
48
|
var ERC20_BALANCEOF_SELECTOR = "0x70a08231";
|
|
28
49
|
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
29
50
|
var PREVIEW_OWNER = "0x1111111111111111111111111111111111111111";
|
|
30
|
-
var CANONICAL_DECIMALS = {
|
|
51
|
+
var CANONICAL_DECIMALS = {
|
|
52
|
+
USDC: 6,
|
|
53
|
+
USDT: 6,
|
|
54
|
+
USDE: 18,
|
|
55
|
+
XAUT: 6,
|
|
56
|
+
// Added 2026-09-08 with the dapp-parity asset expansion. Every value below was read from the
|
|
57
|
+
// token contract itself — `eth_call decimals()` against each deployment the registry lists on the
|
|
58
|
+
// nine escrow chains — and each symbol answered the SAME number on every chain it is deployed on.
|
|
59
|
+
// The set is a deliberate mix of 6 and 18, and a copy-pasted row is wrong by a factor of 1e12
|
|
60
|
+
// while still looking entirely plausible in review; that is the bug this pin exists to prevent.
|
|
61
|
+
USDTB: 18,
|
|
62
|
+
AUSD: 6,
|
|
63
|
+
PYUSD: 6,
|
|
64
|
+
USDG: 6,
|
|
65
|
+
// The wider stable list — the bid side of an RWA trade.
|
|
66
|
+
DAI: 18,
|
|
67
|
+
RLUSD: 18,
|
|
68
|
+
USD1: 18,
|
|
69
|
+
USDS: 18,
|
|
70
|
+
WM: 6,
|
|
71
|
+
// Real-world assets. Every Nest vault share is 6; the Centrifuge pair is 18.
|
|
72
|
+
NALPHA: 6,
|
|
73
|
+
NTBILL: 6,
|
|
74
|
+
NBASIS: 6,
|
|
75
|
+
NCREDIT: 6,
|
|
76
|
+
NOPAL: 6,
|
|
77
|
+
NWISDOM: 6,
|
|
78
|
+
NACRDX: 6,
|
|
79
|
+
NLCRD: 6,
|
|
80
|
+
NAXI: 6,
|
|
81
|
+
NCLOA: 6,
|
|
82
|
+
NFALCON: 6,
|
|
83
|
+
DEJAAA: 18,
|
|
84
|
+
DESPXA: 18
|
|
85
|
+
};
|
|
31
86
|
var CANONICAL_ESCROW = Object.freeze({
|
|
32
87
|
1: "0x5e25c8ABc19b88d6A7Ab0D805C77A34987a68b40",
|
|
33
88
|
// Ethereum
|
|
@@ -57,9 +112,40 @@ var CANONICAL_INBOUND_BRIDGE = {
|
|
|
57
112
|
USDC: "cctp",
|
|
58
113
|
USDT: "layerzero",
|
|
59
114
|
USDE: "layerzero",
|
|
60
|
-
XAUT: "layerzero"
|
|
115
|
+
XAUT: "layerzero",
|
|
116
|
+
// 2026-09-08: the four assets added for dapp parity are all LayerZero V2 OFTs on every chain the
|
|
117
|
+
// registry lists them on (`standard: "LayerZeroV2OFT"`, verified against dev and prod /tokens).
|
|
118
|
+
// USDC remains the only CCTP asset.
|
|
119
|
+
USDTB: "layerzero",
|
|
120
|
+
AUSD: "layerzero",
|
|
121
|
+
PYUSD: "layerzero",
|
|
122
|
+
USDG: "layerzero",
|
|
123
|
+
// `"none"` is a POSITIVE statement, not a gap: these assets have no inbound bridge adapter at all
|
|
124
|
+
// (the registry says `bridge: "None"`, or ships no bridge field at all), so they can only ever be
|
|
125
|
+
// bid on the chain the order already executes on and can never legitimately owe a native
|
|
126
|
+
// LayerZero fee. Pinning them matters because the fallback for an UNpinned asset is the label
|
|
127
|
+
// sniff, and a hostile quote controls the label — `bridge: "layerzero"` on one of these would
|
|
128
|
+
// otherwise let it attach msg.value to an order that forwards none, stranding it in the escrow.
|
|
129
|
+
DAI: "none",
|
|
130
|
+
RLUSD: "none",
|
|
131
|
+
USD1: "none",
|
|
132
|
+
USDS: "none",
|
|
133
|
+
WM: "none",
|
|
134
|
+
NALPHA: "none",
|
|
135
|
+
NTBILL: "none",
|
|
136
|
+
NBASIS: "none",
|
|
137
|
+
NCREDIT: "none",
|
|
138
|
+
NOPAL: "none",
|
|
139
|
+
NWISDOM: "none",
|
|
140
|
+
NACRDX: "none",
|
|
141
|
+
NLCRD: "none",
|
|
142
|
+
NAXI: "none",
|
|
143
|
+
NCLOA: "none",
|
|
144
|
+
NFALCON: "none",
|
|
145
|
+
DEJAAA: "none",
|
|
146
|
+
DESPXA: "none"
|
|
61
147
|
};
|
|
62
|
-
var SAME_CLASS_STABLE =
|
|
148
|
+
var SAME_CLASS_STABLE = new Set(STABLE_ASSETS);
|
|
63
149
|
var MAX_SAME_CLASS_PAY_BPS = 30000n;
|
|
64
150
|
var BUNDLED_NATIVE_SYMBOL = {
|
|
65
151
|
1: "ETH",
|
|
@@ -82,6 +168,55 @@ var BUNDLED_RPC = {
|
|
|
82
168
|
42161: "https://arb1.arbitrum.io/rpc",
|
|
83
169
|
98866: "https://rpc.plume.org"
|
|
84
170
|
};
|
|
171
|
+
var CHAIN_DISPLAY_NAMES = Object.freeze({
|
|
172
|
+
1: "Ethereum",
|
|
173
|
+
10: "Optimism",
|
|
174
|
+
14: "Flare",
|
|
175
|
+
30: "Rootstock",
|
|
176
|
+
50: "XDC Network",
|
|
177
|
+
56: "BNB Chain",
|
|
178
|
+
88: "Viction",
|
|
179
|
+
130: "Unichain",
|
|
180
|
+
137: "Polygon",
|
|
181
|
+
143: "Monad",
|
|
182
|
+
146: "Sonic",
|
|
183
|
+
151: "Redbelly Network",
|
|
184
|
+
169: "Manta Pacific",
|
|
185
|
+
196: "X Layer",
|
|
186
|
+
252: "Fraxtal",
|
|
187
|
+
324: "zkSync Era",
|
|
188
|
+
480: "World Chain",
|
|
189
|
+
988: "Stable",
|
|
190
|
+
999: "HyperEVM",
|
|
191
|
+
1030: "Conflux eSpace",
|
|
192
|
+
1088: "Metis",
|
|
193
|
+
1135: "Lisk",
|
|
194
|
+
1329: "Sei",
|
|
195
|
+
1776: "Injective EVM",
|
|
196
|
+
1868: "Soneium",
|
|
197
|
+
1923: "Swellchain",
|
|
198
|
+
2222: "Kava",
|
|
199
|
+
2818: "Morph",
|
|
200
|
+
3343: "EDGE",
|
|
201
|
+
4326: "MegaETH",
|
|
202
|
+
5e3: "Mantle",
|
|
203
|
+
8453: "Base",
|
|
204
|
+
9745: "Plasma",
|
|
205
|
+
34443: "Mode",
|
|
206
|
+
42161: "Arbitrum One",
|
|
207
|
+
43114: "Avalanche C-Chain",
|
|
208
|
+
48900: "Zircuit",
|
|
209
|
+
57073: "Ink",
|
|
210
|
+
59144: "Linea",
|
|
211
|
+
80094: "Berachain",
|
|
212
|
+
81224: "Codex",
|
|
213
|
+
81457: "Blast",
|
|
214
|
+
98866: "Plume",
|
|
215
|
+
534352: "Scroll",
|
|
216
|
+
747474: "Katana",
|
|
217
|
+
7777777: "Zora",
|
|
218
|
+
21e6: "Corn"
|
|
219
|
+
});
|
|
85
220
|
|
|
86
221
|
// src/core/address.ts
|
|
87
222
|
function symbolKey(value) {
|
|
@@ -346,18 +481,133 @@ function applyLayerZeroBuffer(quote, option = {}) {
|
|
|
346
481
|
return gas * (10000n + LZ_FEE_BUFFER_BPS) / 10000n;
|
|
347
482
|
}
|
|
348
483
|
|
|
484
|
+
// src/core/availability.ts
|
|
485
|
+
function assetClassOf(symbol) {
|
|
486
|
+
const key = symbolKey(symbol);
|
|
487
|
+
if (TRADEABLE_RWA_ASSETS.has(key)) return "rwa";
|
|
488
|
+
if (STABLE_ASSETS.has(key)) return "stable";
|
|
489
|
+
return null;
|
|
490
|
+
}
|
|
491
|
+
function productAssets(product) {
|
|
492
|
+
return product === "rwa" ? /* @__PURE__ */ new Set([...STABLE_ASSETS, ...TRADEABLE_RWA_ASSETS]) : EXECUTABLE_STABLE_ASSETS;
|
|
493
|
+
}
|
|
494
|
+
function counterpartTokens(tokens, selected) {
|
|
495
|
+
const want = assetClassOf(selected?.symbol) === "rwa" ? "stable" : "rwa";
|
|
496
|
+
return tokens.filter((token) => assetClassOf(token.symbol) === want);
|
|
497
|
+
}
|
|
498
|
+
function tokenKey(chainId, address) {
|
|
499
|
+
return `${Number(chainId)}:${String(address || "").toLowerCase()}`;
|
|
500
|
+
}
|
|
501
|
+
function laneKey(fromChainId, fromAddress, toChainId, toAddress) {
|
|
502
|
+
return `${tokenKey(fromChainId, fromAddress)}>${tokenKey(toChainId, toAddress)}`;
|
|
503
|
+
}
|
|
504
|
+
function isExecutableBridge(descriptor) {
|
|
505
|
+
const bridge = descriptor?.bridge?.trim().toLowerCase();
|
|
506
|
+
const standard = descriptor?.standard?.replace(/[\s_-]/g, "").toLowerCase();
|
|
507
|
+
return (bridge === "circle" || bridge === "cctp") && standard === "cctpv2" || bridge === "layerzero" && standard === "layerzerov2oft";
|
|
508
|
+
}
|
|
509
|
+
function isKnownUnbridgeable(bridge) {
|
|
510
|
+
return typeof bridge === "string" && bridge.trim().toLowerCase() === "none";
|
|
511
|
+
}
|
|
512
|
+
function executableRoutes(routes) {
|
|
513
|
+
return routes.filter((route) => route.isEnabled !== false && isExecutableBridge(route));
|
|
514
|
+
}
|
|
515
|
+
function sourceKeys(routes) {
|
|
516
|
+
return new Set(routes.filter((r) => r.isEnabled !== false).map((r) => tokenKey(r.fromChainId, r.fromAddress ?? "")));
|
|
517
|
+
}
|
|
518
|
+
function destinationKeys(routes) {
|
|
519
|
+
return new Set(routes.filter((r) => r.isEnabled !== false).map((r) => tokenKey(r.toChainId, r.toAddress ?? "")));
|
|
520
|
+
}
|
|
521
|
+
function laneKeys(routes) {
|
|
522
|
+
return new Set(routes.filter((r) => r.isEnabled !== false).map((r) => laneKey(r.fromChainId, r.fromAddress ?? "", r.toChainId, r.toAddress ?? "")));
|
|
523
|
+
}
|
|
524
|
+
function executionChainIds(chains) {
|
|
525
|
+
return new Set(chains.filter((c) => c.isEnabled !== false && c.isExecutionChain === true).map((c) => Number(c.chainId)));
|
|
526
|
+
}
|
|
527
|
+
function hubDeliverableSymbols(tokens, execution) {
|
|
528
|
+
return new Set(tokens.filter((t) => execution.has(Number(t.chainId))).map((t) => symbolKey(t.symbol)));
|
|
529
|
+
}
|
|
530
|
+
function isSourceToken(token, ctx) {
|
|
531
|
+
const chainId = Number(token.chainId);
|
|
532
|
+
if (!ctx.sourceChains.has(chainId)) return false;
|
|
533
|
+
return ctx.execution.has(chainId) || !isKnownUnbridgeable(token.bridge) && ctx.source.has(tokenKey(chainId, token.address));
|
|
534
|
+
}
|
|
535
|
+
function directLaneOK(token, source, lanes) {
|
|
536
|
+
if (!source || !lanes) return true;
|
|
537
|
+
if (symbolKey(source.symbol) !== symbolKey(token.symbol)) return true;
|
|
538
|
+
if (Number(source.chainId) === Number(token.chainId)) return true;
|
|
539
|
+
return lanes.has(laneKey(source.chainId, source.address, token.chainId, token.address));
|
|
540
|
+
}
|
|
541
|
+
function brokenLaneFor(token, source, brokenLanes) {
|
|
542
|
+
if (!source || !brokenLanes) return void 0;
|
|
543
|
+
return brokenLanes.get(laneKey(source.chainId, source.address, token.chainId, token.address));
|
|
544
|
+
}
|
|
545
|
+
function destinationAvailability(token, ctx, source) {
|
|
546
|
+
if (brokenLaneFor(token, source ?? void 0, ctx.brokenLanes)) return "unreachable";
|
|
547
|
+
if (ctx.execution.has(Number(token.chainId))) return "available";
|
|
548
|
+
if (token.isChainedDestination === true) return "available";
|
|
549
|
+
if (!isKnownUnbridgeable(token.bridge) && ctx.destination.has(tokenKey(token.chainId, token.address)) && directLaneOK(token, source ?? void 0, ctx.lanes)) {
|
|
550
|
+
return "available";
|
|
551
|
+
}
|
|
552
|
+
return ctx.hubSymbols.has(symbolKey(token.symbol)) ? "hub-only" : "unreachable";
|
|
553
|
+
}
|
|
554
|
+
function hasReachableDestination(source, catalogue, ctx) {
|
|
555
|
+
if (catalogue.length === 0) return true;
|
|
556
|
+
const from = tokenKey(source.chainId, source.address);
|
|
557
|
+
for (const candidate of catalogue) {
|
|
558
|
+
if (tokenKey(candidate.chainId, candidate.address) === from) continue;
|
|
559
|
+
if (destinationAvailability(candidate, ctx, source) === "available") return true;
|
|
560
|
+
}
|
|
561
|
+
return false;
|
|
562
|
+
}
|
|
563
|
+
function buildCatalogue(input) {
|
|
564
|
+
const { chains, tokens, routes, supportedChainIds, brokenLanes } = input;
|
|
565
|
+
const product = input.product ?? "stable";
|
|
566
|
+
const universe = productAssets(product);
|
|
567
|
+
const allowedAssets = input.allowedAssets ? new Set([...input.allowedAssets].filter((a) => universe.has(a))) : universe;
|
|
568
|
+
const enabledChains = chains.filter((c) => c.isEnabled !== false);
|
|
569
|
+
const registryChainIds = new Set(enabledChains.map((c) => Number(c.chainId)));
|
|
570
|
+
const sourceChains = new Set([...registryChainIds].filter((id) => supportedChainIds.has(id)));
|
|
571
|
+
const execution = executionChainIds(enabledChains);
|
|
572
|
+
const projected = product === "rwa" ? routes.filter((route) => route.isEnabled !== false) : executableRoutes(routes);
|
|
573
|
+
const source = sourceKeys(projected);
|
|
574
|
+
const destination = destinationKeys(projected);
|
|
575
|
+
const lanes = laneKeys(projected);
|
|
576
|
+
const chainIds = new Set(sourceChains);
|
|
577
|
+
for (const route of projected) {
|
|
578
|
+
const id = Number(route.toChainId);
|
|
579
|
+
if (Number.isSafeInteger(id) && id > 0) chainIds.add(id);
|
|
580
|
+
}
|
|
581
|
+
const allowed = tokens.filter((token) => token.isEnabled !== false && allowedAssets.has(symbolKey(token.symbol)));
|
|
582
|
+
const projectedCatalogue = allowed.filter((token) => {
|
|
583
|
+
if (!chainIds.has(Number(token.chainId))) return false;
|
|
584
|
+
if (product === "rwa") return true;
|
|
585
|
+
if (!isExecutableBridge(token)) return false;
|
|
586
|
+
const key = tokenKey(token.chainId, token.address);
|
|
587
|
+
return source.has(key) || destination.has(key) || execution.has(Number(token.chainId));
|
|
588
|
+
});
|
|
589
|
+
const ready = chains.length > 0 && routes.length > 0 && projectedCatalogue.length > 0;
|
|
590
|
+
const catalogue = ready ? projectedCatalogue : allowed;
|
|
591
|
+
const hubSymbols = hubDeliverableSymbols(catalogue, execution);
|
|
592
|
+
const ctx = { source, destination, lanes, execution, sourceChains, hubSymbols, ...brokenLanes ? { brokenLanes } : {} };
|
|
593
|
+
const sources = ready ? catalogue.filter((token) => isSourceToken(token, ctx) && hasReachableDestination(token, catalogue, ctx)) : (
|
|
594
|
+
// Unprojected: the only rule we can still apply with confidence is the escrow-chain bound,
|
|
595
|
+
// which comes from this build's own pins rather than from the registry.
|
|
596
|
+
catalogue.filter((token) => sourceChains.has(Number(token.chainId)))
|
|
597
|
+
);
|
|
598
|
+
const byId = new Map(enabledChains.map((c) => [Number(c.chainId), c]));
|
|
599
|
+
for (const id of chainIds) if (!byId.has(id)) byId.set(id, { chainId: id, isEnabled: true });
|
|
600
|
+
return { ...ctx, product, tokens: catalogue, sources, chainIds, chains: [...byId.values()], ready };
|
|
601
|
+
}
|
|
602
|
+
|
|
349
603
|
// src/core/options.ts
|
|
350
604
|
function chainNameOf(chainId, chains) {
|
|
351
605
|
const chain = chains.find((item) => Number(item.chainId) === Number(chainId));
|
|
352
|
-
return chain?.displayName || chain?.name || `Chain ${chainId}`;
|
|
606
|
+
return chain?.displayName || chain?.name || CHAIN_DISPLAY_NAMES[Number(chainId)] || `Chain ${chainId}`;
|
|
353
607
|
}
|
|
354
608
|
function chainById(chains, chainId) {
|
|
355
609
|
return chains.find((chain) => Number(chain.chainId) === Number(chainId)) || null;
|
|
356
610
|
}
|
|
357
|
-
function isDeliverable(symbol, chainId) {
|
|
358
|
-
if (Number(chainId) === 8453 && symbolKey(symbol) === "USDT") return false;
|
|
359
|
-
return true;
|
|
360
|
-
}
|
|
361
611
|
function chainSelectable(chain, chainId) {
|
|
362
612
|
if (!SUPPORTED_CHAIN_IDS.has(Number(chainId))) return false;
|
|
363
613
|
if (!chain) return true;
|
|
@@ -370,45 +620,57 @@ function findToken(tokens, chainId, symbol) {
|
|
|
370
620
|
const key = symbolKey(symbol);
|
|
371
621
|
return tokens.find((token) => tokenEnabled(token) && Number(token.chainId) === Number(chainId) && symbolKey(token.symbol) === key) || null;
|
|
372
622
|
}
|
|
373
|
-
function buildPayOptions({ invoiceAsset, invoiceChainId, tokens, routes, chains, walletChainId }) {
|
|
623
|
+
function buildPayOptions({ invoiceAsset, invoiceChainId, tokens, routes, chains, walletChainId, catalogue }) {
|
|
374
624
|
const invoiceKey = symbolKey(invoiceAsset);
|
|
375
|
-
const
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
const key = symbolKey(token.symbol);
|
|
379
|
-
if (!tokenBySymbolAndChain.has(key)) tokenBySymbolAndChain.set(key, /* @__PURE__ */ new Map());
|
|
380
|
-
tokenBySymbolAndChain.get(key).set(Number(token.chainId), token);
|
|
381
|
-
}
|
|
625
|
+
const invoiceChain = Number(invoiceChainId);
|
|
626
|
+
const live = catalogue?.ready ? catalogue : null;
|
|
627
|
+
const destinationToken = findToken(tokens, invoiceChain, invoiceKey);
|
|
382
628
|
const routeBridge = /* @__PURE__ */ new Map();
|
|
383
629
|
for (const route of routes || []) {
|
|
384
|
-
if (route.isEnabled === false || Number(route.toChainId) !==
|
|
630
|
+
if (route.isEnabled === false || Number(route.toChainId) !== invoiceChain) continue;
|
|
385
631
|
routeBridge.set(`${symbolKey(route.tokenName || route.tokenId)}:${Number(route.fromChainId)}`, route.bridge);
|
|
386
632
|
routeBridge.set(`${symbolKey(route.tokenId)}:${Number(route.fromChainId)}`, route.bridge);
|
|
387
633
|
}
|
|
388
|
-
const
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
if (!direct && (!receiveDeliverable || !isDeliverable(payKey, chainId))) continue;
|
|
398
|
-
options.push({
|
|
399
|
-
symbol: token.symbol,
|
|
400
|
-
symbolKey: payKey,
|
|
401
|
-
name: token.name || token.symbol,
|
|
402
|
-
chainId,
|
|
403
|
-
chainName: chainNameOf(chainId, chains),
|
|
404
|
-
address: token.address,
|
|
405
|
-
decimals: assetDecimals(token),
|
|
406
|
-
logoUrl: token.logoUrl,
|
|
407
|
-
bridge: routeBridge.get(`${payKey}:${chainId}`) || token.bridge,
|
|
408
|
-
sameChain: chainId === Number(invoiceChainId),
|
|
409
|
-
direct
|
|
410
|
-
});
|
|
634
|
+
const knownLanes = live?.lanes && live.lanes.size > 0 ? live.lanes : null;
|
|
635
|
+
function refusal(token) {
|
|
636
|
+
const sameSymbol = symbolKey(token.symbol) === invoiceKey;
|
|
637
|
+
const sameChain = Number(token.chainId) === invoiceChain;
|
|
638
|
+
if (sameSymbol && sameChain) return null;
|
|
639
|
+
if (live && destinationToken && brokenLaneFor(destinationToken, token, live.brokenLanes)) return "measured";
|
|
640
|
+
if (live && !isSourceToken(token, live)) return "not-a-source";
|
|
641
|
+
if (sameSymbol && knownLanes && !knownLanes.has(laneKey(token.chainId, token.address, invoiceChain, destinationToken?.address ?? ""))) {
|
|
642
|
+
return "no-direct-lane";
|
|
411
643
|
}
|
|
644
|
+
if (live && destinationToken && destinationAvailability(destinationToken, live, token) !== "available") return "undeliverable";
|
|
645
|
+
return null;
|
|
646
|
+
}
|
|
647
|
+
const options = [];
|
|
648
|
+
const seen = /* @__PURE__ */ new Set();
|
|
649
|
+
const universe = live ? live.tokens : tokens;
|
|
650
|
+
for (const token of universe) {
|
|
651
|
+
if (!tokenEnabled(token)) continue;
|
|
652
|
+
const chainId = Number(token.chainId);
|
|
653
|
+
const chain = chainById(chains, chainId);
|
|
654
|
+
if (!chainSelectable(chain, chainId)) continue;
|
|
655
|
+
const key = tokenKey(chainId, token.address);
|
|
656
|
+
if (seen.has(key)) continue;
|
|
657
|
+
if (refusal(token)) continue;
|
|
658
|
+
seen.add(key);
|
|
659
|
+
const payKey = symbolKey(token.symbol);
|
|
660
|
+
const direct = chainId === invoiceChain && payKey === invoiceKey;
|
|
661
|
+
options.push({
|
|
662
|
+
symbol: token.symbol,
|
|
663
|
+
symbolKey: payKey,
|
|
664
|
+
name: token.name || token.symbol,
|
|
665
|
+
chainId,
|
|
666
|
+
chainName: chainNameOf(chainId, chains),
|
|
667
|
+
address: token.address,
|
|
668
|
+
decimals: assetDecimals(token),
|
|
669
|
+
logoUrl: token.logoUrl,
|
|
670
|
+
bridge: routeBridge.get(`${payKey}:${chainId}`) || token.bridge,
|
|
671
|
+
sameChain: chainId === invoiceChain,
|
|
672
|
+
direct
|
|
673
|
+
});
|
|
412
674
|
}
|
|
413
675
|
options.sort((a, b) => {
|
|
414
676
|
const walletChain = Number(walletChainId || 0);
|
|
@@ -467,6 +729,352 @@ function nativeFeeShortMessage(check, symbol, chainName2) {
|
|
|
467
729
|
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.`;
|
|
468
730
|
}
|
|
469
731
|
|
|
732
|
+
// src/core/route-health.ts
|
|
733
|
+
var EMPTY = /* @__PURE__ */ new Map();
|
|
734
|
+
function suppressedLanes(health) {
|
|
735
|
+
if (health?.mode !== "enforce" || !Array.isArray(health.lanes)) return EMPTY;
|
|
736
|
+
const out = /* @__PURE__ */ new Map();
|
|
737
|
+
for (const lane of health.lanes) {
|
|
738
|
+
if (lane?.status !== "broken") continue;
|
|
739
|
+
const key = typeof lane.laneKey === "string" ? lane.laneKey.toLowerCase() : "";
|
|
740
|
+
if (!key) continue;
|
|
741
|
+
out.set(key, {
|
|
742
|
+
route: typeof lane.route === "string" ? lane.route : "",
|
|
743
|
+
code: typeof lane.code === "string" ? lane.code : "",
|
|
744
|
+
message: typeof lane.message === "string" ? lane.message : "",
|
|
745
|
+
...typeof lane.kind === "string" ? { kind: lane.kind } : {}
|
|
746
|
+
});
|
|
747
|
+
}
|
|
748
|
+
return out;
|
|
749
|
+
}
|
|
750
|
+
function brokenLaneReason(lane) {
|
|
751
|
+
if (!lane) return "";
|
|
752
|
+
switch (lane.kind) {
|
|
753
|
+
case "bridge-throttled":
|
|
754
|
+
return "The issuer's bridge for this pair is closed right now.";
|
|
755
|
+
case "vault-closed":
|
|
756
|
+
return "This vault is not accepting deposits right now.";
|
|
757
|
+
default:
|
|
758
|
+
return "ZeroDelta could not price this pair in its latest check.";
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
// src/core/compliance.ts
|
|
763
|
+
var COMPLIANCE_DENY_LABEL = "Compliance check failed";
|
|
764
|
+
function complianceView(compliance, hasQuote = true) {
|
|
765
|
+
if (!hasQuote) {
|
|
766
|
+
return {
|
|
767
|
+
tone: "neutral",
|
|
768
|
+
label: "Compliance checks run with your quote",
|
|
769
|
+
headline: "No compliance decision for this payment yet",
|
|
770
|
+
blocked: false,
|
|
771
|
+
needsAction: false,
|
|
772
|
+
screened: false
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
const decision = compliance?.decision;
|
|
776
|
+
const screened = compliance?.status === "SCREENED";
|
|
777
|
+
if (decision === "DENY") {
|
|
778
|
+
return {
|
|
779
|
+
tone: "blocked",
|
|
780
|
+
label: COMPLIANCE_DENY_LABEL,
|
|
781
|
+
headline: "Blocked by compliance policy",
|
|
782
|
+
blocked: true,
|
|
783
|
+
needsAction: false,
|
|
784
|
+
screened
|
|
785
|
+
};
|
|
786
|
+
}
|
|
787
|
+
if (decision === "REVIEW" || decision === "REMEDIATE") {
|
|
788
|
+
const word = decision.toLowerCase();
|
|
789
|
+
return {
|
|
790
|
+
tone: "warn",
|
|
791
|
+
label: `Compliance: ${word} required`,
|
|
792
|
+
headline: `Manual ${word} required`,
|
|
793
|
+
blocked: false,
|
|
794
|
+
needsAction: true,
|
|
795
|
+
screened
|
|
796
|
+
};
|
|
797
|
+
}
|
|
798
|
+
if (decision === "ALLOW") {
|
|
799
|
+
return {
|
|
800
|
+
tone: "ok",
|
|
801
|
+
label: screened ? "Compliance checks passed" : "Allowed \u2014 wallets not screened",
|
|
802
|
+
headline: screened ? "Wallets screened and allowed" : "Allowed \u2014 wallets not screened",
|
|
803
|
+
blocked: false,
|
|
804
|
+
needsAction: false,
|
|
805
|
+
screened
|
|
806
|
+
};
|
|
807
|
+
}
|
|
808
|
+
return {
|
|
809
|
+
tone: "neutral",
|
|
810
|
+
label: screened ? "Screened \u2014 no policy decision returned" : "No compliance decision returned",
|
|
811
|
+
headline: screened ? "Screened \u2014 no policy decision returned" : "No compliance decision returned",
|
|
812
|
+
blocked: false,
|
|
813
|
+
needsAction: false,
|
|
814
|
+
screened
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
var CATEGORY_PHRASES = {
|
|
818
|
+
SANCTIONS: "sanctions",
|
|
819
|
+
TERRORISM_FINANCING: "terrorism financing",
|
|
820
|
+
STOLEN_FUNDS: "stolen funds",
|
|
821
|
+
RANSOMWARE: "ransomware",
|
|
822
|
+
SCAM: "scam activity",
|
|
823
|
+
DARKNET: "darknet activity",
|
|
824
|
+
MIXER: "mixer usage",
|
|
825
|
+
HIGH_RISK_ENTITY: "a high-risk entity",
|
|
826
|
+
PEP: "a politically-exposed person",
|
|
827
|
+
INDIRECT_EXPOSURE: "indirect exposure",
|
|
828
|
+
UNCLASSIFIED: "an unrecognized risk",
|
|
829
|
+
UNKNOWN: "an unrecognized risk"
|
|
830
|
+
};
|
|
831
|
+
function categoryLabel(code) {
|
|
832
|
+
const key = code.trim().toUpperCase();
|
|
833
|
+
const LABELS = {
|
|
834
|
+
SANCTIONS: "Sanctions",
|
|
835
|
+
TERRORISM_FINANCING: "Terrorist financing",
|
|
836
|
+
STOLEN_FUNDS: "Stolen funds",
|
|
837
|
+
RANSOMWARE: "Ransomware",
|
|
838
|
+
SCAM: "Scam",
|
|
839
|
+
DARKNET: "Darknet services",
|
|
840
|
+
MIXER: "Mixer",
|
|
841
|
+
HIGH_RISK_ENTITY: "High-risk entity",
|
|
842
|
+
PEP: "Politically exposed person (PEP)",
|
|
843
|
+
INDIRECT_EXPOSURE: "Indirect exposure",
|
|
844
|
+
UNCLASSIFIED: "Unclassified risk",
|
|
845
|
+
UNKNOWN: "Unclassified risk"
|
|
846
|
+
};
|
|
847
|
+
return LABELS[key] ?? key.toLowerCase().replace(/_/g, " ");
|
|
848
|
+
}
|
|
849
|
+
function cleanJurisdiction(code) {
|
|
850
|
+
return code.replace(/^(OFAC|TIER\d+|SANCTIONED)_/i, "").trim();
|
|
851
|
+
}
|
|
852
|
+
function stripBundlePrefix(head) {
|
|
853
|
+
if (head.startsWith("policy_")) return { head: head.slice("policy_".length), source: "policy" };
|
|
854
|
+
if (head.startsWith("legislation_")) return { head: head.slice("legislation_".length), source: "legislation" };
|
|
855
|
+
return { head, source: null };
|
|
856
|
+
}
|
|
857
|
+
function complianceReasonHead(raw) {
|
|
858
|
+
return stripBundlePrefix((raw.split(":")[0] ?? "").trim()).head;
|
|
859
|
+
}
|
|
860
|
+
function usd(raw) {
|
|
861
|
+
const n = Number(raw);
|
|
862
|
+
if (!Number.isFinite(n)) return `$${raw}`;
|
|
863
|
+
return `$${n.toLocaleString("en-US", { maximumFractionDigits: 2 })}`;
|
|
864
|
+
}
|
|
865
|
+
function capFromDetail(detail) {
|
|
866
|
+
const m = detail.match(/>([\d.]+)/);
|
|
867
|
+
return m ? ` (${usd(m[1])})` : "";
|
|
868
|
+
}
|
|
869
|
+
function categoryPhrase(detail) {
|
|
870
|
+
const cat = detail.replace(/\s*\(.*\)$/, "").toUpperCase();
|
|
871
|
+
return CATEGORY_PHRASES[cat] ?? cat.toLowerCase().replace(/_/g, " ");
|
|
872
|
+
}
|
|
873
|
+
function humanizeComplianceReason(raw) {
|
|
874
|
+
const [headRaw, ...restParts] = raw.split(":");
|
|
875
|
+
const detail = restParts.join(":").trim();
|
|
876
|
+
const { head, source } = stripBundlePrefix((headRaw ?? "").trim());
|
|
877
|
+
const scope = source === "legislation" ? "applicable regulations" : "the applicable policy";
|
|
878
|
+
switch (head) {
|
|
879
|
+
case "asset_pair_not_allowed": {
|
|
880
|
+
const m = detail.match(/^(\S+)->(\S+)\s+in\s+(\S+)/);
|
|
881
|
+
if (m) return `${m[1]} \u2192 ${m[2]} isn't available in your region (${cleanJurisdiction(m[3])}).`;
|
|
882
|
+
return "This asset pair isn't available in your region.";
|
|
883
|
+
}
|
|
884
|
+
case "asset_not_allowed": {
|
|
885
|
+
const m = detail.match(/^(\S+?)->(\S+?)(?::|$)/);
|
|
886
|
+
if (m) return `${m[1]} \u2192 ${m[2]} isn't permitted under ${scope}.`;
|
|
887
|
+
return `This asset pair isn't permitted under ${scope}.`;
|
|
888
|
+
}
|
|
889
|
+
case "blocked_jurisdiction":
|
|
890
|
+
return `Your region (${cleanJurisdiction(detail)}) isn't supported.`;
|
|
891
|
+
case "blocked_destination_jurisdiction":
|
|
892
|
+
return `The destination region (${cleanJurisdiction(detail)}) isn't supported.`;
|
|
893
|
+
case "jurisdiction_out_of_scope":
|
|
894
|
+
return `Not covered by ${scope}.`;
|
|
895
|
+
case "ui_block":
|
|
896
|
+
return `Payments aren't available in your region (${cleanJurisdiction(detail)}).`;
|
|
897
|
+
case "blocked_corridor_mode":
|
|
898
|
+
return "This route isn't currently open for payments.";
|
|
899
|
+
case "blocked_category":
|
|
900
|
+
return `Flagged for ${categoryPhrase(detail)}.`;
|
|
901
|
+
case "amount_exceeds_max_order_usd":
|
|
902
|
+
case "amount_exceeds_max":
|
|
903
|
+
return `Amount exceeds the maximum order size${capFromDetail(detail)}.`;
|
|
904
|
+
case "amount_exceeds_actor_cap":
|
|
905
|
+
return `Amount exceeds the limit for your account type${capFromDetail(detail)}.`;
|
|
906
|
+
case "amount_exceeds_jurisdiction_max":
|
|
907
|
+
return `Amount exceeds the limit for your region${capFromDetail(detail)}.`;
|
|
908
|
+
case "source_chain_not_allowed":
|
|
909
|
+
return `The source chain isn't permitted under ${scope}.`;
|
|
910
|
+
case "dest_chain_not_allowed":
|
|
911
|
+
return `The destination chain isn't permitted under ${scope}.`;
|
|
912
|
+
default:
|
|
913
|
+
return detail ? `${head.replace(/_/g, " ")} \u2014 ${detail}` : head.replace(/_/g, " ");
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
var COMPLIANCE_CHECK_ORDER = [
|
|
917
|
+
"location",
|
|
918
|
+
"screening",
|
|
919
|
+
"risk",
|
|
920
|
+
"asset",
|
|
921
|
+
"limits"
|
|
922
|
+
];
|
|
923
|
+
var CHECK_LABELS = {
|
|
924
|
+
location: "Location and corridor permitted",
|
|
925
|
+
screening: "Both wallets screened",
|
|
926
|
+
risk: "Risk policy passed",
|
|
927
|
+
asset: "Asset and amount allowed",
|
|
928
|
+
limits: "Transaction limits verified"
|
|
929
|
+
};
|
|
930
|
+
var CHECK_HEADS = {
|
|
931
|
+
location: [
|
|
932
|
+
"blocked_jurisdiction",
|
|
933
|
+
"blocked_destination_jurisdiction",
|
|
934
|
+
"ui_block",
|
|
935
|
+
"blocked_corridor_mode",
|
|
936
|
+
"jurisdiction_out_of_scope"
|
|
937
|
+
],
|
|
938
|
+
screening: [],
|
|
939
|
+
risk: ["blocked_category"],
|
|
940
|
+
asset: ["asset_pair_not_allowed", "asset_not_allowed", "source_chain_not_allowed", "dest_chain_not_allowed"],
|
|
941
|
+
limits: [
|
|
942
|
+
"amount_exceeds_max_order_usd",
|
|
943
|
+
"amount_exceeds_max",
|
|
944
|
+
"amount_exceeds_actor_cap",
|
|
945
|
+
"amount_exceeds_jurisdiction_max"
|
|
946
|
+
]
|
|
947
|
+
};
|
|
948
|
+
function distinctScreenedWallets(compliance) {
|
|
949
|
+
const seen = /* @__PURE__ */ new Set();
|
|
950
|
+
const wallets = [];
|
|
951
|
+
for (const raw of compliance?.screenedWallets ?? []) {
|
|
952
|
+
const address = raw?.trim();
|
|
953
|
+
if (!address) continue;
|
|
954
|
+
const key = /^0x[0-9a-fA-F]+$/.test(address) ? address.toLowerCase() : address;
|
|
955
|
+
if (seen.has(key)) continue;
|
|
956
|
+
seen.add(key);
|
|
957
|
+
wallets.push(address);
|
|
958
|
+
}
|
|
959
|
+
return wallets;
|
|
960
|
+
}
|
|
961
|
+
function shortAddress(a) {
|
|
962
|
+
return a.length > 12 ? `${a.slice(0, 6)}\u2026${a.slice(-4)}` : a;
|
|
963
|
+
}
|
|
964
|
+
function screeningLabel(wallets) {
|
|
965
|
+
if (wallets === 1) return "Wallet screened";
|
|
966
|
+
if (wallets === 2) return CHECK_LABELS.screening;
|
|
967
|
+
return "Wallets screened";
|
|
968
|
+
}
|
|
969
|
+
function complianceChecks(compliance, cv = complianceView(compliance)) {
|
|
970
|
+
if (cv.tone === "neutral") return [];
|
|
971
|
+
const byControl = /* @__PURE__ */ new Map();
|
|
972
|
+
for (const raw of compliance?.reasons ?? []) {
|
|
973
|
+
const head = complianceReasonHead(raw);
|
|
974
|
+
const id = COMPLIANCE_CHECK_ORDER.find((c) => CHECK_HEADS[c].includes(head));
|
|
975
|
+
if (!id) continue;
|
|
976
|
+
byControl.set(id, [...byControl.get(id) ?? [], raw]);
|
|
977
|
+
}
|
|
978
|
+
const screenedWallets = distinctScreenedWallets(compliance);
|
|
979
|
+
const wallets = screenedWallets.length;
|
|
980
|
+
const blocking = compliance?.blockingCategories?.length ?? 0;
|
|
981
|
+
return COMPLIANCE_CHECK_ORDER.map((id) => {
|
|
982
|
+
if (id === "screening") {
|
|
983
|
+
const ok2 = cv.screened || wallets > 0;
|
|
984
|
+
const note = wallets === 1 ? shortAddress(screenedWallets[0]) : wallets > 1 ? `${wallets} wallets screened` : void 0;
|
|
985
|
+
return { id, label: ok2 ? screeningLabel(wallets) : "Wallets not screened", ok: ok2, reasons: [], note };
|
|
986
|
+
}
|
|
987
|
+
const reasons = byControl.get(id) ?? [];
|
|
988
|
+
const ok = reasons.length === 0 && !(id === "risk" && blocking > 0);
|
|
989
|
+
return { id, label: CHECK_LABELS[id], ok, reasons };
|
|
990
|
+
});
|
|
991
|
+
}
|
|
992
|
+
function unattributedComplianceReasons(compliance, cv = complianceView(compliance)) {
|
|
993
|
+
const claimed = new Set(complianceChecks(compliance, cv).flatMap((c) => c.reasons));
|
|
994
|
+
return (compliance?.reasons ?? []).filter((r) => !claimed.has(r));
|
|
995
|
+
}
|
|
996
|
+
function directComplianceFromScreens(screens) {
|
|
997
|
+
const blockedAny = screens.some((s) => s.blocked);
|
|
998
|
+
const cats = (pick) => [
|
|
999
|
+
...new Set(screens.flatMap((s) => pick(s) ?? []))
|
|
1000
|
+
];
|
|
1001
|
+
return {
|
|
1002
|
+
status: "SCREENED",
|
|
1003
|
+
decision: blockedAny ? "DENY" : "ALLOW",
|
|
1004
|
+
screenedWallets: screens.map((s) => s.address),
|
|
1005
|
+
riskCategories: cats((s) => s.riskCategories),
|
|
1006
|
+
flaggedCategories: cats((s) => s.flaggedCategories),
|
|
1007
|
+
blockingCategories: cats((s) => s.blockingCategories),
|
|
1008
|
+
reasons: blockedAny ? cats((s) => s.blockingCategories).map((c) => `blocked_category:${c}`) : []
|
|
1009
|
+
};
|
|
1010
|
+
}
|
|
1011
|
+
var DIRECT_CHECK_IDS = ["screening", "risk"];
|
|
1012
|
+
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.";
|
|
1013
|
+
var BLOCK_CATEGORY_LABELS = {
|
|
1014
|
+
STOLEN_FUNDS: "flagged as associated with stolen funds",
|
|
1015
|
+
SANCTIONS: "on a sanctions list",
|
|
1016
|
+
SANCTIONED: "on a sanctions list",
|
|
1017
|
+
OFAC: "on a sanctions list",
|
|
1018
|
+
TERRORIST_FINANCING: "flagged for terrorist financing",
|
|
1019
|
+
TERRORISM_FINANCING: "flagged for terrorist financing",
|
|
1020
|
+
FRAUD: "flagged for fraud",
|
|
1021
|
+
SCAM: "flagged as a scam address"
|
|
1022
|
+
};
|
|
1023
|
+
var BLOCK_LABEL_DEFAULT = "flagged by compliance screening";
|
|
1024
|
+
function blockLabelFor(categories) {
|
|
1025
|
+
for (const raw of categories) {
|
|
1026
|
+
const label = BLOCK_CATEGORY_LABELS[String(raw || "").trim().toUpperCase()];
|
|
1027
|
+
if (label) return label;
|
|
1028
|
+
}
|
|
1029
|
+
return BLOCK_LABEL_DEFAULT;
|
|
1030
|
+
}
|
|
1031
|
+
var REASON_TAGS = {
|
|
1032
|
+
blocked_jurisdiction: "Restricted country",
|
|
1033
|
+
ui_block: "Restricted country",
|
|
1034
|
+
blocked_destination_jurisdiction: "Restricted destination",
|
|
1035
|
+
blocked_corridor_mode: "Corridor closed",
|
|
1036
|
+
blocked_category: "Risk flag",
|
|
1037
|
+
amount_exceeds_max_order_usd: "Limit exceeded",
|
|
1038
|
+
amount_exceeds_max: "Limit exceeded",
|
|
1039
|
+
amount_exceeds_actor_cap: "Limit exceeded",
|
|
1040
|
+
amount_exceeds_jurisdiction_max: "Limit exceeded",
|
|
1041
|
+
asset_pair_not_allowed: "Asset not allowed",
|
|
1042
|
+
asset_not_allowed: "Asset not allowed",
|
|
1043
|
+
source_chain_not_allowed: "Chain not allowed",
|
|
1044
|
+
dest_chain_not_allowed: "Chain not allowed",
|
|
1045
|
+
jurisdiction_out_of_scope: "Out of scope"
|
|
1046
|
+
};
|
|
1047
|
+
function complianceReasonTag(raw) {
|
|
1048
|
+
const head = complianceReasonHead(raw);
|
|
1049
|
+
return REASON_TAGS[head] ?? head.replace(/_/g, " ");
|
|
1050
|
+
}
|
|
1051
|
+
function complianceTagOf(compliance) {
|
|
1052
|
+
const first = (compliance?.reasons ?? [])[0];
|
|
1053
|
+
return first ? complianceReasonTag(first) : "";
|
|
1054
|
+
}
|
|
1055
|
+
var FLOOR_CATEGORIES = ["SANCTIONS", "TERRORISM_FINANCING", "STOLEN_FUNDS", "RANSOMWARE"];
|
|
1056
|
+
var TUNABLE_CATEGORIES = ["SCAM", "DARKNET", "MIXER", "HIGH_RISK_ENTITY", "PEP", "INDIRECT_EXPOSURE", "UNCLASSIFIED"];
|
|
1057
|
+
var TUNED_OUTCOMES = {
|
|
1058
|
+
SCAM: "blocked",
|
|
1059
|
+
DARKNET: "blocked",
|
|
1060
|
+
MIXER: "flagged",
|
|
1061
|
+
HIGH_RISK_ENTITY: "flagged",
|
|
1062
|
+
PEP: "flagged",
|
|
1063
|
+
INDIRECT_EXPOSURE: "flagged",
|
|
1064
|
+
UNCLASSIFIED: "flagged"
|
|
1065
|
+
};
|
|
1066
|
+
function screeningOutcomeOf(category) {
|
|
1067
|
+
const key = category.trim().toUpperCase();
|
|
1068
|
+
if (FLOOR_CATEGORIES.includes(key)) return "always-blocked";
|
|
1069
|
+
return TUNED_OUTCOMES[key] ?? null;
|
|
1070
|
+
}
|
|
1071
|
+
var labelsFor = (outcome) => [...FLOOR_CATEGORIES, ...TUNABLE_CATEGORIES].filter((c) => screeningOutcomeOf(c) === outcome).map(categoryLabel);
|
|
1072
|
+
var SCREENING_BUCKETS = [
|
|
1073
|
+
{ outcome: "always-blocked", title: "Always blocked", detail: "Cannot be changed or disabled.", categories: labelsFor("always-blocked") },
|
|
1074
|
+
{ outcome: "blocked", title: "Blocked under this policy", detail: "The current policy stops the order.", categories: labelsFor("blocked") },
|
|
1075
|
+
{ outcome: "flagged", title: "Flagged", detail: "A warning is shown.", categories: labelsFor("flagged") }
|
|
1076
|
+
];
|
|
1077
|
+
|
|
470
1078
|
// src/core/solve.ts
|
|
471
1079
|
async function solveExactOut({ option, destination, destinationToken, payer, fetchQuote }) {
|
|
472
1080
|
const destDecimals = assetDecimals(destinationToken);
|
|
@@ -703,7 +1311,7 @@ function routeLabelFor(option, destinationToken, result) {
|
|
|
703
1311
|
const bridge = result.quote.bridge ? ` via ${result.quote.bridge}` : "";
|
|
704
1312
|
return `Swap ${option.symbol} to ${destinationToken.symbol} and settle on ZeroDelta${bridge}.`;
|
|
705
1313
|
}
|
|
706
|
-
async function buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote, solve = solveExactOut, amountInRaw }) {
|
|
1314
|
+
async function buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote, solve = solveExactOut, amountInRaw, compliance }) {
|
|
707
1315
|
const result = await solve({ option, destination, destinationToken, payer, fetchQuote, amountInRaw });
|
|
708
1316
|
const quote = result.quote;
|
|
709
1317
|
const destDecimals = assetDecimals(destinationToken);
|
|
@@ -750,7 +1358,11 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
750
1358
|
bridge: quote.bridge,
|
|
751
1359
|
feeBps: quote.feeBps,
|
|
752
1360
|
estimatedDuration: quote.estimatedDuration,
|
|
753
|
-
iterations: result.iterations
|
|
1361
|
+
iterations: result.iterations,
|
|
1362
|
+
// A direct transfer never reaches /quote (solve.ts short-circuits it), so there is no
|
|
1363
|
+
// gateway decision to carry. The caller screens both parties itself and passes the
|
|
1364
|
+
// synthesized verdict in — see plan.ts and compliance.ts::directComplianceFromScreens.
|
|
1365
|
+
compliance
|
|
754
1366
|
}
|
|
755
1367
|
};
|
|
756
1368
|
}
|
|
@@ -834,7 +1446,11 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
834
1446
|
gasCostSource: quote.gasCostSource,
|
|
835
1447
|
msgValue: valueRaw.toString(),
|
|
836
1448
|
deadline: order.deadline,
|
|
837
|
-
iterations: result.iterations
|
|
1449
|
+
iterations: result.iterations,
|
|
1450
|
+
// Carried verbatim from the gateway's decision on THIS wallet pair. The projection used to
|
|
1451
|
+
// drop it, which is why the widget could show a price with no evidence of the control that
|
|
1452
|
+
// produced it.
|
|
1453
|
+
compliance: quote.compliance
|
|
838
1454
|
}
|
|
839
1455
|
};
|
|
840
1456
|
}
|
|
@@ -870,25 +1486,20 @@ function apiMessage(json, fallback) {
|
|
|
870
1486
|
}
|
|
871
1487
|
return sanitizeMessage(err?.message, fallback);
|
|
872
1488
|
}
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
TERRORIST_FINANCING: "flagged for terrorist financing",
|
|
879
|
-
FRAUD: "flagged for fraud",
|
|
880
|
-
SCAM: "flagged as a scam address"
|
|
881
|
-
};
|
|
882
|
-
var BLOCK_LABEL_DEFAULT = "flagged by compliance screening";
|
|
1489
|
+
function isStructuredComplianceBlock(error) {
|
|
1490
|
+
const code = String(error?.code || "").toUpperCase();
|
|
1491
|
+
if (code === "COMPLIANCE_BLOCKED" || code === "COMPLIANCE_BLOCK") return true;
|
|
1492
|
+
return error?.status === 422 && Array.isArray(error?.reasons) && error.reasons.length > 0;
|
|
1493
|
+
}
|
|
883
1494
|
function classifyQuoteError(error) {
|
|
884
1495
|
if (!error) return null;
|
|
885
1496
|
const reasons = Array.isArray(error.reasons) ? error.reasons : [];
|
|
886
1497
|
const haystack = `${error.message || ""} ${reasons.join(" ")}`;
|
|
887
1498
|
const catMatch = /blocked_category:\s*([A-Za-z_]+)/i.exec(haystack);
|
|
888
|
-
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);
|
|
1499
|
+
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);
|
|
889
1500
|
if (!isBlock) return null;
|
|
890
1501
|
const category = (catMatch?.[1] || "").toUpperCase() || "COMPLIANCE";
|
|
891
|
-
const label =
|
|
1502
|
+
const label = blockLabelFor([category]);
|
|
892
1503
|
return {
|
|
893
1504
|
blocked: true,
|
|
894
1505
|
category,
|
|
@@ -909,8 +1520,11 @@ function createApiClient(cfg) {
|
|
|
909
1520
|
const cache = {
|
|
910
1521
|
chains: null,
|
|
911
1522
|
tokens: null,
|
|
912
|
-
routes: null
|
|
1523
|
+
routes: null,
|
|
1524
|
+
health: null
|
|
913
1525
|
};
|
|
1526
|
+
const screenCache = /* @__PURE__ */ new Map();
|
|
1527
|
+
const screenInflight = /* @__PURE__ */ new Map();
|
|
914
1528
|
const apiBase = cfg.apiBase.replace(/\/$/, "");
|
|
915
1529
|
async function apiRequest(path, init = {}) {
|
|
916
1530
|
const apiKey = await cfg.getApiKey();
|
|
@@ -979,6 +1593,18 @@ function createApiClient(cfg) {
|
|
|
979
1593
|
return [];
|
|
980
1594
|
}
|
|
981
1595
|
}
|
|
1596
|
+
async function fetchRouteHealth() {
|
|
1597
|
+
if (nowFresh(cache.health)) return cache.health.value;
|
|
1598
|
+
let value = null;
|
|
1599
|
+
try {
|
|
1600
|
+
const health = await apiRequest("/route-health", { timeoutMs: 8e3 });
|
|
1601
|
+
value = health && typeof health === "object" && !Array.isArray(health) ? health : null;
|
|
1602
|
+
} catch {
|
|
1603
|
+
value = null;
|
|
1604
|
+
}
|
|
1605
|
+
cache.health = { at: Date.now(), value };
|
|
1606
|
+
return value;
|
|
1607
|
+
}
|
|
982
1608
|
async function fetchQuote(body, retries = 1) {
|
|
983
1609
|
let lastError;
|
|
984
1610
|
for (let attempt = 0; attempt <= retries; attempt += 1) {
|
|
@@ -993,7 +1619,32 @@ function createApiClient(cfg) {
|
|
|
993
1619
|
}
|
|
994
1620
|
throw lastError;
|
|
995
1621
|
}
|
|
996
|
-
|
|
1622
|
+
async function screenWallet(address, chainId) {
|
|
1623
|
+
const addr = String(address || "").trim();
|
|
1624
|
+
if (!addr) throw apiError("An address is required to screen a wallet.", { code: "bad_request" });
|
|
1625
|
+
const key = `${/^0x[0-9a-fA-F]+$/.test(addr) ? addr.toLowerCase() : addr}|${chainId ?? ""}`;
|
|
1626
|
+
const hit = screenCache.get(key);
|
|
1627
|
+
if (hit && Date.now() - hit.at < SCREEN_CACHE_TTL_MS) return hit.value;
|
|
1628
|
+
const inflight = screenInflight.get(key);
|
|
1629
|
+
if (inflight) return inflight;
|
|
1630
|
+
const request = apiRequest("/screen/wallet", {
|
|
1631
|
+
method: "POST",
|
|
1632
|
+
body: JSON.stringify(chainId == null ? { address: addr } : { address: addr, chainId }),
|
|
1633
|
+
timeoutMs: 12e3
|
|
1634
|
+
}).then((screen) => {
|
|
1635
|
+
if (!screen || typeof screen !== "object" || typeof screen.blocked !== "boolean") {
|
|
1636
|
+
throw apiError("Compliance screening returned an unusable result.", { code: "bad_response" });
|
|
1637
|
+
}
|
|
1638
|
+
const value = { ...screen, address: screen.address || addr };
|
|
1639
|
+
screenCache.set(key, { at: Date.now(), value });
|
|
1640
|
+
return value;
|
|
1641
|
+
}).finally(() => {
|
|
1642
|
+
screenInflight.delete(key);
|
|
1643
|
+
});
|
|
1644
|
+
screenInflight.set(key, request);
|
|
1645
|
+
return request;
|
|
1646
|
+
}
|
|
1647
|
+
return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchQuote, screenWallet, apiBase };
|
|
997
1648
|
}
|
|
998
1649
|
|
|
999
1650
|
// src/core/plan.ts
|
|
@@ -1011,7 +1662,7 @@ function validateDestination(destination) {
|
|
|
1011
1662
|
assertAddress(destination.address, "Destination address");
|
|
1012
1663
|
const chainId = Number(destination.chainId);
|
|
1013
1664
|
const asset = symbolKey(destination.asset);
|
|
1014
|
-
if (!
|
|
1665
|
+
if (!Number.isSafeInteger(chainId) || chainId <= 0) throw new Error("Unsupported destination chain.");
|
|
1015
1666
|
if (!SUPPORTED_ASSETS.has(asset)) throw new Error("Unsupported destination asset.");
|
|
1016
1667
|
const normalizedAmount = normalizeDecimalText(destination.amount);
|
|
1017
1668
|
if (!/^\d+(\.\d+)?$/.test(normalizedAmount)) throw new Error("Could not detect a valid payment amount.");
|
|
@@ -1025,7 +1676,15 @@ function planErrorSummary(errors) {
|
|
|
1025
1676
|
async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances) {
|
|
1026
1677
|
validateDestination(request);
|
|
1027
1678
|
assertAddress(payer, "Payer wallet");
|
|
1028
|
-
const [chains, tokens, routes] = await Promise.all([api.fetchChains(), api.fetchTokens(), api.fetchRoutes()]);
|
|
1679
|
+
const [chains, tokens, routes, health] = await Promise.all([api.fetchChains(), api.fetchTokens(), api.fetchRoutes(), api.fetchRouteHealth()]);
|
|
1680
|
+
const catalogue = buildCatalogue({
|
|
1681
|
+
chains,
|
|
1682
|
+
tokens,
|
|
1683
|
+
routes,
|
|
1684
|
+
product: "stable",
|
|
1685
|
+
supportedChainIds: SUPPORTED_CHAIN_IDS,
|
|
1686
|
+
brokenLanes: suppressedLanes(health)
|
|
1687
|
+
});
|
|
1029
1688
|
const destination = {
|
|
1030
1689
|
...request,
|
|
1031
1690
|
chainId: Number(request.chainId),
|
|
@@ -1040,7 +1699,8 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances)
|
|
|
1040
1699
|
tokens,
|
|
1041
1700
|
routes,
|
|
1042
1701
|
chains,
|
|
1043
|
-
walletChainId: wallet?.chainId
|
|
1702
|
+
walletChainId: wallet?.chainId,
|
|
1703
|
+
catalogue
|
|
1044
1704
|
}).filter((option) => option.direct || !allowedFunding || allowedFunding.has(option.symbolKey));
|
|
1045
1705
|
if (!options.length) throw new Error(`No enabled ZeroDelta funding assets can settle ${destination.asset} on ${chainNameOf(destination.chainId, chains)}.`);
|
|
1046
1706
|
const balanceTargets = [];
|
|
@@ -1052,7 +1712,36 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances)
|
|
|
1052
1712
|
balanceTargets.push({ chainId: option.chainId, tokenAddress: option.address, decimals: option.decimals });
|
|
1053
1713
|
}
|
|
1054
1714
|
const walletBalances = readBalances ? await readBalances(payer, balanceTargets).catch(() => ({})) : {};
|
|
1055
|
-
const
|
|
1715
|
+
const directOptions = options.filter((option) => option.direct);
|
|
1716
|
+
let directCompliance = null;
|
|
1717
|
+
if (directOptions.length) {
|
|
1718
|
+
const parties = [];
|
|
1719
|
+
const seenParty = /* @__PURE__ */ new Set();
|
|
1720
|
+
for (const raw of [payer, destination.address]) {
|
|
1721
|
+
const addr = String(raw || "").trim();
|
|
1722
|
+
if (!addr) continue;
|
|
1723
|
+
const key = /^0x[0-9a-fA-F]+$/.test(addr) ? addr.toLowerCase() : addr;
|
|
1724
|
+
if (seenParty.has(key)) continue;
|
|
1725
|
+
seenParty.add(key);
|
|
1726
|
+
parties.push(addr);
|
|
1727
|
+
}
|
|
1728
|
+
try {
|
|
1729
|
+
const screens = await Promise.all(parties.map((address) => api.screenWallet(address, destination.chainId)));
|
|
1730
|
+
const blocked = screens.filter((screen) => screen.blocked);
|
|
1731
|
+
if (blocked.length) {
|
|
1732
|
+
const who = blocked.some((s) => s.address.toLowerCase() === payer.toLowerCase()) ? "your wallet" : "the recipient";
|
|
1733
|
+
const categories = [...new Set(blocked.flatMap((s) => s.blockingCategories ?? []))];
|
|
1734
|
+
throw apiError(
|
|
1735
|
+
`This payment was blocked by compliance screening \u2014 ${who} is ${blockLabelFor(categories)}. Choose a different recipient or connect a different wallet.`,
|
|
1736
|
+
{ blocked: true, blockedCategory: categories[0] || "COMPLIANCE", blockedReason: categories.join(", ") }
|
|
1737
|
+
);
|
|
1738
|
+
}
|
|
1739
|
+
directCompliance = directComplianceFromScreens(screens);
|
|
1740
|
+
} catch (error) {
|
|
1741
|
+
if (error?.blocked) throw error;
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
const candidates = directCompliance ? directOptions : [];
|
|
1056
1745
|
const heldOptions = options.filter((option) => !option.direct && hasPositiveBalance(option, walletBalances));
|
|
1057
1746
|
const heldKeys = new Set(heldOptions.map(optionBalanceKey));
|
|
1058
1747
|
const seenChains = /* @__PURE__ */ new Set();
|
|
@@ -1072,7 +1761,7 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances)
|
|
|
1072
1761
|
}
|
|
1073
1762
|
const routeErrors = [];
|
|
1074
1763
|
const routePromises = candidates.map(
|
|
1075
|
-
(option) => buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote: api.fetchQuote }).catch((error) => {
|
|
1764
|
+
(option) => buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote: api.fetchQuote, compliance: option.direct ? directCompliance ?? void 0 : void 0 }).catch((error) => {
|
|
1076
1765
|
routeErrors.push(error);
|
|
1077
1766
|
return null;
|
|
1078
1767
|
})
|
|
@@ -1122,7 +1811,8 @@ function validateSwap(swap = {}) {
|
|
|
1122
1811
|
const toChainId = Number(swap.toChainId);
|
|
1123
1812
|
const fromToken = symbolKey(swap.fromToken);
|
|
1124
1813
|
const toToken = symbolKey(swap.toToken);
|
|
1125
|
-
if (!SUPPORTED_CHAIN_IDS.has(fromChainId)
|
|
1814
|
+
if (!SUPPORTED_CHAIN_IDS.has(fromChainId)) throw new Error("Unsupported swap chain.");
|
|
1815
|
+
if (!Number.isSafeInteger(toChainId) || toChainId <= 0) throw new Error("Unsupported swap chain.");
|
|
1126
1816
|
if (!SUPPORTED_ASSETS.has(fromToken) || !SUPPORTED_ASSETS.has(toToken)) throw new Error("Unsupported swap asset.");
|
|
1127
1817
|
const amountIn = normalizeDecimalText(swap.amountIn);
|
|
1128
1818
|
if (!/^\d+(\.\d+)?$/.test(amountIn) || Number(amountIn) <= 0 || Number(amountIn) > 1e9) throw new Error("Enter a valid swap amount.");
|
|
@@ -1568,7 +2258,26 @@ function createEngine(config = {}) {
|
|
|
1568
2258
|
fetchChains: api.fetchChains,
|
|
1569
2259
|
fetchTokens: api.fetchTokens,
|
|
1570
2260
|
fetchRoutes: api.fetchRoutes,
|
|
2261
|
+
fetchRouteHealth: api.fetchRouteHealth,
|
|
1571
2262
|
fetchQuote: api.fetchQuote,
|
|
2263
|
+
fetchCatalogue: async (allowedAssets, product) => {
|
|
2264
|
+
const [chains, tokens, routes, health] = await Promise.all([
|
|
2265
|
+
api.fetchChains().catch(() => []),
|
|
2266
|
+
api.fetchTokens().catch(() => []),
|
|
2267
|
+
api.fetchRoutes().catch(() => []),
|
|
2268
|
+
api.fetchRouteHealth()
|
|
2269
|
+
]);
|
|
2270
|
+
const allowed = allowedAssets?.length ? new Set([...allowedAssets].map(symbolKey).filter((a) => SUPPORTED_ASSETS.has(a))) : void 0;
|
|
2271
|
+
return buildCatalogue({
|
|
2272
|
+
chains,
|
|
2273
|
+
tokens,
|
|
2274
|
+
routes,
|
|
2275
|
+
product,
|
|
2276
|
+
...allowed ? { allowedAssets: allowed } : {},
|
|
2277
|
+
supportedChainIds: SUPPORTED_CHAIN_IDS,
|
|
2278
|
+
brokenLanes: suppressedLanes(health)
|
|
2279
|
+
});
|
|
2280
|
+
},
|
|
1572
2281
|
fetchPaymentPlan: (request, payer, wallet) => fetchPaymentPlan(api, request, payer, wallet, verifier.readBalances),
|
|
1573
2282
|
quoteSwapPreview: (swap, owner) => quoteSwapPreview(api, swap, owner),
|
|
1574
2283
|
buildSwapPlan: (swap, payer, wallet) => buildSwapPlan(api, swap, payer, wallet),
|
|
@@ -2305,7 +3014,12 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
|
|
|
2305
3014
|
.sg-back{width:32px;height:32px;flex:0 0 auto;border:none;border-radius:999px;background:transparent;color:var(--sg-text);cursor:pointer;font:inherit;display:flex;align-items:center;justify-content:center;transition:background 120ms ease}
|
|
2306
3015
|
.sg-back:hover{background:var(--sg-surface)}
|
|
2307
3016
|
.sg-sel-title{flex:1 1 auto;text-align:center;font-size:15px;font-weight:600;margin-right:32px}
|
|
2308
|
-
.
|
|
3017
|
+
/* Scrolls at ~2.5 rows. The catalogue's destination chains outnumber its source chains three to one
|
|
3018
|
+
(9 escrow chains, ~37 total), so an ungated grid was eight rows tall and pushed the token list \u2014
|
|
3019
|
+
the thing the panel exists for \u2014 below the fold. The fade is a scroll affordance, not decoration. */
|
|
3020
|
+
.sg-chain-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:8px;margin-bottom:12px;max-height:124px;overflow-y:auto;scrollbar-width:thin;padding-bottom:2px;mask-image:linear-gradient(to bottom,#000 calc(100% - 14px),transparent);-webkit-mask-image:linear-gradient(to bottom,#000 calc(100% - 14px),transparent)}
|
|
3021
|
+
/* No mask once everything fits \u2014 a fade under a grid with nothing below it reads as a rendering bug. */
|
|
3022
|
+
.sg-chain-grid[data-scroll="false"]{mask-image:none;-webkit-mask-image:none;overflow-y:visible;max-height:none}
|
|
2309
3023
|
.sg-chain-chip{height:44px;border-radius:var(--sg-radius-control);border:1px solid var(--sg-border);background:var(--sg-surface);color:var(--sg-text);display:flex;align-items:center;justify-content:center;cursor:pointer;font:inherit;font-size:10px;font-weight:700;letter-spacing:.02em;transition:border-color 120ms ease,background 120ms ease;overflow:hidden}
|
|
2310
3024
|
.sg-chain-chip img{width:22px;height:22px;border-radius:999px;display:block}
|
|
2311
3025
|
.sg-chain-chip:hover{border-color:color-mix(in srgb,var(--sg-accent) 45%,var(--sg-border))}
|
|
@@ -2508,6 +3222,98 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
|
|
|
2508
3222
|
.sg-island .sg-spinner{display:none!important}
|
|
2509
3223
|
.sg-island .sg-rm-dot{display:inline-block}
|
|
2510
3224
|
}
|
|
3225
|
+
|
|
3226
|
+
/* \u2500\u2500 compliance disclosure \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
3227
|
+
Mirrors the dApp's compliance row + details dialog. The row is a quiet affordance in the payment
|
|
3228
|
+
summary; the details open a sheet that fills the widget's own card, because a page-level modal
|
|
3229
|
+
inside somebody else's checkout is a z-index fight we would lose.
|
|
3230
|
+
|
|
3231
|
+
Tone note, carried over from the dApp: a PASS reads in body ink, not in green. The shield tick is
|
|
3232
|
+
already green, so colouring the sentence too says the same thing twice and spends the accent on
|
|
3233
|
+
the half that carries no information. A DENY still shouts. */
|
|
3234
|
+
/* NOT positioned. The sheet is inset:0 against the WIDGET CARD, so this wrapper must not become
|
|
3235
|
+
the containing block: when it carried position:relative the sheet collapsed to the height of
|
|
3236
|
+
this one row and drew straight through the CTA beneath it.
|
|
3237
|
+
NB this stylesheet is a JS template literal - never write a backtick in these comments. */
|
|
3238
|
+
.sg-cp{margin-top:10px}
|
|
3239
|
+
.sg-cp-row{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;padding:9px 12px;border:1px solid var(--sg-border);border-radius:var(--sg-radius-control);background:var(--sg-surface);color:inherit;font:inherit;text-align:left;cursor:pointer;transition:border-color 120ms ease,background 120ms ease}
|
|
3240
|
+
.sg-cp-row:hover{border-color:color-mix(in srgb,var(--sg-accent) 40%,var(--sg-border))}
|
|
3241
|
+
.sg-cp-row:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px}
|
|
3242
|
+
.sg-cp-row-main{display:flex;align-items:center;gap:8px;min-width:0}
|
|
3243
|
+
.sg-cp-row-glyph{display:flex;flex:0 0 auto;color:var(--sg-success)}
|
|
3244
|
+
.sg-cp-row[data-tone="neutral"] .sg-cp-row-glyph{color:var(--sg-text-muted);opacity:.55}
|
|
3245
|
+
.sg-cp-row[data-tone="blocked"] .sg-cp-row-glyph,.sg-cp-row[data-tone="warn"] .sg-cp-row-glyph{color:var(--sg-danger)}
|
|
3246
|
+
.sg-cp-row-label{font-size:13px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
3247
|
+
.sg-cp-row[data-tone="neutral"] .sg-cp-row-label{color:var(--sg-text-muted)}
|
|
3248
|
+
.sg-cp-row[data-tone="blocked"] .sg-cp-row-label,.sg-cp-row[data-tone="warn"] .sg-cp-row-label{color:var(--sg-danger)}
|
|
3249
|
+
.sg-cp-row-chev{display:flex;flex:0 0 auto;color:var(--sg-text-muted)}
|
|
3250
|
+
.sg-cp-row-tag{display:block;margin:4px 0 0 32px;font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:var(--sg-text-muted)}
|
|
3251
|
+
|
|
3252
|
+
/* the sheet \u2014 fills the widget card */
|
|
3253
|
+
.sg-cp-sheet{display:flex;flex-direction:column;padding:14px;background:var(--sg-bg);border:1px solid var(--sg-border);border-radius:var(--sg-radius-control);animation:sg-cp-in var(--sg-motion-fast) var(--sg-ease-out-soft) both}
|
|
3254
|
+
@keyframes sg-cp-in{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
|
|
3255
|
+
.sg-cp-sheet:focus{outline:none}
|
|
3256
|
+
.sg-cp-sheet-head{display:flex;align-items:center;justify-content:space-between;gap:8px;flex:0 0 auto}
|
|
3257
|
+
.sg-cp-sheet-title{margin:0;font-size:15px;font-weight:600}
|
|
3258
|
+
.sg-cp-close{display:flex;align-items:center;justify-content:center;width:28px;height:28px;flex:0 0 auto;border:0;border-radius:8px;background:transparent;color:var(--sg-text-muted);cursor:pointer;transition:background 120ms ease,color 120ms ease}
|
|
3259
|
+
.sg-cp-close:hover{background:var(--sg-surface);color:var(--sg-text)}
|
|
3260
|
+
.sg-cp-close:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px}
|
|
3261
|
+
.sg-cp-tabs{display:flex;align-items:center;gap:4px;flex:0 0 auto;margin-top:10px;padding:4px;border:1px solid var(--sg-border);border-radius:14px}
|
|
3262
|
+
.sg-cp-tab{flex:1 1 0;min-width:0;padding:7px 8px;border:0;border-radius:11px;background:transparent;color:var(--sg-text-muted);font:inherit;font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.5px;cursor:pointer;transition:background 120ms ease,color 120ms ease}
|
|
3263
|
+
.sg-cp-tab[data-active="true"]{background:color-mix(in srgb,var(--sg-accent) 10%,transparent);color:var(--sg-accent)}
|
|
3264
|
+
.sg-cp-tab:focus-visible{outline:2px solid var(--sg-accent);outline-offset:-2px}
|
|
3265
|
+
.sg-cp-sheet-body{margin-top:10px}
|
|
3266
|
+
.sg-cp-tabpanel{display:flex;flex-direction:column;gap:8px}
|
|
3267
|
+
|
|
3268
|
+
/* cards */
|
|
3269
|
+
.sg-cp-card{display:flex;flex-direction:column;gap:12px;padding:14px;border:1px solid var(--sg-border);border-radius:16px}
|
|
3270
|
+
.sg-cp-card-head{display:flex;align-items:center;gap:8px}
|
|
3271
|
+
.sg-cp-card-glyph{display:flex;flex:0 0 auto;color:var(--sg-accent)}
|
|
3272
|
+
.sg-cp-card-title{margin:0;font-size:14px;font-weight:600}
|
|
3273
|
+
.sg-cp-summary{display:flex;flex-direction:column;gap:3px}
|
|
3274
|
+
.sg-cp-summary-head{display:flex;align-items:center;gap:8px;color:var(--sg-success)}
|
|
3275
|
+
.sg-cp-summary-head[data-tone="neutral"]{color:var(--sg-text-muted)}
|
|
3276
|
+
.sg-cp-summary-head[data-tone="blocked"],.sg-cp-summary-head[data-tone="warn"]{color:var(--sg-danger)}
|
|
3277
|
+
.sg-cp-summary-title{font-size:14px;font-weight:600;color:var(--sg-text)}
|
|
3278
|
+
.sg-cp-summary-head[data-tone="blocked"] .sg-cp-summary-title,.sg-cp-summary-head[data-tone="warn"] .sg-cp-summary-title{color:var(--sg-danger)}
|
|
3279
|
+
.sg-cp-summary-sub{margin:0;padding-left:24px;font-size:12px;line-height:1.35;color:var(--sg-text-muted)}
|
|
3280
|
+
|
|
3281
|
+
/* per-control rows */
|
|
3282
|
+
.sg-cp-checks{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:11px}
|
|
3283
|
+
.sg-cp-check-head{display:flex;flex-wrap:wrap;align-items:center;gap:6px 14px}
|
|
3284
|
+
.sg-cp-check-label{display:flex;align-items:center;gap:8px;min-width:0;font-size:13.5px;line-height:1.25}
|
|
3285
|
+
.sg-cp-check[data-ok="false"] .sg-cp-check-label{color:var(--sg-danger)}
|
|
3286
|
+
.sg-cp-check-mark{display:flex;flex:0 0 auto;color:var(--sg-success)}
|
|
3287
|
+
.sg-cp-check-mark[data-ok="false"]{color:var(--sg-danger)}
|
|
3288
|
+
.sg-cp-check-note,.sg-cp-check-reason{display:block;padding-left:20px;margin-top:3px;font-size:11.5px;line-height:1.4;color:var(--sg-text-muted);overflow-wrap:anywhere}
|
|
3289
|
+
.sg-cp-check-reason{color:var(--sg-danger)}
|
|
3290
|
+
.sg-cp-link{display:inline-flex;align-items:center;gap:5px;padding:0;border:0;background:transparent;color:var(--sg-accent);font:inherit;font-size:12px;font-weight:500;cursor:pointer}
|
|
3291
|
+
.sg-cp-link:hover{text-decoration:underline}
|
|
3292
|
+
.sg-cp-link:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px;border-radius:4px}
|
|
3293
|
+
.sg-cp-orphans{list-style:none;margin:0;padding:0 0 0 20px;display:flex;flex-direction:column;gap:3px;font-size:11.5px;line-height:1.4;color:var(--sg-danger)}
|
|
3294
|
+
.sg-cp-scope{margin:0;font-size:11.5px;line-height:1.45;color:var(--sg-text-muted)}
|
|
3295
|
+
.sg-cp-flags{margin:0;font-size:13px}
|
|
3296
|
+
|
|
3297
|
+
/* quote details */
|
|
3298
|
+
.sg-cp-facts{margin:0;display:flex;flex-direction:column;gap:9px}
|
|
3299
|
+
.sg-cp-fact{display:grid;grid-template-columns:78px minmax(0,1fr);align-items:center;gap:10px}
|
|
3300
|
+
.sg-cp-fact dt{font-size:12px;color:var(--sg-text-muted)}
|
|
3301
|
+
.sg-cp-fact dd{margin:0;font-size:13px;min-width:0;overflow-wrap:anywhere}
|
|
3302
|
+
|
|
3303
|
+
/* screening policy */
|
|
3304
|
+
.sg-cp-policy-head{display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:space-between;gap:8px;padding-bottom:2px}
|
|
3305
|
+
.sg-cp-policy-id{font-size:11px;color:var(--sg-text-muted);overflow-wrap:anywhere}
|
|
3306
|
+
.sg-cp-policy-facts{padding:2px 0 8px}
|
|
3307
|
+
.sg-cp-buckets{display:flex;flex-direction:column;gap:8px}
|
|
3308
|
+
.sg-cp-bucket{gap:10px;padding:12px 14px}
|
|
3309
|
+
.sg-cp-bucket-head{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:4px 10px}
|
|
3310
|
+
.sg-cp-bucket-detail{font-size:11.5px;color:var(--sg-text-muted)}
|
|
3311
|
+
.sg-cp-cats{list-style:none;margin:0;padding:0 0 0 4px;display:flex;flex-direction:column;gap:5px}
|
|
3312
|
+
.sg-cp-cats li{display:flex;align-items:center;gap:10px;font-size:12.5px;line-height:1.35}
|
|
3313
|
+
.sg-cp-dot{flex:0 0 auto;width:4px;height:4px;border-radius:999px;background:var(--sg-accent);opacity:.8}
|
|
3314
|
+
|
|
3315
|
+
/* express (PaymentIsland) trims the card padding, so the sheet follows */
|
|
3316
|
+
@media (prefers-reduced-motion:reduce){.sg-cp-sheet{animation:none}}
|
|
2511
3317
|
`;
|
|
2512
3318
|
var injected = false;
|
|
2513
3319
|
function injectStyles() {
|
|
@@ -2661,11 +3467,11 @@ function WidgetShell(props) {
|
|
|
2661
3467
|
] })
|
|
2662
3468
|
] });
|
|
2663
3469
|
}
|
|
2664
|
-
function
|
|
3470
|
+
function shortAddress2(a) {
|
|
2665
3471
|
if (!a) return "";
|
|
2666
3472
|
return `${a.slice(0, 6)}\u2026${a.slice(-4)}`;
|
|
2667
3473
|
}
|
|
2668
|
-
var
|
|
3474
|
+
var SOURCE_CHAIN_LABELS = {
|
|
2669
3475
|
1: "Ethereum",
|
|
2670
3476
|
10: "Optimism",
|
|
2671
3477
|
130: "Unichain",
|
|
@@ -2676,8 +3482,14 @@ var CHAIN_LABELS = {
|
|
|
2676
3482
|
42161: "Arbitrum",
|
|
2677
3483
|
98866: "Plume"
|
|
2678
3484
|
};
|
|
3485
|
+
var CHAIN_LABELS = { ...CHAIN_DISPLAY_NAMES, ...SOURCE_CHAIN_LABELS };
|
|
2679
3486
|
var SUPPORTED_CHAINS = [1, 10, 42161, 8453, 57073, 130, 9745, 146, 98866];
|
|
2680
|
-
var SUPPORTED_ASSETS2 = [
|
|
3487
|
+
var SUPPORTED_ASSETS2 = [
|
|
3488
|
+
...EXECUTABLE_STABLE_ASSETS,
|
|
3489
|
+
...[...STABLE_ASSETS].filter((a) => !EXECUTABLE_STABLE_ASSETS.has(a)),
|
|
3490
|
+
...[...SUPPORTED_ASSETS].filter((a) => !STABLE_ASSETS.has(a))
|
|
3491
|
+
];
|
|
3492
|
+
[...EXECUTABLE_STABLE_ASSETS];
|
|
2681
3493
|
function Button(props) {
|
|
2682
3494
|
const soft = !!props.softDisabled && !props.disabled;
|
|
2683
3495
|
const nativeDisabled = props.disabled || props.busy && !props.softDisabled;
|
|
@@ -2867,6 +3679,251 @@ function RouteList(props) {
|
|
|
2867
3679
|
] }) : null
|
|
2868
3680
|
] });
|
|
2869
3681
|
}
|
|
3682
|
+
function ShieldTick({ size = 16 }) {
|
|
3683
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3684
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 2.5 4.5 5.5v6c0 4.4 3.1 8.5 7.5 10 4.4-1.5 7.5-5.6 7.5-10v-6L12 2.5Z", fill: "currentColor", opacity: ".14" }),
|
|
3685
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 2.5 4.5 5.5v6c0 4.4 3.1 8.5 7.5 10 4.4-1.5 7.5-5.6 7.5-10v-6L12 2.5Z", stroke: "currentColor", strokeWidth: "1.6", strokeLinejoin: "round" }),
|
|
3686
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m8.6 11.9 2.3 2.3 4.5-4.5", stroke: "currentColor", strokeWidth: "1.9", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
3687
|
+
] });
|
|
3688
|
+
}
|
|
3689
|
+
function TickCircle({ size = 16 }) {
|
|
3690
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3691
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor" }),
|
|
3692
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m7.8 12.2 2.7 2.7 5.7-5.8", stroke: "var(--sg-bg)", strokeWidth: "2.1", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
3693
|
+
] });
|
|
3694
|
+
}
|
|
3695
|
+
function CloseCircle({ size = 16 }) {
|
|
3696
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3697
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor" }),
|
|
3698
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m8.7 8.7 6.6 6.6M15.3 8.7l-6.6 6.6", stroke: "var(--sg-bg)", strokeWidth: "2.1", strokeLinecap: "round" })
|
|
3699
|
+
] });
|
|
3700
|
+
}
|
|
3701
|
+
function PendingCircle({ size = 16 }) {
|
|
3702
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3703
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "9.2", stroke: "currentColor", strokeWidth: "1.6", strokeDasharray: "3 3" }),
|
|
3704
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8.5 12h7", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round" })
|
|
3705
|
+
] });
|
|
3706
|
+
}
|
|
3707
|
+
function Tick({ size = 12 }) {
|
|
3708
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m4.5 12.8 5 5L19.5 6.5", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
3709
|
+
}
|
|
3710
|
+
function Cross({ size = 12 }) {
|
|
3711
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m5.5 5.5 13 13M18.5 5.5l-13 13", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round" }) });
|
|
3712
|
+
}
|
|
3713
|
+
function Chevron({ size = 16 }) {
|
|
3714
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m9 5 7 7-7 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
3715
|
+
}
|
|
3716
|
+
function Info({ size = 16 }) {
|
|
3717
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3718
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor" }),
|
|
3719
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 10.6v6", stroke: "var(--sg-bg)", strokeWidth: "2.1", strokeLinecap: "round" }),
|
|
3720
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "7.6", r: "1.25", fill: "var(--sg-bg)" })
|
|
3721
|
+
] });
|
|
3722
|
+
}
|
|
3723
|
+
function Lock({ size = 16 }) {
|
|
3724
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3725
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "4.5", y: "10.5", width: "15", height: "9.5", rx: "2.2", stroke: "currentColor", strokeWidth: "1.7" }),
|
|
3726
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 10.5V7.8a4 4 0 0 1 8 0v2.7", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round" })
|
|
3727
|
+
] });
|
|
3728
|
+
}
|
|
3729
|
+
function ShieldOutline({ size = 16 }) {
|
|
3730
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 2.5 4.5 5.5v6c0 4.4 3.1 8.5 7.5 10 4.4-1.5 7.5-5.6 7.5-10v-6L12 2.5Z", stroke: "currentColor", strokeWidth: "1.7", strokeLinejoin: "round" }) });
|
|
3731
|
+
}
|
|
3732
|
+
function WarningFilled({ size = 16 }) {
|
|
3733
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3734
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 3.2 21.4 19.4H2.6L12 3.2Z", fill: "currentColor" }),
|
|
3735
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 9.4v4.3", stroke: "var(--sg-bg)", strokeWidth: "1.9", strokeLinecap: "round" }),
|
|
3736
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "16.4", r: "1.05", fill: "var(--sg-bg)" })
|
|
3737
|
+
] });
|
|
3738
|
+
}
|
|
3739
|
+
function CornerArrow({ size = 12 }) {
|
|
3740
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M7 17 17 7M9 7h8v8", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
3741
|
+
}
|
|
3742
|
+
var POLICY_GLYPH = {
|
|
3743
|
+
"always-blocked": Lock,
|
|
3744
|
+
blocked: ShieldOutline,
|
|
3745
|
+
flagged: WarningFilled
|
|
3746
|
+
};
|
|
3747
|
+
var POLICY_DETAIL = {
|
|
3748
|
+
"always-blocked": "Cannot be changed or disabled",
|
|
3749
|
+
blocked: "Stops the payment",
|
|
3750
|
+
flagged: "Does not automatically block"
|
|
3751
|
+
};
|
|
3752
|
+
function shortAddr(a) {
|
|
3753
|
+
return a.length > 14 ? `${a.slice(0, 6)}\u2026${a.slice(-4)}` : a;
|
|
3754
|
+
}
|
|
3755
|
+
function TriggerGlyph({ cv }) {
|
|
3756
|
+
if (cv.tone === "blocked" || cv.tone === "warn") return /* @__PURE__ */ jsxRuntime.jsx(CloseCircle, {});
|
|
3757
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ShieldTick, {});
|
|
3758
|
+
}
|
|
3759
|
+
function CheckRow({ check, onViewPolicy }) {
|
|
3760
|
+
const label = check.id === "risk" ? check.ok ? "Risk screening passed" : "Risk screening failed" : check.label;
|
|
3761
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "sg-cp-check", "data-ok": check.ok, children: [
|
|
3762
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-check-head", children: [
|
|
3763
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-check-label", children: [
|
|
3764
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-check-mark", "data-ok": check.ok, children: check.ok ? /* @__PURE__ */ jsxRuntime.jsx(Tick, {}) : /* @__PURE__ */ jsxRuntime.jsx(Cross, {}) }),
|
|
3765
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: label }),
|
|
3766
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-sr-only", children: check.ok ? " \u2014 passed" : " \u2014 failed" })
|
|
3767
|
+
] }),
|
|
3768
|
+
check.id === "risk" ? /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-cp-link", onClick: onViewPolicy, children: [
|
|
3769
|
+
"View policy",
|
|
3770
|
+
/* @__PURE__ */ jsxRuntime.jsx(CornerArrow, {})
|
|
3771
|
+
] }) : null
|
|
3772
|
+
] }),
|
|
3773
|
+
check.note ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-check-note", children: check.note }) : null,
|
|
3774
|
+
check.reasons.map((reason) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-check-reason", children: humanizeComplianceReason(reason) }, reason))
|
|
3775
|
+
] });
|
|
3776
|
+
}
|
|
3777
|
+
function QuoteChecks({
|
|
3778
|
+
compliance,
|
|
3779
|
+
cv,
|
|
3780
|
+
checks,
|
|
3781
|
+
direct,
|
|
3782
|
+
onViewPolicy
|
|
3783
|
+
}) {
|
|
3784
|
+
const allPassed = cv.tone === "ok" && checks.length > 0 && checks.every((c) => c.ok);
|
|
3785
|
+
const summary = allPassed ? "All checks passed" : cv.label;
|
|
3786
|
+
const orphans = unattributedComplianceReasons(compliance, cv);
|
|
3787
|
+
const wallets = distinctScreenedWallets(compliance);
|
|
3788
|
+
const jurisdiction = compliance?.sourceJurisdiction?.trim();
|
|
3789
|
+
const hasDetails = Boolean(jurisdiction || wallets.length || compliance?.checkId);
|
|
3790
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-tabpanel", role: "tabpanel", "aria-label": "Quote checks", children: [
|
|
3791
|
+
/* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card", children: [
|
|
3792
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-summary", children: [
|
|
3793
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-summary-head", "data-tone": cv.tone, children: [
|
|
3794
|
+
cv.tone === "blocked" || cv.tone === "warn" ? /* @__PURE__ */ jsxRuntime.jsx(CloseCircle, {}) : cv.tone === "neutral" ? /* @__PURE__ */ jsxRuntime.jsx(PendingCircle, {}) : /* @__PURE__ */ jsxRuntime.jsx(TickCircle, {}),
|
|
3795
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-summary-title", children: summary })
|
|
3796
|
+
] }),
|
|
3797
|
+
checks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "sg-cp-summary-sub", children: [
|
|
3798
|
+
checks.length,
|
|
3799
|
+
" check",
|
|
3800
|
+
checks.length === 1 ? " was" : "s were",
|
|
3801
|
+
" completed for this payment"
|
|
3802
|
+
] }) : (
|
|
3803
|
+
// No decision was issued. Listing the controls here would be ticks for a verdict nobody
|
|
3804
|
+
// gave, and an unconfigured gate is not a set of passed checks.
|
|
3805
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-cp-summary-sub", children: "The gateway returned no compliance decision for this quote, so there is nothing to show. It is not a failed check." })
|
|
3806
|
+
)
|
|
3807
|
+
] }),
|
|
3808
|
+
checks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "sg-cp-checks", children: checks.map((check) => /* @__PURE__ */ jsxRuntime.jsx(CheckRow, { check, onViewPolicy }, check.id)) }) : null,
|
|
3809
|
+
orphans.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "sg-cp-orphans", children: orphans.map((reason) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: humanizeComplianceReason(reason) }, reason)) }) : null,
|
|
3810
|
+
direct && checks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-cp-scope", children: DIRECT_SCOPE_NOTE }) : null
|
|
3811
|
+
] }),
|
|
3812
|
+
compliance?.flaggedCategories?.length ? /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card", children: [
|
|
3813
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-card-head", children: [
|
|
3814
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-card-glyph", children: /* @__PURE__ */ jsxRuntime.jsx(WarningFilled, {}) }),
|
|
3815
|
+
/* @__PURE__ */ jsxRuntime.jsx("h5", { className: "sg-cp-card-title", children: "Flagged, not blocking" })
|
|
3816
|
+
] }),
|
|
3817
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-cp-flags", children: compliance.flaggedCategories.map(categoryLabel).join(" \xB7 ") }),
|
|
3818
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-cp-scope", children: "The policy records these and still allows the payment. They do not stop settlement." })
|
|
3819
|
+
] }) : null,
|
|
3820
|
+
hasDetails ? /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card", children: [
|
|
3821
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-card-head", children: [
|
|
3822
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-card-glyph", children: /* @__PURE__ */ jsxRuntime.jsx(Info, {}) }),
|
|
3823
|
+
/* @__PURE__ */ jsxRuntime.jsx("h5", { className: "sg-cp-card-title", children: "Quote details" })
|
|
3824
|
+
] }),
|
|
3825
|
+
/* @__PURE__ */ jsxRuntime.jsxs("dl", { className: "sg-cp-facts", children: [
|
|
3826
|
+
jurisdiction ? /* @__PURE__ */ jsxRuntime.jsx(Fact, { label: "Jurisdiction", value: jurisdiction }) : null,
|
|
3827
|
+
wallets.map((w, i) => /* @__PURE__ */ jsxRuntime.jsx(Fact, { label: wallets.length > 1 ? i === 0 ? "Payer" : "Recipient" : "Wallet", value: shortAddr(w), title: w, mono: true }, w)),
|
|
3828
|
+
compliance?.checkId ? /* @__PURE__ */ jsxRuntime.jsx(Fact, { label: "Check ID", value: compliance.checkId, mono: true }) : null
|
|
3829
|
+
] })
|
|
3830
|
+
] }) : null
|
|
3831
|
+
] });
|
|
3832
|
+
}
|
|
3833
|
+
function Fact({ label, value, title, mono = false }) {
|
|
3834
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-fact", children: [
|
|
3835
|
+
/* @__PURE__ */ jsxRuntime.jsx("dt", { children: label }),
|
|
3836
|
+
/* @__PURE__ */ jsxRuntime.jsx("dd", { title, className: mono ? "sg-mono" : void 0, children: value })
|
|
3837
|
+
] });
|
|
3838
|
+
}
|
|
3839
|
+
function ScreeningPolicy({ compliance }) {
|
|
3840
|
+
const policyId = compliance?.policyVersion?.trim();
|
|
3841
|
+
const applied = Boolean(compliance?.decision || policyId || compliance?.appliedPolicyNames?.length);
|
|
3842
|
+
const names = [...compliance?.appliedPolicyNames ?? [], ...compliance?.appliedLegislation ?? []];
|
|
3843
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-tabpanel", role: "tabpanel", "aria-label": "Screening policy", children: [
|
|
3844
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-policy-head", children: [
|
|
3845
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-summary", children: [
|
|
3846
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-summary-head", "data-tone": applied ? "ok" : "neutral", children: [
|
|
3847
|
+
applied ? /* @__PURE__ */ jsxRuntime.jsx(TickCircle, {}) : /* @__PURE__ */ jsxRuntime.jsx(PendingCircle, {}),
|
|
3848
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-summary-title", children: "Transaction screening policy" })
|
|
3849
|
+
] }),
|
|
3850
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-cp-summary-sub", children: applied ? "Applied to this payment" : "No policy decision was returned" })
|
|
3851
|
+
] }),
|
|
3852
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-policy-id sg-mono", children: policyId ? `Policy ${policyId}` : "Policy ID unavailable" })
|
|
3853
|
+
] }),
|
|
3854
|
+
names.length ? /* @__PURE__ */ jsxRuntime.jsxs("dl", { className: "sg-cp-facts sg-cp-policy-facts", children: [
|
|
3855
|
+
compliance?.appliedPolicyNames?.length ? /* @__PURE__ */ jsxRuntime.jsx(Fact, { label: "Policy", value: compliance.appliedPolicyNames.join(", ") }) : null,
|
|
3856
|
+
compliance?.appliedLegislation?.length ? /* @__PURE__ */ jsxRuntime.jsx(Fact, { label: "Legislation", value: compliance.appliedLegislation.join(", ") }) : null
|
|
3857
|
+
] }) : null,
|
|
3858
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cp-buckets", children: SCREENING_BUCKETS.map((bucket) => {
|
|
3859
|
+
const Glyph = POLICY_GLYPH[bucket.outcome];
|
|
3860
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card sg-cp-bucket", children: [
|
|
3861
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-bucket-head", children: [
|
|
3862
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-card-head", children: [
|
|
3863
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-card-glyph", children: /* @__PURE__ */ jsxRuntime.jsx(Glyph, {}) }),
|
|
3864
|
+
/* @__PURE__ */ jsxRuntime.jsx("h5", { className: "sg-cp-card-title", children: bucket.title })
|
|
3865
|
+
] }),
|
|
3866
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-bucket-detail", children: POLICY_DETAIL[bucket.outcome] })
|
|
3867
|
+
] }),
|
|
3868
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: "sg-cp-cats", children: bucket.categories.map((category) => /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
|
|
3869
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-dot", "aria-hidden": "true" }),
|
|
3870
|
+
category
|
|
3871
|
+
] }, category)) })
|
|
3872
|
+
] }, bucket.outcome);
|
|
3873
|
+
}) })
|
|
3874
|
+
] });
|
|
3875
|
+
}
|
|
3876
|
+
function CompliancePanel(props) {
|
|
3877
|
+
const [open, setOpen] = react.useState(false);
|
|
3878
|
+
const [tab, setTab] = react.useState("checks");
|
|
3879
|
+
const triggerRef = react.useRef(null);
|
|
3880
|
+
const sheetRef = react.useRef(null);
|
|
3881
|
+
const compliance = props.compliance ?? null;
|
|
3882
|
+
const cv = complianceView(compliance, props.hasQuote ?? true);
|
|
3883
|
+
const allChecks = complianceChecks(compliance, cv);
|
|
3884
|
+
const checks = props.direct ? allChecks.filter((c) => DIRECT_CHECK_IDS.includes(c.id)) : allChecks;
|
|
3885
|
+
const tag = complianceTagOf(compliance);
|
|
3886
|
+
react.useEffect(() => {
|
|
3887
|
+
if (!open) return;
|
|
3888
|
+
sheetRef.current?.focus();
|
|
3889
|
+
const onKey = (e) => {
|
|
3890
|
+
if (e.key === "Escape") {
|
|
3891
|
+
e.stopPropagation();
|
|
3892
|
+
setOpen(false);
|
|
3893
|
+
triggerRef.current?.focus();
|
|
3894
|
+
}
|
|
3895
|
+
};
|
|
3896
|
+
document.addEventListener("keydown", onKey, true);
|
|
3897
|
+
return () => document.removeEventListener("keydown", onKey, true);
|
|
3898
|
+
}, [open]);
|
|
3899
|
+
const close = () => {
|
|
3900
|
+
setOpen(false);
|
|
3901
|
+
triggerRef.current?.focus();
|
|
3902
|
+
};
|
|
3903
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp", "data-tone": cv.tone, children: [
|
|
3904
|
+
open ? null : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3905
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { ref: triggerRef, type: "button", className: "sg-cp-row", "data-tone": cv.tone, onClick: () => setOpen(true), "aria-haspopup": "dialog", children: [
|
|
3906
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-row-main", children: [
|
|
3907
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-row-glyph", children: /* @__PURE__ */ jsxRuntime.jsx(TriggerGlyph, { cv }) }),
|
|
3908
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-row-label", children: cv.label })
|
|
3909
|
+
] }),
|
|
3910
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-row-chev", children: /* @__PURE__ */ jsxRuntime.jsx(Chevron, {}) })
|
|
3911
|
+
] }),
|
|
3912
|
+
(cv.blocked || cv.needsAction) && tag ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-row-tag sg-mono", children: tag }) : null
|
|
3913
|
+
] }),
|
|
3914
|
+
open ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-sheet", role: "dialog", "aria-modal": "true", "aria-label": "Compliance details", ref: sheetRef, tabIndex: -1, children: [
|
|
3915
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-sheet-head", children: [
|
|
3916
|
+
/* @__PURE__ */ jsxRuntime.jsx("h4", { className: "sg-cp-sheet-title", children: "Compliance details" }),
|
|
3917
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-cp-close", onClick: close, "aria-label": "Close compliance details", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m6 6 12 12M18 6 6 18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
|
|
3918
|
+
] }),
|
|
3919
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-tabs", role: "tablist", "aria-label": "Compliance details sections", children: [
|
|
3920
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", role: "tab", "aria-selected": tab === "checks", "data-active": tab === "checks", className: "sg-cp-tab", onClick: () => setTab("checks"), children: "Quote checks" }),
|
|
3921
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", role: "tab", "aria-selected": tab === "policy", "data-active": tab === "policy", className: "sg-cp-tab", onClick: () => setTab("policy"), children: "Screening policy" })
|
|
3922
|
+
] }),
|
|
3923
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cp-sheet-body", children: tab === "checks" ? /* @__PURE__ */ jsxRuntime.jsx(QuoteChecks, { compliance, cv, checks, direct: !!props.direct, onViewPolicy: () => setTab("policy") }) : /* @__PURE__ */ jsxRuntime.jsx(ScreeningPolicy, { compliance }) })
|
|
3924
|
+
] }) : null
|
|
3925
|
+
] });
|
|
3926
|
+
}
|
|
2870
3927
|
|
|
2871
3928
|
// src/react/ui/chain-logos.ts
|
|
2872
3929
|
var BUNDLED_CHAIN_LOGO = {
|
|
@@ -2886,7 +3943,19 @@ var BUNDLED_TOKEN_LOGO = {
|
|
|
2886
3943
|
USDC: "https://coin-images.coingecko.com/coins/images/6319/large/USDC.png",
|
|
2887
3944
|
USDT: "https://coin-images.coingecko.com/coins/images/325/large/Tether.png",
|
|
2888
3945
|
USDE: "https://coin-images.coingecko.com/coins/images/33613/large/usde.png",
|
|
2889
|
-
XAUT: "https://coin-images.coingecko.com/coins/images/10481/large/Tether_Gold.png"
|
|
3946
|
+
XAUT: "https://coin-images.coingecko.com/coins/images/10481/large/Tether_Gold.png",
|
|
3947
|
+
// 2026-09-08, with the dapp-parity asset expansion — the same four URLs the dapp draws
|
|
3948
|
+
// (zd-dapp/src/lib/tokenLogos.ts), so the two products show one picture per coin.
|
|
3949
|
+
USDTB: "https://coin-images.coingecko.com/coins/images/52804/large/76357aa8-4ef7-446c-bad3-a3f944eeec7a.jpeg",
|
|
3950
|
+
AUSD: "https://coin-images.coingecko.com/coins/images/39284/large/AUSD_1024px.png",
|
|
3951
|
+
PYUSD: "https://coin-images.coingecko.com/coins/images/31212/large/PYUSD_Token_Logo_2x.png",
|
|
3952
|
+
USDG: "https://coin-images.coingecko.com/coins/images/51281/large/GDN_USDG_Token_200x200.png",
|
|
3953
|
+
// The wider stable list, added 2026-09-08 with the RWA exchange.
|
|
3954
|
+
DAI: "https://coin-images.coingecko.com/coins/images/9956/large/Badge_Dai.png",
|
|
3955
|
+
USDS: "https://coin-images.coingecko.com/coins/images/39926/large/usds.webp",
|
|
3956
|
+
RLUSD: "https://coin-images.coingecko.com/coins/images/39651/large/RLUSD_200x200_%281%29.png",
|
|
3957
|
+
USD1: "https://coin-images.coingecko.com/coins/images/54977/large/USD1_1000x1000_transparent.png",
|
|
3958
|
+
WM: "https://coin-images.coingecko.com/coins/images/50789/large/M.png"
|
|
2890
3959
|
};
|
|
2891
3960
|
function isHttpsUrl(u) {
|
|
2892
3961
|
return typeof u === "string" && /^https:\/\//i.test(u);
|
|
@@ -2916,12 +3985,18 @@ var CHAIN_SHORT = {
|
|
|
2916
3985
|
42161: "ARB",
|
|
2917
3986
|
98866: "PLM"
|
|
2918
3987
|
};
|
|
3988
|
+
function chainBadge(chainId) {
|
|
3989
|
+
const pinned = CHAIN_SHORT[Number(chainId)];
|
|
3990
|
+
if (pinned) return pinned;
|
|
3991
|
+
const name = CHAIN_LABELS[Number(chainId)];
|
|
3992
|
+
return name ? name.replace(/[^A-Za-z]/g, "").slice(0, 3).toUpperCase() : "?";
|
|
3993
|
+
}
|
|
2919
3994
|
function TokenGlyph(props) {
|
|
2920
3995
|
const [failed, setFailed] = react.useState([]);
|
|
2921
3996
|
const src = tokenLogoCandidates(props.symbol, props.logoUrl).find((u) => !failed.includes(u));
|
|
2922
3997
|
const mark = props.chainId ? chainLogoCandidates(props.chainId)[0] : void 0;
|
|
2923
3998
|
let badge = null;
|
|
2924
|
-
if (props.chainId) badge = mark ? /* @__PURE__ */ jsxRuntime.jsx("img", { className: "sg-tok-badge", src: mark, alt: "" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tok-badge", children:
|
|
3999
|
+
if (props.chainId) badge = mark ? /* @__PURE__ */ jsxRuntime.jsx("img", { className: "sg-tok-badge", src: mark, alt: "" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tok-badge", children: chainBadge(props.chainId) });
|
|
2925
4000
|
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-tok", "data-size": props.size === "sm" ? "sm" : void 0, children: [
|
|
2926
4001
|
src ? /* @__PURE__ */ jsxRuntime.jsx("img", { className: "sg-tok-img", src, alt: "", loading: "lazy", onError: () => setFailed((f) => [...f, src]) }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tok-fb", children: props.symbol.slice(0, 4) }),
|
|
2927
4002
|
badge
|
|
@@ -2931,17 +4006,18 @@ function ChevronGlyph() {
|
|
|
2931
4006
|
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.4", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m9 18 6-6-6-6" }) });
|
|
2932
4007
|
}
|
|
2933
4008
|
function TokenTile(props) {
|
|
4009
|
+
const shown = props.token?.symbol ?? props.pick?.symbol ?? "";
|
|
2934
4010
|
const glyph = props.pick ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2935
4011
|
/* @__PURE__ */ jsxRuntime.jsx(TokenGlyph, { symbol: props.pick.symbol, logoUrl: props.token?.logoUrl, chainId: props.pick.chainId }),
|
|
2936
4012
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: { minWidth: 0 }, children: [
|
|
2937
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-sym", children:
|
|
4013
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-sym", children: shown }),
|
|
2938
4014
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-chain", children: CHAIN_LABELS[props.pick.chainId] || `Chain ${props.pick.chainId}` })
|
|
2939
4015
|
] })
|
|
2940
4016
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2941
4017
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tok", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tok-fb", children: "?" }) }),
|
|
2942
4018
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-empty", children: "Select\u2026" })
|
|
2943
4019
|
] });
|
|
2944
|
-
const ariaLabel = `${props.label}: ${props.pick ? `${
|
|
4020
|
+
const ariaLabel = `${props.label}: ${props.pick ? `${shown} on ${CHAIN_LABELS[props.pick.chainId] || props.pick.chainId}` : "select token"}`;
|
|
2945
4021
|
if (props.row) {
|
|
2946
4022
|
return /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", ref: props.btnRef, className: "sg-tile sg-tile--row", disabled: props.disabled, onClick: props.onClick, "aria-label": ariaLabel, children: [
|
|
2947
4023
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-label", children: props.label }),
|
|
@@ -2982,7 +4058,8 @@ function FundingTile(props) {
|
|
|
2982
4058
|
function ChainChip(props) {
|
|
2983
4059
|
const [failed, setFailed] = react.useState([]);
|
|
2984
4060
|
const src = chainLogoCandidates(props.chain?.chainId, props.chain?.logoUrl).find((u) => !failed.includes(u));
|
|
2985
|
-
|
|
4061
|
+
const name = props.name ?? props.label;
|
|
4062
|
+
return /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-chain-chip", "data-selected": props.selected, title: name, "aria-label": name, "aria-pressed": props.selected, onClick: props.onClick, children: src ? /* @__PURE__ */ jsxRuntime.jsx("img", { src, alt: "", loading: "lazy", onError: () => setFailed((f) => [...f, src]) }) : props.label });
|
|
2986
4063
|
}
|
|
2987
4064
|
function SearchGlyph() {
|
|
2988
4065
|
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.4", strokeLinecap: "round", "aria-hidden": "true", children: [
|
|
@@ -3003,7 +4080,9 @@ function TokenSelect(props) {
|
|
|
3003
4080
|
const q = query.trim().toLowerCase();
|
|
3004
4081
|
const filtered = props.tokens.filter((t) => chainFilter == null ? true : Number(t.chainId) === chainFilter).filter((t) => {
|
|
3005
4082
|
if (!q) return true;
|
|
3006
|
-
return String(t.symbol || "").toLowerCase().includes(q) || String(t.name || "").toLowerCase().includes(q) || String(t.address || "").toLowerCase().includes(q)
|
|
4083
|
+
return String(t.symbol || "").toLowerCase().includes(q) || String(t.name || "").toLowerCase().includes(q) || String(t.address || "").toLowerCase().includes(q) || // Chain name too (2026-09-08): with ~37 destination chains most have no bundled mark and
|
|
4084
|
+
// show a three-letter badge, so "Katana" or "Berachain" has to be findable by typing it.
|
|
4085
|
+
String(CHAIN_LABELS[Number(t.chainId)] || "").toLowerCase().includes(q);
|
|
3007
4086
|
});
|
|
3008
4087
|
if (!props.balances) return filtered;
|
|
3009
4088
|
const balNum = (t) => {
|
|
@@ -3017,13 +4096,14 @@ function TokenSelect(props) {
|
|
|
3017
4096
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-back", onClick: props.onBack, "aria-label": "Back", children: /* @__PURE__ */ jsxRuntime.jsx(BackGlyph, {}) }),
|
|
3018
4097
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-sel-title", children: props.title })
|
|
3019
4098
|
] }),
|
|
3020
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-chain-grid", role: "group", "aria-label": "Filter by chain", children: [
|
|
4099
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-chain-grid", "data-scroll": props.chains.length > 14 ? void 0 : "false", role: "group", "aria-label": "Filter by chain", children: [
|
|
3021
4100
|
/* @__PURE__ */ jsxRuntime.jsx(ChainChip, { label: "All", selected: chainFilter == null, onClick: () => setChainFilter(null) }),
|
|
3022
4101
|
props.chains.map((c) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3023
4102
|
ChainChip,
|
|
3024
4103
|
{
|
|
3025
4104
|
chain: c,
|
|
3026
|
-
label:
|
|
4105
|
+
label: chainBadge(Number(c.chainId)),
|
|
4106
|
+
name: CHAIN_LABELS[Number(c.chainId)] || c.displayName || c.name || `Chain ${c.chainId}`,
|
|
3027
4107
|
selected: chainFilter === Number(c.chainId),
|
|
3028
4108
|
onClick: () => setChainFilter(Number(c.chainId))
|
|
3029
4109
|
},
|
|
@@ -3032,7 +4112,7 @@ function TokenSelect(props) {
|
|
|
3032
4112
|
] }),
|
|
3033
4113
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-search", children: [
|
|
3034
4114
|
/* @__PURE__ */ jsxRuntime.jsx(SearchGlyph, {}),
|
|
3035
|
-
/* @__PURE__ */ jsxRuntime.jsx("input", { autoFocus: true, placeholder: "Search by token or address", value: query, onChange: (e) => setQuery(e.target.value), spellCheck: false, "aria-label": "Search by token or address" })
|
|
4115
|
+
/* @__PURE__ */ jsxRuntime.jsx("input", { autoFocus: true, placeholder: "Search by token, network or address", value: query, onChange: (e) => setQuery(e.target.value), spellCheck: false, "aria-label": "Search by token, network or address" })
|
|
3036
4116
|
] }),
|
|
3037
4117
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-toklist", role: "group", "aria-label": props.title, children: rows.length ? rows.map((t) => {
|
|
3038
4118
|
const chainId = Number(t.chainId);
|
|
@@ -3064,7 +4144,7 @@ function TokenSelect(props) {
|
|
|
3064
4144
|
},
|
|
3065
4145
|
`${chainId}:${t.address}`
|
|
3066
4146
|
);
|
|
3067
|
-
}) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-sel-empty", children: "No tokens match \u2014 try another chain or search." }) })
|
|
4147
|
+
}) : props.loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-sel-empty", children: "Loading the token list\u2026" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-sel-empty", children: "No tokens match \u2014 try another chain or search." }) })
|
|
3068
4148
|
] });
|
|
3069
4149
|
}
|
|
3070
4150
|
function useTxHistory(account) {
|
|
@@ -3210,7 +4290,7 @@ function TxDetail(props) {
|
|
|
3210
4290
|
] }),
|
|
3211
4291
|
e.recipient ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
|
|
3212
4292
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Recipient" }),
|
|
3213
|
-
/* @__PURE__ */ jsxRuntime.jsx("b", { className: "sg-mono", children:
|
|
4293
|
+
/* @__PURE__ */ jsxRuntime.jsx("b", { className: "sg-mono", children: shortAddress2(e.recipient) })
|
|
3214
4294
|
] }) : null,
|
|
3215
4295
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
|
|
3216
4296
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Settlement" }),
|
|
@@ -3305,7 +4385,7 @@ function forgetIdentity(account) {
|
|
|
3305
4385
|
}
|
|
3306
4386
|
var addrEq = (a, b) => String(a || "").toLowerCase() === String(b || "").toLowerCase();
|
|
3307
4387
|
var chainName = (id) => id != null ? CHAIN_LABELS[id] || `Chain ${id}` : "";
|
|
3308
|
-
var STABLES =
|
|
4388
|
+
var STABLES = EXECUTABLE_STABLE_ASSETS;
|
|
3309
4389
|
function BankGlyph() {
|
|
3310
4390
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3311
4391
|
"svg",
|
|
@@ -3524,7 +4604,7 @@ function IdentityLine(props) {
|
|
|
3524
4604
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-link-id", children: [
|
|
3525
4605
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-id-icon", children: /* @__PURE__ */ jsxRuntime.jsx(WalletGlyph, {}) }),
|
|
3526
4606
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-link-id-text", children: [
|
|
3527
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-id-primary", children: props.account ?
|
|
4607
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-id-primary", children: props.account ? shortAddress2(props.account) : "ZeroDelta Link" }),
|
|
3528
4608
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-id-secondary", children: props.email ? props.email : props.account ? "Connected wallet" : "Connect your wallet to continue" })
|
|
3529
4609
|
] }),
|
|
3530
4610
|
props.account ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-wallet-dot", "aria-hidden": "true" }) : null
|
|
@@ -3546,19 +4626,17 @@ function PaymentIsland(props) {
|
|
|
3546
4626
|
const mode = props.mode ?? "exchange";
|
|
3547
4627
|
const rampMode = kind === "exchange" && mode !== "exchange";
|
|
3548
4628
|
const bankSettlement = isPay && props.settlement === "bank";
|
|
3549
|
-
const
|
|
3550
|
-
|
|
3551
|
-
[props.assets]
|
|
3552
|
-
);
|
|
4629
|
+
const exProduct = props.product ?? "stable";
|
|
4630
|
+
const exAllowed = react.useMemo(() => props.assets?.length ? props.assets.map((a) => symbolKey(a)) : void 0, [props.assets]);
|
|
3553
4631
|
const [exFrom, setExFrom] = react.useState(() => {
|
|
3554
4632
|
const chainId = props.defaultFromChainId ?? (kind === "swap" ? 42161 : void 0);
|
|
3555
4633
|
const asset = props.defaultFromAsset ?? (kind === "swap" ? "USDT" : void 0);
|
|
3556
|
-
return chainId && asset
|
|
4634
|
+
return chainId && asset ? { chainId, symbol: symbolKey(asset) } : null;
|
|
3557
4635
|
});
|
|
3558
4636
|
const [exTo, setExTo] = react.useState(() => {
|
|
3559
4637
|
const chainId = props.defaultToChainId ?? (kind === "swap" ? 8453 : void 0);
|
|
3560
4638
|
const asset = props.defaultToAsset ?? (kind === "swap" ? "USDC" : void 0);
|
|
3561
|
-
return chainId && asset
|
|
4639
|
+
return chainId && asset ? { chainId, symbol: symbolKey(asset) } : null;
|
|
3562
4640
|
});
|
|
3563
4641
|
const [exAmount, setExAmount] = react.useState(props.defaultAmount ?? "");
|
|
3564
4642
|
const exFromChainId = exFrom?.chainId;
|
|
@@ -3651,27 +4729,24 @@ function PaymentIsland(props) {
|
|
|
3651
4729
|
}
|
|
3652
4730
|
return map;
|
|
3653
4731
|
}, [annotated, holdings.loading]);
|
|
3654
|
-
const [
|
|
3655
|
-
const [registryTokens, setRegistryTokens] = react.useState([]);
|
|
4732
|
+
const [catalogue, setCatalogue] = react.useState(null);
|
|
3656
4733
|
react.useEffect(() => {
|
|
3657
4734
|
if (bankSettlement || !isPay && rampMode) return;
|
|
3658
4735
|
let alive = true;
|
|
3659
|
-
|
|
3660
|
-
if (
|
|
3661
|
-
const order = new Map(SUPPORTED_CHAINS.map((id, i) => [id, i]));
|
|
3662
|
-
setChains(
|
|
3663
|
-
cs.filter((c) => SUPPORTED_CHAIN_IDS.has(Number(c.chainId)) && c.isEnabled !== false).sort((a, b) => (order.get(Number(a.chainId)) ?? 99) - (order.get(Number(b.chainId)) ?? 99))
|
|
3664
|
-
);
|
|
3665
|
-
setRegistryTokens(ts.filter((t) => tokenEnabled(t) && SUPPORTED_CHAIN_IDS.has(Number(t.chainId))));
|
|
4736
|
+
engine.fetchCatalogue(isPay ? void 0 : exAllowed, isPay ? "stable" : exProduct).then((next) => {
|
|
4737
|
+
if (alive) setCatalogue(next);
|
|
3666
4738
|
});
|
|
3667
4739
|
return () => {
|
|
3668
4740
|
alive = false;
|
|
3669
4741
|
};
|
|
3670
|
-
}, [engine, isPay, rampMode, bankSettlement]);
|
|
3671
|
-
const
|
|
3672
|
-
|
|
3673
|
-
[
|
|
3674
|
-
);
|
|
4742
|
+
}, [engine, isPay, rampMode, bankSettlement, exAllowed, exProduct]);
|
|
4743
|
+
const chains = react.useMemo(() => {
|
|
4744
|
+
const order = new Map(SUPPORTED_CHAINS.map((id, i) => [id, i]));
|
|
4745
|
+
return [...catalogue?.chains ?? []].sort((a, b) => (order.get(Number(a.chainId)) ?? 99) - (order.get(Number(b.chainId)) ?? 99) || Number(a.chainId) - Number(b.chainId));
|
|
4746
|
+
}, [catalogue]);
|
|
4747
|
+
const registryTokens = react.useMemo(() => catalogue?.tokens ?? [], [catalogue]);
|
|
4748
|
+
const exchangeTokens = react.useMemo(() => isPay ? [] : registryTokens, [isPay, registryTokens]);
|
|
4749
|
+
const exSourceTokens = react.useMemo(() => isPay ? [] : catalogue?.sources ?? [], [isPay, catalogue]);
|
|
3675
4750
|
const [exBalances, setExBalances] = react.useState({});
|
|
3676
4751
|
const exBalReq = react.useRef(0);
|
|
3677
4752
|
react.useEffect(() => {
|
|
@@ -3693,6 +4768,39 @@ function PaymentIsland(props) {
|
|
|
3693
4768
|
}, [engine, isPay, wallet.account, exchangeTokens]);
|
|
3694
4769
|
const exFromToken = react.useMemo(() => exFrom ? findToken(exchangeTokens, exFrom.chainId, exFrom.symbol) : null, [exchangeTokens, exFrom]);
|
|
3695
4770
|
const exToToken = react.useMemo(() => exTo ? findToken(exchangeTokens, exTo.chainId, exTo.symbol) : null, [exchangeTokens, exTo]);
|
|
4771
|
+
const exFromPicker = react.useMemo(() => exProduct === "rwa" ? counterpartTokens(exSourceTokens, exToToken) : exSourceTokens, [exProduct, exSourceTokens, exToToken]);
|
|
4772
|
+
const exToPicker = react.useMemo(() => exProduct === "rwa" ? counterpartTokens(exchangeTokens, exFromToken) : exchangeTokens, [exProduct, exchangeTokens, exFromToken]);
|
|
4773
|
+
const exRwaSeeded = react.useRef(false);
|
|
4774
|
+
react.useEffect(() => {
|
|
4775
|
+
if (isPay || exProduct !== "rwa" || exRwaSeeded.current) return;
|
|
4776
|
+
if (props.defaultFromAsset || props.defaultToAsset || !catalogue?.ready) return;
|
|
4777
|
+
const stable = exSourceTokens.find((t) => Number(t.chainId) === 42161 && symbolKey(t.symbol) === "USDC") ?? exSourceTokens.find((t) => assetClassOf(t.symbol) === "stable");
|
|
4778
|
+
const rwa = exchangeTokens.find((t) => assetClassOf(t.symbol) === "rwa");
|
|
4779
|
+
if (!stable || !rwa) return;
|
|
4780
|
+
exRwaSeeded.current = true;
|
|
4781
|
+
setExFrom({ chainId: Number(stable.chainId), symbol: symbolKey(stable.symbol) });
|
|
4782
|
+
setExTo({ chainId: Number(rwa.chainId), symbol: symbolKey(rwa.symbol) });
|
|
4783
|
+
}, [isPay, exProduct, catalogue, exSourceTokens, exchangeTokens, props.defaultFromAsset, props.defaultToAsset]);
|
|
4784
|
+
const exDestinationStates = react.useMemo(() => {
|
|
4785
|
+
if (!catalogue?.ready) return void 0;
|
|
4786
|
+
const states = {};
|
|
4787
|
+
for (const token of catalogue.tokens) {
|
|
4788
|
+
const key = balanceKey(Number(token.chainId), token.address);
|
|
4789
|
+
const measured = exFromToken ? brokenLaneFor(token, exFromToken, catalogue.brokenLanes) : void 0;
|
|
4790
|
+
if (measured) {
|
|
4791
|
+
states[key] = { disabled: true, reason: brokenLaneReason(measured), hint: "Unavailable" };
|
|
4792
|
+
continue;
|
|
4793
|
+
}
|
|
4794
|
+
const verdict = destinationAvailability(token, catalogue, exFromToken);
|
|
4795
|
+
if (verdict === "available") continue;
|
|
4796
|
+
states[key] = {
|
|
4797
|
+
disabled: true,
|
|
4798
|
+
reason: verdict === "hub-only" ? `${token.symbol} cannot be delivered on this chain.` : "ZeroDelta cannot deliver this asset here.",
|
|
4799
|
+
hint: verdict === "hub-only" ? "Not here" : "Unavailable"
|
|
4800
|
+
};
|
|
4801
|
+
}
|
|
4802
|
+
return states;
|
|
4803
|
+
}, [catalogue, exFromToken]);
|
|
3696
4804
|
const exFromBal = exFrom && exFromToken ? exBalances[balanceKey(exFrom.chainId, exFromToken.address)] : void 0;
|
|
3697
4805
|
const fundingTokens = react.useMemo(() => {
|
|
3698
4806
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -3940,8 +5048,10 @@ function PaymentIsland(props) {
|
|
|
3940
5048
|
{
|
|
3941
5049
|
title: isFrom ? "Exchange from" : "Exchange to",
|
|
3942
5050
|
chains,
|
|
3943
|
-
tokens:
|
|
5051
|
+
tokens: isFrom ? exFromPicker : exToPicker,
|
|
3944
5052
|
balances: exBalances,
|
|
5053
|
+
optionStates: isFrom ? void 0 : exDestinationStates,
|
|
5054
|
+
loading: !catalogue?.ready,
|
|
3945
5055
|
onBack: () => closeSelector(openerRef),
|
|
3946
5056
|
onPick: (pick) => {
|
|
3947
5057
|
(isFrom ? setExFrom : setExTo)({ chainId: pick.chainId, symbol: symbolKey(pick.symbol) });
|
|
@@ -3999,7 +5109,7 @@ function PaymentIsland(props) {
|
|
|
3999
5109
|
] }),
|
|
4000
5110
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-receipt-sub", children: [
|
|
4001
5111
|
confirmed ? "Confirmed on-chain" : "Confirmation pending",
|
|
4002
|
-
isPay && props.recipient ? ` \xB7 ${
|
|
5112
|
+
isPay && props.recipient ? ` \xB7 ${shortAddress2(props.recipient)}` : ""
|
|
4003
5113
|
] })
|
|
4004
5114
|
] }),
|
|
4005
5115
|
!identityMatchesWallet ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-remember", children: [
|
|
@@ -4111,6 +5221,7 @@ function PaymentIsland(props) {
|
|
|
4111
5221
|
chainName(sel.source.chainId)
|
|
4112
5222
|
] })
|
|
4113
5223
|
] }) : null,
|
|
5224
|
+
sel && !loading && !quoteError ? /* @__PURE__ */ jsxRuntime.jsx(CompliancePanel, { compliance: sel.quote.compliance, direct: sel.state === "DIRECT" }) : null,
|
|
4114
5225
|
quoteError ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: flow.error || "Couldn't get a price right now." }) : null,
|
|
4115
5226
|
walletError ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: flow.error || "The wallet could not complete this payment." }) : null,
|
|
4116
5227
|
submitting || walletError ? /* @__PURE__ */ jsxRuntime.jsx(StepList, { variant: "rich", steps: flow.steps, verdict: flow.verdict }) : null,
|
|
@@ -4159,8 +5270,8 @@ function PaymentIsland(props) {
|
|
|
4159
5270
|
) }) })
|
|
4160
5271
|
] }) });
|
|
4161
5272
|
}
|
|
4162
|
-
var STABLES2 =
|
|
4163
|
-
var DEFAULT_FUNDING_ASSETS = [
|
|
5273
|
+
var STABLES2 = EXECUTABLE_STABLE_ASSETS;
|
|
5274
|
+
var DEFAULT_FUNDING_ASSETS = [...EXECUTABLE_STABLE_ASSETS];
|
|
4164
5275
|
function CheckGlyph3() {
|
|
4165
5276
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4166
5277
|
"svg",
|
|
@@ -4265,23 +5376,22 @@ function StableGeniePay(props) {
|
|
|
4265
5376
|
}
|
|
4266
5377
|
return map;
|
|
4267
5378
|
}, [annotated, holdings.loading]);
|
|
4268
|
-
const [
|
|
4269
|
-
const
|
|
5379
|
+
const [catalogue, setCatalogue] = react.useState(null);
|
|
5380
|
+
const chains = react.useMemo(() => {
|
|
5381
|
+
const order = new Map(SUPPORTED_CHAINS.map((id, i) => [id, i]));
|
|
5382
|
+
return [...catalogue?.chains ?? []].sort((a, b) => (order.get(Number(a.chainId)) ?? 99) - (order.get(Number(b.chainId)) ?? 99) || Number(a.chainId) - Number(b.chainId));
|
|
5383
|
+
}, [catalogue]);
|
|
5384
|
+
const registryTokens = react.useMemo(() => catalogue?.tokens ?? [], [catalogue]);
|
|
4270
5385
|
react.useEffect(() => {
|
|
4271
5386
|
if (props.variant === "pill") return;
|
|
4272
5387
|
let alive = true;
|
|
4273
|
-
|
|
4274
|
-
if (
|
|
4275
|
-
const order = new Map(SUPPORTED_CHAINS.map((id, i) => [id, i]));
|
|
4276
|
-
setChains(
|
|
4277
|
-
cs.filter((c) => SUPPORTED_CHAIN_IDS.has(Number(c.chainId)) && c.isEnabled !== false).sort((a, b) => (order.get(Number(a.chainId)) ?? 99) - (order.get(Number(b.chainId)) ?? 99))
|
|
4278
|
-
);
|
|
4279
|
-
setRegistryTokens(ts.filter((t) => tokenEnabled(t) && SUPPORTED_CHAIN_IDS.has(Number(t.chainId))));
|
|
5388
|
+
engine.fetchCatalogue().then((next) => {
|
|
5389
|
+
if (alive) setCatalogue(next);
|
|
4280
5390
|
});
|
|
4281
5391
|
return () => {
|
|
4282
5392
|
alive = false;
|
|
4283
5393
|
};
|
|
4284
|
-
}, [engine]);
|
|
5394
|
+
}, [engine, props.variant]);
|
|
4285
5395
|
const fundingTokens = react.useMemo(() => {
|
|
4286
5396
|
const seen = /* @__PURE__ */ new Set();
|
|
4287
5397
|
const list = [];
|
|
@@ -4405,7 +5515,7 @@ function StableGeniePay(props) {
|
|
|
4405
5515
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
|
|
4406
5516
|
flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
|
|
4407
5517
|
" \xB7 ",
|
|
4408
|
-
|
|
5518
|
+
shortAddress2(props.recipient)
|
|
4409
5519
|
] })
|
|
4410
5520
|
] }),
|
|
4411
5521
|
lastTxOwned ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", onClick: () => setHist({ entry: flow.lastTxEntry }), children: "View transaction" }) }) : null
|
|
@@ -4448,6 +5558,7 @@ function StableGeniePay(props) {
|
|
|
4448
5558
|
scannedEmpty ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-note", children: "None of your balances can cover this yet \u2014 pick a different asset to fund with." }) : null,
|
|
4449
5559
|
flow.status === "ready" && !visibleRoutes.length ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { children: "No funding route matches the accepted assets for this payment." }) : null
|
|
4450
5560
|
] }),
|
|
5561
|
+
sel && flow.status !== "loading" ? /* @__PURE__ */ jsxRuntime.jsx(CompliancePanel, { compliance: sel.quote.compliance, direct: sel.state === "DIRECT" }) : null,
|
|
4451
5562
|
submitting ? /* @__PURE__ */ jsxRuntime.jsx(StepList, { steps: flow.steps }) : null,
|
|
4452
5563
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4453
5564
|
Button,
|
|
@@ -4460,8 +5571,8 @@ function StableGeniePay(props) {
|
|
|
4460
5571
|
) })
|
|
4461
5572
|
] }) }) });
|
|
4462
5573
|
}
|
|
4463
|
-
var
|
|
4464
|
-
var
|
|
5574
|
+
var sourceChainOptions = SUPPORTED_CHAINS.map((c) => ({ value: c, label: CHAIN_LABELS[c] || `Chain ${c}` }));
|
|
5575
|
+
var bundledAssetOptions = SUPPORTED_ASSETS2.map((a) => ({ value: a, label: a }));
|
|
4465
5576
|
function CheckGlyph4() {
|
|
4466
5577
|
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M20 6 9 17l-5-5" }) });
|
|
4467
5578
|
}
|
|
@@ -4474,6 +5585,33 @@ function StableGenieSwap(props) {
|
|
|
4474
5585
|
const [toChainId, setToChainId] = react.useState(props.defaultToChainId ?? 8453);
|
|
4475
5586
|
const [toAsset, setToAsset] = react.useState(props.defaultToAsset ?? "USDC");
|
|
4476
5587
|
const [amount, setAmount] = react.useState(props.defaultAmount ?? "");
|
|
5588
|
+
const [catalogue, setCatalogue] = react.useState(null);
|
|
5589
|
+
react.useEffect(() => {
|
|
5590
|
+
if (props.variant === "pill") return;
|
|
5591
|
+
let alive = true;
|
|
5592
|
+
engine.fetchCatalogue().then((next) => {
|
|
5593
|
+
if (alive && next.ready) setCatalogue(next);
|
|
5594
|
+
});
|
|
5595
|
+
return () => {
|
|
5596
|
+
alive = false;
|
|
5597
|
+
};
|
|
5598
|
+
}, [engine, props.variant]);
|
|
5599
|
+
const assetOptions = react.useMemo(() => {
|
|
5600
|
+
if (!catalogue) return bundledAssetOptions;
|
|
5601
|
+
const symbols = [...new Set(catalogue.tokens.map((t) => t.symbol.toUpperCase()))];
|
|
5602
|
+
const ordered = [...SUPPORTED_ASSETS2.filter((a) => symbols.includes(a)), ...symbols.filter((s) => !SUPPORTED_ASSETS2.includes(s))];
|
|
5603
|
+
return ordered.length ? ordered.map((a) => ({ value: a, label: a })) : bundledAssetOptions;
|
|
5604
|
+
}, [catalogue]);
|
|
5605
|
+
const toChainOptions = react.useMemo(() => {
|
|
5606
|
+
if (!catalogue) return sourceChainOptions;
|
|
5607
|
+
const ids = [...catalogue.chainIds].sort((a, b) => {
|
|
5608
|
+
const ai = SUPPORTED_CHAINS.indexOf(a);
|
|
5609
|
+
const bi = SUPPORTED_CHAINS.indexOf(b);
|
|
5610
|
+
if (ai !== bi) return (ai < 0 ? 999 : ai) - (bi < 0 ? 999 : bi);
|
|
5611
|
+
return a - b;
|
|
5612
|
+
});
|
|
5613
|
+
return ids.map((c) => ({ value: c, label: CHAIN_LABELS[c] || `Chain ${c}` }));
|
|
5614
|
+
}, [catalogue]);
|
|
4477
5615
|
const amountValid = /^\d+(\.\d+)?$/.test(amount.replace(",", ".")) && Number(amount.replace(",", ".")) > 0;
|
|
4478
5616
|
const enabled = amountValid && props.variant !== "pill";
|
|
4479
5617
|
const paramsKey = `${fromChainId}|${fromAsset}|${toChainId}|${toAsset}|${amount}|${props.recipient ?? ""}`;
|
|
@@ -4538,7 +5676,7 @@ function StableGenieSwap(props) {
|
|
|
4538
5676
|
] }),
|
|
4539
5677
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
|
|
4540
5678
|
flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
|
|
4541
|
-
props.recipient ? ` \xB7 ${
|
|
5679
|
+
props.recipient ? ` \xB7 ${shortAddress2(props.recipient)}` : ""
|
|
4542
5680
|
] })
|
|
4543
5681
|
] }),
|
|
4544
5682
|
lastTxOwned ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", onClick: () => setHist({ entry: flow.lastTxEntry }), children: "View transaction" }) }) : null
|
|
@@ -4550,7 +5688,7 @@ function StableGenieSwap(props) {
|
|
|
4550
5688
|
/* @__PURE__ */ jsxRuntime.jsx(AmountInput, { value: amount, onChange: setAmount, disabled: submitting }),
|
|
4551
5689
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-row", style: { marginTop: 8 }, children: [
|
|
4552
5690
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-grow", children: /* @__PURE__ */ jsxRuntime.jsx(Select, { value: fromAsset, onChange: setFromAsset, options: assetOptions, disabled: submitting }) }),
|
|
4553
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-grow", children: /* @__PURE__ */ jsxRuntime.jsx(Select, { value: fromChainId, onChange: (v) => setFromChainId(Number(v)), options:
|
|
5691
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-grow", children: /* @__PURE__ */ jsxRuntime.jsx(Select, { value: fromChainId, onChange: (v) => setFromChainId(Number(v)), options: sourceChainOptions, disabled: submitting }) })
|
|
4554
5692
|
] })
|
|
4555
5693
|
] }),
|
|
4556
5694
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-reverse", onClick: reverse, "aria-label": "Reverse", disabled: submitting, children: "\u2193" }),
|
|
@@ -4559,11 +5697,12 @@ function StableGenieSwap(props) {
|
|
|
4559
5697
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-anchor sg-mono", children: toValue }),
|
|
4560
5698
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-row", style: { marginTop: 8 }, children: [
|
|
4561
5699
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-grow", children: /* @__PURE__ */ jsxRuntime.jsx(Select, { value: toAsset, onChange: setToAsset, options: assetOptions, disabled: submitting }) }),
|
|
4562
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-grow", children: /* @__PURE__ */ jsxRuntime.jsx(Select, { value: toChainId, onChange: (v) => setToChainId(Number(v)), options:
|
|
5700
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-grow", children: /* @__PURE__ */ jsxRuntime.jsx(Select, { value: toChainId, onChange: (v) => setToChainId(Number(v)), options: toChainOptions, disabled: submitting }) })
|
|
4563
5701
|
] })
|
|
4564
5702
|
] }),
|
|
4565
5703
|
flow.status === "error" && flow.error ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: flow.error }) : null,
|
|
4566
5704
|
flow.routes.length ? /* @__PURE__ */ jsxRuntime.jsx(RouteList, { routes: flow.routes, selectedId: flow.selected?.id ?? null, onSelect: flow.selectRoute }) : null,
|
|
5705
|
+
flow.selected && flow.status !== "loading" ? /* @__PURE__ */ jsxRuntime.jsx(CompliancePanel, { compliance: flow.selected.quote.compliance, direct: flow.selected.state === "DIRECT" }) : null,
|
|
4567
5706
|
submitting ? /* @__PURE__ */ jsxRuntime.jsx(StepList, { steps: flow.steps }) : null,
|
|
4568
5707
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
|
|
4569
5708
|
!wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: wallet.connect, busy: wallet.connecting, children: "Connect wallet" }) : /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: flow.submit, busy: submitting, disabled: !flow.selected || flow.insufficient || !!flow.nativeShortfall || !enabled || flow.status === "loading", children: swapLabel }),
|
|
@@ -4571,7 +5710,6 @@ function StableGenieSwap(props) {
|
|
|
4571
5710
|
] })
|
|
4572
5711
|
] });
|
|
4573
5712
|
}
|
|
4574
|
-
var STABLE_ASSETS = ["USDC", "USDT", "USDE"];
|
|
4575
5713
|
var FIAT = [
|
|
4576
5714
|
{ code: "USD", glyph: "$", label: "US Dollar" },
|
|
4577
5715
|
{ code: "EUR", glyph: "\u20AC", label: "Euro" },
|
|
@@ -4614,24 +5752,25 @@ function StableGenieExchange(props) {
|
|
|
4614
5752
|
const mode = props.mode ?? "exchange";
|
|
4615
5753
|
const wide = props.variant === "wide";
|
|
4616
5754
|
const isPill = props.variant === "pill";
|
|
4617
|
-
const
|
|
4618
|
-
const
|
|
4619
|
-
const [
|
|
5755
|
+
const product = props.product ?? "stable";
|
|
5756
|
+
const allowed = react.useMemo(() => props.assets?.length ? props.assets.map((a) => symbolKey(a)) : void 0, [props.assets]);
|
|
5757
|
+
const [catalogue, setCatalogue] = react.useState(null);
|
|
4620
5758
|
react.useEffect(() => {
|
|
4621
5759
|
if (isPill) return;
|
|
4622
5760
|
let alive = true;
|
|
4623
|
-
|
|
4624
|
-
if (
|
|
4625
|
-
const order = new Map(SUPPORTED_CHAINS.map((id, i) => [id, i]));
|
|
4626
|
-
setChains(
|
|
4627
|
-
cs.filter((c) => SUPPORTED_CHAIN_IDS.has(Number(c.chainId)) && c.isEnabled !== false).sort((a, b) => (order.get(Number(a.chainId)) ?? 99) - (order.get(Number(b.chainId)) ?? 99))
|
|
4628
|
-
);
|
|
4629
|
-
setTokens(ts.filter((t) => tokenEnabled(t) && SUPPORTED_CHAIN_IDS.has(Number(t.chainId)) && allowed.includes(symbolKey(t.symbol)) && isDeliverable(symbolKey(t.symbol), Number(t.chainId))));
|
|
5761
|
+
engine.fetchCatalogue(allowed, product).then((next) => {
|
|
5762
|
+
if (alive) setCatalogue(next);
|
|
4630
5763
|
});
|
|
4631
5764
|
return () => {
|
|
4632
5765
|
alive = false;
|
|
4633
5766
|
};
|
|
4634
|
-
}, [engine, allowed]);
|
|
5767
|
+
}, [engine, allowed, product, isPill]);
|
|
5768
|
+
const chains = react.useMemo(() => {
|
|
5769
|
+
const order = new Map(SUPPORTED_CHAINS.map((id, i) => [id, i]));
|
|
5770
|
+
return [...catalogue?.chains ?? []].sort((a, b) => (order.get(Number(a.chainId)) ?? 99) - (order.get(Number(b.chainId)) ?? 99) || Number(a.chainId) - Number(b.chainId));
|
|
5771
|
+
}, [catalogue]);
|
|
5772
|
+
const tokens = react.useMemo(() => catalogue?.tokens ?? [], [catalogue]);
|
|
5773
|
+
const sourceTokens = react.useMemo(() => catalogue?.sources ?? [], [catalogue]);
|
|
4635
5774
|
const [view, setView] = react.useState("main");
|
|
4636
5775
|
const [hist, setHist] = react.useState(null);
|
|
4637
5776
|
const histBtnRef = react.useRef(null);
|
|
@@ -4641,19 +5780,53 @@ function StableGenieExchange(props) {
|
|
|
4641
5780
|
};
|
|
4642
5781
|
react.useEffect(() => setHist(null), [wallet.account]);
|
|
4643
5782
|
const [from, setFrom] = react.useState(
|
|
4644
|
-
() => props.defaultFromChainId && props.defaultFromAsset
|
|
5783
|
+
() => props.defaultFromChainId && props.defaultFromAsset ? { chainId: props.defaultFromChainId, symbol: symbolKey(props.defaultFromAsset) } : null
|
|
4645
5784
|
);
|
|
4646
5785
|
const [to, setTo] = react.useState(
|
|
4647
|
-
() => props.defaultToChainId && props.defaultToAsset
|
|
5786
|
+
() => props.defaultToChainId && props.defaultToAsset ? { chainId: props.defaultToChainId, symbol: symbolKey(props.defaultToAsset) } : null
|
|
4648
5787
|
);
|
|
4649
5788
|
const [amount, setAmount] = react.useState(props.defaultAmount ?? "");
|
|
4650
5789
|
const [fiatCurrency, setFiatCurrency] = react.useState(props.fiatCurrency ?? "EUR");
|
|
4651
5790
|
const fromToken = react.useMemo(() => from ? findToken(tokens, from.chainId, from.symbol) : null, [tokens, from]);
|
|
4652
5791
|
const toToken = react.useMemo(() => to ? findToken(tokens, to.chainId, to.symbol) : null, [tokens, to]);
|
|
5792
|
+
const toSymbol = toToken?.symbol ?? to?.symbol ?? "";
|
|
5793
|
+
const fromPickerTokens = react.useMemo(() => product === "rwa" ? counterpartTokens(sourceTokens, toToken) : sourceTokens, [product, sourceTokens, toToken]);
|
|
5794
|
+
const toPickerTokens = react.useMemo(() => product === "rwa" ? counterpartTokens(tokens, fromToken) : tokens, [product, tokens, fromToken]);
|
|
5795
|
+
const rwaSeeded = react.useRef(false);
|
|
5796
|
+
react.useEffect(() => {
|
|
5797
|
+
if (product !== "rwa" || rwaSeeded.current) return;
|
|
5798
|
+
if (props.defaultFromAsset || props.defaultToAsset || !catalogue?.ready) return;
|
|
5799
|
+
const stable = sourceTokens.find((t) => Number(t.chainId) === 42161 && symbolKey(t.symbol) === "USDC") ?? sourceTokens.find((t) => assetClassOf(t.symbol) === "stable");
|
|
5800
|
+
const rwa = tokens.find((t) => assetClassOf(t.symbol) === "rwa");
|
|
5801
|
+
if (!stable || !rwa) return;
|
|
5802
|
+
rwaSeeded.current = true;
|
|
5803
|
+
setFrom({ chainId: Number(stable.chainId), symbol: symbolKey(stable.symbol) });
|
|
5804
|
+
setTo({ chainId: Number(rwa.chainId), symbol: symbolKey(rwa.symbol) });
|
|
5805
|
+
}, [product, catalogue, sourceTokens, tokens, props.defaultFromAsset, props.defaultToAsset]);
|
|
5806
|
+
const destinationStates = react.useMemo(() => {
|
|
5807
|
+
if (!catalogue?.ready) return void 0;
|
|
5808
|
+
const states = {};
|
|
5809
|
+
for (const token of catalogue.tokens) {
|
|
5810
|
+
const key = `${Number(token.chainId)}:${String(token.address || "").toLowerCase()}`;
|
|
5811
|
+
const measured = fromToken ? brokenLaneFor(token, fromToken, catalogue.brokenLanes) : void 0;
|
|
5812
|
+
if (measured) {
|
|
5813
|
+
states[key] = { disabled: true, reason: brokenLaneReason(measured), hint: "Unavailable" };
|
|
5814
|
+
continue;
|
|
5815
|
+
}
|
|
5816
|
+
const verdict = destinationAvailability(token, catalogue, fromToken);
|
|
5817
|
+
if (verdict === "available") continue;
|
|
5818
|
+
states[key] = {
|
|
5819
|
+
disabled: true,
|
|
5820
|
+
reason: verdict === "hub-only" ? `${token.symbol} cannot be delivered on this chain \u2014 choose an execution chain.` : "ZeroDelta cannot deliver this asset here.",
|
|
5821
|
+
hint: verdict === "hub-only" ? "Not here" : "Unavailable"
|
|
5822
|
+
};
|
|
5823
|
+
}
|
|
5824
|
+
return states;
|
|
5825
|
+
}, [catalogue, fromToken]);
|
|
4653
5826
|
const normalizedAmount = normalizeDecimalText(amount);
|
|
4654
5827
|
const amountValid = /^\d+(\.\d+)?$/.test(normalizedAmount) && Number(normalizedAmount) > 0 && Number(normalizedAmount) <= 1e9;
|
|
4655
5828
|
const rampMode = mode !== "exchange";
|
|
4656
|
-
const inUniverse = (p) => Boolean(p &&
|
|
5829
|
+
const inUniverse = (p) => Boolean(p && tokens.some((t) => Number(t.chainId) === p.chainId && symbolKey(t.symbol) === p.symbol));
|
|
4657
5830
|
const cryptoReady = rampMode ? inUniverse(mode === "onramp" ? to : from) : inUniverse(from) && inUniverse(to);
|
|
4658
5831
|
const quotable = mode === "exchange" && inUniverse(from) && inUniverse(to) && amountValid;
|
|
4659
5832
|
const [balances, setBalances] = react.useState({});
|
|
@@ -4676,7 +5849,7 @@ function StableGenieExchange(props) {
|
|
|
4676
5849
|
});
|
|
4677
5850
|
}, [engine, wallet.account, tokens]);
|
|
4678
5851
|
const fromBal = from && fromToken ? balances[balanceKey(from.chainId, fromToken.address)] : void 0;
|
|
4679
|
-
const paramsKey = `${mode}|${from?.chainId}|${from?.symbol}|${to?.chainId}|${
|
|
5852
|
+
const paramsKey = `${mode}|${from?.chainId}|${from?.symbol}|${to?.chainId}|${toSymbol}|${normalizedAmount}|${props.recipient ?? ""}`;
|
|
4680
5853
|
const flow = useFlow({
|
|
4681
5854
|
engine,
|
|
4682
5855
|
wallet,
|
|
@@ -4728,7 +5901,7 @@ function StableGenieExchange(props) {
|
|
|
4728
5901
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-wallet", "data-connected": connected || void 0, onClick: connected ? void 0 : wallet.connect, disabled: wallet.connecting, children: connected ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4729
5902
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-wallet-dot", "aria-hidden": "true" }),
|
|
4730
5903
|
" ",
|
|
4731
|
-
|
|
5904
|
+
shortAddress2(wallet.account)
|
|
4732
5905
|
] }) : wallet.connecting ? "Connecting\u2026" : "Connect wallet" })
|
|
4733
5906
|
] });
|
|
4734
5907
|
const fromTileRef = react.useRef(null);
|
|
@@ -4748,8 +5921,10 @@ function StableGenieExchange(props) {
|
|
|
4748
5921
|
{
|
|
4749
5922
|
title: isFrom ? "Exchange from" : "Exchange to",
|
|
4750
5923
|
chains,
|
|
4751
|
-
tokens,
|
|
5924
|
+
tokens: isFrom ? fromPickerTokens : toPickerTokens,
|
|
4752
5925
|
balances,
|
|
5926
|
+
optionStates: isFrom ? void 0 : destinationStates,
|
|
5927
|
+
loading: !catalogue?.ready,
|
|
4753
5928
|
onBack: () => closeSelector(isFrom),
|
|
4754
5929
|
onPick: (pick) => {
|
|
4755
5930
|
(isFrom ? setFrom : setTo)({ chainId: pick.chainId, symbol: symbolKey(pick.symbol) });
|
|
@@ -4764,11 +5939,11 @@ function StableGenieExchange(props) {
|
|
|
4764
5939
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-amt sg-mono", children: [
|
|
4765
5940
|
receive,
|
|
4766
5941
|
" ",
|
|
4767
|
-
|
|
5942
|
+
toSymbol
|
|
4768
5943
|
] }),
|
|
4769
5944
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
|
|
4770
5945
|
flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
|
|
4771
|
-
props.recipient ? ` \xB7 ${
|
|
5946
|
+
props.recipient ? ` \xB7 ${shortAddress2(props.recipient)}` : ""
|
|
4772
5947
|
] })
|
|
4773
5948
|
] }),
|
|
4774
5949
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
|
|
@@ -4805,7 +5980,7 @@ function StableGenieExchange(props) {
|
|
|
4805
5980
|
!rampMode && quoteError && !wide ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: quoteError }) : null,
|
|
4806
5981
|
!rampMode && !wide && quotable && !quoteError ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-panel", style: { marginTop: 12 }, children: [
|
|
4807
5982
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-label", children: "You receive (estimated)" }),
|
|
4808
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-anchor sg-mono", children: quoting ? "\u2026" : receive ? `${receive} ${
|
|
5983
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-anchor sg-mono", children: quoting ? "\u2026" : receive ? `${receive} ${toSymbol}` : "\u2014" }),
|
|
4809
5984
|
meta && !quoting ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-recv-sub", children: [
|
|
4810
5985
|
"via ",
|
|
4811
5986
|
meta.bridge,
|
|
@@ -4815,6 +5990,7 @@ function StableGenieExchange(props) {
|
|
|
4815
5990
|
meta.duration ? ` \xB7 ~${meta.duration}s` : ""
|
|
4816
5991
|
] }) : null
|
|
4817
5992
|
] }) : null,
|
|
5993
|
+
connected && flow.selected && flow.status !== "loading" ? /* @__PURE__ */ jsxRuntime.jsx(CompliancePanel, { compliance: flow.selected.quote.compliance, direct: flow.selected.state === "DIRECT" }) : null,
|
|
4818
5994
|
submitting ? /* @__PURE__ */ jsxRuntime.jsx(StepList, { steps: flow.steps }) : null,
|
|
4819
5995
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
|
|
4820
5996
|
!connected && !rampMode ? /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: wallet.connect, busy: wallet.connecting, children: "Connect wallet" }) : /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: rampMode ? void 0 : flow.submit, busy: submitting, disabled: rampMode || !quotable || !cryptoReady || connected && (!flow.selected || flow.insufficient || !!flow.nativeShortfall || flow.status === "loading"), children: ctaLabel }),
|
|
@@ -4853,7 +6029,7 @@ function StableGenieExchange(props) {
|
|
|
4853
6029
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-recv-amt sg-mono", children: [
|
|
4854
6030
|
receive,
|
|
4855
6031
|
" ",
|
|
4856
|
-
|
|
6032
|
+
toSymbol
|
|
4857
6033
|
] }),
|
|
4858
6034
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-recv-sub", children: [
|
|
4859
6035
|
"on ",
|
|
@@ -4909,9 +6085,10 @@ function StableGenieExchange(props) {
|
|
|
4909
6085
|
function mount(el, config) {
|
|
4910
6086
|
const root = client.createRoot(el);
|
|
4911
6087
|
const variant = config.variant ?? "pay";
|
|
4912
|
-
const
|
|
6088
|
+
const isExchange = variant === "exchange" || variant === "rwa";
|
|
6089
|
+
const Comp = variant === "swap" ? StableGenieSwap : isExchange ? StableGenieExchange : StableGeniePay;
|
|
4913
6090
|
const { variant: _variant, ...props } = config;
|
|
4914
|
-
root.render(react.createElement(Comp, props));
|
|
6091
|
+
root.render(react.createElement(Comp, variant === "rwa" ? { ...props, product: "rwa" } : props));
|
|
4915
6092
|
return () => root.unmount();
|
|
4916
6093
|
}
|
|
4917
6094
|
|