@glacislabs/stablegenie-zerodelta 4.13.1 → 4.14.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 { CHAIN_DISPLAY_NAMES, EXECUTABLE_STABLE_ASSETS, STABLE_ASSETS, SUPPORTED_ASSETS, complianceView, complianceTagOf, symbolKey, normalizeDecimalText, findToken, laneLimitFor, laneLimitSymbol, tokenTicker, exceedsLaneLimit, assetDecimals, parseUnitsDecimal, counterpartTokens, assetClassOf, brokenLaneFor, brokenLaneReason, destinationAvailability, laneLimitHint, tickerOn, laneLimitError, routeNativeValue, formatNative, nativeSymbol, isSolanaChainId, formatUnits, amountFieldError, solanaQuoteCompliance, SUPPORTED_CHAIN_IDS, complianceChecks, DIRECT_CHECK_IDS, isSolanaAddress, createEngine, isAddress, checkNativeFee, nativeFeeShortLabel, nativeFeeShortMessage, allowanceCovers, validatePlannedTransaction, TRACKING, mergeHistory, solanaPlanNeedsPreparation, SOLANA_CHAIN_ID, unattributedComplianceReasons, distinctScreenedWallets, formatJurisdiction, humanizeComplianceReason, DIRECT_SCOPE_NOTE, categoryLabel, SCREENING_BUCKETS, BUNDLED_RPC, foldTicker } from './chunk-6WFIFKZ4.js';
2
- import { createContext, useState, useRef, useMemo, useEffect, useCallback, useId, createElement, useContext, useLayoutEffect, useSyncExternalStore, useReducer } from 'react';
1
+ import { CHAIN_DISPLAY_NAMES, EXECUTABLE_STABLE_ASSETS, STABLE_ASSETS, SUPPORTED_ASSETS, complianceView, complianceTagOf, symbolKey, normalizeDecimalText, findToken, laneLimitFor, laneLimitSymbol, tokenTicker, exceedsLaneLimit, assetDecimals, parseUnitsDecimal, counterpartTokens, assetClassOf, brokenLaneFor, brokenLaneReason, destinationAvailability, laneLimitHint, tickerOn, laneLimitError, routeNativeValue, formatNative, nativeSymbol, isSolanaChainId, formatUnits, amountFieldError, solanaQuoteCompliance, directComplianceFromScreens, SUPPORTED_CHAIN_IDS, complianceChecks, DIRECT_CHECK_IDS, isSolanaAddress, createEngine, isAddress, checkNativeFee, nativeFeeShortLabel, nativeFeeShortMessage, allowanceCovers, validatePlannedTransaction, TRACKING, mergeHistory, solanaPlanNeedsPreparation, SOLANA_CHAIN_ID, unattributedComplianceReasons, distinctScreenedWallets, formatJurisdiction, humanizeComplianceReason, DIRECT_SCOPE_NOTE, categoryLabel, SCREENING_BUCKETS, BUNDLED_RPC, foldTicker } from './chunk-ST3DQXYH.js';
2
+ import { createContext, useState, useRef, useMemo, useEffect, useCallback, useId, useLayoutEffect, createElement, useContext, useSyncExternalStore, useReducer } from 'react';
3
3
  import { createRoot } from 'react-dom/client';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
 
