@glacislabs/stablegenie-zerodelta 4.13.0 → 4.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,96 @@
1
- import { CHAIN_DISPLAY_NAMES, EXECUTABLE_STABLE_ASSETS, STABLE_ASSETS, SUPPORTED_ASSETS, complianceView, complianceTagOf, symbolKey, normalizeDecimalText, findToken, laneLimitFor, laneLimitSymbol, tokenTicker, exceedsLaneLimit, assetDecimals, parseUnitsDecimal, counterpartTokens, assetClassOf, brokenLaneFor, brokenLaneReason, destinationAvailability, laneLimitHint, tickerOn, laneLimitError, routeNativeValue, formatNative, nativeSymbol, isSolanaChainId, formatUnits, amountFieldError, SUPPORTED_CHAIN_IDS, complianceChecks, DIRECT_CHECK_IDS, isSolanaAddress, createEngine, isAddress, checkNativeFee, nativeFeeShortLabel, nativeFeeShortMessage, allowanceCovers, validatePlannedTransaction, solanaPlanNeedsPreparation, SOLANA_CHAIN_ID, unattributedComplianceReasons, distinctScreenedWallets, formatJurisdiction, humanizeComplianceReason, DIRECT_SCOPE_NOTE, categoryLabel, SCREENING_BUCKETS, BUNDLED_RPC, foldTicker } from './chunk-52MY5D3D.js';
1
+ import { CHAIN_DISPLAY_NAMES, EXECUTABLE_STABLE_ASSETS, STABLE_ASSETS, SUPPORTED_ASSETS, complianceView, complianceTagOf, symbolKey, normalizeDecimalText, findToken, laneLimitFor, laneLimitSymbol, tokenTicker, exceedsLaneLimit, assetDecimals, parseUnitsDecimal, counterpartTokens, assetClassOf, brokenLaneFor, brokenLaneReason, destinationAvailability, laneLimitHint, tickerOn, laneLimitError, routeNativeValue, formatNative, nativeSymbol, isSolanaChainId, formatUnits, amountFieldError, solanaQuoteCompliance, SUPPORTED_CHAIN_IDS, complianceChecks, DIRECT_CHECK_IDS, isSolanaAddress, createEngine, isAddress, checkNativeFee, nativeFeeShortLabel, nativeFeeShortMessage, allowanceCovers, validatePlannedTransaction, TRACKING, mergeHistory, solanaPlanNeedsPreparation, SOLANA_CHAIN_ID, unattributedComplianceReasons, distinctScreenedWallets, formatJurisdiction, humanizeComplianceReason, DIRECT_SCOPE_NOTE, categoryLabel, SCREENING_BUCKETS, BUNDLED_RPC, foldTicker } from './chunk-6WFIFKZ4.js';
2
2
  import { createContext, useState, useRef, useMemo, useEffect, useCallback, useId, createElement, useContext, useLayoutEffect, useSyncExternalStore, useReducer } from 'react';
3
3
  import { createRoot } from 'react-dom/client';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
 
6
+ function deliveryPollDelay(elapsedMs) {
7
+ if (elapsedMs < 6e4) return 5e3;
8
+ if (elapsedMs < 11 * 6e4) return 15e3;
9
+ return 3e4;
10
+ }
11
+ var DELIVERY_GIVE_UP_MS = 2 * 60 * 60 * 1e3;
12
+ var UNANSWERED_LIMIT = 20;
13
+ var UNAVAILABLE = Object.freeze({ phase: "unavailable", status: "", steps: [] });
14
+ var hidden = () => typeof document !== "undefined" && document.visibilityState === "hidden";
15
+ function useDelivery(engine, hash) {
16
+ const [state, setState] = useState({ hash: null, value: TRACKING });
17
+ useEffect(() => {
18
+ if (!hash) return;
19
+ let alive = true;
20
+ let timer2;
21
+ let answered = false;
22
+ let unanswered = 0;
23
+ const started2 = Date.now();
24
+ setState({ hash, value: TRACKING });
25
+ const schedule = () => {
26
+ if (Date.now() - started2 > DELIVERY_GIVE_UP_MS) return setState({ hash, value: UNAVAILABLE });
27
+ timer2 = setTimeout(tick, deliveryPollDelay(Date.now() - started2));
28
+ };
29
+ const tick = async () => {
30
+ timer2 = void 0;
31
+ if (hidden()) return schedule();
32
+ const next = await engine.trackDelivery(hash);
33
+ if (!alive) return;
34
+ if (next.phase === "tracking") {
35
+ if (!answered && ++unanswered >= UNANSWERED_LIMIT) return setState({ hash, value: UNAVAILABLE });
36
+ return schedule();
37
+ }
38
+ answered = true;
39
+ setState({ hash, value: next });
40
+ if (next.phase === "delivered" || next.phase === "failed") return;
41
+ schedule();
42
+ };
43
+ const onVisible2 = () => {
44
+ if (!alive || hidden() || !timer2) return;
45
+ clearTimeout(timer2);
46
+ void tick();
47
+ };
48
+ void tick();
49
+ if (typeof document !== "undefined") document.addEventListener("visibilitychange", onVisible2);
50
+ return () => {
51
+ alive = false;
52
+ if (timer2) clearTimeout(timer2);
53
+ if (typeof document !== "undefined") document.removeEventListener("visibilitychange", onVisible2);
54
+ };
55
+ }, [engine, hash]);
56
+ return state.hash === hash ? state.value : TRACKING;
57
+ }
58
+ var STEP_LABEL = {
59
+ submitted: "Submitted",
60
+ arrived: "Arrived",
61
+ filled: "Filled",
62
+ outbound_bridging: "Bridging",
63
+ delivered: "Delivered"
64
+ };
65
+ var label = (name) => STEP_LABEL[name] ?? name.replace(/_/g, " ");
66
+ function deliveryHeadline(delivery, sourceConfirmed, direct = false) {
67
+ if (direct) return sourceConfirmed ? "Delivered" : "Submitted \u2014 awaiting confirmation";
68
+ switch (delivery.phase) {
69
+ case "delivered":
70
+ return "Delivered";
71
+ case "failed":
72
+ return delivery.status === "cancelled" ? "Cancelled \u2014 not delivered" : `Not delivered (${delivery.status.replace(/_/g, " ")}) \u2014 open the transaction for details`;
73
+ case "attention":
74
+ return delivery.status === "cancel_pending" ? "Being cancelled \u2014 not delivered" : "Waiting to be claimed \u2014 open the transaction";
75
+ case "in-progress": {
76
+ if (delivery.status === "continuing") return "On its way \u2014 final leg next";
77
+ const next = delivery.steps.find((s) => !s.done);
78
+ return next ? `On its way \u2014 ${label(next.name).toLowerCase()} next` : "On its way";
79
+ }
80
+ case "unavailable":
81
+ return sourceConfirmed ? "Sent \u2014 open the transaction to follow delivery" : "Submitted \u2014 awaiting confirmation";
82
+ default:
83
+ return sourceConfirmed ? "Sent \u2014 tracking delivery" : "Submitted \u2014 awaiting confirmation";
84
+ }
85
+ }
86
+ function isDelivered(delivery, sourceConfirmed, direct = false) {
87
+ return direct ? sourceConfirmed : delivery.phase === "delivered";
88
+ }
89
+ function DeliverySteps(props) {
90
+ const { steps, phase } = props.delivery;
91
+ if (!steps.length || phase === "failed") return null;
92
+ return /* @__PURE__ */ jsx("div", { className: "sg-success-steps", "data-testid": "delivery-steps", "data-phase": phase, children: steps.map((s) => `${label(s.name)}${s.done ? " \u2713" : ""}`).join(" \xB7 ") });
93
+ }
6
94
  var ConfigContext = createContext({});
