@glacislabs/stablegenie-zerodelta 2.0.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -870,9 +870,7 @@ var WIDGET_CSS = `
870
870
  .sg-soonpanel-title{font-size:14px;font-weight:700;margin-bottom:6px}
871
871
  .sg-soonpanel-sub{font-size:12px;color:var(--sg-text-muted);line-height:1.45}
872
872
 
873
- /* compact merchant-receives anchor + click-to-expand "Details" disclosure (merchant-configured;
874
- the payer never edits it). Reveal mirrors the island's grid-rows morph; reduced-motion covered by
875
- the .sg-island guard below (it disables transitions on .sg-island *). */
873
+ /* payout slot \u2014 bank settlement only (the stablecoin destination anchor is never rendered) */
876
874
  .sg-merch-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
877
875
  .sg-merch-lead{min-width:0}
878
876
  /* bank payout destination (settlement="bank") \u2014 sits in the same anchor slot as the stablecoin
@@ -882,19 +880,6 @@ var WIDGET_CSS = `
882
880
  .sg-bank-text{display:flex;flex-direction:column;min-width:0}
883
881
  .sg-bank-name{font-size:16px;font-weight:700;color:var(--sg-text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
884
882
  .sg-bank-cur{font-size:12px;color:var(--sg-text-muted)}
885
- .sg-details-toggle{flex:0 0 auto;display:inline-flex;align-items:center;gap:4px;padding:5px 10px;border:1px solid var(--sg-border);border-radius:var(--sg-radius-cta);background:transparent;color:var(--sg-text-muted);font:inherit;font-size:12px;font-weight:600;cursor:pointer;white-space:nowrap;transition:color var(--sg-motion-fast) var(--sg-ease-out-soft),border-color var(--sg-motion-fast) var(--sg-ease-out-soft)}
886
- .sg-details-toggle:hover{color:var(--sg-accent);border-color:var(--sg-accent)}
887
- .sg-details-chev{display:inline-flex;font-size:11px;line-height:1;transition:transform var(--sg-motion-fast) var(--sg-ease-out-soft)}
888
- .sg-details-toggle[data-open="true"] .sg-details-chev{transform:rotate(180deg)}
889
- .sg-details-reveal{display:grid;grid-template-rows:0fr;transition:grid-template-rows var(--sg-motion-base) var(--sg-ease-out-soft)}
890
- .sg-details-reveal[data-open="true"]{grid-template-rows:1fr}
891
- .sg-details-reveal-inner{min-height:0;overflow:hidden}
892
- .sg-details-body{margin-top:12px;padding-top:12px;border-top:1px solid var(--sg-border)}
893
- .sg-details-row{display:flex;align-items:baseline;justify-content:space-between;gap:12px;padding:4px 0;font-size:12px}
894
- .sg-details-k{flex:0 0 auto;color:var(--sg-text-muted)}
895
- .sg-details-v{min-width:0;text-align:right;color:var(--sg-text)}
896
- .sg-details-addr{word-break:break-all;font-size:11px}
897
- .sg-details-note{margin-top:8px;font-size:11px;color:var(--sg-text-muted);line-height:1.45}
898
883
 
899
884
  /* express-card compaction for the 5-tab method selector (already overflow-x:auto for narrow cells) */
900
885
  .sg-widget[data-sg-express] .sg-tabs{margin:12px 0 8px}
@@ -924,7 +909,7 @@ var WIDGET_CSS = `
924
909
  broken) and shows the static accent dot instead; the label + live region carry the state. */
925
910
  @media (prefers-reduced-motion:reduce){
926
911
  .sg-island,.sg-island *{transition:none!important;animation:none!important}
927
- .sg-island-reveal,.sg-details-reveal{transition:none!important}
912
+ .sg-island-reveal{transition:none!important}
928
913
  .sg-island .sg-spinner{display:none!important}
929
914
  .sg-island .sg-rm-dot{display:inline-block}
930
915
  }
@@ -1172,14 +1157,22 @@ function StepList(props) {
1172
1157
  }
1173
1158
  var SHOW_ROADMAP_METHODS = true;
1174
1159
  var METHODS = [
1175
- { id: "recommended", label: "Recommended", live: true },
1176
1160
  { id: "stablecoin", label: "Stablecoin", live: true },
1177
- { id: "anyasset", label: "Any asset", live: true },
1178
1161
  { id: "card", label: "Card", live: false },
1179
- { id: "bank", label: "Bank", live: false }
1162
+ { id: "bank", label: "Bank account", live: false }
1180
1163
  ];
1181
1164
  function isLiveMethod(m) {
1182
- return m === "recommended" || m === "stablecoin" || m === "anyasset";
1165
+ return m === "stablecoin";
1166
+ }
1167
+ function balanceRank(raw, decimals) {
1168
+ if (raw == null) return 0n;
1169
+ try {
1170
+ const d = Number.isFinite(Number(decimals)) ? Math.max(0, Math.trunc(Number(decimals))) : 18;
1171
+ const v = BigInt(raw);
1172
+ return d <= 18 ? v * 10n ** BigInt(18 - d) : v / 10n ** BigInt(d - 18);
1173
+ } catch {
1174
+ return 0n;
1175
+ }
1183
1176
  }
1184
1177
  function MethodTabs(props) {
1185
1178
  const showRoadmap = props.showRoadmap ?? SHOW_ROADMAP_METHODS;
@@ -1654,55 +1647,6 @@ function forgetIdentity(account) {
1654
1647
  var addrEq = (a, b) => String(a || "").toLowerCase() === String(b || "").toLowerCase();
1655
1648
  var chainName = (id) => id != null ? CHAIN_LABELS[id] || `Chain ${id}` : "";
1656
1649
  var STABLES = /* @__PURE__ */ new Set(["USDC", "USDT", "USDE"]);
1657
- function MerchantReceives(props) {
1658
- const [open, setOpen] = useState(false);
1659
- const bodyId = useId();
1660
- const hasDetails = Boolean(props.recipient);
1661
- return /* @__PURE__ */ jsxs("div", { className: "sg-panel sg-merch", children: [
1662
- /* @__PURE__ */ jsxs("div", { className: "sg-merch-head", children: [
1663
- /* @__PURE__ */ jsxs("div", { className: "sg-merch-lead", children: [
1664
- /* @__PURE__ */ jsx("div", { className: "sg-label", children: "Merchant receives exactly" }),
1665
- /* @__PURE__ */ jsxs("div", { className: "sg-anchor sg-mono", children: [
1666
- props.amount,
1667
- " ",
1668
- props.asset
1669
- ] })
1670
- ] }),
1671
- hasDetails ? /* @__PURE__ */ jsxs(
1672
- "button",
1673
- {
1674
- type: "button",
1675
- className: "sg-details-toggle",
1676
- "data-open": open,
1677
- "aria-expanded": open,
1678
- "aria-controls": bodyId,
1679
- onClick: () => setOpen((o) => !o),
1680
- children: [
1681
- "Details",
1682
- /* @__PURE__ */ jsx("span", { className: "sg-details-chev", "aria-hidden": "true", children: "\u2304" })
1683
- ]
1684
- }
1685
- ) : null
1686
- ] }),
1687
- hasDetails ? /* @__PURE__ */ jsx("div", { className: "sg-details-reveal", "data-open": open, children: /* @__PURE__ */ jsx("div", { className: "sg-details-reveal-inner", children: /* @__PURE__ */ jsxs("div", { className: "sg-details-body", id: bodyId, children: [
1688
- /* @__PURE__ */ jsxs("div", { className: "sg-details-row", children: [
1689
- /* @__PURE__ */ jsx("span", { className: "sg-details-k", children: "Network" }),
1690
- /* @__PURE__ */ jsx("span", { className: "sg-details-v", children: chainName(props.chainId) })
1691
- ] }),
1692
- /* @__PURE__ */ jsxs("div", { className: "sg-details-row", children: [
1693
- /* @__PURE__ */ jsx("span", { className: "sg-details-k", children: "Recipient" }),
1694
- /* @__PURE__ */ jsx("span", { className: "sg-details-v sg-mono sg-details-addr", children: props.recipient })
1695
- ] }),
1696
- /* @__PURE__ */ jsxs("div", { className: "sg-details-note", children: [
1697
- "Settled like a card \u2014 the merchant always receives exactly ",
1698
- props.amount,
1699
- " ",
1700
- props.asset,
1701
- ". You pay a little more to cover the network cost."
1702
- ] })
1703
- ] }) }) }) : null
1704
- ] });
1705
- }
1706
1650
  function BankGlyph() {
1707
1651
  return /* @__PURE__ */ jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M3 10h18M5 10v8M10 10v8M14 10v8M19 10v8M3 19h18M12 3 3 8h18Z" }) });
1708
1652
  }
@@ -1905,7 +1849,7 @@ function PaymentIsland(props) {
1905
1849
  onSuccess: config.onSuccess,
1906
1850
  onError: config.onError
1907
1851
  });
1908
- const [method, setMethod] = useState("recommended");
1852
+ const [method, setMethod] = useState("stablecoin");
1909
1853
  const parked = isPay && !isLiveMethod(method);
1910
1854
  const fundingSet = useMemo(
1911
1855
  () => props.fundingAssets?.length ? new Set(props.fundingAssets.map((a) => a.toUpperCase())) : null,
@@ -1931,7 +1875,13 @@ function PaymentIsland(props) {
1931
1875
  }),
1932
1876
  [visibleRoutes, holdings.balances]
1933
1877
  );
1934
- const held = useMemo(() => annotated.filter((a) => a.affordable === true), [annotated]);
1878
+ const held = useMemo(
1879
+ () => annotated.filter((a) => a.affordable === true).sort((a, b) => {
1880
+ const d = balanceRank(b.balance?.raw, b.route.source.decimals) - balanceRank(a.balance?.raw, a.route.source.decimals);
1881
+ return d > 0n ? 1 : d < 0n ? -1 : 0;
1882
+ }),
1883
+ [annotated]
1884
+ );
1935
1885
  const heldIds = useMemo(() => new Set(held.map((a) => a.route.id)), [held]);
1936
1886
  const optionStates = useMemo(() => {
1937
1887
  const map = {};
@@ -2120,9 +2070,7 @@ function PaymentIsland(props) {
2120
2070
  const lastTxOwned = Boolean(flow.lastTxEntry?.hash && wallet.account && flow.lastTxEntry.account === wallet.account.toLowerCase());
2121
2071
  const mismatch = flow.status === "error" && flow.verdict?.status === "mismatch";
2122
2072
  const destAsset = isPay ? props.toAsset : exToAsset;
2123
- const destChainId = isPay ? props.toChainId : exToChainId;
2124
- const anchorLabel = isPay ? "Merchant receives exactly" : "You receive (estimated)";
2125
- const anchorAmount = isPay ? props.amount : sel?.receive.amount ?? (flow.status === "loading" ? "\u2026" : "\u2014");
2073
+ const anchorAmount = sel?.receive.amount ?? (flow.status === "loading" ? "\u2026" : "\u2014");
2126
2074
  const successAmount = isPay ? props.amount : sel?.receive.amount;
2127
2075
  const money = props.moneyDisplay ?? (isPay ? props.amount ? `${props.amount} ${props.toAsset}` : "" : exAmount ? `${exAmount} ${exFromAsset ?? ""}`.trim() : "");
2128
2076
  const verb = isPay ? { present: "Pay", gerund: "Paying", past: "Paid" } : kind === "swap" ? { present: "Swap", gerund: "Swapping", past: "Swapped" } : { present: "Exchange", gerund: "Exchanging", past: "Exchanged" };
@@ -2244,7 +2192,7 @@ function PaymentIsland(props) {
2244
2192
  } else if (!wallet.account) {
2245
2193
  body = /* @__PURE__ */ jsxs(Fragment, { children: [
2246
2194
  /* @__PURE__ */ jsx(IdentityLine, { account: null, email: identity?.email }),
2247
- isPay ? /* @__PURE__ */ jsx("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ jsx(MerchantReceives, { amount: props.amount, asset: destAsset, chainId: destChainId, recipient: props.recipient }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2195
+ isPay ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
2248
2196
  exchangeControls,
2249
2197
  /* @__PURE__ */ jsxs("div", { className: "sg-panel", style: { marginTop: 12 }, children: [
2250
2198
  /* @__PURE__ */ jsx("div", { className: "sg-label", children: "You receive (estimated)" }),
@@ -2315,10 +2263,10 @@ function PaymentIsland(props) {
2315
2263
  const walletError = flow.status === "error" && flow.steps.length > 0;
2316
2264
  body = /* @__PURE__ */ jsxs(Fragment, { children: [
2317
2265
  /* @__PURE__ */ jsx(IdentityLine, { account: wallet.account, email: identity?.email }),
2318
- isPay ? /* @__PURE__ */ jsx("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ jsx(MerchantReceives, { amount: props.amount, asset: destAsset, chainId: destChainId, recipient: props.recipient }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2266
+ isPay ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
2319
2267
  exchangeControls,
2320
2268
  /* @__PURE__ */ jsxs("div", { className: "sg-panel", style: { marginTop: 12 }, children: [
2321
- /* @__PURE__ */ jsx("div", { className: "sg-label", children: anchorLabel }),
2269
+ /* @__PURE__ */ jsx("div", { className: "sg-label", children: "You receive (estimated)" }),
2322
2270
  /* @__PURE__ */ jsxs("div", { className: "sg-anchor sg-mono", children: [
2323
2271
  anchorAmount,
2324
2272
  " ",
@@ -2425,7 +2373,7 @@ function StableGeniePay(props) {
2425
2373
  onSuccess: config.onSuccess,
2426
2374
  onError: config.onError
2427
2375
  });
2428
- const [method, setMethod] = useState("recommended");
2376
+ const [method, setMethod] = useState("stablecoin");
2429
2377
  const fundingSet = useMemo(
2430
2378
  () => props.fundingAssets?.length ? new Set(props.fundingAssets.map((a) => a.toUpperCase())) : null,
2431
2379
  [props.fundingAssets]
@@ -2450,7 +2398,13 @@ function StableGeniePay(props) {
2450
2398
  }),
2451
2399
  [visibleRoutes, holdings.balances]
2452
2400
  );
2453
- const held = useMemo(() => annotated.filter((a) => a.affordable === true), [annotated]);
2401
+ const held = useMemo(
2402
+ () => annotated.filter((a) => a.affordable === true).sort((a, b) => {
2403
+ const d = balanceRank(b.balance?.raw, b.route.source.decimals) - balanceRank(a.balance?.raw, a.route.source.decimals);
2404
+ return d > 0n ? 1 : d < 0n ? -1 : 0;
2405
+ }),
2406
+ [annotated]
2407
+ );
2454
2408
  const heldIds = useMemo(() => new Set(held.map((a) => a.route.id)), [held]);
2455
2409
  const scannedEmpty = !holdings.loading && Object.keys(holdings.balances).length > 0 && held.length === 0;
2456
2410
  const optionStates = useMemo(() => {
@@ -2553,7 +2507,6 @@ function StableGeniePay(props) {
2553
2507
  if (r) selectRoute(r.id);
2554
2508
  closeSelector();
2555
2509
  };
2556
- const chainName2 = CHAIN_LABELS[props.toChainId] || `Chain ${props.toChainId}`;
2557
2510
  const parked = !isLiveMethod(method);
2558
2511
  const submitting = flow.status === "submitting";
2559
2512
  const sel = flow.selected;
@@ -2561,7 +2514,10 @@ function StableGeniePay(props) {
2561
2514
  const selPick = sel && selectedVisible ? { chainId: sel.source.chainId, symbol: sel.source.asset } : null;
2562
2515
  const selToken = sel ? registryTokens.find((t) => Number(t.chainId) === sel.source.chainId && addrEq2(t.address, sel.source.tokenAddress)) ?? null : null;
2563
2516
  const selBal = sel ? holdings.balances[balanceKey(sel.source.chainId, sel.source.tokenAddress)] : void 0;
2564
- const why = parked ? "" : sel && selectedVisible ? sel.state === "DIRECT" ? `Direct ${sel.source.asset} transfer on ${CHAIN_LABELS[sel.source.chainId] || sel.source.chainName} \xB7 lowest cost` : `Routed through ZeroDelta \u2014 the merchant still receives exactly ${props.amount} ${props.toAsset}` : method === "stablecoin" ? "Pay with USDC, USDT, or USDE from your wallet." : method === "anyasset" ? "Pay with any supported asset \u2014 we route it to exactly what the merchant needs." : "Best route \xB7 picked for you";
2517
+ const why = parked ? "" : sel && selectedVisible ? sel.state === "DIRECT" ? `Direct ${sel.source.asset} transfer on ${CHAIN_LABELS[sel.source.chainId] || sel.source.chainName} \xB7 lowest cost` : (
2518
+ // Deliberately does NOT restate the destination amount — that is merchant config, not a payer fact.
2519
+ `Routed through ZeroDelta \xB7 the extra covers the network cost`
2520
+ ) : "Pay with USDC, USDT, or USDE from your wallet.";
2565
2521
  const comingSoon = method === "card" ? "Card payments are coming soon. Today StableGenie pays from your connected wallet." : "Bank transfers are coming soon.";
2566
2522
  const payLabel = parked ? method === "card" ? "Card \u2014 coming soon" : "Bank \u2014 coming soon" : submitting ? "Paying\u2026" : flow.insufficient ? "Insufficient balance" : flow.nativeShortfall ? flow.nativeShortfall : sel && selectedVisible ? `Pay ${sel.source.payAmount} ${sel.source.asset}` : "Pay";
2567
2523
  const walletSlot = wallet.account ? /* @__PURE__ */ jsxs("div", { className: "sg-head-tools", children: [
@@ -2572,82 +2528,66 @@ function StableGeniePay(props) {
2572
2528
  ] })
2573
2529
  ] }) : void 0;
2574
2530
  if (props.variant === "pill") return /* @__PURE__ */ jsx(PaymentIsland, { kind: "pay", ...props });
2575
- return /* @__PURE__ */ jsx(WidgetShell, { title: config.title || "Complete payment", theme: config.theme, heightPx: props.heightPx, walletSlot, children: hist && wallet.account ? /* @__PURE__ */ jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, initialEntry: hist.entry ?? null, onBack: closeHistory }) : view === "select" && wallet.account ? /* @__PURE__ */ jsx(TokenSelect, { title: "Pay with", chains: fundingChains, tokens: fundingTokens, balances: holdings.balances, optionStates, onBack: closeSelector, onPick: pickFunding }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2576
- /* @__PURE__ */ jsxs("div", { className: "sg-panel", children: [
2577
- /* @__PURE__ */ jsx("div", { className: "sg-label", children: "Merchant receives exactly" }),
2578
- /* @__PURE__ */ jsxs("div", { className: "sg-anchor sg-mono", children: [
2531
+ return /* @__PURE__ */ jsx(WidgetShell, { title: config.title || "Complete payment", theme: config.theme, heightPx: props.heightPx, walletSlot, children: hist && wallet.account ? /* @__PURE__ */ jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, initialEntry: hist.entry ?? null, onBack: closeHistory }) : view === "select" && wallet.account ? /* @__PURE__ */ jsx(TokenSelect, { title: "Pay with", chains: fundingChains, tokens: fundingTokens, balances: holdings.balances, optionStates, onBack: closeSelector, onPick: pickFunding }) : /* @__PURE__ */ jsx(Fragment, { children: !wallet.account ? /* @__PURE__ */ jsxs("div", { className: "sg-cta-wrap", children: [
2532
+ /* @__PURE__ */ jsx(Button, { onClick: wallet.connect, busy: wallet.connecting, children: "Connect wallet" }),
2533
+ wallet.error ? /* @__PURE__ */ jsx(StatusPanel, { tone: "error", children: wallet.error }) : null
2534
+ ] }) : flow.status === "success" || flow.status === "pending" ? /* @__PURE__ */ jsxs(Fragment, { children: [
2535
+ /* @__PURE__ */ jsxs("div", { className: "sg-success", children: [
2536
+ /* @__PURE__ */ jsx("div", { className: "sg-success-check", "data-pending": flow.verdict?.status !== "confirmed", children: /* @__PURE__ */ jsx(CheckGlyph3, {}) }),
2537
+ /* @__PURE__ */ jsxs("div", { className: "sg-success-amt sg-mono", children: [
2579
2538
  props.amount,
2580
2539
  " ",
2581
2540
  props.toAsset
2582
2541
  ] }),
2583
- /* @__PURE__ */ jsxs("div", { className: "sg-anchor-sub", children: [
2584
- "on ",
2585
- chainName2,
2542
+ /* @__PURE__ */ jsxs("div", { className: "sg-success-sub", children: [
2543
+ flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
2586
2544
  " \xB7 ",
2587
2545
  shortAddress(props.recipient)
2588
2546
  ] })
2589
2547
  ] }),
2590
- !wallet.account ? /* @__PURE__ */ jsxs("div", { className: "sg-cta-wrap", children: [
2591
- /* @__PURE__ */ jsx(Button, { onClick: wallet.connect, busy: wallet.connecting, children: "Connect wallet" }),
2592
- wallet.error ? /* @__PURE__ */ jsx(StatusPanel, { tone: "error", children: wallet.error }) : null
2593
- ] }) : flow.status === "success" || flow.status === "pending" ? /* @__PURE__ */ jsxs(Fragment, { children: [
2594
- /* @__PURE__ */ jsxs("div", { className: "sg-success", children: [
2595
- /* @__PURE__ */ jsx("div", { className: "sg-success-check", "data-pending": flow.verdict?.status !== "confirmed", children: /* @__PURE__ */ jsx(CheckGlyph3, {}) }),
2596
- /* @__PURE__ */ jsxs("div", { className: "sg-success-amt sg-mono", children: [
2597
- props.amount,
2548
+ lastTxOwned ? /* @__PURE__ */ jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => setHist({ entry: flow.lastTxEntry }), children: "View transaction" }) }) : null
2549
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2550
+ /* @__PURE__ */ jsx(MethodTabs, { value: method, onChange: setMethod }),
2551
+ parked ? /* @__PURE__ */ jsx(StatusPanel, { children: comingSoon }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2552
+ /* @__PURE__ */ jsx("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ jsx(
2553
+ TokenTile,
2554
+ {
2555
+ label: "Pay with",
2556
+ pick: selPick,
2557
+ token: selToken,
2558
+ disabled: submitting || !visibleRoutes.length,
2559
+ btnRef: payTileRef,
2560
+ onClick: () => setView("select")
2561
+ }
2562
+ ) }),
2563
+ flow.status === "loading" ? /* @__PURE__ */ jsxs("div", { className: "sg-route", style: { marginTop: 12 }, children: [
2564
+ /* @__PURE__ */ jsx("div", { className: "sg-skel" }),
2565
+ /* @__PURE__ */ jsxs("div", { className: "sg-muted", style: { fontSize: 13 }, children: [
2566
+ /* @__PURE__ */ jsx("span", { className: "sg-spinner" }),
2567
+ " Finding the best way to pay\u2026"
2568
+ ] })
2569
+ ] }) : null,
2570
+ flow.status === "error" && flow.error ? /* @__PURE__ */ jsx(StatusPanel, { tone: "error", children: flow.error }) : null,
2571
+ sel && selectedVisible && flow.status !== "loading" ? /* @__PURE__ */ jsxs("div", { className: "sg-panel", style: { marginTop: 12 }, children: [
2572
+ /* @__PURE__ */ jsx("div", { className: "sg-label", children: "You pay" }),
2573
+ /* @__PURE__ */ jsxs("div", { className: "sg-anchor sg-mono", children: [
2574
+ sel.source.payAmount,
2598
2575
  " ",
2599
- props.toAsset
2576
+ sel.source.asset
2600
2577
  ] }),
2601
- /* @__PURE__ */ jsxs("div", { className: "sg-success-sub", children: [
2602
- flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
2603
- " \xB7 ",
2604
- shortAddress(props.recipient)
2578
+ /* @__PURE__ */ jsxs("div", { className: "sg-anchor-sub", children: [
2579
+ "on ",
2580
+ CHAIN_LABELS[sel.source.chainId] || sel.source.chainName,
2581
+ selBal ? ` \xB7 balance ${selBal.formatted}` : ""
2605
2582
  ] })
2606
- ] }),
2607
- lastTxOwned ? /* @__PURE__ */ jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => setHist({ entry: flow.lastTxEntry }), children: "View transaction" }) }) : null
2608
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2609
- /* @__PURE__ */ jsx(MethodTabs, { value: method, onChange: setMethod }),
2610
- parked ? /* @__PURE__ */ jsx(StatusPanel, { children: comingSoon }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2611
- /* @__PURE__ */ jsx("div", { style: { marginTop: 12 }, children: /* @__PURE__ */ jsx(
2612
- TokenTile,
2613
- {
2614
- label: "Pay with",
2615
- pick: selPick,
2616
- token: selToken,
2617
- disabled: submitting || !visibleRoutes.length,
2618
- btnRef: payTileRef,
2619
- onClick: () => setView("select")
2620
- }
2621
- ) }),
2622
- flow.status === "loading" ? /* @__PURE__ */ jsxs("div", { className: "sg-route", style: { marginTop: 12 }, children: [
2623
- /* @__PURE__ */ jsx("div", { className: "sg-skel" }),
2624
- /* @__PURE__ */ jsxs("div", { className: "sg-muted", style: { fontSize: 13 }, children: [
2625
- /* @__PURE__ */ jsx("span", { className: "sg-spinner" }),
2626
- " Finding the best way to pay\u2026"
2627
- ] })
2628
- ] }) : null,
2629
- flow.status === "error" && flow.error ? /* @__PURE__ */ jsx(StatusPanel, { tone: "error", children: flow.error }) : null,
2630
- sel && selectedVisible && flow.status !== "loading" ? /* @__PURE__ */ jsxs("div", { className: "sg-panel", style: { marginTop: 12 }, children: [
2631
- /* @__PURE__ */ jsx("div", { className: "sg-label", children: "You pay" }),
2632
- /* @__PURE__ */ jsxs("div", { className: "sg-anchor sg-mono", children: [
2633
- sel.source.payAmount,
2634
- " ",
2635
- sel.source.asset
2636
- ] }),
2637
- /* @__PURE__ */ jsxs("div", { className: "sg-anchor-sub", children: [
2638
- "on ",
2639
- CHAIN_LABELS[sel.source.chainId] || sel.source.chainName,
2640
- selBal ? ` \xB7 balance ${selBal.formatted}` : ""
2641
- ] })
2642
- ] }) : null,
2643
- why ? /* @__PURE__ */ jsx("div", { className: "sg-why", style: { marginTop: 10 }, children: why }) : null,
2644
- scannedEmpty ? /* @__PURE__ */ jsx("div", { className: "sg-note", children: "None of your balances can cover this yet \u2014 pick a different asset to fund with." }) : null,
2645
- flow.status === "ready" && !visibleRoutes.length ? /* @__PURE__ */ jsx(StatusPanel, { children: "No funding route matches the accepted assets for this payment." }) : null
2646
- ] }),
2647
- submitting ? /* @__PURE__ */ jsx(StepList, { steps: flow.steps }) : null,
2648
- /* @__PURE__ */ jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsx(Button, { onClick: parked || !selectedVisible ? void 0 : flow.submit, busy: submitting, disabled: parked || !selectedVisible || flow.insufficient || !!flow.nativeShortfall || flow.status === "loading", children: payLabel }) })
2649
- ] })
2650
- ] }) });
2583
+ ] }) : null,
2584
+ why ? /* @__PURE__ */ jsx("div", { className: "sg-why", style: { marginTop: 10 }, children: why }) : null,
2585
+ scannedEmpty ? /* @__PURE__ */ jsx("div", { className: "sg-note", children: "None of your balances can cover this yet \u2014 pick a different asset to fund with." }) : null,
2586
+ flow.status === "ready" && !visibleRoutes.length ? /* @__PURE__ */ jsx(StatusPanel, { children: "No funding route matches the accepted assets for this payment." }) : null
2587
+ ] }),
2588
+ submitting ? /* @__PURE__ */ jsx(StepList, { steps: flow.steps }) : null,
2589
+ /* @__PURE__ */ jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsx(Button, { onClick: parked || !selectedVisible ? void 0 : flow.submit, busy: submitting, disabled: parked || !selectedVisible || flow.insufficient || !!flow.nativeShortfall || flow.status === "loading", children: payLabel }) })
2590
+ ] }) }) });
2651
2591
  }
2652
2592
  var chainOptions = SUPPORTED_CHAINS.map((c) => ({ value: c, label: CHAIN_LABELS[c] || `Chain ${c}` }));
2653
2593
  var assetOptions = SUPPORTED_ASSETS2.map((a) => ({ value: a, label: a }));