@glacislabs/stablegenie-zerodelta 3.2.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -17,7 +17,27 @@ 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 SUPPORTED_ASSETS = /* @__PURE__ */ new Set(["USDC", "USDT", "USDE", "XAUT"]);
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;
22
42
  var MAX_QUOTE_CANDIDATES = 8;
23
43
  var QUOTE_BUFFER_BPS = 50;
@@ -30,7 +50,41 @@ var ERC20_ALLOWANCE_SELECTOR = "0xdd62ed3e";
30
50
  var ERC20_BALANCEOF_SELECTOR = "0x70a08231";
31
51
  var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
32
52
  var PREVIEW_OWNER = "0x1111111111111111111111111111111111111111";
33
- var CANONICAL_DECIMALS = { USDC: 6, USDT: 6, USDE: 18, XAUT: 6 };
53
+ var CANONICAL_DECIMALS = {
54
+ USDC: 6,
55
+ USDT: 6,
56
+ USDE: 18,
57
+ XAUT: 6,
58
+ // Added 2026-09-08 with the dapp-parity asset expansion. Every value below was read from the
59
+ // token contract itself — `eth_call decimals()` against each deployment the registry lists on the
60
+ // nine escrow chains — and each symbol answered the SAME number on every chain it is deployed on.
61
+ // The set is a deliberate mix of 6 and 18, and a copy-pasted row is wrong by a factor of 1e12
62
+ // while still looking entirely plausible in review; that is the bug this pin exists to prevent.
63
+ USDTB: 18,
64
+ AUSD: 6,
65
+ PYUSD: 6,
66
+ USDG: 6,
67
+ // The wider stable list — the bid side of an RWA trade.
68
+ DAI: 18,
69
+ RLUSD: 18,
70
+ USD1: 18,
71
+ USDS: 18,
72
+ WM: 6,
73
+ // Real-world assets. Every Nest vault share is 6; the Centrifuge pair is 18.
74
+ NALPHA: 6,
75
+ NTBILL: 6,
76
+ NBASIS: 6,
77
+ NCREDIT: 6,
78
+ NOPAL: 6,
79
+ NWISDOM: 6,
80
+ NACRDX: 6,
81
+ NLCRD: 6,
82
+ NAXI: 6,
83
+ NCLOA: 6,
84
+ NFALCON: 6,
85
+ DEJAAA: 18,
86
+ DESPXA: 18
87
+ };
34
88
  var CANONICAL_ESCROW = Object.freeze({
35
89
  1: "0x5e25c8ABc19b88d6A7Ab0D805C77A34987a68b40",
36
90
  // Ethereum
@@ -60,9 +114,40 @@ var CANONICAL_INBOUND_BRIDGE = {
60
114
  USDC: "cctp",
61
115
  USDT: "layerzero",
62
116
  USDE: "layerzero",
63
- XAUT: "layerzero"
117
+ XAUT: "layerzero",
118
+ // 2026-09-08: the four assets added for dapp parity are all LayerZero V2 OFTs on every chain the
119
+ // registry lists them on (`standard: "LayerZeroV2OFT"`, verified against dev and prod /tokens).
120
+ // USDC remains the only CCTP asset.
121
+ USDTB: "layerzero",
122
+ AUSD: "layerzero",
123
+ PYUSD: "layerzero",
124
+ USDG: "layerzero",
125
+ // `"none"` is a POSITIVE statement, not a gap: these assets have no inbound bridge adapter at all
126
+ // (the registry says `bridge: "None"`, or ships no bridge field at all), so they can only ever be
127
+ // bid on the chain the order already executes on and can never legitimately owe a native
128
+ // LayerZero fee. Pinning them matters because the fallback for an UNpinned asset is the label
129
+ // sniff, and a hostile quote controls the label — `bridge: "layerzero"` on one of these would
130
+ // otherwise let it attach msg.value to an order that forwards none, stranding it in the escrow.
131
+ DAI: "none",
132
+ RLUSD: "none",
133
+ USD1: "none",
134
+ USDS: "none",
135
+ WM: "none",
136
+ NALPHA: "none",
137
+ NTBILL: "none",
138
+ NBASIS: "none",
139
+ NCREDIT: "none",
140
+ NOPAL: "none",
141
+ NWISDOM: "none",
142
+ NACRDX: "none",
143
+ NLCRD: "none",
144
+ NAXI: "none",
145
+ NCLOA: "none",
146
+ NFALCON: "none",
147
+ DEJAAA: "none",
148
+ DESPXA: "none"
64
149
  };
65
- var SAME_CLASS_STABLE = /* @__PURE__ */ new Set(["USDC", "USDT", "USDE"]);
150
+ var SAME_CLASS_STABLE = new Set(STABLE_ASSETS);
66
151
  var MAX_SAME_CLASS_PAY_BPS = 30000n;
67
152
  var BUNDLED_NATIVE_SYMBOL = {
68
153
  1: "ETH",
@@ -85,6 +170,55 @@ var BUNDLED_RPC = {
85
170
  42161: "https://arb1.arbitrum.io/rpc",
86
171
  98866: "https://rpc.plume.org"
87
172
  };
173
+ var CHAIN_DISPLAY_NAMES = Object.freeze({
174
+ 1: "Ethereum",
175
+ 10: "Optimism",
176
+ 14: "Flare",
177
+ 30: "Rootstock",
178
+ 50: "XDC Network",
179
+ 56: "BNB Chain",
180
+ 88: "Viction",
181
+ 130: "Unichain",
182
+ 137: "Polygon",
183
+ 143: "Monad",
184
+ 146: "Sonic",
185
+ 151: "Redbelly Network",
186
+ 169: "Manta Pacific",
187
+ 196: "X Layer",
188
+ 252: "Fraxtal",
189
+ 324: "zkSync Era",
190
+ 480: "World Chain",
191
+ 988: "Stable",
192
+ 999: "HyperEVM",
193
+ 1030: "Conflux eSpace",
194
+ 1088: "Metis",
195
+ 1135: "Lisk",
196
+ 1329: "Sei",
197
+ 1776: "Injective EVM",
198
+ 1868: "Soneium",
199
+ 1923: "Swellchain",
200
+ 2222: "Kava",
201
+ 2818: "Morph",
202
+ 3343: "EDGE",
203
+ 4326: "MegaETH",
204
+ 5e3: "Mantle",
205
+ 8453: "Base",
206
+ 9745: "Plasma",
207
+ 34443: "Mode",
208
+ 42161: "Arbitrum One",
209
+ 43114: "Avalanche C-Chain",
210
+ 48900: "Zircuit",
211
+ 57073: "Ink",
212
+ 59144: "Linea",
213
+ 80094: "Berachain",
214
+ 81224: "Codex",
215
+ 81457: "Blast",
216
+ 98866: "Plume",
217
+ 534352: "Scroll",
218
+ 747474: "Katana",
219
+ 7777777: "Zora",
220
+ 21e6: "Corn"
221
+ });
88
222
 
89
223
  // src/core/address.ts
90
224
  function symbolKey(value) {
@@ -349,18 +483,133 @@ function applyLayerZeroBuffer(quote, option = {}) {
349
483
  return gas * (10000n + LZ_FEE_BUFFER_BPS) / 10000n;
350
484
  }
351
485
 
486
+ // src/core/availability.ts
487
+ function assetClassOf(symbol) {
488
+ const key = symbolKey(symbol);
489
+ if (TRADEABLE_RWA_ASSETS.has(key)) return "rwa";
490
+ if (STABLE_ASSETS.has(key)) return "stable";
491
+ return null;
492
+ }
493
+ function productAssets(product) {
494
+ return product === "rwa" ? /* @__PURE__ */ new Set([...STABLE_ASSETS, ...TRADEABLE_RWA_ASSETS]) : EXECUTABLE_STABLE_ASSETS;
495
+ }
496
+ function counterpartTokens(tokens, selected) {
497
+ const want = assetClassOf(selected?.symbol) === "rwa" ? "stable" : "rwa";
498
+ return tokens.filter((token) => assetClassOf(token.symbol) === want);
499
+ }
500
+ function tokenKey(chainId, address) {
501
+ return `${Number(chainId)}:${String(address || "").toLowerCase()}`;
502
+ }
503
+ function laneKey(fromChainId, fromAddress, toChainId, toAddress) {
504
+ return `${tokenKey(fromChainId, fromAddress)}>${tokenKey(toChainId, toAddress)}`;
505
+ }
506
+ function isExecutableBridge(descriptor) {
507
+ const bridge = descriptor?.bridge?.trim().toLowerCase();
508
+ const standard = descriptor?.standard?.replace(/[\s_-]/g, "").toLowerCase();
509
+ return (bridge === "circle" || bridge === "cctp") && standard === "cctpv2" || bridge === "layerzero" && standard === "layerzerov2oft";
510
+ }
511
+ function isKnownUnbridgeable(bridge) {
512
+ return typeof bridge === "string" && bridge.trim().toLowerCase() === "none";
513
+ }
514
+ function executableRoutes(routes) {
515
+ return routes.filter((route) => route.isEnabled !== false && isExecutableBridge(route));
516
+ }
517
+ function sourceKeys(routes) {
518
+ return new Set(routes.filter((r) => r.isEnabled !== false).map((r) => tokenKey(r.fromChainId, r.fromAddress ?? "")));
519
+ }
520
+ function destinationKeys(routes) {
521
+ return new Set(routes.filter((r) => r.isEnabled !== false).map((r) => tokenKey(r.toChainId, r.toAddress ?? "")));
522
+ }
523
+ function laneKeys(routes) {
524
+ return new Set(routes.filter((r) => r.isEnabled !== false).map((r) => laneKey(r.fromChainId, r.fromAddress ?? "", r.toChainId, r.toAddress ?? "")));
525
+ }
526
+ function executionChainIds(chains) {
527
+ return new Set(chains.filter((c) => c.isEnabled !== false && c.isExecutionChain === true).map((c) => Number(c.chainId)));
528
+ }
529
+ function hubDeliverableSymbols(tokens, execution) {
530
+ return new Set(tokens.filter((t) => execution.has(Number(t.chainId))).map((t) => symbolKey(t.symbol)));
531
+ }
532
+ function isSourceToken(token, ctx) {
533
+ const chainId = Number(token.chainId);
534
+ if (!ctx.sourceChains.has(chainId)) return false;
535
+ return ctx.execution.has(chainId) || !isKnownUnbridgeable(token.bridge) && ctx.source.has(tokenKey(chainId, token.address));
536
+ }
537
+ function directLaneOK(token, source, lanes) {
538
+ if (!source || !lanes) return true;
539
+ if (symbolKey(source.symbol) !== symbolKey(token.symbol)) return true;
540
+ if (Number(source.chainId) === Number(token.chainId)) return true;
541
+ return lanes.has(laneKey(source.chainId, source.address, token.chainId, token.address));
542
+ }
543
+ function brokenLaneFor(token, source, brokenLanes) {
544
+ if (!source || !brokenLanes) return void 0;
545
+ return brokenLanes.get(laneKey(source.chainId, source.address, token.chainId, token.address));
546
+ }
547
+ function destinationAvailability(token, ctx, source) {
548
+ if (brokenLaneFor(token, source ?? void 0, ctx.brokenLanes)) return "unreachable";
549
+ if (ctx.execution.has(Number(token.chainId))) return "available";
550
+ if (token.isChainedDestination === true) return "available";
551
+ if (!isKnownUnbridgeable(token.bridge) && ctx.destination.has(tokenKey(token.chainId, token.address)) && directLaneOK(token, source ?? void 0, ctx.lanes)) {
552
+ return "available";
553
+ }
554
+ return ctx.hubSymbols.has(symbolKey(token.symbol)) ? "hub-only" : "unreachable";
555
+ }
556
+ function hasReachableDestination(source, catalogue, ctx) {
557
+ if (catalogue.length === 0) return true;
558
+ const from = tokenKey(source.chainId, source.address);
559
+ for (const candidate of catalogue) {
560
+ if (tokenKey(candidate.chainId, candidate.address) === from) continue;
561
+ if (destinationAvailability(candidate, ctx, source) === "available") return true;
562
+ }
563
+ return false;
564
+ }
565
+ function buildCatalogue(input) {
566
+ const { chains, tokens, routes, supportedChainIds, brokenLanes } = input;
567
+ const product = input.product ?? "stable";
568
+ const universe = productAssets(product);
569
+ const allowedAssets = input.allowedAssets ? new Set([...input.allowedAssets].filter((a) => universe.has(a))) : universe;
570
+ const enabledChains = chains.filter((c) => c.isEnabled !== false);
571
+ const registryChainIds = new Set(enabledChains.map((c) => Number(c.chainId)));
572
+ const sourceChains = new Set([...registryChainIds].filter((id) => supportedChainIds.has(id)));
573
+ const execution = executionChainIds(enabledChains);
574
+ const projected = product === "rwa" ? routes.filter((route) => route.isEnabled !== false) : executableRoutes(routes);
575
+ const source = sourceKeys(projected);
576
+ const destination = destinationKeys(projected);
577
+ const lanes = laneKeys(projected);
578
+ const chainIds = new Set(sourceChains);
579
+ for (const route of projected) {
580
+ const id = Number(route.toChainId);
581
+ if (Number.isSafeInteger(id) && id > 0) chainIds.add(id);
582
+ }
583
+ const allowed = tokens.filter((token) => token.isEnabled !== false && allowedAssets.has(symbolKey(token.symbol)));
584
+ const projectedCatalogue = allowed.filter((token) => {
585
+ if (!chainIds.has(Number(token.chainId))) return false;
586
+ if (product === "rwa") return true;
587
+ if (!isExecutableBridge(token)) return false;
588
+ const key = tokenKey(token.chainId, token.address);
589
+ return source.has(key) || destination.has(key) || execution.has(Number(token.chainId));
590
+ });
591
+ const ready = chains.length > 0 && routes.length > 0 && projectedCatalogue.length > 0;
592
+ const catalogue = ready ? projectedCatalogue : allowed;
593
+ const hubSymbols = hubDeliverableSymbols(catalogue, execution);
594
+ const ctx = { source, destination, lanes, execution, sourceChains, hubSymbols, ...brokenLanes ? { brokenLanes } : {} };
595
+ const sources = ready ? catalogue.filter((token) => isSourceToken(token, ctx) && hasReachableDestination(token, catalogue, ctx)) : (
596
+ // Unprojected: the only rule we can still apply with confidence is the escrow-chain bound,
597
+ // which comes from this build's own pins rather than from the registry.
598
+ catalogue.filter((token) => sourceChains.has(Number(token.chainId)))
599
+ );
600
+ const byId = new Map(enabledChains.map((c) => [Number(c.chainId), c]));
601
+ for (const id of chainIds) if (!byId.has(id)) byId.set(id, { chainId: id, isEnabled: true });
602
+ return { ...ctx, product, tokens: catalogue, sources, chainIds, chains: [...byId.values()], ready };
603
+ }
604
+
352
605
  // src/core/options.ts
353
606
  function chainNameOf(chainId, chains) {
354
607
  const chain = chains.find((item) => Number(item.chainId) === Number(chainId));
355
- return chain?.displayName || chain?.name || `Chain ${chainId}`;
608
+ return chain?.displayName || chain?.name || CHAIN_DISPLAY_NAMES[Number(chainId)] || `Chain ${chainId}`;
356
609
  }
357
610
  function chainById(chains, chainId) {
358
611
  return chains.find((chain) => Number(chain.chainId) === Number(chainId)) || null;
359
612
  }
360
- function isDeliverable(symbol, chainId) {
361
- if (Number(chainId) === 8453 && symbolKey(symbol) === "USDT") return false;
362
- return true;
363
- }
364
613
  function chainSelectable(chain, chainId) {
365
614
  if (!SUPPORTED_CHAIN_IDS.has(Number(chainId))) return false;
366
615
  if (!chain) return true;
@@ -373,45 +622,57 @@ function findToken(tokens, chainId, symbol) {
373
622
  const key = symbolKey(symbol);
374
623
  return tokens.find((token) => tokenEnabled(token) && Number(token.chainId) === Number(chainId) && symbolKey(token.symbol) === key) || null;
375
624
  }
376
- function buildPayOptions({ invoiceAsset, invoiceChainId, tokens, routes, chains, walletChainId }) {
625
+ function buildPayOptions({ invoiceAsset, invoiceChainId, tokens, routes, chains, walletChainId, catalogue }) {
377
626
  const invoiceKey = symbolKey(invoiceAsset);
378
- const tokenBySymbolAndChain = /* @__PURE__ */ new Map();
379
- for (const token of tokens) {
380
- if (!tokenEnabled(token)) continue;
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
- }
627
+ const invoiceChain = Number(invoiceChainId);
628
+ const live = catalogue?.ready ? catalogue : null;
629
+ const destinationToken = findToken(tokens, invoiceChain, invoiceKey);
385
630
  const routeBridge = /* @__PURE__ */ new Map();
386
631
  for (const route of routes || []) {
387
- if (route.isEnabled === false || Number(route.toChainId) !== Number(invoiceChainId)) continue;
632
+ if (route.isEnabled === false || Number(route.toChainId) !== invoiceChain) continue;
388
633
  routeBridge.set(`${symbolKey(route.tokenName || route.tokenId)}:${Number(route.fromChainId)}`, route.bridge);
389
634
  routeBridge.set(`${symbolKey(route.tokenId)}:${Number(route.fromChainId)}`, route.bridge);
390
635
  }
391
- const receiveDeliverable = isDeliverable(invoiceKey, invoiceChainId);
392
- const options = [];
393
- for (const [payKey, byChain] of tokenBySymbolAndChain.entries()) {
394
- if (!byChain.has(Number(invoiceChainId))) continue;
395
- for (const [chainId, token] of byChain.entries()) {
396
- const chain = chainById(chains, chainId);
397
- if (!chainSelectable(chain, chainId)) continue;
398
- const direct = chainId === Number(invoiceChainId) && payKey === invoiceKey;
399
- if (!direct && payKey === invoiceKey) continue;
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
- });
636
+ const knownLanes = live?.lanes && live.lanes.size > 0 ? live.lanes : null;
637
+ function refusal(token) {
638
+ const sameSymbol = symbolKey(token.symbol) === invoiceKey;
639
+ const sameChain = Number(token.chainId) === invoiceChain;
640
+ if (sameSymbol && sameChain) return null;
641
+ if (live && destinationToken && brokenLaneFor(destinationToken, token, live.brokenLanes)) return "measured";
642
+ if (live && !isSourceToken(token, live)) return "not-a-source";
643
+ if (sameSymbol && knownLanes && !knownLanes.has(laneKey(token.chainId, token.address, invoiceChain, destinationToken?.address ?? ""))) {
644
+ return "no-direct-lane";
414
645
  }
646
+ if (live && destinationToken && destinationAvailability(destinationToken, live, token) !== "available") return "undeliverable";
647
+ return null;
648
+ }
649
+ const options = [];
650
+ const seen = /* @__PURE__ */ new Set();
651
+ const universe = live ? live.tokens : tokens;
652
+ for (const token of universe) {
653
+ if (!tokenEnabled(token)) continue;
654
+ const chainId = Number(token.chainId);
655
+ const chain = chainById(chains, chainId);
656
+ if (!chainSelectable(chain, chainId)) continue;
657
+ const key = tokenKey(chainId, token.address);
658
+ if (seen.has(key)) continue;
659
+ if (refusal(token)) continue;
660
+ seen.add(key);
661
+ const payKey = symbolKey(token.symbol);
662
+ const direct = chainId === invoiceChain && payKey === invoiceKey;
663
+ options.push({
664
+ symbol: token.symbol,
665
+ symbolKey: payKey,
666
+ name: token.name || token.symbol,
667
+ chainId,
668
+ chainName: chainNameOf(chainId, chains),
669
+ address: token.address,
670
+ decimals: assetDecimals(token),
671
+ logoUrl: token.logoUrl,
672
+ bridge: routeBridge.get(`${payKey}:${chainId}`) || token.bridge,
673
+ sameChain: chainId === invoiceChain,
674
+ direct
675
+ });
415
676
  }
416
677
  options.sort((a, b) => {
417
678
  const walletChain = Number(walletChainId || 0);
@@ -470,6 +731,36 @@ function nativeFeeShortMessage(check, symbol, chainName2) {
470
731
  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
732
  }
472
733
 
734
+ // src/core/route-health.ts
735
+ var EMPTY = /* @__PURE__ */ new Map();
736
+ function suppressedLanes(health) {
737
+ if (health?.mode !== "enforce" || !Array.isArray(health.lanes)) return EMPTY;
738
+ const out = /* @__PURE__ */ new Map();
739
+ for (const lane of health.lanes) {
740
+ if (lane?.status !== "broken") continue;
741
+ const key = typeof lane.laneKey === "string" ? lane.laneKey.toLowerCase() : "";
742
+ if (!key) continue;
743
+ out.set(key, {
744
+ route: typeof lane.route === "string" ? lane.route : "",
745
+ code: typeof lane.code === "string" ? lane.code : "",
746
+ message: typeof lane.message === "string" ? lane.message : "",
747
+ ...typeof lane.kind === "string" ? { kind: lane.kind } : {}
748
+ });
749
+ }
750
+ return out;
751
+ }
752
+ function brokenLaneReason(lane) {
753
+ if (!lane) return "";
754
+ switch (lane.kind) {
755
+ case "bridge-throttled":
756
+ return "The issuer's bridge for this pair is closed right now.";
757
+ case "vault-closed":
758
+ return "This vault is not accepting deposits right now.";
759
+ default:
760
+ return "ZeroDelta could not price this pair in its latest check.";
761
+ }
762
+ }
763
+
473
764
  // src/core/solve.ts
474
765
  async function solveExactOut({ option, destination, destinationToken, payer, fetchQuote }) {
475
766
  const destDecimals = assetDecimals(destinationToken);
@@ -912,7 +1203,8 @@ function createApiClient(cfg) {
912
1203
  const cache = {
913
1204
  chains: null,
914
1205
  tokens: null,
915
- routes: null
1206
+ routes: null,
1207
+ health: null
916
1208
  };
917
1209
  const apiBase = cfg.apiBase.replace(/\/$/, "");
918
1210
  async function apiRequest(path, init = {}) {
@@ -982,6 +1274,18 @@ function createApiClient(cfg) {
982
1274
  return [];
983
1275
  }
984
1276
  }
1277
+ async function fetchRouteHealth() {
1278
+ if (nowFresh(cache.health)) return cache.health.value;
1279
+ let value = null;
1280
+ try {
1281
+ const health = await apiRequest("/route-health", { timeoutMs: 8e3 });
1282
+ value = health && typeof health === "object" && !Array.isArray(health) ? health : null;
1283
+ } catch {
1284
+ value = null;
1285
+ }
1286
+ cache.health = { at: Date.now(), value };
1287
+ return value;
1288
+ }
985
1289
  async function fetchQuote(body, retries = 1) {
986
1290
  let lastError;
987
1291
  for (let attempt = 0; attempt <= retries; attempt += 1) {
@@ -996,7 +1300,7 @@ function createApiClient(cfg) {
996
1300
  }
997
1301
  throw lastError;
998
1302
  }
999
- return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchQuote, apiBase };
1303
+ return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchQuote, apiBase };
1000
1304
  }
1001
1305
 
1002
1306
  // src/core/plan.ts
@@ -1014,7 +1318,7 @@ function validateDestination(destination) {
1014
1318
  assertAddress(destination.address, "Destination address");
1015
1319
  const chainId = Number(destination.chainId);
1016
1320
  const asset = symbolKey(destination.asset);
1017
- if (!SUPPORTED_CHAIN_IDS.has(chainId)) throw new Error("Unsupported destination chain.");
1321
+ if (!Number.isSafeInteger(chainId) || chainId <= 0) throw new Error("Unsupported destination chain.");
1018
1322
  if (!SUPPORTED_ASSETS.has(asset)) throw new Error("Unsupported destination asset.");
1019
1323
  const normalizedAmount = normalizeDecimalText(destination.amount);
1020
1324
  if (!/^\d+(\.\d+)?$/.test(normalizedAmount)) throw new Error("Could not detect a valid payment amount.");
@@ -1028,7 +1332,15 @@ function planErrorSummary(errors) {
1028
1332
  async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances) {
1029
1333
  validateDestination(request);
1030
1334
  assertAddress(payer, "Payer wallet");
1031
- const [chains, tokens, routes] = await Promise.all([api.fetchChains(), api.fetchTokens(), api.fetchRoutes()]);
1335
+ const [chains, tokens, routes, health] = await Promise.all([api.fetchChains(), api.fetchTokens(), api.fetchRoutes(), api.fetchRouteHealth()]);
1336
+ const catalogue = buildCatalogue({
1337
+ chains,
1338
+ tokens,
1339
+ routes,
1340
+ product: "stable",
1341
+ supportedChainIds: SUPPORTED_CHAIN_IDS,
1342
+ brokenLanes: suppressedLanes(health)
1343
+ });
1032
1344
  const destination = {
1033
1345
  ...request,
1034
1346
  chainId: Number(request.chainId),
@@ -1043,7 +1355,8 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances)
1043
1355
  tokens,
1044
1356
  routes,
1045
1357
  chains,
1046
- walletChainId: wallet?.chainId
1358
+ walletChainId: wallet?.chainId,
1359
+ catalogue
1047
1360
  }).filter((option) => option.direct || !allowedFunding || allowedFunding.has(option.symbolKey));
1048
1361
  if (!options.length) throw new Error(`No enabled ZeroDelta funding assets can settle ${destination.asset} on ${chainNameOf(destination.chainId, chains)}.`);
1049
1362
  const balanceTargets = [];
@@ -1125,7 +1438,8 @@ function validateSwap(swap = {}) {
1125
1438
  const toChainId = Number(swap.toChainId);
1126
1439
  const fromToken = symbolKey(swap.fromToken);
1127
1440
  const toToken = symbolKey(swap.toToken);
1128
- if (!SUPPORTED_CHAIN_IDS.has(fromChainId) || !SUPPORTED_CHAIN_IDS.has(toChainId)) throw new Error("Unsupported swap chain.");
1441
+ if (!SUPPORTED_CHAIN_IDS.has(fromChainId)) throw new Error("Unsupported swap chain.");
1442
+ if (!Number.isSafeInteger(toChainId) || toChainId <= 0) throw new Error("Unsupported swap chain.");
1129
1443
  if (!SUPPORTED_ASSETS.has(fromToken) || !SUPPORTED_ASSETS.has(toToken)) throw new Error("Unsupported swap asset.");
1130
1444
  const amountIn = normalizeDecimalText(swap.amountIn);
1131
1445
  if (!/^\d+(\.\d+)?$/.test(amountIn) || Number(amountIn) <= 0 || Number(amountIn) > 1e9) throw new Error("Enter a valid swap amount.");
@@ -1571,7 +1885,26 @@ function createEngine(config = {}) {
1571
1885
  fetchChains: api.fetchChains,
1572
1886
  fetchTokens: api.fetchTokens,
1573
1887
  fetchRoutes: api.fetchRoutes,
1888
+ fetchRouteHealth: api.fetchRouteHealth,
1574
1889
  fetchQuote: api.fetchQuote,
1890
+ fetchCatalogue: async (allowedAssets, product) => {
1891
+ const [chains, tokens, routes, health] = await Promise.all([
1892
+ api.fetchChains().catch(() => []),
1893
+ api.fetchTokens().catch(() => []),
1894
+ api.fetchRoutes().catch(() => []),
1895
+ api.fetchRouteHealth()
1896
+ ]);
1897
+ const allowed = allowedAssets?.length ? new Set([...allowedAssets].map(symbolKey).filter((a) => SUPPORTED_ASSETS.has(a))) : void 0;
1898
+ return buildCatalogue({
1899
+ chains,
1900
+ tokens,
1901
+ routes,
1902
+ product,
1903
+ ...allowed ? { allowedAssets: allowed } : {},
1904
+ supportedChainIds: SUPPORTED_CHAIN_IDS,
1905
+ brokenLanes: suppressedLanes(health)
1906
+ });
1907
+ },
1575
1908
  fetchPaymentPlan: (request, payer, wallet) => fetchPaymentPlan(api, request, payer, wallet, verifier.readBalances),
1576
1909
  quoteSwapPreview: (swap, owner) => quoteSwapPreview(api, swap, owner),
1577
1910
  buildSwapPlan: (swap, payer, wallet) => buildSwapPlan(api, swap, payer, wallet),
@@ -2308,7 +2641,12 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
2308
2641
  .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
2642
  .sg-back:hover{background:var(--sg-surface)}
2310
2643
  .sg-sel-title{flex:1 1 auto;text-align:center;font-size:15px;font-weight:600;margin-right:32px}
2311
- .sg-chain-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:8px;margin-bottom:12px}
2644
+ /* Scrolls at ~2.5 rows. The catalogue's destination chains outnumber its source chains three to one
2645
+ (9 escrow chains, ~37 total), so an ungated grid was eight rows tall and pushed the token list \u2014
2646
+ the thing the panel exists for \u2014 below the fold. The fade is a scroll affordance, not decoration. */
2647
+ .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)}
2648
+ /* No mask once everything fits \u2014 a fade under a grid with nothing below it reads as a rendering bug. */
2649
+ .sg-chain-grid[data-scroll="false"]{mask-image:none;-webkit-mask-image:none;overflow-y:visible;max-height:none}
2312
2650
  .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
2651
  .sg-chain-chip img{width:22px;height:22px;border-radius:999px;display:block}
2314
2652
  .sg-chain-chip:hover{border-color:color-mix(in srgb,var(--sg-accent) 45%,var(--sg-border))}
@@ -2668,7 +3006,7 @@ function shortAddress(a) {
2668
3006
  if (!a) return "";
2669
3007
  return `${a.slice(0, 6)}\u2026${a.slice(-4)}`;
2670
3008
  }
2671
- var CHAIN_LABELS = {
3009
+ var SOURCE_CHAIN_LABELS = {
2672
3010
  1: "Ethereum",
2673
3011
  10: "Optimism",
2674
3012
  130: "Unichain",
@@ -2679,8 +3017,14 @@ var CHAIN_LABELS = {
2679
3017
  42161: "Arbitrum",
2680
3018
  98866: "Plume"
2681
3019
  };
3020
+ var CHAIN_LABELS = { ...CHAIN_DISPLAY_NAMES, ...SOURCE_CHAIN_LABELS };
2682
3021
  var SUPPORTED_CHAINS = [1, 10, 42161, 8453, 57073, 130, 9745, 146, 98866];
2683
- var SUPPORTED_ASSETS2 = ["USDC", "USDT", "USDE", "XAUT"];
3022
+ var SUPPORTED_ASSETS2 = [
3023
+ ...EXECUTABLE_STABLE_ASSETS,
3024
+ ...[...STABLE_ASSETS].filter((a) => !EXECUTABLE_STABLE_ASSETS.has(a)),
3025
+ ...[...SUPPORTED_ASSETS].filter((a) => !STABLE_ASSETS.has(a))
3026
+ ];
3027
+ [...EXECUTABLE_STABLE_ASSETS];
2684
3028
  function Button(props) {
2685
3029
  const soft = !!props.softDisabled && !props.disabled;
2686
3030
  const nativeDisabled = props.disabled || props.busy && !props.softDisabled;
@@ -2889,7 +3233,19 @@ var BUNDLED_TOKEN_LOGO = {
2889
3233
  USDC: "https://coin-images.coingecko.com/coins/images/6319/large/USDC.png",
2890
3234
  USDT: "https://coin-images.coingecko.com/coins/images/325/large/Tether.png",
2891
3235
  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"
3236
+ XAUT: "https://coin-images.coingecko.com/coins/images/10481/large/Tether_Gold.png",
3237
+ // 2026-09-08, with the dapp-parity asset expansion — the same four URLs the dapp draws
3238
+ // (zd-dapp/src/lib/tokenLogos.ts), so the two products show one picture per coin.
3239
+ USDTB: "https://coin-images.coingecko.com/coins/images/52804/large/76357aa8-4ef7-446c-bad3-a3f944eeec7a.jpeg",
3240
+ AUSD: "https://coin-images.coingecko.com/coins/images/39284/large/AUSD_1024px.png",
3241
+ PYUSD: "https://coin-images.coingecko.com/coins/images/31212/large/PYUSD_Token_Logo_2x.png",
3242
+ USDG: "https://coin-images.coingecko.com/coins/images/51281/large/GDN_USDG_Token_200x200.png",
3243
+ // The wider stable list, added 2026-09-08 with the RWA exchange.
3244
+ DAI: "https://coin-images.coingecko.com/coins/images/9956/large/Badge_Dai.png",
3245
+ USDS: "https://coin-images.coingecko.com/coins/images/39926/large/usds.webp",
3246
+ RLUSD: "https://coin-images.coingecko.com/coins/images/39651/large/RLUSD_200x200_%281%29.png",
3247
+ USD1: "https://coin-images.coingecko.com/coins/images/54977/large/USD1_1000x1000_transparent.png",
3248
+ WM: "https://coin-images.coingecko.com/coins/images/50789/large/M.png"
2893
3249
  };
2894
3250
  function isHttpsUrl(u) {
2895
3251
  return typeof u === "string" && /^https:\/\//i.test(u);
@@ -2919,12 +3275,18 @@ var CHAIN_SHORT = {
2919
3275
  42161: "ARB",
2920
3276
  98866: "PLM"
2921
3277
  };
3278
+ function chainBadge(chainId) {
3279
+ const pinned = CHAIN_SHORT[Number(chainId)];
3280
+ if (pinned) return pinned;
3281
+ const name = CHAIN_LABELS[Number(chainId)];
3282
+ return name ? name.replace(/[^A-Za-z]/g, "").slice(0, 3).toUpperCase() : "?";
3283
+ }
2922
3284
  function TokenGlyph(props) {
2923
3285
  const [failed, setFailed] = react.useState([]);
2924
3286
  const src = tokenLogoCandidates(props.symbol, props.logoUrl).find((u) => !failed.includes(u));
2925
3287
  const mark = props.chainId ? chainLogoCandidates(props.chainId)[0] : void 0;
2926
3288
  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: CHAIN_SHORT[props.chainId] || "?" });
3289
+ 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
3290
  return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-tok", "data-size": props.size === "sm" ? "sm" : void 0, children: [
2929
3291
  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
3292
  badge
@@ -2934,17 +3296,18 @@ function ChevronGlyph() {
2934
3296
  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
3297
  }
2936
3298
  function TokenTile(props) {
3299
+ const shown = props.token?.symbol ?? props.pick?.symbol ?? "";
2937
3300
  const glyph = props.pick ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2938
3301
  /* @__PURE__ */ jsxRuntime.jsx(TokenGlyph, { symbol: props.pick.symbol, logoUrl: props.token?.logoUrl, chainId: props.pick.chainId }),
2939
3302
  /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { minWidth: 0 }, children: [
2940
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-sym", children: props.pick.symbol }),
3303
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-sym", children: shown }),
2941
3304
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-chain", children: CHAIN_LABELS[props.pick.chainId] || `Chain ${props.pick.chainId}` })
2942
3305
  ] })
2943
3306
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2944
3307
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tok", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tok-fb", children: "?" }) }),
2945
3308
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-empty", children: "Select\u2026" })
2946
3309
  ] });
2947
- const ariaLabel = `${props.label}: ${props.pick ? `${props.pick.symbol} on ${CHAIN_LABELS[props.pick.chainId] || props.pick.chainId}` : "select token"}`;
3310
+ const ariaLabel = `${props.label}: ${props.pick ? `${shown} on ${CHAIN_LABELS[props.pick.chainId] || props.pick.chainId}` : "select token"}`;
2948
3311
  if (props.row) {
2949
3312
  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
3313
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-label", children: props.label }),
@@ -2985,7 +3348,8 @@ function FundingTile(props) {
2985
3348
  function ChainChip(props) {
2986
3349
  const [failed, setFailed] = react.useState([]);
2987
3350
  const src = chainLogoCandidates(props.chain?.chainId, props.chain?.logoUrl).find((u) => !failed.includes(u));
2988
- return /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-chain-chip", "data-selected": props.selected, title: props.label, "aria-pressed": props.selected, onClick: props.onClick, children: src ? /* @__PURE__ */ jsxRuntime.jsx("img", { src, alt: props.label, loading: "lazy", onError: () => setFailed((f) => [...f, src]) }) : props.label });
3351
+ const name = props.name ?? props.label;
3352
+ 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
3353
  }
2990
3354
  function SearchGlyph() {
2991
3355
  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 +3370,9 @@ function TokenSelect(props) {
3006
3370
  const q = query.trim().toLowerCase();
3007
3371
  const filtered = props.tokens.filter((t) => chainFilter == null ? true : Number(t.chainId) === chainFilter).filter((t) => {
3008
3372
  if (!q) return true;
3009
- return String(t.symbol || "").toLowerCase().includes(q) || String(t.name || "").toLowerCase().includes(q) || String(t.address || "").toLowerCase().includes(q);
3373
+ 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
3374
+ // show a three-letter badge, so "Katana" or "Berachain" has to be findable by typing it.
3375
+ String(CHAIN_LABELS[Number(t.chainId)] || "").toLowerCase().includes(q);
3010
3376
  });
3011
3377
  if (!props.balances) return filtered;
3012
3378
  const balNum = (t) => {
@@ -3020,13 +3386,14 @@ function TokenSelect(props) {
3020
3386
  /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-back", onClick: props.onBack, "aria-label": "Back", children: /* @__PURE__ */ jsxRuntime.jsx(BackGlyph, {}) }),
3021
3387
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-sel-title", children: props.title })
3022
3388
  ] }),
3023
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-chain-grid", role: "group", "aria-label": "Filter by chain", children: [
3389
+ /* @__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
3390
  /* @__PURE__ */ jsxRuntime.jsx(ChainChip, { label: "All", selected: chainFilter == null, onClick: () => setChainFilter(null) }),
3025
3391
  props.chains.map((c) => /* @__PURE__ */ jsxRuntime.jsx(
3026
3392
  ChainChip,
3027
3393
  {
3028
3394
  chain: c,
3029
- label: CHAIN_SHORT[Number(c.chainId)] || String(c.chainId),
3395
+ label: chainBadge(Number(c.chainId)),
3396
+ name: CHAIN_LABELS[Number(c.chainId)] || c.displayName || c.name || `Chain ${c.chainId}`,
3030
3397
  selected: chainFilter === Number(c.chainId),
3031
3398
  onClick: () => setChainFilter(Number(c.chainId))
3032
3399
  },
@@ -3035,7 +3402,7 @@ function TokenSelect(props) {
3035
3402
  ] }),
3036
3403
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-search", children: [
3037
3404
  /* @__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" })
3405
+ /* @__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
3406
  ] }),
3040
3407
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-toklist", role: "group", "aria-label": props.title, children: rows.length ? rows.map((t) => {
3041
3408
  const chainId = Number(t.chainId);
@@ -3067,7 +3434,7 @@ function TokenSelect(props) {
3067
3434
  },
3068
3435
  `${chainId}:${t.address}`
3069
3436
  );
3070
- }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-sel-empty", children: "No tokens match \u2014 try another chain or search." }) })
3437
+ }) : 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
3438
  ] });
3072
3439
  }
3073
3440
  function useTxHistory(account) {
@@ -3308,7 +3675,7 @@ function forgetIdentity(account) {
3308
3675
  }
3309
3676
  var addrEq = (a, b) => String(a || "").toLowerCase() === String(b || "").toLowerCase();
3310
3677
  var chainName = (id) => id != null ? CHAIN_LABELS[id] || `Chain ${id}` : "";
3311
- var STABLES = /* @__PURE__ */ new Set(["USDC", "USDT", "USDE"]);
3678
+ var STABLES = EXECUTABLE_STABLE_ASSETS;
3312
3679
  function BankGlyph() {
3313
3680
  return /* @__PURE__ */ jsxRuntime.jsx(
3314
3681
  "svg",
@@ -3549,19 +3916,17 @@ function PaymentIsland(props) {
3549
3916
  const mode = props.mode ?? "exchange";
3550
3917
  const rampMode = kind === "exchange" && mode !== "exchange";
3551
3918
  const bankSettlement = isPay && props.settlement === "bank";
3552
- const exAllowed = react.useMemo(
3553
- () => (props.assets?.length ? props.assets : ["USDC", "USDT", "USDE"]).map((a) => symbolKey(a)),
3554
- [props.assets]
3555
- );
3919
+ const exProduct = props.product ?? "stable";
3920
+ const exAllowed = react.useMemo(() => props.assets?.length ? props.assets.map((a) => symbolKey(a)) : void 0, [props.assets]);
3556
3921
  const [exFrom, setExFrom] = react.useState(() => {
3557
3922
  const chainId = props.defaultFromChainId ?? (kind === "swap" ? 42161 : void 0);
3558
3923
  const asset = props.defaultFromAsset ?? (kind === "swap" ? "USDT" : void 0);
3559
- return chainId && asset && exAllowed.includes(symbolKey(asset)) ? { chainId, symbol: symbolKey(asset) } : null;
3924
+ return chainId && asset ? { chainId, symbol: symbolKey(asset) } : null;
3560
3925
  });
3561
3926
  const [exTo, setExTo] = react.useState(() => {
3562
3927
  const chainId = props.defaultToChainId ?? (kind === "swap" ? 8453 : void 0);
3563
3928
  const asset = props.defaultToAsset ?? (kind === "swap" ? "USDC" : void 0);
3564
- return chainId && asset && exAllowed.includes(symbolKey(asset)) ? { chainId, symbol: symbolKey(asset) } : null;
3929
+ return chainId && asset ? { chainId, symbol: symbolKey(asset) } : null;
3565
3930
  });
3566
3931
  const [exAmount, setExAmount] = react.useState(props.defaultAmount ?? "");
3567
3932
  const exFromChainId = exFrom?.chainId;
@@ -3654,27 +4019,24 @@ function PaymentIsland(props) {
3654
4019
  }
3655
4020
  return map;
3656
4021
  }, [annotated, holdings.loading]);
3657
- const [chains, setChains] = react.useState([]);
3658
- const [registryTokens, setRegistryTokens] = react.useState([]);
4022
+ const [catalogue, setCatalogue] = react.useState(null);
3659
4023
  react.useEffect(() => {
3660
4024
  if (bankSettlement || !isPay && rampMode) return;
3661
4025
  let alive = true;
3662
- Promise.all([engine.fetchChains().catch(() => []), engine.fetchTokens().catch(() => [])]).then(([cs, ts]) => {
3663
- if (!alive) return;
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))));
4026
+ engine.fetchCatalogue(isPay ? void 0 : exAllowed, isPay ? "stable" : exProduct).then((next) => {
4027
+ if (alive) setCatalogue(next);
3669
4028
  });
3670
4029
  return () => {
3671
4030
  alive = false;
3672
4031
  };
3673
- }, [engine, isPay, rampMode, bankSettlement]);
3674
- const exchangeTokens = react.useMemo(
3675
- () => isPay ? [] : registryTokens.filter((t) => exAllowed.includes(symbolKey(t.symbol)) && isDeliverable(symbolKey(t.symbol), Number(t.chainId))),
3676
- [isPay, registryTokens, exAllowed]
3677
- );
4032
+ }, [engine, isPay, rampMode, bankSettlement, exAllowed, exProduct]);
4033
+ const chains = react.useMemo(() => {
4034
+ const order = new Map(SUPPORTED_CHAINS.map((id, i) => [id, i]));
4035
+ return [...catalogue?.chains ?? []].sort((a, b) => (order.get(Number(a.chainId)) ?? 99) - (order.get(Number(b.chainId)) ?? 99) || Number(a.chainId) - Number(b.chainId));
4036
+ }, [catalogue]);
4037
+ const registryTokens = react.useMemo(() => catalogue?.tokens ?? [], [catalogue]);
4038
+ const exchangeTokens = react.useMemo(() => isPay ? [] : registryTokens, [isPay, registryTokens]);
4039
+ const exSourceTokens = react.useMemo(() => isPay ? [] : catalogue?.sources ?? [], [isPay, catalogue]);
3678
4040
  const [exBalances, setExBalances] = react.useState({});
3679
4041
  const exBalReq = react.useRef(0);
3680
4042
  react.useEffect(() => {
@@ -3696,6 +4058,39 @@ function PaymentIsland(props) {
3696
4058
  }, [engine, isPay, wallet.account, exchangeTokens]);
3697
4059
  const exFromToken = react.useMemo(() => exFrom ? findToken(exchangeTokens, exFrom.chainId, exFrom.symbol) : null, [exchangeTokens, exFrom]);
3698
4060
  const exToToken = react.useMemo(() => exTo ? findToken(exchangeTokens, exTo.chainId, exTo.symbol) : null, [exchangeTokens, exTo]);
4061
+ const exFromPicker = react.useMemo(() => exProduct === "rwa" ? counterpartTokens(exSourceTokens, exToToken) : exSourceTokens, [exProduct, exSourceTokens, exToToken]);
4062
+ const exToPicker = react.useMemo(() => exProduct === "rwa" ? counterpartTokens(exchangeTokens, exFromToken) : exchangeTokens, [exProduct, exchangeTokens, exFromToken]);
4063
+ const exRwaSeeded = react.useRef(false);
4064
+ react.useEffect(() => {
4065
+ if (isPay || exProduct !== "rwa" || exRwaSeeded.current) return;
4066
+ if (props.defaultFromAsset || props.defaultToAsset || !catalogue?.ready) return;
4067
+ const stable = exSourceTokens.find((t) => Number(t.chainId) === 42161 && symbolKey(t.symbol) === "USDC") ?? exSourceTokens.find((t) => assetClassOf(t.symbol) === "stable");
4068
+ const rwa = exchangeTokens.find((t) => assetClassOf(t.symbol) === "rwa");
4069
+ if (!stable || !rwa) return;
4070
+ exRwaSeeded.current = true;
4071
+ setExFrom({ chainId: Number(stable.chainId), symbol: symbolKey(stable.symbol) });
4072
+ setExTo({ chainId: Number(rwa.chainId), symbol: symbolKey(rwa.symbol) });
4073
+ }, [isPay, exProduct, catalogue, exSourceTokens, exchangeTokens, props.defaultFromAsset, props.defaultToAsset]);
4074
+ const exDestinationStates = react.useMemo(() => {
4075
+ if (!catalogue?.ready) return void 0;
4076
+ const states = {};
4077
+ for (const token of catalogue.tokens) {
4078
+ const key = balanceKey(Number(token.chainId), token.address);
4079
+ const measured = exFromToken ? brokenLaneFor(token, exFromToken, catalogue.brokenLanes) : void 0;
4080
+ if (measured) {
4081
+ states[key] = { disabled: true, reason: brokenLaneReason(measured), hint: "Unavailable" };
4082
+ continue;
4083
+ }
4084
+ const verdict = destinationAvailability(token, catalogue, exFromToken);
4085
+ if (verdict === "available") continue;
4086
+ states[key] = {
4087
+ disabled: true,
4088
+ reason: verdict === "hub-only" ? `${token.symbol} cannot be delivered on this chain.` : "ZeroDelta cannot deliver this asset here.",
4089
+ hint: verdict === "hub-only" ? "Not here" : "Unavailable"
4090
+ };
4091
+ }
4092
+ return states;
4093
+ }, [catalogue, exFromToken]);
3699
4094
  const exFromBal = exFrom && exFromToken ? exBalances[balanceKey(exFrom.chainId, exFromToken.address)] : void 0;
3700
4095
  const fundingTokens = react.useMemo(() => {
3701
4096
  const seen = /* @__PURE__ */ new Set();
@@ -3943,8 +4338,10 @@ function PaymentIsland(props) {
3943
4338
  {
3944
4339
  title: isFrom ? "Exchange from" : "Exchange to",
3945
4340
  chains,
3946
- tokens: exchangeTokens,
4341
+ tokens: isFrom ? exFromPicker : exToPicker,
3947
4342
  balances: exBalances,
4343
+ optionStates: isFrom ? void 0 : exDestinationStates,
4344
+ loading: !catalogue?.ready,
3948
4345
  onBack: () => closeSelector(openerRef),
3949
4346
  onPick: (pick) => {
3950
4347
  (isFrom ? setExFrom : setExTo)({ chainId: pick.chainId, symbol: symbolKey(pick.symbol) });
@@ -4162,8 +4559,8 @@ function PaymentIsland(props) {
4162
4559
  ) }) })
4163
4560
  ] }) });
