@glacislabs/stablegenie-zerodelta 4.15.0 → 4.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mount.cjs CHANGED
@@ -910,7 +910,9 @@ var CHAIN_DISPLAY_NAMES = Object.freeze({
910
910
  9745: "Plasma",
911
911
  34443: "Mode",
912
912
  42161: "Arbitrum One",
913
- 43114: "Avalanche C-Chain",
913
+ // "Avalanche", as the dApp prints it since zd-dapp#582 (from ZD Heavy's /chains). The widget's
914
+ // registry read lists no row for a payout-only chain, so this table is what names it here.
915
+ 43114: "Avalanche",
914
916
  48900: "Zircuit",
915
917
  57073: "Ink",
916
918
  59144: "Linea",
@@ -1512,7 +1514,7 @@ function verifySolanaSubmit(p, e) {
1512
1514
  if (p.destinationChainId !== BigInt(e.destinationChainId)) fail("destination chain");
1513
1515
  if (p.executionChainId !== BigInt(e.executionChainId)) fail("execution chain");
1514
1516
  if (p.deadline !== BigInt(e.deadline)) fail("deadline");
1515
- if (p.partnerId !== null !== (e.partnerId !== null)) fail("subsidy marker");
1517
+ if (p.partnerId !== null !== (e.partnerId !== null)) fail("partner id");
1516
1518
  }
1517
1519
  var PREPARATION_INSTRUCTIONS = [
1518
1520
  { discriminator: [225, 205, 234, 143, 17, 186, 50, 220], signer: 2 },
@@ -2030,6 +2032,8 @@ function normalizePreview(request, quote, to, amount) {
2030
2032
  estimatedDuration: Number(option.estimatedTimeSec || 0),
2031
2033
  via: null,
2032
2034
  nativeFeeRaw: String(option.gasCostSource || "0"),
2035
+ zeroDeltaFeeCentibips: option.zeroDeltaFeeCentibips,
2036
+ zeroDeltaFeeNative: option.zeroDeltaFeeNative,
2033
2037
  quote,
2034
2038
  option,
2035
2039
  txData: option.txData,
@@ -2067,7 +2071,9 @@ async function previewSolanaSource(api, input) {
2067
2071
  feeBps: Number(option.feeBps || 0),
2068
2072
  estimatedDuration: Number(option.estimatedTimeSec || 0),
2069
2073
  via: null,
2070
- nativeFeeRaw: "0"
2074
+ nativeFeeRaw: "0",
2075
+ zeroDeltaFeeCentibips: option.zeroDeltaFeeCentibips,
2076
+ zeroDeltaFeeNative: option.zeroDeltaFeeNative
2071
2077
  };
2072
2078
  }
2073
2079
  function solanaQuoteCompliance(quote) {
@@ -2850,6 +2856,12 @@ function humanizeComplianceReason(raw2) {
2850
2856
  }
2851
2857
  case "blocked_jurisdiction":
2852
2858
  return `Your region (${cleanJurisdiction(detail)}) isn't supported.`;
2859
+ // zd-dapp src/lib/complianceReason.ts (#588): ZD Heavy's account-country and wallet-origin rules.
2860
+ // Without these two the payer read the raw code ("account blocked country — IR").
2861
+ case "account_blocked_country":
2862
+ return `Your account doesn't support this region (${cleanJurisdiction(detail)}).`;
2863
+ case "blocked_origin_jurisdiction":
2864
+ return `The wallet's attributed region (${cleanJurisdiction(detail)}) isn't supported.`;
2853
2865
  case "blocked_destination_jurisdiction":
2854
2866
  return `The destination region (${cleanJurisdiction(detail)}) isn't supported.`;
2855
2867
  case "jurisdiction_out_of_scope":
@@ -3528,6 +3540,8 @@ async function buildRoute({
3528
3540
  quote: {
3529
3541
  bridge: quote.bridge,
3530
3542
  feeBps: quote.feeBps,
3543
+ zeroDeltaFeeCentibips: quote.zeroDeltaFeeCentibips,
3544
+ zeroDeltaFeeNative: quote.zeroDeltaFeeNative,
3531
3545
  estimatedDuration: quote.estimatedDuration,
3532
3546
  gasCostSource: quote.gasCostSource,
3533
3547
  msgValue: valueRaw.toString(),
@@ -3548,7 +3562,7 @@ var CHANNEL_HEADER = "x-zd-channel";
3548
3562
  var CHANNEL_VERSION_HEADER = "x-zd-channel-version";
3549
3563
  var CHANNEL_ORIGIN_HEADER = "x-zd-channel-origin";
3550
3564
  var WIDGET_CHANNEL = "widget";
3551
- var WIDGET_VERSION = "4.15.0" ;
3565
+ var WIDGET_VERSION = "4.16.0" ;
3552
3566
  var MAX_CHANNEL_VERSION_LEN = 32;
3553
3567
  function sanitizeVersion(raw2) {
3554
3568
  const v = String(raw2).trim();
@@ -4138,6 +4152,8 @@ async function quoteSwapPreview(api, swap, owner) {
4138
4152
  return {
4139
4153
  receive: formatUnits(final, assetDecimals(destToken)),
4140
4154
  receiveRaw: final.toString(),
4155
+ zeroDeltaFeeCentibips: quote.zeroDeltaFeeCentibips,
4156
+ zeroDeltaFeeNative: quote.zeroDeltaFeeNative,
4141
4157
  fromAmount: v.amountIn,
4142
4158
  fromToken: sourceToken.symbol,
4143
4159
  toToken: destToken.symbol,
@@ -5052,6 +5068,7 @@ function useFlow(args) {
5052
5068
  if (busyRef.current) return;
5053
5069
  setFieldError(null);
5054
5070
  if (!enabled || !wallet.account) {
5071
+ reqId.current++;
5055
5072
  setStatus("idle");
5056
5073
  setPlan(null);
5057
5074
  return;
@@ -5645,6 +5662,8 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
5645
5662
  .sg-pk-body{display:flex;flex-direction:column;gap:8px}
5646
5663
  .sg-pk-selected{display:flex;flex-direction:column;gap:8px;margin-bottom:8px}
5647
5664
  .sg-pk-cap{margin:0;font-size:12px;line-height:1.2;color:var(--sg-text-muted)}
5665
+ .sg-pk-cap--section{margin-top:8px}
5666
+ .sg-pk-bal-missing{flex:0 0 auto;font-size:13px;line-height:1.4;color:var(--sg-text-muted);text-align:right}
5648
5667
  .sg-pk-list{display:flex;flex-direction:column;gap:4px;max-height:320px;overflow-y:auto;margin:-1px;padding:1px;scrollbar-width:thin}
5649
5668
  .sg-pk-row{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;padding:16px;border:none;border-radius:24px;background:color-mix(in srgb,var(--sg-accent) 4%,transparent);color:var(--sg-text);font:inherit;text-align:left;cursor:pointer;transition:background 120ms ease}
5650
5669
  .sg-pk-row:hover{background:color-mix(in srgb,var(--sg-accent) 8%,transparent)}
@@ -6440,6 +6459,12 @@ var SOURCE_CHAIN_LABELS = {
6440
6459
  98866: "Plume"
6441
6460
  };
6442
6461
  var CHAIN_LABELS = { ...CHAIN_DISPLAY_NAMES, ...SOURCE_CHAIN_LABELS };
6462
+ function chainLabel(chainId, chain2) {
6463
+ const pinned = SOURCE_CHAIN_LABELS[chainId];
6464
+ if (pinned) return pinned;
6465
+ const fromRegistry = typeof chain2?.displayName === "string" ? chain2.displayName.trim() : "";
6466
+ return fromRegistry || CHAIN_DISPLAY_NAMES[chainId] || `Chain ${chainId}`;
6467
+ }
6443
6468
  var SUPPORTED_CHAINS = [1, 10, 42161, 8453, 57073, 130, 9745, 146, 98866];
6444
6469
  var SUPPORTED_ASSETS2 = [
6445
6470
  ...EXECUTABLE_STABLE_ASSETS,
@@ -6975,7 +7000,7 @@ function TokenTile(props) {
6975
7000
  /* @__PURE__ */ jsxRuntime.jsx(TokenGlyph, { symbol: props.pick.symbol, logoUrl: props.token?.logoUrl, chainId: props.pick.chainId, size: "tile" }),
6976
7001
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-tile-text", children: [
6977
7002
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-sym", children: shown }),
6978
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-chain", children: CHAIN_LABELS[props.pick.chainId] || `Chain ${props.pick.chainId}` })
7003
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-chain", children: props.chainName || CHAIN_LABELS[props.pick.chainId] || `Chain ${props.pick.chainId}` })
6979
7004
  ] })
6980
7005
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6981
7006
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tok", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tok-fb", children: "?" }) }),
@@ -7054,7 +7079,9 @@ function TickBadge() {
7054
7079
  ] }) });
7055
7080
  }
7056
7081
  function BalanceColumn(props) {
7057
- if (props.amount == null) return null;
7082
+ if (props.amount == null) {
7083
+ return props.walletMissing ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-bal-missing", "data-testid": "balance-wallet-missing", children: "Wallet not connected" }) : null;
7084
+ }
7058
7085
  if (props.amount === 0) return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-bal-zero", children: "0.00" });
7059
7086
  return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-pk-bal", children: [
7060
7087
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-bal-usd sg-mono", children: props.usd == null ? "\u2014" : formatBalanceUsd(props.usd) }),
@@ -7107,7 +7134,7 @@ function TokenSelect(props) {
7107
7134
  const listRef = react.useRef(null);
7108
7135
  const savedScroll = react.useRef(0);
7109
7136
  const chainById2 = react.useMemo(() => new Map(props.chains.map((c) => [Number(c.chainId), c])), [props.chains]);
7110
- const chainName3 = (chainId) => CHAIN_LABELS[chainId] || chainById2.get(chainId)?.displayName || chainById2.get(chainId)?.name || `Chain ${chainId}`;
7137
+ const chainName3 = (chainId) => chainLabel(chainId, chainById2.get(chainId));
7111
7138
  const showBalances = side === "from" && !!props.balances && Object.keys(props.balances).length > 0;
7112
7139
  const [prices, setPrices] = react.useState({});
7113
7140
  const symbolKey2 = react.useMemo(() => [...new Set(props.tokens.map((t) => String(t.symbol).toUpperCase()))].sort().join(","), [props.tokens]);
@@ -7153,6 +7180,15 @@ function TokenSelect(props) {
7153
7180
  }, [props.tokens, props.balances, props.optionStates, showBalances, prices]);
7154
7181
  const chainTerms = react.useMemo(() => buildChainSearchTerms(props.chains), [props.chains]);
7155
7182
  const visible = react.useMemo(() => searchGroups(groups, query, chainTerms, prices), [groups, query, chainTerms, prices]);
7183
+ const { listed, other } = react.useMemo(() => {
7184
+ const held = [];
7185
+ const none = [];
7186
+ for (const g of visible) {
7187
+ const readZero = showBalances && !g.unavailable && g.deployments.length > 0 && g.deployments.every((d) => d.balance === 0);
7188
+ (readZero ? none : held).push(g);
7189
+ }
7190
+ return { listed: held, other: none };
7191
+ }, [visible, showBalances]);
7156
7192
  const openGroup = openKey ? visible.find((g) => g.key === openKey) ?? null : null;
7157
7193
  react.useEffect(() => {
7158
7194
  if (openKey && !openGroup) setOpenKey(null);
@@ -7209,7 +7245,7 @@ function TokenSelect(props) {
7209
7245
  d.hint ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-note", "data-testid": "lane-limit", children: d.hint }) : null
7210
7246
  ] })
7211
7247
  ] }),