@@ -275,18 +275,20 @@ function useWallet(injected2) {
275
275
  const [connecting, setConnecting] = useState(false);
276
276
  const [error, setError] = useState(null);
277
277
  const providerRef = useRef(injected2 ?? null);
278
+ const forgotten = useRef(false);
279
+ const generation = useRef(0);
278
280
  useEffect(() => {
279
281
  const p = provider;
280
282
  if (!p) return;
281
283
  let alive = true;
282
- const onAccounts = (accs) => alive && setAccount(Array.isArray(accs) && accs[0] ? accs[0] : null);
284
+ const onAccounts = (accs) => alive && !forgotten.current && setAccount(Array.isArray(accs) && accs[0] ? accs[0] : null);
283
285
  const onChain = (hex) => alive && setChainId(hexToChain(hex));
284
286
  p.on?.("accountsChanged", onAccounts);
285
287
  p.on?.("chainChanged", onChain);
286
288
  (async () => {
287
289
  try {
288
290
  const accs = await getAccounts(p);
289
- if (alive && accs[0]) setAccount(accs[0]);
291
+ if (alive && accs[0] && !forgotten.current) setAccount(accs[0]);
290
292
  const cid = await getChainId(p);
291
293
  if (alive) setChainId(cid);
292
294
  } catch {
@@ -307,11 +309,14 @@ function useWallet(injected2) {
307
309
  const connect = useCallback(async () => {
308
310
  setConnecting(true);
309
311
  setError(null);
312
+ forgotten.current = false;
313
+ const request = ++generation.current;
310
314
  try {
311
315
  const p = providerRef.current ?? await resolveProvider(injected2);
312
316
  providerRef.current = p;
313
317
  setProvider(p);
314
318
  const accs = await requestAccounts(p);
319
+ if (request !== generation.current) return;
315
320
  setAccount(accs[0] ?? null);
316
321
  setChainId(await getChainId(p));
317
322
  } catch (e) {
@@ -320,7 +325,19 @@ function useWallet(injected2) {
320
325
  setConnecting(false);
321
326
  }
322
327
  }, [injected2]);
323
- return { provider, account, chainId, connecting, error, connect };
328
+ const disconnect = useCallback(async () => {
329
+ forgotten.current = true;
330
+ generation.current += 1;
331
+ setConnecting(false);
332
+ setAccount(null);
333
+ setError(null);
334
+ const p = providerRef.current;
335
+ try {
336
+ await p?.request({ method: "wallet_revokePermissions", params: [{ eth_accounts: {} }] });
337
+ } catch {
338
+ }
339
+ }, []);
340
+ return { provider, account, chainId, connecting, error, connect, disconnect };
324
341
  }
325
342
 
326
343
  // src/react/txHistoryStore.ts
@@ -1563,6 +1580,106 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
1563
1580
  .sg-overlay[data-sg-overlay="drawer"] .sg-pane--note{min-height:145px}
1564
1581
  @keyframes sg-drawer-in{from{transform:translateX(100%)}to{transform:none}}
1565
1582
  @media (prefers-reduced-motion:reduce){.sg-overlay,.sg-dialog{animation:none!important}.sg-pillbtn{transition:none}}
1583
+ /* \u2500\u2500 Wallets + Recipient sheets \u2014 Figma ZD-dApp 3154:48121 / 3155:49634 (2026-10-28) \u2500\u2500 */
1584
+ .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}
1585
+ .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)}
1586
+ .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)}
1587
+ .sg-wallet[data-connected="true"]:hover:not(:disabled){border-color:var(--sg-accent);color:var(--sg-t80)}
1588
+ .sg-wallet[data-connected="true"]:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px}
1589
+ .sg-wallet-label{opacity:.9}
1590
+ .sg-wallet[data-connected="true"] svg{flex:0 0 auto;margin-right:-1px}
1591
+ .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}
1592
+ .sg-ws:focus{outline:none}
1593
+ .sg-ws-top{display:flex;flex-direction:column;gap:28px}
1594
+ .sg-ws-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
1595
+ .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}
1596
+ .sg-ws-back svg{flex:0 0 auto}
1597
+ .sg-ws-back:hover{color:var(--sg-text)}
1598
+ .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}
1599
+ .sg-ws-close:hover{color:var(--sg-text)}
1600
+ .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}
1601
+ .sg-ws-main{display:flex;flex-direction:column;gap:16px}
1602
+ .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)}
1603
+ .sg-ws[data-wide]{gap:16px}
1604
+ .sg-ws[data-wide] .sg-ws-sum-lead{min-width:0}
1605
+ .sg-ws[data-wide] .sg-ws-sum-text{overflow:hidden;text-overflow:ellipsis}
1606
+ .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)}
1607
+ .sg-ws[data-wide] .sg-ws-back{font-size:12px;font-weight:400}
1608
+ .sg-ws[data-wide] .sg-ws-title{font-family:var(--sg-font);font-size:18px;font-weight:500;letter-spacing:0}
1609
+ .sg-ws-list{display:flex;flex-direction:column;gap:4px}
1610
+ .sg-ws-list[data-gap="8"]{gap:8px}
1611
+ .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}
1612
+ .sg-ws-row-line{display:flex;align-items:center;justify-content:space-between;gap:12px}
1613
+ .sg-ws-id{display:flex;align-items:center;gap:20px;min-width:0}
1614
+ .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}
1615
+ .sg-ws-id-label{display:inline-flex;align-items:center;gap:8px;font-size:12px;color:var(--sg-t50)}
1616
+ .sg-ws-addr{font-size:16px;font-weight:500;color:var(--sg-t80)}
1617
+ .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}
1618
+ .sg-ws-pill[data-tone="blocked"]{background:color-mix(in srgb,var(--sg-flag) 12%,transparent);color:var(--sg-flag)}
1619
+ .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)}
1620
+ .sg-ws-note{margin:0;font-size:12px;line-height:1.2;color:var(--sg-t60)}
1621
+ .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}
1622
+ .sg-ws-avatar[data-family="solana"]{background:#1a2ba3;color:#fff}
1623
+ .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}
1624
+ .sg-ws-avatar-chain img{display:block;width:12px;height:12px;border-radius:8px;object-fit:cover}
1625
+ .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}
1626
+ .sg-ws-icon-btn:hover{background:var(--sg-a12)}
1627
+ .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}
1628
+ .sg-ws-action:hover:not(:disabled){background:color-mix(in srgb,var(--sg-accent) 8%,transparent)}
1629
+ .sg-ws-action:disabled{cursor:progress;opacity:.7}
1630
+ .sg-ws-action svg{flex:0 0 auto}
1631
+ .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)}
1632
+ button.sg-ws-sum{cursor:pointer}
1633
+ .sg-ws-sum[data-tone="ok"]{background:color-mix(in srgb,var(--sg-success) 4%,transparent)}
1634
+ .sg-ws-sum[data-tone="blocked"]{background:color-mix(in srgb,var(--sg-flag) 8%,transparent)}
1635
+ .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}
1636
+ .sg-ws-sum-lead svg{flex:0 0 auto;color:var(--sg-accent)}
1637
+ .sg-ws-sum[data-tone="ok"] .sg-ws-sum-lead svg{color:var(--sg-success)}
1638
+ .sg-ws-sum[data-tone="blocked"] .sg-ws-sum-lead svg{color:var(--sg-flag)}
1639
+ .sg-ws-sum[data-tone="unknown"] .sg-ws-sum-lead svg{color:var(--sg-text-muted)}
1640
+ .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}
1641
+ .sg-ws-sum[data-tone="ok"] .sg-ws-sum-act{color:var(--sg-ok-ink)}
1642
+ .sg-ws-sum[data-tone="ok"] .sg-ws-sum-act svg{color:color-mix(in srgb,var(--sg-success) 80%,transparent)}
1643
+ .sg-ws-sum[data-tone="blocked"] .sg-ws-sum-act{color:var(--sg-flag)}
1644
+ .sg-ws-sum[data-tone="unknown"] .sg-ws-sum-act{color:var(--sg-text-muted)}
1645
+ .sg-ws-spin{animation:sg-ws-spin 900ms linear infinite}
1646
+ @keyframes sg-ws-spin{to{transform:rotate(360deg)}}
1647
+ .sg-ws-error{margin:0;font-size:12px;line-height:1.3;color:var(--sg-danger)}
1648
+ .sg-ws-foot{flex:0 0 auto}
1649
+ .sg-btn.sg-ws-cta{height:44px;min-height:44px;padding:0 24px}
1650
+ .sg-btn.sg-ws-cta:disabled{opacity:.2;cursor:not-allowed}
1651
+ .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}
1652
+ .sg-rcp-row[data-wide]{background:transparent;border:1px solid var(--sg-a12);padding:12px 16px}
1653
+ .sg-rcp-row[data-tone="error"]{white-space:normal;color:var(--sg-danger);background:color-mix(in srgb,var(--sg-danger) 8%,transparent)}
1654
+ .sg-rcp-label{color:var(--sg-t60)}
1655
+ .sg-rcp-end{display:inline-flex;align-items:center;gap:8px;min-width:0}
1656
+ .sg-rcp-value{color:var(--sg-t90);overflow:hidden;text-overflow:ellipsis}
1657
+ .sg-rcp-value[data-empty]{color:var(--sg-t50)}
1658
+ .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}
1659
+ .sg-rcp-change:hover:not(:disabled){text-decoration:underline}
1660
+ .sg-rcp-change:disabled{opacity:.5;cursor:not-allowed}
1661
+ .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}
1662
+ .sg-rcp-opt[data-selected]{border-color:transparent;background:var(--sg-a4)}
1663
+ .sg-rcp-opt:hover:not(:disabled):not([data-selected]){border-color:color-mix(in srgb,var(--sg-accent) 40%,transparent)}
1664
+ .sg-rcp-opt:disabled{cursor:not-allowed;opacity:.45}
1665
+ .sg-rcp-tick{display:flex;color:var(--sg-accent);flex:0 0 auto}
1666
+ .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}
1667
+ .sg-rcp-custom svg{flex:0 0 auto}
1668
+ .sg-rcp-custom[data-open]{flex-direction:column;align-items:stretch;gap:8px;border-color:transparent;background:var(--sg-a4);cursor:default}
1669
+ .sg-rcp-custom-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
1670
+ .sg-rcp-custom-head label{cursor:text}
1671
+ .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}
1672
+ .sg-rcp-input::placeholder{color:var(--sg-t50)}
1673
+ .sg-rcp-input:focus{border-color:var(--sg-accent)}
1674
+ .sg-rcp-input[aria-invalid="true"]{border-color:var(--sg-danger)}
1675
+ .sg-rcp-hint{margin:0;font-size:12px;font-weight:400;line-height:1.2;color:var(--sg-t60)}
1676
+ .sg-widget[data-sg-takeover]{display:flex;flex-direction:column}
1677
+ .sg-widget[data-sg-takeover]>.sg-head,.sg-widget[data-sg-takeover]>.sg-foot{display:none}
1678
+ .sg-widget[data-sg-takeover]>.sg-body{display:flex;flex-direction:column;flex:1 1 auto}
1679
+ .sg-widget[data-sg-takeover]>.sg-body>.sg-ws{flex:1 1 auto}
1680
+ .sg-widget[data-sg-side]:has(>.sg-ws){display:flex;flex-direction:column}
1681
+ .sg-widget[data-sg-side]>.sg-ws{flex:1 1 auto}
1682
+ @media (prefers-reduced-motion:reduce){.sg-ws{animation:none}.sg-ws-spin{animation:none}}
1566
1683
  `;
1567
1684
  var injected = false;
1568
1685
  function injectStyles() {
@@ -2776,7 +2893,7 @@ function WidgetShell(props) {
2776
2893
  const resolved = resolveTheme(props.theme);
2777
2894
  const vars = themeToVars(resolved);
2778
2895
  const fixed = Number.isFinite(props.heightPx) && props.heightPx > 0;
2779
- const style = fixed ? { ...vars, height: props.heightPx } : vars;
2896
+ const style = fixed ? { ...vars, height: props.heightPx } : props.minHeightPx ? { ...vars, minHeight: props.minHeightPx } : vars;
2780
2897
  return /* @__PURE__ */ jsxs(
2781
2898
  "div",
2782
2899
  {
@@ -2785,6 +2902,7 @@ function WidgetShell(props) {
2785
2902
  "data-sg-fixed": fixed || void 0,
2786
2903
  "data-sg-express": props.variant === "express" || void 0,
2787
2904
  "data-sg-wide": props.wide || void 0,
2905
+ "data-sg-takeover": props.takeover || void 0,
2788
2906
  style,
2789
2907
  children: [
2790
2908
  /* @__PURE__ */ jsxs("div", { className: "sg-head", children: [
@@ -3694,12 +3812,19 @@ function useRecipient(destinationChainId, hostRecipient, opts = {}) {
3694
3812
  const [custom, setCustom] = useState({});
3695
3813
  const [open, setOpen] = useState(false);
3696
3814
  const triggerRef = useRef(null);
3815
+ const evmAccount = opts.evm?.account ?? null;
3697
3816
  const evmManaged = recipientFamily === "evm" && Boolean(opts.sourceIsSolana);
3698
- const managed = hostRecipient === void 0 && (recipientFamily === "solana" || evmManaged);
3817
+ const required = recipientFamily === "solana" || evmManaged;
3818
+ const managed = hostRecipient === void 0 && (required || Boolean(opts.evm));
3699
3819
  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;
3700
- const recipient = hostRecipient !== void 0 ? hostRecipient : recipientFamily === "solana" ? custom.solana || wallet.address || void 0 : evmManaged ? custom.evm || opts.evm?.account || void 0 : void 0;
3701
- const missing = managed && !recipient;
3702
- 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 };
3820
+ const recipient = 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;
3821
+ const missing = managed && required && !recipient;
3822
+ const shown = recipient ?? (recipientFamily === "evm" && !required ? evmAccount ?? void 0 : void 0);
3823
+ const typed = hostRecipient === void 0 ? custom[recipientFamily] || "" : "";
3824
+ 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 };
3825
+ const wallets = [];
3826
+ if (evmAccount) wallets.push({ family: "evm", address: evmAccount, eligible: recipientFamily === "evm" });
3827
+ if (wallet.address) wallets.push({ family: "solana", address: wallet.address, eligible: recipientFamily === "solana" });
3703
3828
  const close = () => {
3704
3829
  setOpen(false);
3705
3830
  requestAnimationFrame(() => triggerRef.current?.focus());
@@ -3710,7 +3835,7 @@ function useRecipient(destinationChainId, hostRecipient, opts = {}) {
3710
3835
  };
3711
3836
  const connect = async (name) => {
3712
3837
  if (recipientFamily === "evm") {
3713
- if (opts.evm?.account) selectAddress("");
3838
+ if (evmAccount) selectAddress("");
3714
3839
  else opts.evm?.connect();
3715
3840
  return;
3716
3841
  }
@@ -3726,38 +3851,170 @@ function useRecipient(destinationChainId, hostRecipient, opts = {}) {
3726
3851
  if (typeof address === "string") selectAddress("");
3727
3852
  else setOpen(true);
3728
3853
  };
3729
- const recipientFor = (account) => recipientFamily === "solana" || evmManaged ? recipient || "" : hostRecipient || account;
3730
- return { recipientFamily, recipient, recipientFor, managed, missing, error, wallet, familyWallet, open: open && managed, show: () => setOpen(true), close, selectAddress, connect, triggerRef };
3854
+ const recipientFor = (account) => required ? recipient || "" : hostRecipient || custom.evm || account;
3855
+ return { recipientFamily, recipientChainId: destinationChainId, recipient, shown, typed, recipientFor, managed, missing, error, wallet, familyWallet, wallets, open: open && managed, show: () => setOpen(true), close, selectAddress, connect, triggerRef };
3731
3856
  }
3732
- var short = (address) => `${address.slice(0, 4)}\u2026${address.slice(-4)}`;
3733
- function RecipientNote({ state, disabled }) {
3734
- if (state.error) return /* @__PURE__ */ jsx(StatusPanel, { tone: "error", children: state.error });
3735
- if (!state.managed) return null;
3736
- const family = state.recipientFamily === "solana" ? "Solana" : "EVM";
3737
- return /* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "center", gap: 6, marginTop: 10, fontSize: 13, color: "var(--sg-text-muted)", flexWrap: "wrap" }, children: [
3738
- state.recipient ? /* @__PURE__ */ jsxs(Fragment, { children: [
3739
- "To ",
3740
- /* @__PURE__ */ jsx("b", { className: "sg-mono", title: state.recipient, style: { color: "var(--sg-text)" }, children: short(state.recipient) }),
3741
- " on ",
3742
- family,
3743
- " \xB7 "
3744
- ] }) : null,
3745
- /* @__PURE__ */ 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" })
3857
+
3858
+ // src/core/checksum.ts
3859
+ var RC = [
3860
+ 0x0000000000000001n,
3861
+ 0x0000000000008082n,
3862
+ 0x800000000000808an,
3863
+ 0x8000000080008000n,
3864
+ 0x000000000000808bn,
3865
+ 0x0000000080000001n,
3866
+ 0x8000000080008081n,
3867
+ 0x8000000000008009n,
3868
+ 0x000000000000008an,
3869
+ 0x0000000000000088n,
3870
+ 0x0000000080008009n,
3871
+ 0x000000008000000an,
3872
+ 0x000000008000808bn,
3873
+ 0x800000000000008bn,
3874
+ 0x8000000000008089n,
3875
+ 0x8000000000008003n,
3876
+ 0x8000000000008002n,
3877
+ 0x8000000000000080n,
3878
+ 0x000000000000800an,
3879
+ 0x800000008000000an,
3880
+ 0x8000000080008081n,
3881
+ 0x8000000000008080n,
3882
+ 0x0000000080000001n,
3883
+ 0x8000000080008008n
3884
+ ];
3885
+ 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];
3886
+ var MASK = (1n << 64n) - 1n;
3887
+ var rotl = (x, n) => n === 0 ? x : (x << BigInt(n) | x >> BigInt(64 - n)) & MASK;
3888
+ function keccakF(s) {
3889
+ for (let round = 0; round < 24; round++) {
3890
+ const c = [0, 1, 2, 3, 4].map((x) => s[x] ^ s[x + 5] ^ s[x + 10] ^ s[x + 15] ^ s[x + 20]);
3891
+ for (let x = 0; x < 5; x++) {
3892
+ const d = c[(x + 4) % 5] ^ rotl(c[(x + 1) % 5], 1);
3893
+ for (let y = 0; y < 25; y += 5) s[y + x] = s[y + x] ^ d;
3894
+ }
3895
+ const b = new Array(25);
3896
+ 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]);
3897
+ 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];
3898
+ s[0] = s[0] ^ RC[round];
3899
+ }
3900
+ }
3901
+ function keccak256Hex(bytes) {
3902
+ const rate = 136;
3903
+ const padded = new Uint8Array(Math.ceil((bytes.length + 1) / rate) * rate);
3904
+ padded.set(bytes);
3905
+ padded[bytes.length] = padded[bytes.length] ^ 1;
3906
+ padded[padded.length - 1] = padded[padded.length - 1] ^ 128;
3907
+ const s = new Array(25).fill(0n);
3908
+ for (let off = 0; off < padded.length; off += rate) {
3909
+ for (let i = 0; i < rate / 8; i++) {
3910
+ let lane = 0n;
3911
+ for (let j = 7; j >= 0; j--) lane = lane << 8n | BigInt(padded[off + i * 8 + j]);
3912
+ s[i] = s[i] ^ lane;
3913
+ }
3914
+ keccakF(s);
3915
+ }
3916
+ let out = "";
3917
+ 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");
3918
+ return out;
3919
+ }
3920
+ function toChecksumAddress(address) {
3921
+ const lower = address.slice(2).toLowerCase();
3922
+ const hash = keccak256Hex(new TextEncoder().encode(lower));
3923
+ let out = "0x";
3924
+ for (let i = 0; i < 40; i++) out += Number.parseInt(hash[i], 16) >= 8 ? lower[i].toUpperCase() : lower[i];
3925
+ return out;
3926
+ }
3927
+ function hasValidChecksum(address) {
3928
+ if (!/^0x[0-9a-fA-F]{40}$/.test(address)) return false;
3929
+ const body = address.slice(2);
3930
+ if (body === body.toLowerCase() || body === body.toUpperCase()) return true;
3931
+ return toChecksumAddress(address) === address;
3932
+ }
3933
+ function ArrowLeft() {
3934
+ return /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
3935
+ /* @__PURE__ */ jsx("path", { d: "M6.38 3.95312L2.33333 7.99979L6.38 12.0465", stroke: "currentColor", strokeWidth: "1.2", strokeMiterlimit: "10", strokeLinecap: "round", strokeLinejoin: "round" }),
3936
+ /* @__PURE__ */ jsx("path", { d: "M13.6667 8H2.44667", stroke: "currentColor", strokeWidth: "1.2", strokeMiterlimit: "10", strokeLinecap: "round", strokeLinejoin: "round" })
3746
3937
  ] });
3747
3938
  }
3748
- function RecipientSheet({ state, symbol }) {
3749
- const [draft, setDraft] = useState(state.recipient ?? "");
3750
- const id = useId();
3751
- const inputRef = useRef(null);
3939
+ function CloseX() {
3940
+ return /* @__PURE__ */ jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M18 6L6 18M6 6L18 18", stroke: "currentColor", strokeWidth: "1.49983", strokeLinecap: "round", strokeLinejoin: "round" }) });
3941
+ }
3942
+ function AddCircle() {
3943
+ return /* @__PURE__ */ jsxs("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": "true", children: [
3944
+ /* @__PURE__ */ 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" }),
3945
+ /* @__PURE__ */ jsx("path", { d: "M6 9H12M9 12V6", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round" })
3946
+ ] });
3947
+ }
3948
+ function Tick2() {
3949
+ return /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M2.0625 6.5625L4.6875 9.1875L9.9375 3.5625", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
3950
+ }
3951
+ function Logout() {
3952
+ return /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
3953
+ "path",
3954
+ {
3955
+ fill: "currentColor",
3956
+ 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"
3957
+ }
3958
+ ) });
3959
+ }
3960
+ function ShieldTickBold() {
3961
+ return /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
3962
+ "path",
3963
+ {
3964
+ fill: "currentColor",
3965
+ 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"
3966
+ }
3967
+ ) });
3968
+ }
3969
+ function CloseCircleBold() {
3970
+ return /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
3971
+ "path",
3972
+ {
3973
+ fill: "currentColor",
3974
+ 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"
3975
+ }
3976
+ ) });
3977
+ }
3978
+ function Loader() {
3979
+ return /* @__PURE__ */ jsx("svg", { className: "sg-ws-spin", width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
3980
+ "path",
3981
+ {
3982
+ fill: "currentColor",
3983
+ 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"
3984
+ }
3985
+ ) });
3986
+ }
3987
+ function SmallChevron() {
3988
+ return /* @__PURE__ */ jsx("svg", { width: "5", height: "10", viewBox: "0 0 5 10", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M0.503906 9L3.50391 6L0.503906 3", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }) });
3989
+ }
3990
+ function PixelGlyph() {
3991
+ return /* @__PURE__ */ jsxs("svg", { width: "21.5888", height: "17.3869", viewBox: "0 0 21.5888 17.3869", fill: "none", "aria-hidden": "true", children: [
3992
+ /* @__PURE__ */ 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" }),
3993
+ /* @__PURE__ */ 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" })
3994
+ ] });
3995
+ }
3996
+ var FAMILY_LABEL = { evm: "EVM", solana: "Solana" };
3997
+ function walletShort(address) {
3998
+ return address.length > 14 ? `${address.slice(0, 7)}\u2026${address.slice(-5)}` : address;
3999
+ }
4000
+ function chipShort(address) {
4001
+ return address.length > 12 ? `${address.slice(0, 6)}\u2026${address.slice(-4)}` : address;
4002
+ }
4003
+ function WalletAvatar({ family, chainId }) {
4004
+ const [failed, setFailed] = useState([]);
4005
+ const mark = chainLogoCandidates(family === "solana" ? SOLANA_CHAIN_ID : chainId ?? 1).find((url) => !failed.includes(url));
4006
+ return /* @__PURE__ */ jsxs("span", { className: "sg-ws-avatar", "data-family": family, "aria-hidden": "true", children: [
4007
+ /* @__PURE__ */ jsx(PixelGlyph, {}),
4008
+ mark ? /* @__PURE__ */ jsx("span", { className: "sg-ws-avatar-chain", children: /* @__PURE__ */ jsx("img", { src: mark, alt: "", onError: () => setFailed((prev) => [...prev, mark]) }) }) : null
4009
+ ] });
4010
+ }
4011
+ function SheetFrame(props) {
3752
4012
  const sheetRef = useRef(null);
3753
- const closeRef = useRef(state.close);
3754
- closeRef.current = state.close;
3755
- const family = state.recipientFamily === "solana" ? "Solana" : "EVM";
3756
- const valid = state.recipientFamily === "solana" ? isSolanaAddress(draft) : /^0x[0-9a-fA-F]{40}$/.test(draft.trim());
3757
- const invalid = Boolean(draft.trim()) && !valid;
3758
- const noWallet = state.recipientFamily === "solana" && !state.familyWallet.address && !state.familyWallet.wallets.length;
4013
+ const closeRef = useRef(props.onClose);
4014
+ closeRef.current = props.onClose;
4015
+ const titleId = useId();
3759
4016
  useEffect(() => {
3760
- (noWallet ? inputRef : sheetRef).current?.focus();
4017
+ (props.initialFocus?.current ?? sheetRef.current)?.focus();
3761
4018
  const onKey = (event) => {
3762
4019
  if (event.key === "Escape") {
3763
4020
  event.stopPropagation();
@@ -3766,63 +4023,263 @@ function RecipientSheet({ state, symbol }) {
3766
4023
  };
3767
4024
  document.addEventListener("keydown", onKey, true);
3768
4025
  return () => document.removeEventListener("keydown", onKey, true);
3769
- }, [noWallet]);
3770
- return /* @__PURE__ */ jsxs("div", { className: "sg-cp-sheet", role: "dialog", "aria-modal": "true", "aria-label": `${family} recipient`, ref: sheetRef, tabIndex: -1, children: [
3771
- /* @__PURE__ */ jsxs("div", { className: "sg-cp-sheet-head", children: [
3772
- /* @__PURE__ */ jsxs("h4", { className: "sg-cp-sheet-title", children: [
3773
- family,
3774
- " recipient"
3775
- ] }),
3776
- /* @__PURE__ */ jsx("button", { type: "button", className: "sg-cp-close", onClick: state.close, "aria-label": "Close recipient", 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" }) }) })
4026
+ }, []);
4027
+ return /* @__PURE__ */ jsxs(
4028
+ "div",
4029
+ {
4030
+ className: "sg-ws",
4031
+ "data-wide": props.wide || void 0,
4032
+ role: "dialog",
4033
+ "aria-modal": "true",
4034
+ "aria-label": props.label,
4035
+ ref: sheetRef,
4036
+ tabIndex: -1,
4037
+ style: props.minHeight ? { minHeight: props.minHeight } : void 0,
4038
+ children: [
4039
+ /* @__PURE__ */ jsxs("div", { className: "sg-ws-top", children: [
4040
+ /* @__PURE__ */ jsxs("div", { className: "sg-ws-head", children: [
4041
+ /* @__PURE__ */ jsxs("button", { type: "button", className: "sg-ws-back", onClick: () => closeRef.current(), children: [
4042
+ /* @__PURE__ */ jsx(ArrowLeft, {}),
4043
+ props.backLabel ?? "Back to Exchange"
4044
+ ] }),
4045
+ props.wide ? null : /* @__PURE__ */ jsx("button", { type: "button", className: "sg-ws-close", onClick: () => closeRef.current(), "aria-label": `Close ${props.label.toLowerCase()}`, children: /* @__PURE__ */ jsx(CloseX, {}) })
4046
+ ] }),
4047
+ /* @__PURE__ */ jsxs("div", { className: "sg-ws-main", children: [
4048
+ /* @__PURE__ */ jsx("h4", { className: "sg-ws-title", id: titleId, children: props.title }),
4049
+ props.children
4050
+ ] })
4051
+ ] }),
4052
+ props.footer ? /* @__PURE__ */ jsx("div", { className: "sg-ws-foot", children: props.footer }) : null
4053
+ ]
4054
+ }
4055
+ );
4056
+ }
4057
+ function WalletChip(props) {
4058
+ const count = props.addresses.length;
4059
+ if (!count) {
4060
+ return /* @__PURE__ */ jsx("button", { type: "button", className: "sg-wallet", onClick: props.onConnect, disabled: props.connecting, children: props.connecting ? "Connecting\u2026" : "Connect wallet" });
4061
+ }
4062
+ const label2 = count === 1 ? chipShort(props.addresses[0]) : `${count} wallets`;
4063
+ return /* @__PURE__ */ 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: [
4064
+ /* @__PURE__ */ jsx("span", { className: "sg-wallet-dot", "aria-hidden": "true" }),
4065
+ /* @__PURE__ */ jsx("span", { className: "sg-wallet-label", children: label2 }),
4066
+ /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 15.9961 15.9961", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M4 6.99854L7.99902 10.9976L11.998 6.99854", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }) })
4067
+ ] });
4068
+ }
4069
+ function screeningSummary(states) {
4070
+ if (!states.length || states.some((s) => s.status === "pending")) return { tone: "pending", text: "Checking...", action: "Pending" };
4071
+ const blocked = states.filter((s) => s.status === "done" && s.screen.blocked).length;
4072
+ if (blocked) {
4073
+ const text = blocked === states.length ? states.length === 1 ? "Wallet restricted" : states.length === 2 ? "Both wallets restricted" : "All wallets restricted" : `${blocked} of ${states.length} wallets restricted`;
4074
+ return { tone: "blocked", text, action: "View details" };
4075
+ }
4076
+ if (states.some((s) => s.status === "error")) return { tone: "unknown", text: "Screening unavailable", action: "Try later" };
4077
+ return { tone: "ok", text: `${states.length} wallet${states.length === 1 ? "" : "s"} screened`, action: "No flags" };
4078
+ }
4079
+ function WalletsSheet(props) {
4080
+ const states = props.wallets.map((w) => props.screens[w.address] ?? { status: "pending" });
4081
+ const summary = screeningSummary(states);
4082
+ const anyRestricted = states.some((s) => s.status === "done" && s.screen.blocked);
4083
+ const summaryInner = /* @__PURE__ */ jsxs(Fragment, { children: [
4084
+ /* @__PURE__ */ jsxs("span", { className: "sg-ws-sum-lead", children: [
4085
+ summary.tone === "pending" ? /* @__PURE__ */ jsx(Loader, {}) : summary.tone === "blocked" ? /* @__PURE__ */ jsx(CloseCircleBold, {}) : /* @__PURE__ */ jsx(ShieldTickBold, {}),
4086
+ /* @__PURE__ */ jsx("span", { className: "sg-ws-sum-text", children: summary.text })
3777
4087
  ] }),
3778
- /* @__PURE__ */ jsxs("div", { className: "sg-cp-sheet-body", children: [
3779
- /* @__PURE__ */ jsxs("section", { className: "sg-cp-card", children: [
3780
- /* @__PURE__ */ jsxs("p", { className: "sg-cp-summary-sub", style: { margin: "0 0 12px" }, children: [
3781
- symbol,
3782
- " is delivered to a ",
3783
- family,
3784
- " wallet. Your EVM wallet stays the owner of the order and can cancel it."
4088
+ /* @__PURE__ */ jsxs("span", { className: "sg-ws-sum-act", children: [
4089
+ summary.action,
4090
+ /* @__PURE__ */ jsx(SmallChevron, {})
4091
+ ] })
4092
+ ] });
4093
+ return /* @__PURE__ */ jsx(SheetFrame, { label: "Wallets", title: "Wallets", wide: props.wide, onClose: props.onClose, minHeight: props.minHeight, children: /* @__PURE__ */ jsxs("div", { className: "sg-ws-list", "data-gap": "8", children: [
4094
+ /* @__PURE__ */ jsxs("div", { className: "sg-ws-list", children: [
4095
+ props.wallets.map((w, i) => {
4096
+ const state = states[i];
4097
+ const restricted = state.status === "done" && state.screen.blocked;
4098
+ const pill = restricted ? "Restricted" : anyRestricted && state.status === "done" ? "No flags" : null;
4099
+ return /* @__PURE__ */ jsxs("div", { className: "sg-ws-row", "data-restricted": restricted || void 0, children: [
4100
+ /* @__PURE__ */ jsxs("div", { className: "sg-ws-row-line", children: [
4101
+ /* @__PURE__ */ jsxs("span", { className: "sg-ws-id", children: [
4102
+ /* @__PURE__ */ jsx(WalletAvatar, { family: w.family, chainId: w.chainId }),
4103
+ /* @__PURE__ */ jsxs("span", { className: "sg-ws-id-text", children: [
4104
+ /* @__PURE__ */ jsxs("span", { className: "sg-ws-id-label", children: [
4105
+ FAMILY_LABEL[w.family],
4106
+ " Wallet",
4107
+ pill ? /* @__PURE__ */ jsx("span", { className: "sg-ws-pill", "data-tone": restricted ? "blocked" : "ok", children: pill }) : null
4108
+ ] }),
4109
+ /* @__PURE__ */ jsx("span", { className: "sg-ws-addr", title: w.address, children: walletShort(w.address) })
4110
+ ] })
4111
+ ] }),
4112
+ /* @__PURE__ */ jsx("button", { type: "button", className: "sg-ws-icon-btn", onClick: w.disconnect, "aria-label": `Disconnect ${FAMILY_LABEL[w.family]} wallet`, children: /* @__PURE__ */ jsx(Logout, {}) })
4113
+ ] }),
4114
+ restricted ? /* @__PURE__ */ jsx("p", { className: "sg-ws-note", children: "This wallet can\u2019t be used because it didn\u2019t pass compliance screening." }) : null
4115
+ ] }, w.address);
4116
+ }),
4117
+ props.connect && (props.connect.choices?.length ?? 0) > 1 ? props.connect.choices.map((name) => /* @__PURE__ */ jsxs("button", { type: "button", className: "sg-ws-row sg-ws-action", onClick: () => props.connect.onClick(name), disabled: props.connect.busy, children: [
4118
+ /* @__PURE__ */ jsxs("span", { children: [
4119
+ "Connect ",
4120
+ name
3785
4121
  ] }),
3786
- /* @__PURE__ */ 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` }),
3787
- !state.familyWallet.address && state.familyWallet.wallets.length > 1 ? state.familyWallet.wallets.map((wallet) => /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => void state.connect(wallet.name), disabled: state.familyWallet.connecting, children: wallet.name }, wallet.name)) : null,
3788
- noWallet ? /* @__PURE__ */ jsxs("p", { className: "sg-cp-summary-sub", children: [
3789
- "No ",
3790
- family,
3791
- " wallet found. Enter a ",
3792
- family,
3793
- " address instead."
4122
+ /* @__PURE__ */ jsx(AddCircle, {})
4123
+ ] }, name)) : props.connect ? /* @__PURE__ */ jsxs("button", { type: "button", className: "sg-ws-row sg-ws-action", onClick: () => props.connect.onClick(props.connect.choices?.[0]), disabled: props.connect.busy, children: [
4124
+ /* @__PURE__ */ jsx("span", { children: props.connect.busy ? "Connecting\u2026" : `Connect ${FAMILY_LABEL[props.connect.family]} wallet` }),
4125
+ /* @__PURE__ */ jsx(AddCircle, {})
4126
+ ] }) : null
4127
+ ] }),
4128
+ props.wallets.length ? props.onDetails && states.every((s) => s.status === "done") ? /* @__PURE__ */ jsx("button", { type: "button", className: "sg-ws-sum", "data-tone": summary.tone, onClick: props.onDetails, children: summaryInner }) : /* @__PURE__ */ jsx("div", { className: "sg-ws-sum", "data-tone": summary.tone, role: "status", children: summaryInner }) : null,
4129
+ props.error ? /* @__PURE__ */ jsx("p", { className: "sg-ws-error", role: "alert", children: props.error }) : null
4130
+ ] }) });
4131
+ }
4132
+ function RecipientRow({ state, disabled, wide }) {
4133
+ if (state.error) return /* @__PURE__ */ jsx("div", { className: "sg-rcp-row", "data-wide": wide || void 0, "data-tone": "error", role: "alert", children: state.error });
4134
+ const address = state.shown;
4135
+ if (!address && !state.managed) return null;
4136
+ return /* @__PURE__ */ jsxs("div", { className: "sg-rcp-row", "data-wide": wide || void 0, children: [
4137
+ /* @__PURE__ */ jsx("span", { className: "sg-rcp-label", children: "Recipient" }),
4138
+ /* @__PURE__ */ jsxs("span", { className: "sg-rcp-end", children: [
4139
+ address ? /* @__PURE__ */ jsxs("span", { className: "sg-rcp-value", title: address, children: [
4140
+ FAMILY_LABEL[state.recipientFamily],
4141
+ " \xB7 ",
4142
+ chipShort(address)
4143
+ ] }) : /* @__PURE__ */ jsx("span", { className: "sg-rcp-value", "data-empty": "true", children: "Not set" }),
4144
+ state.managed ? /* @__PURE__ */ jsx("button", { ref: state.triggerRef, type: "button", className: "sg-rcp-change", onClick: state.show, disabled, "aria-haspopup": "dialog", children: address ? "Change" : "Add" }) : null
4145
+ ] })
4146
+ ] });
4147
+ }
4148
+ function RecipientSheet({ state, wide, minHeight }) {
4149
+ const family = state.recipientFamily;
4150
+ const label2 = FAMILY_LABEL[family];
4151
+ const eligible = state.wallets.filter((w) => w.eligible);
4152
+ const [choice, setChoice] = useState(() => {
4153
+ if (state.typed) return { kind: "custom" };
4154
+ const current = eligible.find((w) => w.address === state.recipient) ?? eligible[0];
4155
+ return current ? { kind: "wallet", address: current.address } : { kind: "custom" };
4156
+ });
4157
+ const [draft, setDraft] = useState(state.typed);
4158
+ const [editing, setEditing] = useState(false);
4159
+ const id = useId();
4160
+ const inputRef = useRef(null);
4161
+ const noWallet = family === "solana" && !state.familyWallet.address && !state.familyWallet.wallets.length;
4162
+ const canConnect = !state.familyWallet.address && (family === "evm" || state.familyWallet.wallets.length > 0);
4163
+ const shapeOk = family === "solana" ? isSolanaAddress(draft.trim()) : /^0x[0-9a-fA-F]{40}$/.test(draft.trim());
4164
+ const checksumOk = family === "solana" || !shapeOk || hasValidChecksum(draft.trim());
4165
+ const valid = shapeOk && checksumOk;
4166
+ const invalid = choice.kind === "custom" && Boolean(draft.trim()) && !valid;
4167
+ const chosenWallet = choice.kind === "wallet" ? eligible.find((w) => w.address === choice.address) : void 0;
4168
+ const ready = choice.kind === "wallet" ? Boolean(chosenWallet) : valid;
4169
+ const custom = choice.kind === "custom";
4170
+ useEffect(() => {
4171
+ if (custom) inputRef.current?.focus();
4172
+ }, [custom]);
4173
+ const confirm = () => {
4174
+ if (!ready) return;
4175
+ state.selectAddress(choice.kind === "custom" ? draft.trim() : "");
4176
+ };
4177
+ const row = (w) => {
4178
+ const selected = choice.kind === "wallet" && choice.address === w.address && w.eligible;
4179
+ return /* @__PURE__ */ jsxs(
4180
+ "button",
4181
+ {
4182
+ type: "button",
4183
+ className: "sg-rcp-opt",
4184
+ "data-selected": selected || void 0,
4185
+ disabled: !w.eligible,
4186
+ "aria-pressed": selected,
4187
+ title: w.eligible ? w.address : `A ${FAMILY_LABEL[w.family]} wallet cannot receive on this chain`,
4188
+ onClick: () => setChoice({ kind: "wallet", address: w.address }),
4189
+ children: [
4190
+ /* @__PURE__ */ jsxs("span", { className: "sg-ws-id", children: [
4191
+ /* @__PURE__ */ jsx(WalletAvatar, { family: w.family, chainId: w.family === "evm" ? state.recipientChainId : void 0 }),
4192
+ /* @__PURE__ */ jsxs("span", { className: "sg-ws-id-text", children: [
4193
+ /* @__PURE__ */ jsxs("span", { className: "sg-ws-id-label", children: [
4194
+ FAMILY_LABEL[w.family],
4195
+ " Wallet"
4196
+ ] }),
4197
+ /* @__PURE__ */ jsx("span", { className: "sg-ws-addr", children: walletShort(w.address) })
4198
+ ] })
4199
+ ] }),
4200
+ selected ? /* @__PURE__ */ jsx("span", { className: "sg-rcp-tick", children: /* @__PURE__ */ jsx(Tick2, {}) }) : null
4201
+ ]
4202
+ },
4203
+ w.address
4204
+ );
4205
+ };
4206
+ return /* @__PURE__ */ jsx(
4207
+ SheetFrame,
4208
+ {
4209
+ label: "Recipient",
4210
+ title: "Recipient",
4211
+ wide,
4212
+ onClose: state.close,
4213
+ minHeight,
4214
+ initialFocus: noWallet ? inputRef : void 0,
4215
+ footer: /* @__PURE__ */ jsx("button", { type: "button", className: "sg-btn sg-ws-cta", disabled: !ready, onClick: confirm, children: "Use this address" }),
4216
+ children: /* @__PURE__ */ jsxs("div", { className: "sg-ws-list", children: [
4217
+ state.wallets.map(row),
4218
+ canConnect ? /* @__PURE__ */ jsxs("button", { type: "button", className: "sg-ws-row sg-ws-action", onClick: () => void state.connect(), disabled: state.familyWallet.connecting, children: [
4219
+ /* @__PURE__ */ jsx("span", { children: state.familyWallet.connecting ? "Connecting\u2026" : `Connect ${label2} wallet` }),
4220
+ /* @__PURE__ */ jsx(AddCircle, {})
3794
4221
  ] }) : null,
3795
- state.familyWallet.error ? /* @__PURE__ */ jsx(StatusPanel, { tone: "error", children: state.familyWallet.error }) : null
3796
- ] }),
3797
- /* @__PURE__ */ jsxs("section", { className: "sg-cp-card", children: [
3798
- /* @__PURE__ */ jsxs("div", { className: "sg-field", style: { margin: 0 }, children: [
3799
- /* @__PURE__ */ jsx("label", { className: "sg-label", htmlFor: id, children: "Send to a different address" }),
4222
+ !state.familyWallet.address && state.familyWallet.wallets.length > 1 ? state.familyWallet.wallets.map((wallet) => /* @__PURE__ */ jsxs("button", { type: "button", className: "sg-ws-row sg-ws-action", onClick: () => void state.connect(wallet.name), disabled: state.familyWallet.connecting, children: [
4223
+ /* @__PURE__ */ jsx("span", { children: wallet.name }),
4224
+ /* @__PURE__ */ jsx(AddCircle, {})
4225
+ ] }, wallet.name)) : null,
4226
+ custom ? /* @__PURE__ */ jsxs("div", { className: "sg-rcp-custom", "data-open": "true", children: [
4227
+ /* @__PURE__ */ jsxs("div", { className: "sg-rcp-custom-head", children: [
4228
+ /* @__PURE__ */ jsx("label", { htmlFor: id, children: "Add another address" }),
4229
+ /* @__PURE__ */ jsx("span", { className: "sg-rcp-tick", children: /* @__PURE__ */ jsx(Tick2, {}) })
4230
+ ] }),
3800
4231
  /* @__PURE__ */ jsx(
3801
4232
  "input",
3802
4233
  {
3803
4234
  ref: inputRef,
3804
4235
  id,
3805
- className: "sg-input sg-mono",
3806
- 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)" },
3807
- placeholder: `${family} recipient address`,
3808
- "aria-label": `${family} recipient address`,
4236
+ className: "sg-rcp-input",
4237
+ placeholder: family === "solana" ? "Solana recipient address" : "0x...Recipient address",
4238
+ "aria-label": `${label2} recipient address`,
3809
4239
  "aria-invalid": invalid || void 0,
3810
- "aria-describedby": `${id}-help${invalid ? ` ${id}-error` : ""}`,
3811
- value: draft,
4240
+ "aria-describedby": invalid ? `${id}-error` : void 0,
4241
+ value: editing || draft.length <= 34 ? draft : `${draft.slice(0, 13)}..${draft.slice(-15)}`,
4242
+ onFocus: () => setEditing(true),
4243
+ onBlur: () => setEditing(false),
3812
4244
  onChange: (event) => setDraft(event.target.value),
3813
- spellCheck: false
4245
+ onKeyDown: (event) => {
4246
+ if (event.key === "Enter") confirm();
4247
+ },
4248
+ spellCheck: false,
4249
+ autoComplete: "off"
3814
4250
  }
3815
- )
4251
+ ),
4252
+ invalid ? /* @__PURE__ */ 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,
4253
+ noWallet ? /* @__PURE__ */ jsxs("p", { className: "sg-rcp-hint", children: [
4254
+ "No ",
4255
+ label2,
4256
+ " wallet found. Enter a ",
4257
+ label2,
4258
+ " address instead."
4259
+ ] }) : null
4260
+ ] }) : /* @__PURE__ */ jsxs("button", { type: "button", className: "sg-rcp-custom", onClick: () => setChoice({ kind: "custom" }), children: [
4261
+ /* @__PURE__ */ jsx("span", { children: "Add another address" }),
4262
+ /* @__PURE__ */ jsx(AddCircle, {})
3816
4263
  ] }),
3817
- invalid ? /* @__PURE__ */ jsx("div", { id: `${id}-error`, children: /* @__PURE__ */ jsxs(StatusPanel, { tone: "error", children: [
3818
- "Not a valid ",
3819
- family,
3820
- " address."
3821
- ] }) }) : null,
3822
- /* @__PURE__ */ 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." }),
3823
- /* @__PURE__ */ jsx(Button, { disabled: !valid, onClick: () => state.selectAddress(draft.trim()), children: "Use this address" })
4264
+ state.familyWallet.error ? /* @__PURE__ */ jsx("p", { className: "sg-ws-error", children: state.familyWallet.error }) : null
3824
4265
  ] })
3825
- ] })
4266
+ }
4267
+ );
4268
+ }
4269
+ var short = (address) => `${address.slice(0, 4)}\u2026${address.slice(-4)}`;
4270
+ function RecipientNote({ state, disabled }) {
4271
+ if (state.error) return /* @__PURE__ */ jsx(StatusPanel, { tone: "error", children: state.error });
4272
+ if (!state.managed) return null;
4273
+ const family = state.recipientFamily === "solana" ? "Solana" : "EVM";
4274
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "center", gap: 6, marginTop: 10, fontSize: 13, color: "var(--sg-text-muted)", flexWrap: "wrap" }, children: [
4275
+ state.recipient ? /* @__PURE__ */ jsxs(Fragment, { children: [
4276
+ "To ",
4277
+ /* @__PURE__ */ jsx("b", { className: "sg-mono", title: state.recipient, style: { color: "var(--sg-text)" }, children: short(state.recipient) }),
4278
+ " on ",
4279
+ family,
4280
+ " \xB7 "
4281
+ ] }) : null,
4282
+ /* @__PURE__ */ 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" })
3826
4283
  ] });