4164
4561
  }
4165
- var STABLES2 = /* @__PURE__ */ new Set(["USDC", "USDT", "USDE"]);
4166
- var DEFAULT_FUNDING_ASSETS = ["USDC", "USDT", "USDE"];
4562
+ var STABLES2 = EXECUTABLE_STABLE_ASSETS;
4563
+ var DEFAULT_FUNDING_ASSETS = [...EXECUTABLE_STABLE_ASSETS];
4167
4564
  function CheckGlyph3() {
4168
4565
  return /* @__PURE__ */ jsxRuntime.jsx(
4169
4566
  "svg",
@@ -4268,23 +4665,22 @@ function StableGeniePay(props) {
4268
4665
  }
4269
4666
  return map;
4270
4667
  }, [annotated, holdings.loading]);
4271
- const [chains, setChains] = react.useState([]);
4272
- const [registryTokens, setRegistryTokens] = react.useState([]);
4668
+ const [catalogue, setCatalogue] = react.useState(null);
4669
+ const chains = react.useMemo(() => {
4670
+ const order = new Map(SUPPORTED_CHAINS.map((id, i) => [id, i]));
4671
+ return [...catalogue?.chains ?? []].sort((a, b) => (order.get(Number(a.chainId)) ?? 99) - (order.get(Number(b.chainId)) ?? 99) || Number(a.chainId) - Number(b.chainId));
4672
+ }, [catalogue]);
4673
+ const registryTokens = react.useMemo(() => catalogue?.tokens ?? [], [catalogue]);
4273
4674
  react.useEffect(() => {
4274
4675
  if (props.variant === "pill") return;
4275
4676
  let alive = true;
4276
- Promise.all([engine.fetchChains().catch(() => []), engine.fetchTokens().catch(() => [])]).then(([cs, ts]) => {
4277
- if (!alive) return;
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))));
4677
+ engine.fetchCatalogue().then((next) => {
4678
+ if (alive) setCatalogue(next);
4283
4679
  });
