@glacislabs/stablegenie-zerodelta 4.0.0 → 4.1.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/index.cjs CHANGED
@@ -600,7 +600,7 @@ function buildCatalogue(input) {
600
600
  );
601
601
  const byId = new Map(enabledChains.map((c) => [Number(c.chainId), c]));
602
602
  for (const id of chainIds) if (!byId.has(id)) byId.set(id, { chainId: id, isEnabled: true });
603
- return { ...ctx, product, tokens: catalogue, sources, chainIds, chains: [...byId.values()], ready };
603
+ return { ...ctx, product, tokens: catalogue, sources, chainIds, chains: [...byId.values()], ready, vaultIcons: input.vaultIcons ?? /* @__PURE__ */ new Map() };
604
604
  }
605
605
 
606
606
  // src/core/options.ts
@@ -725,10 +725,10 @@ function nativeFeeShortLabel(check, symbol) {
725
725
  if (!check.short) return null;
726
726
  return `Need ${formatNative(check.required)} ${symbol} for the bridge fee`;
727
727
  }
728
- function nativeFeeShortMessage(check, symbol, chainName2) {
728
+ function nativeFeeShortMessage(check, symbol, chainName3) {
729
729
  const need = formatNative(check.required);
730
730
  const have = formatNative(check.balance ?? 0n);
731
- const where = chainName2 ? ` on ${chainName2}` : "";
731
+ const where = chainName3 ? ` on ${chainName3}` : "";
732
732
  return `This route bridges via LayerZero, which charges a ${need} ${symbol} network fee paid as part of the transaction. Your wallet holds ${have} ${symbol}${where}. Add ${symbol}${where} and try again \u2014 gas is owed on top of this fee.`;
733
733
  }
734
734
 
@@ -762,6 +762,34 @@ function brokenLaneReason(lane) {
762
762
  }
763
763
  }
764
764
 
765
+ // src/core/rwa-icons.ts
766
+ var GATEWAY_ICON_PREFIX = "/api/v1/rwa/icons/";
767
+ var ICON_FILE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}\.(?:png|jpg|jpeg|webp|gif)$/;
768
+ function resolveVaultIcon(apiBase, iconPath) {
769
+ if (typeof iconPath !== "string" || !iconPath.startsWith(GATEWAY_ICON_PREFIX)) return void 0;
770
+ const file = iconPath.slice(GATEWAY_ICON_PREFIX.length);
771
+ if (!ICON_FILE.test(file)) return void 0;
772
+ return `${apiBase.replace(/\/$/, "")}/rwa/icons/${file}`;
773
+ }
774
+ function vaultIconsBySymbol(apiBase, vaults) {
775
+ const out = /* @__PURE__ */ new Map();
776
+ for (const vault of vaults) {
777
+ const key = symbolKey(vault?.symbol);
778
+ if (!key || out.has(key)) continue;
779
+ const url = resolveVaultIcon(apiBase, vault?.iconMiniUrl) ?? resolveVaultIcon(apiBase, vault?.iconUrl);
780
+ if (url) out.set(key, url);
781
+ }
782
+ return out;
783
+ }
784
+ function withVaultArtwork(tokens, icons) {
785
+ if (!icons.size) return tokens;
786
+ return tokens.map((token) => {
787
+ if (token.logoUrl) return token;
788
+ const url = icons.get(symbolKey(token.symbol));
789
+ return url ? { ...token, logoUrl: url } : token;
790
+ });
791
+ }
792
+
765
793
  // src/core/compliance.ts
766
794
  var COMPLIANCE_DENY_LABEL = "Compliance check failed";