7212
- showBalances ? /* @__PURE__ */ jsxRuntime.jsx(BalanceColumn, { amount: d.balance, usd: usdOf(d.balance, prices, d.token.symbol), symbol: ticker }) : null
7248
+ showBalances ? /* @__PURE__ */ jsxRuntime.jsx(BalanceColumn, { amount: d.balance, usd: usdOf(d.balance, prices, d.token.symbol), symbol: ticker, walletMissing: props.walletMissing?.(d.token) }) : null
7213
7249
  ] }, d.key);
7214
7250
  }) })
7215
7251
  ] });
@@ -7248,52 +7284,58 @@ function TokenSelect(props) {
7248
7284
  ) : null
7249
7285
  ] })
7250
7286
  ] }) : null,
7251
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-pk-cap", children: side === "from" ? "Your tokens \xB7 All networks" : "Popular tokens \xB7 All networks" }),
7252
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-pk-list", ref: listRef, role: "group", "aria-label": props.title, children: visible.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-pk-empty", children: props.loading ? "Loading the token list\u2026" : "No tokens found." }) : visible.map((g) => {
7253
- const members = g.deployments;
7254
- const multi = members.length > 1;
7255
- const single = members[0];
7256
- const label2 = multi ? g.symbol : tokenTicker(single.token);
7257
- const blocked = !!g.unavailable;
7258
- const opensNetworks = multi || blocked;
7259
- const zero = showBalances && g.amount === 0 || blocked;
7260
- return /* @__PURE__ */ jsxRuntime.jsxs(
7261
- "button",
7262
- {
7263
- type: "button",
7264
- className: "sg-pk-row",
7265
- "data-testid": "token-row",
7266
- "data-symbol": g.symbol,
7267
- "data-networks": members.length,
7268
- "data-zero": zero || void 0,
7269
- "data-unavailable": blocked || void 0,
7270
- onClick: () => {
7271
- if (opensNetworks) {
7272
- savedScroll.current = listRef.current?.scrollTop ?? 0;
7273
- setOpenKey(g.key);
7274
- } else pick(single.token);
7275
- },
7276
- children: [
7277
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-pk-left", children: [
7278
- /* @__PURE__ */ jsxRuntime.jsx(TokenPlate, { symbol: g.symbol, logoUrl: g.logoUrl }),
7279
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-pk-text", children: [
7280
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-label", children: label2 }),
7281
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-pk-line", children: [
7282
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-sub", children: multi ? showBalances ? "Total across" : "Available on" : `On ${chainName3(Number(single.token.chainId))}` }),
7283
- /* @__PURE__ */ jsxRuntime.jsx(ChainMarks, { chainIds: members.map((m) => Number(m.token.chainId)), chainById: chainById2, decorative: !multi }),
7284
- opensNetworks && showBalances ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-chev sg-pk-chev--sm", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(ChevronGlyph, {}) }) : null
7285
- ] }),
7286
- !multi && single.hint ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-note", "data-testid": "lane-limit", children: single.hint }) : null
7287
- ] })
7288
- ] }),
7289
- showBalances ? /* @__PURE__ */ jsxRuntime.jsx(BalanceColumn, { amount: g.amount, usd: g.usd, symbol: label2 }) : opensNetworks ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-chev", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(ChevronGlyph, {}) }) : null
7290
- ]
7291
- },
7292
- g.key
7293
- );
7294
- }) })
7287
+ listed.length > 0 || visible.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-pk-cap", children: side === "from" ? "Your tokens \xB7 All networks" : "Popular tokens \xB7 All networks" }) : null,
7288
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-pk-list", ref: listRef, role: "group", "aria-label": props.title, children: visible.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-pk-empty", children: props.loading ? "Loading the token list\u2026" : "No tokens found." }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7289
+ listed.map((g) => renderRow(g, false)),
7290
+ other.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-pk-cap sg-pk-cap--section", "data-testid": "other-tokens-cap", children: "Other supported tokens" }) : null,
7291
+ other.map((g) => renderRow(g, true))
7292
+ ] }) })
7295
7293
  ] })