4284
4680
  return () => {
4285
4681
  alive = false;
4286
4682
  };
4287
- }, [engine]);
4683
+ }, [engine, props.variant]);
4288
4684
  const fundingTokens = react.useMemo(() => {
4289
4685
  const seen = /* @__PURE__ */ new Set();
4290
4686
  const list = [];
@@ -4463,8 +4859,8 @@ function StableGeniePay(props) {
4463
4859
  ) })
4464
4860
  ] }) }) });
4465
4861
  }
4466
- var chainOptions = SUPPORTED_CHAINS.map((c) => ({ value: c, label: CHAIN_LABELS[c] || `Chain ${c}` }));
4467
- var assetOptions = SUPPORTED_ASSETS2.map((a) => ({ value: a, label: a }));
4862
+ var sourceChainOptions = SUPPORTED_CHAINS.map((c) => ({ value: c, label: CHAIN_LABELS[c] || `Chain ${c}` }));
4863
+ var bundledAssetOptions = SUPPORTED_ASSETS2.map((a) => ({ value: a, label: a }));
4468
4864
  function CheckGlyph4() {
4469
4865
  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
4866
  }
@@ -4477,6 +4873,33 @@ function StableGenieSwap(props) {
4477
4873
  const [toChainId, setToChainId] = react.useState(props.defaultToChainId ?? 8453);
4478
4874
  const [toAsset, setToAsset] = react.useState(props.defaultToAsset ?? "USDC");
4479
4875
  const [amount, setAmount] = react.useState(props.defaultAmount ?? "");
4876
+ const [catalogue, setCatalogue] = react.useState(null);
4877
+ react.useEffect(() => {
4878
+ if (props.variant === "pill") return;
4879
+ let alive = true;
4880
+ engine.fetchCatalogue().then((next) => {
4881
+ if (alive && next.ready) setCatalogue(next);
4882
+ });
4883
+ return () => {
4884
+ alive = false;
4885
+ };
4886
+ }, [engine, props.variant]);
4887
+ const assetOptions = react.useMemo(() => {
4888
+ if (!catalogue) return bundledAssetOptions;
4889
+ const symbols = [...new Set(catalogue.tokens.map((t) => t.symbol.toUpperCase()))];
4890
+ const ordered = [...SUPPORTED_ASSETS2.filter((a) => symbols.includes(a)), ...symbols.filter((s) => !SUPPORTED_ASSETS2.includes(s))];
4891
+ return ordered.length ? ordered.map((a) => ({ value: a, label: a })) : bundledAssetOptions;
4892
+ }, [catalogue]);
4893
+ const toChainOptions = react.useMemo(() => {
4894
+ if (!catalogue) return sourceChainOptions;
4895
+ const ids = [...catalogue.chainIds].sort((a, b) => {
4896
+ const ai = SUPPORTED_CHAINS.indexOf(a);
4897
+ const bi = SUPPORTED_CHAINS.indexOf(b);
4898
+ if (ai !== bi) return (ai < 0 ? 999 : ai) - (bi < 0 ? 999 : bi);
4899
+ return a - b;
4900
+ });
4901
+ return ids.map((c) => ({ value: c, label: CHAIN_LABELS[c] || `Chain ${c}` }));
4902
+ }, [catalogue]);
4480
4903
  const amountValid = /^\d+(\.\d+)?$/.test(amount.replace(",", ".")) && Number(amount.replace(",", ".")) > 0;
4481
4904
  const enabled = amountValid && props.variant !== "pill";
4482
4905
  const paramsKey = `${fromChainId}|${fromAsset}|${toChainId}|${toAsset}|${amount}|${props.recipient ?? ""}`;
@@ -4553,7 +4976,7 @@ function StableGenieSwap(props) {
4553
4976
  /* @__PURE__ */ jsxRuntime.jsx(AmountInput, { value: amount, onChange: setAmount, disabled: submitting }),
4554
4977
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-row", style: { marginTop: 8 }, children: [
4555
4978
  /* @__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: chainOptions, disabled: submitting }) })
4979
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-grow", children: /* @__PURE__ */ jsxRuntime.jsx(Select, { value: fromChainId, onChange: (v) => setFromChainId(Number(v)), options: sourceChainOptions, disabled: submitting }) })
4557
4980
  ] })
