@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.
@@ -1,5 +1,5 @@
1
- import { symbolKey, normalizeDecimalText, parseUnitsDecimal, SUPPORTED_CHAIN_IDS, tokenEnabled, isDeliverable, assetDecimals, findToken, formatUnits, createEngine, routeNativeValue, checkNativeFee, nativeFeeShortLabel, nativeSymbol, nativeFeeShortMessage, allowanceCovers, validatePlannedTransaction, SUPPORTED_ASSETS, BUNDLED_RPC } from './chunk-OOURZ5DL.js';
2
- import { createContext, useMemo, useState, useEffect, useRef, useCallback, useId, createElement, useContext } from 'react';
1
+ import { CHAIN_DISPLAY_NAMES, EXECUTABLE_STABLE_ASSETS, STABLE_ASSETS, SUPPORTED_ASSETS, complianceView, complianceChecks, DIRECT_CHECK_IDS, complianceTagOf, symbolKey, normalizeDecimalText, parseUnitsDecimal, assetDecimals, findToken, counterpartTokens, assetClassOf, brokenLaneFor, brokenLaneReason, destinationAvailability, SUPPORTED_CHAIN_IDS, formatUnits, unattributedComplianceReasons, distinctScreenedWallets, humanizeComplianceReason, DIRECT_SCOPE_NOTE, categoryLabel, SCREENING_BUCKETS, createEngine, routeNativeValue, checkNativeFee, nativeFeeShortLabel, nativeSymbol, nativeFeeShortMessage, allowanceCovers, validatePlannedTransaction, BUNDLED_RPC } from './chunk-FJQQLB2K.js';
2
+ import { createContext, useState, useRef, useEffect, useMemo, useCallback, useId, createElement, useContext } from 'react';
3
3
  import { createRoot } from 'react-dom/client';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
 
@@ -728,7 +728,12 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
728
728
  .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}
729
729
  .sg-back:hover{background:var(--sg-surface)}
730
730
  .sg-sel-title{flex:1 1 auto;text-align:center;font-size:15px;font-weight:600;margin-right:32px}
731
- .sg-chain-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:8px;margin-bottom:12px}
731
+ /* Scrolls at ~2.5 rows. The catalogue's destination chains outnumber its source chains three to one
732
+ (9 escrow chains, ~37 total), so an ungated grid was eight rows tall and pushed the token list \u2014
733
+ the thing the panel exists for \u2014 below the fold. The fade is a scroll affordance, not decoration. */
734
+ .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)}
735
+ /* No mask once everything fits \u2014 a fade under a grid with nothing below it reads as a rendering bug. */
736
+ .sg-chain-grid[data-scroll="false"]{mask-image:none;-webkit-mask-image:none;overflow-y:visible;max-height:none}
732
737
  .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}
733
738
  .sg-chain-chip img{width:22px;height:22px;border-radius:999px;display:block}
734
739
  .sg-chain-chip:hover{border-color:color-mix(in srgb,var(--sg-accent) 45%,var(--sg-border))}
@@ -931,6 +936,98 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
931
936
  .sg-island .sg-spinner{display:none!important}
932
937
  .sg-island .sg-rm-dot{display:inline-block}
933
938
  }