7296
7294
  ] });
7295
+ function renderRow(g, discovery) {
7296
+ const members = g.deployments;
7297
+ const multi = members.length > 1;
7298
+ const single = members[0];
7299
+ const label2 = multi ? g.symbol : tokenTicker(single.token);
7300
+ const blocked = !!g.unavailable;
7301
+ const opensNetworks = multi || blocked;
7302
+ const zero = showBalances && g.amount === 0 || blocked;
7303
+ return /* @__PURE__ */ jsxRuntime.jsxs(
7304
+ "button",
7305
+ {
7306
+ type: "button",
7307
+ className: "sg-pk-row",
7308
+ "data-testid": "token-row",
7309
+ "data-symbol": g.symbol,
7310
+ "data-networks": members.length,
7311
+ "data-zero": zero || void 0,
7312
+ "data-discovery": discovery || void 0,
7313
+ "data-unavailable": blocked || void 0,
7314
+ onClick: () => {
7315
+ if (opensNetworks) {
7316
+ savedScroll.current = listRef.current?.scrollTop ?? 0;
7317
+ setOpenKey(g.key);
7318
+ } else pick(single.token);
7319
+ },
7320
+ children: [
7321
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-pk-left", children: [
7322
+ /* @__PURE__ */ jsxRuntime.jsx(TokenPlate, { symbol: g.symbol, logoUrl: g.logoUrl }),
7323
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-pk-text", children: [
7324
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-label", children: label2 }),
7325
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-pk-line", children: [
7326
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-sub", children: discovery ? "Available on" : multi ? showBalances ? "Total across" : "Available on" : `On ${chainName3(Number(single.token.chainId))}` }),
7327
+ /* @__PURE__ */ jsxRuntime.jsx(ChainMarks, { chainIds: members.map((m) => Number(m.token.chainId)), chainById: chainById2, decorative: !multi && !discovery }),
7328
+ opensNetworks && showBalances ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-chev sg-pk-chev--sm", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(ChevronGlyph, {}) }) : null
7329
+ ] }),
7330
+ !multi && single.hint ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-note", "data-testid": "lane-limit", children: single.hint }) : null
7331
+ ] })
7332
+ ] }),
7333
+ showBalances ? /* @__PURE__ */ jsxRuntime.jsx(BalanceColumn, { amount: g.amount, usd: g.usd, symbol: label2, walletMissing: !multi && props.walletMissing?.(single.token) }) : opensNetworks ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-chev", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(ChevronGlyph, {}) }) : null
7334
+ ]
7335
+ },
7336
+ g.key
7337
+ );
7338
+ }
7297
7339
  }