767
795
  function complianceView(compliance, hasQuote = true) {
@@ -1330,7 +1358,63 @@ function routeLabelFor(option, destinationToken, result) {
1330
1358
  const bridge = result.quote.bridge ? ` via ${result.quote.bridge}` : "";
1331
1359
  return `Swap ${option.symbol} to ${destinationToken.symbol} and settle on ZeroDelta${bridge}.`;
1332
1360
  }
1333
- async function buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote, solve = solveExactOut, amountInRaw, compliance }) {
1361
+ function tokenAt(tokens, chainId, address) {
1362
+ const wanted = normalizeAddress(address);
1363
+ if (!wanted || !tokens?.length) return void 0;
1364
+ return tokens.find((t) => Number(t.chainId) === Number(chainId) && normalizeAddress(t.address) === wanted);
1365
+ }
1366
+ function legAmount(raw, decimals) {
1367
+ if (decimals === void 0) return "";
1368
+ try {
1369
+ return formatUnits(raw || "0", decimals);
1370
+ } catch {
1371
+ return "";
1372
+ }
1373
+ }
1374
+ function buildLegs(orders, ctx) {
1375
+ const legs = [];
1376
+ let fromChainId = ctx.option.chainId;
1377
+ let fromAsset = ctx.option.symbol;
1378
+ let fromDecimals = ctx.option.decimals;
1379
+ for (let index = 0; index < orders.length; index += 1) {
1380
+ const order = orders[index];
1381
+ const isLast = index === orders.length - 1;
1382
+ const toChainId = Number(order.destinationChainId);
1383
+ const askToken = isLast ? ctx.destinationToken : tokenAt(ctx.tokens, toChainId, order.askToken);
1384
+ const toAsset = isLast ? ctx.destinationToken.symbol : askToken?.symbol ?? "";
1385
+ const toDecimals = askToken ? assetDecimals(askToken) : void 0;
1386
+ const executionChainId = Number(order.executionChainId);
1387
+ legs.push({
1388
+ index: index + 1,
1389
+ fromAsset,
1390
+ fromChainId,
1391
+ fromChainName: chainNameOf(fromChainId, ctx.chains),
1392
+ fromAmount: legAmount(order.bidTokenAmount, fromDecimals),
1393
+ toAsset,
1394
+ toChainId,
1395
+ toChainName: chainNameOf(toChainId, ctx.chains),
1396
+ toAmount: legAmount(order.askTokenAmount, toDecimals),
1397
+ executionChainId,
1398
+ executionChainName: chainNameOf(executionChainId, ctx.chains)
1399
+ });
1400
+ fromChainId = toChainId;
1401
+ fromAsset = toAsset;
1402
+ fromDecimals = toDecimals;
1403
+ }
1404
+ return legs;
1405
+ }
1406
+ async function buildRoute({
1407
+ option,
1408
+ destination,
1409
+ destinationToken,
1410
+ chains,
1411
+ tokens,
1412
+ payer,
1413
+ fetchQuote,
1414
+ solve = solveExactOut,
1415
+ amountInRaw,
1416
+ compliance
1417
+ }) {
1334
1418
  const result = await solve({ option, destination, destinationToken, payer, fetchQuote, amountInRaw });
1335
1419
  const quote = result.quote;
1336
1420
  const destDecimals = assetDecimals(destinationToken);
@@ -1360,6 +1444,23 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
1360
1444
  },
1361
1445
  routeLabel: routeLabelFor(option, destinationToken, result),
1362
1446
  deltaLabel: routeDeltaLabel(result, quote),
1447
+ // A direct transfer submits no order at all, but it is still ONE hop and history renders the
1448
+ // same shape for it — an empty `legs` would leave "one order or two?" unanswerable for it alone.
1449
+ legs: [
1450
+ {
1451
+ index: 1,
1452
+ fromAsset: option.symbol,
1453
+ fromChainId: option.chainId,
1454
+ fromChainName: option.chainName,
1455
+ fromAmount: sourceAmount,
1456
+ toAsset: destinationToken.symbol,
1457
+ toChainId: Number(destination.chainId),
1458
+ toChainName: chainNameOf(Number(destination.chainId), chains),
1459
+ toAmount: receiveAmount,
1460
+ executionChainId: option.chainId,
1461
+ executionChainName: option.chainName
1462
+ }
1463
+ ],
1363
1464
  transactions: [
1364
1465
  {
1365
1466
  id: "transfer",
@@ -1433,6 +1534,7 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
1433
1534
  },
1434
1535
  routeLabel: routeLabelFor(option, destinationToken, result),
1435
1536
  deltaLabel: routeDeltaLabel(result, quote),
1537
+ legs: buildLegs(orders, { option, destinationToken, chains, tokens }),
1436
1538
  transactions: [
1437
1539
  {
1438
1540
  id: "approve",
@@ -1540,7 +1642,8 @@ function createApiClient(cfg) {
1540
1642
  chains: null,
1541
1643
  tokens: null,
1542
1644
  routes: null,
1543
- health: null
1645
+ health: null,
1646
+ vaults: null
1544
1647
  };
1545
1648
  const screenCache = /* @__PURE__ */ new Map();
1546
1649
  const screenInflight = /* @__PURE__ */ new Map();
@@ -1624,6 +1727,19 @@ function createApiClient(cfg) {
1624
1727
  cache.health = { at: Date.now(), value };
1625
1728
  return value;
1626
1729
  }
1730
+ async function fetchRwaVaults() {
1731
+ if (nowFresh(cache.vaults)) return cache.vaults.value;
1732
+ let value = [];
1733
+ try {
1734
+ const payload = await apiRequest("/rwa/vaults?status=active,coming_soon", { timeoutMs: 8e3 });
1735
+ const rows = Array.isArray(payload) ? payload : payload?.vaults;
1736
+ value = Array.isArray(rows) ? rows.filter((v) => !!v && typeof v === "object") : [];
1737
+ } catch {
1738
+ value = [];
1739
+ }
1740
+ cache.vaults = { at: Date.now(), value };
1741
+ return value;
1742
+ }
1627
1743
  async function fetchQuote(body, retries = 1) {
1628
1744
  let lastError;
1629
1745
  for (let attempt = 0; attempt <= retries; attempt += 1) {
@@ -1663,7 +1779,7 @@ function createApiClient(cfg) {
1663
1779
  screenInflight.set(key, request);
1664
1780
  return request;
1665
1781
  }
1666
- return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchQuote, screenWallet, apiBase };
1782
+ return { apiRequest, fetchChains, fetchTokens, fetchRoutes, fetchRouteHealth, fetchRwaVaults, fetchQuote, screenWallet, apiBase };
1667
1783
  }
1668
1784
 
1669
1785
  // src/core/plan.ts
@@ -1780,7 +1896,16 @@ async function fetchPaymentPlan(api, request, payer, wallet = {}, readBalances)
1780
1896
  }
1781
1897
  const routeErrors = [];
1782
1898
  const routePromises = candidates.map(
1783
- (option) => buildRoute({ option, destination, destinationToken, chains, payer, fetchQuote: api.fetchQuote, compliance: option.direct ? directCompliance ?? void 0 : void 0 }).catch((error) => {
1899
+ (option) => buildRoute({
1900
+ option,
1901
+ destination,
1902
+ destinationToken,
1903
+ chains,
1904
+ tokens,
1905
+ payer,
1906
+ fetchQuote: api.fetchQuote,
1907
+ compliance: option.direct ? directCompliance ?? void 0 : void 0
1908
+ }).catch((error) => {
1784
1909
  routeErrors.push(error);
1785
1910
  return null;
1786
1911
  })
@@ -1893,7 +2018,7 @@ async function buildSwapPlan(api, swap, payer, wallet = {}) {
1893
2018
  direct: false
1894
2019
  };
1895
2020
  const destination = { address: receiver, chainId: v.toChainId, asset: destToken.symbol };
1896
- const route = await buildRoute({ option, destination, destinationToken: destToken, chains, payer: account, fetchQuote: api.fetchQuote, solve: solveExactIn, amountInRaw });
2021
+ const route = await buildRoute({ option, destination, destinationToken: destToken, chains, tokens, payer: account, fetchQuote: api.fetchQuote, solve: solveExactIn, amountInRaw });
1897
2022
  if (route.state === "SHORT") throw new Error("ZeroDelta could not price this swap right now.");
1898
2023
  route.recommended = true;
1899
2024
  return {
@@ -2248,6 +2373,24 @@ function resolveConfig(config = {}) {
2248
2373
  }
2249
2374
 
2250
2375
  // src/core/index.ts
2376
+ function sanitizeLegs(legs) {
2377
+ if (!Array.isArray(legs) || !legs.length) return void 0;
2378
+ const text = (v, max) => String(v ?? "").slice(0, max);
2379
+ const chain = (v) => Number(v) || 0;
2380
+ return legs.slice(0, 8).map((leg, i) => ({
2381
+ index: Number(leg?.index) || i + 1,
2382
+ fromAsset: text(leg?.fromAsset, 12),
2383
+ fromChainId: chain(leg?.fromChainId),
2384
+ fromChainName: text(leg?.fromChainName, 40),
2385
+ fromAmount: text(leg?.fromAmount, 40),
2386
+ toAsset: text(leg?.toAsset, 12),
2387
+ toChainId: chain(leg?.toChainId),
2388
+ toChainName: text(leg?.toChainName, 40),
2389
+ toAmount: text(leg?.toAmount, 40),
2390
+ executionChainId: chain(leg?.executionChainId),
2391
+ executionChainName: text(leg?.executionChainName, 40)
2392
+ }));
2393
+ }
2251
2394
  function sanitizeTxEntry(entry) {
2252
2395
  return {
2253
2396
  kind: entry.kind === "swap" ? "swap" : "payment",
@@ -2263,7 +2406,8 @@ function sanitizeTxEntry(entry) {
2263
2406
  recipient: isAddress(entry.recipient) ? normalizeAddress(entry.recipient) : "",
2264
2407
  settlement: entry.settlement === "direct" ? "direct" : "escrow",
2265
2408
  status: entry.status && ["confirmed", "unconfirmed", "error"].includes(entry.status) ? entry.status : "submitted",
2266
- at: (/* @__PURE__ */ new Date()).toISOString()
2409
+ at: (/* @__PURE__ */ new Date()).toISOString(),
2410
+ legs: sanitizeLegs(entry.legs)
2267
2411
  };
2268
2412
  }
2269
2413
  function createEngine(config = {}) {
@@ -2280,12 +2424,15 @@ function createEngine(config = {}) {
2280
2424
  fetchRouteHealth: api.fetchRouteHealth,
2281
2425
  fetchQuote: api.fetchQuote,
2282
2426
  fetchCatalogue: async (allowedAssets, product) => {
2283
- const [chains, tokens, routes, health] = await Promise.all([
2427
+ const [chains, registryTokens, routes, health, vaults] = await Promise.all([
2284
2428
  api.fetchChains().catch(() => []),
2285
2429
  api.fetchTokens().catch(() => []),
2286
2430
  api.fetchRoutes().catch(() => []),
2287
- api.fetchRouteHealth()
2431
+ api.fetchRouteHealth(),
2432
+ api.fetchRwaVaults()
2288
2433
  ]);
2434
+ const vaultIcons = vaultIconsBySymbol(api.apiBase, vaults);
2435
+ const tokens = withVaultArtwork(registryTokens, vaultIcons);
2289
2436
  const allowed = allowedAssets?.length ? new Set([...allowedAssets].map(symbolKey).filter((a) => SUPPORTED_ASSETS.has(a))) : void 0;
2290
2437
  return buildCatalogue({
2291
2438
  chains,
@@ -2294,7 +2441,8 @@ function createEngine(config = {}) {
2294
2441
  product,
2295
2442
  ...allowed ? { allowedAssets: allowed } : {},
2296
2443
  supportedChainIds: SUPPORTED_CHAIN_IDS,
2297
- brokenLanes: suppressedLanes(health)
2444
+ brokenLanes: suppressedLanes(health),
2445
+ vaultIcons
2298
2446
  });
2299
2447
  },
2300
2448
  fetchPaymentPlan: (request, payer, wallet) => fetchPaymentPlan(api, request, payer, wallet, verifier.readBalances),
@@ -2758,7 +2906,10 @@ function useFlow(args) {
2758
2906
  account,
2759
2907
  recipient,
2760
2908
  settlement: route.state === "DIRECT" ? "direct" : "escrow",
2761
- status: v.status === "confirmed" ? "confirmed" : v.status === "mismatch" || v.status === "reverted" ? "error" : "unconfirmed"
2909
+ status: v.status === "confirmed" ? "confirmed" : v.status === "mismatch" || v.status === "reverted" ? "error" : "unconfirmed",
2910
+ // One signature can be several orders. Record them, or the history of a chained RWA trade
2911
+ // reads as a single hop that skipped a chain it demonstrably went through.
2912
+ legs: route.legs
2762
2913
  });
2763
2914
  setLastTxEntry(entry.hash ? entry : null);
2764
2915
  appendTxHistory(account, entry);
@@ -2979,6 +3130,12 @@ var WIDGET_CSS = `
2979
3130
  @keyframes sg-shimmer{0%{background-position:100% 0}100%{background-position:-100% 0}}
2980
3131
 
2981
3132
  .sg-foot{margin-top:14px;display:flex;align-items:center;justify-content:center;gap:6px;font-size:11px;color:var(--sg-text-muted);text-align:center}
3133
+ /* display:inline-block is load-bearing, not tidiness. A host running a CSS reset \u2014 Tailwind
3134
+ preflight, which most integrators use and which this repo's own playground applies \u2014 sets
3135
+ svg{display:block}, and the padlock then takes a line of its own above the sentence. Every other
3136
+ glyph in the widget sits in a flex or absolute box where that is harmless; this is the one that
3137
+ lives in normal text flow. (WIDGET_CSS is a template literal: no backticks in these comments.) */
3138
+ .sg-foot svg{display:inline-block;vertical-align:-1px;margin-right:5px}
2982
3139
 
2983
3140
  /* fixed-height variant \u2014 head/foot pinned, body scrolls */
2984
3141
  .sg-widget[data-sg-fixed="true"]{display:flex;flex-direction:column}
@@ -2998,6 +3155,7 @@ var WIDGET_CSS = `
2998
3155
  .sg-tile:disabled{cursor:default}
2999
3156
  .sg-tile-label{font-size:12px;color:var(--sg-text-muted)}
3000
3157
  .sg-tile-main{display:flex;align-items:center;gap:10px;min-width:0}
3158
+ .sg-tile-text{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
3001
3159
  .sg-tile-sym{font-size:16px;font-weight:700;line-height:1.15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
3002
3160
  .sg-tile-chain{font-size:11px;color:var(--sg-text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
3003
3161
  .sg-tile-empty{color:var(--sg-text-muted);font-size:15px;font-weight:600}
@@ -3032,7 +3190,9 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
3032
3190
  .sg-sel-head{display:flex;align-items:center;margin-bottom:14px}
3033
3191
  .sg-back{width:32px;height:32px;flex:0 0 auto;border:none;border-radius:999px;background:transparent;color:var(--sg-text);cursor:pointer;font:inherit;display:flex;align-items:center;justify-content:center;transition:background 120ms ease}
3034
3192
  .sg-back:hover{background:var(--sg-surface)}
3035
- .sg-sel-title{flex:1 1 auto;text-align:center;font-size:15px;font-weight:600;margin-right:32px}
3193
+ .sg-sel-title{flex:1 1 auto;min-width:0;text-align:center;font-size:15px;font-weight:600;margin-right:32px}
3194
+ /* Whose transactions these are \u2014 history is per wallet, and the takeover hides the header's pill. */
3195
+ .sg-sel-sub{display:block;font-size:11px;font-weight:600;color:var(--sg-text-muted);margin-top:1px}
3036
3196
  /* Scrolls at ~2.5 rows. The catalogue's destination chains outnumber its source chains three to one
3037
3197
  (9 escrow chains, ~37 total), so an ungated grid was eight rows tall and pushed the token list \u2014
3038
3198
  the thing the panel exists for \u2014 below the fold. The fade is a scroll affordance, not decoration. */
@@ -3091,6 +3251,53 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
3091
3251
  .sg-hist{width:32px;height:32px;flex:0 0 auto;border:1px solid var(--sg-border);border-radius:999px;background:transparent;color:var(--sg-text-muted);cursor:pointer;font:inherit;display:flex;align-items:center;justify-content:center;transition:color 120ms ease,border-color 120ms ease}
3092
3252
  .sg-hist:hover{color:var(--sg-accent);border-color:var(--sg-accent)}
3093
3253
 
3254
+ /* transaction history row. NOT the picker's flex row: at 390px that layout wrapped the pair onto two
3255
+ lines and then ellipsised the whole meta line down to "\u2026". A 3-column grid instead, where the meta
3256
+ spans the badge column so it always has the full card width to wrap into. */
3257
+ .sg-txrow{display:grid;grid-template-columns:auto minmax(0,1fr);column-gap:11px;row-gap:3px;align-items:center;width:100%;padding:10px 8px;border:none;border-radius:var(--sg-radius-control);background:transparent;color:var(--sg-text);cursor:pointer;font:inherit;text-align:left;transition:background 120ms ease}
3258
+ .sg-txrow:hover{background:var(--sg-surface)}
3259
+ /* Both ends of the trade, side by side \u2014 the RWA gets a mark of its own. NOT overlapped: each disc
3260
+ carries a chain badge at its bottom-right, and an overlap parks that badge on top of its neighbour. */
3261
+ .sg-txrow-glyphs{grid-column:1;grid-row:1 / span 2;display:flex;align-items:center;gap:9px}
3262
+ /* Each side is its own nowrap span, so a narrow card breaks the line AT THE ARROW, never mid-symbol. */
3263
+ .sg-txrow-pair{grid-column:2;grid-row:1;display:flex;flex-wrap:wrap;align-items:baseline;gap:0 6px;font-size:14px;font-weight:700;line-height:1.35;min-width:0}
3264
+ .sg-txrow-side{white-space:nowrap;display:inline-flex;align-items:center;gap:5px}
3265
+ .sg-txrow-arrow{display:inline-flex;color:var(--sg-text-muted)}
3266
+ /* Meta and status share line 2. The badge sat beside the pair until it squeezed the pair onto two
3267
+ lines at 390px; down here the pair gets the card's full width and the badge still reads at a glance. */
3268
+ /* flex-start, not center: on a phone the meta wraps to two lines, and a centred badge then floats
3269
+ between them. Pinned to the first line it reads as the row's status rather than as a third line. */
3270
+ .sg-txrow-meta{grid-column:2;grid-row:2;display:flex;align-items:flex-start;gap:8px;font-size:11.5px;color:var(--sg-text-muted);line-height:1.4}
3271
+ .sg-txrow-when{flex:1 1 auto;min-width:0;display:flex;flex-wrap:wrap;column-gap:8px}
3272
+ /* The kind+chain+orders unit WRAPS; only the timestamp is unbreakable. Holding both as nowrap made
3273
+ the express card (the narrowest surface) overflow its text straight under the status pill. */
3274
+ .sg-txrow-time{white-space:nowrap}
3275
+ .sg-txrow-what{display:flex;flex-wrap:wrap;column-gap:5px;min-width:0}
3276
+ .sg-txrow-what>span{white-space:nowrap}
3277
+ /* The separator is the literal character, never a CSS unicode escape. WIDGET_CSS is a JS template
3278
+ literal, so a backslash-zero-zero escape in here is a legacy octal sequence and esbuild refuses to
3279
+ build the package at all \u2014 including inside a comment like this one. */
3280
+ .sg-txrow-what>span:not(:last-child)::after{content:"\xB7";margin-left:5px}
3281
+ .sg-txrow-end{flex:0 0 auto;margin-left:auto}
3282
+
3283
+ /* transaction detail: the route, one row per ORDER. A chained (RWA) trade is ONE signature and TWO
3284
+ orders; the numbered rail is what makes the middle hop visible instead of merely implied. */
3285
+ /* The pair's artwork above the anchor amount, same marks the pickers draw. */
3286
+ .sg-panel > .sg-txrow-glyphs{margin-bottom:10px}
3287
+ .sg-legs{margin-top:14px}
3288
+ .sg-legs-head{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:13px;margin-bottom:6px}
3289
+ .sg-leg-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:2px}
3290
+ .sg-leg{display:flex;align-items:flex-start;gap:10px;padding:8px 0;border-bottom:1px solid var(--sg-border)}
3291
+ .sg-leg:last-child{border-bottom:none}
3292
+ /* The step number doubles as the rail: a pseudo-element joins consecutive orders, so two legs read as
3293
+ one continuous path rather than as two unrelated rows. */
3294
+ .sg-leg-n{position:relative;flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;margin-top:1px;border-radius:999px;background:color-mix(in srgb,var(--sg-accent) 14%,transparent);color:var(--sg-accent);font-size:10px;font-weight:700;font-variant-numeric:tabular-nums}
3295
+ .sg-leg:not(:last-child) .sg-leg-n::after{content:"";position:absolute;top:19px;left:50%;width:1px;height:calc(100% + 6px);background:var(--sg-border)}
3296
+ .sg-leg-body{min-width:0;flex:1 1 auto}
3297
+ .sg-leg-line{display:flex;align-items:center;gap:7px;flex-wrap:wrap;font-size:13px;font-weight:600}
3298
+ .sg-leg-arrow{display:inline-flex;color:var(--sg-text-muted)}
3299
+ .sg-leg-sub{margin-top:2px;font-size:11.5px;color:var(--sg-text-muted);line-height:1.45}
3300
+
3094
3301
  /* transaction detail: copyable hash row (no external links \u2014 everything stays in-widget) */
3095
3302
  .sg-txd-hash{display:flex;align-items:center;gap:8px;margin-top:12px;font-size:13px}
3096
3303
  .sg-txd-hash .sg-mono{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@@ -3480,10 +3687,10 @@ function WidgetShell(props) {
3480
3687
  ] })
3481
3688
  ] }),
3482
3689
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-body", children: props.children }),
3483
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-foot", children: [
3690
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-foot", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
3484
3691
  /* @__PURE__ */ jsxRuntime.jsx(LockGlyph, {}),
3485
3692
  " Your wallet signs every transaction \xB7 Powered by ZeroDelta"
3486
- ] })
3693
+ ] }) })
3487
3694
  ] });