3827
4284
  }
3828
4285
  var IDENTITY_KEY_PREFIX = "sg:link:v1:";
@@ -5707,6 +6164,11 @@ function ExchangeCard(props) {
5707
6164
  evm: { account: wallet.account, connect: wallet.connect, connecting: wallet.connecting }
5708
6165
  });
5709
6166
  const recipient = recipientState.recipient;
6167
+ const [walletsOpen, setWalletsOpen] = useState(false);
6168
+ const [walletDetails, setWalletDetails] = useState(false);
6169
+ const [screens, setScreens] = useState({});
6170
+ const walletChipRef = useRef(null);
6171
+ const [takeoverHeight, setTakeoverHeight] = useState(void 0);
5710
6172
  const needsRecipient = recipientState.missing || !!recipientState.error;
5711
6173
  const onInputChange = useRef(props.onInputChange);
5712
6174
  onInputChange.current = props.onInputChange;
@@ -5876,6 +6338,31 @@ function ExchangeCard(props) {
5876
6338
  const connected2 = Boolean(wallet.account);
5877
6339
  const addressed = connected2 && !needsRecipient;
5878
6340
  const submitting = solActive ? solFlow.status === "preparing" || solFlow.status === "submitting" : flow.status === "submitting";
6341
+ const sheetWallets = [
6342
+ ...wallet.account ? [{ family: "evm", address: wallet.account, chainId: wallet.chainId, disconnect: () => void wallet.disconnect() }] : [],
6343
+ ...solanaWallet.address ? [{ family: "solana", address: solanaWallet.address, disconnect: () => void solanaWallet.disconnect() }] : []
6344
+ ];
6345
+ const walletKey = sheetWallets.map((w) => `${w.family}:${w.address}`).join("|");
6346
+ useEffect(() => {
6347
+ if (!walletsOpen) return;
6348
+ let alive = true;
6349
+ for (const w of sheetWallets) {
6350
+ setScreens((prev) => prev[w.address]?.status === "done" ? prev : { ...prev, [w.address]: { status: "pending" } });
6351
+ 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" } })));
6352
+ }
6353
+ return () => {
6354
+ alive = false;
6355
+ };
6356
+ }, [walletsOpen, walletKey, engine]);
6357
+ useEffect(() => {
6358
+ if (!submitting) return;
6359
+ setWalletsOpen(false);
6360
+ setWalletDetails(false);
6361
+ if (recipientState.open) recipientState.close();
6362
+ }, [submitting]);
6363
+ useEffect(() => {
6364
+ if (!sheetWallets.length) setWalletsOpen(false);
6365
+ }, [sheetWallets.length]);
5879
6366
  const lastTxOwned = Boolean(flow.lastTxEntry?.hash && wallet.account && flow.lastTxEntry.account === wallet.account.toLowerCase());
5880
6367
  const evmDirect = flow.lastTxEntry?.settlement === "direct";
5881
6368
  const evmConfirmed = flow.verdict?.status === "confirmed";
@@ -5891,6 +6378,10 @@ function ExchangeCard(props) {
5891
6378
  const receiveSideRef = useRef(null);
5892
6379
  const receiveShown = `${receive ?? ""}|${quoting}|${toTicker}`;
5893
6380
  useFitText(receiveOutRef, receiveShown);
6381
+ useLayoutEffect(() => {
6382
+ const h = receiveOutRef.current?.closest(".sg-widget")?.getBoundingClientRect().height;
6383
+ if (h && Math.round(h) !== takeoverHeight) setTakeoverHeight(Math.round(h));
6384
+ });
5894
6385
  useFitText(receiveSideRef, receiveShown);
5895
6386
  const toDecimals = useMemo(() => {
5896
6387
  try {
@@ -5937,12 +6428,26 @@ function ExchangeCard(props) {
5937
6428
  };
5938
6429
  const walletSlot = /* @__PURE__ */ jsxs("div", { className: "sg-head-tools", children: [
5939
6430
  connected2 ? /* @__PURE__ */ jsx(HistoryButton, { btnRef: histBtnRef, disabled: submitting, onClick: () => setHist({}) }) : null,
5940
- /* @__PURE__ */ jsx("button", { type: "button", className: "sg-wallet", "data-connected": connected2 || void 0, onClick: connected2 ? void 0 : wallet.connect, disabled: wallet.connecting, children: connected2 ? /* @__PURE__ */ jsxs(Fragment, { children: [
5941
- /* @__PURE__ */ jsx("span", { className: "sg-wallet-dot", "aria-hidden": "true" }),
5942
- " ",
5943
- shortAddress(wallet.account)
5944
- ] }) : wallet.connecting ? "Connecting\u2026" : "Connect wallet" })
6431
+ /* @__PURE__ */ jsx(
6432
+ WalletChip,
6433
+ {
6434
+ addresses: sheetWallets.map((w) => w.address),
6435
+ connecting: wallet.connecting,
6436
+ onConnect: wallet.connect,
6437
+ btnRef: walletChipRef,
6438
+ disabled: submitting,
6439
+ onOpen: () => {
6440
+ setSheet(null);
6441
+ setWalletsOpen(true);
6442
+ }
6443
+ }
6444
+ )
5945
6445
  ] });
6446
+ const closeWallets = () => {
6447
+ setWalletsOpen(false);
6448
+ setWalletDetails(false);
6449
+ requestAnimationFrame(() => walletChipRef.current?.focus());
6450
+ };
5946
6451
  const closeSelector = (isFrom) => {
5947
6452
  setView("main");
5948
6453
  requestAnimationFrame(() => (isFrom ? fromTileRef : toTileRef).current?.focus());
@@ -5985,7 +6490,19 @@ function ExchangeCard(props) {
5985
6490
  }
5986
6491
  );
5987
6492
  const rateBox = (open) => /* @__PURE__ */ jsx(RateBox, { rate, fromSymbol: from?.symbol ?? "", fromLogoUrl: fromToken?.logoUrl, toTicker, rows: rateRows, defaultOpen: open, paused: quotePaused });
5988
- const sheetBody = recipientState.open ? /* @__PURE__ */ jsx(RecipientSheet, { state: recipientState, symbol: toTicker }) : sheet === "compliance" ? /* @__PURE__ */ jsx(ComplianceSheet, { compliance, direct: selected?.state === "DIRECT", hasQuote: complianceHasQuote, onClose: closeSheet }) : sheet === "quote" && hasQuote ? /* @__PURE__ */ jsx(
6493
+ const walletScreens = sheetWallets.map((w) => screens[w.address]).flatMap((s) => s?.status === "done" ? [s.screen] : []);
6494
+ const sheetBody = walletsOpen && walletDetails ? /* @__PURE__ */ jsx(ComplianceSheet, { compliance: directComplianceFromScreens(walletScreens), direct: true, hasQuote: true, onClose: () => setWalletDetails(false) }) : walletsOpen ? /* @__PURE__ */ jsx(
6495
+ WalletsSheet,
6496
+ {
6497
+ wallets: sheetWallets,
6498
+ screens,
6499
+ wide,
6500
+ onClose: closeWallets,
6501
+ onDetails: walletScreens.length ? () => setWalletDetails(true) : void 0,
6502
+ 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,
6503
+ error: solanaWallet.error || wallet.error
6504
+ }
6505
+ ) : recipientState.open ? /* @__PURE__ */ jsx(RecipientSheet, { state: recipientState, wide }) : sheet === "compliance" ? /* @__PURE__ */ jsx(ComplianceSheet, { compliance, direct: selected?.state === "DIRECT", hasQuote: complianceHasQuote, onClose: closeSheet }) : sheet === "quote" && hasQuote ? /* @__PURE__ */ jsx(
5989
6506
  QuoteSheet,
5990
6507
  {
5991
6508
  onClose: closeSheet,
@@ -6035,6 +6552,7 @@ function ExchangeCard(props) {
6035
6552
  " SOL."
6036
6553
  ] }) : null;
6037
6554
  let body;
6555
+ let takeover = false;
6038
6556
  if (hist && connected2) {
6039
6557
  body = /* @__PURE__ */ jsx(TxHistoryPanel, { account: wallet.account, engine, solanaAccount: solanaWallet.address, tokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
6040
6558
  } else if (view === "from" || view === "to") {
@@ -6059,6 +6577,7 @@ function ExchangeCard(props) {
6059
6577
  }
6060
6578
  );
6061
6579
  } else if (sheetBody && !wide) {
6580
+ takeover = walletsOpen && !walletDetails || recipientState.open;
6062
6581
  body = sheetBody;
6063
6582
  } else if (solActive && solFlow.status === "sent") {
6064
6583
  body = /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -6107,7 +6626,6 @@ function ExchangeCard(props) {
6107
6626
  const cta = solActive ? /* @__PURE__ */ jsxs("div", { className: "sg-cta-wrap", children: [
6108
6627
  solanaSteps,
6109
6628
  solanaCta,
6110
- /* @__PURE__ */ jsx(RecipientNote, { state: recipientState, disabled: submitting }),
6111
6629
  solanaWallet.error ? /* @__PURE__ */ jsx(StatusPanel, { tone: "error", children: solanaWallet.error }) : null,
6112
6630
  wallet.error ? /* @__PURE__ */ jsx(StatusPanel, { tone: "error", children: wallet.error }) : null
6113
6631
  ] }) : /* @__PURE__ */ jsxs("div", { className: "sg-cta-wrap", children: [
@@ -6116,7 +6634,6 @@ function ExchangeCard(props) {
6116
6634
  recipientState.recipientFamily === "solana" ? "Solana" : "EVM",
6117
6635
  " wallet"
6118
6636
  ] }) : /* @__PURE__ */ 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 }),
6119
- !rampMode ? /* @__PURE__ */ jsx(RecipientNote, { state: recipientState, disabled: submitting }) : null,
6120
6637
  wallet.error ? /* @__PURE__ */ jsx(StatusPanel, { tone: "error", children: wallet.error }) : null
6121
6638
  ] });
6122
6639
  const notices = /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -6166,6 +6683,7 @@ function ExchangeCard(props) {
6166
6683
  ] }),
6167
6684
  /* @__PURE__ */ jsx(PaneFoot, { usd: hasQuote ? toUsd : null })
6168
6685
  ] }),