4558
4981
  ] }),
4559
4982
  /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-reverse", onClick: reverse, "aria-label": "Reverse", disabled: submitting, children: "\u2193" }),
@@ -4562,7 +4985,7 @@ function StableGenieSwap(props) {
4562
4985
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-anchor sg-mono", children: toValue }),
4563
4986
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-row", style: { marginTop: 8 }, children: [
4564
4987
  /* @__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: chainOptions, disabled: submitting }) })
4988
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-grow", children: /* @__PURE__ */ jsxRuntime.jsx(Select, { value: toChainId, onChange: (v) => setToChainId(Number(v)), options: toChainOptions, disabled: submitting }) })
4566
4989
  ] })
4567
4990
  ] }),
4568
4991
  flow.status === "error" && flow.error ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: flow.error }) : null,
@@ -4574,7 +4997,6 @@ function StableGenieSwap(props) {
4574
4997
  ] })
4575
4998
  ] });
4576
4999
  }
4577
- var STABLE_ASSETS = ["USDC", "USDT", "USDE"];
4578
5000
  var FIAT = [
4579
5001
  { code: "USD", glyph: "$", label: "US Dollar" },
4580
5002
  { code: "EUR", glyph: "\u20AC", label: "Euro" },
@@ -4617,24 +5039,25 @@ function StableGenieExchange(props) {
4617
5039
  const mode = props.mode ?? "exchange";
4618
5040
  const wide = props.variant === "wide";
4619
5041
  const isPill = props.variant === "pill";
4620
- const allowed = react.useMemo(() => (props.assets?.length ? props.assets : STABLE_ASSETS).map((a) => symbolKey(a)), [props.assets]);
4621
- const [chains, setChains] = react.useState([]);
4622
- const [tokens, setTokens] = react.useState([]);
5042
+ const product = props.product ?? "stable";
5043
+ const allowed = react.useMemo(() => props.assets?.length ? props.assets.map((a) => symbolKey(a)) : void 0, [props.assets]);
5044
+ const [catalogue, setCatalogue] = react.useState(null);
4623
5045
  react.useEffect(() => {
4624
5046
  if (isPill) return;
4625
5047
  let alive = true;
4626
- Promise.all([engine.fetchChains().catch(() => []), engine.fetchTokens().catch(() => [])]).then(([cs, ts]) => {
4627
- if (!alive) return;
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))));
5048
+ engine.fetchCatalogue(allowed, product).then((next) => {
5049
+ if (alive) setCatalogue(next);
4633
5050
  });
4634
5051
  return () => {
4635
5052
  alive = false;
4636
5053
  };
4637
- }, [engine, allowed]);
5054
+ }, [engine, allowed, product, isPill]);
5055
+ const chains = react.useMemo(() => {
5056
+ const order = new Map(SUPPORTED_CHAINS.map((id, i) => [id, i]));
5057
+ return [...catalogue?.chains ?? []].sort((a, b) => (order.get(Number(a.chainId)) ?? 99) - (order.get(Number(b.chainId)) ?? 99) || Number(a.chainId) - Number(b.chainId));
5058
+ }, [catalogue]);
5059
+ const tokens = react.useMemo(() => catalogue?.tokens ?? [], [catalogue]);
5060
+ const sourceTokens = react.useMemo(() => catalogue?.sources ?? [], [catalogue]);
4638
5061
  const [view, setView] = react.useState("main");