3488
3695
  }
3489
3696
  function shortAddress2(a) {
@@ -3979,9 +4186,15 @@ var BUNDLED_TOKEN_LOGO = {
3979
4186
  function isHttpsUrl(u) {
3980
4187
  return typeof u === "string" && /^https:\/\//i.test(u);
3981
4188
  }
4189
+ function isSameOriginPath2(u) {
4190
+ return typeof u === "string" && u.startsWith("/") && !u.startsWith("//") && !u.startsWith("/\\");
4191
+ }
4192
+ function isDisplayableImageSrc(u) {
4193
+ return isHttpsUrl(u) || isSameOriginPath2(u);
4194
+ }
3982
4195
  function tokenLogoCandidates(symbol, logoUrl) {
3983
4196
  const out = [];
3984
- if (isHttpsUrl(logoUrl)) out.push(logoUrl);
4197
+ if (isDisplayableImageSrc(logoUrl)) out.push(logoUrl);
3985
4198
  const bundled = BUNDLED_TOKEN_LOGO[symbolKey(symbol)];
3986
4199
  if (bundled && !out.includes(bundled)) out.push(bundled);
3987
4200
  return out;
@@ -4028,7 +4241,7 @@ function TokenTile(props) {
4028
4241
  const shown = props.token?.symbol ?? props.pick?.symbol ?? "";
4029
4242
  const glyph = props.pick ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4030
4243
  /* @__PURE__ */ jsxRuntime.jsx(TokenGlyph, { symbol: props.pick.symbol, logoUrl: props.token?.logoUrl, chainId: props.pick.chainId }),
4031
- /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { minWidth: 0 }, children: [
4244
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-tile-text", children: [
4032
4245
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-sym", children: shown }),
4033
4246
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tile-chain", children: CHAIN_LABELS[props.pick.chainId] || `Chain ${props.pick.chainId}` })
4034
4247
  ] })
@@ -4216,6 +4429,59 @@ function HistoryButton(props) {
4216
4429
  function chainLabel(entry) {
4217
4430
  return entry.chainId != null && CHAIN_LABELS[entry.chainId] || entry.chainName || (entry.chainId != null ? `Chain ${entry.chainId}` : "Unknown chain");
4218
4431
  }
4432
+ function chainName(chainId, fallback) {
4433
+ return CHAIN_LABELS[chainId] || fallback || (chainId ? `Chain ${chainId}` : "Unknown chain");
4434
+ }
4435
+ function legsOf(entry) {
4436
+ if (entry.legs?.length) return entry.legs;
4437
+ const leg = {
4438
+ index: 1,
4439
+ fromAsset: entry.fromAsset,
4440
+ fromChainId: entry.chainId ?? 0,
4441
+ fromChainName: entry.chainName,
4442
+ fromAmount: entry.payAmount,
4443
+ toAsset: entry.toAsset,
4444
+ toChainId: 0,
4445
+ toChainName: "",
4446
+ toAmount: entry.receiveAmount,
4447
+ executionChainId: 0,
4448
+ executionChainName: ""
4449
+ };
4450
+ return [leg];
4451
+ }
4452
+ function ordersLabel(count) {
4453
+ return count === 1 ? "1 order" : `${count} orders`;
4454
+ }
4455
+ function LegArrowGlyph() {
4456
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.6", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
4457
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 12h14" }),
4458
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m13 6 6 6-6 6" })
4459
+ ] });
4460
+ }
4461
+ function TxLegs(props) {
4462
+ const multi = props.legs.length > 1;
4463
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-legs", "data-multi": multi || void 0, children: [
4464
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-legs-head", children: [
4465
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Route" }),
4466
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", children: ordersLabel(props.legs.length) })
4467
+ ] }),
4468
+ /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "sg-leg-list", children: props.legs.map((leg) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "sg-leg", children: [
4469
+ multi ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-leg-n", "aria-hidden": "true", children: leg.index }) : null,
4470
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-leg-body", children: [
4471
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-leg-line", children: [
4472
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-mono", children: `${leg.fromAmount ? `${leg.fromAmount} ` : ""}${leg.fromAsset || "\u2014"}` }),
4473
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-leg-arrow", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(LegArrowGlyph, {}) }),
4474
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-mono", children: `${leg.toAmount ? `${leg.toAmount} ` : ""}${leg.toAsset || "\u2014"}` })
4475
+ ] }),
4476
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-leg-sub", children: [
4477
+ chainName(leg.fromChainId, leg.fromChainName),
4478
+ leg.toChainId ? ` \u2192 ${chainName(leg.toChainId, leg.toChainName)}` : "",
4479
+ leg.executionChainId && leg.executionChainId !== leg.fromChainId ? ` \xB7 filled on ${chainName(leg.executionChainId, leg.executionChainName)}` : ""
4480
+ ] })
4481
+ ] })
4482
+ ] }, `${leg.index}:${leg.fromChainId}:${leg.toChainId}`)) })
4483
+ ] });
4484
+ }
4219
4485
  function statusBadge(status) {
4220
4486
  if (status === "confirmed")
4221
4487
  return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", "data-tone": "ok", children: "Confirmed" });
@@ -4225,40 +4491,73 @@ function statusBadge(status) {
4225
4491
  }
4226
4492
  function whenLabel(at) {
4227
4493
  const d = new Date(at);
4228
- return Number.isNaN(d.getTime()) ? "" : d.toLocaleString();
4494
+ if (Number.isNaN(d.getTime())) return "";
4495
+ const sameYear = d.getFullYear() === (/* @__PURE__ */ new Date()).getFullYear();
4496
+ try {
4497
+ return d.toLocaleString(void 0, { day: "numeric", month: "short", year: sameYear ? void 0 : "numeric", hour: "2-digit", minute: "2-digit" });
4498
+ } catch {
4499
+ return d.toLocaleString();
4500
+ }
4501
+ }
4502
+ function endpoints(entry) {
4503
+ const legs = entry.legs;
4504
+ return {
4505
+ fromChainId: entry.chainId ?? legs?.[0]?.fromChainId ?? void 0,
4506
+ toChainId: legs?.length ? legs[legs.length - 1].toChainId || void 0 : void 0
4507
+ };
4508
+ }
4509
+ function TxPairGlyphs(props) {
4510
+ const e = props.entry;
4511
+ const { fromChainId, toChainId } = endpoints(e);
4512
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-glyphs", children: [
4513
+ /* @__PURE__ */ jsxRuntime.jsx(TokenGlyph, { symbol: e.fromAsset || "?", logoUrl: logoFor(props.art, e.fromAsset, fromChainId ?? null), chainId: fromChainId, size: "sm" }),
4514
+ /* @__PURE__ */ jsxRuntime.jsx(TokenGlyph, { symbol: e.toAsset || "?", logoUrl: logoFor(props.art, e.toAsset, toChainId ?? null), chainId: toChainId, size: "sm" })
4515
+ ] });
4229
4516
  }