7298
7340
  function ChevronRight({ size = 16 }) {
7299
7341
  return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: size, height: size, viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6 4l4 4-4 4", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }) });
@@ -7370,7 +7412,7 @@ function durationLabel(seconds) {
7370
7412
  }
7371
7413
  function TokenButton(props) {
7372
7414
  const shown = props.token ? tokenTicker(props.token) : props.symbol ?? "";
7373
- const chain2 = props.chainId ? CHAIN_LABELS[props.chainId] || `Chain ${props.chainId}` : "";
7415
+ const chain2 = props.chainId ? props.chainName || CHAIN_LABELS[props.chainId] || `Chain ${props.chainId}` : "";
7374
7416
  return /* @__PURE__ */ jsxRuntime.jsxs(
7375
7417
  "button",
7376
7418
  {
@@ -7835,7 +7877,7 @@ function CheckGlyph() {
7835
7877
  function HistoryButton(props) {
7836
7878
  return /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", ref: props.btnRef, className: "sg-hist", disabled: props.disabled, onClick: props.onClick, "aria-label": "Transaction history", title: "Transaction history", children: /* @__PURE__ */ jsxRuntime.jsx(HistoryGlyph, {}) });
7837
7879
  }
7838
- function chainLabel(entry) {
7880
+ function chainLabel2(entry) {
7839
7881
  return entry.chainId != null && CHAIN_LABELS[entry.chainId] || entry.chainName || (entry.chainId != null ? `Chain ${entry.chainId}` : "Unknown chain");
7840
7882
  }
7841
7883
  function chainName(chainId, fallback) {
@@ -7968,7 +8010,7 @@ function TxHistoryList(props) {
7968
8010
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-when", children: [
7969
8011
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-what", children: [
7970
8012
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: e.kind === "payment" ? "Payment" : "Swap" }),
7971
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: chainLabel(e) }),
8013
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: chainLabel2(e) }),
7972
8014
  (e.legs?.length ?? 1) > 1 ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: ordersLabel(e.legs.length) }) : null