4639
5062
  const [hist, setHist] = react.useState(null);
4640
5063
  const histBtnRef = react.useRef(null);
@@ -4644,19 +5067,53 @@ function StableGenieExchange(props) {
4644
5067
  };
4645
5068
  react.useEffect(() => setHist(null), [wallet.account]);
4646
5069
  const [from, setFrom] = react.useState(
4647
- () => props.defaultFromChainId && props.defaultFromAsset && allowed.includes(symbolKey(props.defaultFromAsset)) ? { chainId: props.defaultFromChainId, symbol: symbolKey(props.defaultFromAsset) } : null
5070
+ () => props.defaultFromChainId && props.defaultFromAsset ? { chainId: props.defaultFromChainId, symbol: symbolKey(props.defaultFromAsset) } : null
4648
5071
  );
4649
5072
  const [to, setTo] = react.useState(
4650
- () => props.defaultToChainId && props.defaultToAsset && allowed.includes(symbolKey(props.defaultToAsset)) ? { chainId: props.defaultToChainId, symbol: symbolKey(props.defaultToAsset) } : null
5073
+ () => props.defaultToChainId && props.defaultToAsset ? { chainId: props.defaultToChainId, symbol: symbolKey(props.defaultToAsset) } : null
4651
5074
  );
4652
5075
  const [amount, setAmount] = react.useState(props.defaultAmount ?? "");