4230
- function logoFor(tokens, symbol, chainId) {
4231
- if (!tokens?.length) return void 0;
4517
+ function TxPair(props) {
4518
+ const e = props.entry;
4519
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-pair", children: [
4520
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-side sg-mono", children: `${e.payAmount} ${e.fromAsset}` }),
4521
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-side sg-mono", children: [
4522
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-arrow", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(LegArrowGlyph, {}) }),
4523
+ `${e.receiveAmount} ${e.toAsset}`
4524
+ ] })
4525
+ ] });
4526
+ }
4527
+ function logoFor(art, symbol, chainId) {
4232
4528
  const key = symbolKey(symbol);
4233
4529
  if (!key) return void 0;
4234
- const sameChain = chainId == null ? void 0 : tokens.find((t) => Number(t.chainId) === chainId && symbolKey(t.symbol) === key);
4235
- return (sameChain ?? tokens.find((t) => symbolKey(t.symbol) === key))?.logoUrl;
4530
+ const tokens = art.tokens;
4531
+ if (tokens?.length) {
4532
+ const sameChain = chainId == null ? void 0 : tokens.find((t) => Number(t.chainId) === chainId && symbolKey(t.symbol) === key);
4533
+ const found = (sameChain ?? tokens.find((t) => symbolKey(t.symbol) === key))?.logoUrl;
4534
+ if (found) return found;
4535
+ }
4536
+ return art.vaultIcons?.get(key);
4236
4537
  }