7973
8015
  ] }),
7974
8016
  whenLabel(e.at) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-time", children: whenLabel(e.at) }) : null
@@ -8025,7 +8067,7 @@ function TxDetail(props) {
8025
8067
  ] }),
8026
8068
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
8027
8069
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Signed on" }),
8028
- /* @__PURE__ */ jsxRuntime.jsx("b", { children: chainLabel(e) })
8070
+ /* @__PURE__ */ jsxRuntime.jsx("b", { children: chainLabel2(e) })
8029
8071
  ] }),
8030
8072
  e.recipient ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
8031
8073
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Recipient" }),
@@ -10681,6 +10723,86 @@ function QuoteSheet(props) {
10681
10723
  ] })
10682
10724
  ] });
10683
10725
  }
10726
+
10727
+ // src/react/ui/cost.ts
10728
+ function tenPow(d) {
10729
+ let x = 1n;
10730
+ for (let i = 0; i < d; i++) x *= 10n;
10731
+ return x;
10732
+ }
10733
+ function divRoundNearest(n, d) {
10734
+ if (d === 0n) return 0n;
10735
+ const sign2 = n < 0n !== d < 0n ? -1n : 1n;
10736
+ const an = n < 0n ? -n : n;
10737
+ const ad = d < 0n ? -d : d;
10738
+ let q = an / ad;
10739
+ const r = an - q * ad;
10740
+ if (r * 2n >= ad) q += 1n;
10741
+ return sign2 * q;
10742
+ }
10743
+ function parSpreadBps(fromAmountRaw, fromDecimals, toAmountRaw, toDecimals) {
10744
+ try {
10745
+ const from = BigInt(fromAmountRaw);
10746
+ const to = BigInt(toAmountRaw);
10747
+ if (from <= 0n) return null;
10748
+ const pFrom = tenPow(fromDecimals);
10749
+ const pTo = tenPow(toDecimals);
10750
+ const den = from * pTo;
10751
+ if (den === 0n) return null;
10752
+ return Number(divRoundNearest((den - to * pFrom) * 100000n, den)) / 10;
10753
+ } catch {
10754
+ return null;
10755
+ }
10756
+ }
10757
+ function totalCostBps(fromUsd, toUsd) {
10758
+ if (fromUsd == null || toUsd == null) return null;
10759
+ if (!Number.isFinite(fromUsd) || !Number.isFinite(toUsd) || fromUsd <= 0) return null;
10760
+ return (fromUsd - toUsd) / fromUsd * 1e4;
10761
+ }
10762
+ function costBasisFor(fromSymbol, toSymbol) {
10763
+ return assetClassOf(fromSymbol) === "stable" && assetClassOf(toSymbol) === "stable" ? "tokens" : "value";
10764
+ }
10765
+ function quoteCostBps(input) {
10766
+ if (!input.fromSymbol || !input.toSymbol) return null;
10767
+ if (costBasisFor(input.fromSymbol, input.toSymbol) === "value") {
10768
+ const usd2 = (amount, price) => price === void 0 || !amount ? null : Number(amount) * price;
10769
+ return totalCostBps(usd2(input.send, input.fromPrice), usd2(input.receive, input.toPrice));
10770
+ }
10771
+ try {
10772
+ if (!input.send || !input.receive) return null;
10773
+ return parSpreadBps(parseUnitsDecimal(input.send, 18).toString(), 18, parseUnitsDecimal(input.receive, 18).toString(), 18);
10774
+ } catch {
10775
+ return null;
10776
+ }
10777
+ }
10778
+ function statedCentibips(fee) {
10779
+ const c = fee?.zeroDeltaFeeCentibips;
10780
+ return typeof c === "number" && Number.isSafeInteger(c) && c >= 0 ? c : null;
10781
+ }
10782
+ function centibipsPct(centibips) {
10783
+ if (centibips === 0) return "0%";
10784
+ const whole = Math.floor(centibips / 1e4);
10785
+ const frac = String(centibips % 1e4).padStart(4, "0").replace(/0+$/, "").padEnd(2, "0");
10786
+ return `${whole}.${frac}%`;
10787
+ }
10788
+ function zeroDeltaFeeLabel(fee, native) {
10789
+ const centibips = statedCentibips(fee);
10790
+ if (centibips === null) return "--";
10791
+ const pct = centibipsPct(centibips);
10792
+ const raw2 = fee?.zeroDeltaFeeNative;
10793
+ if (typeof raw2 !== "string" || !/^\d+$/.test(raw2) || BigInt(raw2) === 0n) return pct;
10794
+ return `${pct} + ${formatUnits(raw2, native.decimals, 8)} ${native.symbol}`;
10795
+ }
10796
+ function formatCostBps(bps) {
10797
+ const rounded = Number(bps.toFixed(1));
10798
+ const sign2 = rounded < 0 ? "\u2212" : "+";
10799
+ return `${sign2}${Math.abs(rounded).toFixed(1)} bps`;
10800
+ }
10801
+ function rateImpactLabel(totalBps, fee) {
10802
+ if (totalBps === null) return "--";
10803
+ const centibips = statedCentibips(fee);
10804
+ return formatCostBps(totalBps - (centibips === null ? 0 : centibips / 100));
10805
+ }
10684
10806
  var FIAT = [
10685
10807
  { code: "USD", glyph: "$", label: "US Dollar" },
10686
10808
  { code: "EUR", glyph: "\u20AC", label: "Euro" },
@@ -10748,6 +10870,8 @@ function ExchangeCard(props) {
10748
10870
  const order = new Map(SUPPORTED_CHAINS.map((id, i) => [id, i]));
10749
10871
  return [...catalogue?.chains ?? []].sort((a, b) => (order.get(Number(a.chainId)) ?? 99) - (order.get(Number(b.chainId)) ?? 99) || Number(a.chainId) - Number(b.chainId));
10750
10872
  }, [catalogue]);