4653
5076
  const [fiatCurrency, setFiatCurrency] = react.useState(props.fiatCurrency ?? "EUR");
4654
5077
  const fromToken = react.useMemo(() => from ? findToken(tokens, from.chainId, from.symbol) : null, [tokens, from]);
4655
5078
  const toToken = react.useMemo(() => to ? findToken(tokens, to.chainId, to.symbol) : null, [tokens, to]);
5079
+ const toSymbol = toToken?.symbol ?? to?.symbol ?? "";
5080
+ const fromPickerTokens = react.useMemo(() => product === "rwa" ? counterpartTokens(sourceTokens, toToken) : sourceTokens, [product, sourceTokens, toToken]);
5081
+ const toPickerTokens = react.useMemo(() => product === "rwa" ? counterpartTokens(tokens, fromToken) : tokens, [product, tokens, fromToken]);
5082
+ const rwaSeeded = react.useRef(false);
5083
+ react.useEffect(() => {
5084
+ if (product !== "rwa" || rwaSeeded.current) return;
5085
+ if (props.defaultFromAsset || props.defaultToAsset || !catalogue?.ready) return;
5086
+ const stable = sourceTokens.find((t) => Number(t.chainId) === 42161 && symbolKey(t.symbol) === "USDC") ?? sourceTokens.find((t) => assetClassOf(t.symbol) === "stable");
5087
+ const rwa = tokens.find((t) => assetClassOf(t.symbol) === "rwa");
5088
+ if (!stable || !rwa) return;
5089
+ rwaSeeded.current = true;
5090
+ setFrom({ chainId: Number(stable.chainId), symbol: symbolKey(stable.symbol) });
5091
+ setTo({ chainId: Number(rwa.chainId), symbol: symbolKey(rwa.symbol) });
5092
+ }, [product, catalogue, sourceTokens, tokens, props.defaultFromAsset, props.defaultToAsset]);
5093
+ const destinationStates = react.useMemo(() => {
5094
+ if (!catalogue?.ready) return void 0;
5095
+ const states = {};
5096
+ for (const token of catalogue.tokens) {
5097
+ const key = `${Number(token.chainId)}:${String(token.address || "").toLowerCase()}`;
5098
+ const measured = fromToken ? brokenLaneFor(token, fromToken, catalogue.brokenLanes) : void 0;
5099
+ if (measured) {
5100
+ states[key] = { disabled: true, reason: brokenLaneReason(measured), hint: "Unavailable" };
5101
+ continue;
5102
+ }
5103
+ const verdict = destinationAvailability(token, catalogue, fromToken);
5104
+ if (verdict === "available") continue;
5105
+ states[key] = {
5106
+ disabled: true,
5107
+ reason: verdict === "hub-only" ? `${token.symbol} cannot be delivered on this chain \u2014 choose an execution chain.` : "ZeroDelta cannot deliver this asset here.",
5108
+ hint: verdict === "hub-only" ? "Not here" : "Unavailable"
5109
+ };
5110
+ }
5111
+ return states;
5112
+ }, [catalogue, fromToken]);
4656
5113
  const normalizedAmount = normalizeDecimalText(amount);