4237
4538
  function TxHistoryList(props) {
4238
4539
  if (!props.entries.length) {
4239
4540
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-sel-empty", children: "No transactions yet \u2014 activity from this wallet will appear here." });
4240
4541
  }
4241
- return /* @__PURE__ */ jsxRuntime.jsx("section", { className: "sg-toklist", "aria-label": "Transaction history", children: props.entries.map((e) => /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-tokrow", onClick: () => props.onPick(e), children: [
4242
- /* @__PURE__ */ jsxRuntime.jsx(TokenGlyph, { symbol: e.fromAsset || e.toAsset || "?", logoUrl: logoFor(props.tokens, e.fromAsset, e.chainId), chainId: e.chainId ?? void 0 }),
4243
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-tokrow-main", children: [
4244
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-tokrow-sym sg-mono", children: [
4245
- e.payAmount,
4246
- " ",
4247
- e.fromAsset,
4248
- " \u2192 ",
4249
- e.receiveAmount,
4250
- " ",
4251
- e.toAsset
4252
- ] }),
4253
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-tokrow-name", children: [
4254
- e.kind === "payment" ? "Payment" : "Swap",
4255
- " \xB7 ",
4256
- chainLabel(e),
4257
- whenLabel(e.at) ? ` \xB7 ${whenLabel(e.at)}` : ""
4542
+ return /* @__PURE__ */ jsxRuntime.jsx("section", { className: "sg-toklist", "aria-label": "Transaction history", children: props.entries.map((e) => (
4543
+ // A GRID, not the picker's flex row: the meta line spans the badge column too, so at 390px it
4544
+ // has the full card width to wrap into instead of being ellipsised away to "…".
4545
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-txrow", onClick: () => props.onPick(e), children: [
4546
+ /* @__PURE__ */ jsxRuntime.jsx(TxPairGlyphs, { entry: e, art: props }),
4547
+ /* @__PURE__ */ jsxRuntime.jsx(TxPair, { entry: e }),
4548
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-meta", children: [
4549
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-when", children: [
4550
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-txrow-what", children: [
4551
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: e.kind === "payment" ? "Payment" : "Swap" }),
4552
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: chainLabel(e) }),
4553
+ (e.legs?.length ?? 1) > 1 ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: ordersLabel(e.legs.length) }) : null
4554
+ ] }),
4555
+ whenLabel(e.at) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-time", children: whenLabel(e.at) }) : null
4556
+ ] }),
4557
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-end", children: statusBadge(e.status) })
4258
4558
  ] })