7
95
  function StableGenieProvider({ children, ...config }) {
8
96
  return /* @__PURE__ */ jsx(ConfigContext.Provider, { value: config, children });
@@ -865,6 +953,7 @@ var WIDGET_CSS = `
865
953
  .sg-success-check{width:40px;height:40px;border-radius:999px;background:var(--sg-accent);color:var(--sg-accent-text);display:inline-flex;align-items:center;justify-content:center;margin-bottom:8px}
866
954
  /* Broadcast but not receipt-confirmed: mute the disc so a pending settlement never wears the
867
955
  accent-coloured "paid" affordance. Mirrors .sg-settle-disc[data-pending] in the island. */
956
+ .sg-success-steps{font-size:12px;color:var(--sg-text-muted);margin-top:6px;text-align:center}
868
957
  .sg-success-check[data-pending="true"]{background:var(--sg-surface);color:var(--sg-text-muted);border:1px solid var(--sg-border)}
869
958
  .sg-success-amt{font-size:20px;font-weight:700;font-variant-numeric:tabular-nums}
870
959
  .sg-success-sub{font-size:12px;color:var(--sg-text-muted);margin-top:2px}
@@ -1755,7 +1844,7 @@ function StepList(props) {
1755
1844
  /* @__PURE__ */ jsx("span", { className: s.state === "done" ? "sg-muted" : "", children: s.label }),
1756
1845
  rich ? /* @__PURE__ */ jsx("span", { className: "sg-sr-only", children: ` \u2014 ${STEP_STATE_WORD[s.state]}` }) : null
1757
1846
  ] }, s.id)) }),
1758
- rich && props.verdict && verifyDone ? /* @__PURE__ */ jsx("div", { className: "sg-step-verdict", children: props.verdict.status === "confirmed" ? "Confirmed on-chain \u2014 the merchant has been settled." : props.verdict.status === "mismatch" ? "The submitted transaction did not match the reviewed plan." : "Payment sent \u2014 confirmation is still pending." }) : null
1847
+ rich && props.verdict && verifyDone ? /* @__PURE__ */ jsx("div", { className: "sg-step-verdict", children: props.verdict.status === "confirmed" ? "Confirmed on-chain \u2014 on its way to the merchant." : props.verdict.status === "mismatch" ? "The submitted transaction did not match the reviewed plan." : "Payment sent \u2014 confirmation is still pending." }) : null
1759
1848
  ] });
1760
1849
  }
1761
1850
  var SHOW_ROADMAP_METHODS = true;
@@ -2095,8 +2184,8 @@ var CHAIN_ALIASES = {
2095
2184
  137: ["matic"],
2096
2185
  43114: ["avax"]
2097
2186
  };
2098
- function labelForms(label) {
2099
- const lower = label.trim().toLowerCase();
2187
+ function labelForms(label2) {
2188
+ const lower = label2.trim().toLowerCase();
2100
2189
  if (!lower) return [];
2101
2190
  const compact = lower.replace(/[^a-z0-9]/g, "");
2102
2191
  return compact && compact !== lower ? [lower, compact] : [lower];
@@ -2107,8 +2196,8 @@ function buildChainSearchTerms(chains) {
2107
2196
  for (const id of ids) {
2108
2197
  const chain = chains.find((c) => Number(c.chainId) === id);
2109
2198
  const terms = /* @__PURE__ */ new Set();
2110
- for (const label of [chain?.displayName, chain?.name, typeof chain?.slug === "string" ? chain.slug : void 0, CHAIN_LABELS[id]]) {
2111
- if (label) for (const form of labelForms(label)) terms.add(form);
2199
+ for (const label2 of [chain?.displayName, chain?.name, typeof chain?.slug === "string" ? chain.slug : void 0, CHAIN_LABELS[id]]) {
2200
+ if (label2) for (const form of labelForms(label2)) terms.add(form);
2112
2201
  }
2113
2202
  for (const alias of CHAIN_ALIASES[id] ?? []) terms.add(alias);
2114
2203
  byId.set(id, [...terms]);
@@ -2480,7 +2569,7 @@ function TokenSelect(props) {
2480
2569
  const members = g.deployments;
2481
2570
  const multi = members.length > 1;
2482
2571
  const single = members[0];
2483
- const label = multi ? g.symbol : tokenTicker(single.token);
2572
+ const label2 = multi ? g.symbol : tokenTicker(single.token);
2484
2573
  const blocked = !!g.unavailable;
2485
2574
  const opensNetworks = multi || blocked;
2486
2575
  const zero = showBalances && g.amount === 0 || blocked;
@@ -2504,7 +2593,7 @@ function TokenSelect(props) {
2504
2593
  /* @__PURE__ */ jsxs("span", { className: "sg-pk-left", children: [
2505
2594
  /* @__PURE__ */ jsx(TokenPlate, { symbol: g.symbol, logoUrl: g.logoUrl }),
2506
2595
  /* @__PURE__ */ jsxs("span", { className: "sg-pk-text", children: [
2507
- /* @__PURE__ */ jsx("span", { className: "sg-pk-label", children: label }),
2596
+ /* @__PURE__ */ jsx("span", { className: "sg-pk-label", children: label2 }),
2508
2597
  /* @__PURE__ */ jsxs("span", { className: "sg-pk-line", children: [
2509
2598
  /* @__PURE__ */ jsx("span", { className: "sg-pk-sub", children: multi ? showBalances ? "Total across" : "Available on" : `On ${chainName3(Number(single.token.chainId))}` }),
2510
2599
  /* @__PURE__ */ jsx(ChainMarks, { chainIds: members.map((m) => Number(m.token.chainId)), chainById, decorative: !multi }),
@@ -2513,7 +2602,7 @@ function TokenSelect(props) {
2513
2602
  !multi && single.hint ? /* @__PURE__ */ jsx("span", { className: "sg-pk-note", "data-testid": "lane-limit", children: single.hint }) : null
2514
2603
  ] })
2515
2604
  ] }),
2516
- showBalances ? /* @__PURE__ */ jsx(BalanceColumn, { amount: g.amount, usd: g.usd, symbol: label }) : opensNetworks ? /* @__PURE__ */ jsx("span", { className: "sg-pk-chev", "aria-hidden": "true", children: /* @__PURE__ */ jsx(ChevronGlyph, {}) }) : null
2605
+ showBalances ? /* @__PURE__ */ jsx(BalanceColumn, { amount: g.amount, usd: g.usd, symbol: label2 }) : opensNetworks ? /* @__PURE__ */ jsx("span", { className: "sg-pk-chev", "aria-hidden": "true", children: /* @__PURE__ */ jsx(ChevronGlyph, {}) }) : null
2517
2606
  ]
2518
2607
  },
2519
2608
  g.key
@@ -2799,12 +2888,12 @@ function TriggerGlyph({ cv }) {
2799
2888
  return /* @__PURE__ */ jsx(ShieldTick, {});
2800
2889
  }
2801
2890
  function CheckRow({ check: check2, onViewPolicy }) {
2802
- const label = check2.id === "risk" ? check2.ok ? "Risk screening passed" : "Risk screening failed" : check2.label;
2891
+ const label2 = check2.id === "risk" ? check2.ok ? "Risk screening passed" : "Risk screening failed" : check2.label;
2803
2892
  return /* @__PURE__ */ jsxs("li", { className: "sg-cp-check", "data-ok": check2.ok, children: [
2804
2893
  /* @__PURE__ */ jsxs("div", { className: "sg-cp-check-head", children: [
2805
2894
  /* @__PURE__ */ jsxs("span", { className: "sg-cp-check-label", children: [
2806
2895
  /* @__PURE__ */ jsx("span", { className: "sg-cp-check-mark", "data-ok": check2.ok, children: check2.ok ? /* @__PURE__ */ jsx(Tick, {}) : /* @__PURE__ */ jsx(Cross, {}) }),
2807
- /* @__PURE__ */ jsx("span", { children: label }),
2896
+ /* @__PURE__ */ jsx("span", { children: label2 }),
2808
2897
  /* @__PURE__ */ jsx("span", { className: "sg-sr-only", children: check2.ok ? " \u2014 passed" : " \u2014 failed" })
2809
2898
  ] }),
2810
2899
  check2.id === "risk" ? /* @__PURE__ */ jsxs("button", { type: "button", className: "sg-cp-link", onClick: onViewPolicy, children: [
@@ -2872,9 +2961,9 @@ function QuoteChecks({
2872
2961
  ] }) : null
2873
2962
  ] });
2874
2963
  }
2875
- function Fact({ label, value, title, mono = false }) {
2964
+ function Fact({ label: label2, value, title, mono = false }) {
2876
2965
  return /* @__PURE__ */ jsxs("div", { className: "sg-cp-fact", children: [
2877
- /* @__PURE__ */ jsx("dt", { children: label }),
2966
+ /* @__PURE__ */ jsx("dt", { children: label2 }),
2878
2967
  /* @__PURE__ */ jsx("dd", { title, className: mono ? "sg-mono" : void 0, children: value })
2879
2968
  ] });
2880
2969
  }
@@ -3003,6 +3092,39 @@ function useTxHistory(account) {
3003
3092
  }, [account]);
3004
3093
  return entries;
3005
3094
  }
3095
+ var WALLET_HISTORY_REFRESH_MS = 3e4;
3096
+ var hidden2 = () => typeof document !== "undefined" && document.visibilityState === "hidden";
3097
+ var travelling = (entries) => !!entries?.some((e) => e.delivery === "in-progress" || e.delivery === "attention");
3098
+ function useWalletHistory(engine, wallets) {
3099
+ const [entries, setEntries] = useState(null);
3100
+ const key = wallets.filter((w) => !!w).join("|");
3101
+ useEffect(() => {
3102
+ setEntries(null);
3103
+ if (!engine || !key) return;
3104
+ let alive = true;
3105
+ let timer2;
3106
+ const read = async () => {
3107
+ if (timer2) clearTimeout(timer2);
3108
+ timer2 = void 0;
3109
+ if (!hidden2()) {
3110
+ const next = await engine.fetchWalletHistory(key.split("|"));
3111
+ if (!alive) return;
3112
+ if (next) setEntries(next);
3113
+ if (!travelling(next)) return;
3114
+ }
3115
+ timer2 = setTimeout(read, WALLET_HISTORY_REFRESH_MS);
3116
+ };
3117
+ void read();
3118
+ const onRecorded = () => void read();
3119
+ if (typeof window !== "undefined") window.addEventListener(TX_HISTORY_EVENT, onRecorded);
3120
+ return () => {
3121
+ alive = false;
3122
+ if (timer2) clearTimeout(timer2);
3123
+ if (typeof window !== "undefined") window.removeEventListener(TX_HISTORY_EVENT, onRecorded);
3124
+ };
3125
+ }, [engine, key]);
3126
+ return entries;
3127
+ }
3006
3128
  function BackGlyph() {
3007
3129
  return /* @__PURE__ */ jsxs("svg", { width: "17", height: "17", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.4", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
3008
3130
  /* @__PURE__ */ jsx("path", { d: "M19 12H5" }),
@@ -3086,7 +3208,15 @@ function TxLegs(props) {
3086
3208
  ] }, `${leg.index}:${leg.fromChainId}:${leg.toChainId}`)) })
3087
3209
  ] });
3088
3210
  }
3089
- function statusBadge(status) {
3211
+ function statusBadge(entry) {
3212
+ if (entry.delivery === "delivered")
3213
+ return /* @__PURE__ */ jsx("span", { className: "sg-badge", "data-tone": "ok", children: "Delivered" });
3214
+ if (entry.delivery === "failed")
3215
+ return /* @__PURE__ */ jsx("span", { className: "sg-badge", "data-tone": "warn", children: "Not delivered" });
3216
+ if (entry.delivery === "attention")
3217
+ return /* @__PURE__ */ jsx("span", { className: "sg-badge", "data-tone": "warn", children: "Needs action" });
3218
+ if (entry.delivery === "in-progress") return /* @__PURE__ */ jsx("span", { className: "sg-badge", children: "On its way" });
3219
+ const status = entry.status;
3090
3220
  if (status === "confirmed")
3091
3221
  return /* @__PURE__ */ jsx("span", { className: "sg-badge", "data-tone": "ok", children: "Confirmed" });
3092
3222
  if (status === "error")
@@ -3158,7 +3288,7 @@ function TxHistoryList(props) {
3158
3288
  ] }),
3159
3289
  whenLabel(e.at) ? /* @__PURE__ */ jsx("span", { className: "sg-txrow-time", children: whenLabel(e.at) }) : null
3160
3290
  ] }),
3161
- /* @__PURE__ */ jsx("span", { className: "sg-txrow-end", children: statusBadge(e.status) })
3291
+ /* @__PURE__ */ jsx("span", { className: "sg-txrow-end", children: statusBadge(e) })
3162
3292
  ] })
3163
3293
  ] }, `${e.hash}:${e.at}`)
3164
3294
  )) });
@@ -3198,7 +3328,7 @@ function TxDetail(props) {
3198
3328
  /* @__PURE__ */ jsxs("div", { className: "sg-meta", children: [
3199
3329
  /* @__PURE__ */ jsxs("div", { className: "sg-meta-row", children: [
3200
3330
  /* @__PURE__ */ jsx("span", { className: "sg-meta-label", children: "Status" }),
3201
- statusBadge(e.status)
3331
+ statusBadge(e)
3202
3332
  ] }),
3203
3333
  /* @__PURE__ */ jsxs("div", { className: "sg-meta-row", children: [
3204
3334
  /* @__PURE__ */ jsx("span", { className: "sg-meta-label", children: "You sent" }),
@@ -3234,18 +3364,21 @@ function displayableHistory(entries, account) {
3234
3364
  }
3235
3365
  function TxHistoryPanel(props) {
3236
3366
  const account = props.account;
3237
- const entries = displayableHistory(useTxHistory(account), account);
3238
- const deepLink = props.initialEntry && displayableHistory([props.initialEntry], account).length ? props.initialEntry : null;
3239
- const [selected, setSelected] = useState(deepLink);
3367
+ const stored = useTxHistory(account);
3368
+ const remote = useWalletHistory(props.engine, [account, props.solanaAccount]);
3369
+ const entries = useMemo(() => mergeHistory(displayableHistory(stored, account), remote), [stored, account, remote]);
3370
+ const linked = props.initialEntry && displayableHistory([props.initialEntry], account).length ? props.initialEntry : null;
3371
+ const [selectedHash, setSelectedHash] = useState(linked?.hash ?? null);
3372
+ const selected = selectedHash ? entries.find((e) => e.hash === selectedHash) ?? (linked?.hash === selectedHash ? linked : null) : null;
3240
3373
  const backRef = useRef(null);
3241
- useEffect(() => setSelected(deepLink), [deepLink]);
3374
+ useEffect(() => setSelectedHash(linked?.hash ?? null), [linked?.hash]);
3242
3375
  const pick = (entry) => {
3243
- setSelected(entry);
3376
+ setSelectedHash(entry.hash);
3244
3377
  requestAnimationFrame(() => backRef.current?.focus());
3245
3378
  };
3246
3379
  return /* @__PURE__ */ jsxs("div", { children: [
3247
3380
  /* @__PURE__ */ jsxs("div", { className: "sg-sel-head", children: [
3248
- /* @__PURE__ */ jsx("button", { type: "button", autoFocus: true, ref: backRef, className: "sg-back", onClick: selected ? () => setSelected(null) : props.onBack, "aria-label": "Back", children: /* @__PURE__ */ jsx(BackGlyph, {}) }),
3381
+ /* @__PURE__ */ jsx("button", { type: "button", autoFocus: true, ref: backRef, className: "sg-back", onClick: selected ? () => setSelectedHash(null) : props.onBack, "aria-label": "Back", children: /* @__PURE__ */ jsx(BackGlyph, {}) }),
3249
3382
  /* @__PURE__ */ jsxs("div", { className: "sg-sel-title", children: [
3250
3383
  selected ? "Transaction" : "Transaction history",
3251
3384
  account ? /* @__PURE__ */ jsx("span", { className: "sg-sel-sub sg-mono", children: shortAddress(account) }) : null
@@ -4334,6 +4467,9 @@ function PaymentIsland(props) {
4334
4467
  const selectedVisible = Boolean(sel && visibleRoutes.some((r) => r.id === sel.id));
4335
4468
  const selBal = sel ? holdings.balances[balanceKey(sel.source.chainId, sel.source.tokenAddress)] : void 0;
4336
4469
  const lastTxOwned = Boolean(flow.lastTxEntry?.hash && wallet.account && flow.lastTxEntry.account === wallet.account.toLowerCase());
4470
+ const evmDirect = flow.lastTxEntry?.settlement === "direct";
4471
+ const evmConfirmed = flow.verdict?.status === "confirmed";
4472
+ const evmDelivery = useDelivery(engine, (flow.status === "success" || flow.status === "pending") && !evmDirect ? flow.txHash : null);
4337
4473
  const mismatch = flow.status === "error" && flow.verdict?.status === "mismatch";
4338
4474
  const destTicker = isPay ? tickerOn(registryTokens, props.toChainId, props.toAsset ?? "") : exToToken ? tokenTicker(exToToken) : exToAsset ?? "";
4339
4475
  const exFromTicker = exFromToken ? tokenTicker(exFromToken) : exFromAsset ?? "";
@@ -4391,7 +4527,11 @@ function PaymentIsland(props) {
4391
4527
  linkMenu
4392
4528
  ] }) : void 0;
4393
4529
  const activeStep = flow.steps.find((s) => s.state === "active");
4394
- 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." : "";
4530
+ 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" ? (
4531
+ // Announces what the receipt shows: delivery from the tracker, never settlement on the
4532
+ // source receipt alone (review 2026-10-28).
4533
+ `${isPay ? "Payment" : verb.past}: ${deliveryHeadline(evmDelivery, evmConfirmed, evmDirect)}.`
4534
+ ) : "";
4395
4535
  const loading = flow.status === "loading";
4396
4536
  const payReady = isPay ? Boolean(sel && selectedVisible) : Boolean(sel) && !needsRecipient;
4397
4537
  const ctaLabel = submitting ? isPay ? "Paying\u2026" : kind === "swap" ? "Swapping\u2026" : "Exchanging\u2026" : flow.quoteStale ? flow.quotePaused ? "Refresh quote" : "Refreshing quote\u2026" : flow.insufficient ? "Insufficient balance" : flow.nativeShortfall ? flow.nativeShortfall : loading ? "Getting a price\u2026" : isPay ? sel && selectedVisible ? `Pay ${sel.source.payAmount} ${sel.source.ticker || sel.source.asset}` : "Pay" : kind === "swap" ? "Swap" : "Exchange";
@@ -4436,7 +4576,7 @@ function PaymentIsland(props) {
4436
4576
  ] });
4437
4577
  let body;
4438
4578
  if (hist && wallet.account) {
4439
- body = /* @__PURE__ */ jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
4579
+ body = /* @__PURE__ */ jsx(TxHistoryPanel, { account: wallet.account, engine, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
4440
4580
  } else if (isPay && view === "select" && wallet.account) {
4441
4581
  body = /* @__PURE__ */ jsx(
4442
4582
  TokenSelect,
@@ -4514,7 +4654,7 @@ function PaymentIsland(props) {
4514
4654
  ] })
4515
4655
  ] });
4516
4656
  } else if (paid || settling) {
4517
- const confirmed = flow.verdict?.status === "confirmed";
4657
+ const confirmed = isDelivered(evmDelivery, evmConfirmed, evmDirect);
4518
4658
  body = /* @__PURE__ */ jsxs(Fragment, { children: [
4519
4659
  /* @__PURE__ */ jsx(IdentityLine, { account: wallet.account, email: identity?.email }),
4520
4660
  /* @__PURE__ */ jsxs("div", { className: "sg-receipt", children: [
@@ -4526,9 +4666,10 @@ function PaymentIsland(props) {
4526
4666
  destTicker
4527
4667
  ] }),
4528
4668
  /* @__PURE__ */ jsxs("div", { className: "sg-receipt-sub", children: [
4529
- confirmed ? "Confirmed on-chain" : "Confirmation pending",
4669
+ deliveryHeadline(evmDelivery, evmConfirmed, evmDirect),
4530
4670
  (flow.lastTxEntry?.recipient || recipient) && (isPay || recipientState.recipientFamily === "solana") ? ` \xB7 ${shortAddress(flow.lastTxEntry?.recipient || recipient)}` : ""
4531
- ] })
4671
+ ] }),
4672
+ evmDirect ? null : /* @__PURE__ */ jsx(DeliverySteps, { delivery: evmDelivery })
4532
4673
  ] }),
4533
4674
  !identityMatchesWallet ? /* @__PURE__ */ jsxs("div", { className: "sg-remember", children: [
4534
4675
  /* @__PURE__ */ jsxs("label", { className: "sg-remember-top", children: [
@@ -4953,6 +5094,9 @@ function PayCard(props) {
4953
5094
  };
4954
5095
  useEffect(() => setHist(null), [wallet.account]);
4955
5096
  const lastTxOwned = Boolean(flow.lastTxEntry?.hash && wallet.account && flow.lastTxEntry.account === wallet.account.toLowerCase());
5097
+ const evmDirect = flow.lastTxEntry?.settlement === "direct";
5098
+ const evmConfirmed = flow.verdict?.status === "confirmed";
5099
+ const evmDelivery = useDelivery(engine, (flow.status === "success" || flow.status === "pending") && !evmDirect ? flow.txHash : null);
4956
5100
  const pickFunding = (pick) => {
4957
5101
  setPickError(null);
4958
5102
  const r = visibleRoutes.find((x) => x.source.chainId === pick.chainId && symbolKey(x.source.asset) === symbolKey(pick.symbol));
@@ -5012,7 +5156,7 @@ function PayCard(props) {
5012
5156
  ...durationLabel(sel.quote.estimatedDuration) ? [{ label: "Estimated time", value: durationLabel(sel.quote.estimatedDuration) }] : []
5013
5157
  ] : [];
5014
5158
  const loadingPlan = flow.status === "loading" || holdings.loading && !sel || pricing !== null;
5015
- return /* @__PURE__ */ jsx(WidgetShell, { title: config.title || "Complete payment", theme: config.theme, heightPx: props.heightPx, walletSlot, onClose: props.onClose, children: hist && wallet.account ? /* @__PURE__ */ jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory }) : view === "select" && wallet.account ? /* @__PURE__ */ jsx(
5159
+ return /* @__PURE__ */ jsx(WidgetShell, { title: config.title || "Complete payment", theme: config.theme, heightPx: props.heightPx, walletSlot, onClose: props.onClose, children: hist && wallet.account ? /* @__PURE__ */ jsx(TxHistoryPanel, { account: wallet.account, engine, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory }) : view === "select" && wallet.account ? /* @__PURE__ */ jsx(
5016
5160
  TokenSelect,
5017
5161
  {
5018
5162
  title: "Pay with",
@@ -5034,17 +5178,18 @@ function PayCard(props) {
5034
5178
  ] })
5035
5179
  ] }) : flow.status === "success" || flow.status === "pending" ? /* @__PURE__ */ jsxs(Fragment, { children: [
5036
5180
  /* @__PURE__ */ jsxs("div", { className: "sg-success", children: [
5037
- /* @__PURE__ */ jsx("div", { className: "sg-success-check", "data-pending": flow.verdict?.status !== "confirmed", children: /* @__PURE__ */ jsx(CheckGlyph3, {}) }),
5181
+ /* @__PURE__ */ jsx("div", { className: "sg-success-check", "data-pending": !isDelivered(evmDelivery, evmConfirmed, evmDirect), children: /* @__PURE__ */ jsx(CheckGlyph3, {}) }),
5038
5182
  /* @__PURE__ */ jsxs("div", { className: "sg-success-amt sg-mono", children: [
5039
5183
  props.amount,
5040
5184
  " ",
5041
5185
  tickerOn(registryTokens, props.toChainId, props.toAsset)
5042
5186
  ] }),
5043
- /* @__PURE__ */ jsxs("div", { className: "sg-success-sub", children: [
5044
- flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
5187
+ /* @__PURE__ */ jsxs("div", { className: "sg-success-sub", role: "status", "aria-live": "polite", children: [
5188
+ deliveryHeadline(evmDelivery, evmConfirmed, evmDirect),
5045
5189
  " \xB7 ",
5046
5190
  shortAddress(props.recipient)
5047
- ] })
5191
+ ] }),
5192
+ evmDirect ? null : /* @__PURE__ */ jsx(DeliverySteps, { delivery: evmDelivery })
5048
5193
  ] }),
5049
5194
  lastTxOwned ? /* @__PURE__ */ jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => setHist({ entry: flow.lastTxEntry }), children: "View transaction" }) }) : null
5050
5195
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -5196,28 +5341,32 @@ function StableGenieSwap(props) {
5196
5341
  };
5197
5342
  }, [engine, props.variant, hist]);
5198
5343
  const lastTxOwned = Boolean(flow.lastTxEntry?.hash && wallet.account && flow.lastTxEntry.account === wallet.account.toLowerCase());
5344
+ const evmDirect = flow.lastTxEntry?.settlement === "direct";
5345
+ const evmConfirmed = flow.verdict?.status === "confirmed";
5346
+ const evmDelivery = useDelivery(engine, (flow.status === "success" || flow.status === "pending") && !evmDirect ? flow.txHash : null);
5199
5347
  if (props.variant === "pill") return /* @__PURE__ */ jsx(PaymentIsland, { kind: "swap", ...props });
5200
5348
  const walletSlot = wallet.account ? /* @__PURE__ */ jsxs("div", { className: "sg-head-tools", children: [
5201
5349
  /* @__PURE__ */ jsx(HistoryButton, { btnRef: histBtnRef, disabled: submitting, onClick: () => setHist({}) }),
5202
5350
  /* @__PURE__ */ jsx("div", { className: "sg-brand", children: "ZeroDelta" })
5203
5351
  ] }) : void 0;
5204
5352
  if (hist && wallet.account) {
5205
- return /* @__PURE__ */ jsx(WidgetShell, { title: config.title || "Swap", theme: config.theme, walletSlot, children: /* @__PURE__ */ jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory }) });
5353
+ return /* @__PURE__ */ jsx(WidgetShell, { title: config.title || "Swap", theme: config.theme, walletSlot, children: /* @__PURE__ */ jsx(TxHistoryPanel, { account: wallet.account, engine, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory }) });
5206
5354
  }
5207
5355
  if (recipientState.open) return /* @__PURE__ */ jsx(WidgetShell, { title: config.title || "Swap", theme: config.theme, walletSlot, children: /* @__PURE__ */ jsx(RecipientSheet, { state: recipientState, symbol: toAsset }) });
5208
5356
  if (flow.status === "success" || flow.status === "pending") {
5209
5357
  return /* @__PURE__ */ jsxs(WidgetShell, { title: config.title || "Swap", theme: config.theme, walletSlot, children: [
5210
5358
  /* @__PURE__ */ jsxs("div", { className: "sg-success", children: [
5211
- /* @__PURE__ */ jsx("div", { className: "sg-success-check", "data-pending": flow.verdict?.status !== "confirmed", children: /* @__PURE__ */ jsx(CheckGlyph4, {}) }),
5359
+ /* @__PURE__ */ jsx("div", { className: "sg-success-check", "data-pending": !isDelivered(evmDelivery, evmConfirmed, evmDirect), children: /* @__PURE__ */ jsx(CheckGlyph4, {}) }),
5212
5360
  /* @__PURE__ */ jsxs("div", { className: "sg-success-amt sg-mono", children: [
5213
5361
  receive,
5214
5362
  " ",
5215
5363
  tickerOn(registryTokens, toChainId, toAsset)
5216
5364
  ] }),
5217
- /* @__PURE__ */ jsxs("div", { className: "sg-success-sub", children: [
5218
- flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
5365
+ /* @__PURE__ */ jsxs("div", { className: "sg-success-sub", role: "status", "aria-live": "polite", children: [
5366
+ deliveryHeadline(evmDelivery, evmConfirmed, evmDirect),
5219
5367
  recipientState.recipientFamily === "solana" ? ` \xB7 ${shortAddress(flow.lastTxEntry?.recipient || recipient)}` : props.recipient ? ` \xB7 ${shortAddress(props.recipient)}` : ""
5220
- ] })
5368
+ ] }),
5369
+ evmDirect ? null : /* @__PURE__ */ jsx(DeliverySteps, { delivery: evmDelivery })
5221
5370
  ] }),
5222
5371
  lastTxOwned ? /* @__PURE__ */ jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => setHist({ entry: flow.lastTxEntry }), children: "View transaction" }) }) : null
5223
5372
  ] });
@@ -5728,6 +5877,10 @@ function ExchangeCard(props) {
5728
5877
  const addressed = connected2 && !needsRecipient;
5729
5878
  const submitting = solActive ? solFlow.status === "preparing" || solFlow.status === "submitting" : flow.status === "submitting";
5730
5879
  const lastTxOwned = Boolean(flow.lastTxEntry?.hash && wallet.account && flow.lastTxEntry.account === wallet.account.toLowerCase());
5880
+ const evmDirect = flow.lastTxEntry?.settlement === "direct";
5881
+ const evmConfirmed = flow.verdict?.status === "confirmed";
5882
+ const evmDelivery = useDelivery(engine, (flow.status === "success" || flow.status === "pending") && !evmDirect ? flow.txHash : null);
5883
+ const solDelivery = useDelivery(engine, solActive && solFlow.status === "sent" ? solFlow.signature : null);
5731
5884
  const quoting = solActive ? solFlow.status === "quoting" : addressed ? flow.status === "loading" : preview.status === "loading";
5732
5885
  const quoteError = !quotable ? null : solActive ? solFlow.status === "error" || solFlow.status === "failed" ? solFlow.error : null : addressed ? flow.status === "error" ? flow.error : null : preview.status === "error" ? preview.error ?? "No route." : null;
5733
5886
  const gatewayAmountError = !quoteError || solActive ? null : addressed ? flow.fieldError : preview.fieldError ?? null;
@@ -5772,8 +5925,8 @@ function ExchangeCard(props) {
5772
5925
  const rateRows = hasQuote ? [{ label: "Network fee", value: networkFee }, ...eta ? [{ label: "Estimated time", value: eta }] : []] : [];
5773
5926
  const via = selected ? selected.legs.length > 1 ? selected.legs[0]?.toTicker || selected.legs[0]?.toAsset || "" : null : preview.data?.via ?? null;
5774
5927
  const routeShape = via === null ? "Direct" : via ? `Via ${via}` : "Two steps";
5775
- const compliance = selected?.quote.compliance;
5776
- const complianceHasQuote = Boolean(selected && flow.status !== "loading");
5928
+ const compliance = solActive ? solanaQuoteCompliance(solFlow.plan?.preview.quote) : selected?.quote.compliance;
5929
+ const complianceHasQuote = solActive ? Boolean(solFlow.plan && solFlow.status !== "quoting") : Boolean(selected && flow.status !== "loading");
5777
5930
  const fromUsd = usdOf2(normalizedAmount, prices[from?.symbol ?? ""]);
5778
5931
  const toUsd = usdOf2(receive, prices[to?.symbol ?? ""]);
5779
5932
  const flippable = !rampMode && !submitting && Boolean(to && sourceTokens.some((t) => Number(t.chainId) === to.chainId && symbolKey(t.symbol) === to.symbol));
@@ -5873,10 +6026,17 @@ function ExchangeCard(props) {
5873
6026
  children: solFlow.status === "preparing" ? "Preparing order\u2026" : solFlow.status === "submitting" ? "Submitting\u2026" : solFlow.insufficient ? "Insufficient balance" : solFlow.solShort ? "Not enough SOL for network fees" : solFlow.status === "failed" ? "Try again" : !solFlow.plan ? "Exchange" : solFlow.needsPreparation ? "Continue in wallet" : "Submit"
5874
6027
  }
5875
6028
  );
5876
- const solanaSteps = solActive && solFlow.plan && connected2 && solanaWallet.address ? /* @__PURE__ */ jsx("p", { className: "sg-cp-summary-sub", style: { textAlign: "center", margin: "0 0 8px" }, "data-testid": "solana-steps", children: solFlow.needsPreparation || solFlow.status === "preparing" ? "Prepare order \xB7 Submit \xB7 Track" : solFlow.status === "prepared" ? "Prepare order \u2713 \xB7 Submit \xB7 Track" : "Submit \xB7 Track" }) : null;
6029
+ const solanaSteps = solActive && solFlow.plan && connected2 && solanaWallet.address && solFlow.solShort && solFlow.cost ? /* @__PURE__ */ jsxs("p", { className: "sg-cp-summary-sub", style: { textAlign: "center", margin: "0 0 8px" }, "data-testid": "sol-shortfall", children: [
6030
+ "This order needs about ",
6031
+ (solFlow.cost.lamports / 1e9).toFixed(4),
6032
+ " SOL for network fees and rent; the wallet holds",
6033
+ " ",
6034
+ (solFlow.cost.balanceLamports / 1e9).toFixed(4),
6035
+ " SOL."
6036
+ ] }) : null;
5877
6037
  let body;
5878
6038
  if (hist && connected2) {
5879
- body = /* @__PURE__ */ jsx(TxHistoryPanel, { account: wallet.account, tokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
6039
+ body = /* @__PURE__ */ jsx(TxHistoryPanel, { account: wallet.account, engine, solanaAccount: solanaWallet.address, tokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
5880
6040
  } else if (view === "from" || view === "to") {
5881
6041
  const isFrom = view === "from";
5882
6042
  body = /* @__PURE__ */ jsx(
@@ -5903,16 +6063,17 @@ function ExchangeCard(props) {
5903
6063
  } else if (solActive && solFlow.status === "sent") {
5904
6064
  body = /* @__PURE__ */ jsxs(Fragment, { children: [
5905
6065
  /* @__PURE__ */ jsxs("div", { className: "sg-success", children: [
5906
- /* @__PURE__ */ jsx("div", { className: "sg-success-check", "data-pending": "true", children: /* @__PURE__ */ jsx(CheckGlyph5, {}) }),
6066
+ /* @__PURE__ */ jsx("div", { className: "sg-success-check", "data-pending": !isDelivered(solDelivery, false), children: /* @__PURE__ */ jsx(CheckGlyph5, {}) }),
5907
6067
  /* @__PURE__ */ jsxs("div", { className: "sg-success-amt sg-mono", children: [
5908
6068
  solFlow.sent?.receive ?? receive,
5909
6069
  " ",
5910
6070
  solFlow.sent?.toTicker ?? toTicker
5911
6071
  ] }),
5912
- /* @__PURE__ */ jsxs("div", { className: "sg-success-sub", children: [
5913
- "Submitted on Solana \u2014 ZeroDelta delivers it",
6072
+ /* @__PURE__ */ jsxs("div", { className: "sg-success-sub", role: "status", "aria-live": "polite", children: [
6073
+ solDelivery.phase === "tracking" ? "Submitted on Solana \u2014 tracking delivery" : deliveryHeadline(solDelivery, true),
5914
6074
  solFlow.sent?.recipient ? ` \xB7 ${shortAddress(solFlow.sent.recipient)}` : ""
5915
- ] })
6075
+ ] }),
6076
+ /* @__PURE__ */ jsx(DeliverySteps, { delivery: solDelivery })
5916
6077
  ] }),
5917
6078
  /* @__PURE__ */ jsxs("div", { className: "sg-cta-wrap", children: [
5918
6079
  solFlow.signature ? /* @__PURE__ */ jsx("a", { className: "sg-btn sg-btn-ghost", href: `https://solscan.io/tx/${solFlow.signature}`, target: "_blank", rel: "noopener noreferrer", children: "View on Solscan" }) : null,
@@ -5923,16 +6084,17 @@ function ExchangeCard(props) {
5923
6084
  } else if (flow.status === "success" || flow.status === "pending") {
5924
6085
  body = /* @__PURE__ */ jsxs(Fragment, { children: [
5925
6086
  /* @__PURE__ */ jsxs("div", { className: "sg-success", children: [
5926
- /* @__PURE__ */ jsx("div", { className: "sg-success-check", "data-pending": flow.verdict?.status !== "confirmed", children: /* @__PURE__ */ jsx(CheckGlyph5, {}) }),
6087
+ /* @__PURE__ */ jsx("div", { className: "sg-success-check", "data-pending": !isDelivered(evmDelivery, evmConfirmed, evmDirect), children: /* @__PURE__ */ jsx(CheckGlyph5, {}) }),
5927
6088
  /* @__PURE__ */ jsxs("div", { className: "sg-success-amt sg-mono", children: [
5928
6089
  receive,
5929
6090
  " ",
5930
6091
  toTicker
5931
6092
  ] }),
5932
- /* @__PURE__ */ jsxs("div", { className: "sg-success-sub", children: [
5933
- flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
6093
+ /* @__PURE__ */ jsxs("div", { className: "sg-success-sub", role: "status", "aria-live": "polite", children: [
6094
+ deliveryHeadline(evmDelivery, evmConfirmed, evmDirect),
5934
6095
  recipientState.recipientFamily === "solana" ? ` \xB7 ${shortAddress(flow.lastTxEntry?.recipient || recipient)}` : props.recipient ? ` \xB7 ${shortAddress(props.recipient)}` : ""
5935
- ] })
6096
+ ] }),
6097
+ evmDirect ? null : /* @__PURE__ */ jsx(DeliverySteps, { delivery: evmDelivery })
5936
6098
  ] }),
5937
6099
  /* @__PURE__ */ jsxs("div", { className: "sg-cta-wrap", children: [
5938
6100
  lastTxOwned ? /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => setHist({ entry: flow.lastTxEntry }), children: "View transaction" }) : null,