4657
5114
  const amountValid = /^\d+(\.\d+)?$/.test(normalizedAmount) && Number(normalizedAmount) > 0 && Number(normalizedAmount) <= 1e9;
4658
5115
  const rampMode = mode !== "exchange";
4659
- const inUniverse = (p) => Boolean(p && allowed.includes(p.symbol));
5116
+ const inUniverse = (p) => Boolean(p && tokens.some((t) => Number(t.chainId) === p.chainId && symbolKey(t.symbol) === p.symbol));
4660
5117
  const cryptoReady = rampMode ? inUniverse(mode === "onramp" ? to : from) : inUniverse(from) && inUniverse(to);
4661
5118
  const quotable = mode === "exchange" && inUniverse(from) && inUniverse(to) && amountValid;
4662
5119
  const [balances, setBalances] = react.useState({});
@@ -4679,7 +5136,7 @@ function StableGenieExchange(props) {
4679
5136
  });
4680
5137
  }, [engine, wallet.account, tokens]);
4681
5138
  const fromBal = from && fromToken ? balances[balanceKey(from.chainId, fromToken.address)] : void 0;
4682
- const paramsKey = `${mode}|${from?.chainId}|${from?.symbol}|${to?.chainId}|${to?.symbol}|${normalizedAmount}|${props.recipient ?? ""}`;
5139
+ const paramsKey = `${mode}|${from?.chainId}|${from?.symbol}|${to?.chainId}|${toSymbol}|${normalizedAmount}|${props.recipient ?? ""}`;
4683
5140
  const flow = useFlow({
4684
5141
  engine,
4685
5142
  wallet,
@@ -4751,8 +5208,10 @@ function StableGenieExchange(props) {
4751
5208
  {
4752
5209
  title: isFrom ? "Exchange from" : "Exchange to",
4753
5210
  chains,
4754
- tokens,
5211
+ tokens: isFrom ? fromPickerTokens : toPickerTokens,
4755
5212
  balances,
5213
+ optionStates: isFrom ? void 0 : destinationStates,
5214
+ loading: !catalogue?.ready,
4756
5215
  onBack: () => closeSelector(isFrom),
4757
5216
  onPick: (pick) => {
4758
5217
  (isFrom ? setFrom : setTo)({ chainId: pick.chainId, symbol: symbolKey(pick.symbol) });
@@ -4767,7 +5226,7 @@ function StableGenieExchange(props) {
4767
5226
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-amt sg-mono", children: [
4768
5227
  receive,
4769
5228
  " ",
4770
- to?.symbol
5229
+ toSymbol
4771
5230
  ] }),
4772
5231
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
4773
5232
  flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
@@ -4808,7 +5267,7 @@ function StableGenieExchange(props) {
4808
5267
  !rampMode && quoteError && !wide ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: quoteError }) : null,
4809
5268
  !rampMode && !wide && quotable && !quoteError ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-panel", style: { marginTop: 12 }, children: [
4810
5269
  /* @__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} ${to?.symbol}` : "\u2014" }),
5270
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-anchor sg-mono", children: quoting ? "\u2026" : receive ? `${receive} ${toSymbol}` : "\u2014" }),
4812
5271
  meta && !quoting ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-recv-sub", children: [
4813
5272
  "via ",
4814
5273
  meta.bridge,
@@ -4856,7 +5315,7 @@ function StableGenieExchange(props) {
4856
5315
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-recv-amt sg-mono", children: [
4857
5316
  receive,
4858
5317
  " ",
4859
- to?.symbol
5318
+ toSymbol
4860
5319
  ] }),
4861
5320
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-recv-sub", children: [
4862
5321
  "on ",
@@ -4907,22 +5366,37 @@ function StableGenieExchange(props) {
4907
5366
  ] })
4908
5367
  ] }) });
4909
5368
  }
5369
+ function StableGenieRwaExchange(props) {
5370
+ return /* @__PURE__ */ jsxRuntime.jsx(StableGenieExchange, { ...props, product: "rwa" });
5371
+ }
4910
5372
  function mount(el, config) {
4911
5373
  const root = client.createRoot(el);
4912
5374
  const variant = config.variant ?? "pay";
4913
- const Comp = variant === "swap" ? StableGenieSwap : variant === "exchange" ? StableGenieExchange : StableGeniePay;
5375
+ const isExchange = variant === "exchange" || variant === "rwa";
5376
+ const Comp = variant === "swap" ? StableGenieSwap : isExchange ? StableGenieExchange : StableGeniePay;
4914
5377
  const { variant: _variant, ...props } = config;
4915
- root.render(react.createElement(Comp, props));
5378
+ root.render(react.createElement(Comp, variant === "rwa" ? { ...props, product: "rwa" } : props));
4916
5379
  return () => root.unmount();
4917
5380
  }
4918
5381
 
5382
+ exports.EXECUTABLE_STABLE_ASSETS = EXECUTABLE_STABLE_ASSETS;
4919
5383
  exports.PaymentIsland = PaymentIsland;
5384
+ exports.STABLE_ASSETS = STABLE_ASSETS;
5385
+ exports.SUPPORTED_ASSETS = SUPPORTED_ASSETS;
5386
+ exports.SUPPORTED_CHAIN_IDS = SUPPORTED_CHAIN_IDS;
4920
5387
  exports.StableGenieExchange = StableGenieExchange;
4921
5388
  exports.StableGeniePay = StableGeniePay;
4922
5389
  exports.StableGenieProvider = StableGenieProvider;
5390
+ exports.StableGenieRwaExchange = StableGenieRwaExchange;
4923
5391
  exports.StableGenieSwap = StableGenieSwap;
5392
+ exports.TRADEABLE_RWA_ASSETS = TRADEABLE_RWA_ASSETS;
5393
+ exports.assetClassOf = assetClassOf;
5394
+ exports.brokenLaneReason = brokenLaneReason;
5395
+ exports.counterpartTokens = counterpartTokens;
4924
5396
  exports.createEngine = createEngine;
4925
5397
  exports.darkTheme = darkTheme;
5398
+ exports.destinationAvailability = destinationAvailability;
4926
5399
  exports.lightTheme = lightTheme;
4927
5400
  exports.mount = mount;
4928
5401
  exports.resolveTheme = resolveTheme;
5402
+ exports.symbolKey = symbolKey;