4259
- ] }),
4260
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-tokrow-end", children: statusBadge(e.status) })
4261
- ] }, `${e.hash}:${e.at}`)) });
4559
+ ] }, `${e.hash}:${e.at}`)
4560
+ )) });
4262
4561
  }
4263
4562
  function TxDetail(props) {
4264
4563
  const e = props.entry;
@@ -4281,6 +4580,7 @@ function TxDetail(props) {
4281
4580
  }
4282
4581
  };
4283
4582
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-panel", children: [
4583
+ /* @__PURE__ */ jsxRuntime.jsx(TxPairGlyphs, { entry: e, art: props }),
4284
4584
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-anchor sg-mono", children: [
4285
4585
  e.receiveAmount,
4286
4586
  " ",
@@ -4290,6 +4590,7 @@ function TxDetail(props) {
4290
4590
  e.kind === "payment" ? "Payment" : "Swap",
4291
4591
  whenLabel(e.at) ? ` \xB7 ${whenLabel(e.at)}` : ""
4292
4592
  ] }),
4593
+ /* @__PURE__ */ jsxRuntime.jsx(TxLegs, { legs: legsOf(e) }),
4293
4594
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta", children: [
4294
4595
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
4295
4596
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Status" }),
@@ -4304,7 +4605,7 @@ function TxDetail(props) {
4304
4605
  ] })
