@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/index.cjs
CHANGED
|
@@ -17,8 +17,29 @@ function useMergedConfig(local) {
|
|
|
17
17
|
// src/core/constants.ts
|
|
18
18
|
var DEFAULT_WIDGET_API_BASE = "/api/widget/v1";
|
|
19
19
|
var SUPPORTED_CHAIN_IDS = /* @__PURE__ */ new Set([1, 10, 42161, 8453, 57073, 130, 9745, 146, 98866]);
|
|
20
|
-
var
|
|
20
|
+
var EXECUTABLE_STABLE_ASSETS = /* @__PURE__ */ new Set(["USDC", "USDT", "USDE", "USDTB", "AUSD", "PYUSD", "USDG"]);
|
|
21
|
+
var STABLE_ASSETS = /* @__PURE__ */ new Set([...EXECUTABLE_STABLE_ASSETS, "USD1", "WM", "USDS", "DAI", "RLUSD"]);
|
|
22
|
+
var TRADEABLE_RWA_ASSETS = /* @__PURE__ */ new Set([
|
|
23
|
+
"XAUT",
|
|
24
|
+
// Nest vault shares — chained delivery on Plume, sellable from their Ethereum deployment.
|
|
25
|
+
"NALPHA",
|
|
26
|
+
"NTBILL",
|
|
27
|
+
"NBASIS",
|
|
28
|
+
"NCREDIT",
|
|
29
|
+
"NOPAL",
|
|
30
|
+
"NWISDOM",
|
|
31
|
+
"NACRDX",
|
|
32
|
+
"NLCRD",
|
|
33
|
+
"NAXI",
|
|
34
|
+
"NCLOA",
|
|
35
|
+
"NFALCON",
|
|
36
|
+
// Centrifuge deRWA pair — chained asks on Base.
|
|
37
|
+
"DEJAAA",
|
|
38
|
+
"DESPXA"
|
|
39
|
+
]);
|
|
40
|
+
var SUPPORTED_ASSETS = /* @__PURE__ */ new Set([...STABLE_ASSETS, ...TRADEABLE_RWA_ASSETS]);
|
|
21
41
|
var API_CACHE_TTL_MS = 6e4;
|
|
42
|
+
var SCREEN_CACHE_TTL_MS = 5 * 6e4;
|
|
22
43
|
var MAX_QUOTE_CANDIDATES = 8;
|
|
23
44
|
var QUOTE_BUFFER_BPS = 50;
|
|
24
45
|
var LZ_FEE_BUFFER_BPS = 1500n;
|
|
@@ -30,7 +51,41 @@ var ERC20_ALLOWANCE_SELECTOR = "0xdd62ed3e";
|
|
|
30
51
|
var ERC20_BALANCEOF_SELECTOR = "0x70a08231";
|
|
31
52
|
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
32
53
|
var PREVIEW_OWNER = "0x1111111111111111111111111111111111111111";
|
|
33
|
-
var CANONICAL_DECIMALS = {
|
|
54
|
+
var CANONICAL_DECIMALS = {
|
|
55
|
+
USDC: 6,
|
|
56
|
+
USDT: 6,
|
|
57
|
+
USDE: 18,
|
|
58
|
+
XAUT: 6,
|
|
59
|
+
// Added 2026-09-08 with the dapp-parity asset expansion. Every value below was read from the
|
|
60
|
+
// token contract itself — `eth_call decimals()` against each deployment the registry lists on the
|
|
61
|
+
// nine escrow chains — and each symbol answered the SAME number on every chain it is deployed on.
|
|
62
|
+
// The set is a deliberate mix of 6 and 18, and a copy-pasted row is wrong by a factor of 1e12
|
|
63
|
+
// while still looking entirely plausible in review; that is the bug this pin exists to prevent.
|
|
64
|
+
USDTB: 18,
|
|
65
|
+
AUSD: 6,
|
|
66
|
+
PYUSD: 6,
|
|
67
|
+
USDG: 6,
|
|
68
|
+
// The wider stable list — the bid side of an RWA trade.
|
|
69
|
+
DAI: 18,
|
|
70
|
+
RLUSD: 18,
|
|
71
|
+
USD1: 18,
|
|
72
|
+
USDS: 18,
|
|
73
|
+
WM: 6,
|
|
74
|
+
// Real-world assets. Every Nest vault share is 6; the Centrifuge pair is 18.
|
|
75
|
+
NALPHA: 6,
|
|
76
|
+
NTBILL: 6,
|
|
77
|
+
NBASIS: 6,
|
|
78
|
+
NCREDIT: 6,
|
|
79
|
+
NOPAL: 6,
|
|
80
|
+
NWISDOM: 6,
|
|
81
|
+
NACRDX: 6,
|
|
82
|
+
NLCRD: 6,
|
|
83
|
+
NAXI: 6,
|
|
84
|
+
NCLOA: 6,
|
|
85
|
+
NFALCON: 6,
|
|
86
|
+
DEJAAA: 18,
|
|
87
|
+
DESPXA: 18
|
|
88
|
+
};
|
|
34
89
|
var CANONICAL_ESCROW = Object.freeze({
|
|
35
90
|
1: "0x5e25c8ABc19b88d6A7Ab0D805C77A34987a68b40",
|
|
36
91
|
// Ethereum
|
|
@@ -60,9 +115,40 @@ var CANONICAL_INBOUND_BRIDGE = {
|
|
|
60
115
|
USDC: "cctp",
|
|
61
116
|
USDT: "layerzero",
|
|
62
117
|
USDE: "layerzero",
|
|
63
|
-
XAUT: "layerzero"
|
|
118
|
+
XAUT: "layerzero",
|
|
119
|
+
// 2026-09-08: the four assets added for dapp parity are all LayerZero V2 OFTs on every chain the
|
|
120
|
+
// registry lists them on (`standard: "LayerZeroV2OFT"`, verified against dev and prod /tokens).
|
|
121
|
+
// USDC remains the only CCTP asset.
|
|
122
|
+
USDTB: "layerzero",
|
|
123
|
+
AUSD: "layerzero",
|
|
124
|
+
PYUSD: "layerzero",
|
|
125
|
+
USDG: "layerzero",
|
|
126
|
+
// `"none"` is a POSITIVE statement, not a gap: these assets have no inbound bridge adapter at all
|
|
127
|
+
// (the registry says `bridge: "None"`, or ships no bridge field at all), so they can only ever be
|
|
128
|
+
// bid on the chain the order already executes on and can never legitimately owe a native
|
|
129
|
+
// LayerZero fee. Pinning them matters because the fallback for an UNpinned asset is the label
|
|
130
|
+
// sniff, and a hostile quote controls the label — `bridge: "layerzero"` on one of these would
|
|
131
|
+
// otherwise let it attach msg.value to an order that forwards none, stranding it in the escrow.
|
|
132
|
+
DAI: "none",
|
|
133
|
+
RLUSD: "none",
|
|
134
|
+
USD1: "none",
|
|
135
|
+
USDS: "none",
|
|
136
|
+
WM: "none",
|
|
137
|
+
NALPHA: "none",
|
|
138
|
+
NTBILL: "none",
|
|
139
|
+
NBASIS: "none",
|
|
140
|
+
NCREDIT: "none",
|
|
141
|
+
NOPAL: "none",
|
|
142
|
+
NWISDOM: "none",
|
|
143
|
+
NACRDX: "none",
|
|
144
|
+
NLCRD: "none",
|
|
145
|
+
NAXI: "none",
|
|
146
|
+
NCLOA: "none",
|
|
147
|
+
NFALCON: "none",
|
|
148
|
+
DEJAAA: "none",
|
|
149
|
+
DESPXA: "none"
|
|
64
150
|
};
|
|
65
|
-
var SAME_CLASS_STABLE =
|
|
151
|
+
var SAME_CLASS_STABLE = new Set(STABLE_ASSETS);
|
|
66
152
|
var MAX_SAME_CLASS_PAY_BPS = 30000n;
|
|
67
153
|
var BUNDLED_NATIVE_SYMBOL = {
|
|
68
154
|
1: "ETH",
|
|
@@ -85,6 +171,55 @@ var BUNDLED_RPC = {
|
|
|
85
171
|
42161: "https://arb1.arbitrum.io/rpc",
|
|
86
172
|
98866: "https://rpc.plume.org"
|
|
87
173
|
};
|
|
174
|
+
var CHAIN_DISPLAY_NAMES = Object.freeze({
|
|
175
|
+
1: "Ethereum",
|
|
176
|
+
10: "Optimism",
|
|
177
|
+
14: "Flare",
|
|
178
|
+
30: "Rootstock",
|
|
179
|
+
50: "XDC Network",
|
|
180
|
+
56: "BNB Chain",
|
|
181
|
+
88: "Viction",
|
|
182
|
+
130: "Unichain",
|
|
183
|
+
137: "Polygon",
|
|
184
|
+
143: "Monad",
|
|
185
|
+
146: "Sonic",
|
|
186
|
+
151: "Redbelly Network",
|
|
187
|
+
169: "Manta Pacific",
|
|
188
|
+
196: "X Layer",
|
|
189
|
+
252: "Fraxtal",
|
|
190
|
+
324: "zkSync Era",
|
|
191
|
+
480: "World Chain",
|
|
192
|
+
988: "Stable",
|
|
193
|
+
999: "HyperEVM",
|
|
194
|
+
1030: "Conflux eSpace",
|
|
195
|
+
1088: "Metis",
|
|
196
|
+
1135: "Lisk",
|
|
197
|
+
1329: "Sei",
|
|
198
|
+
1776: "Injective EVM",
|
|
199
|
+
1868: "Soneium",
|
|
200
|
+
1923: "Swellchain",
|
|
201
|
+
2222: "Kava",
|
|
202
|
+
2818: "Morph",
|
|
203
|
+
3343: "EDGE",
|
|
204
|
+
4326: "MegaETH",
|
|
205
|
+
5e3: "Mantle",
|
|
206
|
+
8453: "Base",
|
|
207
|
+
9745: "Plasma",
|
|
208
|
+
34443: "Mode",
|
|
209
|
+
42161: "Arbitrum One",
|
|
210
|
+
43114: "Avalanche C-Chain",
|
|
211
|
+
48900: "Zircuit",
|
|
212
|
+
57073: "Ink",
|
|
213
|
+
59144: "Linea",
|
|
214
|
+
80094: "Berachain",
|
|
215
|
+
81224: "Codex",
|
|
216
|
+
81457: "Blast",
|
|
217
|
+
98866: "Plume",
|
|
218
|
+
534352: "Scroll",
|
|
219
|
+
747474: "Katana",
|
|
220
|
+
7777777: "Zora",
|
|
221
|
+
21e6: "Corn"
|
|
222
|
+
});
|
|
88
223
|
|
|
89
224
|
// src/core/address.ts
|
|
90
225
|
function symbolKey(value) {
|
|
@@ -349,18 +484,133 @@ function applyLayerZeroBuffer(quote, option = {}) {
|
|
|
349
484
|
return gas * (10000n + LZ_FEE_BUFFER_BPS) / 10000n;
|
|
350
485
|
}
|
|
351
486
|
|
|
487
|
+
// src/core/availability.ts
|
|
488
|
+
function assetClassOf(symbol) {
|
|
489
|
+
const key = symbolKey(symbol);
|
|
490
|
+
if (TRADEABLE_RWA_ASSETS.has(key)) return "rwa";
|
|
491
|
+
if (STABLE_ASSETS.has(key)) return "stable";
|
|
492
|
+
return null;
|
|
493
|
+
}
|
|
494
|
+
function productAssets(product) {
|
|
495
|
+
return product === "rwa" ? /* @__PURE__ */ new Set([...STABLE_ASSETS, ...TRADEABLE_RWA_ASSETS]) : EXECUTABLE_STABLE_ASSETS;
|
|
496
|
+
}
|
|
497
|
+
function counterpartTokens(tokens, selected) {
|
|
498
|
+
const want = assetClassOf(selected?.symbol) === "rwa" ? "stable" : "rwa";
|
|
499
|
+
return tokens.filter((token) => assetClassOf(token.symbol) === want);
|
|
500
|
+
}
|
|
501
|
+
function tokenKey(chainId, address) {
|
|
502
|
+
return `${Number(chainId)}:${String(address || "").toLowerCase()}`;
|
|
503
|
+
}
|
|
504
|
+
function laneKey(fromChainId, fromAddress, toChainId, toAddress) {
|
|
505
|
+
return `${tokenKey(fromChainId, fromAddress)}>${tokenKey(toChainId, toAddress)}`;
|
|
506
|
+
}
|
|
507
|
+
function isExecutableBridge(descriptor) {
|
|
508
|
+
const bridge = descriptor?.bridge?.trim().toLowerCase();
|
|
509
|
+
const standard = descriptor?.standard?.replace(/[\s_-]/g, "").toLowerCase();
|
|
510
|
+
return (bridge === "circle" || bridge === "cctp") && standard === "cctpv2" || bridge === "layerzero" && standard === "layerzerov2oft";
|
|
511
|
+
}
|
|
512
|
+
function isKnownUnbridgeable(bridge) {
|
|
513
|
+
return typeof bridge === "string" && bridge.trim().toLowerCase() === "none";
|
|
514
|
+
}
|
|
515
|
+
function executableRoutes(routes) {
|
|
516
|
+
return routes.filter((route) => route.isEnabled !== false && isExecutableBridge(route));
|
|
517
|
+
}
|
|
518
|
+
function sourceKeys(routes) {
|
|
519
|
+
return new Set(routes.filter((r) => r.isEnabled !== false).map((r) => tokenKey(r.fromChainId, r.fromAddress ?? "")));
|
|
520
|
+
}
|
|
521
|
+
function destinationKeys(routes) {
|
|
522
|
+
return new Set(routes.filter((r) => r.isEnabled !== false).map((r) => tokenKey(r.toChainId, r.toAddress ?? "")));
|
|
523
|
+
}
|
|
524
|
+
function laneKeys(routes) {
|
|
525
|
+
return new Set(routes.filter((r) => r.isEnabled !== false).map((r) => laneKey(r.fromChainId, r.fromAddress ?? "", r.toChainId, r.toAddress ?? "")));
|
|
526
|
+
}
|
|
527
|
+
function executionChainIds(chains) {
|
|
528
|
+
return new Set(chains.filter((c) => c.isEnabled !== false && c.isExecutionChain === true).map((c) => Number(c.chainId)));
|
|
529
|
+
}
|
|
530
|
+
function hubDeliverableSymbols(tokens, execution) {
|
|
531
|
+
return new Set(tokens.filter((t) => execution.has(Number(t.chainId))).map((t) => symbolKey(t.symbol)));
|
|
532
|
+
}
|
|
533
|
+
function isSourceToken(token, ctx) {
|
|
534
|
+
const chainId = Number(token.chainId);
|
|
535
|
+
if (!ctx.sourceChains.has(chainId)) return false;
|
|
536
|
+
return ctx.execution.has(chainId) || !isKnownUnbridgeable(token.bridge) && ctx.source.has(tokenKey(chainId, token.address));
|
|
537
|
+
}
|
|
538
|
+
function directLaneOK(token, source, lanes) {
|
|
539
|
+
if (!source || !lanes) return true;
|
|
540
|
+
if (symbolKey(source.symbol) !== symbolKey(token.symbol)) return true;
|
|
541
|
+
if (Number(source.chainId) === Number(token.chainId)) return true;
|
|
542
|
+
return lanes.has(laneKey(source.chainId, source.address, token.chainId, token.address));
|
|
543
|
+
}
|
|
544
|
+
function brokenLaneFor(token, source, brokenLanes) {
|
|
545
|
+
if (!source || !brokenLanes) return void 0;
|
|
546
|
+
return brokenLanes.get(laneKey(source.chainId, source.address, token.chainId, token.address));
|
|
547
|
+
}
|
|
548
|
+
function destinationAvailability(token, ctx, source) {
|
|
549
|
+
if (brokenLaneFor(token, source ?? void 0, ctx.brokenLanes)) return "unreachable";
|
|
550
|
+
if (ctx.execution.has(Number(token.chainId))) return "available";
|
|
551
|
+
if (token.isChainedDestination === true) return "available";
|
|
552
|
+
if (!isKnownUnbridgeable(token.bridge) && ctx.destination.has(tokenKey(token.chainId, token.address)) && directLaneOK(token, source ?? void 0, ctx.lanes)) {
|
|
553
|
+
return "available";
|
|
554
|
+
}
|
|
555
|
+
return ctx.hubSymbols.has(symbolKey(token.symbol)) ? "hub-only" : "unreachable";
|
|
556
|
+
}
|
|
557
|
+
function hasReachableDestination(source, catalogue, ctx) {
|
|
558
|
+
if (catalogue.length === 0) return true;
|
|
559
|
+
const from = tokenKey(source.chainId, source.address);
|
|
560
|
+
for (const candidate of catalogue) {
|
|
561
|
+
if (tokenKey(candidate.chainId, candidate.address) === from) continue;
|
|
562
|
+
if (destinationAvailability(candidate, ctx, source) === "available") return true;
|
|
563
|
+
}
|
|
564
|
+
return false;
|
|
565
|
+
}
|
|
566
|
+
function buildCatalogue(input) {
|
|
567
|
+
const { chains, tokens, routes, supportedChainIds, brokenLanes } = input;
|
|
568
|
+
const product = input.product ?? "stable";
|
|
569
|
+
const universe = productAssets(product);
|
|
570
|
+
const allowedAssets = input.allowedAssets ? new Set([...input.allowedAssets].filter((a) => universe.has(a))) : universe;
|
|
571
|
+
const enabledChains = chains.filter((c) => c.isEnabled !== false);
|
|
572
|
+
const registryChainIds = new Set(enabledChains.map((c) => Number(c.chainId)));
|
|
573
|
+
const sourceChains = new Set([...registryChainIds].filter((id) => supportedChainIds.has(id)));
|
|
574
|
+
const execution = executionChainIds(enabledChains);
|
|
575
|
+
const projected = product === "rwa" ? routes.filter((route) => route.isEnabled !== false) : executableRoutes(routes);
|
|
576
|
+
const source = sourceKeys(projected);
|
|
577
|
+
const destination = destinationKeys(projected);
|
|
578
|
+
const lanes = laneKeys(projected);
|
|
579
|
+
const chainIds = new Set(sourceChains);
|
|
580
|
+
for (const route of projected) {
|
|
581
|
+
const id = Number(route.toChainId);
|
|
582
|
+
if (Number.isSafeInteger(id) && id > 0) chainIds.add(id);
|
|
583
|
+
}
|
|
584
|
+
const allowed = tokens.filter((token) => token.isEnabled !== false && allowedAssets.has(symbolKey(token.symbol)));
|
|
585
|
+
const projectedCatalogue = allowed.filter((token) => {
|
|
586
|
+
if (!chainIds.has(Number(token.chainId))) return false;
|
|
587
|
+
if (product === "rwa") return true;
|
|
588
|
+
if (!isExecutableBridge(token)) return false;
|
|
589
|
+
const key = tokenKey(token.chainId, token.address);
|
|
590
|
+
return source.has(key) || destination.has(key) || execution.has(Number(token.chainId));
|
|
591
|
+
});
|
|
592
|
+
const ready = chains.length > 0 && routes.length > 0 && projectedCatalogue.length > 0;
|
|
593
|
+
const catalogue = ready ? projectedCatalogue : allowed;
|
|
594
|
+
const hubSymbols = hubDeliverableSymbols(catalogue, execution);
|
|
595
|
+
const ctx = { source, destination, lanes, execution, sourceChains, hubSymbols, ...brokenLanes ? { brokenLanes } : {} };
|
|
596
|
+
const sources = ready ? catalogue.filter((token) => isSourceToken(token, ctx) && hasReachableDestination(token, catalogue, ctx)) : (
|
|
597
|
+
// Unprojected: the only rule we can still apply with confidence is the escrow-chain bound,
|
|
598
|
+
// which comes from this build's own pins rather than from the registry.
|
|
599
|
+
catalogue.filter((token) => sourceChains.has(Number(token.chainId)))
|
|
600
|
+
);
|
|
601
|
+
const byId = new Map(enabledChains.map((c) => [Number(c.chainId), c]));
|
|
602
|
+
for (const id of chainIds) if (!byId.has(id)) byId.set(id, { chainId: id, isEnabled: true });
|
|
603
|
+
return { ...ctx, product, tokens: catalogue, sources, chainIds, chains: [...byId.values()], ready };
|
|
604
|
+
}
|
|
605
|
+
|
|
352
606
|
// src/core/options.ts
|
|
353
607
|
function chainNameOf(chainId, chains) {
|
|
354
608
|
const chain = chains.find((item) => Number(item.chainId) === Number(chainId));
|
|
355
|
-
return chain?.displayName || chain?.name || `Chain ${chainId}`;
|
|
609
|
+
return chain?.displayName || chain?.name || CHAIN_DISPLAY_NAMES[Number(chainId)] || `Chain ${chainId}`;
|
|
356
610
|
}
|
|
357
611
|
function chainById(chains, chainId) {
|
|
358
612
|
return chains.find((chain) => Number(chain.chainId) === Number(chainId)) || null;
|
|
359
613
|
}
|
|
360
|
-
function isDeliverable(symbol, chainId) {
|
|
361
|
-
if (Number(chainId) === 8453 && symbolKey(symbol) === "USDT") return false;
|
|
362
|
-
return true;
|
|
363
|
-
}
|
|
364
614
|
function chainSelectable(chain, chainId) {
|
|
365
615
|
if (!SUPPORTED_CHAIN_IDS.has(Number(chainId))) return false;
|
|
366
616
|
if (!chain) return true;
|
|
@@ -373,45 +623,57 @@ function findToken(tokens, chainId, symbol) {
|
|
|
373
623
|
const key = symbolKey(symbol);
|
|
374
624
|
return tokens.find((token) => tokenEnabled(token) && Number(token.chainId) === Number(chainId) && symbolKey(token.symbol) === key) || null;
|
|
375
625
|
}
|
|
376
|
-
function buildPayOptions({ invoiceAsset, invoiceChainId, tokens, routes, chains, walletChainId }) {
|
|
626
|
+
function buildPayOptions({ invoiceAsset, invoiceChainId, tokens, routes, chains, walletChainId, catalogue }) {
|
|
377
627
|
const invoiceKey = symbolKey(invoiceAsset);
|
|
378
|
-
const
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
const key = symbolKey(token.symbol);
|
|
382
|
-
if (!tokenBySymbolAndChain.has(key)) tokenBySymbolAndChain.set(key, /* @__PURE__ */ new Map());
|
|
383
|
-
tokenBySymbolAndChain.get(key).set(Number(token.chainId), token);
|
|
384
|
-
}
|
|
628
|
+
const invoiceChain = Number(invoiceChainId);
|
|
629
|
+
const live = catalogue?.ready ? catalogue : null;
|
|
630
|
+
const destinationToken = findToken(tokens, invoiceChain, invoiceKey);
|
|
385
631
|
const routeBridge = /* @__PURE__ */ new Map();
|
|
386
632
|
for (const route of routes || []) {
|
|
387
|
-
if (route.isEnabled === false || Number(route.toChainId) !==
|
|
633
|
+
if (route.isEnabled === false || Number(route.toChainId) !== invoiceChain) continue;
|
|
388
634
|
routeBridge.set(`${symbolKey(route.tokenName || route.tokenId)}:${Number(route.fromChainId)}`, route.bridge);
|
|
389
635
|
routeBridge.set(`${symbolKey(route.tokenId)}:${Number(route.fromChainId)}`, route.bridge);
|
|
390
636
|
}
|
|
391
|
-
const
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
if (!direct && (!receiveDeliverable || !isDeliverable(payKey, chainId))) continue;
|
|
401
|
-
options.push({
|
|
402
|
-
symbol: token.symbol,
|
|
403
|
-
symbolKey: payKey,
|
|
404
|
-
name: token.name || token.symbol,
|
|
405
|
-
chainId,
|
|
406
|
-
chainName: chainNameOf(chainId, chains),
|
|
407
|
-
address: token.address,
|
|
408
|
-
decimals: assetDecimals(token),
|
|
409
|
-
logoUrl: token.logoUrl,
|
|
410
|
-
bridge: routeBridge.get(`${payKey}:${chainId}`) || token.bridge,
|
|
411
|
-
sameChain: chainId === Number(invoiceChainId),
|
|
412
|
-
direct
|
|
413
|
-
});
|
|
637
|
+
const knownLanes = live?.lanes && live.lanes.size > 0 ? live.lanes : null;
|
|
638
|
+
function refusal(token) {
|
|
639
|
+
const sameSymbol = symbolKey(token.symbol) === invoiceKey;
|
|
640
|
+
const sameChain = Number(token.chainId) === invoiceChain;
|
|
641
|
+
if (sameSymbol && sameChain) return null;
|
|
642
|
+
if (live && destinationToken && brokenLaneFor(destinationToken, token, live.brokenLanes)) return "measured";
|
|
643
|
+
if (live && !isSourceToken(token, live)) return "not-a-source";
|
|
644
|
+
if (sameSymbol && knownLanes && !knownLanes.has(laneKey(token.chainId, token.address, invoiceChain, destinationToken?.address ?? ""))) {
|
|
645
|
+
return "no-direct-lane";
|
|
414
646
|
}
|
|
647
|
+
if (live && destinationToken && destinationAvailability(destinationToken, live, token) !== "available") return "undeliverable";
|
|
648
|
+
return null;
|
|
649
|
+
}
|
|
650
|
+
const options = [];
|
|
651
|
+
const seen = /* @__PURE__ */ new Set();
|
|
652
|
+
const universe = live ? live.tokens : tokens;
|
|
653
|
+
for (const token of universe) {
|
|
654
|
+
if (!tokenEnabled(token)) continue;
|
|
655
|
+
const chainId = Number(token.chainId);
|
|
656
|
+
const chain = chainById(chains, chainId);
|
|
657
|
+
if (!chainSelectable(chain, chainId)) continue;
|
|
658
|
+
const key = tokenKey(chainId, token.address);
|
|
659
|
+
if (seen.has(key)) continue;
|
|
660
|
+
if (refusal(token)) continue;
|
|
661
|
+
seen.add(key);
|
|
662
|
+
const payKey = symbolKey(token.symbol);
|
|
663
|
+
const direct = chainId === invoiceChain && payKey === invoiceKey;
|
|
664
|
+
options.push({
|
|
665
|
+
symbol: token.symbol,
|
|
666
|
+
symbolKey: payKey,
|
|
667
|
+
name: token.name || token.symbol,
|
|
668
|
+
chainId,
|
|
669
|
+
chainName: chainNameOf(chainId, chains),
|
|
670
|
+
address: token.address,
|
|
671
|
+
decimals: assetDecimals(token),
|
|
672
|
+
logoUrl: token.logoUrl,
|
|
673
|
+
bridge: routeBridge.get(`${payKey}:${chainId}`) || token.bridge,
|
|
674
|
+
sameChain: chainId === invoiceChain,
|
|
675
|
+
direct
|
|
676
|
+
});
|
|
415
677
|
}
|
|
416
678
|
options.sort((a, b) => {
|
|
417
679
|
const walletChain = Number(walletChainId || 0);
|
|
@@ -470,6 +732,368 @@ function nativeFeeShortMessage(check, symbol, chainName2) {
|
|
|
470
732
|
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.`;
|
|
471
733
|
}
|
|
472
734
|
|
|
735
|
+
// src/core/route-health.ts
|
|
736
|
+
var EMPTY = /* @__PURE__ */ new Map();
|
|
737
|
+
function suppressedLanes(health) {
|
|
738
|
+
if (health?.mode !== "enforce" || !Array.isArray(health.lanes)) return EMPTY;
|
|
739
|
+
const out = /* @__PURE__ */ new Map();
|
|
740
|
+
for (const lane of health.lanes) {
|
|
741
|
+
if (lane?.status !== "broken") continue;
|
|
742
|
+
const key = typeof lane.laneKey === "string" ? lane.laneKey.toLowerCase() : "";
|
|
743
|
+
if (!key) continue;
|
|
744
|
+
out.set(key, {
|
|
745
|
+
route: typeof lane.route === "string" ? lane.route : "",
|
|
746
|
+
code: typeof lane.code === "string" ? lane.code : "",
|
|
747
|
+
message: typeof lane.message === "string" ? lane.message : "",
|
|
748
|
+
...typeof lane.kind === "string" ? { kind: lane.kind } : {}
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
return out;
|
|
752
|
+
}
|
|
753
|
+
function brokenLaneReason(lane) {
|
|
754
|
+
if (!lane) return "";
|
|
755
|
+
switch (lane.kind) {
|
|
756
|
+
case "bridge-throttled":
|
|
757
|
+
return "The issuer's bridge for this pair is closed right now.";
|
|
758
|
+
case "vault-closed":
|
|
759
|
+
return "This vault is not accepting deposits right now.";
|
|
760
|
+
default:
|
|
761
|
+
return "ZeroDelta could not price this pair in its latest check.";
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
// src/core/compliance.ts
|
|
766
|
+
var COMPLIANCE_DENY_LABEL = "Compliance check failed";
|
|
767
|
+
function complianceView(compliance, hasQuote = true) {
|
|
768
|
+
if (!hasQuote) {
|
|
769
|
+
return {
|
|
770
|
+
tone: "neutral",
|
|
771
|
+
label: "Compliance checks run with your quote",
|
|
772
|
+
headline: "No compliance decision for this payment yet",
|
|
773
|
+
blocked: false,
|
|
774
|
+
needsAction: false,
|
|
775
|
+
screened: false
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
const decision = compliance?.decision;
|
|
779
|
+
const screened = compliance?.status === "SCREENED";
|
|
780
|
+
if (decision === "DENY") {
|
|
781
|
+
return {
|
|
782
|
+
tone: "blocked",
|
|
783
|
+
label: COMPLIANCE_DENY_LABEL,
|
|
784
|
+
headline: "Blocked by compliance policy",
|
|
785
|
+
blocked: true,
|
|
786
|
+
needsAction: false,
|
|
787
|
+
screened
|
|
788
|
+
};
|
|
789
|
+
}
|
|
790
|
+
if (decision === "REVIEW" || decision === "REMEDIATE") {
|
|
791
|
+
const word = decision.toLowerCase();
|
|
792
|
+
return {
|
|
793
|
+
tone: "warn",
|
|
794
|
+
label: `Compliance: ${word} required`,
|
|
795
|
+
headline: `Manual ${word} required`,
|
|
796
|
+
blocked: false,
|
|
797
|
+
needsAction: true,
|
|
798
|
+
screened
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
if (decision === "ALLOW") {
|
|
802
|
+
return {
|
|
803
|
+
tone: "ok",
|
|
804
|
+
label: screened ? "Compliance checks passed" : "Allowed \u2014 wallets not screened",
|
|
805
|
+
headline: screened ? "Wallets screened and allowed" : "Allowed \u2014 wallets not screened",
|
|
806
|
+
blocked: false,
|
|
807
|
+
needsAction: false,
|
|
808
|
+
screened
|
|
809
|
+
};
|
|
810
|
+
}
|
|
811
|
+
return {
|
|
812
|
+
tone: "neutral",
|
|
813
|
+
label: screened ? "Screened \u2014 no policy decision returned" : "No compliance decision returned",
|
|
814
|
+
headline: screened ? "Screened \u2014 no policy decision returned" : "No compliance decision returned",
|
|
815
|
+
blocked: false,
|
|
816
|
+
needsAction: false,
|
|
817
|
+
screened
|
|
818
|
+
};
|
|
819
|
+
}
|
|
820
|
+
var CATEGORY_PHRASES = {
|
|
821
|
+
SANCTIONS: "sanctions",
|
|
822
|
+
TERRORISM_FINANCING: "terrorism financing",
|
|
823
|
+
STOLEN_FUNDS: "stolen funds",
|
|
824
|
+
RANSOMWARE: "ransomware",
|
|
825
|
+
SCAM: "scam activity",
|
|
826
|
+
DARKNET: "darknet activity",
|
|
827
|
+
MIXER: "mixer usage",
|
|
828
|
+
HIGH_RISK_ENTITY: "a high-risk entity",
|
|
829
|
+
PEP: "a politically-exposed person",
|
|
830
|
+
INDIRECT_EXPOSURE: "indirect exposure",
|
|
831
|
+
UNCLASSIFIED: "an unrecognized risk",
|
|
832
|
+
UNKNOWN: "an unrecognized risk"
|
|
833
|
+
};
|
|
834
|
+
function categoryLabel(code) {
|
|
835
|
+
const key = code.trim().toUpperCase();
|
|
836
|
+
const LABELS = {
|
|
837
|
+
SANCTIONS: "Sanctions",
|
|
838
|
+
TERRORISM_FINANCING: "Terrorist financing",
|
|
839
|
+
STOLEN_FUNDS: "Stolen funds",
|
|
840
|
+
RANSOMWARE: "Ransomware",
|
|
841
|
+
SCAM: "Scam",
|
|
842
|
+
DARKNET: "Darknet services",
|
|
843
|
+
MIXER: "Mixer",
|
|
844
|
+
HIGH_RISK_ENTITY: "High-risk entity",
|
|
845
|
+
PEP: "Politically exposed person (PEP)",
|
|
846
|
+
INDIRECT_EXPOSURE: "Indirect exposure",
|
|
847
|
+
UNCLASSIFIED: "Unclassified risk",
|
|
848
|
+
UNKNOWN: "Unclassified risk"
|
|
849
|
+
};
|
|
850
|
+
return LABELS[key] ?? key.toLowerCase().replace(/_/g, " ");
|
|
851
|
+
}
|
|
852
|
+
function cleanJurisdiction(code) {
|
|
853
|
+
return code.replace(/^(OFAC|TIER\d+|SANCTIONED)_/i, "").trim();
|
|
854
|
+
}
|
|
855
|
+
function stripBundlePrefix(head) {
|
|
856
|
+
if (head.startsWith("policy_")) return { head: head.slice("policy_".length), source: "policy" };
|
|
857
|
+
if (head.startsWith("legislation_")) return { head: head.slice("legislation_".length), source: "legislation" };
|
|
858
|
+
return { head, source: null };
|
|
859
|
+
}
|
|
860
|
+
function complianceReasonHead(raw) {
|
|
861
|
+
return stripBundlePrefix((raw.split(":")[0] ?? "").trim()).head;
|
|
862
|
+
}
|
|
863
|
+
function usd(raw) {
|
|
864
|
+
const n = Number(raw);
|
|
865
|
+
if (!Number.isFinite(n)) return `$${raw}`;
|
|
866
|
+
return `$${n.toLocaleString("en-US", { maximumFractionDigits: 2 })}`;
|
|
867
|
+
}
|
|
868
|
+
function capFromDetail(detail) {
|
|
869
|
+
const m = detail.match(/>([\d.]+)/);
|
|
870
|
+
return m ? ` (${usd(m[1])})` : "";
|
|
871
|
+
}
|
|
872
|
+
function categoryPhrase(detail) {
|
|
873
|
+
const cat = detail.replace(/\s*\(.*\)$/, "").toUpperCase();
|
|
874
|
+
return CATEGORY_PHRASES[cat] ?? cat.toLowerCase().replace(/_/g, " ");
|
|
875
|
+
}
|
|
876
|
+
function humanizeComplianceReason(raw) {
|
|
877
|
+
const [headRaw, ...restParts] = raw.split(":");
|
|
878
|
+
const detail = restParts.join(":").trim();
|
|
879
|
+
const { head, source } = stripBundlePrefix((headRaw ?? "").trim());
|
|
880
|
+
const scope = source === "legislation" ? "applicable regulations" : "the applicable policy";
|
|
881
|
+
switch (head) {
|
|
882
|
+
case "asset_pair_not_allowed": {
|
|
883
|
+
const m = detail.match(/^(\S+)->(\S+)\s+in\s+(\S+)/);
|
|
884
|
+
if (m) return `${m[1]} \u2192 ${m[2]} isn't available in your region (${cleanJurisdiction(m[3])}).`;
|
|
885
|
+
return "This asset pair isn't available in your region.";
|
|
886
|
+
}
|
|
887
|
+
case "asset_not_allowed": {
|
|
888
|
+
const m = detail.match(/^(\S+?)->(\S+?)(?::|$)/);
|
|
889
|
+
if (m) return `${m[1]} \u2192 ${m[2]} isn't permitted under ${scope}.`;
|
|
890
|
+
return `This asset pair isn't permitted under ${scope}.`;
|
|
891
|
+
}
|
|
892
|
+
case "blocked_jurisdiction":
|
|
893
|
+
return `Your region (${cleanJurisdiction(detail)}) isn't supported.`;
|
|
894
|
+
case "blocked_destination_jurisdiction":
|
|
895
|
+
return `The destination region (${cleanJurisdiction(detail)}) isn't supported.`;
|
|
896
|
+
case "jurisdiction_out_of_scope":
|
|
897
|
+
return `Not covered by ${scope}.`;
|
|
898
|
+
case "ui_block":
|
|
899
|
+
return `Payments aren't available in your region (${cleanJurisdiction(detail)}).`;
|
|
900
|
+
case "blocked_corridor_mode":
|
|
901
|
+
return "This route isn't currently open for payments.";
|
|
902
|
+
case "blocked_category":
|
|
903
|
+
return `Flagged for ${categoryPhrase(detail)}.`;
|
|
904
|
+
case "amount_exceeds_max_order_usd":
|
|
905
|
+
case "amount_exceeds_max":
|
|
906
|
+
return `Amount exceeds the maximum order size${capFromDetail(detail)}.`;
|
|
907
|
+
case "amount_exceeds_actor_cap":
|
|
908
|
+
return `Amount exceeds the limit for your account type${capFromDetail(detail)}.`;
|
|
909
|
+
case "amount_exceeds_jurisdiction_max":
|
|
910
|
+
return `Amount exceeds the limit for your region${capFromDetail(detail)}.`;
|
|
911
|
+
case "source_chain_not_allowed":
|
|
912
|
+
return `The source chain isn't permitted under ${scope}.`;
|
|
913
|
+
case "dest_chain_not_allowed":
|
|
914
|
+
return `The destination chain isn't permitted under ${scope}.`;
|
|
915
|
+
default:
|
|
916
|
+
return detail ? `${head.replace(/_/g, " ")} \u2014 ${detail}` : head.replace(/_/g, " ");
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
var COMPLIANCE_CHECK_ORDER = [
|
|
920
|
+
"location",
|
|
921
|
+
"screening",
|
|
922
|
+
"risk",
|
|
923
|
+
"asset",
|
|
924
|
+
"limits"
|
|
925
|
+
];
|
|
926
|
+
var CHECK_LABELS = {
|
|
927
|
+
location: "Location and corridor permitted",
|
|
928
|
+
screening: "Both wallets screened",
|
|
929
|
+
risk: "Risk policy passed",
|
|
930
|
+
asset: "Asset and amount allowed",
|
|
931
|
+
limits: "Transaction limits verified"
|
|
932
|
+
};
|
|
933
|
+
var CHECK_HEADS = {
|
|
934
|
+
location: [
|
|
935
|
+
"blocked_jurisdiction",
|
|
936
|
+
"blocked_destination_jurisdiction",
|
|
937
|
+
"ui_block",
|
|
938
|
+
"blocked_corridor_mode",
|
|
939
|
+
"jurisdiction_out_of_scope"
|
|
940
|
+
],
|
|
941
|
+
screening: [],
|
|
942
|
+
risk: ["blocked_category"],
|
|
943
|
+
asset: ["asset_pair_not_allowed", "asset_not_allowed", "source_chain_not_allowed", "dest_chain_not_allowed"],
|
|
944
|
+
limits: [
|
|
945
|
+
"amount_exceeds_max_order_usd",
|
|
946
|
+
"amount_exceeds_max",
|
|
947
|
+
"amount_exceeds_actor_cap",
|
|
948
|
+
"amount_exceeds_jurisdiction_max"
|
|
949
|
+
]
|
|
950
|
+
};
|
|
951
|
+
function distinctScreenedWallets(compliance) {
|
|
952
|
+
const seen = /* @__PURE__ */ new Set();
|
|
953
|
+
const wallets = [];
|
|
954
|
+
for (const raw of compliance?.screenedWallets ?? []) {
|
|
955
|
+
const address = raw?.trim();
|
|
956
|
+
if (!address) continue;
|
|
957
|
+
const key = /^0x[0-9a-fA-F]+$/.test(address) ? address.toLowerCase() : address;
|
|
958
|
+
if (seen.has(key)) continue;
|
|
959
|
+
seen.add(key);
|
|
960
|
+
wallets.push(address);
|
|
961
|
+
}
|
|
962
|
+
return wallets;
|
|
963
|
+
}
|
|
964
|
+
function shortAddress(a) {
|
|
965
|
+
return a.length > 12 ? `${a.slice(0, 6)}\u2026${a.slice(-4)}` : a;
|
|
966
|
+
}
|
|
967
|
+
function screeningLabel(wallets) {
|
|
968
|
+
if (wallets === 1) return "Wallet screened";
|
|
969
|
+
if (wallets === 2) return CHECK_LABELS.screening;
|
|
970
|
+
return "Wallets screened";
|
|
971
|
+
}
|
|
972
|
+
function complianceChecks(compliance, cv = complianceView(compliance)) {
|
|
973
|
+
if (cv.tone === "neutral") return [];
|
|
974
|
+
const byControl = /* @__PURE__ */ new Map();
|
|
975
|
+
for (const raw of compliance?.reasons ?? []) {
|
|
976
|
+
const head = complianceReasonHead(raw);
|
|
977
|
+
const id = COMPLIANCE_CHECK_ORDER.find((c) => CHECK_HEADS[c].includes(head));
|
|
978
|
+
if (!id) continue;
|
|
979
|
+
byControl.set(id, [...byControl.get(id) ?? [], raw]);
|
|
980
|
+
}
|
|
981
|
+
const screenedWallets = distinctScreenedWallets(compliance);
|
|
982
|
+
const wallets = screenedWallets.length;
|
|
983
|
+
const blocking = compliance?.blockingCategories?.length ?? 0;
|
|
984
|
+
return COMPLIANCE_CHECK_ORDER.map((id) => {
|
|
985
|
+
if (id === "screening") {
|
|
986
|
+
const ok2 = cv.screened || wallets > 0;
|
|
987
|
+
const note = wallets === 1 ? shortAddress(screenedWallets[0]) : wallets > 1 ? `${wallets} wallets screened` : void 0;
|
|
988
|
+
return { id, label: ok2 ? screeningLabel(wallets) : "Wallets not screened", ok: ok2, reasons: [], note };
|
|
989
|
+
}
|
|
990
|
+
const reasons = byControl.get(id) ?? [];
|
|
991
|
+
const ok = reasons.length === 0 && !(id === "risk" && blocking > 0);
|
|
992
|
+
return { id, label: CHECK_LABELS[id], ok, reasons };
|
|
993
|
+
});
|
|
994
|
+
}
|
|
995
|
+
function unattributedComplianceReasons(compliance, cv = complianceView(compliance)) {
|
|
996
|
+
const claimed = new Set(complianceChecks(compliance, cv).flatMap((c) => c.reasons));
|
|
997
|
+
return (compliance?.reasons ?? []).filter((r) => !claimed.has(r));
|
|
998
|
+
}
|
|
999
|
+
function complianceControlsEvaluated(compliance, cv = complianceView(compliance)) {
|
|
1000
|
+
const checks = complianceChecks(compliance, cv);
|
|
1001
|
+
if (checks.length === 0) return 0;
|
|
1002
|
+
const named = /* @__PURE__ */ new Set();
|
|
1003
|
+
for (const raw of [...compliance?.appliedPolicyNames ?? [], ...compliance?.appliedLegislation ?? []]) {
|
|
1004
|
+
const name = raw?.trim();
|
|
1005
|
+
if (name) named.add(name.toLowerCase());
|
|
1006
|
+
}
|
|
1007
|
+
return checks.length + named.size;
|
|
1008
|
+
}
|
|
1009
|
+
function complianceControlsLine(compliance, cv = complianceView(compliance)) {
|
|
1010
|
+
if (cv.blocked || cv.needsAction) return cv.headline;
|
|
1011
|
+
const n = complianceControlsEvaluated(compliance, cv);
|
|
1012
|
+
if (n === 0) return cv.headline;
|
|
1013
|
+
return `${n} compliance control${n === 1 ? "" : "s"} evaluated for this payment`;
|
|
1014
|
+
}
|
|
1015
|
+
function directComplianceFromScreens(screens) {
|
|
1016
|
+
const blockedAny = screens.some((s) => s.blocked);
|
|
1017
|
+
const cats = (pick) => [
|
|
1018
|
+
...new Set(screens.flatMap((s) => pick(s) ?? []))
|
|
1019
|
+
];
|
|
1020
|
+
return {
|
|
1021
|
+
status: "SCREENED",
|
|
1022
|
+
decision: blockedAny ? "DENY" : "ALLOW",
|
|
1023
|
+
screenedWallets: screens.map((s) => s.address),
|
|
1024
|
+
riskCategories: cats((s) => s.riskCategories),
|
|
1025
|
+
flaggedCategories: cats((s) => s.flaggedCategories),
|
|
1026
|
+
blockingCategories: cats((s) => s.blockingCategories),
|
|
1027
|
+
reasons: blockedAny ? cats((s) => s.blockingCategories).map((c) => `blocked_category:${c}`) : []
|
|
1028
|
+
};
|
|
1029
|
+
}
|
|
1030
|
+
var DIRECT_CHECK_IDS = ["screening", "risk"];
|
|
1031
|
+
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.";
|
|
1032
|
+
var BLOCK_CATEGORY_LABELS = {
|
|
1033
|
+
STOLEN_FUNDS: "flagged as associated with stolen funds",
|
|
1034
|
+
SANCTIONS: "on a sanctions list",
|
|
1035
|
+
SANCTIONED: "on a sanctions list",
|
|
1036
|
+
OFAC: "on a sanctions list",
|
|
1037
|
+
TERRORIST_FINANCING: "flagged for terrorist financing",
|
|
1038
|
+
TERRORISM_FINANCING: "flagged for terrorist financing",
|
|
1039
|
+
FRAUD: "flagged for fraud",
|
|
1040
|
+
SCAM: "flagged as a scam address"
|
|
1041
|
+
};
|
|
1042
|
+
var BLOCK_LABEL_DEFAULT = "flagged by compliance screening";
|
|
1043
|
+
function blockLabelFor(categories) {
|
|
1044
|
+
for (const raw of categories) {
|
|
1045
|
+
const label = BLOCK_CATEGORY_LABELS[String(raw || "").trim().toUpperCase()];
|
|
1046
|
+
if (label) return label;
|
|
1047
|
+
}
|
|
1048
|
+
return BLOCK_LABEL_DEFAULT;
|
|
1049
|
+
}
|
|
1050
|
+
var REASON_TAGS = {
|
|
1051
|
+
blocked_jurisdiction: "Restricted country",
|
|
1052
|
+
ui_block: "Restricted country",
|
|
1053
|
+
blocked_destination_jurisdiction: "Restricted destination",
|
|
1054
|
+
blocked_corridor_mode: "Corridor closed",
|
|
1055
|
+
blocked_category: "Risk flag",
|
|
1056
|
+
amount_exceeds_max_order_usd: "Limit exceeded",
|
|
1057
|
+
amount_exceeds_max: "Limit exceeded",
|
|
1058
|
+
amount_exceeds_actor_cap: "Limit exceeded",
|
|
1059
|
+
amount_exceeds_jurisdiction_max: "Limit exceeded",
|
|
1060
|
+
asset_pair_not_allowed: "Asset not allowed",
|
|
1061
|
+
asset_not_allowed: "Asset not allowed",
|
|
1062
|
+
source_chain_not_allowed: "Chain not allowed",
|
|
1063
|
+
dest_chain_not_allowed: "Chain not allowed",
|
|
1064
|
+
jurisdiction_out_of_scope: "Out of scope"
|
|
1065
|
+
};
|
|
1066
|
+
function complianceReasonTag(raw) {
|
|
1067
|
+
const head = complianceReasonHead(raw);
|
|
1068
|
+
return REASON_TAGS[head] ?? head.replace(/_/g, " ");
|
|
1069
|
+
}
|
|
1070
|
+
function complianceTagOf(compliance) {
|
|
1071
|
+
const first = (compliance?.reasons ?? [])[0];
|
|
1072
|
+
return first ? complianceReasonTag(first) : "";
|
|
1073
|
+
}
|
|
1074
|
+
var FLOOR_CATEGORIES = ["SANCTIONS", "TERRORISM_FINANCING", "STOLEN_FUNDS", "RANSOMWARE"];
|
|
1075
|
+
var TUNABLE_CATEGORIES = ["SCAM", "DARKNET", "MIXER", "HIGH_RISK_ENTITY", "PEP", "INDIRECT_EXPOSURE", "UNCLASSIFIED"];
|
|
1076
|
+
var TUNED_OUTCOMES = {
|
|
1077
|
+
SCAM: "blocked",
|
|
1078
|
+
DARKNET: "blocked",
|
|
1079
|
+
MIXER: "flagged",
|
|
1080
|
+
HIGH_RISK_ENTITY: "flagged",
|
|
1081
|
+
PEP: "flagged",
|
|
1082
|
+
INDIRECT_EXPOSURE: "flagged",
|
|
1083
|
+
UNCLASSIFIED: "flagged"
|
|
1084
|
+
};
|
|
1085
|
+
function screeningOutcomeOf(category) {
|
|
1086
|
+
const key = category.trim().toUpperCase();
|
|
1087
|
+
if (FLOOR_CATEGORIES.includes(key)) return "always-blocked";
|
|
1088
|
+
return TUNED_OUTCOMES[key] ?? null;
|
|
1089
|
+
}
|
|
1090
|
+
var labelsFor = (outcome) => [...FLOOR_CATEGORIES, ...TUNABLE_CATEGORIES].filter((c) => screeningOutcomeOf(c) === outcome).map(categoryLabel);
|
|
1091
|
+
var SCREENING_BUCKETS = [
|
|
1092
|
+
{ outcome: "always-blocked", title: "Always blocked", detail: "Cannot be changed or disabled.", categories: labelsFor("always-blocked") },
|
|
1093
|
+
{ outcome: "blocked", title: "Blocked under this policy", detail: "The current policy stops the order.", categories: labelsFor("blocked") },
|
|
1094
|
+
{ outcome: "flagged", title: "Flagged", detail: "A warning is shown.", categories: labelsFor("flagged") }
|
|
1095
|
+
];
|
|
1096
|
+
|
|
473
1097
|
// src/core/solve.ts
|
|
474
1098
|
async function solveExactOut({ option, destination, destinationToken, payer, fetchQuote }) {
|
|
475
1099
|
const destDecimals = assetDecimals(destinationToken);
|
|
@@ -706,7 +1330,7 @@ function routeLabelFor(option, destinationToken, result) {
|
|
|
706
1330
|
const bridge = result.quote.bridge ? ` via ${result.quote.bridge}` : "";
|
|
707
1331
|
return `Swap ${option.symbol} to ${destinationToken.symbol} and settle on ZeroDelta${bridge}.`;
|
|
708
1332
|
}
|
|
709
|
-
async function buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote, solve = solveExactOut, amountInRaw }) {
|
|
1333
|
+
async function buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote, solve = solveExactOut, amountInRaw, compliance }) {
|
|
710
1334
|
const result = await solve({ option, destination, destinationToken, payer, fetchQuote, amountInRaw });
|
|
711
1335
|
const quote = result.quote;
|
|
712
1336
|
const destDecimals = assetDecimals(destinationToken);
|
|
@@ -753,7 +1377,11 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
753
1377
|
bridge: quote.bridge,
|
|
754
1378
|
feeBps: quote.feeBps,
|
|
755
1379
|
estimatedDuration: quote.estimatedDuration,
|
|
756
|
-
iterations: result.iterations
|
|
1380
|
+
iterations: result.iterations,
|
|
1381
|
+
// A direct transfer never reaches /quote (solve.ts short-circuits it), so there is no
|
|
1382
|
+
// gateway decision to carry. The caller screens both parties itself and passes the
|
|
1383
|
+
// synthesized verdict in — see plan.ts and compliance.ts::directComplianceFromScreens.
|
|
1384
|
+
compliance
|
|
757
1385
|
}
|
|
758
1386
|
};
|
|
759
1387
|
}
|
|
@@ -837,7 +1465,11 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
837
1465
|
gasCostSource: quote.gasCostSource,
|
|
838
1466
|
msgValue: valueRaw.toString(),
|
|
839
1467
|
deadline: order.deadline,
|
|
840
|
-
iterations: result.iterations
|
|
1468
|
+
iterations: result.iterations,
|
|
1469
|
+
// Carried verbatim from the gateway's decision on THIS wallet pair. The projection used to
|
|
1470
|
+
// drop it, which is why the widget could show a price with no evidence of the control that
|
|
1471
|
+
// produced it.
|
|
1472
|
+
compliance: quote.compliance
|
|
841
1473
|
}
|
|
842
1474
|
};
|
|
843
1475
|
}
|
|
@@ -873,25 +1505,20 @@ function apiMessage(json, fallback) {
|
|
|
873
1505
|
}
|
|
874
1506
|
return sanitizeMessage(err?.message, fallback);
|
|
875
1507
|
}
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
TERRORIST_FINANCING: "flagged for terrorist financing",
|
|
882
|
-
FRAUD: "flagged for fraud",
|
|
883
|
-
SCAM: "flagged as a scam address"
|
|
884
|
-
};
|
|
885
|
-
var BLOCK_LABEL_DEFAULT = "flagged by compliance screening";
|
|
1508
|
+
function isStructuredComplianceBlock(error) {
|
|
1509
|
+
const code = String(error?.code || "").toUpperCase();
|
|
1510
|
+
if (code === "COMPLIANCE_BLOCKED" || code === "COMPLIANCE_BLOCK") return true;
|
|
1511
|
+
return error?.status === 422 && Array.isArray(error?.reasons) && error.reasons.length > 0;
|
|
1512
|
+
}
|
|
886
1513
|
function classifyQuoteError(error) {
|
|
887
1514
|
if (!error) return null;
|
|
888
1515
|
const reasons = Array.isArray(error.reasons) ? error.reasons : [];
|
|
889
1516
|
const haystack = `${error.message || ""} ${reasons.join(" ")}`;
|
|
890
1517
|
const catMatch = /blocked_category:\s*([A-Za-z_]+)/i.exec(haystack);
|
|
891
|
-
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);
|
|
1518
|
+
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);
|
|
892
1519
|
if (!isBlock) return null;
|
|
893
1520
|
const category = (catMatch?.[1] || "").toUpperCase() || "COMPLIANCE";
|
|
894
|
-
const label =
|
|
1521
|
+
const label = blockLabelFor([category]);
|
|
895
1522
|
return {
|
|
896
1523
|
blocked: true,
|
|
897
1524
|
category,
|
|
@@ -912,8 +1539,11 @@ function createApiClient(cfg) {
|
|
|
912
1539
|
const cache = {
|
|
913
1540
|
chains: null,
|
|
914
1541
|
tokens: null,
|
|
915
|
-
routes: null
|
|
1542
|
+
routes: null,
|
|
1543
|
+
health: null
|
|
916
1544
|
};
|
|
1545
|
+
const screenCache = /* @__PURE__ */ new Map();
|
|
1546
|
+
const screenInflight = /* @__PURE__ */ new Map();
|
|
917
1547
|
const apiBase = cfg.apiBase.replace(/\/$/, "");
|
|
918
1548
|
async function apiRequest(path, init = {}) {
|
|
919
1549
|
const apiKey = await cfg.getApiKey();
|
|
@@ -982,6 +1612,18 @@ function createApiClient(cfg) {
|
|
|
982
1612
|
return [];
|
|
983
1613
|
}
|
|
984
1614
|
}
|
|
1615
|
+
async function fetchRouteHealth() {
|
|
1616
|
+
if (nowFresh(cache.health)) return cache.health.value;
|
|
1617
|
+
let value = null;
|
|
1618
|
+
try {
|
|
1619
|
+
const health = await apiRequest("/route-health", { timeoutMs: 8e3 });
|
|
1620
|
+
value = health && typeof health === "object" && !Array.isArray(health) ? health : null;
|
|
1621
|
+
} catch {
|
|
1622
|
+
value = null;
|
|
1623
|
+
}
|
|
1624
|
+
cache.health = { at: Date.now(), value };
|
|
1625
|
+
return value;
|
|
1626
|
+
}
|
|
985
1627
|
async function fetchQuote(body, retries = 1) {
|
|
986
1628
|
let lastError;
|
|
987
1629
|
for (let attempt = 0; attempt <= retries; attempt += 1) {
|
|
@@ -996,7 +1638,32 @@ function createApiClient(cfg) {
|
|
|
996
1638
|
}
|
|
997
1639
|
throw lastError;
|
|
998
1640
|
}
|
|
999
|
-
|
|
1641
|
+
async function screenWallet(address, chainId) {
|
|
1642
|
+
const addr = String(address || "").trim();
|
|
1643
|
+
if (!addr) throw apiError("An address is required to screen a wallet.", { code: "bad_request" });
|
|
1644
|
+
const key = `${/^0x[0-9a-fA-F]+$/.test(addr) ? addr.toLowerCase() : addr}|${chainId ?? ""}`;
|
|
1645
|
+
const hit = screenCache.get(key);
|
|
1646
|
+
if (hit && Date.now() - hit.at < SCREEN_CACHE_TTL_MS) return hit.value;
|
|
1647
|
+
const inflight = screenInflight.get(key);
|
|
1648
|
+
if (inflight) return inflight;
|
|
1649
|
+
const request = apiRequest("/screen/wallet", {
|
|
1650
|
+
method: "POST",
|
|
1651
|
+
body: JSON.stringify(chainId == null ? { address: addr } : { address: addr, chainId }),
|
|
1652
|
+
timeoutMs: 12e3
|
|
1653
|
+
}).then((screen) => {
|
|
1654
|
+
if (!screen || typeof screen !== "object" || typeof screen.blocked !== "boolean") {
|
|
1655
|
+
throw apiError("Compliance screening returned an unusable result.", { code: "bad_response" });
|
|
1656
|
+
}
|
|
1657
|
+
const value = { ...screen, address: screen.address || addr };
|
|
1658
|
+
screenCache.set(key, { at: Date.now(), value });
|
|
1659
|
+
return value;
|
|
1660
|
+
}).finally(() => {
|
|
1661
|
+
screenInflight.delete(key);
|
|
1662
|
+
});
|
|
1663
|
+
screenInflight.set(key, request);
|
|
1664
|
+
return request;
|
|
1665
|
+
}
|
|
1666
|
+
return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchQuote, screenWallet, apiBase };
|
|
1000
1667
|
}
|
|
1001
1668
|
|
|
1002
1669
|
// src/core/plan.ts
|
|
@@ -1014,7 +1681,7 @@ function validateDestination(destination) {
|
|
|
1014
1681
|
assertAddress(destination.address, "Destination address");
|
|
1015
1682
|
const chainId = Number(destination.chainId);
|
|
1016
1683
|
const asset = symbolKey(destination.asset);
|
|
1017
|
-
if (!
|
|
1684
|
+
if (!Number.isSafeInteger(chainId) || chainId <= 0) throw new Error("Unsupported destination chain.");
|
|
1018
1685
|
if (!SUPPORTED_ASSETS.has(asset)) throw new Error("Unsupported destination asset.");
|
|
1019
1686
|
const normalizedAmount = normalizeDecimalText(destination.amount);
|
|
1020
1687
|
if (!/^\d+(\.\d+)?$/.test(normalizedAmount)) throw new Error("Could not detect a valid payment amount.");
|
|
@@ -1028,7 +1695,15 @@ function planErrorSummary(errors) {
|
|
|
1028
1695
|
async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances) {
|
|
1029
1696
|
validateDestination(request);
|
|
1030
1697
|
assertAddress(payer, "Payer wallet");
|
|
1031
|
-
const [chains, tokens, routes] = await Promise.all([api.fetchChains(), api.fetchTokens(), api.fetchRoutes()]);
|
|
1698
|
+
const [chains, tokens, routes, health] = await Promise.all([api.fetchChains(), api.fetchTokens(), api.fetchRoutes(), api.fetchRouteHealth()]);
|
|
1699
|
+
const catalogue = buildCatalogue({
|
|
1700
|
+
chains,
|
|
1701
|
+
tokens,
|
|
1702
|
+
routes,
|
|
1703
|
+
product: "stable",
|
|
1704
|
+
supportedChainIds: SUPPORTED_CHAIN_IDS,
|
|
1705
|
+
brokenLanes: suppressedLanes(health)
|
|
1706
|
+
});
|
|
1032
1707
|
const destination = {
|
|
1033
1708
|
...request,
|
|
1034
1709
|
chainId: Number(request.chainId),
|
|
@@ -1043,7 +1718,8 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances)
|
|
|
1043
1718
|
tokens,
|
|
1044
1719
|
routes,
|
|
1045
1720
|
chains,
|
|
1046
|
-
walletChainId: wallet?.chainId
|
|
1721
|
+
walletChainId: wallet?.chainId,
|
|
1722
|
+
catalogue
|
|
1047
1723
|
}).filter((option) => option.direct || !allowedFunding || allowedFunding.has(option.symbolKey));
|
|
1048
1724
|
if (!options.length) throw new Error(`No enabled ZeroDelta funding assets can settle ${destination.asset} on ${chainNameOf(destination.chainId, chains)}.`);
|
|
1049
1725
|
const balanceTargets = [];
|
|
@@ -1055,7 +1731,36 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances)
|
|
|
1055
1731
|
balanceTargets.push({ chainId: option.chainId, tokenAddress: option.address, decimals: option.decimals });
|
|
1056
1732
|
}
|
|
1057
1733
|
const walletBalances = readBalances ? await readBalances(payer, balanceTargets).catch(() => ({})) : {};
|
|
1058
|
-
const
|
|
1734
|
+
const directOptions = options.filter((option) => option.direct);
|
|
1735
|
+
let directCompliance = null;
|
|
1736
|
+
if (directOptions.length) {
|
|
1737
|
+
const parties = [];
|
|
1738
|
+
const seenParty = /* @__PURE__ */ new Set();
|
|
1739
|
+
for (const raw of [payer, destination.address]) {
|
|
1740
|
+
const addr = String(raw || "").trim();
|
|
1741
|
+
if (!addr) continue;
|
|
1742
|
+
const key = /^0x[0-9a-fA-F]+$/.test(addr) ? addr.toLowerCase() : addr;
|
|
1743
|
+
if (seenParty.has(key)) continue;
|
|
1744
|
+
seenParty.add(key);
|
|
1745
|
+
parties.push(addr);
|
|
1746
|
+
}
|
|
1747
|
+
try {
|
|
1748
|
+
const screens = await Promise.all(parties.map((address) => api.screenWallet(address, destination.chainId)));
|
|
1749
|
+
const blocked = screens.filter((screen) => screen.blocked);
|
|
1750
|
+
if (blocked.length) {
|
|
1751
|
+
const who = blocked.some((s) => s.address.toLowerCase() === payer.toLowerCase()) ? "your wallet" : "the recipient";
|
|
1752
|
+
const categories = [...new Set(blocked.flatMap((s) => s.blockingCategories ?? []))];
|
|
1753
|
+
throw apiError(
|
|
1754
|
+
`This payment was blocked by compliance screening \u2014 ${who} is ${blockLabelFor(categories)}. Choose a different recipient or connect a different wallet.`,
|
|
1755
|
+
{ blocked: true, blockedCategory: categories[0] || "COMPLIANCE", blockedReason: categories.join(", ") }
|
|
1756
|
+
);
|
|
1757
|
+
}
|
|
1758
|
+
directCompliance = directComplianceFromScreens(screens);
|
|
1759
|
+
} catch (error) {
|
|
1760
|
+
if (error?.blocked) throw error;
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
const candidates = directCompliance ? directOptions : [];
|
|
1059
1764
|
const heldOptions = options.filter((option) => !option.direct && hasPositiveBalance(option, walletBalances));
|
|
1060
1765
|
const heldKeys = new Set(heldOptions.map(optionBalanceKey));
|
|
1061
1766
|
const seenChains = /* @__PURE__ */ new Set();
|
|
@@ -1075,7 +1780,7 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances)
|
|
|
1075
1780
|
}
|
|
1076
1781
|
const routeErrors = [];
|
|
1077
1782
|
const routePromises = candidates.map(
|
|
1078
|
-
(option) => buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote: api.fetchQuote }).catch((error) => {
|
|
1783
|
+
(option) => buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote: api.fetchQuote, compliance: option.direct ? directCompliance ?? void 0 : void 0 }).catch((error) => {
|
|
1079
1784
|
routeErrors.push(error);
|
|
1080
1785
|
return null;
|
|
1081
1786
|
})
|
|
@@ -1125,7 +1830,8 @@ function validateSwap(swap = {}) {
|
|
|
1125
1830
|
const toChainId = Number(swap.toChainId);
|
|
1126
1831
|
const fromToken = symbolKey(swap.fromToken);
|
|
1127
1832
|
const toToken = symbolKey(swap.toToken);
|
|
1128
|
-
if (!SUPPORTED_CHAIN_IDS.has(fromChainId)
|
|
1833
|
+
if (!SUPPORTED_CHAIN_IDS.has(fromChainId)) throw new Error("Unsupported swap chain.");
|
|
1834
|
+
if (!Number.isSafeInteger(toChainId) || toChainId <= 0) throw new Error("Unsupported swap chain.");
|
|
1129
1835
|
if (!SUPPORTED_ASSETS.has(fromToken) || !SUPPORTED_ASSETS.has(toToken)) throw new Error("Unsupported swap asset.");
|
|
1130
1836
|
const amountIn = normalizeDecimalText(swap.amountIn);
|
|
1131
1837
|
if (!/^\d+(\.\d+)?$/.test(amountIn) || Number(amountIn) <= 0 || Number(amountIn) > 1e9) throw new Error("Enter a valid swap amount.");
|
|
@@ -1571,7 +2277,26 @@ function createEngine(config = {}) {
|
|
|
1571
2277
|
fetchChains: api.fetchChains,
|
|
1572
2278
|
fetchTokens: api.fetchTokens,
|
|
1573
2279
|
fetchRoutes: api.fetchRoutes,
|
|
2280
|
+
fetchRouteHealth: api.fetchRouteHealth,
|
|
1574
2281
|
fetchQuote: api.fetchQuote,
|
|
2282
|
+
fetchCatalogue: async (allowedAssets, product) => {
|
|
2283
|
+
const [chains, tokens, routes, health] = await Promise.all([
|
|
2284
|
+
api.fetchChains().catch(() => []),
|
|
2285
|
+
api.fetchTokens().catch(() => []),
|
|
2286
|
+
api.fetchRoutes().catch(() => []),
|
|
2287
|
+
api.fetchRouteHealth()
|
|
2288
|
+
]);
|
|
2289
|
+
const allowed = allowedAssets?.length ? new Set([...allowedAssets].map(symbolKey).filter((a) => SUPPORTED_ASSETS.has(a))) : void 0;
|
|
2290
|
+
return buildCatalogue({
|
|
2291
|
+
chains,
|
|
2292
|
+
tokens,
|
|
2293
|
+
routes,
|
|
2294
|
+
product,
|
|
2295
|
+
...allowed ? { allowedAssets: allowed } : {},
|
|
2296
|
+
supportedChainIds: SUPPORTED_CHAIN_IDS,
|
|
2297
|
+
brokenLanes: suppressedLanes(health)
|
|
2298
|
+
});
|
|
2299
|
+
},
|
|
1575
2300
|
fetchPaymentPlan: (request, payer, wallet) => fetchPaymentPlan(api, request, payer, wallet, verifier.readBalances),
|
|
1576
2301
|
quoteSwapPreview: (swap, owner) => quoteSwapPreview(api, swap, owner),
|
|
1577
2302
|
buildSwapPlan: (swap, payer, wallet) => buildSwapPlan(api, swap, payer, wallet),
|
|
@@ -2308,7 +3033,12 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
|
|
|
2308
3033
|
.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}
|
|
2309
3034
|
.sg-back:hover{background:var(--sg-surface)}
|
|
2310
3035
|
.sg-sel-title{flex:1 1 auto;text-align:center;font-size:15px;font-weight:600;margin-right:32px}
|
|
2311
|
-
.
|
|
3036
|
+
/* Scrolls at ~2.5 rows. The catalogue's destination chains outnumber its source chains three to one
|
|
3037
|
+
(9 escrow chains, ~37 total), so an ungated grid was eight rows tall and pushed the token list \u2014
|
|
3038
|
+
the thing the panel exists for \u2014 below the fold. The fade is a scroll affordance, not decoration. */
|
|
3039
|
+
.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)}
|
|
3040
|
+
/* No mask once everything fits \u2014 a fade under a grid with nothing below it reads as a rendering bug. */
|
|
3041
|
+
.sg-chain-grid[data-scroll="false"]{mask-image:none;-webkit-mask-image:none;overflow-y:visible;max-height:none}
|
|
2312
3042
|
.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}
|
|
2313
3043
|
.sg-chain-chip img{width:22px;height:22px;border-radius:999px;display:block}
|
|
2314
3044
|
.sg-chain-chip:hover{border-color:color-mix(in srgb,var(--sg-accent) 45%,var(--sg-border))}
|
|
@@ -2511,6 +3241,98 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
|
|
|
2511
3241
|
.sg-island .sg-spinner{display:none!important}
|
|
2512
3242
|
.sg-island .sg-rm-dot{display:inline-block}
|
|
2513
3243
|
}
|
|
3244
|
+
|
|
3245
|
+
/* \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
|
|
3246
|
+
Mirrors the dApp's compliance row + details dialog. The row is a quiet affordance in the payment
|
|
3247
|
+
summary; the details open a sheet that fills the widget's own card, because a page-level modal
|
|
3248
|
+
inside somebody else's checkout is a z-index fight we would lose.
|
|
3249
|
+
|
|
3250
|
+
Tone note, carried over from the dApp: a PASS reads in body ink, not in green. The shield tick is
|
|
3251
|
+
already green, so colouring the sentence too says the same thing twice and spends the accent on
|
|
3252
|
+
the half that carries no information. A DENY still shouts. */
|
|
3253
|
+
/* NOT positioned. The sheet is inset:0 against the WIDGET CARD, so this wrapper must not become
|
|
3254
|
+
the containing block: when it carried position:relative the sheet collapsed to the height of
|
|
3255
|
+
this one row and drew straight through the CTA beneath it.
|
|
3256
|
+
NB this stylesheet is a JS template literal - never write a backtick in these comments. */
|
|
3257
|
+
.sg-cp{margin-top:10px}
|
|
3258
|
+
.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}
|
|
3259
|
+
.sg-cp-row:hover{border-color:color-mix(in srgb,var(--sg-accent) 40%,var(--sg-border))}
|
|
3260
|
+
.sg-cp-row:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px}
|
|
3261
|
+
.sg-cp-row-main{display:flex;align-items:center;gap:8px;min-width:0}
|
|
3262
|
+
.sg-cp-row-glyph{display:flex;flex:0 0 auto;color:var(--sg-success)}
|
|
3263
|
+
.sg-cp-row[data-tone="neutral"] .sg-cp-row-glyph{color:var(--sg-text-muted);opacity:.55}
|
|
3264
|
+
.sg-cp-row[data-tone="blocked"] .sg-cp-row-glyph,.sg-cp-row[data-tone="warn"] .sg-cp-row-glyph{color:var(--sg-danger)}
|
|
3265
|
+
.sg-cp-row-label{font-size:13px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
3266
|
+
.sg-cp-row[data-tone="neutral"] .sg-cp-row-label{color:var(--sg-text-muted)}
|
|
3267
|
+
.sg-cp-row[data-tone="blocked"] .sg-cp-row-label,.sg-cp-row[data-tone="warn"] .sg-cp-row-label{color:var(--sg-danger)}
|
|
3268
|
+
.sg-cp-row-chev{display:flex;flex:0 0 auto;color:var(--sg-text-muted)}
|
|
3269
|
+
.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)}
|
|
3270
|
+
|
|
3271
|
+
/* the sheet \u2014 fills the widget card */
|
|
3272
|
+
.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}
|
|
3273
|
+
@keyframes sg-cp-in{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
|
|
3274
|
+
.sg-cp-sheet:focus{outline:none}
|
|
3275
|
+
.sg-cp-sheet-head{display:flex;align-items:center;justify-content:space-between;gap:8px;flex:0 0 auto}
|
|
3276
|
+
.sg-cp-sheet-title{margin:0;font-size:15px;font-weight:600}
|
|
3277
|
+
.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}
|
|
3278
|
+
.sg-cp-close:hover{background:var(--sg-surface);color:var(--sg-text)}
|
|
3279
|
+
.sg-cp-close:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px}
|
|
3280
|
+
.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}
|
|
3281
|
+
.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}
|
|
3282
|
+
.sg-cp-tab[data-active="true"]{background:color-mix(in srgb,var(--sg-accent) 10%,transparent);color:var(--sg-accent)}
|
|
3283
|
+
.sg-cp-tab:focus-visible{outline:2px solid var(--sg-accent);outline-offset:-2px}
|
|
3284
|
+
.sg-cp-sheet-body{margin-top:10px}
|
|
3285
|
+
.sg-cp-tabpanel{display:flex;flex-direction:column;gap:8px}
|
|
3286
|
+
|
|
3287
|
+
/* cards */
|
|
3288
|
+
.sg-cp-card{display:flex;flex-direction:column;gap:12px;padding:14px;border:1px solid var(--sg-border);border-radius:16px}
|
|
3289
|
+
.sg-cp-card-head{display:flex;align-items:center;gap:8px}
|
|
3290
|
+
.sg-cp-card-glyph{display:flex;flex:0 0 auto;color:var(--sg-accent)}
|
|
3291
|
+
.sg-cp-card-title{margin:0;font-size:14px;font-weight:600}
|
|
3292
|
+
.sg-cp-summary{display:flex;flex-direction:column;gap:3px}
|
|
3293
|
+
.sg-cp-summary-head{display:flex;align-items:center;gap:8px;color:var(--sg-success)}
|
|
3294
|
+
.sg-cp-summary-head[data-tone="neutral"]{color:var(--sg-text-muted)}
|
|
3295
|
+
.sg-cp-summary-head[data-tone="blocked"],.sg-cp-summary-head[data-tone="warn"]{color:var(--sg-danger)}
|
|
3296
|
+
.sg-cp-summary-title{font-size:14px;font-weight:600;color:var(--sg-text)}
|
|
3297
|
+
.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)}
|
|
3298
|
+
.sg-cp-summary-sub{margin:0;padding-left:24px;font-size:12px;line-height:1.35;color:var(--sg-text-muted)}
|
|
3299
|
+
|
|
3300
|
+
/* per-control rows */
|
|
3301
|
+
.sg-cp-checks{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:11px}
|
|
3302
|
+
.sg-cp-check-head{display:flex;flex-wrap:wrap;align-items:center;gap:6px 14px}
|
|
3303
|
+
.sg-cp-check-label{display:flex;align-items:center;gap:8px;min-width:0;font-size:13.5px;line-height:1.25}
|
|
3304
|
+
.sg-cp-check[data-ok="false"] .sg-cp-check-label{color:var(--sg-danger)}
|
|
3305
|
+
.sg-cp-check-mark{display:flex;flex:0 0 auto;color:var(--sg-success)}
|
|
3306
|
+
.sg-cp-check-mark[data-ok="false"]{color:var(--sg-danger)}
|
|
3307
|
+
.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}
|
|
3308
|
+
.sg-cp-check-reason{color:var(--sg-danger)}
|
|
3309
|
+
.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}
|
|
3310
|
+
.sg-cp-link:hover{text-decoration:underline}
|
|
3311
|
+
.sg-cp-link:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px;border-radius:4px}
|
|
3312
|
+
.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)}
|
|
3313
|
+
.sg-cp-scope{margin:0;font-size:11.5px;line-height:1.45;color:var(--sg-text-muted)}
|
|
3314
|
+
.sg-cp-flags{margin:0;font-size:13px}
|
|
3315
|
+
|
|
3316
|
+
/* quote details */
|
|
3317
|
+
.sg-cp-facts{margin:0;display:flex;flex-direction:column;gap:9px}
|
|
3318
|
+
.sg-cp-fact{display:grid;grid-template-columns:78px minmax(0,1fr);align-items:center;gap:10px}
|
|
3319
|
+
.sg-cp-fact dt{font-size:12px;color:var(--sg-text-muted)}
|
|
3320
|
+
.sg-cp-fact dd{margin:0;font-size:13px;min-width:0;overflow-wrap:anywhere}
|
|
3321
|
+
|
|
3322
|
+
/* screening policy */
|
|
3323
|
+
.sg-cp-policy-head{display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:space-between;gap:8px;padding-bottom:2px}
|
|
3324
|
+
.sg-cp-policy-id{font-size:11px;color:var(--sg-text-muted);overflow-wrap:anywhere}
|
|
3325
|
+
.sg-cp-policy-facts{padding:2px 0 8px}
|
|
3326
|
+
.sg-cp-buckets{display:flex;flex-direction:column;gap:8px}
|
|
3327
|
+
.sg-cp-bucket{gap:10px;padding:12px 14px}
|
|
3328
|
+
.sg-cp-bucket-head{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:4px 10px}
|
|
3329
|
+
.sg-cp-bucket-detail{font-size:11.5px;color:var(--sg-text-muted)}
|
|
3330
|
+
.sg-cp-cats{list-style:none;margin:0;padding:0 0 0 4px;display:flex;flex-direction:column;gap:5px}
|
|
3331
|
+
.sg-cp-cats li{display:flex;align-items:center;gap:10px;font-size:12.5px;line-height:1.35}
|
|
3332
|
+
.sg-cp-dot{flex:0 0 auto;width:4px;height:4px;border-radius:999px;background:var(--sg-accent);opacity:.8}
|
|
3333
|
+
|
|
3334
|
+
/* express (PaymentIsland) trims the card padding, so the sheet follows */
|
|
3335
|
+
@media (prefers-reduced-motion:reduce){.sg-cp-sheet{animation:none}}
|
|
2514
3336
|
`;
|
|
2515
3337
|
var injected = false;
|
|
2516
3338
|
function injectStyles() {
|
|
@@ -2664,11 +3486,11 @@ function WidgetShell(props) {
|
|
|
2664
3486
|
] })
|
|
2665
3487
|
] });
|
|
2666
3488
|
}
|
|
2667
|
-
function
|
|
3489
|
+
function shortAddress2(a) {
|
|
2668
3490
|
if (!a) return "";
|
|
2669
3491
|
return `${a.slice(0, 6)}\u2026${a.slice(-4)}`;
|
|
2670
3492
|
}
|
|
2671
|
-
var
|
|
3493
|
+
var SOURCE_CHAIN_LABELS = {
|
|
2672
3494
|
1: "Ethereum",
|
|
2673
3495
|
10: "Optimism",
|
|
2674
3496
|
130: "Unichain",
|
|
@@ -2679,8 +3501,14 @@ var CHAIN_LABELS = {
|
|
|
2679
3501
|
42161: "Arbitrum",
|
|
2680
3502
|
98866: "Plume"
|
|
2681
3503
|
};
|
|
3504
|
+
var CHAIN_LABELS = { ...CHAIN_DISPLAY_NAMES, ...SOURCE_CHAIN_LABELS };
|
|
2682
3505
|
var SUPPORTED_CHAINS = [1, 10, 42161, 8453, 57073, 130, 9745, 146, 98866];
|
|
2683
|
-
var SUPPORTED_ASSETS2 = [
|
|
3506
|
+
var SUPPORTED_ASSETS2 = [
|
|
3507
|
+
...EXECUTABLE_STABLE_ASSETS,
|
|
3508
|
+
...[...STABLE_ASSETS].filter((a) => !EXECUTABLE_STABLE_ASSETS.has(a)),
|
|
3509
|
+
...[...SUPPORTED_ASSETS].filter((a) => !STABLE_ASSETS.has(a))
|
|
3510
|
+
];
|
|
3511
|
+
[...EXECUTABLE_STABLE_ASSETS];
|
|
2684
3512
|
function Button(props) {
|
|
2685
3513
|
const soft = !!props.softDisabled && !props.disabled;
|
|
2686
3514
|
const nativeDisabled = props.disabled || props.busy && !props.softDisabled;
|
|
@@ -2870,6 +3698,251 @@ function RouteList(props) {
|
|
|
2870
3698
|
] }) : null
|
|
2871
3699
|
] });
|
|
2872
3700
|
}
|
|
3701
|
+
function ShieldTick({ 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("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" }),
|
|
3704
|
+
/* @__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" }),
|
|
3705
|
+
/* @__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" })
|
|
3706
|
+
] });
|
|
3707
|
+
}
|
|
3708
|
+
function TickCircle({ size = 16 }) {
|
|
3709
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3710
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor" }),
|
|
3711
|
+
/* @__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" })
|
|
3712
|
+
] });
|
|
3713
|
+
}
|
|
3714
|
+
function CloseCircle({ size = 16 }) {
|
|
3715
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3716
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor" }),
|
|
3717
|
+
/* @__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" })
|
|
3718
|
+
] });
|
|
3719
|
+
}
|
|
3720
|
+
function PendingCircle({ size = 16 }) {
|
|
3721
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3722
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "9.2", stroke: "currentColor", strokeWidth: "1.6", strokeDasharray: "3 3" }),
|
|
3723
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8.5 12h7", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round" })
|
|
3724
|
+
] });
|
|
3725
|
+
}
|
|
3726
|
+
function Tick({ size = 12 }) {
|
|
3727
|
+
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" }) });
|
|
3728
|
+
}
|
|
3729
|
+
function Cross({ size = 12 }) {
|
|
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: "m5.5 5.5 13 13M18.5 5.5l-13 13", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round" }) });
|
|
3731
|
+
}
|
|
3732
|
+
function Chevron({ size = 16 }) {
|
|
3733
|
+
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" }) });
|
|
3734
|
+
}
|
|
3735
|
+
function Info({ size = 16 }) {
|
|
3736
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3737
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor" }),
|
|
3738
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 10.6v6", stroke: "var(--sg-bg)", strokeWidth: "2.1", strokeLinecap: "round" }),
|
|
3739
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "7.6", r: "1.25", fill: "var(--sg-bg)" })
|
|
3740
|
+
] });
|
|
3741
|
+
}
|
|
3742
|
+
function Lock({ size = 16 }) {
|
|
3743
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3744
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "4.5", y: "10.5", width: "15", height: "9.5", rx: "2.2", stroke: "currentColor", strokeWidth: "1.7" }),
|
|
3745
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 10.5V7.8a4 4 0 0 1 8 0v2.7", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round" })
|
|
3746
|
+
] });
|
|
3747
|
+
}
|
|
3748
|
+
function ShieldOutline({ size = 16 }) {
|
|
3749
|
+
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" }) });
|
|
3750
|
+
}
|
|
3751
|
+
function WarningFilled({ size = 16 }) {
|
|
3752
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
|
|
3753
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 3.2 21.4 19.4H2.6L12 3.2Z", fill: "currentColor" }),
|
|
3754
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 9.4v4.3", stroke: "var(--sg-bg)", strokeWidth: "1.9", strokeLinecap: "round" }),
|
|
3755
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "16.4", r: "1.05", fill: "var(--sg-bg)" })
|
|
3756
|
+
] });
|
|
3757
|
+
}
|
|
3758
|
+
function CornerArrow({ size = 12 }) {
|
|
3759
|
+
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" }) });
|
|
3760
|
+
}
|
|
3761
|
+
var POLICY_GLYPH = {
|
|
3762
|
+
"always-blocked": Lock,
|
|
3763
|
+
blocked: ShieldOutline,
|
|
3764
|
+
flagged: WarningFilled
|
|
3765
|
+
};
|
|
3766
|
+
var POLICY_DETAIL = {
|
|
3767
|
+
"always-blocked": "Cannot be changed or disabled",
|
|
3768
|
+
blocked: "Stops the payment",
|
|
3769
|
+
flagged: "Does not automatically block"
|
|
3770
|
+
};
|
|
3771
|
+
function shortAddr(a) {
|
|
3772
|
+
return a.length > 14 ? `${a.slice(0, 6)}\u2026${a.slice(-4)}` : a;
|
|
3773
|
+
}
|
|
3774
|
+
function TriggerGlyph({ cv }) {
|
|
3775
|
+
if (cv.tone === "blocked" || cv.tone === "warn") return /* @__PURE__ */ jsxRuntime.jsx(CloseCircle, {});
|
|
3776
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ShieldTick, {});
|
|
3777
|
+
}
|
|
3778
|
+
function CheckRow({ check, onViewPolicy }) {
|
|
3779
|
+
const label = check.id === "risk" ? check.ok ? "Risk screening passed" : "Risk screening failed" : check.label;
|
|
3780
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "sg-cp-check", "data-ok": check.ok, children: [
|
|
3781
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-check-head", children: [
|
|
3782
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-check-label", children: [
|
|
3783
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-check-mark", "data-ok": check.ok, children: check.ok ? /* @__PURE__ */ jsxRuntime.jsx(Tick, {}) : /* @__PURE__ */ jsxRuntime.jsx(Cross, {}) }),
|
|
3784
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: label }),
|
|
3785
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-sr-only", children: check.ok ? " \u2014 passed" : " \u2014 failed" })
|
|
3786
|
+
] }),
|
|
3787
|
+
check.id === "risk" ? /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-cp-link", onClick: onViewPolicy, children: [
|
|
3788
|
+
"View policy",
|
|
3789
|
+
/* @__PURE__ */ jsxRuntime.jsx(CornerArrow, {})
|
|
3790
|
+
] }) : null
|
|
3791
|
+
] }),
|
|
3792
|
+
check.note ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-check-note", children: check.note }) : null,
|
|
3793
|
+
check.reasons.map((reason) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-check-reason", children: humanizeComplianceReason(reason) }, reason))
|
|
3794
|
+
] });
|
|
3795
|
+
}
|
|
3796
|
+
function QuoteChecks({
|
|
3797
|
+
compliance,
|
|
3798
|
+
cv,
|
|
3799
|
+
checks,
|
|
3800
|
+
direct,
|
|
3801
|
+
onViewPolicy
|
|
3802
|
+
}) {
|
|
3803
|
+
const allPassed = cv.tone === "ok" && checks.length > 0 && checks.every((c) => c.ok);
|
|
3804
|
+
const summary = allPassed ? "All checks passed" : cv.label;
|
|
3805
|
+
const orphans = unattributedComplianceReasons(compliance, cv);
|
|
3806
|
+
const wallets = distinctScreenedWallets(compliance);
|
|
3807
|
+
const jurisdiction = compliance?.sourceJurisdiction?.trim();
|
|
3808
|
+
const hasDetails = Boolean(jurisdiction || wallets.length || compliance?.checkId);
|
|
3809
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-tabpanel", role: "tabpanel", "aria-label": "Quote checks", children: [
|
|
3810
|
+
/* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card", children: [
|
|
3811
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-summary", children: [
|
|
3812
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-summary-head", "data-tone": cv.tone, children: [
|
|
3813
|
+
cv.tone === "blocked" || cv.tone === "warn" ? /* @__PURE__ */ jsxRuntime.jsx(CloseCircle, {}) : cv.tone === "neutral" ? /* @__PURE__ */ jsxRuntime.jsx(PendingCircle, {}) : /* @__PURE__ */ jsxRuntime.jsx(TickCircle, {}),
|
|
3814
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-summary-title", children: summary })
|
|
3815
|
+
] }),
|
|
3816
|
+
checks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "sg-cp-summary-sub", children: [
|
|
3817
|
+
checks.length,
|
|
3818
|
+
" check",
|
|
3819
|
+
checks.length === 1 ? " was" : "s were",
|
|
3820
|
+
" completed for this payment"
|
|
3821
|
+
] }) : (
|
|
3822
|
+
// No decision was issued. Listing the controls here would be ticks for a verdict nobody
|
|
3823
|
+
// gave, and an unconfigured gate is not a set of passed checks.
|
|
3824
|
+
/* @__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." })
|
|
3825
|
+
)
|
|
3826
|
+
] }),
|
|
3827
|
+
checks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "sg-cp-checks", children: checks.map((check) => /* @__PURE__ */ jsxRuntime.jsx(CheckRow, { check, onViewPolicy }, check.id)) }) : null,
|
|
3828
|
+
orphans.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "sg-cp-orphans", children: orphans.map((reason) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: humanizeComplianceReason(reason) }, reason)) }) : null,
|
|
3829
|
+
direct && checks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-cp-scope", children: DIRECT_SCOPE_NOTE }) : null
|
|
3830
|
+
] }),
|
|
3831
|
+
compliance?.flaggedCategories?.length ? /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card", children: [
|
|
3832
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-card-head", children: [
|
|
3833
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-card-glyph", children: /* @__PURE__ */ jsxRuntime.jsx(WarningFilled, {}) }),
|
|
3834
|
+
/* @__PURE__ */ jsxRuntime.jsx("h5", { className: "sg-cp-card-title", children: "Flagged, not blocking" })
|
|
3835
|
+
] }),
|
|
3836
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-cp-flags", children: compliance.flaggedCategories.map(categoryLabel).join(" \xB7 ") }),
|
|
3837
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-cp-scope", children: "The policy records these and still allows the payment. They do not stop settlement." })
|
|
3838
|
+
] }) : null,
|
|
3839
|
+
hasDetails ? /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card", children: [
|
|
3840
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-card-head", children: [
|
|
3841
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-card-glyph", children: /* @__PURE__ */ jsxRuntime.jsx(Info, {}) }),
|
|
3842
|
+
/* @__PURE__ */ jsxRuntime.jsx("h5", { className: "sg-cp-card-title", children: "Quote details" })
|
|
3843
|
+
] }),
|
|
3844
|
+
/* @__PURE__ */ jsxRuntime.jsxs("dl", { className: "sg-cp-facts", children: [
|
|
3845
|
+
jurisdiction ? /* @__PURE__ */ jsxRuntime.jsx(Fact, { label: "Jurisdiction", value: jurisdiction }) : null,
|
|
3846
|
+
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)),
|
|
3847
|
+
compliance?.checkId ? /* @__PURE__ */ jsxRuntime.jsx(Fact, { label: "Check ID", value: compliance.checkId, mono: true }) : null
|
|
3848
|
+
] })
|
|
3849
|
+
] }) : null
|
|
3850
|
+
] });
|
|
3851
|
+
}
|
|
3852
|
+
function Fact({ label, value, title, mono = false }) {
|
|
3853
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-fact", children: [
|
|
3854
|
+
/* @__PURE__ */ jsxRuntime.jsx("dt", { children: label }),
|
|
3855
|
+
/* @__PURE__ */ jsxRuntime.jsx("dd", { title, className: mono ? "sg-mono" : void 0, children: value })
|
|
3856
|
+
] });
|
|
3857
|
+
}
|
|
3858
|
+
function ScreeningPolicy({ compliance }) {
|
|
3859
|
+
const policyId = compliance?.policyVersion?.trim();
|
|
3860
|
+
const applied = Boolean(compliance?.decision || policyId || compliance?.appliedPolicyNames?.length);
|
|
3861
|
+
const names = [...compliance?.appliedPolicyNames ?? [], ...compliance?.appliedLegislation ?? []];
|
|
3862
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-tabpanel", role: "tabpanel", "aria-label": "Screening policy", children: [
|
|
3863
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-policy-head", children: [
|
|
3864
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-summary", children: [
|
|
3865
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-summary-head", "data-tone": applied ? "ok" : "neutral", children: [
|
|
3866
|
+
applied ? /* @__PURE__ */ jsxRuntime.jsx(TickCircle, {}) : /* @__PURE__ */ jsxRuntime.jsx(PendingCircle, {}),
|
|
3867
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-summary-title", children: "Transaction screening policy" })
|
|
3868
|
+
] }),
|
|
3869
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-cp-summary-sub", children: applied ? "Applied to this payment" : "No policy decision was returned" })
|
|
3870
|
+
] }),
|
|
3871
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-policy-id sg-mono", children: policyId ? `Policy ${policyId}` : "Policy ID unavailable" })
|
|
3872
|
+
] }),
|
|
3873
|
+
names.length ? /* @__PURE__ */ jsxRuntime.jsxs("dl", { className: "sg-cp-facts sg-cp-policy-facts", children: [
|
|
3874
|
+
compliance?.appliedPolicyNames?.length ? /* @__PURE__ */ jsxRuntime.jsx(Fact, { label: "Policy", value: compliance.appliedPolicyNames.join(", ") }) : null,
|
|
3875
|
+
compliance?.appliedLegislation?.length ? /* @__PURE__ */ jsxRuntime.jsx(Fact, { label: "Legislation", value: compliance.appliedLegislation.join(", ") }) : null
|
|
3876
|
+
] }) : null,
|
|
3877
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cp-buckets", children: SCREENING_BUCKETS.map((bucket) => {
|
|
3878
|
+
const Glyph = POLICY_GLYPH[bucket.outcome];
|
|
3879
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card sg-cp-bucket", children: [
|
|
3880
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-bucket-head", children: [
|
|
3881
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-card-head", children: [
|
|
3882
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-card-glyph", children: /* @__PURE__ */ jsxRuntime.jsx(Glyph, {}) }),
|
|
3883
|
+
/* @__PURE__ */ jsxRuntime.jsx("h5", { className: "sg-cp-card-title", children: bucket.title })
|
|
3884
|
+
] }),
|
|
3885
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-bucket-detail", children: POLICY_DETAIL[bucket.outcome] })
|
|
3886
|
+
] }),
|
|
3887
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: "sg-cp-cats", children: bucket.categories.map((category) => /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
|
|
3888
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-dot", "aria-hidden": "true" }),
|
|
3889
|
+
category
|
|
3890
|
+
] }, category)) })
|
|
3891
|
+
] }, bucket.outcome);
|
|
3892
|
+
}) })
|
|
3893
|
+
] });
|
|
3894
|
+
}
|
|
3895
|
+
function CompliancePanel(props) {
|
|
3896
|
+
const [open, setOpen] = react.useState(false);
|
|
3897
|
+
const [tab, setTab] = react.useState("checks");
|
|
3898
|
+
const triggerRef = react.useRef(null);
|
|
3899
|
+
const sheetRef = react.useRef(null);
|
|
3900
|
+
const compliance = props.compliance ?? null;
|
|
3901
|
+
const cv = complianceView(compliance, props.hasQuote ?? true);
|
|
3902
|
+
const allChecks = complianceChecks(compliance, cv);
|
|
3903
|
+
const checks = props.direct ? allChecks.filter((c) => DIRECT_CHECK_IDS.includes(c.id)) : allChecks;
|
|
3904
|
+
const tag = complianceTagOf(compliance);
|
|
3905
|
+
react.useEffect(() => {
|
|
3906
|
+
if (!open) return;
|
|
3907
|
+
sheetRef.current?.focus();
|
|
3908
|
+
const onKey = (e) => {
|
|
3909
|
+
if (e.key === "Escape") {
|
|
3910
|
+
e.stopPropagation();
|
|
3911
|
+
setOpen(false);
|
|
3912
|
+
triggerRef.current?.focus();
|
|
3913
|
+
}
|
|
3914
|
+
};
|
|
3915
|
+
document.addEventListener("keydown", onKey, true);
|
|
3916
|
+
return () => document.removeEventListener("keydown", onKey, true);
|
|
3917
|
+
}, [open]);
|
|
3918
|
+
const close = () => {
|
|
3919
|
+
setOpen(false);
|
|
3920
|
+
triggerRef.current?.focus();
|
|
3921
|
+
};
|
|
3922
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp", "data-tone": cv.tone, children: [
|
|
3923
|
+
open ? null : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3924
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { ref: triggerRef, type: "button", className: "sg-cp-row", "data-tone": cv.tone, onClick: () => setOpen(true), "aria-haspopup": "dialog", children: [
|
|
3925
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-row-main", children: [
|
|
3926
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-row-glyph", children: /* @__PURE__ */ jsxRuntime.jsx(TriggerGlyph, { cv }) }),
|
|
3927
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-row-label", children: cv.label })
|
|
3928
|
+
] }),
|
|
3929
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-row-chev", children: /* @__PURE__ */ jsxRuntime.jsx(Chevron, {}) })
|
|
3930
|
+
] }),
|
|
3931
|
+
(cv.blocked || cv.needsAction) && tag ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-row-tag sg-mono", children: tag }) : null
|
|
3932
|
+
] }),
|
|
3933
|
+
open ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-sheet", role: "dialog", "aria-modal": "true", "aria-label": "Compliance details", ref: sheetRef, tabIndex: -1, children: [
|
|
3934
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-sheet-head", children: [
|
|
3935
|
+
/* @__PURE__ */ jsxRuntime.jsx("h4", { className: "sg-cp-sheet-title", children: "Compliance details" }),
|
|
3936
|
+
/* @__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" }) }) })
|
|
3937
|
+
] }),
|
|
3938
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-tabs", role: "tablist", "aria-label": "Compliance details sections", children: [
|
|
3939
|
+
/* @__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" }),
|
|
3940
|
+
/* @__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" })
|
|
3941
|
+
] }),
|
|
3942
|
+
/* @__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 }) })
|
|
3943
|
+
] }) : null
|
|
3944
|
+
] });
|
|
3945
|
+
}
|
|
2873
3946
|
|
|
2874
3947
|
// src/react/ui/chain-logos.ts
|
|
2875
3948
|
var BUNDLED_CHAIN_LOGO = {
|
|
@@ -2889,7 +3962,19 @@ var BUNDLED_TOKEN_LOGO = {
|
|
|
2889
3962
|
USDC: "https://coin-images.coingecko.com/coins/images/6319/large/USDC.png",
|
|
2890
3963
|
USDT: "https://coin-images.coingecko.com/coins/images/325/large/Tether.png",
|
|
2891
3964
|
USDE: "https://coin-images.coingecko.com/coins/images/33613/large/usde.png",
|
|
2892
|
-
XAUT: "https://coin-images.coingecko.com/coins/images/10481/large/Tether_Gold.png"
|
|
3965
|
+
XAUT: "https://coin-images.coingecko.com/coins/images/10481/large/Tether_Gold.png",
|
|
3966
|
+
// 2026-09-08, with the dapp-parity asset expansion — the same four URLs the dapp draws
|
|
3967
|
+
// (zd-dapp/src/lib/tokenLogos.ts), so the two products show one picture per coin.
|
|
3968
|
+
USDTB: "https://coin-images.coingecko.com/coins/images/52804/large/76357aa8-4ef7-446c-bad3-a3f944eeec7a.jpeg",
|
|
3969
|
+
AUSD: "https://coin-images.coingecko.com/coins/images/39284/large/AUSD_1024px.png",
|
|
3970
|
+
PYUSD: "https://coin-images.coingecko.com/coins/images/31212/large/PYUSD_Token_Logo_2x.png",
|
|
3971
|
+
USDG: "https://coin-images.coingecko.com/coins/images/51281/large/GDN_USDG_Token_200x200.png",
|
|
3972
|
+
// The wider stable list, added 2026-09-08 with the RWA exchange.
|
|
3973
|
+
DAI: "https://coin-images.coingecko.com/coins/images/9956/large/Badge_Dai.png",
|
|
3974
|
+
USDS: "https://coin-images.coingecko.com/coins/images/39926/large/usds.webp",
|
|
3975
|
+
RLUSD: "https://coin-images.coingecko.com/coins/images/39651/large/RLUSD_200x200_%281%29.png",
|
|
3976
|
+
USD1: "https://coin-images.coingecko.com/coins/images/54977/large/USD1_1000x1000_transparent.png",
|
|
3977
|
+
WM: "https://coin-images.coingecko.com/coins/images/50789/large/M.png"
|
|
2893
3978
|
};
|
|
2894
3979
|
function isHttpsUrl(u) {
|
|
2895
3980
|
return typeof u === "string" && /^https:\/\//i.test(u);
|
|
@@ -2919,12 +4004,18 @@ var CHAIN_SHORT = {
|
|
|
2919
4004
|
42161: "ARB",
|
|
2920
4005
|
98866: "PLM"
|
|
2921
4006
|
};
|
|
4007
|
+
function chainBadge(chainId) {
|
|
4008
|
+
const pinned = CHAIN_SHORT[Number(chainId)];
|
|
4009
|
+
if (pinned) return pinned;
|
|
4010
|
+
const name = CHAIN_LABELS[Number(chainId)];
|
|
4011
|
+
return name ? name.replace(/[^A-Za-z]/g, "").slice(0, 3).toUpperCase() : "?";
|
|
4012
|
+
}
|
|
2922
4013
|
function TokenGlyph(props) {
|
|
2923
4014
|
const [failed, setFailed] = react.useState([]);
|
|
2924
4015
|
const src = tokenLogoCandidates(props.symbol, props.logoUrl).find((u) => !failed.includes(u));
|
|
2925
4016
|
const mark = props.chainId ? chainLogoCandidates(props.chainId)[0] : void 0;
|
|
2926
4017
|
let badge = null;
|
|
2927
|
-
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:
|
|
4018
|
+
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) });
|
|
2928
4019
|
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-tok", "data-size": props.size === "sm" ? "sm" : void 0, children: [
|
|
2929
4020
|
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) }),
|
|
2930
4021
|
badge
|
|
@@ -2934,17 +4025,18 @@ function ChevronGlyph() {
|
|
|
2934
4025
|
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" }) });
|
|
2935
4026
|
}
|
|
2936
4027
|
function TokenTile(props) {
|
|
4028
|
+
const shown = props.token?.symbol ?? props.pick?.symbol ?? "";
|
|
2937
4029
|
const glyph = props.pick ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2938
4030
|
/* @__PURE__ */ jsxRuntime.jsx(TokenGlyph, { symbol: props.pick.symbol, logoUrl: props.token?.logoUrl, chainId: props.pick.chainId }),
|
|
2939
4031
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: { minWidth: 0 }, children: [
|
|
2940
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-sym", children:
|
|
4032
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-sym", children: shown }),
|
|
2941
4033
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-chain", children: CHAIN_LABELS[props.pick.chainId] || `Chain ${props.pick.chainId}` })
|
|
2942
4034
|
] })
|
|
2943
4035
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2944
4036
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tok", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tok-fb", children: "?" }) }),
|
|
2945
4037
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-empty", children: "Select\u2026" })
|
|
2946
4038
|
] });
|
|
2947
|
-
const ariaLabel = `${props.label}: ${props.pick ? `${
|
|
4039
|
+
const ariaLabel = `${props.label}: ${props.pick ? `${shown} on ${CHAIN_LABELS[props.pick.chainId] || props.pick.chainId}` : "select token"}`;
|
|
2948
4040
|
if (props.row) {
|
|
2949
4041
|
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: [
|
|
2950
4042
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-label", children: props.label }),
|
|
@@ -2985,7 +4077,8 @@ function FundingTile(props) {
|
|
|
2985
4077
|
function ChainChip(props) {
|
|
2986
4078
|
const [failed, setFailed] = react.useState([]);
|
|
2987
4079
|
const src = chainLogoCandidates(props.chain?.chainId, props.chain?.logoUrl).find((u) => !failed.includes(u));
|
|
2988
|
-
|
|
4080
|
+
const name = props.name ?? props.label;
|
|
4081
|
+
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 });
|
|
2989
4082
|
}
|
|
2990
4083
|
function SearchGlyph() {
|
|
2991
4084
|
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: [
|
|
@@ -3006,7 +4099,9 @@ function TokenSelect(props) {
|
|
|
3006
4099
|
const q = query.trim().toLowerCase();
|
|
3007
4100
|
const filtered = props.tokens.filter((t) => chainFilter == null ? true : Number(t.chainId) === chainFilter).filter((t) => {
|
|
3008
4101
|
if (!q) return true;
|
|
3009
|
-
return String(t.symbol || "").toLowerCase().includes(q) || String(t.name || "").toLowerCase().includes(q) || String(t.address || "").toLowerCase().includes(q)
|
|
4102
|
+
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
|
|
4103
|
+
// show a three-letter badge, so "Katana" or "Berachain" has to be findable by typing it.
|
|
4104
|
+
String(CHAIN_LABELS[Number(t.chainId)] || "").toLowerCase().includes(q);
|
|
3010
4105
|
});
|
|
3011
4106
|
if (!props.balances) return filtered;
|
|
3012
4107
|
const balNum = (t) => {
|
|
@@ -3020,13 +4115,14 @@ function TokenSelect(props) {
|
|
|
3020
4115
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-back", onClick: props.onBack, "aria-label": "Back", children: /* @__PURE__ */ jsxRuntime.jsx(BackGlyph, {}) }),
|
|
3021
4116
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-sel-title", children: props.title })
|
|
3022
4117
|
] }),
|
|
3023
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-chain-grid", role: "group", "aria-label": "Filter by chain", children: [
|
|
4118
|
+
/* @__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: [
|
|
3024
4119
|
/* @__PURE__ */ jsxRuntime.jsx(ChainChip, { label: "All", selected: chainFilter == null, onClick: () => setChainFilter(null) }),
|
|
3025
4120
|
props.chains.map((c) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3026
4121
|
ChainChip,
|
|
3027
4122
|
{
|
|
3028
4123
|
chain: c,
|
|
3029
|
-
label:
|
|
4124
|
+
label: chainBadge(Number(c.chainId)),
|
|
4125
|
+
name: CHAIN_LABELS[Number(c.chainId)] || c.displayName || c.name || `Chain ${c.chainId}`,
|
|
3030
4126
|
selected: chainFilter === Number(c.chainId),
|
|
3031
4127
|
onClick: () => setChainFilter(Number(c.chainId))
|
|
3032
4128
|
},
|
|
@@ -3035,7 +4131,7 @@ function TokenSelect(props) {
|
|
|
3035
4131
|
] }),
|
|
3036
4132
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-search", children: [
|
|
3037
4133
|
/* @__PURE__ */ jsxRuntime.jsx(SearchGlyph, {}),
|
|
3038
|
-
/* @__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" })
|
|
4134
|
+
/* @__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" })
|
|
3039
4135
|
] }),
|
|
3040
4136
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-toklist", role: "group", "aria-label": props.title, children: rows.length ? rows.map((t) => {
|
|
3041
4137
|
const chainId = Number(t.chainId);
|
|
@@ -3067,7 +4163,7 @@ function TokenSelect(props) {
|
|
|
3067
4163
|
},
|
|
3068
4164
|
`${chainId}:${t.address}`
|
|
3069
4165
|
);
|
|
3070
|
-
}) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-sel-empty", children: "No tokens match \u2014 try another chain or search." }) })
|
|
4166
|
+
}) : 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." }) })
|
|
3071
4167
|
] });
|
|
3072
4168
|
}
|
|
3073
4169
|
function useTxHistory(account) {
|
|
@@ -3213,7 +4309,7 @@ function TxDetail(props) {
|
|
|
3213
4309
|
] }),
|
|
3214
4310
|
e.recipient ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
|
|
3215
4311
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Recipient" }),
|
|
3216
|
-
/* @__PURE__ */ jsxRuntime.jsx("b", { className: "sg-mono", children:
|
|
4312
|
+
/* @__PURE__ */ jsxRuntime.jsx("b", { className: "sg-mono", children: shortAddress2(e.recipient) })
|
|
3217
4313
|
] }) : null,
|
|
3218
4314
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
|
|
3219
4315
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Settlement" }),
|
|
@@ -3308,7 +4404,7 @@ function forgetIdentity(account) {
|
|
|
3308
4404
|
}
|
|
3309
4405
|
var addrEq = (a, b) => String(a || "").toLowerCase() === String(b || "").toLowerCase();
|
|
3310
4406
|
var chainName = (id) => id != null ? CHAIN_LABELS[id] || `Chain ${id}` : "";
|
|
3311
|
-
var STABLES =
|
|
4407
|
+
var STABLES = EXECUTABLE_STABLE_ASSETS;
|
|
3312
4408
|
function BankGlyph() {
|
|
3313
4409
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3314
4410
|
"svg",
|
|
@@ -3527,7 +4623,7 @@ function IdentityLine(props) {
|
|
|
3527
4623
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-link-id", children: [
|
|
3528
4624
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-id-icon", children: /* @__PURE__ */ jsxRuntime.jsx(WalletGlyph, {}) }),
|
|
3529
4625
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-link-id-text", children: [
|
|
3530
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-id-primary", children: props.account ?
|
|
4626
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-id-primary", children: props.account ? shortAddress2(props.account) : "ZeroDelta Link" }),
|
|
3531
4627
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-id-secondary", children: props.email ? props.email : props.account ? "Connected wallet" : "Connect your wallet to continue" })
|
|
3532
4628
|
] }),
|
|
3533
4629
|
props.account ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-wallet-dot", "aria-hidden": "true" }) : null
|
|
@@ -3549,19 +4645,17 @@ function PaymentIsland(props) {
|
|
|
3549
4645
|
const mode = props.mode ?? "exchange";
|
|
3550
4646
|
const rampMode = kind === "exchange" && mode !== "exchange";
|
|
3551
4647
|
const bankSettlement = isPay && props.settlement === "bank";
|
|
3552
|
-
const
|
|
3553
|
-
|
|
3554
|
-
[props.assets]
|
|
3555
|
-
);
|
|
4648
|
+
const exProduct = props.product ?? "stable";
|
|
4649
|
+
const exAllowed = react.useMemo(() => props.assets?.length ? props.assets.map((a) => symbolKey(a)) : void 0, [props.assets]);
|
|
3556
4650
|
const [exFrom, setExFrom] = react.useState(() => {
|
|
3557
4651
|
const chainId = props.defaultFromChainId ?? (kind === "swap" ? 42161 : void 0);
|
|
3558
4652
|
const asset = props.defaultFromAsset ?? (kind === "swap" ? "USDT" : void 0);
|
|
3559
|
-
return chainId && asset
|
|
4653
|
+
return chainId && asset ? { chainId, symbol: symbolKey(asset) } : null;
|
|
3560
4654
|
});
|
|
3561
4655
|
const [exTo, setExTo] = react.useState(() => {
|
|
3562
4656
|
const chainId = props.defaultToChainId ?? (kind === "swap" ? 8453 : void 0);
|
|
3563
4657
|
const asset = props.defaultToAsset ?? (kind === "swap" ? "USDC" : void 0);
|
|
3564
|
-
return chainId && asset
|
|
4658
|
+
return chainId && asset ? { chainId, symbol: symbolKey(asset) } : null;
|
|
3565
4659
|
});
|
|
3566
4660
|
const [exAmount, setExAmount] = react.useState(props.defaultAmount ?? "");
|
|
3567
4661
|
const exFromChainId = exFrom?.chainId;
|
|
@@ -3654,27 +4748,24 @@ function PaymentIsland(props) {
|
|
|
3654
4748
|
}
|
|
3655
4749
|
return map;
|
|
3656
4750
|
}, [annotated, holdings.loading]);
|
|
3657
|
-
const [
|
|
3658
|
-
const [registryTokens, setRegistryTokens] = react.useState([]);
|
|
4751
|
+
const [catalogue, setCatalogue] = react.useState(null);
|
|
3659
4752
|
react.useEffect(() => {
|
|
3660
4753
|
if (bankSettlement || !isPay && rampMode) return;
|
|
3661
4754
|
let alive = true;
|
|
3662
|
-
|
|
3663
|
-
if (
|
|
3664
|
-
const order = new Map(SUPPORTED_CHAINS.map((id, i) => [id, i]));
|
|
3665
|
-
setChains(
|
|
3666
|
-
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))
|
|
3667
|
-
);
|
|
3668
|
-
setRegistryTokens(ts.filter((t) => tokenEnabled(t) && SUPPORTED_CHAIN_IDS.has(Number(t.chainId))));
|
|
4755
|
+
engine.fetchCatalogue(isPay ? void 0 : exAllowed, isPay ? "stable" : exProduct).then((next) => {
|
|
4756
|
+
if (alive) setCatalogue(next);
|
|
3669
4757
|
});
|
|
3670
4758
|
return () => {
|
|
3671
4759
|
alive = false;
|
|
3672
4760
|
};
|
|
3673
|
-
}, [engine, isPay, rampMode, bankSettlement]);
|
|
3674
|
-
const
|
|
3675
|
-
|
|
3676
|
-
[
|
|
3677
|
-
);
|
|
4761
|
+
}, [engine, isPay, rampMode, bankSettlement, exAllowed, exProduct]);
|
|
4762
|
+
const chains = react.useMemo(() => {
|
|
4763
|
+
const order = new Map(SUPPORTED_CHAINS.map((id, i) => [id, i]));
|
|
4764
|
+
return [...catalogue?.chains ?? []].sort((a, b) => (order.get(Number(a.chainId)) ?? 99) - (order.get(Number(b.chainId)) ?? 99) || Number(a.chainId) - Number(b.chainId));
|
|
4765
|
+
}, [catalogue]);
|
|
4766
|
+
const registryTokens = react.useMemo(() => catalogue?.tokens ?? [], [catalogue]);
|
|
4767
|
+
const exchangeTokens = react.useMemo(() => isPay ? [] : registryTokens, [isPay, registryTokens]);
|
|
4768
|
+
const exSourceTokens = react.useMemo(() => isPay ? [] : catalogue?.sources ?? [], [isPay, catalogue]);
|
|
3678
4769
|
const [exBalances, setExBalances] = react.useState({});
|
|
3679
4770
|
const exBalReq = react.useRef(0);
|
|
3680
4771
|
react.useEffect(() => {
|
|
@@ -3696,6 +4787,39 @@ function PaymentIsland(props) {
|
|
|
3696
4787
|
}, [engine, isPay, wallet.account, exchangeTokens]);
|
|
3697
4788
|
const exFromToken = react.useMemo(() => exFrom ? findToken(exchangeTokens, exFrom.chainId, exFrom.symbol) : null, [exchangeTokens, exFrom]);
|
|
3698
4789
|
const exToToken = react.useMemo(() => exTo ? findToken(exchangeTokens, exTo.chainId, exTo.symbol) : null, [exchangeTokens, exTo]);
|
|
4790
|
+
const exFromPicker = react.useMemo(() => exProduct === "rwa" ? counterpartTokens(exSourceTokens, exToToken) : exSourceTokens, [exProduct, exSourceTokens, exToToken]);
|
|
4791
|
+
const exToPicker = react.useMemo(() => exProduct === "rwa" ? counterpartTokens(exchangeTokens, exFromToken) : exchangeTokens, [exProduct, exchangeTokens, exFromToken]);
|
|
4792
|
+
const exRwaSeeded = react.useRef(false);
|
|
4793
|
+
react.useEffect(() => {
|
|
4794
|
+
if (isPay || exProduct !== "rwa" || exRwaSeeded.current) return;
|
|
4795
|
+
if (props.defaultFromAsset || props.defaultToAsset || !catalogue?.ready) return;
|
|
4796
|
+
const stable = exSourceTokens.find((t) => Number(t.chainId) === 42161 && symbolKey(t.symbol) === "USDC") ?? exSourceTokens.find((t) => assetClassOf(t.symbol) === "stable");
|
|
4797
|
+
const rwa = exchangeTokens.find((t) => assetClassOf(t.symbol) === "rwa");
|
|
4798
|
+
if (!stable || !rwa) return;
|
|
4799
|
+
exRwaSeeded.current = true;
|
|
4800
|
+
setExFrom({ chainId: Number(stable.chainId), symbol: symbolKey(stable.symbol) });
|
|
4801
|
+
setExTo({ chainId: Number(rwa.chainId), symbol: symbolKey(rwa.symbol) });
|
|
4802
|
+
}, [isPay, exProduct, catalogue, exSourceTokens, exchangeTokens, props.defaultFromAsset, props.defaultToAsset]);
|
|
4803
|
+
const exDestinationStates = react.useMemo(() => {
|
|
4804
|
+
if (!catalogue?.ready) return void 0;
|
|
4805
|
+
const states = {};
|
|
4806
|
+
for (const token of catalogue.tokens) {
|
|
4807
|
+
const key = balanceKey(Number(token.chainId), token.address);
|
|
4808
|
+
const measured = exFromToken ? brokenLaneFor(token, exFromToken, catalogue.brokenLanes) : void 0;
|
|
4809
|
+
if (measured) {
|
|
4810
|
+
states[key] = { disabled: true, reason: brokenLaneReason(measured), hint: "Unavailable" };
|
|
4811
|
+
continue;
|
|
4812
|
+
}
|
|
4813
|
+
const verdict = destinationAvailability(token, catalogue, exFromToken);
|
|
4814
|
+
if (verdict === "available") continue;
|
|
4815
|
+
states[key] = {
|
|
4816
|
+
disabled: true,
|
|
4817
|
+
reason: verdict === "hub-only" ? `${token.symbol} cannot be delivered on this chain.` : "ZeroDelta cannot deliver this asset here.",
|
|
4818
|
+
hint: verdict === "hub-only" ? "Not here" : "Unavailable"
|
|
4819
|
+
};
|
|
4820
|
+
}
|
|
4821
|
+
return states;
|
|
4822
|
+
}, [catalogue, exFromToken]);
|
|
3699
4823
|
const exFromBal = exFrom && exFromToken ? exBalances[balanceKey(exFrom.chainId, exFromToken.address)] : void 0;
|
|
3700
4824
|
const fundingTokens = react.useMemo(() => {
|
|
3701
4825
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -3943,8 +5067,10 @@ function PaymentIsland(props) {
|
|
|
3943
5067
|
{
|
|
3944
5068
|
title: isFrom ? "Exchange from" : "Exchange to",
|
|
3945
5069
|
chains,
|
|
3946
|
-
tokens:
|
|
5070
|
+
tokens: isFrom ? exFromPicker : exToPicker,
|
|
3947
5071
|
balances: exBalances,
|
|
5072
|
+
optionStates: isFrom ? void 0 : exDestinationStates,
|
|
5073
|
+
loading: !catalogue?.ready,
|
|
3948
5074
|
onBack: () => closeSelector(openerRef),
|
|
3949
5075
|
onPick: (pick) => {
|
|
3950
5076
|
(isFrom ? setExFrom : setExTo)({ chainId: pick.chainId, symbol: symbolKey(pick.symbol) });
|
|
@@ -4002,7 +5128,7 @@ function PaymentIsland(props) {
|
|
|
4002
5128
|
] }),
|
|
4003
5129
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-receipt-sub", children: [
|
|
4004
5130
|
confirmed ? "Confirmed on-chain" : "Confirmation pending",
|
|
4005
|
-
isPay && props.recipient ? ` \xB7 ${
|
|
5131
|
+
isPay && props.recipient ? ` \xB7 ${shortAddress2(props.recipient)}` : ""
|
|
4006
5132
|
] })
|
|
4007
5133
|
] }),
|
|
4008
5134
|
!identityMatchesWallet ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-remember", children: [
|
|
@@ -4114,6 +5240,7 @@ function PaymentIsland(props) {
|
|
|
4114
5240
|
chainName(sel.source.chainId)
|
|
4115
5241
|
] })
|
|
4116
5242
|
] }) : null,
|
|
5243
|
+
sel && !loading && !quoteError ? /* @__PURE__ */ jsxRuntime.jsx(CompliancePanel, { compliance: sel.quote.compliance, direct: sel.state === "DIRECT" }) : null,
|
|
4117
5244
|
quoteError ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: flow.error || "Couldn't get a price right now." }) : null,
|
|
4118
5245
|
walletError ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: flow.error || "The wallet could not complete this payment." }) : null,
|
|
4119
5246
|
submitting || walletError ? /* @__PURE__ */ jsxRuntime.jsx(StepList, { variant: "rich", steps: flow.steps, verdict: flow.verdict }) : null,
|
|
@@ -4162,8 +5289,8 @@ function PaymentIsland(props) {
|
|
|
4162
5289
|
) }) })
|
|
4163
5290
|
] }) });
|
|
4164
5291
|
}
|
|
4165
|
-
var STABLES2 =
|
|
4166
|
-
var DEFAULT_FUNDING_ASSETS = [
|
|
5292
|
+
var STABLES2 = EXECUTABLE_STABLE_ASSETS;
|
|
5293
|
+
var DEFAULT_FUNDING_ASSETS = [...EXECUTABLE_STABLE_ASSETS];
|
|
4167
5294
|
function CheckGlyph3() {
|
|
4168
5295
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4169
5296
|
"svg",
|
|
@@ -4268,23 +5395,22 @@ function StableGeniePay(props) {
|
|
|
4268
5395
|
}
|
|
4269
5396
|
return map;
|
|
4270
5397
|
}, [annotated, holdings.loading]);
|
|
4271
|
-
const [
|
|
4272
|
-
const
|
|
5398
|
+
const [catalogue, setCatalogue] = react.useState(null);
|
|
5399
|
+
const chains = react.useMemo(() => {
|
|
5400
|
+
const order = new Map(SUPPORTED_CHAINS.map((id, i) => [id, i]));
|
|
5401
|
+
return [...catalogue?.chains ?? []].sort((a, b) => (order.get(Number(a.chainId)) ?? 99) - (order.get(Number(b.chainId)) ?? 99) || Number(a.chainId) - Number(b.chainId));
|
|
5402
|
+
}, [catalogue]);
|
|
5403
|
+
const registryTokens = react.useMemo(() => catalogue?.tokens ?? [], [catalogue]);
|
|
4273
5404
|
react.useEffect(() => {
|
|
4274
5405
|
if (props.variant === "pill") return;
|
|
4275
5406
|
let alive = true;
|
|
4276
|
-
|
|
4277
|
-
if (
|
|
4278
|
-
const order = new Map(SUPPORTED_CHAINS.map((id, i) => [id, i]));
|
|
4279
|
-
setChains(
|
|
4280
|
-
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))
|
|
4281
|
-
);
|
|
4282
|
-
setRegistryTokens(ts.filter((t) => tokenEnabled(t) && SUPPORTED_CHAIN_IDS.has(Number(t.chainId))));
|
|
5407
|
+
engine.fetchCatalogue().then((next) => {
|
|
5408
|
+
if (alive) setCatalogue(next);
|
|
4283
5409
|
});
|
|
4284
5410
|
return () => {
|
|
4285
5411
|
alive = false;
|
|
4286
5412
|
};
|
|
4287
|
-
}, [engine]);
|
|
5413
|
+
}, [engine, props.variant]);
|
|
4288
5414
|
const fundingTokens = react.useMemo(() => {
|
|
4289
5415
|
const seen = /* @__PURE__ */ new Set();
|
|
4290
5416
|
const list = [];
|
|
@@ -4408,7 +5534,7 @@ function StableGeniePay(props) {
|
|
|
4408
5534
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
|
|
4409
5535
|
flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
|
|
4410
5536
|
" \xB7 ",
|
|
4411
|
-
|
|
5537
|
+
shortAddress2(props.recipient)
|
|
4412
5538
|
] })
|
|
4413
5539
|
] }),
|
|
4414
5540
|
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
|
|
@@ -4451,6 +5577,7 @@ function StableGeniePay(props) {
|
|
|
4451
5577
|
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,
|
|
4452
5578
|
flow.status === "ready" && !visibleRoutes.length ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { children: "No funding route matches the accepted assets for this payment." }) : null
|
|
4453
5579
|
] }),
|
|
5580
|
+
sel && flow.status !== "loading" ? /* @__PURE__ */ jsxRuntime.jsx(CompliancePanel, { compliance: sel.quote.compliance, direct: sel.state === "DIRECT" }) : null,
|
|
4454
5581
|
submitting ? /* @__PURE__ */ jsxRuntime.jsx(StepList, { steps: flow.steps }) : null,
|
|
4455
5582
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4456
5583
|
Button,
|
|
@@ -4463,8 +5590,8 @@ function StableGeniePay(props) {
|
|
|
4463
5590
|
) })
|
|
4464
5591
|
] }) }) });
|
|
4465
5592
|
}
|
|
4466
|
-
var
|
|
4467
|
-
var
|
|
5593
|
+
var sourceChainOptions = SUPPORTED_CHAINS.map((c) => ({ value: c, label: CHAIN_LABELS[c] || `Chain ${c}` }));
|
|
5594
|
+
var bundledAssetOptions = SUPPORTED_ASSETS2.map((a) => ({ value: a, label: a }));
|
|
4468
5595
|
function CheckGlyph4() {
|
|
4469
5596
|
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" }) });
|
|
4470
5597
|
}
|
|
@@ -4477,6 +5604,33 @@ function StableGenieSwap(props) {
|
|
|
4477
5604
|
const [toChainId, setToChainId] = react.useState(props.defaultToChainId ?? 8453);
|
|
4478
5605
|
const [toAsset, setToAsset] = react.useState(props.defaultToAsset ?? "USDC");
|
|
4479
5606
|
const [amount, setAmount] = react.useState(props.defaultAmount ?? "");
|
|
5607
|
+
const [catalogue, setCatalogue] = react.useState(null);
|
|
5608
|
+
react.useEffect(() => {
|
|
5609
|
+
if (props.variant === "pill") return;
|
|
5610
|
+
let alive = true;
|
|
5611
|
+
engine.fetchCatalogue().then((next) => {
|
|
5612
|
+
if (alive && next.ready) setCatalogue(next);
|
|
5613
|
+
});
|
|
5614
|
+
return () => {
|
|
5615
|
+
alive = false;
|
|
5616
|
+
};
|
|
5617
|
+
}, [engine, props.variant]);
|
|
5618
|
+
const assetOptions = react.useMemo(() => {
|
|
5619
|
+
if (!catalogue) return bundledAssetOptions;
|
|
5620
|
+
const symbols = [...new Set(catalogue.tokens.map((t) => t.symbol.toUpperCase()))];
|
|
5621
|
+
const ordered = [...SUPPORTED_ASSETS2.filter((a) => symbols.includes(a)), ...symbols.filter((s) => !SUPPORTED_ASSETS2.includes(s))];
|
|
5622
|
+
return ordered.length ? ordered.map((a) => ({ value: a, label: a })) : bundledAssetOptions;
|
|
5623
|
+
}, [catalogue]);
|
|
5624
|
+
const toChainOptions = react.useMemo(() => {
|
|
5625
|
+
if (!catalogue) return sourceChainOptions;
|
|
5626
|
+
const ids = [...catalogue.chainIds].sort((a, b) => {
|
|
5627
|
+
const ai = SUPPORTED_CHAINS.indexOf(a);
|
|
5628
|
+
const bi = SUPPORTED_CHAINS.indexOf(b);
|
|
5629
|
+
if (ai !== bi) return (ai < 0 ? 999 : ai) - (bi < 0 ? 999 : bi);
|
|
5630
|
+
return a - b;
|
|
5631
|
+
});
|
|
5632
|
+
return ids.map((c) => ({ value: c, label: CHAIN_LABELS[c] || `Chain ${c}` }));
|
|
5633
|
+
}, [catalogue]);
|
|
4480
5634
|
const amountValid = /^\d+(\.\d+)?$/.test(amount.replace(",", ".")) && Number(amount.replace(",", ".")) > 0;
|
|
4481
5635
|
const enabled = amountValid && props.variant !== "pill";
|
|
4482
5636
|
const paramsKey = `${fromChainId}|${fromAsset}|${toChainId}|${toAsset}|${amount}|${props.recipient ?? ""}`;
|
|
@@ -4541,7 +5695,7 @@ function StableGenieSwap(props) {
|
|
|
4541
5695
|
] }),
|
|
4542
5696
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
|
|
4543
5697
|
flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
|
|
4544
|
-
props.recipient ? ` \xB7 ${
|
|
5698
|
+
props.recipient ? ` \xB7 ${shortAddress2(props.recipient)}` : ""
|
|
4545
5699
|
] })
|
|
4546
5700
|
] }),
|
|
4547
5701
|
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
|
|
@@ -4553,7 +5707,7 @@ function StableGenieSwap(props) {
|
|
|
4553
5707
|
/* @__PURE__ */ jsxRuntime.jsx(AmountInput, { value: amount, onChange: setAmount, disabled: submitting }),
|
|
4554
5708
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-row", style: { marginTop: 8 }, children: [
|
|
4555
5709
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-grow", children: /* @__PURE__ */ jsxRuntime.jsx(Select, { value: fromAsset, onChange: setFromAsset, options: assetOptions, disabled: submitting }) }),
|
|
4556
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-grow", children: /* @__PURE__ */ jsxRuntime.jsx(Select, { value: fromChainId, onChange: (v) => setFromChainId(Number(v)), options:
|
|
5710
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-grow", children: /* @__PURE__ */ jsxRuntime.jsx(Select, { value: fromChainId, onChange: (v) => setFromChainId(Number(v)), options: sourceChainOptions, disabled: submitting }) })
|
|
4557
5711
|
] })
|
|
4558
5712
|
] }),
|
|
4559
5713
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-reverse", onClick: reverse, "aria-label": "Reverse", disabled: submitting, children: "\u2193" }),
|
|
@@ -4562,11 +5716,12 @@ function StableGenieSwap(props) {
|
|
|
4562
5716
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-anchor sg-mono", children: toValue }),
|
|
4563
5717
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-row", style: { marginTop: 8 }, children: [
|
|
4564
5718
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-grow", children: /* @__PURE__ */ jsxRuntime.jsx(Select, { value: toAsset, onChange: setToAsset, options: assetOptions, disabled: submitting }) }),
|
|
4565
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-grow", children: /* @__PURE__ */ jsxRuntime.jsx(Select, { value: toChainId, onChange: (v) => setToChainId(Number(v)), options:
|
|
5719
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-grow", children: /* @__PURE__ */ jsxRuntime.jsx(Select, { value: toChainId, onChange: (v) => setToChainId(Number(v)), options: toChainOptions, disabled: submitting }) })
|
|
4566
5720
|
] })
|
|
4567
5721
|
] }),
|
|
4568
5722
|
flow.status === "error" && flow.error ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: flow.error }) : null,
|
|
4569
5723
|
flow.routes.length ? /* @__PURE__ */ jsxRuntime.jsx(RouteList, { routes: flow.routes, selectedId: flow.selected?.id ?? null, onSelect: flow.selectRoute }) : null,
|
|
5724
|
+
flow.selected && flow.status !== "loading" ? /* @__PURE__ */ jsxRuntime.jsx(CompliancePanel, { compliance: flow.selected.quote.compliance, direct: flow.selected.state === "DIRECT" }) : null,
|
|
4570
5725
|
submitting ? /* @__PURE__ */ jsxRuntime.jsx(StepList, { steps: flow.steps }) : null,
|
|
4571
5726
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
|
|
4572
5727
|
!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 }),
|
|
@@ -4574,7 +5729,6 @@ function StableGenieSwap(props) {
|
|
|
4574
5729
|
] })
|
|
4575
5730
|
] });
|
|
4576
5731
|
}
|
|
4577
|
-
var STABLE_ASSETS = ["USDC", "USDT", "USDE"];
|
|
4578
5732
|
var FIAT = [
|
|
4579
5733
|
{ code: "USD", glyph: "$", label: "US Dollar" },
|
|
4580
5734
|
{ code: "EUR", glyph: "\u20AC", label: "Euro" },
|
|
@@ -4617,24 +5771,25 @@ function StableGenieExchange(props) {
|
|
|
4617
5771
|
const mode = props.mode ?? "exchange";
|
|
4618
5772
|
const wide = props.variant === "wide";
|
|
4619
5773
|
const isPill = props.variant === "pill";
|
|
4620
|
-
const
|
|
4621
|
-
const
|
|
4622
|
-
const [
|
|
5774
|
+
const product = props.product ?? "stable";
|
|
5775
|
+
const allowed = react.useMemo(() => props.assets?.length ? props.assets.map((a) => symbolKey(a)) : void 0, [props.assets]);
|
|
5776
|
+
const [catalogue, setCatalogue] = react.useState(null);
|
|
4623
5777
|
react.useEffect(() => {
|
|
4624
5778
|
if (isPill) return;
|
|
4625
5779
|
let alive = true;
|
|
4626
|
-
|
|
4627
|
-
if (
|
|
4628
|
-
const order = new Map(SUPPORTED_CHAINS.map((id, i) => [id, i]));
|
|
4629
|
-
setChains(
|
|
4630
|
-
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))
|
|
4631
|
-
);
|
|
4632
|
-
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))));
|
|
5780
|
+
engine.fetchCatalogue(allowed, product).then((next) => {
|
|
5781
|
+
if (alive) setCatalogue(next);
|
|
4633
5782
|
});
|
|
4634
5783
|
return () => {
|
|
4635
5784
|
alive = false;
|
|
4636
5785
|
};
|
|
4637
|
-
}, [engine, allowed]);
|
|
5786
|
+
}, [engine, allowed, product, isPill]);
|
|
5787
|
+
const chains = react.useMemo(() => {
|
|
5788
|
+
const order = new Map(SUPPORTED_CHAINS.map((id, i) => [id, i]));
|
|
5789
|
+
return [...catalogue?.chains ?? []].sort((a, b) => (order.get(Number(a.chainId)) ?? 99) - (order.get(Number(b.chainId)) ?? 99) || Number(a.chainId) - Number(b.chainId));
|
|
5790
|
+
}, [catalogue]);
|
|
5791
|
+
const tokens = react.useMemo(() => catalogue?.tokens ?? [], [catalogue]);
|
|
5792
|
+
const sourceTokens = react.useMemo(() => catalogue?.sources ?? [], [catalogue]);
|
|
4638
5793
|
const [view, setView] = react.useState("main");
|
|
4639
5794
|
const [hist, setHist] = react.useState(null);
|
|
4640
5795
|
const histBtnRef = react.useRef(null);
|
|
@@ -4644,19 +5799,53 @@ function StableGenieExchange(props) {
|
|
|
4644
5799
|
};
|
|
4645
5800
|
react.useEffect(() => setHist(null), [wallet.account]);
|
|
4646
5801
|
const [from, setFrom] = react.useState(
|
|
4647
|
-
() => props.defaultFromChainId && props.defaultFromAsset
|
|
5802
|
+
() => props.defaultFromChainId && props.defaultFromAsset ? { chainId: props.defaultFromChainId, symbol: symbolKey(props.defaultFromAsset) } : null
|
|
4648
5803
|
);
|
|
4649
5804
|
const [to, setTo] = react.useState(
|
|
4650
|
-
() => props.defaultToChainId && props.defaultToAsset
|
|
5805
|
+
() => props.defaultToChainId && props.defaultToAsset ? { chainId: props.defaultToChainId, symbol: symbolKey(props.defaultToAsset) } : null
|
|
4651
5806
|
);
|
|
4652
5807
|
const [amount, setAmount] = react.useState(props.defaultAmount ?? "");
|
|
4653
5808
|
const [fiatCurrency, setFiatCurrency] = react.useState(props.fiatCurrency ?? "EUR");
|
|
4654
5809
|
const fromToken = react.useMemo(() => from ? findToken(tokens, from.chainId, from.symbol) : null, [tokens, from]);
|
|
4655
5810
|
const toToken = react.useMemo(() => to ? findToken(tokens, to.chainId, to.symbol) : null, [tokens, to]);
|
|
5811
|
+
const toSymbol = toToken?.symbol ?? to?.symbol ?? "";
|
|
5812
|
+
const fromPickerTokens = react.useMemo(() => product === "rwa" ? counterpartTokens(sourceTokens, toToken) : sourceTokens, [product, sourceTokens, toToken]);
|
|
5813
|
+
const toPickerTokens = react.useMemo(() => product === "rwa" ? counterpartTokens(tokens, fromToken) : tokens, [product, tokens, fromToken]);
|
|
5814
|
+
const rwaSeeded = react.useRef(false);
|
|
5815
|
+
react.useEffect(() => {
|
|
5816
|
+
if (product !== "rwa" || rwaSeeded.current) return;
|
|
5817
|
+
if (props.defaultFromAsset || props.defaultToAsset || !catalogue?.ready) return;
|
|
5818
|
+
const stable = sourceTokens.find((t) => Number(t.chainId) === 42161 && symbolKey(t.symbol) === "USDC") ?? sourceTokens.find((t) => assetClassOf(t.symbol) === "stable");
|
|
5819
|
+
const rwa = tokens.find((t) => assetClassOf(t.symbol) === "rwa");
|
|
5820
|
+
if (!stable || !rwa) return;
|
|
5821
|
+
rwaSeeded.current = true;
|
|
5822
|
+
setFrom({ chainId: Number(stable.chainId), symbol: symbolKey(stable.symbol) });
|
|
5823
|
+
setTo({ chainId: Number(rwa.chainId), symbol: symbolKey(rwa.symbol) });
|
|
5824
|
+
}, [product, catalogue, sourceTokens, tokens, props.defaultFromAsset, props.defaultToAsset]);
|
|
5825
|
+
const destinationStates = react.useMemo(() => {
|
|
5826
|
+
if (!catalogue?.ready) return void 0;
|
|
5827
|
+
const states = {};
|
|
5828
|
+
for (const token of catalogue.tokens) {
|
|
5829
|
+
const key = `${Number(token.chainId)}:${String(token.address || "").toLowerCase()}`;
|
|
5830
|
+
const measured = fromToken ? brokenLaneFor(token, fromToken, catalogue.brokenLanes) : void 0;
|
|
5831
|
+
if (measured) {
|
|
5832
|
+
states[key] = { disabled: true, reason: brokenLaneReason(measured), hint: "Unavailable" };
|
|
5833
|
+
continue;
|
|
5834
|
+
}
|
|
5835
|
+
const verdict = destinationAvailability(token, catalogue, fromToken);
|
|
5836
|
+
if (verdict === "available") continue;
|
|
5837
|
+
states[key] = {
|
|
5838
|
+
disabled: true,
|
|
5839
|
+
reason: verdict === "hub-only" ? `${token.symbol} cannot be delivered on this chain \u2014 choose an execution chain.` : "ZeroDelta cannot deliver this asset here.",
|
|
5840
|
+
hint: verdict === "hub-only" ? "Not here" : "Unavailable"
|
|
5841
|
+
};
|
|
5842
|
+
}
|
|
5843
|
+
return states;
|
|
5844
|
+
}, [catalogue, fromToken]);
|
|
4656
5845
|
const normalizedAmount = normalizeDecimalText(amount);
|
|
4657
5846
|
const amountValid = /^\d+(\.\d+)?$/.test(normalizedAmount) && Number(normalizedAmount) > 0 && Number(normalizedAmount) <= 1e9;
|
|
4658
5847
|
const rampMode = mode !== "exchange";
|
|
4659
|
-
const inUniverse = (p) => Boolean(p &&
|
|
5848
|
+
const inUniverse = (p) => Boolean(p && tokens.some((t) => Number(t.chainId) === p.chainId && symbolKey(t.symbol) === p.symbol));
|
|
4660
5849
|
const cryptoReady = rampMode ? inUniverse(mode === "onramp" ? to : from) : inUniverse(from) && inUniverse(to);
|
|
4661
5850
|
const quotable = mode === "exchange" && inUniverse(from) && inUniverse(to) && amountValid;
|
|
4662
5851
|
const [balances, setBalances] = react.useState({});
|
|
@@ -4679,7 +5868,7 @@ function StableGenieExchange(props) {
|
|
|
4679
5868
|
});
|
|
4680
5869
|
}, [engine, wallet.account, tokens]);
|
|
4681
5870
|
const fromBal = from && fromToken ? balances[balanceKey(from.chainId, fromToken.address)] : void 0;
|
|
4682
|
-
const paramsKey = `${mode}|${from?.chainId}|${from?.symbol}|${to?.chainId}|${
|
|
5871
|
+
const paramsKey = `${mode}|${from?.chainId}|${from?.symbol}|${to?.chainId}|${toSymbol}|${normalizedAmount}|${props.recipient ?? ""}`;
|
|
4683
5872
|
const flow = useFlow({
|
|
4684
5873
|
engine,
|
|
4685
5874
|
wallet,
|
|
@@ -4731,7 +5920,7 @@ function StableGenieExchange(props) {
|
|
|
4731
5920
|
/* @__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: [
|
|
4732
5921
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-wallet-dot", "aria-hidden": "true" }),
|
|
4733
5922
|
" ",
|
|
4734
|
-
|
|
5923
|
+
shortAddress2(wallet.account)
|
|
4735
5924
|
] }) : wallet.connecting ? "Connecting\u2026" : "Connect wallet" })
|
|
4736
5925
|
] });
|
|
4737
5926
|
const fromTileRef = react.useRef(null);
|
|
@@ -4751,8 +5940,10 @@ function StableGenieExchange(props) {
|
|
|
4751
5940
|
{
|
|
4752
5941
|
title: isFrom ? "Exchange from" : "Exchange to",
|
|
4753
5942
|
chains,
|
|
4754
|
-
tokens,
|
|
5943
|
+
tokens: isFrom ? fromPickerTokens : toPickerTokens,
|
|
4755
5944
|
balances,
|
|
5945
|
+
optionStates: isFrom ? void 0 : destinationStates,
|
|
5946
|
+
loading: !catalogue?.ready,
|
|
4756
5947
|
onBack: () => closeSelector(isFrom),
|
|
4757
5948
|
onPick: (pick) => {
|
|
4758
5949
|
(isFrom ? setFrom : setTo)({ chainId: pick.chainId, symbol: symbolKey(pick.symbol) });
|
|
@@ -4767,11 +5958,11 @@ function StableGenieExchange(props) {
|
|
|
4767
5958
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-amt sg-mono", children: [
|
|
4768
5959
|
receive,
|
|
4769
5960
|
" ",
|
|
4770
|
-
|
|
5961
|
+
toSymbol
|
|
4771
5962
|
] }),
|
|
4772
5963
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
|
|
4773
5964
|
flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
|
|
4774
|
-
props.recipient ? ` \xB7 ${
|
|
5965
|
+
props.recipient ? ` \xB7 ${shortAddress2(props.recipient)}` : ""
|
|
4775
5966
|
] })
|
|
4776
5967
|
] }),
|
|
4777
5968
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
|
|
@@ -4808,7 +5999,7 @@ function StableGenieExchange(props) {
|
|
|
4808
5999
|
!rampMode && quoteError && !wide ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: quoteError }) : null,
|
|
4809
6000
|
!rampMode && !wide && quotable && !quoteError ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-panel", style: { marginTop: 12 }, children: [
|
|
4810
6001
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-label", children: "You receive (estimated)" }),
|
|
4811
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-anchor sg-mono", children: quoting ? "\u2026" : receive ? `${receive} ${
|
|
6002
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-anchor sg-mono", children: quoting ? "\u2026" : receive ? `${receive} ${toSymbol}` : "\u2014" }),
|
|
4812
6003
|
meta && !quoting ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-recv-sub", children: [
|
|
4813
6004
|
"via ",
|
|
4814
6005
|
meta.bridge,
|
|
@@ -4818,6 +6009,7 @@ function StableGenieExchange(props) {
|
|
|
4818
6009
|
meta.duration ? ` \xB7 ~${meta.duration}s` : ""
|
|
4819
6010
|
] }) : null
|
|
4820
6011
|
] }) : null,
|
|
6012
|
+
connected && flow.selected && flow.status !== "loading" ? /* @__PURE__ */ jsxRuntime.jsx(CompliancePanel, { compliance: flow.selected.quote.compliance, direct: flow.selected.state === "DIRECT" }) : null,
|
|
4821
6013
|
submitting ? /* @__PURE__ */ jsxRuntime.jsx(StepList, { steps: flow.steps }) : null,
|
|
4822
6014
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
|
|
4823
6015
|
!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 }),
|
|
@@ -4856,7 +6048,7 @@ function StableGenieExchange(props) {
|
|
|
4856
6048
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-recv-amt sg-mono", children: [
|
|
4857
6049
|
receive,
|
|
4858
6050
|
" ",
|
|
4859
|
-
|
|
6051
|
+
toSymbol
|
|
4860
6052
|
] }),
|
|
4861
6053
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-recv-sub", children: [
|
|
4862
6054
|
"on ",
|
|
@@ -4907,22 +6099,42 @@ function StableGenieExchange(props) {
|
|
|
4907
6099
|
] })
|
|
4908
6100
|
] }) });
|
|
4909
6101
|
}
|
|
6102
|
+
function StableGenieRwaExchange(props) {
|
|
6103
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StableGenieExchange, { ...props, product: "rwa" });
|
|
6104
|
+
}
|
|
4910
6105
|
function mount(el, config) {
|
|
4911
6106
|
const root = client.createRoot(el);
|
|
4912
6107
|
const variant = config.variant ?? "pay";
|
|
4913
|
-
const
|
|
6108
|
+
const isExchange = variant === "exchange" || variant === "rwa";
|
|
6109
|
+
const Comp = variant === "swap" ? StableGenieSwap : isExchange ? StableGenieExchange : StableGeniePay;
|
|
4914
6110
|
const { variant: _variant, ...props } = config;
|
|
4915
|
-
root.render(react.createElement(Comp, props));
|
|
6111
|
+
root.render(react.createElement(Comp, variant === "rwa" ? { ...props, product: "rwa" } : props));
|
|
4916
6112
|
return () => root.unmount();
|
|
4917
6113
|
}
|
|
4918
6114
|
|
|
6115
|
+
exports.CompliancePanel = CompliancePanel;
|
|
6116
|
+
exports.EXECUTABLE_STABLE_ASSETS = EXECUTABLE_STABLE_ASSETS;
|
|
4919
6117
|
exports.PaymentIsland = PaymentIsland;
|
|
6118
|
+
exports.STABLE_ASSETS = STABLE_ASSETS;
|
|
6119
|
+
exports.SUPPORTED_ASSETS = SUPPORTED_ASSETS;
|
|
6120
|
+
exports.SUPPORTED_CHAIN_IDS = SUPPORTED_CHAIN_IDS;
|
|
4920
6121
|
exports.StableGenieExchange = StableGenieExchange;
|
|
4921
6122
|
exports.StableGeniePay = StableGeniePay;
|
|
4922
6123
|
exports.StableGenieProvider = StableGenieProvider;
|
|
6124
|
+
exports.StableGenieRwaExchange = StableGenieRwaExchange;
|
|
4923
6125
|
exports.StableGenieSwap = StableGenieSwap;
|
|
6126
|
+
exports.TRADEABLE_RWA_ASSETS = TRADEABLE_RWA_ASSETS;
|
|
6127
|
+
exports.assetClassOf = assetClassOf;
|
|
6128
|
+
exports.brokenLaneReason = brokenLaneReason;
|
|
6129
|
+
exports.complianceChecks = complianceChecks;
|
|
6130
|
+
exports.complianceControlsLine = complianceControlsLine;
|
|
6131
|
+
exports.complianceView = complianceView;
|
|
6132
|
+
exports.counterpartTokens = counterpartTokens;
|
|
4924
6133
|
exports.createEngine = createEngine;
|
|
4925
6134
|
exports.darkTheme = darkTheme;
|
|
6135
|
+
exports.destinationAvailability = destinationAvailability;
|
|
6136
|
+
exports.humanizeComplianceReason = humanizeComplianceReason;
|
|
4926
6137
|
exports.lightTheme = lightTheme;
|
|
4927
6138
|
exports.mount = mount;
|
|
4928
6139
|
exports.resolveTheme = resolveTheme;
|
|
6140
|
+
exports.symbolKey = symbolKey;
|