939
+
940
+ /* \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
941
+ Mirrors the dApp's compliance row + details dialog. The row is a quiet affordance in the payment
942
+ summary; the details open a sheet that fills the widget's own card, because a page-level modal
943
+ inside somebody else's checkout is a z-index fight we would lose.
944
+
945
+ Tone note, carried over from the dApp: a PASS reads in body ink, not in green. The shield tick is
946
+ already green, so colouring the sentence too says the same thing twice and spends the accent on
947
+ the half that carries no information. A DENY still shouts. */
948
+ /* NOT positioned. The sheet is inset:0 against the WIDGET CARD, so this wrapper must not become
949
+ the containing block: when it carried position:relative the sheet collapsed to the height of
950
+ this one row and drew straight through the CTA beneath it.
951
+ NB this stylesheet is a JS template literal - never write a backtick in these comments. */
952
+ .sg-cp{margin-top:10px}
953
+ .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}
954
+ .sg-cp-row:hover{border-color:color-mix(in srgb,var(--sg-accent) 40%,var(--sg-border))}
955
+ .sg-cp-row:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px}
956
+ .sg-cp-row-main{display:flex;align-items:center;gap:8px;min-width:0}
957
+ .sg-cp-row-glyph{display:flex;flex:0 0 auto;color:var(--sg-success)}
958
+ .sg-cp-row[data-tone="neutral"] .sg-cp-row-glyph{color:var(--sg-text-muted);opacity:.55}
959
+ .sg-cp-row[data-tone="blocked"] .sg-cp-row-glyph,.sg-cp-row[data-tone="warn"] .sg-cp-row-glyph{color:var(--sg-danger)}
960
+ .sg-cp-row-label{font-size:13px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
961
+ .sg-cp-row[data-tone="neutral"] .sg-cp-row-label{color:var(--sg-text-muted)}
962
+ .sg-cp-row[data-tone="blocked"] .sg-cp-row-label,.sg-cp-row[data-tone="warn"] .sg-cp-row-label{color:var(--sg-danger)}
963
+ .sg-cp-row-chev{display:flex;flex:0 0 auto;color:var(--sg-text-muted)}
964
+ .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)}
965
+
966
+ /* the sheet \u2014 fills the widget card */
967
+ .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}
968
+ @keyframes sg-cp-in{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
969
+ .sg-cp-sheet:focus{outline:none}
970
+ .sg-cp-sheet-head{display:flex;align-items:center;justify-content:space-between;gap:8px;flex:0 0 auto}
971
+ .sg-cp-sheet-title{margin:0;font-size:15px;font-weight:600}
972
+ .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}
973
+ .sg-cp-close:hover{background:var(--sg-surface);color:var(--sg-text)}
974
+ .sg-cp-close:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px}
975
+ .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}
976
+ .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}
977
+ .sg-cp-tab[data-active="true"]{background:color-mix(in srgb,var(--sg-accent) 10%,transparent);color:var(--sg-accent)}
978
+ .sg-cp-tab:focus-visible{outline:2px solid var(--sg-accent);outline-offset:-2px}
979
+ .sg-cp-sheet-body{margin-top:10px}
980
+ .sg-cp-tabpanel{display:flex;flex-direction:column;gap:8px}
981
+
982
+ /* cards */
983
+ .sg-cp-card{display:flex;flex-direction:column;gap:12px;padding:14px;border:1px solid var(--sg-border);border-radius:16px}
984
+ .sg-cp-card-head{display:flex;align-items:center;gap:8px}
985
+ .sg-cp-card-glyph{display:flex;flex:0 0 auto;color:var(--sg-accent)}
986
+ .sg-cp-card-title{margin:0;font-size:14px;font-weight:600}
987
+ .sg-cp-summary{display:flex;flex-direction:column;gap:3px}
988
+ .sg-cp-summary-head{display:flex;align-items:center;gap:8px;color:var(--sg-success)}
989
+ .sg-cp-summary-head[data-tone="neutral"]{color:var(--sg-text-muted)}
990
+ .sg-cp-summary-head[data-tone="blocked"],.sg-cp-summary-head[data-tone="warn"]{color:var(--sg-danger)}
991
+ .sg-cp-summary-title{font-size:14px;font-weight:600;color:var(--sg-text)}
992
+ .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)}
993
+ .sg-cp-summary-sub{margin:0;padding-left:24px;font-size:12px;line-height:1.35;color:var(--sg-text-muted)}
994
+
995
+ /* per-control rows */
996
+ .sg-cp-checks{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:11px}
997
+ .sg-cp-check-head{display:flex;flex-wrap:wrap;align-items:center;gap:6px 14px}
998
+ .sg-cp-check-label{display:flex;align-items:center;gap:8px;min-width:0;font-size:13.5px;line-height:1.25}
999
+ .sg-cp-check[data-ok="false"] .sg-cp-check-label{color:var(--sg-danger)}
1000
+ .sg-cp-check-mark{display:flex;flex:0 0 auto;color:var(--sg-success)}
1001
+ .sg-cp-check-mark[data-ok="false"]{color:var(--sg-danger)}
1002
+ .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}
1003
+ .sg-cp-check-reason{color:var(--sg-danger)}
1004
+ .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}
1005
+ .sg-cp-link:hover{text-decoration:underline}
1006
+ .sg-cp-link:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px;border-radius:4px}
1007
+ .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)}
1008
+ .sg-cp-scope{margin:0;font-size:11.5px;line-height:1.45;color:var(--sg-text-muted)}
1009
+ .sg-cp-flags{margin:0;font-size:13px}
1010
+
1011
+ /* quote details */
1012
+ .sg-cp-facts{margin:0;display:flex;flex-direction:column;gap:9px}
1013
+ .sg-cp-fact{display:grid;grid-template-columns:78px minmax(0,1fr);align-items:center;gap:10px}
1014
+ .sg-cp-fact dt{font-size:12px;color:var(--sg-text-muted)}
1015
+ .sg-cp-fact dd{margin:0;font-size:13px;min-width:0;overflow-wrap:anywhere}
1016
+
1017
+ /* screening policy */
1018
+ .sg-cp-policy-head{display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:space-between;gap:8px;padding-bottom:2px}
1019
+ .sg-cp-policy-id{font-size:11px;color:var(--sg-text-muted);overflow-wrap:anywhere}
1020
+ .sg-cp-policy-facts{padding:2px 0 8px}
1021
+ .sg-cp-buckets{display:flex;flex-direction:column;gap:8px}
1022
+ .sg-cp-bucket{gap:10px;padding:12px 14px}
1023
+ .sg-cp-bucket-head{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:4px 10px}
1024
+ .sg-cp-bucket-detail{font-size:11.5px;color:var(--sg-text-muted)}
1025
+ .sg-cp-cats{list-style:none;margin:0;padding:0 0 0 4px;display:flex;flex-direction:column;gap:5px}
1026
+ .sg-cp-cats li{display:flex;align-items:center;gap:10px;font-size:12.5px;line-height:1.35}
1027
+ .sg-cp-dot{flex:0 0 auto;width:4px;height:4px;border-radius:999px;background:var(--sg-accent);opacity:.8}
1028
+
1029
+ /* express (PaymentIsland) trims the card padding, so the sheet follows */
1030
+ @media (prefers-reduced-motion:reduce){.sg-cp-sheet{animation:none}}
934
1031
  `;
935
1032
  var injected = false;
936
1033
  function injectStyles() {
@@ -1088,7 +1185,7 @@ function shortAddress(a) {
1088
1185
  if (!a) return "";
1089
1186
  return `${a.slice(0, 6)}\u2026${a.slice(-4)}`;
1090
1187
  }
1091
- var CHAIN_LABELS = {
1188
+ var SOURCE_CHAIN_LABELS = {
1092
1189
  1: "Ethereum",
1093
1190
  10: "Optimism",
1094
1191
  130: "Unichain",
@@ -1099,8 +1196,14 @@ var CHAIN_LABELS = {
1099
1196
  42161: "Arbitrum",
1100
1197
  98866: "Plume"
1101
1198
  };
1199
+ var CHAIN_LABELS = { ...CHAIN_DISPLAY_NAMES, ...SOURCE_CHAIN_LABELS };
1102
1200
  var SUPPORTED_CHAINS = [1, 10, 42161, 8453, 57073, 130, 9745, 146, 98866];
1103
- var SUPPORTED_ASSETS2 = ["USDC", "USDT", "USDE", "XAUT"];
1201
+ var SUPPORTED_ASSETS2 = [
1202
+ ...EXECUTABLE_STABLE_ASSETS,
1203
+ ...[...STABLE_ASSETS].filter((a) => !EXECUTABLE_STABLE_ASSETS.has(a)),
1204
+ ...[...SUPPORTED_ASSETS].filter((a) => !STABLE_ASSETS.has(a))
1205
+ ];
1206
+ [...EXECUTABLE_STABLE_ASSETS];
1104
1207
  function Button(props) {
1105
1208
  const soft = !!props.softDisabled && !props.disabled;
1106
1209
  const nativeDisabled = props.disabled || props.busy && !props.softDisabled;
@@ -1290,6 +1393,251 @@ function RouteList(props) {
1290
1393
  ] }) : null
1291
1394
  ] });
1292
1395
  }
1396
+ function ShieldTick({ size = 16 }) {
1397
+ return /* @__PURE__ */ jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
1398
+ /* @__PURE__ */ 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" }),
1399
+ /* @__PURE__ */ 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" }),
1400
+ /* @__PURE__ */ jsx("path", { d: "m8.6 11.9 2.3 2.3 4.5-4.5", stroke: "currentColor", strokeWidth: "1.9", strokeLinecap: "round", strokeLinejoin: "round" })
1401
+ ] });
1402
+ }
1403
+ function TickCircle({ size = 16 }) {
1404
+ return /* @__PURE__ */ jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
1405
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor" }),
1406
+ /* @__PURE__ */ 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" })
1407
+ ] });
1408
+ }
1409
+ function CloseCircle({ size = 16 }) {
1410
+ return /* @__PURE__ */ jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
1411
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor" }),
1412
+ /* @__PURE__ */ 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" })
1413
+ ] });
1414
+ }
1415
+ function PendingCircle({ size = 16 }) {
1416
+ return /* @__PURE__ */ jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
1417
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "9.2", stroke: "currentColor", strokeWidth: "1.6", strokeDasharray: "3 3" }),
1418
+ /* @__PURE__ */ jsx("path", { d: "M8.5 12h7", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round" })
1419
+ ] });
1420
+ }
1421
+ function Tick({ size = 12 }) {
1422
+ return /* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "m4.5 12.8 5 5L19.5 6.5", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round" }) });
1423
+ }
1424
+ function Cross({ size = 12 }) {
1425
+ return /* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "m5.5 5.5 13 13M18.5 5.5l-13 13", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round" }) });
1426
+ }
1427
+ function Chevron({ size = 16 }) {
1428
+ return /* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "m9 5 7 7-7 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
1429
+ }
1430
+ function Info({ size = 16 }) {
1431
+ return /* @__PURE__ */ jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
1432
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor" }),
1433
+ /* @__PURE__ */ jsx("path", { d: "M12 10.6v6", stroke: "var(--sg-bg)", strokeWidth: "2.1", strokeLinecap: "round" }),
1434
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "7.6", r: "1.25", fill: "var(--sg-bg)" })
1435
+ ] });
1436
+ }
1437
+ function Lock({ size = 16 }) {
1438
+ return /* @__PURE__ */ jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
1439
+ /* @__PURE__ */ jsx("rect", { x: "4.5", y: "10.5", width: "15", height: "9.5", rx: "2.2", stroke: "currentColor", strokeWidth: "1.7" }),
1440
+ /* @__PURE__ */ jsx("path", { d: "M8 10.5V7.8a4 4 0 0 1 8 0v2.7", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round" })
1441
+ ] });
1442
+ }
1443
+ function ShieldOutline({ size = 16 }) {
1444
+ return /* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ 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" }) });
1445
+ }
1446
+ function WarningFilled({ size = 16 }) {
1447
+ return /* @__PURE__ */ jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
1448
+ /* @__PURE__ */ jsx("path", { d: "M12 3.2 21.4 19.4H2.6L12 3.2Z", fill: "currentColor" }),
1449
+ /* @__PURE__ */ jsx("path", { d: "M12 9.4v4.3", stroke: "var(--sg-bg)", strokeWidth: "1.9", strokeLinecap: "round" }),
1450
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "16.4", r: "1.05", fill: "var(--sg-bg)" })
1451
+ ] });
1452
+ }
1453
+ function CornerArrow({ size = 12 }) {
1454
+ return /* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M7 17 17 7M9 7h8v8", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round" }) });
1455
+ }
1456
+ var POLICY_GLYPH = {
1457
+ "always-blocked": Lock,
1458
+ blocked: ShieldOutline,
1459
+ flagged: WarningFilled
1460
+ };
1461
+ var POLICY_DETAIL = {
1462
+ "always-blocked": "Cannot be changed or disabled",
1463
+ blocked: "Stops the payment",
1464
+ flagged: "Does not automatically block"
1465
+ };
1466
+ function shortAddr(a) {
1467
+ return a.length > 14 ? `${a.slice(0, 6)}\u2026${a.slice(-4)}` : a;
1468
+ }
1469
+ function TriggerGlyph({ cv }) {
1470
+ if (cv.tone === "blocked" || cv.tone === "warn") return /* @__PURE__ */ jsx(CloseCircle, {});
1471
+ return /* @__PURE__ */ jsx(ShieldTick, {});
1472
+ }
1473
+ function CheckRow({ check, onViewPolicy }) {
1474
+ const label = check.id === "risk" ? check.ok ? "Risk screening passed" : "Risk screening failed" : check.label;
1475
+ return /* @__PURE__ */ jsxs("li", { className: "sg-cp-check", "data-ok": check.ok, children: [
1476
+ /* @__PURE__ */ jsxs("div", { className: "sg-cp-check-head", children: [
1477
+ /* @__PURE__ */ jsxs("span", { className: "sg-cp-check-label", children: [
1478
+ /* @__PURE__ */ jsx("span", { className: "sg-cp-check-mark", "data-ok": check.ok, children: check.ok ? /* @__PURE__ */ jsx(Tick, {}) : /* @__PURE__ */ jsx(Cross, {}) }),
1479
+ /* @__PURE__ */ jsx("span", { children: label }),
1480
+ /* @__PURE__ */ jsx("span", { className: "sg-sr-only", children: check.ok ? " \u2014 passed" : " \u2014 failed" })
1481
+ ] }),
1482
+ check.id === "risk" ? /* @__PURE__ */ jsxs("button", { type: "button", className: "sg-cp-link", onClick: onViewPolicy, children: [
1483
+ "View policy",
1484
+ /* @__PURE__ */ jsx(CornerArrow, {})
1485
+ ] }) : null
1486
+ ] }),
1487
+ check.note ? /* @__PURE__ */ jsx("span", { className: "sg-cp-check-note", children: check.note }) : null,
1488
+ check.reasons.map((reason) => /* @__PURE__ */ jsx("span", { className: "sg-cp-check-reason", children: humanizeComplianceReason(reason) }, reason))
1489
+ ] });
1490
+ }
1491
+ function QuoteChecks({
1492
+ compliance,
1493
+ cv,
1494
+ checks,
1495
+ direct,
1496
+ onViewPolicy
1497
+ }) {
1498
+ const allPassed = cv.tone === "ok" && checks.length > 0 && checks.every((c) => c.ok);
1499
+ const summary = allPassed ? "All checks passed" : cv.label;
1500
+ const orphans = unattributedComplianceReasons(compliance, cv);
1501
+ const wallets = distinctScreenedWallets(compliance);
1502
+ const jurisdiction = compliance?.sourceJurisdiction?.trim();
1503
+ const hasDetails = Boolean(jurisdiction || wallets.length || compliance?.checkId);
1504
+ return /* @__PURE__ */ jsxs("div", { className: "sg-cp-tabpanel", role: "tabpanel", "aria-label": "Quote checks", children: [
1505
+ /* @__PURE__ */ jsxs("section", { className: "sg-cp-card", children: [
1506
+ /* @__PURE__ */ jsxs("div", { className: "sg-cp-summary", children: [
1507
+ /* @__PURE__ */ jsxs("span", { className: "sg-cp-summary-head", "data-tone": cv.tone, children: [
1508
+ cv.tone === "blocked" || cv.tone === "warn" ? /* @__PURE__ */ jsx(CloseCircle, {}) : cv.tone === "neutral" ? /* @__PURE__ */ jsx(PendingCircle, {}) : /* @__PURE__ */ jsx(TickCircle, {}),
1509
+ /* @__PURE__ */ jsx("span", { className: "sg-cp-summary-title", children: summary })
1510
+ ] }),
1511
+ checks.length > 0 ? /* @__PURE__ */ jsxs("p", { className: "sg-cp-summary-sub", children: [
1512
+ checks.length,
1513
+ " check",
1514
+ checks.length === 1 ? " was" : "s were",
1515
+ " completed for this payment"
1516
+ ] }) : (
1517
+ // No decision was issued. Listing the controls here would be ticks for a verdict nobody
1518
+ // gave, and an unconfigured gate is not a set of passed checks.
1519
+ /* @__PURE__ */ 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." })
1520
+ )
1521
+ ] }),
1522
+ checks.length > 0 ? /* @__PURE__ */ jsx("ul", { className: "sg-cp-checks", children: checks.map((check) => /* @__PURE__ */ jsx(CheckRow, { check, onViewPolicy }, check.id)) }) : null,
1523
+ orphans.length > 0 ? /* @__PURE__ */ jsx("ul", { className: "sg-cp-orphans", children: orphans.map((reason) => /* @__PURE__ */ jsx("li", { children: humanizeComplianceReason(reason) }, reason)) }) : null,
1524
+ direct && checks.length > 0 ? /* @__PURE__ */ jsx("p", { className: "sg-cp-scope", children: DIRECT_SCOPE_NOTE }) : null
1525
+ ] }),
1526
+ compliance?.flaggedCategories?.length ? /* @__PURE__ */ jsxs("section", { className: "sg-cp-card", children: [
1527
+ /* @__PURE__ */ jsxs("div", { className: "sg-cp-card-head", children: [
1528
+ /* @__PURE__ */ jsx("span", { className: "sg-cp-card-glyph", children: /* @__PURE__ */ jsx(WarningFilled, {}) }),
1529
+ /* @__PURE__ */ jsx("h5", { className: "sg-cp-card-title", children: "Flagged, not blocking" })
1530
+ ] }),
1531
+ /* @__PURE__ */ jsx("p", { className: "sg-cp-flags", children: compliance.flaggedCategories.map(categoryLabel).join(" \xB7 ") }),
1532
+ /* @__PURE__ */ jsx("p", { className: "sg-cp-scope", children: "The policy records these and still allows the payment. They do not stop settlement." })
1533
+ ] }) : null,
1534
+ hasDetails ? /* @__PURE__ */ jsxs("section", { className: "sg-cp-card", children: [
1535
+ /* @__PURE__ */ jsxs("div", { className: "sg-cp-card-head", children: [
1536
+ /* @__PURE__ */ jsx("span", { className: "sg-cp-card-glyph", children: /* @__PURE__ */ jsx(Info, {}) }),
1537
+ /* @__PURE__ */ jsx("h5", { className: "sg-cp-card-title", children: "Quote details" })
1538
+ ] }),
1539
+ /* @__PURE__ */ jsxs("dl", { className: "sg-cp-facts", children: [
1540
+ jurisdiction ? /* @__PURE__ */ jsx(Fact, { label: "Jurisdiction", value: jurisdiction }) : null,
1541
+ wallets.map((w, i) => /* @__PURE__ */ jsx(Fact, { label: wallets.length > 1 ? i === 0 ? "Payer" : "Recipient" : "Wallet", value: shortAddr(w), title: w, mono: true }, w)),
1542
+ compliance?.checkId ? /* @__PURE__ */ jsx(Fact, { label: "Check ID", value: compliance.checkId, mono: true }) : null
1543
+ ] })
1544
+ ] }) : null
1545
+ ] });
1546
+ }
1547
+ function Fact({ label, value, title, mono = false }) {
1548
+ return /* @__PURE__ */ jsxs("div", { className: "sg-cp-fact", children: [
1549
+ /* @__PURE__ */ jsx("dt", { children: label }),
1550
+ /* @__PURE__ */ jsx("dd", { title, className: mono ? "sg-mono" : void 0, children: value })
1551
+ ] });
1552
+ }
1553
+ function ScreeningPolicy({ compliance }) {
1554
+ const policyId = compliance?.policyVersion?.trim();
1555
+ const applied = Boolean(compliance?.decision || policyId || compliance?.appliedPolicyNames?.length);
1556
+ const names = [...compliance?.appliedPolicyNames ?? [], ...compliance?.appliedLegislation ?? []];
1557
+ return /* @__PURE__ */ jsxs("div", { className: "sg-cp-tabpanel", role: "tabpanel", "aria-label": "Screening policy", children: [
1558
+ /* @__PURE__ */ jsxs("div", { className: "sg-cp-policy-head", children: [
1559
+ /* @__PURE__ */ jsxs("div", { className: "sg-cp-summary", children: [
1560
+ /* @__PURE__ */ jsxs("span", { className: "sg-cp-summary-head", "data-tone": applied ? "ok" : "neutral", children: [
1561
+ applied ? /* @__PURE__ */ jsx(TickCircle, {}) : /* @__PURE__ */ jsx(PendingCircle, {}),
1562
+ /* @__PURE__ */ jsx("span", { className: "sg-cp-summary-title", children: "Transaction screening policy" })
1563
+ ] }),
1564
+ /* @__PURE__ */ jsx("p", { className: "sg-cp-summary-sub", children: applied ? "Applied to this payment" : "No policy decision was returned" })
1565
+ ] }),
1566
+ /* @__PURE__ */ jsx("span", { className: "sg-cp-policy-id sg-mono", children: policyId ? `Policy ${policyId}` : "Policy ID unavailable" })
1567
+ ] }),
1568
+ names.length ? /* @__PURE__ */ jsxs("dl", { className: "sg-cp-facts sg-cp-policy-facts", children: [
1569
+ compliance?.appliedPolicyNames?.length ? /* @__PURE__ */ jsx(Fact, { label: "Policy", value: compliance.appliedPolicyNames.join(", ") }) : null,
1570
+ compliance?.appliedLegislation?.length ? /* @__PURE__ */ jsx(Fact, { label: "Legislation", value: compliance.appliedLegislation.join(", ") }) : null
1571
+ ] }) : null,
1572
+ /* @__PURE__ */ jsx("div", { className: "sg-cp-buckets", children: SCREENING_BUCKETS.map((bucket) => {
1573
+ const Glyph = POLICY_GLYPH[bucket.outcome];
1574
+ return /* @__PURE__ */ jsxs("section", { className: "sg-cp-card sg-cp-bucket", children: [
1575
+ /* @__PURE__ */ jsxs("div", { className: "sg-cp-bucket-head", children: [
1576
+ /* @__PURE__ */ jsxs("span", { className: "sg-cp-card-head", children: [
1577
+ /* @__PURE__ */ jsx("span", { className: "sg-cp-card-glyph", children: /* @__PURE__ */ jsx(Glyph, {}) }),
1578
+ /* @__PURE__ */ jsx("h5", { className: "sg-cp-card-title", children: bucket.title })
1579
+ ] }),
1580
+ /* @__PURE__ */ jsx("span", { className: "sg-cp-bucket-detail", children: POLICY_DETAIL[bucket.outcome] })
1581
+ ] }),
1582
+ /* @__PURE__ */ jsx("ul", { className: "sg-cp-cats", children: bucket.categories.map((category) => /* @__PURE__ */ jsxs("li", { children: [
1583
+ /* @__PURE__ */ jsx("span", { className: "sg-cp-dot", "aria-hidden": "true" }),
1584
+ category
1585
+ ] }, category)) })
1586
+ ] }, bucket.outcome);
1587
+ }) })
1588
+ ] });
1589
+ }
1590
+ function CompliancePanel(props) {
1591
+ const [open, setOpen] = useState(false);
1592
+ const [tab, setTab] = useState("checks");
1593
+ const triggerRef = useRef(null);
1594
+ const sheetRef = useRef(null);
1595
+ const compliance = props.compliance ?? null;
1596
+ const cv = complianceView(compliance, props.hasQuote ?? true);
1597
+ const allChecks = complianceChecks(compliance, cv);
1598
+ const checks = props.direct ? allChecks.filter((c) => DIRECT_CHECK_IDS.includes(c.id)) : allChecks;
1599
+ const tag = complianceTagOf(compliance);
1600
+ useEffect(() => {
1601
+ if (!open) return;
1602
+ sheetRef.current?.focus();
1603
+ const onKey = (e) => {
1604
+ if (e.key === "Escape") {
1605
+ e.stopPropagation();
1606
+ setOpen(false);
1607
+ triggerRef.current?.focus();
1608
+ }
1609
+ };
1610
+ document.addEventListener("keydown", onKey, true);
1611
+ return () => document.removeEventListener("keydown", onKey, true);
1612
+ }, [open]);
1613
+ const close = () => {
1614
+ setOpen(false);
1615
+ triggerRef.current?.focus();
1616
+ };
1617
+ return /* @__PURE__ */ jsxs("div", { className: "sg-cp", "data-tone": cv.tone, children: [
1618
+ open ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
1619
+ /* @__PURE__ */ jsxs("button", { ref: triggerRef, type: "button", className: "sg-cp-row", "data-tone": cv.tone, onClick: () => setOpen(true), "aria-haspopup": "dialog", children: [
1620
+ /* @__PURE__ */ jsxs("span", { className: "sg-cp-row-main", children: [
1621
+ /* @__PURE__ */ jsx("span", { className: "sg-cp-row-glyph", children: /* @__PURE__ */ jsx(TriggerGlyph, { cv }) }),
1622
+ /* @__PURE__ */ jsx("span", { className: "sg-cp-row-label", children: cv.label })
1623
+ ] }),
1624
+ /* @__PURE__ */ jsx("span", { className: "sg-cp-row-chev", children: /* @__PURE__ */ jsx(Chevron, {}) })
1625
+ ] }),
1626
+ (cv.blocked || cv.needsAction) && tag ? /* @__PURE__ */ jsx("span", { className: "sg-cp-row-tag sg-mono", children: tag }) : null
1627
+ ] }),
1628
+ open ? /* @__PURE__ */ jsxs("div", { className: "sg-cp-sheet", role: "dialog", "aria-modal": "true", "aria-label": "Compliance details", ref: sheetRef, tabIndex: -1, children: [
1629
+ /* @__PURE__ */ jsxs("div", { className: "sg-cp-sheet-head", children: [
1630
+ /* @__PURE__ */ jsx("h4", { className: "sg-cp-sheet-title", children: "Compliance details" }),
1631
+ /* @__PURE__ */ jsx("button", { type: "button", className: "sg-cp-close", onClick: close, "aria-label": "Close compliance details", children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "m6 6 12 12M18 6 6 18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
1632
+ ] }),
1633
+ /* @__PURE__ */ jsxs("div", { className: "sg-cp-tabs", role: "tablist", "aria-label": "Compliance details sections", children: [
1634
+ /* @__PURE__ */ jsx("button", { type: "button", role: "tab", "aria-selected": tab === "checks", "data-active": tab === "checks", className: "sg-cp-tab", onClick: () => setTab("checks"), children: "Quote checks" }),
1635
+ /* @__PURE__ */ jsx("button", { type: "button", role: "tab", "aria-selected": tab === "policy", "data-active": tab === "policy", className: "sg-cp-tab", onClick: () => setTab("policy"), children: "Screening policy" })
1636
+ ] }),
1637
+ /* @__PURE__ */ jsx("div", { className: "sg-cp-sheet-body", children: tab === "checks" ? /* @__PURE__ */ jsx(QuoteChecks, { compliance, cv, checks, direct: !!props.direct, onViewPolicy: () => setTab("policy") }) : /* @__PURE__ */ jsx(ScreeningPolicy, { compliance }) })
1638
+ ] }) : null
1639
+ ] });
1640
+ }
1293
1641
 
1294
1642
  // src/react/ui/chain-logos.ts
1295
1643
  var BUNDLED_CHAIN_LOGO = {
@@ -1309,7 +1657,19 @@ var BUNDLED_TOKEN_LOGO = {
1309
1657
  USDC: "https://coin-images.coingecko.com/coins/images/6319/large/USDC.png",
1310
1658
  USDT: "https://coin-images.coingecko.com/coins/images/325/large/Tether.png",
1311
1659
  USDE: "https://coin-images.coingecko.com/coins/images/33613/large/usde.png",
1312
- XAUT: "https://coin-images.coingecko.com/coins/images/10481/large/Tether_Gold.png"
1660
+ XAUT: "https://coin-images.coingecko.com/coins/images/10481/large/Tether_Gold.png",
1661
+ // 2026-09-08, with the dapp-parity asset expansion — the same four URLs the dapp draws
1662
+ // (zd-dapp/src/lib/tokenLogos.ts), so the two products show one picture per coin.
1663
+ USDTB: "https://coin-images.coingecko.com/coins/images/52804/large/76357aa8-4ef7-446c-bad3-a3f944eeec7a.jpeg",
1664
+ AUSD: "https://coin-images.coingecko.com/coins/images/39284/large/AUSD_1024px.png",
1665
+ PYUSD: "https://coin-images.coingecko.com/coins/images/31212/large/PYUSD_Token_Logo_2x.png",
1666
+ USDG: "https://coin-images.coingecko.com/coins/images/51281/large/GDN_USDG_Token_200x200.png",
1667
+ // The wider stable list, added 2026-09-08 with the RWA exchange.
1668
+ DAI: "https://coin-images.coingecko.com/coins/images/9956/large/Badge_Dai.png",
1669
+ USDS: "https://coin-images.coingecko.com/coins/images/39926/large/usds.webp",
1670
+ RLUSD: "https://coin-images.coingecko.com/coins/images/39651/large/RLUSD_200x200_%281%29.png",
1671
+ USD1: "https://coin-images.coingecko.com/coins/images/54977/large/USD1_1000x1000_transparent.png",
1672
+ WM: "https://coin-images.coingecko.com/coins/images/50789/large/M.png"
1313
1673
  };
1314
1674
  function isHttpsUrl(u) {
1315
1675
  return typeof u === "string" && /^https:\/\//i.test(u);
@@ -1339,12 +1699,18 @@ var CHAIN_SHORT = {
1339
1699
  42161: "ARB",
1340
1700
  98866: "PLM"
1341
1701
  };
1702
+ function chainBadge(chainId) {
1703
+ const pinned = CHAIN_SHORT[Number(chainId)];
1704
+ if (pinned) return pinned;
1705
+ const name = CHAIN_LABELS[Number(chainId)];
1706
+ return name ? name.replace(/[^A-Za-z]/g, "").slice(0, 3).toUpperCase() : "?";
1707
+ }
1342
1708
  function TokenGlyph(props) {
1343
1709
  const [failed, setFailed] = useState([]);
1344
1710
  const src = tokenLogoCandidates(props.symbol, props.logoUrl).find((u) => !failed.includes(u));
1345
1711
  const mark = props.chainId ? chainLogoCandidates(props.chainId)[0] : void 0;
1346
1712
  let badge = null;
1347
- if (props.chainId) badge = mark ? /* @__PURE__ */ jsx("img", { className: "sg-tok-badge", src: mark, alt: "" }) : /* @__PURE__ */ jsx("span", { className: "sg-tok-badge", children: CHAIN_SHORT[props.chainId] || "?" });
1713
+ if (props.chainId) badge = mark ? /* @__PURE__ */ jsx("img", { className: "sg-tok-badge", src: mark, alt: "" }) : /* @__PURE__ */ jsx("span", { className: "sg-tok-badge", children: chainBadge(props.chainId) });
1348
1714
  return /* @__PURE__ */ jsxs("span", { className: "sg-tok", "data-size": props.size === "sm" ? "sm" : void 0, children: [
1349
1715
  src ? /* @__PURE__ */ jsx("img", { className: "sg-tok-img", src, alt: "", loading: "lazy", onError: () => setFailed((f) => [...f, src]) }) : /* @__PURE__ */ jsx("span", { className: "sg-tok-fb", children: props.symbol.slice(0, 4) }),
1350
1716
  badge
@@ -1354,17 +1720,18 @@ function ChevronGlyph() {
1354
1720
  return /* @__PURE__ */ 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__ */ jsx("path", { d: "m9 18 6-6-6-6" }) });
1355
1721
  }
1356
1722
  function TokenTile(props) {
1723
+ const shown = props.token?.symbol ?? props.pick?.symbol ?? "";
1357
1724
  const glyph = props.pick ? /* @__PURE__ */ jsxs(Fragment, { children: [
1358
1725
  /* @__PURE__ */ jsx(TokenGlyph, { symbol: props.pick.symbol, logoUrl: props.token?.logoUrl, chainId: props.pick.chainId }),
1359
1726
  /* @__PURE__ */ jsxs("span", { style: { minWidth: 0 }, children: [
1360
- /* @__PURE__ */ jsx("span", { className: "sg-tile-sym", children: props.pick.symbol }),
1727
+ /* @__PURE__ */ jsx("span", { className: "sg-tile-sym", children: shown }),
1361
1728
  /* @__PURE__ */ jsx("span", { className: "sg-tile-chain", children: CHAIN_LABELS[props.pick.chainId] || `Chain ${props.pick.chainId}` })
1362
1729
  ] })
1363
1730
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
1364
1731
  /* @__PURE__ */ jsx("span", { className: "sg-tok", children: /* @__PURE__ */ jsx("span", { className: "sg-tok-fb", children: "?" }) }),
1365
1732
  /* @__PURE__ */ jsx("span", { className: "sg-tile-empty", children: "Select\u2026" })
1366
1733
  ] });
1367
- const ariaLabel = `${props.label}: ${props.pick ? `${props.pick.symbol} on ${CHAIN_LABELS[props.pick.chainId] || props.pick.chainId}` : "select token"}`;
1734
+ const ariaLabel = `${props.label}: ${props.pick ? `${shown} on ${CHAIN_LABELS[props.pick.chainId] || props.pick.chainId}` : "select token"}`;
1368
1735
  if (props.row) {
1369
1736
  return /* @__PURE__ */ jsxs("button", { type: "button", ref: props.btnRef, className: "sg-tile sg-tile--row", disabled: props.disabled, onClick: props.onClick, "aria-label": ariaLabel, children: [
1370
1737
  /* @__PURE__ */ jsx("span", { className: "sg-tile-label", children: props.label }),
@@ -1405,7 +1772,8 @@ function FundingTile(props) {
1405
1772
  function ChainChip(props) {
1406
1773
  const [failed, setFailed] = useState([]);
1407
1774
  const src = chainLogoCandidates(props.chain?.chainId, props.chain?.logoUrl).find((u) => !failed.includes(u));
1408
- return /* @__PURE__ */ 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__ */ jsx("img", { src, alt: props.label, loading: "lazy", onError: () => setFailed((f) => [...f, src]) }) : props.label });
1775
+ const name = props.name ?? props.label;
1776
+ return /* @__PURE__ */ 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__ */ jsx("img", { src, alt: "", loading: "lazy", onError: () => setFailed((f) => [...f, src]) }) : props.label });
1409
1777
  }
1410
1778
  function SearchGlyph() {
1411
1779
  return /* @__PURE__ */ jsxs("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.4", strokeLinecap: "round", "aria-hidden": "true", children: [
@@ -1426,7 +1794,9 @@ function TokenSelect(props) {
1426
1794
  const q = query.trim().toLowerCase();
1427
1795
  const filtered = props.tokens.filter((t) => chainFilter == null ? true : Number(t.chainId) === chainFilter).filter((t) => {
1428
1796
  if (!q) return true;
1429
- return String(t.symbol || "").toLowerCase().includes(q) || String(t.name || "").toLowerCase().includes(q) || String(t.address || "").toLowerCase().includes(q);
1797
+ 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
1798
+ // show a three-letter badge, so "Katana" or "Berachain" has to be findable by typing it.
1799
+ String(CHAIN_LABELS[Number(t.chainId)] || "").toLowerCase().includes(q);
1430
1800
  });
1431
1801
  if (!props.balances) return filtered;
1432
1802
  const balNum = (t) => {
@@ -1440,13 +1810,14 @@ function TokenSelect(props) {
1440
1810
  /* @__PURE__ */ jsx("button", { type: "button", className: "sg-back", onClick: props.onBack, "aria-label": "Back", children: /* @__PURE__ */ jsx(BackGlyph, {}) }),
1441
1811
  /* @__PURE__ */ jsx("div", { className: "sg-sel-title", children: props.title })
1442
1812
  ] }),
1443
- /* @__PURE__ */ jsxs("div", { className: "sg-chain-grid", role: "group", "aria-label": "Filter by chain", children: [
1813
+ /* @__PURE__ */ jsxs("div", { className: "sg-chain-grid", "data-scroll": props.chains.length > 14 ? void 0 : "false", role: "group", "aria-label": "Filter by chain", children: [
1444
1814
  /* @__PURE__ */ jsx(ChainChip, { label: "All", selected: chainFilter == null, onClick: () => setChainFilter(null) }),
1445
1815
  props.chains.map((c) => /* @__PURE__ */ jsx(
1446
1816
  ChainChip,
1447
1817
  {
1448
1818
  chain: c,
1449
- label: CHAIN_SHORT[Number(c.chainId)] || String(c.chainId),
1819
+ label: chainBadge(Number(c.chainId)),
1820
+ name: CHAIN_LABELS[Number(c.chainId)] || c.displayName || c.name || `Chain ${c.chainId}`,
1450
1821
  selected: chainFilter === Number(c.chainId),
1451
1822
  onClick: () => setChainFilter(Number(c.chainId))
1452
1823
  },
@@ -1455,7 +1826,7 @@ function TokenSelect(props) {
1455
1826
  ] }),
1456
1827
  /* @__PURE__ */ jsxs("div", { className: "sg-search", children: [
1457
1828
  /* @__PURE__ */ jsx(SearchGlyph, {}),
1458
- /* @__PURE__ */ 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" })
1829
+ /* @__PURE__ */ 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" })
1459
1830
  ] }),
1460
1831
  /* @__PURE__ */ jsx("div", { className: "sg-toklist", role: "group", "aria-label": props.title, children: rows.length ? rows.map((t) => {
1461
1832
  const chainId = Number(t.chainId);
@@ -1487,7 +1858,7 @@ function TokenSelect(props) {
1487
1858
  },
1488
1859
  `${chainId}:${t.address}`
1489
1860
  );
1490
- }) : /* @__PURE__ */ jsx("div", { className: "sg-sel-empty", children: "No tokens match \u2014 try another chain or search." }) })
1861
+ }) : props.loading ? /* @__PURE__ */ jsx("div", { className: "sg-sel-empty", children: "Loading the token list\u2026" }) : /* @__PURE__ */ jsx("div", { className: "sg-sel-empty", children: "No tokens match \u2014 try another chain or search." }) })
1491
1862
  ] });
1492
1863
  }
1493
1864
  function useTxHistory(account) {
@@ -1728,7 +2099,7 @@ function forgetIdentity(account) {
1728
2099
  }
1729
2100
  var addrEq = (a, b) => String(a || "").toLowerCase() === String(b || "").toLowerCase();
1730
2101
  var chainName = (id) => id != null ? CHAIN_LABELS[id] || `Chain ${id}` : "";
1731
- var STABLES = /* @__PURE__ */ new Set(["USDC", "USDT", "USDE"]);
2102
+ var STABLES = EXECUTABLE_STABLE_ASSETS;
1732
2103
  function BankGlyph() {
1733
2104
  return /* @__PURE__ */ jsx(
1734
2105
  "svg",
@@ -1969,19 +2340,17 @@ function PaymentIsland(props) {
1969
2340
  const mode = props.mode ?? "exchange";
1970
2341
  const rampMode = kind === "exchange" && mode !== "exchange";
1971
2342
  const bankSettlement = isPay && props.settlement === "bank";
1972
- const exAllowed = useMemo(
1973
- () => (props.assets?.length ? props.assets : ["USDC", "USDT", "USDE"]).map((a) => symbolKey(a)),
1974
- [props.assets]
1975
- );
2343
+ const exProduct = props.product ?? "stable";
2344
+ const exAllowed = useMemo(() => props.assets?.length ? props.assets.map((a) => symbolKey(a)) : void 0, [props.assets]);
1976
2345
  const [exFrom, setExFrom] = useState(() => {
1977
2346
  const chainId = props.defaultFromChainId ?? (kind === "swap" ? 42161 : void 0);
1978
2347
  const asset = props.defaultFromAsset ?? (kind === "swap" ? "USDT" : void 0);
1979
- return chainId && asset && exAllowed.includes(symbolKey(asset)) ? { chainId, symbol: symbolKey(asset) } : null;
2348
+ return chainId && asset ? { chainId, symbol: symbolKey(asset) } : null;
1980
2349
  });
1981
2350
  const [exTo, setExTo] = useState(() => {
1982
2351
  const chainId = props.defaultToChainId ?? (kind === "swap" ? 8453 : void 0);
1983
2352
  const asset = props.defaultToAsset ?? (kind === "swap" ? "USDC" : void 0);
1984
- return chainId && asset && exAllowed.includes(symbolKey(asset)) ? { chainId, symbol: symbolKey(asset) } : null;
2353
+ return chainId && asset ? { chainId, symbol: symbolKey(asset) } : null;
1985
2354
  });
1986
2355
  const [exAmount, setExAmount] = useState(props.defaultAmount ?? "");
1987
2356
  const exFromChainId = exFrom?.chainId;
@@ -2074,27 +2443,24 @@ function PaymentIsland(props) {
2074
2443
  }
2075
2444
  return map;
2076
2445
  }, [annotated, holdings.loading]);
2077
- const [chains, setChains] = useState([]);
2078
- const [registryTokens, setRegistryTokens] = useState([]);
2446
+ const [catalogue, setCatalogue] = useState(null);
2079
2447
  useEffect(() => {
2080
2448
  if (bankSettlement || !isPay && rampMode) return;
2081
2449
  let alive = true;
2082
- Promise.all([engine.fetchChains().catch(() => []), engine.fetchTokens().catch(() => [])]).then(([cs, ts]) => {
2083
- if (!alive) return;
2084
- const order = new Map(SUPPORTED_CHAINS.map((id, i) => [id, i]));
2085
- setChains(
2086
- 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))
2087
- );
2088
- setRegistryTokens(ts.filter((t) => tokenEnabled(t) && SUPPORTED_CHAIN_IDS.has(Number(t.chainId))));
2450
+ engine.fetchCatalogue(isPay ? void 0 : exAllowed, isPay ? "stable" : exProduct).then((next) => {
2451
+ if (alive) setCatalogue(next);
2089
2452
  });
2090
2453
  return () => {
2091
2454
  alive = false;
2092
2455
  };
2093
- }, [engine, isPay, rampMode, bankSettlement]);
2094
- const exchangeTokens = useMemo(
2095
- () => isPay ? [] : registryTokens.filter((t) => exAllowed.includes(symbolKey(t.symbol)) && isDeliverable(symbolKey(t.symbol), Number(t.chainId))),
2096
- [isPay, registryTokens, exAllowed]
2097
- );
2456
+ }, [engine, isPay, rampMode, bankSettlement, exAllowed, exProduct]);
2457
+ const chains = useMemo(() => {
2458
+ const order = new Map(SUPPORTED_CHAINS.map((id, i) => [id, i]));
2459
+ return [...catalogue?.chains ?? []].sort((a, b) => (order.get(Number(a.chainId)) ?? 99) - (order.get(Number(b.chainId)) ?? 99) || Number(a.chainId) - Number(b.chainId));
2460
+ }, [catalogue]);
2461
+ const registryTokens = useMemo(() => catalogue?.tokens ?? [], [catalogue]);
2462
+ const exchangeTokens = useMemo(() => isPay ? [] : registryTokens, [isPay, registryTokens]);
2463
+ const exSourceTokens = useMemo(() => isPay ? [] : catalogue?.sources ?? [], [isPay, catalogue]);
2098
2464
  const [exBalances, setExBalances] = useState({});
2099
2465
  const exBalReq = useRef(0);
2100
2466
  useEffect(() => {
@@ -2116,6 +2482,39 @@ function PaymentIsland(props) {
2116
2482
  }, [engine, isPay, wallet.account, exchangeTokens]);
2117
2483
  const exFromToken = useMemo(() => exFrom ? findToken(exchangeTokens, exFrom.chainId, exFrom.symbol) : null, [exchangeTokens, exFrom]);
2118
2484
  const exToToken = useMemo(() => exTo ? findToken(exchangeTokens, exTo.chainId, exTo.symbol) : null, [exchangeTokens, exTo]);
2485
+ const exFromPicker = useMemo(() => exProduct === "rwa" ? counterpartTokens(exSourceTokens, exToToken) : exSourceTokens, [exProduct, exSourceTokens, exToToken]);
2486
+ const exToPicker = useMemo(() => exProduct === "rwa" ? counterpartTokens(exchangeTokens, exFromToken) : exchangeTokens, [exProduct, exchangeTokens, exFromToken]);
2487
+ const exRwaSeeded = useRef(false);
2488
+ useEffect(() => {
2489
+ if (isPay || exProduct !== "rwa" || exRwaSeeded.current) return;
2490
+ if (props.defaultFromAsset || props.defaultToAsset || !catalogue?.ready) return;
2491
+ const stable = exSourceTokens.find((t) => Number(t.chainId) === 42161 && symbolKey(t.symbol) === "USDC") ?? exSourceTokens.find((t) => assetClassOf(t.symbol) === "stable");
2492
+ const rwa = exchangeTokens.find((t) => assetClassOf(t.symbol) === "rwa");
2493
+ if (!stable || !rwa) return;
2494
+ exRwaSeeded.current = true;
2495
+ setExFrom({ chainId: Number(stable.chainId), symbol: symbolKey(stable.symbol) });
2496
+ setExTo({ chainId: Number(rwa.chainId), symbol: symbolKey(rwa.symbol) });
2497
+ }, [isPay, exProduct, catalogue, exSourceTokens, exchangeTokens, props.defaultFromAsset, props.defaultToAsset]);
2498
+ const exDestinationStates = useMemo(() => {
2499
+ if (!catalogue?.ready) return void 0;
2500
+ const states = {};
2501
+ for (const token of catalogue.tokens) {
2502
+ const key = balanceKey(Number(token.chainId), token.address);
2503
+ const measured = exFromToken ? brokenLaneFor(token, exFromToken, catalogue.brokenLanes) : void 0;
2504
+ if (measured) {
2505
+ states[key] = { disabled: true, reason: brokenLaneReason(measured), hint: "Unavailable" };
2506
+ continue;
2507
+ }
2508
+ const verdict = destinationAvailability(token, catalogue, exFromToken);
2509
+ if (verdict === "available") continue;
2510
+ states[key] = {
2511
+ disabled: true,
2512
+ reason: verdict === "hub-only" ? `${token.symbol} cannot be delivered on this chain.` : "ZeroDelta cannot deliver this asset here.",
2513
+ hint: verdict === "hub-only" ? "Not here" : "Unavailable"
2514
+ };
2515
+ }
2516
+ return states;
2517
+ }, [catalogue, exFromToken]);
2119
2518
  const exFromBal = exFrom && exFromToken ? exBalances[balanceKey(exFrom.chainId, exFromToken.address)] : void 0;
2120
2519
  const fundingTokens = useMemo(() => {
2121
2520
  const seen = /* @__PURE__ */ new Set();
@@ -2363,8 +2762,10 @@ function PaymentIsland(props) {
2363
2762
  {
2364
2763
  title: isFrom ? "Exchange from" : "Exchange to",
2365
2764
  chains,
2366
- tokens: exchangeTokens,
2765
+ tokens: isFrom ? exFromPicker : exToPicker,
2367
2766
  balances: exBalances,
2767
+ optionStates: isFrom ? void 0 : exDestinationStates,
2768
+ loading: !catalogue?.ready,
2368
2769
  onBack: () => closeSelector(openerRef),
2369
2770
  onPick: (pick) => {
2370
2771
  (isFrom ? setExFrom : setExTo)({ chainId: pick.chainId, symbol: symbolKey(pick.symbol) });
@@ -2534,6 +2935,7 @@ function PaymentIsland(props) {
2534
2935
  chainName(sel.source.chainId)
2535
2936
  ] })
2536
2937
  ] }) : null,
2938
+ sel && !loading && !quoteError ? /* @__PURE__ */ jsx(CompliancePanel, { compliance: sel.quote.compliance, direct: sel.state === "DIRECT" }) : null,
2537
2939
  quoteError ? /* @__PURE__ */ jsx(StatusPanel, { tone: "error", children: flow.error || "Couldn't get a price right now." }) : null,
2538
2940
  walletError ? /* @__PURE__ */ jsx(StatusPanel, { tone: "error", children: flow.error || "The wallet could not complete this payment." }) : null,
2539
2941
  submitting || walletError ? /* @__PURE__ */ jsx(StepList, { variant: "rich", steps: flow.steps, verdict: flow.verdict }) : null,
@@ -2582,8 +2984,8 @@ function PaymentIsland(props) {
2582
2984
  ) }) })
2583
2985
  ] }) });
2584
2986
  }
2585
- var STABLES2 = /* @__PURE__ */ new Set(["USDC", "USDT", "USDE"]);
2586
- var DEFAULT_FUNDING_ASSETS = ["USDC", "USDT", "USDE"];
2987
+ var STABLES2 = EXECUTABLE_STABLE_ASSETS;
2988
+ var DEFAULT_FUNDING_ASSETS = [...EXECUTABLE_STABLE_ASSETS];
2587
2989
  function CheckGlyph3() {
2588
2990
  return /* @__PURE__ */ jsx(
2589
2991
  "svg",
@@ -2688,23 +3090,22 @@ function StableGeniePay(props) {
2688
3090
  }
2689
3091
  return map;
2690
3092
  }, [annotated, holdings.loading]);
2691
- const [chains, setChains] = useState([]);
2692
- const [registryTokens, setRegistryTokens] = useState([]);
3093
+ const [catalogue, setCatalogue] = useState(null);
3094
+ const chains = useMemo(() => {
3095
+ const order = new Map(SUPPORTED_CHAINS.map((id, i) => [id, i]));
3096
+ return [...catalogue?.chains ?? []].sort((a, b) => (order.get(Number(a.chainId)) ?? 99) - (order.get(Number(b.chainId)) ?? 99) || Number(a.chainId) - Number(b.chainId));
3097
+ }, [catalogue]);
3098
+ const registryTokens = useMemo(() => catalogue?.tokens ?? [], [catalogue]);
2693
3099
  useEffect(() => {
2694
3100
  if (props.variant === "pill") return;
2695
3101
  let alive = true;
2696
- Promise.all([engine.fetchChains().catch(() => []), engine.fetchTokens().catch(() => [])]).then(([cs, ts]) => {
2697
- if (!alive) return;
2698
- const order = new Map(SUPPORTED_CHAINS.map((id, i) => [id, i]));
2699
- setChains(
2700
- 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))
2701
- );
2702
- setRegistryTokens(ts.filter((t) => tokenEnabled(t) && SUPPORTED_CHAIN_IDS.has(Number(t.chainId))));
3102
+ engine.fetchCatalogue().then((next) => {
3103
+ if (alive) setCatalogue(next);
2703
3104
  });
2704
3105
  return () => {
2705
3106
  alive = false;
2706
3107
  };
2707
- }, [engine]);
3108
+ }, [engine, props.variant]);
2708
3109
  const fundingTokens = useMemo(() => {
2709
3110
  const seen = /* @__PURE__ */ new Set();
2710
3111
  const list = [];
@@ -2871,6 +3272,7 @@ function StableGeniePay(props) {
2871
3272
  scannedEmpty ? /* @__PURE__ */ jsx("div", { className: "sg-note", children: "None of your balances can cover this yet \u2014 pick a different asset to fund with." }) : null,
2872
3273
  flow.status === "ready" && !visibleRoutes.length ? /* @__PURE__ */ jsx(StatusPanel, { children: "No funding route matches the accepted assets for this payment." }) : null
2873
3274
  ] }),
3275
+ sel && flow.status !== "loading" ? /* @__PURE__ */ jsx(CompliancePanel, { compliance: sel.quote.compliance, direct: sel.state === "DIRECT" }) : null,
2874
3276
  submitting ? /* @__PURE__ */ jsx(StepList, { steps: flow.steps }) : null,
2875
3277
  /* @__PURE__ */ jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsx(
2876
3278
  Button,
@@ -2883,8 +3285,8 @@ function StableGeniePay(props) {
2883
3285
  ) })
2884
3286
  ] }) }) });
2885
3287
  }
2886
- var chainOptions = SUPPORTED_CHAINS.map((c) => ({ value: c, label: CHAIN_LABELS[c] || `Chain ${c}` }));
2887
- var assetOptions = SUPPORTED_ASSETS2.map((a) => ({ value: a, label: a }));
3288
+ var sourceChainOptions = SUPPORTED_CHAINS.map((c) => ({ value: c, label: CHAIN_LABELS[c] || `Chain ${c}` }));
3289
+ var bundledAssetOptions = SUPPORTED_ASSETS2.map((a) => ({ value: a, label: a }));
2888
3290
  function CheckGlyph4() {
2889
3291
  return /* @__PURE__ */ 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__ */ jsx("path", { d: "M20 6 9 17l-5-5" }) });
2890
3292
  }
@@ -2897,6 +3299,33 @@ function StableGenieSwap(props) {
2897
3299
  const [toChainId, setToChainId] = useState(props.defaultToChainId ?? 8453);
2898
3300
  const [toAsset, setToAsset] = useState(props.defaultToAsset ?? "USDC");
2899
3301
  const [amount, setAmount] = useState(props.defaultAmount ?? "");
3302
+ const [catalogue, setCatalogue] = useState(null);
3303
+ useEffect(() => {
3304
+ if (props.variant === "pill") return;
3305
+ let alive = true;
3306
+ engine.fetchCatalogue().then((next) => {
3307
+ if (alive && next.ready) setCatalogue(next);
3308
+ });
3309
+ return () => {
3310
+ alive = false;
3311
+ };
3312
+ }, [engine, props.variant]);
3313
+ const assetOptions = useMemo(() => {
3314
+ if (!catalogue) return bundledAssetOptions;
3315
+ const symbols = [...new Set(catalogue.tokens.map((t) => t.symbol.toUpperCase()))];
3316
+ const ordered = [...SUPPORTED_ASSETS2.filter((a) => symbols.includes(a)), ...symbols.filter((s) => !SUPPORTED_ASSETS2.includes(s))];
3317
+ return ordered.length ? ordered.map((a) => ({ value: a, label: a })) : bundledAssetOptions;
3318
+ }, [catalogue]);
3319
+ const toChainOptions = useMemo(() => {
3320
+ if (!catalogue) return sourceChainOptions;
3321
+ const ids = [...catalogue.chainIds].sort((a, b) => {
3322
+ const ai = SUPPORTED_CHAINS.indexOf(a);
3323
+ const bi = SUPPORTED_CHAINS.indexOf(b);
3324
+ if (ai !== bi) return (ai < 0 ? 999 : ai) - (bi < 0 ? 999 : bi);
3325
+ return a - b;
3326
+ });
3327
+ return ids.map((c) => ({ value: c, label: CHAIN_LABELS[c] || `Chain ${c}` }));
3328
+ }, [catalogue]);
2900
3329
  const amountValid = /^\d+(\.\d+)?$/.test(amount.replace(",", ".")) && Number(amount.replace(",", ".")) > 0;
2901
3330
  const enabled = amountValid && props.variant !== "pill";
2902
3331
  const paramsKey = `${fromChainId}|${fromAsset}|${toChainId}|${toAsset}|${amount}|${props.recipient ?? ""}`;
@@ -2973,7 +3402,7 @@ function StableGenieSwap(props) {
2973
3402
  /* @__PURE__ */ jsx(AmountInput, { value: amount, onChange: setAmount, disabled: submitting }),
2974
3403
  /* @__PURE__ */ jsxs("div", { className: "sg-row", style: { marginTop: 8 }, children: [
2975
3404
  /* @__PURE__ */ jsx("div", { className: "sg-grow", children: /* @__PURE__ */ jsx(Select, { value: fromAsset, onChange: setFromAsset, options: assetOptions, disabled: submitting }) }),
2976
- /* @__PURE__ */ jsx("div", { className: "sg-grow", children: /* @__PURE__ */ jsx(Select, { value: fromChainId, onChange: (v) => setFromChainId(Number(v)), options: chainOptions, disabled: submitting }) })
3405
+ /* @__PURE__ */ jsx("div", { className: "sg-grow", children: /* @__PURE__ */ jsx(Select, { value: fromChainId, onChange: (v) => setFromChainId(Number(v)), options: sourceChainOptions, disabled: submitting }) })
2977
3406
  ] })
2978
3407
  ] }),
2979
3408
  /* @__PURE__ */ jsx("button", { type: "button", className: "sg-reverse", onClick: reverse, "aria-label": "Reverse", disabled: submitting, children: "\u2193" }),
@@ -2982,11 +3411,12 @@ function StableGenieSwap(props) {
2982
3411
  /* @__PURE__ */ jsx("div", { className: "sg-anchor sg-mono", children: toValue }),
2983
3412
  /* @__PURE__ */ jsxs("div", { className: "sg-row", style: { marginTop: 8 }, children: [
2984
3413
  /* @__PURE__ */ jsx("div", { className: "sg-grow", children: /* @__PURE__ */ jsx(Select, { value: toAsset, onChange: setToAsset, options: assetOptions, disabled: submitting }) }),
2985
- /* @__PURE__ */ jsx("div", { className: "sg-grow", children: /* @__PURE__ */ jsx(Select, { value: toChainId, onChange: (v) => setToChainId(Number(v)), options: chainOptions, disabled: submitting }) })
3414
+ /* @__PURE__ */ jsx("div", { className: "sg-grow", children: /* @__PURE__ */ jsx(Select, { value: toChainId, onChange: (v) => setToChainId(Number(v)), options: toChainOptions, disabled: submitting }) })
2986
3415
  ] })
2987
3416
  ] }),
2988
3417
  flow.status === "error" && flow.error ? /* @__PURE__ */ jsx(StatusPanel, { tone: "error", children: flow.error }) : null,
2989
3418
  flow.routes.length ? /* @__PURE__ */ jsx(RouteList, { routes: flow.routes, selectedId: flow.selected?.id ?? null, onSelect: flow.selectRoute }) : null,
3419
+ flow.selected && flow.status !== "loading" ? /* @__PURE__ */ jsx(CompliancePanel, { compliance: flow.selected.quote.compliance, direct: flow.selected.state === "DIRECT" }) : null,
2990
3420
  submitting ? /* @__PURE__ */ jsx(StepList, { steps: flow.steps }) : null,
2991
3421
  /* @__PURE__ */ jsxs("div", { className: "sg-cta-wrap", children: [
2992
3422
  !wallet.account ? /* @__PURE__ */ jsx(Button, { onClick: wallet.connect, busy: wallet.connecting, children: "Connect wallet" }) : /* @__PURE__ */ jsx(Button, { onClick: flow.submit, busy: submitting, disabled: !flow.selected || flow.insufficient || !!flow.nativeShortfall || !enabled || flow.status === "loading", children: swapLabel }),
@@ -2994,7 +3424,6 @@ function StableGenieSwap(props) {
2994
3424
  ] })
2995
3425
  ] });
2996
3426
  }
2997
- var STABLE_ASSETS = ["USDC", "USDT", "USDE"];
2998
3427
  var FIAT = [
2999
3428
  { code: "USD", glyph: "$", label: "US Dollar" },
3000
3429
  { code: "EUR", glyph: "\u20AC", label: "Euro" },
@@ -3037,24 +3466,25 @@ function StableGenieExchange(props) {
3037
3466
  const mode = props.mode ?? "exchange";
3038
3467
  const wide = props.variant === "wide";
3039
3468
  const isPill = props.variant === "pill";
3040
- const allowed = useMemo(() => (props.assets?.length ? props.assets : STABLE_ASSETS).map((a) => symbolKey(a)), [props.assets]);
3041
- const [chains, setChains] = useState([]);
3042
- const [tokens, setTokens] = useState([]);
3469
+ const product = props.product ?? "stable";
3470
+ const allowed = useMemo(() => props.assets?.length ? props.assets.map((a) => symbolKey(a)) : void 0, [props.assets]);
3471
+ const [catalogue, setCatalogue] = useState(null);
3043
3472
  useEffect(() => {
3044
3473
  if (isPill) return;
3045
3474
  let alive = true;
3046
- Promise.all([engine.fetchChains().catch(() => []), engine.fetchTokens().catch(() => [])]).then(([cs, ts]) => {
3047
- if (!alive) return;
3048
- const order = new Map(SUPPORTED_CHAINS.map((id, i) => [id, i]));
3049
- setChains(
3050
- 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))
3051
- );
3052
- 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))));
3475
+ engine.fetchCatalogue(allowed, product).then((next) => {
3476
+ if (alive) setCatalogue(next);
3053
3477
  });
3054
3478
  return () => {
3055
3479
  alive = false;
3056
3480
  };
3057
- }, [engine, allowed]);
3481
+ }, [engine, allowed, product, isPill]);
3482
+ const chains = useMemo(() => {
3483
+ const order = new Map(SUPPORTED_CHAINS.map((id, i) => [id, i]));
3484
+ return [...catalogue?.chains ?? []].sort((a, b) => (order.get(Number(a.chainId)) ?? 99) - (order.get(Number(b.chainId)) ?? 99) || Number(a.chainId) - Number(b.chainId));
3485
+ }, [catalogue]);
3486
+ const tokens = useMemo(() => catalogue?.tokens ?? [], [catalogue]);
3487
+ const sourceTokens = useMemo(() => catalogue?.sources ?? [], [catalogue]);
3058
3488
  const [view, setView] = useState("main");
3059
3489
  const [hist, setHist] = useState(null);
3060
3490
  const histBtnRef = useRef(null);
@@ -3064,19 +3494,53 @@ function StableGenieExchange(props) {
3064
3494
  };
3065
3495
  useEffect(() => setHist(null), [wallet.account]);
3066
3496
  const [from, setFrom] = useState(
3067
- () => props.defaultFromChainId && props.defaultFromAsset && allowed.includes(symbolKey(props.defaultFromAsset)) ? { chainId: props.defaultFromChainId, symbol: symbolKey(props.defaultFromAsset) } : null
3497
+ () => props.defaultFromChainId && props.defaultFromAsset ? { chainId: props.defaultFromChainId, symbol: symbolKey(props.defaultFromAsset) } : null
3068
3498
  );
3069
3499
  const [to, setTo] = useState(
3070
- () => props.defaultToChainId && props.defaultToAsset && allowed.includes(symbolKey(props.defaultToAsset)) ? { chainId: props.defaultToChainId, symbol: symbolKey(props.defaultToAsset) } : null
3500
+ () => props.defaultToChainId && props.defaultToAsset ? { chainId: props.defaultToChainId, symbol: symbolKey(props.defaultToAsset) } : null
3071
3501
  );
3072
3502
  const [amount, setAmount] = useState(props.defaultAmount ?? "");
3073
3503
  const [fiatCurrency, setFiatCurrency] = useState(props.fiatCurrency ?? "EUR");
3074
3504
  const fromToken = useMemo(() => from ? findToken(tokens, from.chainId, from.symbol) : null, [tokens, from]);
3075
3505
  const toToken = useMemo(() => to ? findToken(tokens, to.chainId, to.symbol) : null, [tokens, to]);
3506
+ const toSymbol = toToken?.symbol ?? to?.symbol ?? "";
3507
+ const fromPickerTokens = useMemo(() => product === "rwa" ? counterpartTokens(sourceTokens, toToken) : sourceTokens, [product, sourceTokens, toToken]);
3508
+ const toPickerTokens = useMemo(() => product === "rwa" ? counterpartTokens(tokens, fromToken) : tokens, [product, tokens, fromToken]);
3509
+ const rwaSeeded = useRef(false);
3510
+ useEffect(() => {
3511
+ if (product !== "rwa" || rwaSeeded.current) return;
3512
+ if (props.defaultFromAsset || props.defaultToAsset || !catalogue?.ready) return;
3513
+ const stable = sourceTokens.find((t) => Number(t.chainId) === 42161 && symbolKey(t.symbol) === "USDC") ?? sourceTokens.find((t) => assetClassOf(t.symbol) === "stable");
3514
+ const rwa = tokens.find((t) => assetClassOf(t.symbol) === "rwa");
3515
+ if (!stable || !rwa) return;
3516
+ rwaSeeded.current = true;
3517
+ setFrom({ chainId: Number(stable.chainId), symbol: symbolKey(stable.symbol) });
3518
+ setTo({ chainId: Number(rwa.chainId), symbol: symbolKey(rwa.symbol) });
3519
+ }, [product, catalogue, sourceTokens, tokens, props.defaultFromAsset, props.defaultToAsset]);
3520
+ const destinationStates = useMemo(() => {
3521
+ if (!catalogue?.ready) return void 0;
3522
+ const states = {};
3523
+ for (const token of catalogue.tokens) {
3524
+ const key = `${Number(token.chainId)}:${String(token.address || "").toLowerCase()}`;
3525
+ const measured = fromToken ? brokenLaneFor(token, fromToken, catalogue.brokenLanes) : void 0;
3526
+ if (measured) {
3527
+ states[key] = { disabled: true, reason: brokenLaneReason(measured), hint: "Unavailable" };
3528
+ continue;
3529
+ }
3530
+ const verdict = destinationAvailability(token, catalogue, fromToken);
3531
+ if (verdict === "available") continue;
3532
+ states[key] = {
3533
+ disabled: true,
3534
+ reason: verdict === "hub-only" ? `${token.symbol} cannot be delivered on this chain \u2014 choose an execution chain.` : "ZeroDelta cannot deliver this asset here.",
3535
+ hint: verdict === "hub-only" ? "Not here" : "Unavailable"
3536
+ };
3537
+ }
3538
+ return states;
3539
+ }, [catalogue, fromToken]);
3076
3540
  const normalizedAmount = normalizeDecimalText(amount);
3077
3541
  const amountValid = /^\d+(\.\d+)?$/.test(normalizedAmount) && Number(normalizedAmount) > 0 && Number(normalizedAmount) <= 1e9;
3078
3542
  const rampMode = mode !== "exchange";
3079
- const inUniverse = (p) => Boolean(p && allowed.includes(p.symbol));
3543
+ const inUniverse = (p) => Boolean(p && tokens.some((t) => Number(t.chainId) === p.chainId && symbolKey(t.symbol) === p.symbol));
3080
3544
  const cryptoReady = rampMode ? inUniverse(mode === "onramp" ? to : from) : inUniverse(from) && inUniverse(to);
3081
3545
  const quotable = mode === "exchange" && inUniverse(from) && inUniverse(to) && amountValid;
3082
3546
  const [balances, setBalances] = useState({});
@@ -3099,7 +3563,7 @@ function StableGenieExchange(props) {
3099
3563
  });
3100
3564
  }, [engine, wallet.account, tokens]);
3101
3565
  const fromBal = from && fromToken ? balances[balanceKey(from.chainId, fromToken.address)] : void 0;
3102
- const paramsKey = `${mode}|${from?.chainId}|${from?.symbol}|${to?.chainId}|${to?.symbol}|${normalizedAmount}|${props.recipient ?? ""}`;
3566
+ const paramsKey = `${mode}|${from?.chainId}|${from?.symbol}|${to?.chainId}|${toSymbol}|${normalizedAmount}|${props.recipient ?? ""}`;
3103
3567
  const flow = useFlow({
3104
3568
  engine,
3105
3569
  wallet,
@@ -3171,8 +3635,10 @@ function StableGenieExchange(props) {
3171
3635
  {
3172
3636
  title: isFrom ? "Exchange from" : "Exchange to",
3173
3637
  chains,
3174
- tokens,
3638
+ tokens: isFrom ? fromPickerTokens : toPickerTokens,
3175
3639
  balances,
3640
+ optionStates: isFrom ? void 0 : destinationStates,
3641
+ loading: !catalogue?.ready,
3176
3642
  onBack: () => closeSelector(isFrom),
3177
3643
  onPick: (pick) => {
3178
3644
  (isFrom ? setFrom : setTo)({ chainId: pick.chainId, symbol: symbolKey(pick.symbol) });
@@ -3187,7 +3653,7 @@ function StableGenieExchange(props) {
3187
3653
  /* @__PURE__ */ jsxs("div", { className: "sg-success-amt sg-mono", children: [
3188
3654
  receive,
3189
3655
  " ",
3190
- to?.symbol
3656
+ toSymbol
3191
3657
  ] }),
3192
3658
  /* @__PURE__ */ jsxs("div", { className: "sg-success-sub", children: [
3193
3659
  flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
@@ -3228,7 +3694,7 @@ function StableGenieExchange(props) {
3228
3694
  !rampMode && quoteError && !wide ? /* @__PURE__ */ jsx(StatusPanel, { tone: "error", children: quoteError }) : null,
3229
3695
  !rampMode && !wide && quotable && !quoteError ? /* @__PURE__ */ jsxs("div", { className: "sg-panel", style: { marginTop: 12 }, children: [
3230
3696
  /* @__PURE__ */ jsx("div", { className: "sg-label", children: "You receive (estimated)" }),
3231
- /* @__PURE__ */ jsx("div", { className: "sg-anchor sg-mono", children: quoting ? "\u2026" : receive ? `${receive} ${to?.symbol}` : "\u2014" }),
3697
+ /* @__PURE__ */ jsx("div", { className: "sg-anchor sg-mono", children: quoting ? "\u2026" : receive ? `${receive} ${toSymbol}` : "\u2014" }),
3232
3698
  meta && !quoting ? /* @__PURE__ */ jsxs("div", { className: "sg-recv-sub", children: [
3233
3699
  "via ",
3234
3700
  meta.bridge,
@@ -3238,6 +3704,7 @@ function StableGenieExchange(props) {
3238
3704
  meta.duration ? ` \xB7 ~${meta.duration}s` : ""
3239
3705
  ] }) : null
3240
3706
  ] }) : null,
3707
+ connected && flow.selected && flow.status !== "loading" ? /* @__PURE__ */ jsx(CompliancePanel, { compliance: flow.selected.quote.compliance, direct: flow.selected.state === "DIRECT" }) : null,
3241
3708
  submitting ? /* @__PURE__ */ jsx(StepList, { steps: flow.steps }) : null,
3242
3709
  /* @__PURE__ */ jsxs("div", { className: "sg-cta-wrap", children: [
3243
3710
  !connected && !rampMode ? /* @__PURE__ */ jsx(Button, { onClick: wallet.connect, busy: wallet.connecting, children: "Connect wallet" }) : /* @__PURE__ */ 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 }),
@@ -3276,7 +3743,7 @@ function StableGenieExchange(props) {
3276
3743
  /* @__PURE__ */ jsxs("div", { className: "sg-recv-amt sg-mono", children: [
3277
3744
  receive,
3278
3745
  " ",
3279
- to?.symbol
3746
+ toSymbol
3280
3747
  ] }),
3281
3748
  /* @__PURE__ */ jsxs("div", { className: "sg-recv-sub", children: [
3282
3749
  "on ",
@@ -3327,15 +3794,19 @@ function StableGenieExchange(props) {
3327
3794
  ] })
3328
3795
  ] }) });
3329
3796
  }
3797
+ function StableGenieRwaExchange(props) {
3798
+ return /* @__PURE__ */ jsx(StableGenieExchange, { ...props, product: "rwa" });
3799
+ }
3330
3800
 
3331
3801
  // src/mount.ts
3332
3802
  function mount(el, config) {
3333
3803
  const root = createRoot(el);
3334
3804
  const variant = config.variant ?? "pay";
3335
- const Comp = variant === "swap" ? StableGenieSwap : variant === "exchange" ? StableGenieExchange : StableGeniePay;
3805
+ const isExchange = variant === "exchange" || variant === "rwa";
3806
+ const Comp = variant === "swap" ? StableGenieSwap : isExchange ? StableGenieExchange : StableGeniePay;
3336
3807
  const { variant: _variant, ...props } = config;
3337
- root.render(createElement(Comp, props));
3808
+ root.render(createElement(Comp, variant === "rwa" ? { ...props, product: "rwa" } : props));
3338
3809
  return () => root.unmount();
3339
3810
  }
3340
3811
 
3341
- export { PaymentIsland, StableGenieExchange, StableGeniePay, StableGenieProvider, StableGenieSwap, darkTheme, lightTheme, mount, resolveTheme };
3812
+ export { CompliancePanel, PaymentIsland, StableGenieExchange, StableGeniePay, StableGenieProvider, StableGenieRwaExchange, StableGenieSwap, darkTheme, lightTheme, mount, resolveTheme };