4305
4606
  ] }),
4306
4607
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
4307
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Chain" }),
4608
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Signed on" }),
4308
4609
  /* @__PURE__ */ jsxRuntime.jsx("b", { children: chainLabel(e) })
4309
4610
  ] }),
4310
4611
  e.recipient ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
@@ -4323,14 +4624,17 @@ function TxDetail(props) {
4323
4624
  ] })
4324
4625
  ] });
4325
4626
  }
4326
- function displayableHistory(entries) {
4327
- return entries.filter((e) => e.txKind !== "approve");
4627
+ function displayableHistory(entries, account) {
4628
+ const owner = typeof account === "string" ? account.toLowerCase() : "";
4629
+ return entries.filter((e) => e.txKind !== "approve" && (!e.account || !owner || e.account.toLowerCase() === owner));
4328
4630
  }
4329
4631
  function TxHistoryPanel(props) {
4330
- const entries = displayableHistory(useTxHistory(props.account));
4331
- const [selected, setSelected] = react.useState(props.initialEntry ?? null);
4632
+ const account = props.account;
4633
+ const entries = displayableHistory(useTxHistory(account), account);
4634
+ const deepLink = props.initialEntry && displayableHistory([props.initialEntry], account).length ? props.initialEntry : null;
4635
+ const [selected, setSelected] = react.useState(deepLink);
4332
4636
  const backRef = react.useRef(null);
4333
- react.useEffect(() => setSelected(props.initialEntry ?? null), [props.initialEntry]);
4637
+ react.useEffect(() => setSelected(deepLink), [deepLink]);
4334
4638
  const pick = (entry) => {
4335
4639
  setSelected(entry);
4336
4640
  requestAnimationFrame(() => backRef.current?.focus());
@@ -4338,9 +4642,12 @@ function TxHistoryPanel(props) {
4338
4642
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4339
4643
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-sel-head", children: [
4340
4644
  /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", autoFocus: true, ref: backRef, className: "sg-back", onClick: selected ? () => setSelected(null) : props.onBack, "aria-label": "Back", children: /* @__PURE__ */ jsxRuntime.jsx(BackGlyph2, {}) }),
4341
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-sel-title", children: selected ? "Transaction" : "Transaction history" })
4645
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-sel-title", children: [
4646
+ selected ? "Transaction" : "Transaction history",
4647
+ account ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-sel-sub sg-mono", children: shortAddress2(account) }) : null
4648
+ ] })
4342
4649
  ] }),
4343
- selected ? /* @__PURE__ */ jsxRuntime.jsx(TxDetail, { entry: selected }) : /* @__PURE__ */ jsxRuntime.jsx(TxHistoryList, { entries, tokens: props.tokens, onPick: pick })
4650
+ selected ? /* @__PURE__ */ jsxRuntime.jsx(TxDetail, { entry: selected, tokens: props.tokens, vaultIcons: props.vaultIcons }) : /* @__PURE__ */ jsxRuntime.jsx(TxHistoryList, { entries, tokens: props.tokens, vaultIcons: props.vaultIcons, onPick: pick })
4344
4651
  ] });
4345
4652
  }
4346
4653
  var IDENTITY_KEY_PREFIX = "sg:link:v1:";
@@ -4403,7 +4710,7 @@ function forgetIdentity(account) {
4403
4710
  }
4404
4711
  }
4405
4712
  var addrEq = (a, b) => String(a || "").toLowerCase() === String(b || "").toLowerCase();
4406
- var chainName = (id) => id != null ? CHAIN_LABELS[id] || `Chain ${id}` : "";
4713
+ var chainName2 = (id) => id != null ? CHAIN_LABELS[id] || `Chain ${id}` : "";
4407
4714
  var STABLES = EXECUTABLE_STABLE_ASSETS;