10873
+ const chainRow = react.useMemo(() => new Map(chains.map((c) => [Number(c.chainId), c])), [chains]);
10874
+ const nameOf = (id) => id ? chainLabel(id, chainRow.get(id)) : void 0;
10751
10875
  const tokens = react.useMemo(() => catalogue?.tokens ?? [], [catalogue]);
10752
10876
  const sourceTokens = react.useMemo(() => catalogue?.sources ?? [], [catalogue]);
10753
10877
  const [view, setView] = react.useState("main");
@@ -11038,6 +11162,13 @@ function ExchangeCard(props) {
11038
11162
  const complianceHasQuote = solActive ? Boolean(solFlow.plan && solFlow.status !== "quoting") : Boolean(selected && flow.status !== "loading");
11039
11163
  const fromUsd = usdOf2(normalizedAmount, prices[from?.symbol ?? ""]);
11040
11164
  const toUsd = usdOf2(receive, prices[to?.symbol ?? ""]);
11165
+ const statedFee = solActive ? solFlow.preview : addressed ? selected?.quote : preview.data;
11166
+ const feeNative = solActive ? { symbol: "SOL", decimals: 9 } : { symbol: nativeSymbol(from?.chainId ?? 1, chains), decimals: 18 };
11167
+ const feeLabel = hasQuote ? zeroDeltaFeeLabel(statedFee, feeNative) : "--";
11168
+ const rateImpact = hasQuote ? rateImpactLabel(
11169
+ quoteCostBps({ send: normalizedAmount, receive, fromSymbol: from?.symbol, toSymbol: to?.symbol, fromPrice: prices[from?.symbol ?? ""], toPrice: prices[to?.symbol ?? ""] }),
11170
+ statedFee
11171
+ ) : "--";
11041
11172
  const flippable = !rampMode && !submitting && Boolean(to && sourceTokens.some((t) => Number(t.chainId) === to.chainId && symbolKey(t.symbol) === to.symbol));
11042
11173
  const flip = () => {
11043
11174
  if (!flippable) return;
@@ -11128,7 +11259,8 @@ function ExchangeCard(props) {
11128
11259
  { label: "You send", value: `${normalizedAmount} ${fromTicker}` },
11129
11260
  { label: "You receive", value: `${receive} ${toTicker}` },
11130
11261
  ...rate ? [{ label: "Rate", value: `1 ${fromTicker} = ${rate} ${toTicker}` }] : [],
11131
- { label: "Fee", value: `${meta?.feeBps ?? 0} bps` },
11262
+ { label: "Rate impact", value: rateImpact },
11263
+ { label: "Fee", value: feeLabel },
11132
11264
  { label: "Network fee", value: networkFee },
11133
11265
  ...eta ? [{ label: "Estimated time", value: eta }] : []
11134
11266
  ],
@@ -11185,6 +11317,7 @@ function ExchangeCard(props) {
11185
11317
  balances,
11186
11318
  optionStates: isFrom ? void 0 : destinationStates,
11187
11319
  loading: !catalogue?.ready,
11320
+ walletMissing: (t) => isSolanaChainId(t.chainId) && !solanaWallet.address,
11188
11321
  onBack: () => closeSelector(isFrom),
11189
11322
  onPick: (pick) => {
11190
11323
  (isFrom ? setFrom : setTo)({ chainId: pick.chainId, symbol: symbolKey(pick.symbol) });
@@ -11237,8 +11370,8 @@ function ExchangeCard(props) {
11237
11370
  ] })
11238
11371
  ] });