6686
+ !rampMode && (connected2 || recipientState.managed) ? /* @__PURE__ */ jsx(RecipientRow, { state: recipientState, disabled: submitting }) : null,
6169
6687
  rampMode ? null : props.inDialog === "drawer" ? /* @__PURE__ */ jsxs(Fragment, { children: [
6170
6688
  complianceButton(true),
6171
6689
  quoteButton(true),
@@ -6183,7 +6701,7 @@ function ExchangeCard(props) {
6183
6701
  cta
6184
6702
  ] });
6185
6703
  }
6186
- const card = /* @__PURE__ */ jsx(WidgetShell, { title, theme: config.theme, heightPx: props.heightPx, walletSlot, onClose: props.onClose, wide, children: body });
6704
+ const card = /* @__PURE__ */ jsx(WidgetShell, { title, theme: config.theme, heightPx: props.heightPx, walletSlot, onClose: props.onClose, wide, takeover, minHeightPx: takeover ? takeoverHeight : void 0, children: body });
6187
6705
  if (!wide) return card;
6188
6706
  const resolved = resolveTheme(config.theme);
6189
6707
  const vars = themeToVars(resolved);
@@ -6230,6 +6748,7 @@ function ExchangeCard(props) {
6230
6748
  ] })
6231
6749
  ] }),
6232
6750
  /* @__PURE__ */ jsxs("div", { className: "sg-stack", children: [
6751
+ connected2 || recipientState.managed ? /* @__PURE__ */ jsx(RecipientRow, { state: recipientState, disabled: submitting, wide: true }) : null,
6233
6752
  rateBox(true),
6234
6753
  complianceButton(true),
6235
6754
  quoteButton(true)