@glacislabs/stablegenie-zerodelta 4.13.1 → 4.14.1

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/mount.cjs CHANGED
@@ -1714,6 +1714,11 @@ function assetClassOf(symbol) {
1714
1714
  if (STABLE_ASSETS.has(key)) return "stable";
1715
1715
  return null;
1716
1716
  }
1717
+ var NEST_VAULT_SHARES = /* @__PURE__ */ new Set(["NALPHA", "NTBILL", "NBASIS", "NCREDIT", "NOPAL", "NWISDOM", "NACRDX", "NLCRD", "NAXI", "NCLOA", "NFALCON"]);
1718
+ function isSellableRwa(token) {
1719
+ if (assetClassOf(token.symbol) !== "rwa") return true;
1720
+ return token.isSellSource === true || !NEST_VAULT_SHARES.has(symbolKey(token.symbol));
1721
+ }
1717
1722
  function productAssets(product) {
1718
1723
  return product === "rwa" ? /* @__PURE__ */ new Set([...STABLE_ASSETS, ...TRADEABLE_RWA_ASSETS]) : EXECUTABLE_STABLE_ASSETS;
1719
1724
  }
@@ -1820,10 +1825,11 @@ function buildCatalogue(input) {
1820
1825
  const catalogue = ready ? projectedCatalogue : allowed;
1821
1826
  const hubSymbols = hubDeliverableSymbols(catalogue, execution);
1822
1827
  const ctx = { source: source2, destination, lanes, execution, sourceChains, hubSymbols, ...brokenLanes ? { brokenLanes } : {} };
1823
- const sources2 = ready ? catalogue.filter((token) => isSourceToken(token, ctx) && hasReachableDestination(token, catalogue, ctx)) : (
1828
+ const sellable = (token) => product !== "rwa" || isSellableRwa(token);
1829
+ const sources2 = ready ? catalogue.filter((token) => sellable(token) && isSourceToken(token, ctx) && hasReachableDestination(token, catalogue, ctx)) : (
1824
1830
  // Unprojected: the only rule we can still apply with confidence is the escrow-chain bound,
1825
1831
  // which comes from this build's own pins rather than from the registry.
1826
- catalogue.filter((token) => sourceChains.has(Number(token.chainId)))
1832
+ catalogue.filter((token) => sellable(token) && sourceChains.has(Number(token.chainId)))
1827
1833
  );
1828
1834
  const byId = new Map(enabledChains.map((c) => [Number(c.chainId), c]));
1829
1835
  for (const id of chainIds) if (!byId.has(id)) byId.set(id, { chainId: id, isEnabled: true });
@@ -3538,7 +3544,7 @@ var CHANNEL_HEADER = "x-zd-channel";
3538
3544
  var CHANNEL_VERSION_HEADER = "x-zd-channel-version";
3539
3545
  var CHANNEL_ORIGIN_HEADER = "x-zd-channel-origin";
3540
3546
  var WIDGET_CHANNEL = "widget";
3541
- var WIDGET_VERSION = "4.13.1" ;
3547
+ var WIDGET_VERSION = "4.14.1" ;
3542
3548
  var MAX_CHANNEL_VERSION_LEN = 32;
3543
3549
  function sanitizeVersion(raw2) {
3544
3550
  const v = String(raw2).trim();
@@ -4821,18 +4827,20 @@ function useWallet(injected2) {
4821
4827
  const [connecting, setConnecting] = react.useState(false);
4822
4828
  const [error, setError] = react.useState(null);
4823
4829
  const providerRef = react.useRef(injected2 ?? null);
4830
+ const forgotten = react.useRef(false);
4831
+ const generation = react.useRef(0);
4824
4832
  react.useEffect(() => {
4825
4833
  const p = provider;
4826
4834
  if (!p) return;
4827
4835
  let alive = true;
4828
- const onAccounts = (accs) => alive && setAccount(Array.isArray(accs) && accs[0] ? accs[0] : null);
4836
+ const onAccounts = (accs) => alive && !forgotten.current && setAccount(Array.isArray(accs) && accs[0] ? accs[0] : null);
4829
4837
  const onChain = (hex) => alive && setChainId(hexToChain(hex));
4830
4838
  p.on?.("accountsChanged", onAccounts);
4831
4839
  p.on?.("chainChanged", onChain);
4832
4840
  (async () => {
4833
4841
  try {
4834
4842
  const accs = await getAccounts(p);
4835
- if (alive && accs[0]) setAccount(accs[0]);
4843
+ if (alive && accs[0] && !forgotten.current) setAccount(accs[0]);
4836
4844
  const cid = await getChainId(p);
4837
4845
  if (alive) setChainId(cid);
4838
4846
  } catch {
@@ -4853,11 +4861,14 @@ function useWallet(injected2) {
4853
4861
  const connect = react.useCallback(async () => {
4854
4862
  setConnecting(true);
4855
4863
  setError(null);
4864
+ forgotten.current = false;
4865
+ const request = ++generation.current;
4856
4866
  try {
4857
4867
  const p = providerRef.current ?? await resolveProvider(injected2);
4858
4868
  providerRef.current = p;
4859
4869
  setProvider(p);
4860
4870
  const accs = await requestAccounts(p);
4871
+ if (request !== generation.current) return;
4861
4872
  setAccount(accs[0] ?? null);
4862
4873
  setChainId(await getChainId(p));
4863
4874
  } catch (e) {
@@ -4866,7 +4877,19 @@ function useWallet(injected2) {
4866
4877
  setConnecting(false);
4867
4878
  }
4868
4879
  }, [injected2]);
4869
- return { provider, account, chainId, connecting, error, connect };
4880
+ const disconnect = react.useCallback(async () => {
4881
+ forgotten.current = true;
4882
+ generation.current += 1;
4883
+ setConnecting(false);
4884
+ setAccount(null);
4885
+ setError(null);
4886
+ const p = providerRef.current;
4887
+ try {
4888
+ await p?.request({ method: "wallet_revokePermissions", params: [{ eth_accounts: {} }] });
4889
+ } catch {
4890
+ }
4891
+ }, []);
4892
+ return { provider, account, chainId, connecting, error, connect, disconnect };
4870
4893
  }
4871
4894
 
4872
4895
  // src/react/txHistoryStore.ts
@@ -6109,6 +6132,106 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
6109
6132
  .sg-overlay[data-sg-overlay="drawer"] .sg-pane--note{min-height:145px}
6110
6133
  @keyframes sg-drawer-in{from{transform:translateX(100%)}to{transform:none}}
6111
6134
  @media (prefers-reduced-motion:reduce){.sg-overlay,.sg-dialog{animation:none!important}.sg-pillbtn{transition:none}}
6135
+ /* \u2500\u2500 Wallets + Recipient sheets \u2014 Figma ZD-dApp 3154:48121 / 3155:49634 (2026-10-28) \u2500\u2500 */
6136
+ .sg-widget{--sg-t50:color-mix(in srgb,var(--sg-text) 50%,transparent);--sg-a4:color-mix(in srgb,var(--sg-accent) 4%,transparent);--sg-a12:color-mix(in srgb,var(--sg-accent) 12%,transparent);--sg-flag:#fd6b6e;--sg-ok-ink:#1ba669}
6137
+ .sg-widget[data-sg-mode="dark"]{--sg-a4:color-mix(in srgb,var(--sg-accent) 10%,transparent);--sg-a12:var(--sg-border);--sg-ok-ink:var(--sg-success)}
6138
+ .sg-wallet[data-connected="true"]{cursor:pointer;height:30px;box-sizing:border-box;padding:7px 11px;gap:6px;border-radius:16px;border-color:var(--sg-a12);color:var(--sg-t80)}
6139
+ .sg-wallet[data-connected="true"]:hover:not(:disabled){border-color:var(--sg-accent);color:var(--sg-t80)}
6140
+ .sg-wallet[data-connected="true"]:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px}
6141
+ .sg-wallet-label{opacity:.9}
6142
+ .sg-wallet[data-connected="true"] svg{flex:0 0 auto;margin-right:-1px}
6143
+ .sg-ws{display:flex;flex-direction:column;justify-content:space-between;gap:20px;box-sizing:border-box;width:100%;animation:sg-cp-in var(--sg-motion-fast) var(--sg-ease-out-soft) both}
6144
+ .sg-ws:focus{outline:none}
6145
+ .sg-ws-top{display:flex;flex-direction:column;gap:28px}
6146
+ .sg-ws-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
6147
+ .sg-ws-back{display:inline-flex;align-items:center;gap:10px;padding:0;border:0;background:transparent;font:inherit;font-size:16px;font-weight:500;line-height:1.2;color:var(--sg-t60);cursor:pointer}
6148
+ .sg-ws-back svg{flex:0 0 auto}
6149
+ .sg-ws-back:hover{color:var(--sg-text)}
6150
+ .sg-ws-close{display:flex;align-items:center;justify-content:center;width:30px;height:30px;padding:0;border:0;border-radius:8px;background:transparent;color:#a7a9be;cursor:pointer}
6151
+ .sg-ws-close:hover{color:var(--sg-text)}
6152
+ .sg-ws-back:focus-visible,.sg-ws-close:focus-visible,.sg-ws-icon-btn:focus-visible,.sg-ws-action:focus-visible,.sg-ws-sum:focus-visible,.sg-rcp-opt:focus-visible,.sg-rcp-custom:focus-visible,.sg-rcp-change:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px}
6153
+ .sg-ws-main{display:flex;flex-direction:column;gap:16px}
6154
+ .sg-ws-title{margin:0;font-family:var(--sg-font-display);font-size:16px;font-weight:600;line-height:1.2;letter-spacing:.32px;color:var(--sg-t90)}
6155
+ .sg-ws[data-wide]{gap:16px}
6156
+ .sg-ws[data-wide] .sg-ws-sum-lead{min-width:0}
6157
+ .sg-ws[data-wide] .sg-ws-sum-text{overflow:hidden;text-overflow:ellipsis}
6158
+ .sg-widget[data-sg-mode="dark"] :is(.sg-ws-action,.sg-rcp-custom,.sg-rcp-change,.sg-ws-icon-btn,.sg-rcp-tick){color:var(--sg-info)}
6159
+ .sg-ws[data-wide] .sg-ws-back{font-size:12px;font-weight:400}
6160
+ .sg-ws[data-wide] .sg-ws-title{font-family:var(--sg-font);font-size:18px;font-weight:500;letter-spacing:0}
6161
+ .sg-ws-list{display:flex;flex-direction:column;gap:4px}
6162
+ .sg-ws-list[data-gap="8"]{gap:8px}
6163
+ .sg-ws-row{display:flex;flex-direction:column;gap:12px;box-sizing:border-box;width:100%;padding:18px 16px;border:0;border-radius:24px;background:var(--sg-a4);color:var(--sg-text);font:inherit;text-align:left}
6164
+ .sg-ws-row-line{display:flex;align-items:center;justify-content:space-between;gap:12px}
6165
+ .sg-ws-id{display:flex;align-items:center;gap:20px;min-width:0}
6166
+ .sg-ws-id-text{display:flex;flex-direction:column;align-items:flex-start;gap:4px;min-width:0;line-height:1.2;white-space:nowrap}
6167
+ .sg-ws-id-label{display:inline-flex;align-items:center;gap:8px;font-size:12px;color:var(--sg-t50)}
6168
+ .sg-ws-addr{font-size:16px;font-weight:500;color:var(--sg-t80)}
6169
+ .sg-ws-pill{display:inline-flex;align-items:center;padding:4px 8px;border-radius:16px;font-size:11px;font-weight:500;line-height:1.2}
6170
+ .sg-ws-pill[data-tone="blocked"]{background:color-mix(in srgb,var(--sg-flag) 12%,transparent);color:var(--sg-flag)}
6171
+ .sg-ws-pill[data-tone="ok"]{background:color-mix(in srgb,var(--sg-success) 6%,transparent);color:color-mix(in srgb,var(--sg-success) 80%,transparent)}
6172
+ .sg-ws-note{margin:0;font-size:12px;line-height:1.2;color:var(--sg-t60)}
6173
+ .sg-ws-avatar{position:relative;flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:31px;background:#e7e8f3;color:#2c2d34}
6174
+ .sg-ws-avatar[data-family="solana"]{background:#1a2ba3;color:#fff}
6175
+ .sg-ws-avatar-chain{position:absolute;left:20px;top:21px;display:flex;padding:2px;border:2px solid var(--sg-surface);border-radius:10px;background:var(--sg-surface);overflow:hidden}
6176
+ .sg-ws-avatar-chain img{display:block;width:12px;height:12px;border-radius:8px;object-fit:cover}
6177
+ .sg-ws-icon-btn{display:flex;align-items:center;justify-content:center;flex:0 0 auto;width:24px;height:24px;margin:-4px;padding:0;border:0;border-radius:8px;background:transparent;color:var(--sg-accent);cursor:pointer}
6178
+ .sg-ws-icon-btn:hover{background:var(--sg-a12)}
6179
+ .sg-ws-action{flex-direction:row;align-items:center;justify-content:space-between;border-radius:20px;font-size:13px;font-weight:500;line-height:1.4;color:var(--sg-accent);cursor:pointer}
6180
+ .sg-ws-action:hover:not(:disabled){background:color-mix(in srgb,var(--sg-accent) 8%,transparent)}
6181
+ .sg-ws-action:disabled{cursor:progress;opacity:.7}
6182
+ .sg-ws-action svg{flex:0 0 auto}
6183
+ .sg-ws-sum{display:flex;align-items:center;justify-content:space-between;gap:8px;box-sizing:border-box;width:100%;padding:16px;border:0;border-radius:20px;font:inherit;text-align:left;background:color-mix(in srgb,var(--sg-text) 3%,transparent)}
6184
+ button.sg-ws-sum{cursor:pointer}
6185
+ .sg-ws-sum[data-tone="ok"]{background:color-mix(in srgb,var(--sg-success) 4%,transparent)}
6186
+ .sg-ws-sum[data-tone="blocked"]{background:color-mix(in srgb,var(--sg-flag) 8%,transparent)}
6187
+ .sg-ws-sum-lead{display:inline-flex;align-items:center;gap:8px;font-size:13px;font-weight:500;line-height:1.2;color:var(--sg-t80);white-space:nowrap}
6188
+ .sg-ws-sum-lead svg{flex:0 0 auto;color:var(--sg-accent)}
6189
+ .sg-ws-sum[data-tone="ok"] .sg-ws-sum-lead svg{color:var(--sg-success)}
6190
+ .sg-ws-sum[data-tone="blocked"] .sg-ws-sum-lead svg{color:var(--sg-flag)}
6191
+ .sg-ws-sum[data-tone="unknown"] .sg-ws-sum-lead svg{color:var(--sg-text-muted)}
6192
+ .sg-ws-sum-act{display:inline-flex;align-items:center;gap:8px;padding:4px 0;font-size:11px;font-weight:500;line-height:1.2;color:var(--sg-t90);white-space:nowrap}
6193
+ .sg-ws-sum[data-tone="ok"] .sg-ws-sum-act{color:var(--sg-ok-ink)}
6194
+ .sg-ws-sum[data-tone="ok"] .sg-ws-sum-act svg{color:color-mix(in srgb,var(--sg-success) 80%,transparent)}
6195
+ .sg-ws-sum[data-tone="blocked"] .sg-ws-sum-act{color:var(--sg-flag)}
6196
+ .sg-ws-sum[data-tone="unknown"] .sg-ws-sum-act{color:var(--sg-text-muted)}
6197
+ .sg-ws-spin{animation:sg-ws-spin 900ms linear infinite}
6198
+ @keyframes sg-ws-spin{to{transform:rotate(360deg)}}
6199
+ .sg-ws-error{margin:0;font-size:12px;line-height:1.3;color:var(--sg-danger)}
6200
+ .sg-ws-foot{flex:0 0 auto}
6201
+ .sg-btn.sg-ws-cta{height:44px;min-height:44px;padding:0 24px}
6202
+ .sg-btn.sg-ws-cta:disabled{opacity:.2;cursor:not-allowed}
6203
+ .sg-rcp-row{display:flex;align-items:center;justify-content:space-between;gap:8px;box-sizing:border-box;width:100%;padding:12px 16px;border-radius:24px;background:var(--sg-a4);font-size:12px;line-height:1.2;white-space:nowrap}
6204
+ .sg-rcp-row[data-wide]{background:transparent;border:1px solid var(--sg-a12);padding:12px 16px}
6205
+ .sg-rcp-row[data-tone="error"]{white-space:normal;color:var(--sg-danger);background:color-mix(in srgb,var(--sg-danger) 8%,transparent)}
6206
+ .sg-rcp-label{color:var(--sg-t60)}
6207
+ .sg-rcp-end{display:inline-flex;align-items:center;gap:8px;min-width:0}
6208
+ .sg-rcp-value{color:var(--sg-t90);overflow:hidden;text-overflow:ellipsis}
6209
+ .sg-rcp-value[data-empty]{color:var(--sg-t50)}
6210
+ .sg-rcp-change{padding:0;border:0;background:transparent;font:inherit;font-size:12px;font-weight:500;line-height:1.4;color:var(--sg-accent);cursor:pointer}
6211
+ .sg-rcp-change:hover:not(:disabled){text-decoration:underline}
6212
+ .sg-rcp-change:disabled{opacity:.5;cursor:not-allowed}
6213
+ .sg-rcp-opt{display:flex;align-items:center;justify-content:space-between;gap:12px;box-sizing:border-box;width:100%;padding:18px 16px;border:1px solid var(--sg-a12);border-radius:24px;background:transparent;color:var(--sg-text);font:inherit;text-align:left;cursor:pointer}
6214
+ .sg-rcp-opt[data-selected]{border-color:transparent;background:var(--sg-a4)}
6215
+ .sg-rcp-opt:hover:not(:disabled):not([data-selected]){border-color:color-mix(in srgb,var(--sg-accent) 40%,transparent)}
6216
+ .sg-rcp-opt:disabled{cursor:not-allowed;opacity:.45}
6217
+ .sg-rcp-tick{display:flex;color:var(--sg-accent);flex:0 0 auto}
6218
+ .sg-rcp-custom{display:flex;align-items:center;justify-content:space-between;gap:8px;box-sizing:border-box;width:100%;padding:18px 16px;border:1px solid var(--sg-a12);border-radius:20px;background:transparent;font:inherit;font-size:13px;font-weight:500;line-height:1.4;color:var(--sg-accent);text-align:left;cursor:pointer}
6219
+ .sg-rcp-custom svg{flex:0 0 auto}
6220
+ .sg-rcp-custom[data-open]{flex-direction:column;align-items:stretch;gap:8px;border-color:transparent;background:var(--sg-a4);cursor:default}
6221
+ .sg-rcp-custom-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
6222
+ .sg-rcp-custom-head label{cursor:text}
6223
+ .sg-rcp-input{box-sizing:border-box;width:100%;padding:11px 16px;border:1px solid var(--sg-a12);border-radius:12px;background:var(--sg-bg);color:var(--sg-t90);font:inherit;font-size:12px;font-weight:400;line-height:1.2;outline:none;text-overflow:ellipsis}
6224
+ .sg-rcp-input::placeholder{color:var(--sg-t50)}
6225
+ .sg-rcp-input:focus{border-color:var(--sg-accent)}
6226
+ .sg-rcp-input[aria-invalid="true"]{border-color:var(--sg-danger)}
6227
+ .sg-rcp-hint{margin:0;font-size:12px;font-weight:400;line-height:1.2;color:var(--sg-t60)}
6228
+ .sg-widget[data-sg-takeover]{display:flex;flex-direction:column}
6229
+ .sg-widget[data-sg-takeover]>.sg-head,.sg-widget[data-sg-takeover]>.sg-foot{display:none}
6230
+ .sg-widget[data-sg-takeover]>.sg-body{display:flex;flex-direction:column;flex:1 1 auto}
6231
+ .sg-widget[data-sg-takeover]>.sg-body>.sg-ws{flex:1 1 auto}
6232
+ .sg-widget[data-sg-side]:has(>.sg-ws){display:flex;flex-direction:column}
6233
+ .sg-widget[data-sg-side]>.sg-ws{flex:1 1 auto}
6234
+ @media (prefers-reduced-motion:reduce){.sg-ws{animation:none}.sg-ws-spin{animation:none}}
6112
6235
  `;
6113
6236
  var injected = false;
6114
6237
  function injectStyles() {
@@ -7322,7 +7445,7 @@ function WidgetShell(props) {
7322
7445
  const resolved = resolveTheme(props.theme);
7323
7446
  const vars = themeToVars(resolved);
7324
7447
  const fixed = Number.isFinite(props.heightPx) && props.heightPx > 0;
7325
- const style = fixed ? { ...vars, height: props.heightPx } : vars;
7448
+ const style = fixed ? { ...vars, height: props.heightPx } : props.minHeightPx ? { ...vars, minHeight: props.minHeightPx } : vars;
7326
7449
  return /* @__PURE__ */ jsxRuntime.jsxs(
7327
7450
  "div",
7328
7451
  {
@@ -7331,6 +7454,7 @@ function WidgetShell(props) {
7331
7454
  "data-sg-fixed": fixed || void 0,
7332
7455
  "data-sg-express": props.variant === "express" || void 0,
7333
7456
  "data-sg-wide": props.wide || void 0,
7457
+ "data-sg-takeover": props.takeover || void 0,
7334
7458
  style,
7335
7459
  children: [
7336
7460
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-head", children: [
@@ -8240,12 +8364,19 @@ function useRecipient(destinationChainId, hostRecipient, opts = {}) {
8240
8364
  const [custom, setCustom] = react.useState({});
8241
8365
  const [open, setOpen] = react.useState(false);
8242
8366
  const triggerRef = react.useRef(null);
8367
+ const evmAccount = opts.evm?.account ?? null;
8243
8368
  const evmManaged = recipientFamily === "evm" && Boolean(opts.sourceIsSolana);
8244
- const managed = hostRecipient === void 0 && (recipientFamily === "solana" || evmManaged);
8369
+ const required = recipientFamily === "solana" || evmManaged;
8370
+ const managed = hostRecipient === void 0 && (required || Boolean(opts.evm));
8245
8371
  const error = hostRecipient === void 0 ? null : recipientFamily === "solana" && !isSolanaAddress(hostRecipient) ? "The configured recipient is not a Solana address." : evmManaged && !isAddress(hostRecipient) ? "The configured recipient is not an EVM address." : null;
8246
- const recipient2 = hostRecipient !== void 0 ? hostRecipient : recipientFamily === "solana" ? custom.solana || wallet.address || void 0 : evmManaged ? custom.evm || opts.evm?.account || void 0 : void 0;
8247
- const missing = managed && !recipient2;
8248
- const familyWallet = recipientFamily === "solana" ? { address: wallet.address, wallets: wallet.wallets, connecting: wallet.status === "connecting", error: wallet.error } : { address: opts.evm?.account ?? null, wallets: [], connecting: Boolean(opts.evm?.connecting), error: null };
8372
+ const recipient2 = hostRecipient !== void 0 ? hostRecipient : recipientFamily === "solana" ? custom.solana || wallet.address || void 0 : evmManaged ? custom.evm || evmAccount || void 0 : opts.evm ? custom.evm || void 0 : void 0;
8373
+ const missing = managed && required && !recipient2;
8374
+ const shown = recipient2 ?? (recipientFamily === "evm" && !required ? evmAccount ?? void 0 : void 0);
8375
+ const typed = hostRecipient === void 0 ? custom[recipientFamily] || "" : "";
8376
+ const familyWallet = recipientFamily === "solana" ? { address: wallet.address, wallets: wallet.wallets, connecting: wallet.status === "connecting", error: wallet.error } : { address: evmAccount, wallets: [], connecting: Boolean(opts.evm?.connecting), error: null };
8377
+ const wallets = [];
8378
+ if (evmAccount) wallets.push({ family: "evm", address: evmAccount, eligible: recipientFamily === "evm" });
8379
+ if (wallet.address) wallets.push({ family: "solana", address: wallet.address, eligible: recipientFamily === "solana" });
8249
8380
  const close = () => {
8250
8381
  setOpen(false);
8251
8382
  requestAnimationFrame(() => triggerRef.current?.focus());
@@ -8256,7 +8387,7 @@ function useRecipient(destinationChainId, hostRecipient, opts = {}) {
8256
8387
  };
8257
8388
  const connect = async (name) => {
8258
8389
  if (recipientFamily === "evm") {
8259
- if (opts.evm?.account) selectAddress("");
8390
+ if (evmAccount) selectAddress("");
8260
8391
  else opts.evm?.connect();
8261
8392
  return;
8262
8393
  }
@@ -8272,38 +8403,170 @@ function useRecipient(destinationChainId, hostRecipient, opts = {}) {
8272
8403
  if (typeof address === "string") selectAddress("");
8273
8404
  else setOpen(true);
8274
8405
  };
8275
- const recipientFor = (account) => recipientFamily === "solana" || evmManaged ? recipient2 || "" : hostRecipient || account;
8276
- return { recipientFamily, recipient: recipient2, recipientFor, managed, missing, error, wallet, familyWallet, open: open && managed, show: () => setOpen(true), close, selectAddress, connect, triggerRef };
8406
+ const recipientFor = (account) => required ? recipient2 || "" : hostRecipient || custom.evm || account;
8407
+ return { recipientFamily, recipientChainId: destinationChainId, recipient: recipient2, shown, typed, recipientFor, managed, missing, error, wallet, familyWallet, wallets, open: open && managed, show: () => setOpen(true), close, selectAddress, connect, triggerRef };
8277
8408
  }
8278
- var short = (address) => `${address.slice(0, 4)}\u2026${address.slice(-4)}`;
8279
- function RecipientNote({ state, disabled }) {
8280
- if (state.error) return /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: state.error });
8281
- if (!state.managed) return null;
8282
- const family = state.recipientFamily === "solana" ? "Solana" : "EVM";
8283
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "center", gap: 6, marginTop: 10, fontSize: 13, color: "var(--sg-text-muted)", flexWrap: "wrap" }, children: [
8284
- state.recipient ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8285
- "To ",
8286
- /* @__PURE__ */ jsxRuntime.jsx("b", { className: "sg-mono", title: state.recipient, style: { color: "var(--sg-text)" }, children: short(state.recipient) }),
8287
- " on ",
8288
- family,
8289
- " \xB7 "
8290
- ] }) : null,
8291
- /* @__PURE__ */ jsxRuntime.jsx("button", { ref: state.triggerRef, type: "button", className: "sg-cp-link", onClick: state.show, disabled, "aria-haspopup": "dialog", children: state.recipient ? "Change" : "Send to a different address" })
8409
+
8410
+ // src/core/checksum.ts
8411
+ var RC = [
8412
+ 0x0000000000000001n,
8413
+ 0x0000000000008082n,
8414
+ 0x800000000000808an,
8415
+ 0x8000000080008000n,
8416
+ 0x000000000000808bn,
8417
+ 0x0000000080000001n,
8418
+ 0x8000000080008081n,
8419
+ 0x8000000000008009n,
8420
+ 0x000000000000008an,
8421
+ 0x0000000000000088n,
8422
+ 0x0000000080008009n,
8423
+ 0x000000008000000an,
8424
+ 0x000000008000808bn,
8425
+ 0x800000000000008bn,
8426
+ 0x8000000000008089n,
8427
+ 0x8000000000008003n,
8428
+ 0x8000000000008002n,
8429
+ 0x8000000000000080n,
8430
+ 0x000000000000800an,
8431
+ 0x800000008000000an,
8432
+ 0x8000000080008081n,
8433
+ 0x8000000000008080n,
8434
+ 0x0000000080000001n,
8435
+ 0x8000000080008008n
8436
+ ];
8437
+ var ROT = [0, 1, 62, 28, 27, 36, 44, 6, 55, 20, 3, 10, 43, 25, 39, 41, 45, 15, 21, 8, 18, 2, 61, 56, 14];
8438
+ var MASK = (1n << 64n) - 1n;
8439
+ var rotl = (x, n) => n === 0 ? x : (x << BigInt(n) | x >> BigInt(64 - n)) & MASK;
8440
+ function keccakF(s) {
8441
+ for (let round = 0; round < 24; round++) {
8442
+ const c = [0, 1, 2, 3, 4].map((x) => s[x] ^ s[x + 5] ^ s[x + 10] ^ s[x + 15] ^ s[x + 20]);
8443
+ for (let x = 0; x < 5; x++) {
8444
+ const d = c[(x + 4) % 5] ^ rotl(c[(x + 1) % 5], 1);
8445
+ for (let y = 0; y < 25; y += 5) s[y + x] = s[y + x] ^ d;
8446
+ }
8447
+ const b = new Array(25);
8448
+ for (let x = 0; x < 5; x++) for (let y = 0; y < 5; y++) b[y + 5 * ((2 * x + 3 * y) % 5)] = rotl(s[x + 5 * y], ROT[x + 5 * y]);
8449
+ for (let x = 0; x < 5; x++) for (let y = 0; y < 25; y += 5) s[y + x] = b[y + x] ^ ~b[y + (x + 1) % 5] & MASK & b[y + (x + 2) % 5];
8450
+ s[0] = s[0] ^ RC[round];
8451
+ }
8452
+ }
8453
+ function keccak256Hex(bytes) {
8454
+ const rate = 136;
8455
+ const padded = new Uint8Array(Math.ceil((bytes.length + 1) / rate) * rate);
8456
+ padded.set(bytes);
8457
+ padded[bytes.length] = padded[bytes.length] ^ 1;
8458
+ padded[padded.length - 1] = padded[padded.length - 1] ^ 128;
8459
+ const s = new Array(25).fill(0n);
8460
+ for (let off = 0; off < padded.length; off += rate) {
8461
+ for (let i = 0; i < rate / 8; i++) {
8462
+ let lane = 0n;
8463
+ for (let j = 7; j >= 0; j--) lane = lane << 8n | BigInt(padded[off + i * 8 + j]);
8464
+ s[i] = s[i] ^ lane;
8465
+ }
8466
+ keccakF(s);
8467
+ }
8468
+ let out = "";
8469
+ for (let i = 0; i < 4; i++) for (let j = 0; j < 8; j++) out += Number(s[i] >> BigInt(8 * j) & 0xffn).toString(16).padStart(2, "0");
8470
+ return out;
8471
+ }
8472
+ function toChecksumAddress(address) {
8473
+ const lower2 = address.slice(2).toLowerCase();
8474
+ const hash2 = keccak256Hex(new TextEncoder().encode(lower2));
8475
+ let out = "0x";
8476
+ for (let i = 0; i < 40; i++) out += Number.parseInt(hash2[i], 16) >= 8 ? lower2[i].toUpperCase() : lower2[i];
8477
+ return out;
8478
+ }
8479
+ function hasValidChecksum(address) {
8480
+ if (!/^0x[0-9a-fA-F]{40}$/.test(address)) return false;
8481
+ const body = address.slice(2);
8482
+ if (body === body.toLowerCase() || body === body.toUpperCase()) return true;
8483
+ return toChecksumAddress(address) === address;
8484
+ }
8485
+ function ArrowLeft() {
8486
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
8487
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6.38 3.95312L2.33333 7.99979L6.38 12.0465", stroke: "currentColor", strokeWidth: "1.2", strokeMiterlimit: "10", strokeLinecap: "round", strokeLinejoin: "round" }),
8488
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M13.6667 8H2.44667", stroke: "currentColor", strokeWidth: "1.2", strokeMiterlimit: "10", strokeLinecap: "round", strokeLinejoin: "round" })
8292
8489
  ] });
8293
8490
  }
8294
- function RecipientSheet({ state, symbol }) {
8295
- const [draft, setDraft] = react.useState(state.recipient ?? "");
8296
- const id = react.useId();
8297
- const inputRef = react.useRef(null);
8491
+ function CloseX() {
8492
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18 6L6 18M6 6L18 18", stroke: "currentColor", strokeWidth: "1.49983", strokeLinecap: "round", strokeLinejoin: "round" }) });
8493
+ }
8494
+ function AddCircle() {
8495
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": "true", children: [
8496
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 16.5C13.125 16.5 16.5 13.125 16.5 9C16.5 4.875 13.125 1.5 9 1.5C4.875 1.5 1.5 4.875 1.5 9C1.5 13.125 4.875 16.5 9 16.5Z", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round" }),
8497
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6 9H12M9 12V6", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round" })
8498
+ ] });
8499
+ }
8500
+ function Tick2() {
8501
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2.0625 6.5625L4.6875 9.1875L9.9375 3.5625", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
8502
+ }
8503
+ function Logout() {
8504
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
8505
+ "path",
8506
+ {
8507
+ fill: "currentColor",
8508
+ d: "M3.33333 14C2.96667 14 2.65289 13.8696 2.392 13.6087C2.13111 13.3478 2.00044 13.0338 2 12.6667V3.33333C2 2.96667 2.13067 2.65289 2.392 2.392C2.65333 2.13111 2.96711 2.00044 3.33333 2H7.33333C7.52222 2 7.68067 2.064 7.80867 2.192C7.93667 2.32 8.00044 2.47822 8 2.66667C7.99955 2.85511 7.93555 3.01356 7.808 3.142C7.68044 3.27044 7.52222 3.33422 7.33333 3.33333H3.33333V12.6667H7.33333C7.52222 12.6667 7.68067 12.7307 7.80867 12.8587C7.93667 12.9867 8.00044 13.1449 8 13.3333C7.99955 13.5218 7.93555 13.6802 7.808 13.8087C7.68044 13.9371 7.52222 14.0009 7.33333 14H3.33333ZM11.45 8.66667H6.66667C6.47778 8.66667 6.31955 8.60267 6.192 8.47467C6.06444 8.34667 6.00044 8.18844 6 8C5.99955 7.81155 6.06356 7.65333 6.192 7.52533C6.32044 7.39733 6.47867 7.33333 6.66667 7.33333H11.45L10.2 6.08333C10.0778 5.96111 10.0167 5.81111 10.0167 5.63333C10.0167 5.45555 10.0778 5.3 10.2 5.16667C10.3222 5.03333 10.4778 4.96378 10.6667 4.958C10.8556 4.95222 11.0167 5.01622 11.15 5.15L13.5333 7.53333C13.6667 7.66667 13.7333 7.82222 13.7333 8C13.7333 8.17778 13.6667 8.33333 13.5333 8.46667L11.15 10.85C11.0167 10.9833 10.8584 11.0473 10.6753 11.042C10.4922 11.0367 10.3338 10.9671 10.2 10.8333C10.0778 10.7 10.0196 10.5418 10.0253 10.3587C10.0311 10.1756 10.0949 10.0227 10.2167 9.9L11.45 8.66667Z"
8509
+ }
8510
+ ) });
8511
+ }
8512
+ function ShieldTickBold() {
8513
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
8514
+ "path",
8515
+ {
8516
+ fill: "currentColor",
8517
+ d: "M10.815 2.40333L7.60667 1.20167C7.27417 1.07917 6.73167 1.07917 6.39917 1.20167L3.19083 2.40333C2.5725 2.63667 2.07083 3.36 2.07083 4.01917V8.74417C2.07083 9.21667 2.38 9.84083 2.75917 10.1208L5.9675 12.5183C6.53333 12.9442 7.46083 12.9442 8.02667 12.5183L11.235 10.1208C11.6142 9.835 11.9233 9.21667 11.9233 8.74417V4.01917C11.9292 3.36 11.4275 2.63667 10.815 2.40333ZM9.03 5.67L6.52167 8.17833C6.43417 8.26583 6.32333 8.30667 6.2125 8.30667C6.10167 8.30667 5.99083 8.26583 5.90333 8.17833L4.97 7.23333C4.80083 7.06417 4.80083 6.78417 4.97 6.615C5.13917 6.44583 5.41917 6.44583 5.58833 6.615L6.21833 7.245L8.4175 5.04583C8.58667 4.87667 8.86667 4.87667 9.03583 5.04583C9.205 5.215 9.205 5.50083 9.03 5.67Z"
8518
+ }
8519
+ ) });
8520
+ }
8521
+ function CloseCircleBold() {
8522
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
8523
+ "path",
8524
+ {
8525
+ fill: "currentColor",
8526
+ d: "M7 1.16667C3.78583 1.16667 1.16667 3.78583 1.16667 7C1.16667 10.2142 3.78583 12.8333 7 12.8333C10.2142 12.8333 12.8333 10.2142 12.8333 7C12.8333 3.78583 10.2142 1.16667 7 1.16667ZM8.96 8.34167C9.12917 8.51083 9.12917 8.79083 8.96 8.96C8.8725 9.0475 8.76167 9.08833 8.65083 9.08833C8.54 9.08833 8.42917 9.0475 8.34167 8.96L7 7.61833L5.65833 8.96C5.57083 9.0475 5.46 9.08833 5.34917 9.08833C5.23833 9.08833 5.1275 9.0475 5.04 8.96C4.87083 8.79083 4.87083 8.51083 5.04 8.34167L6.38167 7L5.04 5.65833C4.87083 5.48917 4.87083 5.20917 5.04 5.04C5.20917 4.87083 5.48917 4.87083 5.65833 5.04L7 6.38167L8.34167 5.04C8.51083 4.87083 8.79083 4.87083 8.96 5.04C9.12917 5.20917 9.12917 5.48917 8.96 5.65833L7.61833 7L8.96 8.34167Z"
8527
+ }
8528
+ ) });
8529
+ }
8530
+ function Loader() {
8531
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "sg-ws-spin", width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
8532
+ "path",
8533
+ {
8534
+ fill: "currentColor",
8535
+ d: "M6.99935 12.8337C10.1616 12.8337 12.8327 10.1626 12.8327 7.00033H11.666C11.666 9.53024 9.52927 11.667 6.99935 11.667C4.46943 11.667 2.33268 9.53024 2.33268 7.00033C2.33268 4.47041 4.46943 2.33366 6.99935 2.33366V1.16699C3.8371 1.16699 1.16602 3.83866 1.16602 7.00033C1.16602 10.1626 3.8371 12.8337 6.99935 12.8337Z"
8536
+ }
8537
+ ) });
8538
+ }
8539
+ function SmallChevron() {
8540
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "5", height: "10", viewBox: "0 0 5 10", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0.503906 9L3.50391 6L0.503906 3", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }) });
8541
+ }
8542
+ function PixelGlyph() {
8543
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "21.5888", height: "17.3869", viewBox: "0 0 21.5888 17.3869", fill: "none", "aria-hidden": "true", children: [
8544
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0 0.000114202H4.94401V8.15773H0V0.000114202ZM16.6448 0.000114202H21.5888V8.15773H16.6448V0.000114202ZM4.94401 8.15773H9.55841V12.7721H4.94401V8.15773ZM12.0304 8.15773H16.6448V12.7721H12.0304V8.15773Z", fill: "#A7A9BE" }),
8545
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2.5034e-06 12.7725H4.94401V17.3869H2.5034e-06V12.7725ZM8.48722 12.7725H13.1016V17.3869H8.48722V12.7725ZM16.6448 12.7725H21.5888V17.3869H16.6448V12.7725Z", fill: "currentColor" })
8546
+ ] });
8547
+ }
8548
+ var FAMILY_LABEL = { evm: "EVM", solana: "Solana" };
8549
+ function walletShort(address) {
8550
+ return address.length > 14 ? `${address.slice(0, 7)}\u2026${address.slice(-5)}` : address;
8551
+ }
8552
+ function chipShort(address) {
8553
+ return address.length > 12 ? `${address.slice(0, 6)}\u2026${address.slice(-4)}` : address;
8554
+ }
8555
+ function WalletAvatar({ family, chainId }) {
8556
+ const [failed, setFailed] = react.useState([]);
8557
+ const mark = chainLogoCandidates(family === "solana" ? SOLANA_CHAIN_ID : chainId ?? 1).find((url) => !failed.includes(url));
8558
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-ws-avatar", "data-family": family, "aria-hidden": "true", children: [
8559
+ /* @__PURE__ */ jsxRuntime.jsx(PixelGlyph, {}),
8560
+ mark ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-ws-avatar-chain", children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: mark, alt: "", onError: () => setFailed((prev) => [...prev, mark]) }) }) : null
8561
+ ] });
8562
+ }
8563
+ function SheetFrame(props) {
8298
8564
  const sheetRef = react.useRef(null);
8299
- const closeRef = react.useRef(state.close);
8300
- closeRef.current = state.close;
8301
- const family = state.recipientFamily === "solana" ? "Solana" : "EVM";
8302
- const valid = state.recipientFamily === "solana" ? isSolanaAddress(draft) : /^0x[0-9a-fA-F]{40}$/.test(draft.trim());
8303
- const invalid = Boolean(draft.trim()) && !valid;
8304
- const noWallet = state.recipientFamily === "solana" && !state.familyWallet.address && !state.familyWallet.wallets.length;
8565
+ const closeRef = react.useRef(props.onClose);
8566
+ closeRef.current = props.onClose;
8567
+ const titleId = react.useId();
8305
8568
  react.useEffect(() => {
8306
- (noWallet ? inputRef : sheetRef).current?.focus();
8569
+ (props.initialFocus?.current ?? sheetRef.current)?.focus();
8307
8570
  const onKey = (event) => {
8308
8571
  if (event.key === "Escape") {
8309
8572
  event.stopPropagation();
@@ -8312,63 +8575,263 @@ function RecipientSheet({ state, symbol }) {
8312
8575
  };
8313
8576
  document.addEventListener("keydown", onKey, true);
8314
8577
  return () => document.removeEventListener("keydown", onKey, true);
8315
- }, [noWallet]);
8316
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-sheet", role: "dialog", "aria-modal": "true", "aria-label": `${family} recipient`, ref: sheetRef, tabIndex: -1, children: [
8317
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-sheet-head", children: [
8318
- /* @__PURE__ */ jsxRuntime.jsxs("h4", { className: "sg-cp-sheet-title", children: [
8319
- family,
8320
- " recipient"
8321
- ] }),
8322
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-cp-close", onClick: state.close, "aria-label": "Close recipient", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m6 6 12 12M18 6 6 18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
8578
+ }, []);
8579
+ return /* @__PURE__ */ jsxRuntime.jsxs(
8580
+ "div",
8581
+ {
8582
+ className: "sg-ws",
8583
+ "data-wide": props.wide || void 0,
8584
+ role: "dialog",
8585
+ "aria-modal": "true",
8586
+ "aria-label": props.label,
8587
+ ref: sheetRef,
8588
+ tabIndex: -1,
8589
+ style: props.minHeight ? { minHeight: props.minHeight } : void 0,
8590
+ children: [
8591
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-ws-top", children: [
8592
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-ws-head", children: [
8593
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-ws-back", onClick: () => closeRef.current(), children: [
8594
+ /* @__PURE__ */ jsxRuntime.jsx(ArrowLeft, {}),
8595
+ props.backLabel ?? "Back to Exchange"
8596
+ ] }),
8597
+ props.wide ? null : /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-ws-close", onClick: () => closeRef.current(), "aria-label": `Close ${props.label.toLowerCase()}`, children: /* @__PURE__ */ jsxRuntime.jsx(CloseX, {}) })
8598
+ ] }),
8599
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-ws-main", children: [
8600
+ /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "sg-ws-title", id: titleId, children: props.title }),
8601
+ props.children
8602
+ ] })
8603
+ ] }),
8604
+ props.footer ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-ws-foot", children: props.footer }) : null
8605
+ ]
8606
+ }
8607
+ );
8608
+ }
8609
+ function WalletChip(props) {
8610
+ const count = props.addresses.length;
8611
+ if (!count) {
8612
+ return /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-wallet", onClick: props.onConnect, disabled: props.connecting, children: props.connecting ? "Connecting\u2026" : "Connect wallet" });
8613
+ }
8614
+ const label2 = count === 1 ? chipShort(props.addresses[0]) : `${count} wallets`;
8615
+ return /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", ref: props.btnRef, className: "sg-wallet", "data-connected": "true", onClick: props.onOpen, disabled: props.disabled, "aria-haspopup": "dialog", "aria-label": `Wallets: ${label2}`, children: [
8616
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-wallet-dot", "aria-hidden": "true" }),
8617
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-wallet-label", children: label2 }),
8618
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 15.9961 15.9961", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 6.99854L7.99902 10.9976L11.998 6.99854", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }) })
8619
+ ] });
8620
+ }
8621
+ function screeningSummary(states2) {
8622
+ if (!states2.length || states2.some((s) => s.status === "pending")) return { tone: "pending", text: "Checking...", action: "Pending" };
8623
+ const blocked = states2.filter((s) => s.status === "done" && s.screen.blocked).length;
8624
+ if (blocked) {
8625
+ const text = blocked === states2.length ? states2.length === 1 ? "Wallet restricted" : states2.length === 2 ? "Both wallets restricted" : "All wallets restricted" : `${blocked} of ${states2.length} wallets restricted`;
8626
+ return { tone: "blocked", text, action: "View details" };
8627
+ }
8628
+ if (states2.some((s) => s.status === "error")) return { tone: "unknown", text: "Screening unavailable", action: "Try later" };
8629
+ return { tone: "ok", text: `${states2.length} wallet${states2.length === 1 ? "" : "s"} screened`, action: "No flags" };
8630
+ }
8631
+ function WalletsSheet(props) {
8632
+ const states2 = props.wallets.map((w) => props.screens[w.address] ?? { status: "pending" });
8633
+ const summary = screeningSummary(states2);
8634
+ const anyRestricted = states2.some((s) => s.status === "done" && s.screen.blocked);
8635
+ const summaryInner = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8636
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-ws-sum-lead", children: [
8637
+ summary.tone === "pending" ? /* @__PURE__ */ jsxRuntime.jsx(Loader, {}) : summary.tone === "blocked" ? /* @__PURE__ */ jsxRuntime.jsx(CloseCircleBold, {}) : /* @__PURE__ */ jsxRuntime.jsx(ShieldTickBold, {}),
8638
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-ws-sum-text", children: summary.text })
8323
8639
  ] }),
8324
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-sheet-body", children: [
8325
- /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card", children: [
8326
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "sg-cp-summary-sub", style: { margin: "0 0 12px" }, children: [
8327
- symbol,
8328
- " is delivered to a ",
8329
- family,
8330
- " wallet. Your EVM wallet stays the owner of the order and can cancel it."
8640
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-ws-sum-act", children: [
8641
+ summary.action,
8642
+ /* @__PURE__ */ jsxRuntime.jsx(SmallChevron, {})
8643
+ ] })
8644
+ ] });
8645
+ return /* @__PURE__ */ jsxRuntime.jsx(SheetFrame, { label: "Wallets", title: "Wallets", wide: props.wide, onClose: props.onClose, minHeight: props.minHeight, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-ws-list", "data-gap": "8", children: [
8646
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-ws-list", children: [
8647
+ props.wallets.map((w, i) => {
8648
+ const state = states2[i];
8649
+ const restricted = state.status === "done" && state.screen.blocked;
8650
+ const pill = restricted ? "Restricted" : anyRestricted && state.status === "done" ? "No flags" : null;
8651
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-ws-row", "data-restricted": restricted || void 0, children: [
8652
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-ws-row-line", children: [
8653
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-ws-id", children: [
8654
+ /* @__PURE__ */ jsxRuntime.jsx(WalletAvatar, { family: w.family, chainId: w.chainId }),
8655
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-ws-id-text", children: [
8656
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-ws-id-label", children: [
8657
+ FAMILY_LABEL[w.family],
8658
+ " Wallet",
8659
+ pill ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-ws-pill", "data-tone": restricted ? "blocked" : "ok", children: pill }) : null
8660
+ ] }),
8661
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-ws-addr", title: w.address, children: walletShort(w.address) })
8662
+ ] })
8663
+ ] }),
8664
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-ws-icon-btn", onClick: w.disconnect, "aria-label": `Disconnect ${FAMILY_LABEL[w.family]} wallet`, children: /* @__PURE__ */ jsxRuntime.jsx(Logout, {}) })
8665
+ ] }),
8666
+ restricted ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-ws-note", children: "This wallet can\u2019t be used because it didn\u2019t pass compliance screening." }) : null
8667
+ ] }, w.address);
8668
+ }),
8669
+ props.connect && (props.connect.choices?.length ?? 0) > 1 ? props.connect.choices.map((name) => /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-ws-row sg-ws-action", onClick: () => props.connect.onClick(name), disabled: props.connect.busy, children: [
8670
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
8671
+ "Connect ",
8672
+ name
8331
8673
  ] }),
8332
- /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: () => noWallet ? inputRef.current?.focus() : void state.connect(), busy: state.familyWallet.connecting, children: state.familyWallet.address ? `Use ${short(state.familyWallet.address)}` : `Connect ${family} wallet` }),
8333
- !state.familyWallet.address && state.familyWallet.wallets.length > 1 ? state.familyWallet.wallets.map((wallet) => /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", onClick: () => void state.connect(wallet.name), disabled: state.familyWallet.connecting, children: wallet.name }, wallet.name)) : null,
8334
- noWallet ? /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "sg-cp-summary-sub", children: [
8335
- "No ",
8336
- family,
8337
- " wallet found. Enter a ",
8338
- family,
8339
- " address instead."
8674
+ /* @__PURE__ */ jsxRuntime.jsx(AddCircle, {})
8675
+ ] }, name)) : props.connect ? /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-ws-row sg-ws-action", onClick: () => props.connect.onClick(props.connect.choices?.[0]), disabled: props.connect.busy, children: [
8676
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: props.connect.busy ? "Connecting\u2026" : `Connect ${FAMILY_LABEL[props.connect.family]} wallet` }),
8677
+ /* @__PURE__ */ jsxRuntime.jsx(AddCircle, {})
8678
+ ] }) : null
8679
+ ] }),
8680
+ props.wallets.length ? props.onDetails && states2.every((s) => s.status === "done") ? /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-ws-sum", "data-tone": summary.tone, onClick: props.onDetails, children: summaryInner }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-ws-sum", "data-tone": summary.tone, role: "status", children: summaryInner }) : null,
8681
+ props.error ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-ws-error", role: "alert", children: props.error }) : null
8682
+ ] }) });
8683
+ }
8684
+ function RecipientRow({ state, disabled, wide }) {
8685
+ if (state.error) return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-rcp-row", "data-wide": wide || void 0, "data-tone": "error", role: "alert", children: state.error });
8686
+ const address = state.shown;
8687
+ if (!address && !state.managed) return null;
8688
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-rcp-row", "data-wide": wide || void 0, children: [
8689
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-rcp-label", children: "Recipient" }),
8690
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-rcp-end", children: [
8691
+ address ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-rcp-value", title: address, children: [
8692
+ FAMILY_LABEL[state.recipientFamily],
8693
+ " \xB7 ",
8694
+ chipShort(address)
8695
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-rcp-value", "data-empty": "true", children: "Not set" }),
8696
+ state.managed ? /* @__PURE__ */ jsxRuntime.jsx("button", { ref: state.triggerRef, type: "button", className: "sg-rcp-change", onClick: state.show, disabled, "aria-haspopup": "dialog", children: address ? "Change" : "Add" }) : null
8697
+ ] })
8698
+ ] });
8699
+ }
8700
+ function RecipientSheet({ state, wide, minHeight }) {
8701
+ const family = state.recipientFamily;
8702
+ const label2 = FAMILY_LABEL[family];
8703
+ const eligible = state.wallets.filter((w) => w.eligible);
8704
+ const [choice, setChoice] = react.useState(() => {
8705
+ if (state.typed) return { kind: "custom" };
8706
+ const current = eligible.find((w) => w.address === state.recipient) ?? eligible[0];
8707
+ return current ? { kind: "wallet", address: current.address } : { kind: "custom" };
8708
+ });
8709
+ const [draft, setDraft] = react.useState(state.typed);
8710
+ const [editing, setEditing] = react.useState(false);
8711
+ const id = react.useId();
8712
+ const inputRef = react.useRef(null);
8713
+ const noWallet = family === "solana" && !state.familyWallet.address && !state.familyWallet.wallets.length;
8714
+ const canConnect = !state.familyWallet.address && (family === "evm" || state.familyWallet.wallets.length > 0);
8715
+ const shapeOk = family === "solana" ? isSolanaAddress(draft.trim()) : /^0x[0-9a-fA-F]{40}$/.test(draft.trim());
8716
+ const checksumOk = family === "solana" || !shapeOk || hasValidChecksum(draft.trim());
8717
+ const valid = shapeOk && checksumOk;
8718
+ const invalid = choice.kind === "custom" && Boolean(draft.trim()) && !valid;
8719
+ const chosenWallet = choice.kind === "wallet" ? eligible.find((w) => w.address === choice.address) : void 0;
8720
+ const ready = choice.kind === "wallet" ? Boolean(chosenWallet) : valid;
8721
+ const custom = choice.kind === "custom";
8722
+ react.useEffect(() => {
8723
+ if (custom) inputRef.current?.focus();
8724
+ }, [custom]);
8725
+ const confirm = () => {
8726
+ if (!ready) return;
8727
+ state.selectAddress(choice.kind === "custom" ? draft.trim() : "");
8728
+ };
8729
+ const row = (w) => {
8730
+ const selected = choice.kind === "wallet" && choice.address === w.address && w.eligible;
8731
+ return /* @__PURE__ */ jsxRuntime.jsxs(
8732
+ "button",
8733
+ {
8734
+ type: "button",
8735
+ className: "sg-rcp-opt",
8736
+ "data-selected": selected || void 0,
8737
+ disabled: !w.eligible,
8738
+ "aria-pressed": selected,
8739
+ title: w.eligible ? w.address : `A ${FAMILY_LABEL[w.family]} wallet cannot receive on this chain`,
8740
+ onClick: () => setChoice({ kind: "wallet", address: w.address }),
8741
+ children: [
8742
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-ws-id", children: [
8743
+ /* @__PURE__ */ jsxRuntime.jsx(WalletAvatar, { family: w.family, chainId: w.family === "evm" ? state.recipientChainId : void 0 }),
8744
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-ws-id-text", children: [
8745
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-ws-id-label", children: [
8746
+ FAMILY_LABEL[w.family],
8747
+ " Wallet"
8748
+ ] }),
8749
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-ws-addr", children: walletShort(w.address) })
8750
+ ] })
8751
+ ] }),
8752
+ selected ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-rcp-tick", children: /* @__PURE__ */ jsxRuntime.jsx(Tick2, {}) }) : null
8753
+ ]
8754
+ },
8755
+ w.address
8756
+ );
8757
+ };
8758
+ return /* @__PURE__ */ jsxRuntime.jsx(
8759
+ SheetFrame,
8760
+ {
8761
+ label: "Recipient",
8762
+ title: "Recipient",
8763
+ wide,
8764
+ onClose: state.close,
8765
+ minHeight,
8766
+ initialFocus: noWallet ? inputRef : void 0,
8767
+ footer: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-btn sg-ws-cta", disabled: !ready, onClick: confirm, children: "Use this address" }),
8768
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-ws-list", children: [
8769
+ state.wallets.map(row),
8770
+ canConnect ? /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-ws-row sg-ws-action", onClick: () => void state.connect(), disabled: state.familyWallet.connecting, children: [
8771
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: state.familyWallet.connecting ? "Connecting\u2026" : `Connect ${label2} wallet` }),
8772
+ /* @__PURE__ */ jsxRuntime.jsx(AddCircle, {})
8340
8773
  ] }) : null,
8341
- state.familyWallet.error ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: state.familyWallet.error }) : null
8342
- ] }),
8343
- /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card", children: [
8344
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-field", style: { margin: 0 }, children: [
8345
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "sg-label", htmlFor: id, children: "Send to a different address" }),
8774
+ !state.familyWallet.address && state.familyWallet.wallets.length > 1 ? state.familyWallet.wallets.map((wallet) => /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-ws-row sg-ws-action", onClick: () => void state.connect(wallet.name), disabled: state.familyWallet.connecting, children: [
8775
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: wallet.name }),
8776
+ /* @__PURE__ */ jsxRuntime.jsx(AddCircle, {})
8777
+ ] }, wallet.name)) : null,
8778
+ custom ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-rcp-custom", "data-open": "true", children: [
8779
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-rcp-custom-head", children: [
8780
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, children: "Add another address" }),
8781
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-rcp-tick", children: /* @__PURE__ */ jsxRuntime.jsx(Tick2, {}) })
8782
+ ] }),
8346
8783
  /* @__PURE__ */ jsxRuntime.jsx(
8347
8784
  "input",
8348
8785
  {
8349
8786
  ref: inputRef,
8350
8787
  id,
8351
- className: "sg-input sg-mono",
8352
- style: { fontSize: 14, padding: "12px 14px", border: "1px solid var(--sg-border)", borderRadius: "var(--sg-radius-control)", width: "100%", boxSizing: "border-box", background: "var(--sg-bg)" },
8353
- placeholder: `${family} recipient address`,
8354
- "aria-label": `${family} recipient address`,
8788
+ className: "sg-rcp-input",
8789
+ placeholder: family === "solana" ? "Solana recipient address" : "0x...Recipient address",
8790
+ "aria-label": `${label2} recipient address`,
8355
8791
  "aria-invalid": invalid || void 0,
8356
- "aria-describedby": `${id}-help${invalid ? ` ${id}-error` : ""}`,
8357
- value: draft,
8792
+ "aria-describedby": invalid ? `${id}-error` : void 0,
8793
+ value: editing || draft.length <= 34 ? draft : `${draft.slice(0, 13)}..${draft.slice(-15)}`,
8794
+ onFocus: () => setEditing(true),
8795
+ onBlur: () => setEditing(false),
8358
8796
  onChange: (event) => setDraft(event.target.value),
8359
- spellCheck: false
8797
+ onKeyDown: (event) => {
8798
+ if (event.key === "Enter") confirm();
8799
+ },
8800
+ spellCheck: false,
8801
+ autoComplete: "off"
8360
8802
  }
8361
- )
8803
+ ),
8804
+ invalid ? /* @__PURE__ */ jsxRuntime.jsx("p", { id: `${id}-error`, className: "sg-ws-error", children: shapeOk && !checksumOk ? "Checksum does not match. Check the address for a typo." : `Not a valid ${label2} address.` }) : null,
8805
+ noWallet ? /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "sg-rcp-hint", children: [
8806
+ "No ",
8807
+ label2,
8808
+ " wallet found. Enter a ",
8809
+ label2,
8810
+ " address instead."
8811
+ ] }) : null
8812
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-rcp-custom", onClick: () => setChoice({ kind: "custom" }), children: [
8813
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Add another address" }),
8814
+ /* @__PURE__ */ jsxRuntime.jsx(AddCircle, {})
8362
8815
  ] }),
8363
- invalid ? /* @__PURE__ */ jsxRuntime.jsx("div", { id: `${id}-error`, children: /* @__PURE__ */ jsxRuntime.jsxs(StatusPanel, { tone: "error", children: [
8364
- "Not a valid ",
8365
- family,
8366
- " address."
8367
- ] }) }) : null,
8368
- /* @__PURE__ */ jsxRuntime.jsx("p", { id: `${id}-help`, className: "sg-cp-summary-sub", style: { margin: "8px 0 12px" }, children: "Double-check it: a payment sent to a wrong address cannot be recovered." }),
8369
- /* @__PURE__ */ jsxRuntime.jsx(Button, { disabled: !valid, onClick: () => state.selectAddress(draft.trim()), children: "Use this address" })
8816
+ state.familyWallet.error ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-ws-error", children: state.familyWallet.error }) : null
8370
8817
  ] })
8371
- ] })
8818
+ }
8819
+ );
8820
+ }
8821
+ var short = (address) => `${address.slice(0, 4)}\u2026${address.slice(-4)}`;
8822
+ function RecipientNote({ state, disabled }) {
8823
+ if (state.error) return /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: state.error });
8824
+ if (!state.managed) return null;
8825
+ const family = state.recipientFamily === "solana" ? "Solana" : "EVM";
8826
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "center", gap: 6, marginTop: 10, fontSize: 13, color: "var(--sg-text-muted)", flexWrap: "wrap" }, children: [
8827
+ state.recipient ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8828
+ "To ",
8829
+ /* @__PURE__ */ jsxRuntime.jsx("b", { className: "sg-mono", title: state.recipient, style: { color: "var(--sg-text)" }, children: short(state.recipient) }),
8830
+ " on ",
8831
+ family,
8832
+ " \xB7 "
8833
+ ] }) : null,
8834
+ /* @__PURE__ */ jsxRuntime.jsx("button", { ref: state.triggerRef, type: "button", className: "sg-cp-link", onClick: state.show, disabled, "aria-haspopup": "dialog", children: state.recipient ? "Change" : "Send to a different address" })
8372
8835
  ] });
8373
8836
  }
8374
8837
  var IDENTITY_KEY_PREFIX = "sg:link:v1:";
@@ -10253,6 +10716,11 @@ function ExchangeCard(props) {
10253
10716
  evm: { account: wallet.account, connect: wallet.connect, connecting: wallet.connecting }
10254
10717
  });
10255
10718
  const recipient2 = recipientState.recipient;
10719
+ const [walletsOpen, setWalletsOpen] = react.useState(false);
10720
+ const [walletDetails, setWalletDetails] = react.useState(false);
10721
+ const [screens, setScreens] = react.useState({});
10722
+ const walletChipRef = react.useRef(null);
10723
+ const [takeoverHeight, setTakeoverHeight] = react.useState(void 0);
10256
10724
  const needsRecipient = recipientState.missing || !!recipientState.error;
10257
10725
  const onInputChange = react.useRef(props.onInputChange);
10258
10726
  onInputChange.current = props.onInputChange;
@@ -10264,7 +10732,8 @@ function ExchangeCard(props) {
10264
10732
  onInputChange.current?.({ fromChainId, fromAsset: fromSymbol, toChainId, toAsset: toSymbolKey, amount });
10265
10733
  }, [fromChainId, fromSymbol, toChainId, toSymbolKey, amount]);
10266
10734
  const [fiatCurrency, setFiatCurrency] = react.useState(props.fiatCurrency ?? "EUR");
10267
- const fromToken = react.useMemo(() => from ? findToken(tokens, from.chainId, from.symbol) : null, [tokens, from]);
10735
+ const sellableFrom = react.useCallback((t) => t && product === "rwa" && !isSellableRwa(t) ? null : t, [product]);
10736
+ const fromToken = react.useMemo(() => from ? sellableFrom(findToken(tokens, from.chainId, from.symbol)) : null, [tokens, from, sellableFrom]);
10268
10737
  const toToken = react.useMemo(() => to ? findToken(tokens, to.chainId, to.symbol) : null, [tokens, to]);
10269
10738
  const toSymbol = toToken?.symbol ?? to?.symbol ?? "";
10270
10739
  const fromTicker = fromToken ? tokenTicker(fromToken) : from?.symbol ?? "";
@@ -10422,6 +10891,31 @@ function ExchangeCard(props) {
10422
10891
  const connected2 = Boolean(wallet.account);
10423
10892
  const addressed = connected2 && !needsRecipient;
10424
10893
  const submitting = solActive ? solFlow.status === "preparing" || solFlow.status === "submitting" : flow.status === "submitting";
10894
+ const sheetWallets = [
10895
+ ...wallet.account ? [{ family: "evm", address: wallet.account, chainId: wallet.chainId, disconnect: () => void wallet.disconnect() }] : [],
10896
+ ...solanaWallet.address ? [{ family: "solana", address: solanaWallet.address, disconnect: () => void solanaWallet.disconnect() }] : []
10897
+ ];
10898
+ const walletKey = sheetWallets.map((w) => `${w.family}:${w.address}`).join("|");
10899
+ react.useEffect(() => {
10900
+ if (!walletsOpen) return;
10901
+ let alive = true;
10902
+ for (const w of sheetWallets) {
10903
+ setScreens((prev) => prev[w.address]?.status === "done" ? prev : { ...prev, [w.address]: { status: "pending" } });
10904
+ engine.api.screenWallet(w.address, w.family === "evm" ? w.chainId ?? void 0 : void 0).then((screen) => alive && setScreens((prev) => ({ ...prev, [w.address]: { status: "done", screen } }))).catch(() => alive && setScreens((prev) => ({ ...prev, [w.address]: { status: "error" } })));
10905
+ }
10906
+ return () => {
10907
+ alive = false;
10908
+ };
10909
+ }, [walletsOpen, walletKey, engine]);
10910
+ react.useEffect(() => {
10911
+ if (!submitting) return;
10912
+ setWalletsOpen(false);
10913
+ setWalletDetails(false);
10914
+ if (recipientState.open) recipientState.close();
10915
+ }, [submitting]);
10916
+ react.useEffect(() => {
10917
+ if (!sheetWallets.length) setWalletsOpen(false);
10918
+ }, [sheetWallets.length]);
10425
10919
  const lastTxOwned = Boolean(flow.lastTxEntry?.hash && wallet.account && flow.lastTxEntry.account === wallet.account.toLowerCase());
10426
10920
  const evmDirect = flow.lastTxEntry?.settlement === "direct";
10427
10921
  const evmConfirmed = flow.verdict?.status === "confirmed";
@@ -10437,6 +10931,10 @@ function ExchangeCard(props) {
10437
10931
  const receiveSideRef = react.useRef(null);
10438
10932
  const receiveShown = `${receive ?? ""}|${quoting}|${toTicker}`;
10439
10933
  useFitText(receiveOutRef, receiveShown);
10934
+ react.useLayoutEffect(() => {
10935
+ const h2 = receiveOutRef.current?.closest(".sg-widget")?.getBoundingClientRect().height;
10936
+ if (h2 && Math.round(h2) !== takeoverHeight) setTakeoverHeight(Math.round(h2));
10937
+ });
10440
10938
  useFitText(receiveSideRef, receiveShown);
10441
10939
  const toDecimals = react.useMemo(() => {
10442
10940
  try {
@@ -10483,12 +10981,26 @@ function ExchangeCard(props) {
10483
10981
  };
10484
10982
  const walletSlot = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-head-tools", children: [
10485
10983
  connected2 ? /* @__PURE__ */ jsxRuntime.jsx(HistoryButton, { btnRef: histBtnRef, disabled: submitting, onClick: () => setHist({}) }) : null,
10486
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-wallet", "data-connected": connected2 || void 0, onClick: connected2 ? void 0 : wallet.connect, disabled: wallet.connecting, children: connected2 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10487
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-wallet-dot", "aria-hidden": "true" }),
10488
- " ",
10489
- shortAddress2(wallet.account)
10490
- ] }) : wallet.connecting ? "Connecting\u2026" : "Connect wallet" })
10984
+ /* @__PURE__ */ jsxRuntime.jsx(
10985
+ WalletChip,
10986
+ {
10987
+ addresses: sheetWallets.map((w) => w.address),
10988
+ connecting: wallet.connecting,
10989
+ onConnect: wallet.connect,
10990
+ btnRef: walletChipRef,
10991
+ disabled: submitting,
10992
+ onOpen: () => {
10993
+ setSheet(null);
10994
+ setWalletsOpen(true);
10995
+ }
10996
+ }
10997
+ )
10491
10998
  ] });
10999
+ const closeWallets = () => {
11000
+ setWalletsOpen(false);
11001
+ setWalletDetails(false);
11002
+ requestAnimationFrame(() => walletChipRef.current?.focus());
11003
+ };
10492
11004
  const closeSelector = (isFrom) => {
10493
11005
  setView("main");
10494
11006
  requestAnimationFrame(() => (isFrom ? fromTileRef : toTileRef).current?.focus());
@@ -10531,7 +11043,19 @@ function ExchangeCard(props) {
10531
11043
  }
10532
11044
  );
10533
11045
  const rateBox = (open) => /* @__PURE__ */ jsxRuntime.jsx(RateBox, { rate, fromSymbol: from?.symbol ?? "", fromLogoUrl: fromToken?.logoUrl, toTicker, rows: rateRows, defaultOpen: open, paused: quotePaused });
10534
- const sheetBody = recipientState.open ? /* @__PURE__ */ jsxRuntime.jsx(RecipientSheet, { state: recipientState, symbol: toTicker }) : sheet === "compliance" ? /* @__PURE__ */ jsxRuntime.jsx(ComplianceSheet, { compliance, direct: selected?.state === "DIRECT", hasQuote: complianceHasQuote, onClose: closeSheet }) : sheet === "quote" && hasQuote ? /* @__PURE__ */ jsxRuntime.jsx(
11046
+ const walletScreens = sheetWallets.map((w) => screens[w.address]).flatMap((s) => s?.status === "done" ? [s.screen] : []);
11047
+ const sheetBody = walletsOpen && walletDetails ? /* @__PURE__ */ jsxRuntime.jsx(ComplianceSheet, { compliance: directComplianceFromScreens(walletScreens), direct: true, hasQuote: true, onClose: () => setWalletDetails(false) }) : walletsOpen ? /* @__PURE__ */ jsxRuntime.jsx(
11048
+ WalletsSheet,
11049
+ {
11050
+ wallets: sheetWallets,
11051
+ screens,
11052
+ wide,
11053
+ onClose: closeWallets,
11054
+ onDetails: walletScreens.length ? () => setWalletDetails(true) : void 0,
11055
+ connect: !wallet.account ? { family: "evm", onClick: () => void wallet.connect(), busy: wallet.connecting } : !solanaWallet.address ? { family: "solana", onClick: (name) => void solanaWallet.connect(name), busy: solanaWallet.status === "connecting", choices: solanaWallet.wallets.map((w) => w.name) } : void 0,
11056
+ error: solanaWallet.error || wallet.error
11057
+ }
11058
+ ) : recipientState.open ? /* @__PURE__ */ jsxRuntime.jsx(RecipientSheet, { state: recipientState, wide }) : sheet === "compliance" ? /* @__PURE__ */ jsxRuntime.jsx(ComplianceSheet, { compliance, direct: selected?.state === "DIRECT", hasQuote: complianceHasQuote, onClose: closeSheet }) : sheet === "quote" && hasQuote ? /* @__PURE__ */ jsxRuntime.jsx(
10535
11059
  QuoteSheet,
10536
11060
  {
10537
11061
  onClose: closeSheet,
@@ -10581,6 +11105,7 @@ function ExchangeCard(props) {
10581
11105
  " SOL."
10582
11106
  ] }) : null;
10583
11107
  let body;
11108
+ let takeover = false;
10584
11109
  if (hist && connected2) {
10585
11110
  body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, engine, solanaAccount: solanaWallet.address, tokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
10586
11111
  } else if (view === "from" || view === "to") {
@@ -10605,6 +11130,7 @@ function ExchangeCard(props) {
10605
11130
  }
10606
11131
  );
10607
11132
  } else if (sheetBody && !wide) {
11133
+ takeover = walletsOpen && !walletDetails || recipientState.open;
10608
11134
  body = sheetBody;
10609
11135
  } else if (solActive && solFlow.status === "sent") {
10610
11136
  body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -10653,7 +11179,6 @@ function ExchangeCard(props) {
10653
11179
  const cta = solActive ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
10654
11180
  solanaSteps,
10655
11181
  solanaCta,
10656
- /* @__PURE__ */ jsxRuntime.jsx(RecipientNote, { state: recipientState, disabled: submitting }),
10657
11182
  solanaWallet.error ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: solanaWallet.error }) : null,
10658
11183
  wallet.error ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: wallet.error }) : null
10659
11184
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
@@ -10662,7 +11187,6 @@ function ExchangeCard(props) {
10662
11187
  recipientState.recipientFamily === "solana" ? "Solana" : "EVM",
10663
11188
  " wallet"
10664
11189
  ] }) : /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: rampMode ? void 0 : flow.submit, busy: submitting, disabled: needsRecipient || rampMode || !quotable || !cryptoReady || connected2 && (!flow.selected || flow.insufficient || !!flow.nativeShortfall || flow.status === "loading"), children: ctaLabel }),
10665
- !rampMode ? /* @__PURE__ */ jsxRuntime.jsx(RecipientNote, { state: recipientState, disabled: submitting }) : null,
10666
11190
  wallet.error ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: wallet.error }) : null
10667
11191
  ] });
10668
11192
  const notices = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -10712,6 +11236,7 @@ function ExchangeCard(props) {
10712
11236
  ] }),
10713
11237
  /* @__PURE__ */ jsxRuntime.jsx(PaneFoot, { usd: hasQuote ? toUsd : null })
10714
11238
  ] }),
11239
+ !rampMode && (connected2 || recipientState.managed) ? /* @__PURE__ */ jsxRuntime.jsx(RecipientRow, { state: recipientState, disabled: submitting }) : null,
10715
11240
  rampMode ? null : props.inDialog === "drawer" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10716
11241
  complianceButton(true),
10717
11242
  quoteButton(true),
@@ -10729,7 +11254,7 @@ function ExchangeCard(props) {
10729
11254
  cta
10730
11255
  ] });
10731
11256
  }
10732
- const card = /* @__PURE__ */ jsxRuntime.jsx(WidgetShell, { title, theme: config.theme, heightPx: props.heightPx, walletSlot, onClose: props.onClose, wide, children: body });
11257
+ const card = /* @__PURE__ */ jsxRuntime.jsx(WidgetShell, { title, theme: config.theme, heightPx: props.heightPx, walletSlot, onClose: props.onClose, wide, takeover, minHeightPx: takeover ? takeoverHeight : void 0, children: body });
10733
11258
  if (!wide) return card;
10734
11259
  const resolved = resolveTheme(config.theme);
10735
11260
  const vars = themeToVars(resolved);
@@ -10776,6 +11301,7 @@ function ExchangeCard(props) {
10776
11301
  ] })
10777
11302
  ] }),
10778
11303
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-stack", children: [
11304
+ connected2 || recipientState.managed ? /* @__PURE__ */ jsxRuntime.jsx(RecipientRow, { state: recipientState, disabled: submitting, wide: true }) : null,
10779
11305
  rateBox(true),
10780
11306
  complianceButton(true),
10781
11307
  quoteButton(true)