11239
11372
  } else {
11240
- const payToken = mode === "onramp" ? /* @__PURE__ */ jsxRuntime.jsx(FiatButton, { fiat, onCurrency: setFiatCurrency, disabled: submitting }) : /* @__PURE__ */ jsxRuntime.jsx(TokenButton, { label: "You pay", symbol: from?.symbol ?? null, chainId: from?.chainId ?? null, token: fromToken, disabled: submitting, btnRef: fromTileRef, onClick: () => setView("from") });
11241
- const receiveToken = mode === "offramp" ? /* @__PURE__ */ jsxRuntime.jsx(FiatButton, { fiat, onCurrency: setFiatCurrency, disabled: submitting }) : /* @__PURE__ */ jsxRuntime.jsx(TokenButton, { label: "You receive", symbol: to?.symbol ?? null, chainId: to?.chainId ?? null, token: toToken, disabled: submitting, btnRef: toTileRef, onClick: () => setView("to") });
11373
+ const payToken = mode === "onramp" ? /* @__PURE__ */ jsxRuntime.jsx(FiatButton, { fiat, onCurrency: setFiatCurrency, disabled: submitting }) : /* @__PURE__ */ jsxRuntime.jsx(TokenButton, { label: "You pay", symbol: from?.symbol ?? null, chainId: from?.chainId ?? null, chainName: nameOf(from?.chainId), token: fromToken, disabled: submitting, btnRef: fromTileRef, onClick: () => setView("from") });
11374
+ const receiveToken = mode === "offramp" ? /* @__PURE__ */ jsxRuntime.jsx(FiatButton, { fiat, onCurrency: setFiatCurrency, disabled: submitting }) : /* @__PURE__ */ jsxRuntime.jsx(TokenButton, { label: "You receive", symbol: to?.symbol ?? null, chainId: to?.chainId ?? null, chainName: nameOf(to?.chainId), token: toToken, disabled: submitting, btnRef: toTileRef, onClick: () => setView("to") });
11242
11375
  const cta = solActive ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
11243
11376
  solanaSteps,
11244
11377
  solanaCta,
@@ -11259,9 +11392,9 @@ function ExchangeCard(props) {
11259
11392
  body = wide ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11260
11393
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-stack", children: [
11261
11394
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-ft", children: [
11262
- mode === "onramp" ? /* @__PURE__ */ jsxRuntime.jsx(FiatTile, { label: "From", currency: fiatCurrency, onCurrency: setFiatCurrency }) : /* @__PURE__ */ jsxRuntime.jsx(TokenTile, { label: "From", pick: from, token: fromToken, disabled: submitting, btnRef: fromTileRef, onClick: () => setView("from") }),
11395
+ mode === "onramp" ? /* @__PURE__ */ jsxRuntime.jsx(FiatTile, { label: "From", currency: fiatCurrency, onCurrency: setFiatCurrency }) : /* @__PURE__ */ jsxRuntime.jsx(TokenTile, { label: "From", pick: from, chainName: nameOf(from?.chainId), token: fromToken, disabled: submitting, btnRef: fromTileRef, onClick: () => setView("from") }),
11263
11396
  /* @__PURE__ */ jsxRuntime.jsx(FlipButton, { small: true, onClick: flip, disabled: !flippable }),
11264
- mode === "offramp" ? /* @__PURE__ */ jsxRuntime.jsx(FiatTile, { label: "To", currency: fiatCurrency, onCurrency: setFiatCurrency }) : /* @__PURE__ */ jsxRuntime.jsx(TokenTile, { label: "To", pick: to, token: toToken, disabled: submitting, btnRef: toTileRef, onClick: () => setView("to") })
11397
+ mode === "offramp" ? /* @__PURE__ */ jsxRuntime.jsx(FiatTile, { label: "To", currency: fiatCurrency, onCurrency: setFiatCurrency }) : /* @__PURE__ */ jsxRuntime.jsx(TokenTile, { label: "To", pick: to, chainName: nameOf(to?.chainId), token: toToken, disabled: submitting, btnRef: toTileRef, onClick: () => setView("to") })
11265
11398
  ] }),