4408
4715
  function BankGlyph() {
4409
4716
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -4919,6 +5226,7 @@ function PaymentIsland(props) {
4919
5226
  const [expanded, setExpanded] = react.useState(() => Boolean(props.defaultExpanded) || rampMode);
4920
5227
  const [view, setView] = react.useState("main");
4921
5228
  const [hist, setHist] = react.useState(null);
5229
+ const histBtnRef = react.useRef(null);
4922
5230
  const pillRef = react.useRef(null);
4923
5231
  const methodRowRef = react.useRef(null);
4924
5232
  const exFromTileRef = react.useRef(null);
@@ -4926,6 +5234,7 @@ function PaymentIsland(props) {
4926
5234
  const regionRef = react.useRef(null);
4927
5235
  const panelId = react.useId();
4928
5236
  react.useEffect(() => setView("main"), [wallet.account, payParamsKey]);
5237
+ react.useEffect(() => setHist(null), [wallet.account]);
4929
5238
  const firstRender = react.useRef(true);
4930
5239
  react.useEffect(() => {
4931
5240
  if (firstRender.current) {
@@ -4949,7 +5258,7 @@ function PaymentIsland(props) {
4949
5258
  };
4950
5259
  const closeHistory = () => {
4951
5260
  setHist(null);
4952
- requestAnimationFrame(() => (methodRowRef.current ?? regionRef.current)?.focus());
5261
+ requestAnimationFrame(() => (histBtnRef.current ?? methodRowRef.current ?? regionRef.current)?.focus());
4953
5262
  };
4954
5263
  const pickFunding = (pick) => {
4955
5264
  const r = visibleRoutes.find((x) => x.source.chainId === pick.chainId && symbolKey(x.source.asset) === symbolKey(pick.symbol));
@@ -5011,7 +5320,11 @@ function PaymentIsland(props) {
5011
5320
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-link-word", children: "ZeroDelta" }),
5012
5321
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", "data-tone": "accent", children: "Link" })
5013
5322
  ] });
5014
- const walletSlot = menuItems.length ? /* @__PURE__ */ jsxRuntime.jsx(LinkMenu, { items: menuItems }) : void 0;
5323
+ const linkMenu = menuItems.length ? /* @__PURE__ */ jsxRuntime.jsx(LinkMenu, { items: menuItems }) : null;
5324
+ const walletSlot = wallet.account || linkMenu ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-head-tools", children: [
5325
+ wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(HistoryButton, { btnRef: histBtnRef, disabled: submitting, onClick: () => setHist({}) }) : null,
5326
+ linkMenu
5327
+ ] }) : void 0;
5015
5328
  const activeStep = flow.steps.find((s) => s.state === "active");
5016
5329
  const liveMsg = flow.status === "loading" ? isPay ? "Finding the best way to pay." : "Finding the best route." : flow.status === "submitting" ? `${activeStep?.label ?? (isPay ? "Processing your payment" : `Processing your ${verb.present.toLowerCase()}`)} \u2014 in progress.` : flow.status === "success" || flow.status === "pending" ? flow.verdict?.status === "confirmed" ? isPay ? "Payment confirmed on-chain \u2014 the merchant has been settled." : `${verb.past} \u2014 confirmed on-chain.` : isPay ? "Payment sent \u2014 confirmation is still pending." : "Submitted \u2014 confirmation is still pending." : "";
5017
5330
  const loading = flow.status === "loading";
@@ -5045,7 +5358,7 @@ function PaymentIsland(props) {
5045
5358
  ] });
5046
5359
  let body;
5047
5360
  if (hist && wallet.account) {
5048
- body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, initialEntry: hist.entry ?? null, onBack: closeHistory });
5361
+ body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
5049
5362
  } else if (isPay && view === "select" && wallet.account) {
5050
5363
  body = /* @__PURE__ */ jsxRuntime.jsx(
5051
5364
  TokenSelect,
@@ -5224,7 +5537,7 @@ function PaymentIsland(props) {
5224
5537
  ] }),
5225
5538
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-anchor-sub", children: [
5226
5539
  "on ",
5227
- chainName(sel.source.chainId),
5540
+ chainName2(sel.source.chainId),
5228
5541
  selBal ? ` \xB7 balance ${selBal.formatted}` : ""
5229
5542
  ] })
5230
5543
  ] }) : null,
@@ -5237,7 +5550,7 @@ function PaymentIsland(props) {
5237
5550
  ] }),
5238
5551
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-anchor-sub", children: [
5239
5552
  "on ",
5240
- chainName(sel.source.chainId)
5553
+ chainName2(sel.source.chainId)
5241
5554
  ] })
5242
5555
  ] }) : null,
5243
5556
  sel && !loading && !quoteError ? /* @__PURE__ */ jsxRuntime.jsx(CompliancePanel, { compliance: sel.quote.compliance, direct: sel.state === "DIRECT" }) : null,
@@ -5509,7 +5822,7 @@ function StableGeniePay(props) {
5509
5822
  ] })
5510
5823
  ] }) : void 0;
5511
5824
  if (props.variant === "pill") return /* @__PURE__ */ jsxRuntime.jsx(PaymentIsland, { kind: "pay", ...props });
5512
- return /* @__PURE__ */ jsxRuntime.jsx(WidgetShell, { title: config.title || "Complete payment", theme: config.theme, heightPx: props.heightPx, walletSlot, children: hist && wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, initialEntry: hist.entry ?? null, onBack: closeHistory }) : view === "select" && wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(
5825
+ return /* @__PURE__ */ jsxRuntime.jsx(WidgetShell, { title: config.title || "Complete payment", theme: config.theme, heightPx: props.heightPx, walletSlot, children: hist && wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory }) : view === "select" && wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(
5513
5826
  TokenSelect,
5514
5827
  {
5515
5828
  title: "Pay with",
@@ -5682,7 +5995,7 @@ function StableGenieSwap(props) {
5682
5995
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-brand", children: "ZeroDelta" })
5683
5996
  ] }) : void 0;
5684
5997
  if (hist && wallet.account) {
5685
- return /* @__PURE__ */ jsxRuntime.jsx(WidgetShell, { title: config.title || "Swap", theme: config.theme, walletSlot, children: /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, initialEntry: hist.entry ?? null, onBack: closeHistory }) });
5998
+ return /* @__PURE__ */ jsxRuntime.jsx(WidgetShell, { title: config.title || "Swap", theme: config.theme, walletSlot, children: /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory }) });
5686
5999
  }
5687
6000
  if (flow.status === "success" || flow.status === "pending") {
5688
6001
  return /* @__PURE__ */ jsxRuntime.jsxs(WidgetShell, { title: config.title || "Swap", theme: config.theme, walletSlot, children: [
@@ -5932,7 +6245,7 @@ function StableGenieExchange(props) {
5932
6245
  if (props.variant === "pill") return /* @__PURE__ */ jsxRuntime.jsx(PaymentIsland, { kind: "exchange", ...props });
5933
6246
  let body;
5934
6247
  if (hist && connected) {
5935
- body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens, initialEntry: hist.entry ?? null, onBack: closeHistory });
6248
+ body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
5936
6249
  } else if (view === "from" || view === "to") {
5937
6250
  const isFrom = view === "from";
5938
6251
  body = /* @__PURE__ */ jsxRuntime.jsx(