11266
11399
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-pane", "data-kind": "send", children: [
11267
11400
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-pane-top", children: [
@@ -11360,7 +11493,7 @@ function ExchangeCard(props) {
11360
11493
  ] }),
11361
11494
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-recv-sub", children: [
11362
11495
  "On ",
11363
- CHAIN_LABELS[to?.chainId ?? 0] || `Chain ${to?.chainId}`
11496
+ nameOf(to?.chainId) ?? `Chain ${to?.chainId}`
11364
11497
  ] })
11365
11498
  ] }),
11366
11499
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-stack", children: [
package/dist/mount.d.cts CHANGED
@@ -1,3 +1,3 @@
1
- export { M as MountConfig, t as mount } from './mount-DRCSjQp0.cjs';
1
+ export { M as MountConfig, t as mount } from './mount-BSXfSSP2.cjs';
2
2
  import 'react';
3
- import './verify-CoPaE02j.cjs';
3
+ import './verify-BBREdvIM.cjs';
package/dist/mount.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { M as MountConfig, t as mount } from './mount-CMsgFE6g.js';
1
+ export { M as MountConfig, t as mount } from './mount-BdxMZC70.js';
2
2
  import 'react';
3
- import './verify-CoPaE02j.js';
3
+ import './verify-BBREdvIM.js';
package/dist/mount.js CHANGED
@@ -1,2 +1,2 @@
1
- export { mount } from './chunk-3U5Z5CC3.js';
2
- import './chunk-GWQKWJJA.js';
1
+ export { mount } from './chunk-7V3XP5D6.js';
2
+ import './chunk-7FBWRHP2.js';