@glacislabs/stablegenie-zerodelta 4.13.0 → 4.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -573,6 +573,134 @@ var init_ed255192 = __esm({
573
573
  "src/core/ed25519.ts"() {
574
574
  }
575
575
  });
576
+
577
+ // src/core/delivery.ts
578
+ var FAILED = /* @__PURE__ */ new Set(["cancelled", "fill_failed", "delivery_failed", "expired", "failed"]);
579
+ var ATTENTION = /* @__PURE__ */ new Set(["cancel_pending", "awaiting_claim"]);
580
+ var TRACKING = Object.freeze({ phase: "tracking", status: "", steps: [] });
581
+ var word = (v) => typeof v === "string" ? v.trim().toLowerCase() : "";
582
+ function normalizeDelivery(raw2) {
583
+ const row = raw2 && typeof raw2 === "object" && !Array.isArray(raw2) ? raw2.data ?? raw2 : null;
584
+ if (!row || typeof row !== "object" || Array.isArray(row)) return TRACKING;
585
+ const r = row;
586
+ const chained = r.isChained === true || Array.isArray(r.legs) && r.legs.length > 1;
587
+ const journey = word(r.journeyStatus);
588
+ const own = word(r.status);
589
+ const status = journey || own;
590
+ const rawSteps = Array.isArray(r.steps) ? r.steps : [];
591
+ const steps = rawSteps.filter((s) => s && typeof s === "object" && typeof s.stepName === "string").sort((a, b) => Number(a.stepNumber ?? 0) - Number(b.stepNumber ?? 0)).slice(0, 8).map((s) => ({ name: String(s.stepName).slice(0, 32), done: s.stepStatus === "completed" }));
592
+ if (!status) return TRACKING;
593
+ if (FAILED.has(status)) return { phase: "failed", status, steps };
594
+ if (ATTENTION.has(status)) return { phase: "attention", status, steps };
595
+ if (status === "delivered" && !(chained && !journey)) return { phase: "delivered", status, steps: steps.map((s) => ({ ...s, done: true })) };
596
+ return { phase: "in-progress", status: status === "delivered" ? "continuing" : status, steps };
597
+ }
598
+ var HASH = /^(?:0x[0-9a-fA-F]{64}|[1-9A-HJ-NP-Za-km-z]{64,88})$/;
599
+ function sameOrder(raw2, hash2) {
600
+ const row = raw2 && typeof raw2 === "object" ? raw2.data ?? raw2 : null;
601
+ const got = row && typeof row === "object" ? row.txHash : void 0;
602
+ if (typeof got !== "string" || !got) return false;
603
+ return hash2.startsWith("0x") ? got.toLowerCase() === hash2.toLowerCase() : got === hash2;
604
+ }
605
+ async function fetchDelivery(api, hash2) {
606
+ if (typeof hash2 !== "string" || !HASH.test(hash2)) return TRACKING;
607
+ try {
608
+ const raw2 = await api.apiRequest(`/transactions/${hash2}`, { timeoutMs: 8e3 });
609
+ return sameOrder(raw2, hash2) ? normalizeDelivery(raw2) : TRACKING;
610
+ } catch {
611
+ return TRACKING;
612
+ }
613
+ }
614
+
615
+ // src/react/hooks/useDelivery.ts
616
+ function deliveryPollDelay(elapsedMs) {
617
+ if (elapsedMs < 6e4) return 5e3;
618
+ if (elapsedMs < 11 * 6e4) return 15e3;
619
+ return 3e4;
620
+ }
621
+ var DELIVERY_GIVE_UP_MS = 2 * 60 * 60 * 1e3;
622
+ var UNANSWERED_LIMIT = 20;
623
+ var UNAVAILABLE = Object.freeze({ phase: "unavailable", status: "", steps: [] });
624
+ var hidden = () => typeof document !== "undefined" && document.visibilityState === "hidden";
625
+ function useDelivery(engine, hash2) {
626
+ const [state, setState] = react.useState({ hash: null, value: TRACKING });
627
+ react.useEffect(() => {
628
+ if (!hash2) return;
629
+ let alive = true;
630
+ let timer2;
631
+ let answered = false;
632
+ let unanswered = 0;
633
+ const started2 = Date.now();
634
+ setState({ hash: hash2, value: TRACKING });
635
+ const schedule = () => {
636
+ if (Date.now() - started2 > DELIVERY_GIVE_UP_MS) return setState({ hash: hash2, value: UNAVAILABLE });
637
+ timer2 = setTimeout(tick, deliveryPollDelay(Date.now() - started2));
638
+ };
639
+ const tick = async () => {
640
+ timer2 = void 0;
641
+ if (hidden()) return schedule();
642
+ const next = await engine.trackDelivery(hash2);
643
+ if (!alive) return;
644
+ if (next.phase === "tracking") {
645
+ if (!answered && ++unanswered >= UNANSWERED_LIMIT) return setState({ hash: hash2, value: UNAVAILABLE });
646
+ return schedule();
647
+ }
648
+ answered = true;
649
+ setState({ hash: hash2, value: next });
650
+ if (next.phase === "delivered" || next.phase === "failed") return;
651
+ schedule();
652
+ };
653
+ const onVisible2 = () => {
654
+ if (!alive || hidden() || !timer2) return;
655
+ clearTimeout(timer2);
656
+ void tick();
657
+ };
658
+ void tick();
659
+ if (typeof document !== "undefined") document.addEventListener("visibilitychange", onVisible2);
660
+ return () => {
661
+ alive = false;
662
+ if (timer2) clearTimeout(timer2);
663
+ if (typeof document !== "undefined") document.removeEventListener("visibilitychange", onVisible2);
664
+ };
665
+ }, [engine, hash2]);
666
+ return state.hash === hash2 ? state.value : TRACKING;
667
+ }
668
+ var STEP_LABEL = {
669
+ submitted: "Submitted",
670
+ arrived: "Arrived",
671
+ filled: "Filled",
672
+ outbound_bridging: "Bridging",
673
+ delivered: "Delivered"
674
+ };
675
+ var label = (name) => STEP_LABEL[name] ?? name.replace(/_/g, " ");
676
+ function deliveryHeadline(delivery, sourceConfirmed, direct = false) {
677
+ if (direct) return sourceConfirmed ? "Delivered" : "Submitted \u2014 awaiting confirmation";
678
+ switch (delivery.phase) {
679
+ case "delivered":
680
+ return "Delivered";
681
+ case "failed":
682
+ return delivery.status === "cancelled" ? "Cancelled \u2014 not delivered" : `Not delivered (${delivery.status.replace(/_/g, " ")}) \u2014 open the transaction for details`;
683
+ case "attention":
684
+ return delivery.status === "cancel_pending" ? "Being cancelled \u2014 not delivered" : "Waiting to be claimed \u2014 open the transaction";
685
+ case "in-progress": {
686
+ if (delivery.status === "continuing") return "On its way \u2014 final leg next";
687
+ const next = delivery.steps.find((s) => !s.done);
688
+ return next ? `On its way \u2014 ${label(next.name).toLowerCase()} next` : "On its way";
689
+ }
690
+ case "unavailable":
691
+ return sourceConfirmed ? "Sent \u2014 open the transaction to follow delivery" : "Submitted \u2014 awaiting confirmation";
692
+ default:
693
+ return sourceConfirmed ? "Sent \u2014 tracking delivery" : "Submitted \u2014 awaiting confirmation";
694
+ }
695
+ }
696
+ function isDelivered(delivery, sourceConfirmed, direct = false) {
697
+ return direct ? sourceConfirmed : delivery.phase === "delivered";
698
+ }
699
+ function DeliverySteps(props) {
700
+ const { steps, phase } = props.delivery;
701
+ if (!steps.length || phase === "failed") return null;
702
+ return /* @__PURE__ */ jsxRuntime.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 ") });
703
+ }
576
704
  var ConfigContext = react.createContext({});
577
705
  function StableGenieProvider({ children, ...config }) {
578
706
  return /* @__PURE__ */ jsxRuntime.jsx(ConfigContext.Provider, { value: config, children });
@@ -1048,9 +1176,9 @@ function normalizeAddress(value) {
1048
1176
  if (!isAddress(value)) return null;
1049
1177
  return String(value).toLowerCase();
1050
1178
  }
1051
- function assertAddress(value, label) {
1179
+ function assertAddress(value, label2) {
1052
1180
  const normalized = normalizeAddress(value);
1053
- if (!normalized || normalized === ZERO_ADDRESS) throw new Error(`${label} is not a valid EVM address.`);
1181
+ if (!normalized || normalized === ZERO_ADDRESS) throw new Error(`${label2} is not a valid EVM address.`);
1054
1182
  return normalized;
1055
1183
  }
1056
1184
  function resolveSwapReceiver(recipient2, payer, destinationChainId) {
@@ -1068,8 +1196,8 @@ function chainAddressKey(chainId, value) {
1068
1196
  const text = String(value || "");
1069
1197
  return isSolanaChainId(chainId) ? text.trim() : text.toLowerCase();
1070
1198
  }
1071
- function assertChainAddress(chainId, value, label) {
1072
- if (!isSolanaChainId(chainId)) return assertAddress(value, label);
1199
+ function assertChainAddress(chainId, value, label2) {
1200
+ if (!isSolanaChainId(chainId)) return assertAddress(value, label2);
1073
1201
  if (!String(value || "").trim()) throw new Error("Connect a Solana wallet or enter a Solana recipient address.");
1074
1202
  if (!isSolanaAddress(value)) throw new Error("Not a valid Solana address.");
1075
1203
  return String(value).trim();
@@ -1145,9 +1273,9 @@ function encodeSubmitOrder(orders, partnerId = NO_PARTNER_ID) {
1145
1273
  const tuples = orders.map(encodeOrderTuple);
1146
1274
  let offset = 32n * BigInt(tuples.length);
1147
1275
  const offsets = tuples.map((tuple) => {
1148
- const word = uintWord(offset);
1276
+ const word2 = uintWord(offset);
1149
1277
  offset += BigInt(tuple.length / 2);
1150
- return word;
1278
+ return word2;
1151
1279
  }).join("");
1152
1280
  return `0x${SUBMIT_ORDER_SELECTOR.slice(2)}${uintWord(64)}${bytes32Word(partnerId)}${uintWord(tuples.length)}${offsets}${tuples.join("")}`;
1153
1281
  }
@@ -1158,21 +1286,21 @@ function decodeSubmitOrderCalldata(data) {
1158
1286
  if (`0x${hex.slice(0, 8)}` !== SUBMIT_ORDER_SELECTOR) return null;
1159
1287
  const body = hex.slice(8);
1160
1288
  const totalBytes = body.length / 2;
1161
- const word = (byteOffset) => {
1289
+ const word2 = (byteOffset) => {
1162
1290
  if (!Number.isSafeInteger(byteOffset) || byteOffset < 0 || byteOffset + 32 > totalBytes) return null;
1163
1291
  return BigInt(`0x${body.slice(byteOffset * 2, byteOffset * 2 + 64)}`);
1164
1292
  };
1165
1293
  const addressAt = (byteOffset) => {
1166
- const w = word(byteOffset);
1294
+ const w = word2(byteOffset);
1167
1295
  if (w === null || w >= 1n << 160n) return null;
1168
1296
  return `0x${w.toString(16).padStart(40, "0")}`;
1169
1297
  };
1170
1298
  const uint64At = (byteOffset) => {
1171
- const w = word(byteOffset);
1299
+ const w = word2(byteOffset);
1172
1300
  return w === null || w > MAX_UINT64 ? null : w;
1173
1301
  };
1174
1302
  const keyBytesAt = (byteOffset) => {
1175
- const len = word(byteOffset);
1303
+ const len = word2(byteOffset);
1176
1304
  if (len !== 20n && len !== 32n) return null;
1177
1305
  const length = Number(len);
1178
1306
  const padded = Math.ceil(length / 32) * 32;
@@ -1180,25 +1308,25 @@ function decodeSubmitOrderCalldata(data) {
1180
1308
  if (content.length !== padded * 2 || content.slice(length * 2) !== "0".repeat((padded - length) * 2)) return null;
1181
1309
  return { value: `0x${content.slice(0, length * 2)}`, size: 32 + padded };
1182
1310
  };
1183
- if (word(0) !== 64n) return null;
1184
- if (word(32) === null) return null;
1311
+ if (word2(0) !== 64n) return null;
1312
+ if (word2(32) === null) return null;
1185
1313
  const partnerId = `0x${body.slice(64, 128)}`;
1186
- const count = word(64);
1314
+ const count = word2(64);
1187
1315
  if (count === null || count < 1n || count > BigInt(MAX_DECODED_ORDERS)) return null;
1188
1316
  const n = Number(count);
1189
1317
  const arrayBase = 96;
1190
1318
  let next = arrayBase + 32 * n;
1191
1319
  const orders = [];
1192
1320
  for (let i = 0; i < n; i += 1) {
1193
- const rel = word(arrayBase + i * 32);
1321
+ const rel = word2(arrayBase + i * 32);
1194
1322
  if (rel === null || rel !== BigInt(next - arrayBase)) return null;
1195
1323
  const base = next;
1196
1324
  const owner = addressAt(base);
1197
1325
  const bidToken = addressAt(base + 32);
1198
- const bidTokenAmount = word(base + 64);
1199
- const askOffset = word(base + 96);
1200
- const askTokenAmount = word(base + 128);
1201
- const receiverOffset = word(base + 160);
1326
+ const bidTokenAmount = word2(base + 64);
1327
+ const askOffset = word2(base + 96);
1328
+ const askTokenAmount = word2(base + 128);
1329
+ const receiverOffset = word2(base + 160);
1202
1330
  const destinationChainId = uint64At(base + 192);
1203
1331
  const executionChainId = uint64At(base + 224);
1204
1332
  const deadline = uint64At(base + 256);
@@ -1821,8 +1949,8 @@ function freeze(value) {
1821
1949
  }
1822
1950
  return value;
1823
1951
  }
1824
- function raw(value, label, positive = false) {
1825
- if (typeof value !== "string" || !/^\d+$/.test(value) || positive && BigInt(value) <= 0n || BigInt(value) >= 1n << 256n) throw new Error(`Invalid ${label}.`);
1952
+ function raw(value, label2, positive = false) {
1953
+ if (typeof value !== "string" || !/^\d+$/.test(value) || positive && BigInt(value) <= 0n || BigInt(value) >= 1n << 256n) throw new Error(`Invalid ${label2}.`);
1826
1954
  return value;
1827
1955
  }
1828
1956
  function chain(value) {
@@ -1935,6 +2063,12 @@ async function previewSolanaSource(api, input) {
1935
2063
  nativeFeeRaw: "0"
1936
2064
  };
1937
2065
  }
2066
+ function solanaQuoteCompliance(quote) {
2067
+ for (const value of [quote?.complianceDecision, quote?.compliance]) {
2068
+ if (value && typeof value === "object" && !Array.isArray(value)) return value;
2069
+ }
2070
+ return void 0;
2071
+ }
1938
2072
  function denied(value) {
1939
2073
  return typeof value === "string" ? value.toUpperCase() === "DENY" : !!value && typeof value === "object" && denied(value.decision);
1940
2074
  }
@@ -2052,6 +2186,7 @@ function createSolanaRpc(api) {
2052
2186
  body: JSON.stringify({ jsonrpc: "2.0", id: 1, method, params }),
2053
2187
  timeoutMs: 15e3
2054
2188
  });
2189
+ if (body.error && solanaLamportShortfall(body.error.data?.logs) !== null) throw new Error(SOL_SHORTFALL_MESSAGE);
2055
2190
  if (body.error || body.result === void 0) throw new Error(body.error?.message || "Invalid Solana RPC response.");
2056
2191
  return body.result;
2057
2192
  };
@@ -2216,18 +2351,141 @@ async function readSolanaBalance(rpc, owner, mint) {
2216
2351
  return void 0;
2217
2352
  }
2218
2353
  }
2354
+ function solanaLamportShortfall(logs) {
2355
+ if (!Array.isArray(logs)) return null;
2356
+ for (const line of logs) {
2357
+ const m = /insufficient lamports (\d+), need (\d+)/.exec(String(line));
2358
+ if (m) {
2359
+ const need = Number(m[2]);
2360
+ return Number.isSafeInteger(need) && need > 0 ? need : null;
2361
+ }
2362
+ }
2363
+ return null;
2364
+ }
2365
+ var SOL_SHORTFALL_MESSAGE = "Not enough SOL in this wallet for the Solana network fee and account rent. Add a little SOL and try again.";
2219
2366
  async function simulateSolanaCost(rpc, plan) {
2220
2367
  checkSolanaPlan(plan.txData);
2221
2368
  const signer = plan.expected.signer;
2222
2369
  const before = await rpc("getAccountInfo", [signer, { encoding: "base64", commitment: "confirmed" }]);
2223
2370
  const sim = await rpc("simulateTransaction", [plan.txData[0].transaction, { encoding: "base64", sigVerify: false, replaceRecentBlockhash: true, accounts: { addresses: [signer], encoding: "base64" } }]);
2224
- if (sim.value?.err) throw new Error(`Simulation failed: ${JSON.stringify(sim.value.err)}`);
2225
2371
  const balanceLamports = before.value?.lamports ?? 0, post = sim.value?.accounts?.[0]?.lamports;
2372
+ if (sim.value?.err) {
2373
+ const need = solanaLamportShortfall(sim.value.logs);
2374
+ if (need !== null && Number.isSafeInteger(balanceLamports)) return { lamports: need, balanceLamports, sufficient: false };
2375
+ throw new Error(`Simulation failed: ${JSON.stringify(sim.value.err)}`);
2376
+ }
2226
2377
  if (!Number.isSafeInteger(balanceLamports) || balanceLamports < 0 || post !== void 0 && (!Number.isSafeInteger(post) || post < 0)) throw new Error("Invalid simulation lamports.");
2227
2378
  const lamports = typeof post === "number" ? Math.max(0, balanceLamports - post) : 0;
2228
2379
  return { lamports, balanceLamports, sufficient: balanceLamports >= lamports };
2229
2380
  }
2230
2381
 
2382
+ // src/core/history.ts
2383
+ var WALLET_HISTORY_LIMIT = 50;
2384
+ var HASH2 = /^(?:0x[0-9a-fA-F]{64}|[1-9A-HJ-NP-Za-km-z]{64,88})$/;
2385
+ var WALLET = /^(?:0x[0-9a-fA-F]{40}|[1-9A-HJ-NP-Za-km-z]{32,44})$/;
2386
+ function historyKey(value) {
2387
+ return value.startsWith("0x") ? value.toLowerCase() : value;
2388
+ }
2389
+ var str = (v) => typeof v === "string" ? v : typeof v === "number" ? String(v) : "";
2390
+ function tokenAt(tokens, chainId, address) {
2391
+ if (!address) return void 0;
2392
+ const key = historyKey(address);
2393
+ return tokens.find((t) => Number(t.chainId) === chainId && historyKey(String(t.address)) === key);
2394
+ }
2395
+ function amountOf(raw2, token, rowDecimals, rowAmount) {
2396
+ const decimals = token ? Number(token.decimals) : Number(rowDecimals);
2397
+ if (/^\d{1,78}$/.test(raw2) && Number.isInteger(decimals) && decimals > 0 && decimals <= 36) return formatUnits(raw2, decimals);
2398
+ return Number(rowDecimals) > 0 && /^\d+(?:\.\d+)?$/.test(rowAmount) ? rowAmount.slice(0, 40) : "";
2399
+ }
2400
+ function historyEntryFromOrder(raw2, tokens) {
2401
+ if (!raw2 || typeof raw2 !== "object" || Array.isArray(raw2)) return null;
2402
+ const r = raw2;
2403
+ const hash2 = str(r.txHash);
2404
+ if (!HASH2.test(hash2)) return null;
2405
+ const fromChainId = Number(r.sourceChainId) || 0;
2406
+ const toChainId = Number(r.finalDestChainId ?? r.destChainId) || 0;
2407
+ const from = tokenAt(tokens, fromChainId, str(r.fromTokenAddress));
2408
+ const toAddress = str(r.finalToTokenAddress) || str(r.toTokenAddress);
2409
+ const to = tokenAt(tokens, toChainId, toAddress);
2410
+ const fromAsset = (from?.symbol ?? str(r.fromTokenSymbol)).slice(0, 10);
2411
+ const toAsset = (to?.symbol ?? (str(r.finalToTokenSymbol) || str(r.toTokenSymbol))).slice(0, 10);
2412
+ const payAmount = amountOf(str(r.fromTokenRawAmount), from, r.fromTokenDecimals, str(r.fromTokenAmount));
2413
+ const receiveAmount = str(r.finalToTokenRawAmount) ? amountOf(str(r.finalToTokenRawAmount), to, r.finalToTokenDecimals, str(r.finalToTokenAmount)) : amountOf(str(r.toTokenRawAmount), to, r.toTokenDecimals, str(r.toTokenAmount));
2414
+ const delivery = normalizeDelivery(r).phase;
2415
+ const wallet = str(r.wallet);
2416
+ const receiver = str(r.destinationReceiver);
2417
+ const at = str(r.createdAt) || str(r.submittedAt);
2418
+ return {
2419
+ kind: "swap",
2420
+ hash: hash2,
2421
+ txKind: "submitOrder",
2422
+ chainId: fromChainId || null,
2423
+ chainName: "",
2424
+ fromAsset,
2425
+ toAsset,
2426
+ fromTicker: from ? tokenTicker(from).slice(0, 12) : void 0,
2427
+ toTicker: to ? tokenTicker(to).slice(0, 12) : void 0,
2428
+ payAmount,
2429
+ receiveAmount,
2430
+ account: WALLET.test(wallet) ? historyKey(wallet) : "",
2431
+ recipient: WALLET.test(receiver) ? receiver : "",
2432
+ settlement: "escrow",
2433
+ status: "submitted",
2434
+ at: Number.isNaN(Date.parse(at)) ? (/* @__PURE__ */ new Date(0)).toISOString() : new Date(at).toISOString(),
2435
+ delivery: delivery === "tracking" || delivery === "unavailable" ? void 0 : delivery,
2436
+ legs: [
2437
+ {
2438
+ index: 1,
2439
+ fromAsset,
2440
+ fromTicker: from ? tokenTicker(from).slice(0, 12) : void 0,
2441
+ fromChainId,
2442
+ fromChainName: "",
2443
+ fromAmount: payAmount,
2444
+ toAsset,
2445
+ toTicker: to ? tokenTicker(to).slice(0, 12) : void 0,
2446
+ toChainId,
2447
+ toChainName: "",
2448
+ toAmount: receiveAmount,
2449
+ executionChainId: Number(r.executionChainId) || 0,
2450
+ executionChainName: ""
2451
+ }
2452
+ ]
2453
+ };
2454
+ }
2455
+ async function fetchWalletHistory(api, wallets) {
2456
+ const asked = [...new Set(wallets.filter((w) => WALLET.test(w)).map(historyKey))];
2457
+ if (!asked.length) return [];
2458
+ const tokens = await api.fetchTokens().catch(() => []);
2459
+ const reads = await Promise.all(
2460
+ asked.map(async (wallet) => {
2461
+ try {
2462
+ const rows = await api.apiRequest(`/transactions?wallet=${encodeURIComponent(wallet)}&limit=${WALLET_HISTORY_LIMIT}`, { timeoutMs: 1e4 });
2463
+ if (!Array.isArray(rows)) return null;
2464
+ return rows.filter((row) => historyKey(str(row?.wallet)) === wallet).map((row) => historyEntryFromOrder(row, tokens));
2465
+ } catch {
2466
+ return null;
2467
+ }
2468
+ })
2469
+ );
2470
+ if (reads.every((read) => read === null)) return null;
2471
+ return reads.flatMap((read) => read ?? []).filter((e) => e !== null);
2472
+ }
2473
+ function mergeHistory(local, remote, limit = WALLET_HISTORY_LIMIT) {
2474
+ const byHash = /* @__PURE__ */ new Map();
2475
+ for (const entry of remote ?? []) if (!byHash.has(historyKey(entry.hash))) byHash.set(historyKey(entry.hash), entry);
2476
+ const out = [];
2477
+ const seen = /* @__PURE__ */ new Set();
2478
+ for (const entry of local) {
2479
+ const key = historyKey(entry.hash);
2480
+ if (seen.has(key)) continue;
2481
+ seen.add(key);
2482
+ const known = byHash.get(key);
2483
+ out.push(known ? { ...entry, delivery: known.delivery, legs: entry.legs ?? known.legs } : entry);
2484
+ }
2485
+ for (const [key, entry] of byHash) if (!seen.has(key)) out.push(entry);
2486
+ return out.sort((a, b) => Date.parse(b.at) - Date.parse(a.at)).slice(0, limit);
2487
+ }
2488
+
2231
2489
  // src/core/escrow.ts
2232
2490
  function checkEscrow(chainId, quoteEscrow, chainsEscrow) {
2233
2491
  const fromQuote = normalizeAddress(quoteEscrow);
@@ -2482,11 +2740,11 @@ function complianceView(compliance, hasQuote = true) {
2482
2740
  };
2483
2741
  }
2484
2742
  if (decision === "REVIEW" || decision === "REMEDIATE") {
2485
- const word = decision.toLowerCase();
2743
+ const word2 = decision.toLowerCase();
2486
2744
  return {
2487
2745
  tone: "warn",
2488
- label: `Compliance: ${word} required`,
2489
- headline: `Manual ${word} required`,
2746
+ label: `Compliance: ${word2} required`,
2747
+ headline: `Manual ${word2} required`,
2490
2748
  blocked: false,
2491
2749
  needsAction: true,
2492
2750
  screened
@@ -2736,8 +2994,8 @@ var BLOCK_CATEGORY_LABELS = {
2736
2994
  var BLOCK_LABEL_DEFAULT = "flagged by compliance screening";
2737
2995
  function blockLabelFor(categories) {
2738
2996
  for (const raw2 of categories) {
2739
- const label = BLOCK_CATEGORY_LABELS[String(raw2 || "").trim().toUpperCase()];
2740
- if (label) return label;
2997
+ const label2 = BLOCK_CATEGORY_LABELS[String(raw2 || "").trim().toUpperCase()];
2998
+ if (label2) return label2;
2741
2999
  }
2742
3000
  return BLOCK_LABEL_DEFAULT;
2743
3001
  }
@@ -2937,8 +3195,8 @@ function normalizeOrderRequest(order, payer, destination, fallbackExecutionChain
2937
3195
  const executionChainId = String(order.executionChainId || fallbackExecutionChainId || "0");
2938
3196
  if (!/^\d+$/.test(executionChainId) || BigInt(executionChainId) <= 0n) throw new Error("ZeroDelta quote did not include an execution chain.");
2939
3197
  const solana = isSolanaChainId(order.destinationChainId || destination.chainId);
2940
- const keyBytes2 = (value, label) => {
2941
- if (!/^0x[0-9a-fA-F]{64}$/.test(String(value || ""))) throw new Error(`${label} is not a valid 32-byte Solana key.`);
3198
+ const keyBytes2 = (value, label2) => {
3199
+ if (!/^0x[0-9a-fA-F]{64}$/.test(String(value || ""))) throw new Error(`${label2} is not a valid 32-byte Solana key.`);
2942
3200
  return String(value).toLowerCase();
2943
3201
  };
2944
3202
  return {
@@ -3057,7 +3315,7 @@ function routeLabelFor(option, destinationToken, result) {
3057
3315
  const bridge = result.quote.bridge ? ` via ${result.quote.bridge}` : "";
3058
3316
  return `Swap ${optionTicker(option)} to ${tokenTicker(destinationToken)} and settle on ZeroDelta${bridge}.`;
3059
3317
  }
3060
- function tokenAt(tokens, chainId, address) {
3318
+ function tokenAt2(tokens, chainId, address) {
3061
3319
  const key = isSolanaChainId(chainId) ? hexToSolanaKey(address) || address : address;
3062
3320
  const wanted = isChainAddress(chainId, key) ? chainAddressKey(chainId, key) : null;
3063
3321
  if (!wanted || !tokens?.length) return void 0;
@@ -3081,7 +3339,7 @@ function buildLegs(orders, ctx) {
3081
3339
  const order = orders[index];
3082
3340
  const isLast = index === orders.length - 1;
3083
3341
  const toChainId = Number(order.destinationChainId);
3084
- const askToken = isLast ? ctx.destinationToken : tokenAt(ctx.tokens, toChainId, order.askToken);
3342
+ const askToken = isLast ? ctx.destinationToken : tokenAt2(ctx.tokens, toChainId, order.askToken);
3085
3343
  const toAsset = isLast ? ctx.destinationToken.symbol : askToken?.symbol ?? "";
3086
3344
  const toTicker = askToken ? tokenTicker(askToken) : "";
3087
3345
  const toDecimals = askToken ? assetDecimals(askToken) : void 0;
@@ -3299,7 +3557,7 @@ var CHANNEL_HEADER = "x-zd-channel";
3299
3557
  var CHANNEL_VERSION_HEADER = "x-zd-channel-version";
3300
3558
  var CHANNEL_ORIGIN_HEADER = "x-zd-channel-origin";
3301
3559
  var WIDGET_CHANNEL = "widget";
3302
- var WIDGET_VERSION = "4.13.0" ;
3560
+ var WIDGET_VERSION = "4.14.0" ;
3303
3561
  var MAX_CHANNEL_VERSION_LEN = 32;
3304
3562
  function sanitizeVersion(raw2) {
3305
3563
  const v = String(raw2).trim();
@@ -3380,12 +3638,12 @@ function classifyQuoteError(error) {
3380
3638
  const isBlock = isStructuredComplianceBlock(error) || !!catMatch || error.code === "blocked" || error.code === "compliance_block" || /\b(stolen|sanction(?:s|ed|ing)?|block(?:ed|list)|screen(?:ed|ing)?|compliance|ofac|denylist|blacklist)\b/i.test(haystack);
3381
3639
  if (!isBlock) return null;
3382
3640
  const category = (catMatch?.[1] || "").toUpperCase() || "COMPLIANCE";
3383
- const label = blockLabelFor([category]);
3641
+ const label2 = blockLabelFor([category]);
3384
3642
  return {
3385
3643
  blocked: true,
3386
3644
  category,
3387
3645
  reason: reasons.join(", ") || error.message || "",
3388
- message: `This payment was blocked by compliance screening \u2014 the recipient is ${label}. Choose a different recipient or connect a different wallet.`
3646
+ message: `This payment was blocked by compliance screening \u2014 the recipient is ${label2}. Choose a different recipient or connect a different wallet.`
3389
3647
  };
3390
3648
  }
3391
3649
  function amountFieldError(error) {
@@ -3958,16 +4216,16 @@ function isHexQuantity(value) {
3958
4216
  return /^0x[0-9a-fA-F]+$/.test(String(value));
3959
4217
  }
3960
4218
  function dataWord(data, index) {
3961
- const word = String(data || "").slice(10 + index * 64, 10 + (index + 1) * 64);
3962
- return /^[a-fA-F0-9]{64}$/.test(word) ? word : "";
4219
+ const word2 = String(data || "").slice(10 + index * 64, 10 + (index + 1) * 64);
4220
+ return /^[a-fA-F0-9]{64}$/.test(word2) ? word2 : "";
3963
4221
  }
3964
4222
  function dataAddress(data, index) {
3965
- const word = dataWord(data, index);
3966
- return word ? `0x${word.slice(24)}` : "";
4223
+ const word2 = dataWord(data, index);
4224
+ return word2 ? `0x${word2.slice(24)}` : "";
3967
4225
  }
3968
4226
  function dataUint(data, index) {
3969
- const word = dataWord(data, index);
3970
- return word ? BigInt(`0x${word}`) : null;
4227
+ const word2 = dataWord(data, index);
4228
+ return word2 ? BigInt(`0x${word2}`) : null;
3971
4229
  }
3972
4230
  function rawEquals(value, expected) {
3973
4231
  try {
@@ -4385,6 +4643,8 @@ function createEngine(config = {}) {
4385
4643
  executeSolanaPlan: (input) => executeSolanaPlan({ ...input, rpc: input.rpc ?? solanaRpc }),
4386
4644
  executeSolanaPlanStaged: (input) => executeSolanaPlanStaged({ ...input, rpc: input.rpc ?? solanaRpc }),
4387
4645
  previewSolanaSource: (input) => previewSolanaSource(api, input),
4646
+ trackDelivery: (hash2) => fetchDelivery(api, hash2),
4647
+ fetchWalletHistory: (wallets) => fetchWalletHistory(api, wallets),
4388
4648
  readSolanaBalance: (owner, mint) => readSolanaBalance(solanaRpc, owner, mint),
4389
4649
  simulateSolanaCost: (plan) => simulateSolanaCost(solanaRpc, plan),
4390
4650
  payerNonceBaseline: verifier.payerNonceBaseline,
@@ -4580,18 +4840,20 @@ function useWallet(injected2) {
4580
4840
  const [connecting, setConnecting] = react.useState(false);
4581
4841
  const [error, setError] = react.useState(null);
4582
4842
  const providerRef = react.useRef(injected2 ?? null);
4843
+ const forgotten = react.useRef(false);
4844
+ const generation = react.useRef(0);
4583
4845
  react.useEffect(() => {
4584
4846
  const p = provider;
4585
4847
  if (!p) return;
4586
4848
  let alive = true;
4587
- const onAccounts = (accs) => alive && setAccount(Array.isArray(accs) && accs[0] ? accs[0] : null);
4849
+ const onAccounts = (accs) => alive && !forgotten.current && setAccount(Array.isArray(accs) && accs[0] ? accs[0] : null);
4588
4850
  const onChain = (hex) => alive && setChainId(hexToChain(hex));
4589
4851
  p.on?.("accountsChanged", onAccounts);
4590
4852
  p.on?.("chainChanged", onChain);
4591
4853
  (async () => {
4592
4854
  try {
4593
4855
  const accs = await getAccounts(p);
4594
- if (alive && accs[0]) setAccount(accs[0]);
4856
+ if (alive && accs[0] && !forgotten.current) setAccount(accs[0]);
4595
4857
  const cid = await getChainId(p);
4596
4858
  if (alive) setChainId(cid);
4597
4859
  } catch {
@@ -4612,11 +4874,14 @@ function useWallet(injected2) {
4612
4874
  const connect = react.useCallback(async () => {
4613
4875
  setConnecting(true);
4614
4876
  setError(null);
4877
+ forgotten.current = false;
4878
+ const request = ++generation.current;
4615
4879
  try {
4616
4880
  const p = providerRef.current ?? await resolveProvider(injected2);
4617
4881
  providerRef.current = p;
4618
4882
  setProvider(p);
4619
4883
  const accs = await requestAccounts(p);
4884
+ if (request !== generation.current) return;
4620
4885
  setAccount(accs[0] ?? null);
4621
4886
  setChainId(await getChainId(p));
4622
4887
  } catch (e) {
@@ -4625,7 +4890,19 @@ function useWallet(injected2) {
4625
4890
  setConnecting(false);
4626
4891
  }
4627
4892
  }, [injected2]);
4628
- return { provider, account, chainId, connecting, error, connect };
4893
+ const disconnect = react.useCallback(async () => {
4894
+ forgotten.current = true;
4895
+ generation.current += 1;
4896
+ setConnecting(false);
4897
+ setAccount(null);
4898
+ setError(null);
4899
+ const p = providerRef.current;
4900
+ try {
4901
+ await p?.request({ method: "wallet_revokePermissions", params: [{ eth_accounts: {} }] });
4902
+ } catch {
4903
+ }
4904
+ }, []);
4905
+ return { provider, account, chainId, connecting, error, connect, disconnect };
4629
4906
  }
4630
4907
 
4631
4908
  // src/react/txHistoryStore.ts
@@ -5258,6 +5535,7 @@ var WIDGET_CSS = `
5258
5535
  .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}
5259
5536
  /* Broadcast but not receipt-confirmed: mute the disc so a pending settlement never wears the
5260
5537
  accent-coloured "paid" affordance. Mirrors .sg-settle-disc[data-pending] in the island. */
5538
+ .sg-success-steps{font-size:12px;color:var(--sg-text-muted);margin-top:6px;text-align:center}
5261
5539
  .sg-success-check[data-pending="true"]{background:var(--sg-surface);color:var(--sg-text-muted);border:1px solid var(--sg-border)}
5262
5540
  .sg-success-amt{font-size:20px;font-weight:700;font-variant-numeric:tabular-nums}
5263
5541
  .sg-success-sub{font-size:12px;color:var(--sg-text-muted);margin-top:2px}
@@ -5867,6 +6145,106 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
5867
6145
  .sg-overlay[data-sg-overlay="drawer"] .sg-pane--note{min-height:145px}
5868
6146
  @keyframes sg-drawer-in{from{transform:translateX(100%)}to{transform:none}}
5869
6147
  @media (prefers-reduced-motion:reduce){.sg-overlay,.sg-dialog{animation:none!important}.sg-pillbtn{transition:none}}
6148
+ /* \u2500\u2500 Wallets + Recipient sheets \u2014 Figma ZD-dApp 3154:48121 / 3155:49634 (2026-10-28) \u2500\u2500 */
6149
+ .sg-widget{--sg-t50:color-mix(in srgb,var(--sg-text) 50%,transparent);--sg-a4:color-mix(in srgb,var(--sg-accent) 4%,transparent);--sg-a12:color-mix(in srgb,var(--sg-accent) 12%,transparent);--sg-flag:#fd6b6e;--sg-ok-ink:#1ba669}
6150
+ .sg-widget[data-sg-mode="dark"]{--sg-a4:color-mix(in srgb,var(--sg-accent) 10%,transparent);--sg-a12:var(--sg-border);--sg-ok-ink:var(--sg-success)}
6151
+ .sg-wallet[data-connected="true"]{cursor:pointer;height:30px;box-sizing:border-box;padding:7px 11px;gap:6px;border-radius:16px;border-color:var(--sg-a12);color:var(--sg-t80)}
6152
+ .sg-wallet[data-connected="true"]:hover:not(:disabled){border-color:var(--sg-accent);color:var(--sg-t80)}
6153
+ .sg-wallet[data-connected="true"]:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px}
6154
+ .sg-wallet-label{opacity:.9}
6155
+ .sg-wallet[data-connected="true"] svg{flex:0 0 auto;margin-right:-1px}
6156
+ .sg-ws{display:flex;flex-direction:column;justify-content:space-between;gap:20px;box-sizing:border-box;width:100%;animation:sg-cp-in var(--sg-motion-fast) var(--sg-ease-out-soft) both}
6157
+ .sg-ws:focus{outline:none}
6158
+ .sg-ws-top{display:flex;flex-direction:column;gap:28px}
6159
+ .sg-ws-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
6160
+ .sg-ws-back{display:inline-flex;align-items:center;gap:10px;padding:0;border:0;background:transparent;font:inherit;font-size:16px;font-weight:500;line-height:1.2;color:var(--sg-t60);cursor:pointer}
6161
+ .sg-ws-back svg{flex:0 0 auto}
6162
+ .sg-ws-back:hover{color:var(--sg-text)}
6163
+ .sg-ws-close{display:flex;align-items:center;justify-content:center;width:30px;height:30px;padding:0;border:0;border-radius:8px;background:transparent;color:#a7a9be;cursor:pointer}
6164
+ .sg-ws-close:hover{color:var(--sg-text)}
6165
+ .sg-ws-back:focus-visible,.sg-ws-close:focus-visible,.sg-ws-icon-btn:focus-visible,.sg-ws-action:focus-visible,.sg-ws-sum:focus-visible,.sg-rcp-opt:focus-visible,.sg-rcp-custom:focus-visible,.sg-rcp-change:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px}
6166
+ .sg-ws-main{display:flex;flex-direction:column;gap:16px}
6167
+ .sg-ws-title{margin:0;font-family:var(--sg-font-display);font-size:16px;font-weight:600;line-height:1.2;letter-spacing:.32px;color:var(--sg-t90)}
6168
+ .sg-ws[data-wide]{gap:16px}
6169
+ .sg-ws[data-wide] .sg-ws-sum-lead{min-width:0}
6170
+ .sg-ws[data-wide] .sg-ws-sum-text{overflow:hidden;text-overflow:ellipsis}
6171
+ .sg-widget[data-sg-mode="dark"] :is(.sg-ws-action,.sg-rcp-custom,.sg-rcp-change,.sg-ws-icon-btn,.sg-rcp-tick){color:var(--sg-info)}
6172
+ .sg-ws[data-wide] .sg-ws-back{font-size:12px;font-weight:400}
6173
+ .sg-ws[data-wide] .sg-ws-title{font-family:var(--sg-font);font-size:18px;font-weight:500;letter-spacing:0}
6174
+ .sg-ws-list{display:flex;flex-direction:column;gap:4px}
6175
+ .sg-ws-list[data-gap="8"]{gap:8px}
6176
+ .sg-ws-row{display:flex;flex-direction:column;gap:12px;box-sizing:border-box;width:100%;padding:18px 16px;border:0;border-radius:24px;background:var(--sg-a4);color:var(--sg-text);font:inherit;text-align:left}
6177
+ .sg-ws-row-line{display:flex;align-items:center;justify-content:space-between;gap:12px}
6178
+ .sg-ws-id{display:flex;align-items:center;gap:20px;min-width:0}
6179
+ .sg-ws-id-text{display:flex;flex-direction:column;align-items:flex-start;gap:4px;min-width:0;line-height:1.2;white-space:nowrap}
6180
+ .sg-ws-id-label{display:inline-flex;align-items:center;gap:8px;font-size:12px;color:var(--sg-t50)}
6181
+ .sg-ws-addr{font-size:16px;font-weight:500;color:var(--sg-t80)}
6182
+ .sg-ws-pill{display:inline-flex;align-items:center;padding:4px 8px;border-radius:16px;font-size:11px;font-weight:500;line-height:1.2}
6183
+ .sg-ws-pill[data-tone="blocked"]{background:color-mix(in srgb,var(--sg-flag) 12%,transparent);color:var(--sg-flag)}
6184
+ .sg-ws-pill[data-tone="ok"]{background:color-mix(in srgb,var(--sg-success) 6%,transparent);color:color-mix(in srgb,var(--sg-success) 80%,transparent)}
6185
+ .sg-ws-note{margin:0;font-size:12px;line-height:1.2;color:var(--sg-t60)}
6186
+ .sg-ws-avatar{position:relative;flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:31px;background:#e7e8f3;color:#2c2d34}
6187
+ .sg-ws-avatar[data-family="solana"]{background:#1a2ba3;color:#fff}
6188
+ .sg-ws-avatar-chain{position:absolute;left:20px;top:21px;display:flex;padding:2px;border:2px solid var(--sg-surface);border-radius:10px;background:var(--sg-surface);overflow:hidden}
6189
+ .sg-ws-avatar-chain img{display:block;width:12px;height:12px;border-radius:8px;object-fit:cover}
6190
+ .sg-ws-icon-btn{display:flex;align-items:center;justify-content:center;flex:0 0 auto;width:24px;height:24px;margin:-4px;padding:0;border:0;border-radius:8px;background:transparent;color:var(--sg-accent);cursor:pointer}
6191
+ .sg-ws-icon-btn:hover{background:var(--sg-a12)}
6192
+ .sg-ws-action{flex-direction:row;align-items:center;justify-content:space-between;border-radius:20px;font-size:13px;font-weight:500;line-height:1.4;color:var(--sg-accent);cursor:pointer}
6193
+ .sg-ws-action:hover:not(:disabled){background:color-mix(in srgb,var(--sg-accent) 8%,transparent)}
6194
+ .sg-ws-action:disabled{cursor:progress;opacity:.7}
6195
+ .sg-ws-action svg{flex:0 0 auto}
6196
+ .sg-ws-sum{display:flex;align-items:center;justify-content:space-between;gap:8px;box-sizing:border-box;width:100%;padding:16px;border:0;border-radius:20px;font:inherit;text-align:left;background:color-mix(in srgb,var(--sg-text) 3%,transparent)}
6197
+ button.sg-ws-sum{cursor:pointer}
6198
+ .sg-ws-sum[data-tone="ok"]{background:color-mix(in srgb,var(--sg-success) 4%,transparent)}
6199
+ .sg-ws-sum[data-tone="blocked"]{background:color-mix(in srgb,var(--sg-flag) 8%,transparent)}
6200
+ .sg-ws-sum-lead{display:inline-flex;align-items:center;gap:8px;font-size:13px;font-weight:500;line-height:1.2;color:var(--sg-t80);white-space:nowrap}
6201
+ .sg-ws-sum-lead svg{flex:0 0 auto;color:var(--sg-accent)}
6202
+ .sg-ws-sum[data-tone="ok"] .sg-ws-sum-lead svg{color:var(--sg-success)}
6203
+ .sg-ws-sum[data-tone="blocked"] .sg-ws-sum-lead svg{color:var(--sg-flag)}
6204
+ .sg-ws-sum[data-tone="unknown"] .sg-ws-sum-lead svg{color:var(--sg-text-muted)}
6205
+ .sg-ws-sum-act{display:inline-flex;align-items:center;gap:8px;padding:4px 0;font-size:11px;font-weight:500;line-height:1.2;color:var(--sg-t90);white-space:nowrap}
6206
+ .sg-ws-sum[data-tone="ok"] .sg-ws-sum-act{color:var(--sg-ok-ink)}
6207
+ .sg-ws-sum[data-tone="ok"] .sg-ws-sum-act svg{color:color-mix(in srgb,var(--sg-success) 80%,transparent)}
6208
+ .sg-ws-sum[data-tone="blocked"] .sg-ws-sum-act{color:var(--sg-flag)}
6209
+ .sg-ws-sum[data-tone="unknown"] .sg-ws-sum-act{color:var(--sg-text-muted)}
6210
+ .sg-ws-spin{animation:sg-ws-spin 900ms linear infinite}
6211
+ @keyframes sg-ws-spin{to{transform:rotate(360deg)}}
6212
+ .sg-ws-error{margin:0;font-size:12px;line-height:1.3;color:var(--sg-danger)}
6213
+ .sg-ws-foot{flex:0 0 auto}
6214
+ .sg-btn.sg-ws-cta{height:44px;min-height:44px;padding:0 24px}
6215
+ .sg-btn.sg-ws-cta:disabled{opacity:.2;cursor:not-allowed}
6216
+ .sg-rcp-row{display:flex;align-items:center;justify-content:space-between;gap:8px;box-sizing:border-box;width:100%;padding:12px 16px;border-radius:24px;background:var(--sg-a4);font-size:12px;line-height:1.2;white-space:nowrap}
6217
+ .sg-rcp-row[data-wide]{background:transparent;border:1px solid var(--sg-a12);padding:12px 16px}
6218
+ .sg-rcp-row[data-tone="error"]{white-space:normal;color:var(--sg-danger);background:color-mix(in srgb,var(--sg-danger) 8%,transparent)}
6219
+ .sg-rcp-label{color:var(--sg-t60)}
6220
+ .sg-rcp-end{display:inline-flex;align-items:center;gap:8px;min-width:0}
6221
+ .sg-rcp-value{color:var(--sg-t90);overflow:hidden;text-overflow:ellipsis}
6222
+ .sg-rcp-value[data-empty]{color:var(--sg-t50)}
6223
+ .sg-rcp-change{padding:0;border:0;background:transparent;font:inherit;font-size:12px;font-weight:500;line-height:1.4;color:var(--sg-accent);cursor:pointer}
6224
+ .sg-rcp-change:hover:not(:disabled){text-decoration:underline}
6225
+ .sg-rcp-change:disabled{opacity:.5;cursor:not-allowed}
6226
+ .sg-rcp-opt{display:flex;align-items:center;justify-content:space-between;gap:12px;box-sizing:border-box;width:100%;padding:18px 16px;border:1px solid var(--sg-a12);border-radius:24px;background:transparent;color:var(--sg-text);font:inherit;text-align:left;cursor:pointer}
6227
+ .sg-rcp-opt[data-selected]{border-color:transparent;background:var(--sg-a4)}
6228
+ .sg-rcp-opt:hover:not(:disabled):not([data-selected]){border-color:color-mix(in srgb,var(--sg-accent) 40%,transparent)}
6229
+ .sg-rcp-opt:disabled{cursor:not-allowed;opacity:.45}
6230
+ .sg-rcp-tick{display:flex;color:var(--sg-accent);flex:0 0 auto}
6231
+ .sg-rcp-custom{display:flex;align-items:center;justify-content:space-between;gap:8px;box-sizing:border-box;width:100%;padding:18px 16px;border:1px solid var(--sg-a12);border-radius:20px;background:transparent;font:inherit;font-size:13px;font-weight:500;line-height:1.4;color:var(--sg-accent);text-align:left;cursor:pointer}
6232
+ .sg-rcp-custom svg{flex:0 0 auto}
6233
+ .sg-rcp-custom[data-open]{flex-direction:column;align-items:stretch;gap:8px;border-color:transparent;background:var(--sg-a4);cursor:default}
6234
+ .sg-rcp-custom-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
6235
+ .sg-rcp-custom-head label{cursor:text}
6236
+ .sg-rcp-input{box-sizing:border-box;width:100%;padding:11px 16px;border:1px solid var(--sg-a12);border-radius:12px;background:var(--sg-bg);color:var(--sg-t90);font:inherit;font-size:12px;font-weight:400;line-height:1.2;outline:none;text-overflow:ellipsis}
6237
+ .sg-rcp-input::placeholder{color:var(--sg-t50)}
6238
+ .sg-rcp-input:focus{border-color:var(--sg-accent)}
6239
+ .sg-rcp-input[aria-invalid="true"]{border-color:var(--sg-danger)}
6240
+ .sg-rcp-hint{margin:0;font-size:12px;font-weight:400;line-height:1.2;color:var(--sg-t60)}
6241
+ .sg-widget[data-sg-takeover]{display:flex;flex-direction:column}
6242
+ .sg-widget[data-sg-takeover]>.sg-head,.sg-widget[data-sg-takeover]>.sg-foot{display:none}
6243
+ .sg-widget[data-sg-takeover]>.sg-body{display:flex;flex-direction:column;flex:1 1 auto}
6244
+ .sg-widget[data-sg-takeover]>.sg-body>.sg-ws{flex:1 1 auto}
6245
+ .sg-widget[data-sg-side]:has(>.sg-ws){display:flex;flex-direction:column}
6246
+ .sg-widget[data-sg-side]>.sg-ws{flex:1 1 auto}
6247
+ @media (prefers-reduced-motion:reduce){.sg-ws{animation:none}.sg-ws-spin{animation:none}}
5870
6248
  `;
5871
6249
  var injected = false;
5872
6250
  function injectStyles() {
@@ -6148,7 +6526,7 @@ function StepList(props) {
6148
6526
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: s.state === "done" ? "sg-muted" : "", children: s.label }),
6149
6527
  rich ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-sr-only", children: ` \u2014 ${STEP_STATE_WORD[s.state]}` }) : null
6150
6528
  ] }, s.id)) }),
6151
- rich && props.verdict && verifyDone ? /* @__PURE__ */ jsxRuntime.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
6529
+ rich && props.verdict && verifyDone ? /* @__PURE__ */ jsxRuntime.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
6152
6530
  ] });
6153
6531
  }
6154
6532
  var SHOW_ROADMAP_METHODS = true;
@@ -6488,8 +6866,8 @@ var CHAIN_ALIASES = {
6488
6866
  137: ["matic"],
6489
6867
  43114: ["avax"]
6490
6868
  };
6491
- function labelForms(label) {
6492
- const lower2 = label.trim().toLowerCase();
6869
+ function labelForms(label2) {
6870
+ const lower2 = label2.trim().toLowerCase();
6493
6871
  if (!lower2) return [];
6494
6872
  const compact = lower2.replace(/[^a-z0-9]/g, "");
6495
6873
  return compact && compact !== lower2 ? [lower2, compact] : [lower2];
@@ -6500,8 +6878,8 @@ function buildChainSearchTerms(chains) {
6500
6878
  for (const id of ids) {
6501
6879
  const chain2 = chains.find((c) => Number(c.chainId) === id);
6502
6880
  const terms = /* @__PURE__ */ new Set();
6503
- for (const label of [chain2?.displayName, chain2?.name, typeof chain2?.slug === "string" ? chain2.slug : void 0, CHAIN_LABELS[id]]) {
6504
- if (label) for (const form of labelForms(label)) terms.add(form);
6881
+ for (const label2 of [chain2?.displayName, chain2?.name, typeof chain2?.slug === "string" ? chain2.slug : void 0, CHAIN_LABELS[id]]) {
6882
+ if (label2) for (const form of labelForms(label2)) terms.add(form);
6505
6883
  }
6506
6884
  for (const alias of CHAIN_ALIASES[id] ?? []) terms.add(alias);
6507
6885
  byId.set(id, [...terms]);
@@ -6873,7 +7251,7 @@ function TokenSelect(props) {
6873
7251
  const members = g.deployments;
6874
7252
  const multi = members.length > 1;
6875
7253
  const single = members[0];
6876
- const label = multi ? g.symbol : tokenTicker(single.token);
7254
+ const label2 = multi ? g.symbol : tokenTicker(single.token);
6877
7255
  const blocked = !!g.unavailable;
6878
7256
  const opensNetworks = multi || blocked;
6879
7257
  const zero = showBalances && g.amount === 0 || blocked;
@@ -6897,7 +7275,7 @@ function TokenSelect(props) {
6897
7275
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-pk-left", children: [
6898
7276
  /* @__PURE__ */ jsxRuntime.jsx(TokenPlate, { symbol: g.symbol, logoUrl: g.logoUrl }),
6899
7277
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-pk-text", children: [
6900
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-label", children: label }),
7278
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-label", children: label2 }),
6901
7279
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-pk-line", children: [
6902
7280
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-sub", children: multi ? showBalances ? "Total across" : "Available on" : `On ${chainName3(Number(single.token.chainId))}` }),
6903
7281
  /* @__PURE__ */ jsxRuntime.jsx(ChainMarks, { chainIds: members.map((m) => Number(m.token.chainId)), chainById: chainById2, decorative: !multi }),
@@ -6906,7 +7284,7 @@ function TokenSelect(props) {
6906
7284
  !multi && single.hint ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-note", "data-testid": "lane-limit", children: single.hint }) : null
6907
7285
  ] })
6908
7286
  ] }),
6909
- showBalances ? /* @__PURE__ */ jsxRuntime.jsx(BalanceColumn, { amount: g.amount, usd: g.usd, symbol: label }) : opensNetworks ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-chev", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(ChevronGlyph, {}) }) : null
7287
+ 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
6910
7288
  ]
6911
7289
  },
6912
7290
  g.key
@@ -7080,7 +7458,7 @@ function WidgetShell(props) {
7080
7458
  const resolved = resolveTheme(props.theme);
7081
7459
  const vars = themeToVars(resolved);
7082
7460
  const fixed = Number.isFinite(props.heightPx) && props.heightPx > 0;
7083
- const style = fixed ? { ...vars, height: props.heightPx } : vars;
7461
+ const style = fixed ? { ...vars, height: props.heightPx } : props.minHeightPx ? { ...vars, minHeight: props.minHeightPx } : vars;
7084
7462
  return /* @__PURE__ */ jsxRuntime.jsxs(
7085
7463
  "div",
7086
7464
  {
@@ -7089,6 +7467,7 @@ function WidgetShell(props) {
7089
7467
  "data-sg-fixed": fixed || void 0,
7090
7468
  "data-sg-express": props.variant === "express" || void 0,
7091
7469
  "data-sg-wide": props.wide || void 0,
7470
+ "data-sg-takeover": props.takeover || void 0,
7092
7471
  style,
7093
7472
  children: [
7094
7473
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-head", children: [
@@ -7192,12 +7571,12 @@ function TriggerGlyph({ cv }) {
7192
7571
  return /* @__PURE__ */ jsxRuntime.jsx(ShieldTick, {});
7193
7572
  }
7194
7573
  function CheckRow({ check: check2, onViewPolicy }) {
7195
- const label = check2.id === "risk" ? check2.ok ? "Risk screening passed" : "Risk screening failed" : check2.label;
7574
+ const label2 = check2.id === "risk" ? check2.ok ? "Risk screening passed" : "Risk screening failed" : check2.label;
7196
7575
  return /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "sg-cp-check", "data-ok": check2.ok, children: [
7197
7576
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-check-head", children: [
7198
7577
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-check-label", children: [
7199
7578
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-check-mark", "data-ok": check2.ok, children: check2.ok ? /* @__PURE__ */ jsxRuntime.jsx(Tick, {}) : /* @__PURE__ */ jsxRuntime.jsx(Cross, {}) }),
7200
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: label }),
7579
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: label2 }),
7201
7580
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-sr-only", children: check2.ok ? " \u2014 passed" : " \u2014 failed" })
7202
7581
  ] }),
7203
7582
  check2.id === "risk" ? /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-cp-link", onClick: onViewPolicy, children: [
@@ -7265,9 +7644,9 @@ function QuoteChecks({
7265
7644
  ] }) : null
7266
7645
  ] });
7267
7646
  }
7268
- function Fact({ label, value, title, mono = false }) {
7647
+ function Fact({ label: label2, value, title, mono = false }) {
7269
7648
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-fact", children: [
7270
- /* @__PURE__ */ jsxRuntime.jsx("dt", { children: label }),
7649
+ /* @__PURE__ */ jsxRuntime.jsx("dt", { children: label2 }),
7271
7650
  /* @__PURE__ */ jsxRuntime.jsx("dd", { title, className: mono ? "sg-mono" : void 0, children: value })
7272
7651
  ] });
7273
7652
  }
@@ -7396,6 +7775,39 @@ function useTxHistory(account) {
7396
7775
  }, [account]);
7397
7776
  return entries;
7398
7777
  }
7778
+ var WALLET_HISTORY_REFRESH_MS = 3e4;
7779
+ var hidden2 = () => typeof document !== "undefined" && document.visibilityState === "hidden";
7780
+ var travelling = (entries) => !!entries?.some((e) => e.delivery === "in-progress" || e.delivery === "attention");
7781
+ function useWalletHistory(engine, wallets) {
7782
+ const [entries, setEntries] = react.useState(null);
7783
+ const key = wallets.filter((w) => !!w).join("|");
7784
+ react.useEffect(() => {
7785
+ setEntries(null);
7786
+ if (!engine || !key) return;
7787
+ let alive = true;
7788
+ let timer2;
7789
+ const read = async () => {
7790
+ if (timer2) clearTimeout(timer2);
7791
+ timer2 = void 0;
7792
+ if (!hidden2()) {
7793
+ const next = await engine.fetchWalletHistory(key.split("|"));
7794
+ if (!alive) return;
7795
+ if (next) setEntries(next);
7796
+ if (!travelling(next)) return;
7797
+ }
7798
+ timer2 = setTimeout(read, WALLET_HISTORY_REFRESH_MS);
7799
+ };
7800
+ void read();
7801
+ const onRecorded = () => void read();
7802
+ if (typeof window !== "undefined") window.addEventListener(TX_HISTORY_EVENT, onRecorded);
7803
+ return () => {
7804
+ alive = false;
7805
+ if (timer2) clearTimeout(timer2);
7806
+ if (typeof window !== "undefined") window.removeEventListener(TX_HISTORY_EVENT, onRecorded);
7807
+ };
7808
+ }, [engine, key]);
7809
+ return entries;
7810
+ }
7399
7811
  function BackGlyph() {
7400
7812
  return /* @__PURE__ */ jsxRuntime.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: [
7401
7813
  /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M19 12H5" }),
@@ -7479,7 +7891,15 @@ function TxLegs(props) {
7479
7891
  ] }, `${leg.index}:${leg.fromChainId}:${leg.toChainId}`)) })
7480
7892
  ] });
7481
7893
  }
7482
- function statusBadge(status) {
7894
+ function statusBadge(entry) {
7895
+ if (entry.delivery === "delivered")
7896
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", "data-tone": "ok", children: "Delivered" });
7897
+ if (entry.delivery === "failed")
7898
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", "data-tone": "warn", children: "Not delivered" });
7899
+ if (entry.delivery === "attention")
7900
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", "data-tone": "warn", children: "Needs action" });
7901
+ if (entry.delivery === "in-progress") return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", children: "On its way" });
7902
+ const status = entry.status;
7483
7903
  if (status === "confirmed")
7484
7904
  return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", "data-tone": "ok", children: "Confirmed" });
7485
7905
  if (status === "error")
@@ -7551,7 +7971,7 @@ function TxHistoryList(props) {
7551
7971
  ] }),
7552
7972
  whenLabel(e.at) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-time", children: whenLabel(e.at) }) : null
7553
7973
  ] }),
7554
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-end", children: statusBadge(e.status) })
7974
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-end", children: statusBadge(e) })
7555
7975
  ] })
7556
7976
  ] }, `${e.hash}:${e.at}`)
7557
7977
  )) });
@@ -7591,7 +8011,7 @@ function TxDetail(props) {
7591
8011
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta", children: [
7592
8012
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
7593
8013
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Status" }),
7594
- statusBadge(e.status)
8014
+ statusBadge(e)
7595
8015
  ] }),
7596
8016
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
7597
8017
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "You sent" }),
@@ -7627,18 +8047,21 @@ function displayableHistory(entries, account) {
7627
8047
  }
7628
8048
  function TxHistoryPanel(props) {
7629
8049
  const account = props.account;
7630
- const entries = displayableHistory(useTxHistory(account), account);
7631
- const deepLink = props.initialEntry && displayableHistory([props.initialEntry], account).length ? props.initialEntry : null;
7632
- const [selected, setSelected] = react.useState(deepLink);
8050
+ const stored = useTxHistory(account);
8051
+ const remote = useWalletHistory(props.engine, [account, props.solanaAccount]);
8052
+ const entries = react.useMemo(() => mergeHistory(displayableHistory(stored, account), remote), [stored, account, remote]);
8053
+ const linked = props.initialEntry && displayableHistory([props.initialEntry], account).length ? props.initialEntry : null;
8054
+ const [selectedHash, setSelectedHash] = react.useState(linked?.hash ?? null);
8055
+ const selected = selectedHash ? entries.find((e) => e.hash === selectedHash) ?? (linked?.hash === selectedHash ? linked : null) : null;
7633
8056
  const backRef = react.useRef(null);
7634
- react.useEffect(() => setSelected(deepLink), [deepLink]);
8057
+ react.useEffect(() => setSelectedHash(linked?.hash ?? null), [linked?.hash]);
7635
8058
  const pick = (entry) => {
7636
- setSelected(entry);
8059
+ setSelectedHash(entry.hash);
7637
8060
  requestAnimationFrame(() => backRef.current?.focus());
7638
8061
  };
7639
8062
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
7640
8063
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-sel-head", children: [
7641
- /* @__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(BackGlyph, {}) }),
8064
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", autoFocus: true, ref: backRef, className: "sg-back", onClick: selected ? () => setSelectedHash(null) : props.onBack, "aria-label": "Back", children: /* @__PURE__ */ jsxRuntime.jsx(BackGlyph, {}) }),
7642
8065
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-sel-title", children: [
7643
8066
  selected ? "Transaction" : "Transaction history",
7644
8067
  account ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-sel-sub sg-mono", children: shortAddress2(account) }) : null
@@ -7954,12 +8377,19 @@ function useRecipient(destinationChainId, hostRecipient, opts = {}) {
7954
8377
  const [custom, setCustom] = react.useState({});
7955
8378
  const [open, setOpen] = react.useState(false);
7956
8379
  const triggerRef = react.useRef(null);
8380
+ const evmAccount = opts.evm?.account ?? null;
7957
8381
  const evmManaged = recipientFamily === "evm" && Boolean(opts.sourceIsSolana);
7958
- const managed = hostRecipient === void 0 && (recipientFamily === "solana" || evmManaged);
8382
+ const required = recipientFamily === "solana" || evmManaged;
8383
+ const managed = hostRecipient === void 0 && (required || Boolean(opts.evm));
7959
8384
  const error = hostRecipient === void 0 ? null : recipientFamily === "solana" && !isSolanaAddress(hostRecipient) ? "The configured recipient is not a Solana address." : evmManaged && !isAddress(hostRecipient) ? "The configured recipient is not an EVM address." : null;
7960
- const recipient2 = hostRecipient !== void 0 ? hostRecipient : recipientFamily === "solana" ? custom.solana || wallet.address || void 0 : evmManaged ? custom.evm || opts.evm?.account || void 0 : void 0;
7961
- const missing = managed && !recipient2;
7962
- const familyWallet = recipientFamily === "solana" ? { address: wallet.address, wallets: wallet.wallets, connecting: wallet.status === "connecting", error: wallet.error } : { address: opts.evm?.account ?? null, wallets: [], connecting: Boolean(opts.evm?.connecting), error: null };
8385
+ const recipient2 = hostRecipient !== void 0 ? hostRecipient : recipientFamily === "solana" ? custom.solana || wallet.address || void 0 : evmManaged ? custom.evm || evmAccount || void 0 : opts.evm ? custom.evm || void 0 : void 0;
8386
+ const missing = managed && required && !recipient2;
8387
+ const shown = recipient2 ?? (recipientFamily === "evm" && !required ? evmAccount ?? void 0 : void 0);
8388
+ const typed = hostRecipient === void 0 ? custom[recipientFamily] || "" : "";
8389
+ const familyWallet = recipientFamily === "solana" ? { address: wallet.address, wallets: wallet.wallets, connecting: wallet.status === "connecting", error: wallet.error } : { address: evmAccount, wallets: [], connecting: Boolean(opts.evm?.connecting), error: null };
8390
+ const wallets = [];
8391
+ if (evmAccount) wallets.push({ family: "evm", address: evmAccount, eligible: recipientFamily === "evm" });
8392
+ if (wallet.address) wallets.push({ family: "solana", address: wallet.address, eligible: recipientFamily === "solana" });
7963
8393
  const close = () => {
7964
8394
  setOpen(false);
7965
8395
  requestAnimationFrame(() => triggerRef.current?.focus());
@@ -7970,7 +8400,7 @@ function useRecipient(destinationChainId, hostRecipient, opts = {}) {
7970
8400
  };
7971
8401
  const connect = async (name) => {
7972
8402
  if (recipientFamily === "evm") {
7973
- if (opts.evm?.account) selectAddress("");
8403
+ if (evmAccount) selectAddress("");
7974
8404
  else opts.evm?.connect();
7975
8405
  return;
7976
8406
  }
@@ -7986,38 +8416,170 @@ function useRecipient(destinationChainId, hostRecipient, opts = {}) {
7986
8416
  if (typeof address === "string") selectAddress("");
7987
8417
  else setOpen(true);
7988
8418
  };
7989
- const recipientFor = (account) => recipientFamily === "solana" || evmManaged ? recipient2 || "" : hostRecipient || account;
7990
- return { recipientFamily, recipient: recipient2, recipientFor, managed, missing, error, wallet, familyWallet, open: open && managed, show: () => setOpen(true), close, selectAddress, connect, triggerRef };
8419
+ const recipientFor = (account) => required ? recipient2 || "" : hostRecipient || custom.evm || account;
8420
+ return { recipientFamily, recipientChainId: destinationChainId, recipient: recipient2, shown, typed, recipientFor, managed, missing, error, wallet, familyWallet, wallets, open: open && managed, show: () => setOpen(true), close, selectAddress, connect, triggerRef };
7991
8421
  }
7992
- var short = (address) => `${address.slice(0, 4)}\u2026${address.slice(-4)}`;
7993
- function RecipientNote({ state, disabled }) {
7994
- if (state.error) return /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: state.error });
7995
- if (!state.managed) return null;
7996
- const family = state.recipientFamily === "solana" ? "Solana" : "EVM";
7997
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "center", gap: 6, marginTop: 10, fontSize: 13, color: "var(--sg-text-muted)", flexWrap: "wrap" }, children: [
7998
- state.recipient ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7999
- "To ",
8000
- /* @__PURE__ */ jsxRuntime.jsx("b", { className: "sg-mono", title: state.recipient, style: { color: "var(--sg-text)" }, children: short(state.recipient) }),
8001
- " on ",
8002
- family,
8003
- " \xB7 "
8004
- ] }) : null,
8005
- /* @__PURE__ */ jsxRuntime.jsx("button", { ref: state.triggerRef, type: "button", className: "sg-cp-link", onClick: state.show, disabled, "aria-haspopup": "dialog", children: state.recipient ? "Change" : "Send to a different address" })
8422
+
8423
+ // src/core/checksum.ts
8424
+ var RC = [
8425
+ 0x0000000000000001n,
8426
+ 0x0000000000008082n,
8427
+ 0x800000000000808an,
8428
+ 0x8000000080008000n,
8429
+ 0x000000000000808bn,
8430
+ 0x0000000080000001n,
8431
+ 0x8000000080008081n,
8432
+ 0x8000000000008009n,
8433
+ 0x000000000000008an,
8434
+ 0x0000000000000088n,
8435
+ 0x0000000080008009n,
8436
+ 0x000000008000000an,
8437
+ 0x000000008000808bn,
8438
+ 0x800000000000008bn,
8439
+ 0x8000000000008089n,
8440
+ 0x8000000000008003n,
8441
+ 0x8000000000008002n,
8442
+ 0x8000000000000080n,
8443
+ 0x000000000000800an,
8444
+ 0x800000008000000an,
8445
+ 0x8000000080008081n,
8446
+ 0x8000000000008080n,
8447
+ 0x0000000080000001n,
8448
+ 0x8000000080008008n
8449
+ ];
8450
+ var ROT = [0, 1, 62, 28, 27, 36, 44, 6, 55, 20, 3, 10, 43, 25, 39, 41, 45, 15, 21, 8, 18, 2, 61, 56, 14];
8451
+ var MASK = (1n << 64n) - 1n;
8452
+ var rotl = (x, n) => n === 0 ? x : (x << BigInt(n) | x >> BigInt(64 - n)) & MASK;
8453
+ function keccakF(s) {
8454
+ for (let round = 0; round < 24; round++) {
8455
+ const c = [0, 1, 2, 3, 4].map((x) => s[x] ^ s[x + 5] ^ s[x + 10] ^ s[x + 15] ^ s[x + 20]);
8456
+ for (let x = 0; x < 5; x++) {
8457
+ const d = c[(x + 4) % 5] ^ rotl(c[(x + 1) % 5], 1);
8458
+ for (let y = 0; y < 25; y += 5) s[y + x] = s[y + x] ^ d;
8459
+ }
8460
+ const b = new Array(25);
8461
+ for (let x = 0; x < 5; x++) for (let y = 0; y < 5; y++) b[y + 5 * ((2 * x + 3 * y) % 5)] = rotl(s[x + 5 * y], ROT[x + 5 * y]);
8462
+ for (let x = 0; x < 5; x++) for (let y = 0; y < 25; y += 5) s[y + x] = b[y + x] ^ ~b[y + (x + 1) % 5] & MASK & b[y + (x + 2) % 5];
8463
+ s[0] = s[0] ^ RC[round];
8464
+ }
8465
+ }
8466
+ function keccak256Hex(bytes) {
8467
+ const rate = 136;
8468
+ const padded = new Uint8Array(Math.ceil((bytes.length + 1) / rate) * rate);
8469
+ padded.set(bytes);
8470
+ padded[bytes.length] = padded[bytes.length] ^ 1;
8471
+ padded[padded.length - 1] = padded[padded.length - 1] ^ 128;
8472
+ const s = new Array(25).fill(0n);
8473
+ for (let off = 0; off < padded.length; off += rate) {
8474
+ for (let i = 0; i < rate / 8; i++) {
8475
+ let lane = 0n;
8476
+ for (let j = 7; j >= 0; j--) lane = lane << 8n | BigInt(padded[off + i * 8 + j]);
8477
+ s[i] = s[i] ^ lane;
8478
+ }
8479
+ keccakF(s);
8480
+ }
8481
+ let out = "";
8482
+ for (let i = 0; i < 4; i++) for (let j = 0; j < 8; j++) out += Number(s[i] >> BigInt(8 * j) & 0xffn).toString(16).padStart(2, "0");
8483
+ return out;
8484
+ }
8485
+ function toChecksumAddress(address) {
8486
+ const lower2 = address.slice(2).toLowerCase();
8487
+ const hash2 = keccak256Hex(new TextEncoder().encode(lower2));
8488
+ let out = "0x";
8489
+ for (let i = 0; i < 40; i++) out += Number.parseInt(hash2[i], 16) >= 8 ? lower2[i].toUpperCase() : lower2[i];
8490
+ return out;
8491
+ }
8492
+ function hasValidChecksum(address) {
8493
+ if (!/^0x[0-9a-fA-F]{40}$/.test(address)) return false;
8494
+ const body = address.slice(2);
8495
+ if (body === body.toLowerCase() || body === body.toUpperCase()) return true;
8496
+ return toChecksumAddress(address) === address;
8497
+ }
8498
+ function ArrowLeft() {
8499
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
8500
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6.38 3.95312L2.33333 7.99979L6.38 12.0465", stroke: "currentColor", strokeWidth: "1.2", strokeMiterlimit: "10", strokeLinecap: "round", strokeLinejoin: "round" }),
8501
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M13.6667 8H2.44667", stroke: "currentColor", strokeWidth: "1.2", strokeMiterlimit: "10", strokeLinecap: "round", strokeLinejoin: "round" })
8006
8502
  ] });
8007
8503
  }
8008
- function RecipientSheet({ state, symbol }) {
8009
- const [draft, setDraft] = react.useState(state.recipient ?? "");
8010
- const id = react.useId();
8011
- const inputRef = react.useRef(null);
8504
+ function CloseX() {
8505
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18 6L6 18M6 6L18 18", stroke: "currentColor", strokeWidth: "1.49983", strokeLinecap: "round", strokeLinejoin: "round" }) });
8506
+ }
8507
+ function AddCircle() {
8508
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": "true", children: [
8509
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 16.5C13.125 16.5 16.5 13.125 16.5 9C16.5 4.875 13.125 1.5 9 1.5C4.875 1.5 1.5 4.875 1.5 9C1.5 13.125 4.875 16.5 9 16.5Z", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round" }),
8510
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6 9H12M9 12V6", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round" })
8511
+ ] });
8512
+ }
8513
+ function Tick2() {
8514
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2.0625 6.5625L4.6875 9.1875L9.9375 3.5625", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
8515
+ }
8516
+ function Logout() {
8517
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
8518
+ "path",
8519
+ {
8520
+ fill: "currentColor",
8521
+ d: "M3.33333 14C2.96667 14 2.65289 13.8696 2.392 13.6087C2.13111 13.3478 2.00044 13.0338 2 12.6667V3.33333C2 2.96667 2.13067 2.65289 2.392 2.392C2.65333 2.13111 2.96711 2.00044 3.33333 2H7.33333C7.52222 2 7.68067 2.064 7.80867 2.192C7.93667 2.32 8.00044 2.47822 8 2.66667C7.99955 2.85511 7.93555 3.01356 7.808 3.142C7.68044 3.27044 7.52222 3.33422 7.33333 3.33333H3.33333V12.6667H7.33333C7.52222 12.6667 7.68067 12.7307 7.80867 12.8587C7.93667 12.9867 8.00044 13.1449 8 13.3333C7.99955 13.5218 7.93555 13.6802 7.808 13.8087C7.68044 13.9371 7.52222 14.0009 7.33333 14H3.33333ZM11.45 8.66667H6.66667C6.47778 8.66667 6.31955 8.60267 6.192 8.47467C6.06444 8.34667 6.00044 8.18844 6 8C5.99955 7.81155 6.06356 7.65333 6.192 7.52533C6.32044 7.39733 6.47867 7.33333 6.66667 7.33333H11.45L10.2 6.08333C10.0778 5.96111 10.0167 5.81111 10.0167 5.63333C10.0167 5.45555 10.0778 5.3 10.2 5.16667C10.3222 5.03333 10.4778 4.96378 10.6667 4.958C10.8556 4.95222 11.0167 5.01622 11.15 5.15L13.5333 7.53333C13.6667 7.66667 13.7333 7.82222 13.7333 8C13.7333 8.17778 13.6667 8.33333 13.5333 8.46667L11.15 10.85C11.0167 10.9833 10.8584 11.0473 10.6753 11.042C10.4922 11.0367 10.3338 10.9671 10.2 10.8333C10.0778 10.7 10.0196 10.5418 10.0253 10.3587C10.0311 10.1756 10.0949 10.0227 10.2167 9.9L11.45 8.66667Z"
8522
+ }
8523
+ ) });
8524
+ }
8525
+ function ShieldTickBold() {
8526
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
8527
+ "path",
8528
+ {
8529
+ fill: "currentColor",
8530
+ d: "M10.815 2.40333L7.60667 1.20167C7.27417 1.07917 6.73167 1.07917 6.39917 1.20167L3.19083 2.40333C2.5725 2.63667 2.07083 3.36 2.07083 4.01917V8.74417C2.07083 9.21667 2.38 9.84083 2.75917 10.1208L5.9675 12.5183C6.53333 12.9442 7.46083 12.9442 8.02667 12.5183L11.235 10.1208C11.6142 9.835 11.9233 9.21667 11.9233 8.74417V4.01917C11.9292 3.36 11.4275 2.63667 10.815 2.40333ZM9.03 5.67L6.52167 8.17833C6.43417 8.26583 6.32333 8.30667 6.2125 8.30667C6.10167 8.30667 5.99083 8.26583 5.90333 8.17833L4.97 7.23333C4.80083 7.06417 4.80083 6.78417 4.97 6.615C5.13917 6.44583 5.41917 6.44583 5.58833 6.615L6.21833 7.245L8.4175 5.04583C8.58667 4.87667 8.86667 4.87667 9.03583 5.04583C9.205 5.215 9.205 5.50083 9.03 5.67Z"
8531
+ }
8532
+ ) });
8533
+ }
8534
+ function CloseCircleBold() {
8535
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
8536
+ "path",
8537
+ {
8538
+ fill: "currentColor",
8539
+ d: "M7 1.16667C3.78583 1.16667 1.16667 3.78583 1.16667 7C1.16667 10.2142 3.78583 12.8333 7 12.8333C10.2142 12.8333 12.8333 10.2142 12.8333 7C12.8333 3.78583 10.2142 1.16667 7 1.16667ZM8.96 8.34167C9.12917 8.51083 9.12917 8.79083 8.96 8.96C8.8725 9.0475 8.76167 9.08833 8.65083 9.08833C8.54 9.08833 8.42917 9.0475 8.34167 8.96L7 7.61833L5.65833 8.96C5.57083 9.0475 5.46 9.08833 5.34917 9.08833C5.23833 9.08833 5.1275 9.0475 5.04 8.96C4.87083 8.79083 4.87083 8.51083 5.04 8.34167L6.38167 7L5.04 5.65833C4.87083 5.48917 4.87083 5.20917 5.04 5.04C5.20917 4.87083 5.48917 4.87083 5.65833 5.04L7 6.38167L8.34167 5.04C8.51083 4.87083 8.79083 4.87083 8.96 5.04C9.12917 5.20917 9.12917 5.48917 8.96 5.65833L7.61833 7L8.96 8.34167Z"
8540
+ }
8541
+ ) });
8542
+ }
8543
+ function Loader() {
8544
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "sg-ws-spin", width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
8545
+ "path",
8546
+ {
8547
+ fill: "currentColor",
8548
+ d: "M6.99935 12.8337C10.1616 12.8337 12.8327 10.1626 12.8327 7.00033H11.666C11.666 9.53024 9.52927 11.667 6.99935 11.667C4.46943 11.667 2.33268 9.53024 2.33268 7.00033C2.33268 4.47041 4.46943 2.33366 6.99935 2.33366V1.16699C3.8371 1.16699 1.16602 3.83866 1.16602 7.00033C1.16602 10.1626 3.8371 12.8337 6.99935 12.8337Z"
8549
+ }
8550
+ ) });
8551
+ }
8552
+ function SmallChevron() {
8553
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "5", height: "10", viewBox: "0 0 5 10", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0.503906 9L3.50391 6L0.503906 3", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }) });
8554
+ }
8555
+ function PixelGlyph() {
8556
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "21.5888", height: "17.3869", viewBox: "0 0 21.5888 17.3869", fill: "none", "aria-hidden": "true", children: [
8557
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0 0.000114202H4.94401V8.15773H0V0.000114202ZM16.6448 0.000114202H21.5888V8.15773H16.6448V0.000114202ZM4.94401 8.15773H9.55841V12.7721H4.94401V8.15773ZM12.0304 8.15773H16.6448V12.7721H12.0304V8.15773Z", fill: "#A7A9BE" }),
8558
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2.5034e-06 12.7725H4.94401V17.3869H2.5034e-06V12.7725ZM8.48722 12.7725H13.1016V17.3869H8.48722V12.7725ZM16.6448 12.7725H21.5888V17.3869H16.6448V12.7725Z", fill: "currentColor" })
8559
+ ] });
8560
+ }
8561
+ var FAMILY_LABEL = { evm: "EVM", solana: "Solana" };
8562
+ function walletShort(address) {
8563
+ return address.length > 14 ? `${address.slice(0, 7)}\u2026${address.slice(-5)}` : address;
8564
+ }
8565
+ function chipShort(address) {
8566
+ return address.length > 12 ? `${address.slice(0, 6)}\u2026${address.slice(-4)}` : address;
8567
+ }
8568
+ function WalletAvatar({ family, chainId }) {
8569
+ const [failed, setFailed] = react.useState([]);
8570
+ const mark = chainLogoCandidates(family === "solana" ? SOLANA_CHAIN_ID : chainId ?? 1).find((url) => !failed.includes(url));
8571
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-ws-avatar", "data-family": family, "aria-hidden": "true", children: [
8572
+ /* @__PURE__ */ jsxRuntime.jsx(PixelGlyph, {}),
8573
+ mark ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-ws-avatar-chain", children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: mark, alt: "", onError: () => setFailed((prev) => [...prev, mark]) }) }) : null
8574
+ ] });
8575
+ }
8576
+ function SheetFrame(props) {
8012
8577
  const sheetRef = react.useRef(null);
8013
- const closeRef = react.useRef(state.close);
8014
- closeRef.current = state.close;
8015
- const family = state.recipientFamily === "solana" ? "Solana" : "EVM";
8016
- const valid = state.recipientFamily === "solana" ? isSolanaAddress(draft) : /^0x[0-9a-fA-F]{40}$/.test(draft.trim());
8017
- const invalid = Boolean(draft.trim()) && !valid;
8018
- const noWallet = state.recipientFamily === "solana" && !state.familyWallet.address && !state.familyWallet.wallets.length;
8578
+ const closeRef = react.useRef(props.onClose);
8579
+ closeRef.current = props.onClose;
8580
+ const titleId = react.useId();
8019
8581
  react.useEffect(() => {
8020
- (noWallet ? inputRef : sheetRef).current?.focus();
8582
+ (props.initialFocus?.current ?? sheetRef.current)?.focus();
8021
8583
  const onKey = (event) => {
8022
8584
  if (event.key === "Escape") {
8023
8585
  event.stopPropagation();
@@ -8026,63 +8588,263 @@ function RecipientSheet({ state, symbol }) {
8026
8588
  };
8027
8589
  document.addEventListener("keydown", onKey, true);
8028
8590
  return () => document.removeEventListener("keydown", onKey, true);
8029
- }, [noWallet]);
8030
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-sheet", role: "dialog", "aria-modal": "true", "aria-label": `${family} recipient`, ref: sheetRef, tabIndex: -1, children: [
8031
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-sheet-head", children: [
8032
- /* @__PURE__ */ jsxRuntime.jsxs("h4", { className: "sg-cp-sheet-title", children: [
8033
- family,
8034
- " recipient"
8035
- ] }),
8036
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-cp-close", onClick: state.close, "aria-label": "Close recipient", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m6 6 12 12M18 6 6 18", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
8591
+ }, []);
8592
+ return /* @__PURE__ */ jsxRuntime.jsxs(
8593
+ "div",
8594
+ {
8595
+ className: "sg-ws",
8596
+ "data-wide": props.wide || void 0,
8597
+ role: "dialog",
8598
+ "aria-modal": "true",
8599
+ "aria-label": props.label,
8600
+ ref: sheetRef,
8601
+ tabIndex: -1,
8602
+ style: props.minHeight ? { minHeight: props.minHeight } : void 0,
8603
+ children: [
8604
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-ws-top", children: [
8605
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-ws-head", children: [
8606
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-ws-back", onClick: () => closeRef.current(), children: [
8607
+ /* @__PURE__ */ jsxRuntime.jsx(ArrowLeft, {}),
8608
+ props.backLabel ?? "Back to Exchange"
8609
+ ] }),
8610
+ props.wide ? null : /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-ws-close", onClick: () => closeRef.current(), "aria-label": `Close ${props.label.toLowerCase()}`, children: /* @__PURE__ */ jsxRuntime.jsx(CloseX, {}) })
8611
+ ] }),
8612
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-ws-main", children: [
8613
+ /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "sg-ws-title", id: titleId, children: props.title }),
8614
+ props.children
8615
+ ] })
8616
+ ] }),
8617
+ props.footer ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-ws-foot", children: props.footer }) : null
8618
+ ]
8619
+ }
8620
+ );
8621
+ }
8622
+ function WalletChip(props) {
8623
+ const count = props.addresses.length;
8624
+ if (!count) {
8625
+ return /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-wallet", onClick: props.onConnect, disabled: props.connecting, children: props.connecting ? "Connecting\u2026" : "Connect wallet" });
8626
+ }
8627
+ const label2 = count === 1 ? chipShort(props.addresses[0]) : `${count} wallets`;
8628
+ return /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", ref: props.btnRef, className: "sg-wallet", "data-connected": "true", onClick: props.onOpen, disabled: props.disabled, "aria-haspopup": "dialog", "aria-label": `Wallets: ${label2}`, children: [
8629
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-wallet-dot", "aria-hidden": "true" }),
8630
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-wallet-label", children: label2 }),
8631
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 15.9961 15.9961", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 6.99854L7.99902 10.9976L11.998 6.99854", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }) })
8632
+ ] });
8633
+ }
8634
+ function screeningSummary(states2) {
8635
+ if (!states2.length || states2.some((s) => s.status === "pending")) return { tone: "pending", text: "Checking...", action: "Pending" };
8636
+ const blocked = states2.filter((s) => s.status === "done" && s.screen.blocked).length;
8637
+ if (blocked) {
8638
+ const text = blocked === states2.length ? states2.length === 1 ? "Wallet restricted" : states2.length === 2 ? "Both wallets restricted" : "All wallets restricted" : `${blocked} of ${states2.length} wallets restricted`;
8639
+ return { tone: "blocked", text, action: "View details" };
8640
+ }
8641
+ if (states2.some((s) => s.status === "error")) return { tone: "unknown", text: "Screening unavailable", action: "Try later" };
8642
+ return { tone: "ok", text: `${states2.length} wallet${states2.length === 1 ? "" : "s"} screened`, action: "No flags" };
8643
+ }
8644
+ function WalletsSheet(props) {
8645
+ const states2 = props.wallets.map((w) => props.screens[w.address] ?? { status: "pending" });
8646
+ const summary = screeningSummary(states2);
8647
+ const anyRestricted = states2.some((s) => s.status === "done" && s.screen.blocked);
8648
+ const summaryInner = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8649
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-ws-sum-lead", children: [
8650
+ summary.tone === "pending" ? /* @__PURE__ */ jsxRuntime.jsx(Loader, {}) : summary.tone === "blocked" ? /* @__PURE__ */ jsxRuntime.jsx(CloseCircleBold, {}) : /* @__PURE__ */ jsxRuntime.jsx(ShieldTickBold, {}),
8651
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-ws-sum-text", children: summary.text })
8037
8652
  ] }),
8038
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-sheet-body", children: [
8039
- /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card", children: [
8040
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "sg-cp-summary-sub", style: { margin: "0 0 12px" }, children: [
8041
- symbol,
8042
- " is delivered to a ",
8043
- family,
8044
- " wallet. Your EVM wallet stays the owner of the order and can cancel it."
8653
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-ws-sum-act", children: [
8654
+ summary.action,
8655
+ /* @__PURE__ */ jsxRuntime.jsx(SmallChevron, {})
8656
+ ] })
8657
+ ] });
8658
+ return /* @__PURE__ */ jsxRuntime.jsx(SheetFrame, { label: "Wallets", title: "Wallets", wide: props.wide, onClose: props.onClose, minHeight: props.minHeight, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-ws-list", "data-gap": "8", children: [
8659
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-ws-list", children: [
8660
+ props.wallets.map((w, i) => {
8661
+ const state = states2[i];
8662
+ const restricted = state.status === "done" && state.screen.blocked;
8663
+ const pill = restricted ? "Restricted" : anyRestricted && state.status === "done" ? "No flags" : null;
8664
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-ws-row", "data-restricted": restricted || void 0, children: [
8665
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-ws-row-line", children: [
8666
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-ws-id", children: [
8667
+ /* @__PURE__ */ jsxRuntime.jsx(WalletAvatar, { family: w.family, chainId: w.chainId }),
8668
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-ws-id-text", children: [
8669
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-ws-id-label", children: [
8670
+ FAMILY_LABEL[w.family],
8671
+ " Wallet",
8672
+ pill ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-ws-pill", "data-tone": restricted ? "blocked" : "ok", children: pill }) : null
8673
+ ] }),
8674
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-ws-addr", title: w.address, children: walletShort(w.address) })
8675
+ ] })
8676
+ ] }),
8677
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-ws-icon-btn", onClick: w.disconnect, "aria-label": `Disconnect ${FAMILY_LABEL[w.family]} wallet`, children: /* @__PURE__ */ jsxRuntime.jsx(Logout, {}) })
8678
+ ] }),
8679
+ restricted ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-ws-note", children: "This wallet can\u2019t be used because it didn\u2019t pass compliance screening." }) : null
8680
+ ] }, w.address);
8681
+ }),
8682
+ props.connect && (props.connect.choices?.length ?? 0) > 1 ? props.connect.choices.map((name) => /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-ws-row sg-ws-action", onClick: () => props.connect.onClick(name), disabled: props.connect.busy, children: [
8683
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
8684
+ "Connect ",
8685
+ name
8045
8686
  ] }),
8046
- /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: () => noWallet ? inputRef.current?.focus() : void state.connect(), busy: state.familyWallet.connecting, children: state.familyWallet.address ? `Use ${short(state.familyWallet.address)}` : `Connect ${family} wallet` }),
8047
- !state.familyWallet.address && state.familyWallet.wallets.length > 1 ? state.familyWallet.wallets.map((wallet) => /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", onClick: () => void state.connect(wallet.name), disabled: state.familyWallet.connecting, children: wallet.name }, wallet.name)) : null,
8048
- noWallet ? /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "sg-cp-summary-sub", children: [
8049
- "No ",
8050
- family,
8051
- " wallet found. Enter a ",
8052
- family,
8053
- " address instead."
8687
+ /* @__PURE__ */ jsxRuntime.jsx(AddCircle, {})
8688
+ ] }, name)) : props.connect ? /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-ws-row sg-ws-action", onClick: () => props.connect.onClick(props.connect.choices?.[0]), disabled: props.connect.busy, children: [
8689
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: props.connect.busy ? "Connecting\u2026" : `Connect ${FAMILY_LABEL[props.connect.family]} wallet` }),
8690
+ /* @__PURE__ */ jsxRuntime.jsx(AddCircle, {})
8691
+ ] }) : null
8692
+ ] }),
8693
+ props.wallets.length ? props.onDetails && states2.every((s) => s.status === "done") ? /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-ws-sum", "data-tone": summary.tone, onClick: props.onDetails, children: summaryInner }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-ws-sum", "data-tone": summary.tone, role: "status", children: summaryInner }) : null,
8694
+ props.error ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-ws-error", role: "alert", children: props.error }) : null
8695
+ ] }) });
8696
+ }
8697
+ function RecipientRow({ state, disabled, wide }) {
8698
+ if (state.error) return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-rcp-row", "data-wide": wide || void 0, "data-tone": "error", role: "alert", children: state.error });
8699
+ const address = state.shown;
8700
+ if (!address && !state.managed) return null;
8701
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-rcp-row", "data-wide": wide || void 0, children: [
8702
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-rcp-label", children: "Recipient" }),
8703
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-rcp-end", children: [
8704
+ address ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-rcp-value", title: address, children: [
8705
+ FAMILY_LABEL[state.recipientFamily],
8706
+ " \xB7 ",
8707
+ chipShort(address)
8708
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-rcp-value", "data-empty": "true", children: "Not set" }),
8709
+ state.managed ? /* @__PURE__ */ jsxRuntime.jsx("button", { ref: state.triggerRef, type: "button", className: "sg-rcp-change", onClick: state.show, disabled, "aria-haspopup": "dialog", children: address ? "Change" : "Add" }) : null
8710
+ ] })
8711
+ ] });
8712
+ }
8713
+ function RecipientSheet({ state, wide, minHeight }) {
8714
+ const family = state.recipientFamily;
8715
+ const label2 = FAMILY_LABEL[family];
8716
+ const eligible = state.wallets.filter((w) => w.eligible);
8717
+ const [choice, setChoice] = react.useState(() => {
8718
+ if (state.typed) return { kind: "custom" };
8719
+ const current = eligible.find((w) => w.address === state.recipient) ?? eligible[0];
8720
+ return current ? { kind: "wallet", address: current.address } : { kind: "custom" };
8721
+ });
8722
+ const [draft, setDraft] = react.useState(state.typed);
8723
+ const [editing, setEditing] = react.useState(false);
8724
+ const id = react.useId();
8725
+ const inputRef = react.useRef(null);
8726
+ const noWallet = family === "solana" && !state.familyWallet.address && !state.familyWallet.wallets.length;
8727
+ const canConnect = !state.familyWallet.address && (family === "evm" || state.familyWallet.wallets.length > 0);
8728
+ const shapeOk = family === "solana" ? isSolanaAddress(draft.trim()) : /^0x[0-9a-fA-F]{40}$/.test(draft.trim());
8729
+ const checksumOk = family === "solana" || !shapeOk || hasValidChecksum(draft.trim());
8730
+ const valid = shapeOk && checksumOk;
8731
+ const invalid = choice.kind === "custom" && Boolean(draft.trim()) && !valid;
8732
+ const chosenWallet = choice.kind === "wallet" ? eligible.find((w) => w.address === choice.address) : void 0;
8733
+ const ready = choice.kind === "wallet" ? Boolean(chosenWallet) : valid;
8734
+ const custom = choice.kind === "custom";
8735
+ react.useEffect(() => {
8736
+ if (custom) inputRef.current?.focus();
8737
+ }, [custom]);
8738
+ const confirm = () => {
8739
+ if (!ready) return;
8740
+ state.selectAddress(choice.kind === "custom" ? draft.trim() : "");
8741
+ };
8742
+ const row = (w) => {
8743
+ const selected = choice.kind === "wallet" && choice.address === w.address && w.eligible;
8744
+ return /* @__PURE__ */ jsxRuntime.jsxs(
8745
+ "button",
8746
+ {
8747
+ type: "button",
8748
+ className: "sg-rcp-opt",
8749
+ "data-selected": selected || void 0,
8750
+ disabled: !w.eligible,
8751
+ "aria-pressed": selected,
8752
+ title: w.eligible ? w.address : `A ${FAMILY_LABEL[w.family]} wallet cannot receive on this chain`,
8753
+ onClick: () => setChoice({ kind: "wallet", address: w.address }),
8754
+ children: [
8755
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-ws-id", children: [
8756
+ /* @__PURE__ */ jsxRuntime.jsx(WalletAvatar, { family: w.family, chainId: w.family === "evm" ? state.recipientChainId : void 0 }),
8757
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-ws-id-text", children: [
8758
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-ws-id-label", children: [
8759
+ FAMILY_LABEL[w.family],
8760
+ " Wallet"
8761
+ ] }),
8762
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-ws-addr", children: walletShort(w.address) })
8763
+ ] })
8764
+ ] }),
8765
+ selected ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-rcp-tick", children: /* @__PURE__ */ jsxRuntime.jsx(Tick2, {}) }) : null
8766
+ ]
8767
+ },
8768
+ w.address
8769
+ );
8770
+ };
8771
+ return /* @__PURE__ */ jsxRuntime.jsx(
8772
+ SheetFrame,
8773
+ {
8774
+ label: "Recipient",
8775
+ title: "Recipient",
8776
+ wide,
8777
+ onClose: state.close,
8778
+ minHeight,
8779
+ initialFocus: noWallet ? inputRef : void 0,
8780
+ footer: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-btn sg-ws-cta", disabled: !ready, onClick: confirm, children: "Use this address" }),
8781
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-ws-list", children: [
8782
+ state.wallets.map(row),
8783
+ canConnect ? /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-ws-row sg-ws-action", onClick: () => void state.connect(), disabled: state.familyWallet.connecting, children: [
8784
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: state.familyWallet.connecting ? "Connecting\u2026" : `Connect ${label2} wallet` }),
8785
+ /* @__PURE__ */ jsxRuntime.jsx(AddCircle, {})
8054
8786
  ] }) : null,
8055
- state.familyWallet.error ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: state.familyWallet.error }) : null
8056
- ] }),
8057
- /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card", children: [
8058
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-field", style: { margin: 0 }, children: [
8059
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "sg-label", htmlFor: id, children: "Send to a different address" }),
8787
+ !state.familyWallet.address && state.familyWallet.wallets.length > 1 ? state.familyWallet.wallets.map((wallet) => /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-ws-row sg-ws-action", onClick: () => void state.connect(wallet.name), disabled: state.familyWallet.connecting, children: [
8788
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: wallet.name }),
8789
+ /* @__PURE__ */ jsxRuntime.jsx(AddCircle, {})
8790
+ ] }, wallet.name)) : null,
8791
+ custom ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-rcp-custom", "data-open": "true", children: [
8792
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-rcp-custom-head", children: [
8793
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, children: "Add another address" }),
8794
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-rcp-tick", children: /* @__PURE__ */ jsxRuntime.jsx(Tick2, {}) })
8795
+ ] }),
8060
8796
  /* @__PURE__ */ jsxRuntime.jsx(
8061
8797
  "input",
8062
8798
  {
8063
8799
  ref: inputRef,
8064
8800
  id,
8065
- className: "sg-input sg-mono",
8066
- style: { fontSize: 14, padding: "12px 14px", border: "1px solid var(--sg-border)", borderRadius: "var(--sg-radius-control)", width: "100%", boxSizing: "border-box", background: "var(--sg-bg)" },
8067
- placeholder: `${family} recipient address`,
8068
- "aria-label": `${family} recipient address`,
8801
+ className: "sg-rcp-input",
8802
+ placeholder: family === "solana" ? "Solana recipient address" : "0x...Recipient address",
8803
+ "aria-label": `${label2} recipient address`,
8069
8804
  "aria-invalid": invalid || void 0,
8070
- "aria-describedby": `${id}-help${invalid ? ` ${id}-error` : ""}`,
8071
- value: draft,
8805
+ "aria-describedby": invalid ? `${id}-error` : void 0,
8806
+ value: editing || draft.length <= 34 ? draft : `${draft.slice(0, 13)}..${draft.slice(-15)}`,
8807
+ onFocus: () => setEditing(true),
8808
+ onBlur: () => setEditing(false),
8072
8809
  onChange: (event) => setDraft(event.target.value),
8073
- spellCheck: false
8810
+ onKeyDown: (event) => {
8811
+ if (event.key === "Enter") confirm();
8812
+ },
8813
+ spellCheck: false,
8814
+ autoComplete: "off"
8074
8815
  }
8075
- )
8816
+ ),
8817
+ invalid ? /* @__PURE__ */ jsxRuntime.jsx("p", { id: `${id}-error`, className: "sg-ws-error", children: shapeOk && !checksumOk ? "Checksum does not match. Check the address for a typo." : `Not a valid ${label2} address.` }) : null,
8818
+ noWallet ? /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "sg-rcp-hint", children: [
8819
+ "No ",
8820
+ label2,
8821
+ " wallet found. Enter a ",
8822
+ label2,
8823
+ " address instead."
8824
+ ] }) : null
8825
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-rcp-custom", onClick: () => setChoice({ kind: "custom" }), children: [
8826
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Add another address" }),
8827
+ /* @__PURE__ */ jsxRuntime.jsx(AddCircle, {})
8076
8828
  ] }),
8077
- invalid ? /* @__PURE__ */ jsxRuntime.jsx("div", { id: `${id}-error`, children: /* @__PURE__ */ jsxRuntime.jsxs(StatusPanel, { tone: "error", children: [
8078
- "Not a valid ",
8079
- family,
8080
- " address."
8081
- ] }) }) : null,
8082
- /* @__PURE__ */ jsxRuntime.jsx("p", { id: `${id}-help`, className: "sg-cp-summary-sub", style: { margin: "8px 0 12px" }, children: "Double-check it: a payment sent to a wrong address cannot be recovered." }),
8083
- /* @__PURE__ */ jsxRuntime.jsx(Button, { disabled: !valid, onClick: () => state.selectAddress(draft.trim()), children: "Use this address" })
8829
+ state.familyWallet.error ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-ws-error", children: state.familyWallet.error }) : null
8084
8830
  ] })
8085
- ] })
8831
+ }
8832
+ );
8833
+ }
8834
+ var short = (address) => `${address.slice(0, 4)}\u2026${address.slice(-4)}`;
8835
+ function RecipientNote({ state, disabled }) {
8836
+ if (state.error) return /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: state.error });
8837
+ if (!state.managed) return null;
8838
+ const family = state.recipientFamily === "solana" ? "Solana" : "EVM";
8839
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "center", gap: 6, marginTop: 10, fontSize: 13, color: "var(--sg-text-muted)", flexWrap: "wrap" }, children: [
8840
+ state.recipient ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8841
+ "To ",
8842
+ /* @__PURE__ */ jsxRuntime.jsx("b", { className: "sg-mono", title: state.recipient, style: { color: "var(--sg-text)" }, children: short(state.recipient) }),
8843
+ " on ",
8844
+ family,
8845
+ " \xB7 "
8846
+ ] }) : null,
8847
+ /* @__PURE__ */ jsxRuntime.jsx("button", { ref: state.triggerRef, type: "button", className: "sg-cp-link", onClick: state.show, disabled, "aria-haspopup": "dialog", children: state.recipient ? "Change" : "Send to a different address" })
8086
8848
  ] });
8087
8849
  }
8088
8850
  var IDENTITY_KEY_PREFIX = "sg:link:v1:";
@@ -8727,6 +9489,9 @@ function PaymentIsland(props) {
8727
9489
  const selectedVisible = Boolean(sel && visibleRoutes.some((r) => r.id === sel.id));
8728
9490
  const selBal = sel ? holdings.balances[balanceKey(sel.source.chainId, sel.source.tokenAddress)] : void 0;
8729
9491
  const lastTxOwned = Boolean(flow.lastTxEntry?.hash && wallet.account && flow.lastTxEntry.account === wallet.account.toLowerCase());
9492
+ const evmDirect = flow.lastTxEntry?.settlement === "direct";
9493
+ const evmConfirmed = flow.verdict?.status === "confirmed";
9494
+ const evmDelivery = useDelivery(engine, (flow.status === "success" || flow.status === "pending") && !evmDirect ? flow.txHash : null);
8730
9495
  const mismatch = flow.status === "error" && flow.verdict?.status === "mismatch";
8731
9496
  const destTicker = isPay ? tickerOn(registryTokens, props.toChainId, props.toAsset ?? "") : exToToken ? tokenTicker(exToToken) : exToAsset ?? "";
8732
9497
  const exFromTicker = exFromToken ? tokenTicker(exFromToken) : exFromAsset ?? "";
@@ -8784,7 +9549,11 @@ function PaymentIsland(props) {
8784
9549
  linkMenu
8785
9550
  ] }) : void 0;
8786
9551
  const activeStep = flow.steps.find((s) => s.state === "active");
8787
- 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." : "";
9552
+ 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" ? (
9553
+ // Announces what the receipt shows: delivery from the tracker, never settlement on the
9554
+ // source receipt alone (review 2026-10-28).
9555
+ `${isPay ? "Payment" : verb.past}: ${deliveryHeadline(evmDelivery, evmConfirmed, evmDirect)}.`
9556
+ ) : "";
8788
9557
  const loading = flow.status === "loading";
8789
9558
  const payReady = isPay ? Boolean(sel && selectedVisible) : Boolean(sel) && !needsRecipient;
8790
9559
  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";
@@ -8829,7 +9598,7 @@ function PaymentIsland(props) {
8829
9598
  ] });
8830
9599
  let body;
8831
9600
  if (hist && wallet.account) {
8832
- body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
9601
+ body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, engine, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
8833
9602
  } else if (isPay && view === "select" && wallet.account) {
8834
9603
  body = /* @__PURE__ */ jsxRuntime.jsx(
8835
9604
  TokenSelect,
@@ -8907,7 +9676,7 @@ function PaymentIsland(props) {
8907
9676
  ] })
8908
9677
  ] });
8909
9678
  } else if (paid || settling) {
8910
- const confirmed = flow.verdict?.status === "confirmed";
9679
+ const confirmed = isDelivered(evmDelivery, evmConfirmed, evmDirect);
8911
9680
  body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8912
9681
  /* @__PURE__ */ jsxRuntime.jsx(IdentityLine, { account: wallet.account, email: identity?.email }),
8913
9682
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-receipt", children: [
@@ -8919,9 +9688,10 @@ function PaymentIsland(props) {
8919
9688
  destTicker
8920
9689
  ] }),
8921
9690
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-receipt-sub", children: [
8922
- confirmed ? "Confirmed on-chain" : "Confirmation pending",
9691
+ deliveryHeadline(evmDelivery, evmConfirmed, evmDirect),
8923
9692
  (flow.lastTxEntry?.recipient || recipient2) && (isPay || recipientState.recipientFamily === "solana") ? ` \xB7 ${shortAddress2(flow.lastTxEntry?.recipient || recipient2)}` : ""
8924
- ] })
9693
+ ] }),
9694
+ evmDirect ? null : /* @__PURE__ */ jsxRuntime.jsx(DeliverySteps, { delivery: evmDelivery })
8925
9695
  ] }),
8926
9696
  !identityMatchesWallet ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-remember", children: [
8927
9697
  /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "sg-remember-top", children: [
@@ -9346,6 +10116,9 @@ function PayCard(props) {
9346
10116
  };
9347
10117
  react.useEffect(() => setHist(null), [wallet.account]);
9348
10118
  const lastTxOwned = Boolean(flow.lastTxEntry?.hash && wallet.account && flow.lastTxEntry.account === wallet.account.toLowerCase());
10119
+ const evmDirect = flow.lastTxEntry?.settlement === "direct";
10120
+ const evmConfirmed = flow.verdict?.status === "confirmed";
10121
+ const evmDelivery = useDelivery(engine, (flow.status === "success" || flow.status === "pending") && !evmDirect ? flow.txHash : null);
9349
10122
  const pickFunding = (pick) => {
9350
10123
  setPickError(null);
9351
10124
  const r = visibleRoutes.find((x) => x.source.chainId === pick.chainId && symbolKey(x.source.asset) === symbolKey(pick.symbol));
@@ -9405,7 +10178,7 @@ function PayCard(props) {
9405
10178
  ...durationLabel(sel.quote.estimatedDuration) ? [{ label: "Estimated time", value: durationLabel(sel.quote.estimatedDuration) }] : []
9406
10179
  ] : [];
9407
10180
  const loadingPlan = flow.status === "loading" || holdings.loading && !sel || pricing !== null;
9408
- return /* @__PURE__ */ jsxRuntime.jsx(WidgetShell, { title: config.title || "Complete payment", theme: config.theme, heightPx: props.heightPx, walletSlot, onClose: props.onClose, 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(
10181
+ return /* @__PURE__ */ jsxRuntime.jsx(WidgetShell, { title: config.title || "Complete payment", theme: config.theme, heightPx: props.heightPx, walletSlot, onClose: props.onClose, children: hist && wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, engine, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory }) : view === "select" && wallet.account ? /* @__PURE__ */ jsxRuntime.jsx(
9409
10182
  TokenSelect,
9410
10183
  {
9411
10184
  title: "Pay with",
@@ -9427,17 +10200,18 @@ function PayCard(props) {
9427
10200
  ] })
9428
10201
  ] }) : flow.status === "success" || flow.status === "pending" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9429
10202
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success", children: [
9430
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-success-check", "data-pending": flow.verdict?.status !== "confirmed", children: /* @__PURE__ */ jsxRuntime.jsx(CheckGlyph3, {}) }),
10203
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-success-check", "data-pending": !isDelivered(evmDelivery, evmConfirmed, evmDirect), children: /* @__PURE__ */ jsxRuntime.jsx(CheckGlyph3, {}) }),
9431
10204
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-amt sg-mono", children: [
9432
10205
  props.amount,
9433
10206
  " ",
9434
10207
  tickerOn(registryTokens, props.toChainId, props.toAsset)
9435
10208
  ] }),
9436
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
9437
- flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
10209
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", role: "status", "aria-live": "polite", children: [
10210
+ deliveryHeadline(evmDelivery, evmConfirmed, evmDirect),
9438
10211
  " \xB7 ",
9439
10212
  shortAddress2(props.recipient)
9440
- ] })
10213
+ ] }),
10214
+ evmDirect ? null : /* @__PURE__ */ jsxRuntime.jsx(DeliverySteps, { delivery: evmDelivery })
9441
10215
  ] }),
9442
10216
  lastTxOwned ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", onClick: () => setHist({ entry: flow.lastTxEntry }), children: "View transaction" }) }) : null
9443
10217
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -9589,28 +10363,32 @@ function StableGenieSwap(props) {
9589
10363
  };
9590
10364
  }, [engine, props.variant, hist]);
9591
10365
  const lastTxOwned = Boolean(flow.lastTxEntry?.hash && wallet.account && flow.lastTxEntry.account === wallet.account.toLowerCase());
10366
+ const evmDirect = flow.lastTxEntry?.settlement === "direct";
10367
+ const evmConfirmed = flow.verdict?.status === "confirmed";
10368
+ const evmDelivery = useDelivery(engine, (flow.status === "success" || flow.status === "pending") && !evmDirect ? flow.txHash : null);
9592
10369
  if (props.variant === "pill") return /* @__PURE__ */ jsxRuntime.jsx(PaymentIsland, { kind: "swap", ...props });
9593
10370
  const walletSlot = wallet.account ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-head-tools", children: [
9594
10371
  /* @__PURE__ */ jsxRuntime.jsx(HistoryButton, { btnRef: histBtnRef, disabled: submitting, onClick: () => setHist({}) }),
9595
10372
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-brand", children: "ZeroDelta" })
9596
10373
  ] }) : void 0;
9597
10374
  if (hist && wallet.account) {
9598
- 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 }) });
10375
+ return /* @__PURE__ */ jsxRuntime.jsx(WidgetShell, { title: config.title || "Swap", theme: config.theme, walletSlot, children: /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, engine, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory }) });
9599
10376
  }
9600
10377
  if (recipientState.open) return /* @__PURE__ */ jsxRuntime.jsx(WidgetShell, { title: config.title || "Swap", theme: config.theme, walletSlot, children: /* @__PURE__ */ jsxRuntime.jsx(RecipientSheet, { state: recipientState, symbol: toAsset }) });
9601
10378
  if (flow.status === "success" || flow.status === "pending") {
9602
10379
  return /* @__PURE__ */ jsxRuntime.jsxs(WidgetShell, { title: config.title || "Swap", theme: config.theme, walletSlot, children: [
9603
10380
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success", children: [
9604
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-success-check", "data-pending": flow.verdict?.status !== "confirmed", children: /* @__PURE__ */ jsxRuntime.jsx(CheckGlyph4, {}) }),
10381
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-success-check", "data-pending": !isDelivered(evmDelivery, evmConfirmed, evmDirect), children: /* @__PURE__ */ jsxRuntime.jsx(CheckGlyph4, {}) }),
9605
10382
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-amt sg-mono", children: [
9606
10383
  receive,
9607
10384
  " ",
9608
10385
  tickerOn(registryTokens, toChainId, toAsset)
9609
10386
  ] }),
9610
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
9611
- flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
10387
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", role: "status", "aria-live": "polite", children: [
10388
+ deliveryHeadline(evmDelivery, evmConfirmed, evmDirect),
9612
10389
  recipientState.recipientFamily === "solana" ? ` \xB7 ${shortAddress2(flow.lastTxEntry?.recipient || recipient2)}` : props.recipient ? ` \xB7 ${shortAddress2(props.recipient)}` : ""
9613
- ] })
10390
+ ] }),
10391
+ evmDirect ? null : /* @__PURE__ */ jsxRuntime.jsx(DeliverySteps, { delivery: evmDelivery })
9614
10392
  ] }),
9615
10393
  lastTxOwned ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", onClick: () => setHist({ entry: flow.lastTxEntry }), children: "View transaction" }) }) : null
9616
10394
  ] });
@@ -9951,6 +10729,11 @@ function ExchangeCard(props) {
9951
10729
  evm: { account: wallet.account, connect: wallet.connect, connecting: wallet.connecting }
9952
10730
  });
9953
10731
  const recipient2 = recipientState.recipient;
10732
+ const [walletsOpen, setWalletsOpen] = react.useState(false);
10733
+ const [walletDetails, setWalletDetails] = react.useState(false);
10734
+ const [screens, setScreens] = react.useState({});
10735
+ const walletChipRef = react.useRef(null);
10736
+ const [takeoverHeight, setTakeoverHeight] = react.useState(void 0);
9954
10737
  const needsRecipient = recipientState.missing || !!recipientState.error;
9955
10738
  const onInputChange = react.useRef(props.onInputChange);
9956
10739
  onInputChange.current = props.onInputChange;
@@ -10120,7 +10903,36 @@ function ExchangeCard(props) {
10120
10903
  const connected2 = Boolean(wallet.account);
10121
10904
  const addressed = connected2 && !needsRecipient;
10122
10905
  const submitting = solActive ? solFlow.status === "preparing" || solFlow.status === "submitting" : flow.status === "submitting";
10906
+ const sheetWallets = [
10907
+ ...wallet.account ? [{ family: "evm", address: wallet.account, chainId: wallet.chainId, disconnect: () => void wallet.disconnect() }] : [],
10908
+ ...solanaWallet.address ? [{ family: "solana", address: solanaWallet.address, disconnect: () => void solanaWallet.disconnect() }] : []
10909
+ ];
10910
+ const walletKey = sheetWallets.map((w) => `${w.family}:${w.address}`).join("|");
10911
+ react.useEffect(() => {
10912
+ if (!walletsOpen) return;
10913
+ let alive = true;
10914
+ for (const w of sheetWallets) {
10915
+ setScreens((prev) => prev[w.address]?.status === "done" ? prev : { ...prev, [w.address]: { status: "pending" } });
10916
+ engine.api.screenWallet(w.address, w.family === "evm" ? w.chainId ?? void 0 : void 0).then((screen) => alive && setScreens((prev) => ({ ...prev, [w.address]: { status: "done", screen } }))).catch(() => alive && setScreens((prev) => ({ ...prev, [w.address]: { status: "error" } })));
10917
+ }
10918
+ return () => {
10919
+ alive = false;
10920
+ };
10921
+ }, [walletsOpen, walletKey, engine]);
10922
+ react.useEffect(() => {
10923
+ if (!submitting) return;
10924
+ setWalletsOpen(false);
10925
+ setWalletDetails(false);
10926
+ if (recipientState.open) recipientState.close();
10927
+ }, [submitting]);
10928
+ react.useEffect(() => {
10929
+ if (!sheetWallets.length) setWalletsOpen(false);
10930
+ }, [sheetWallets.length]);
10123
10931
  const lastTxOwned = Boolean(flow.lastTxEntry?.hash && wallet.account && flow.lastTxEntry.account === wallet.account.toLowerCase());
10932
+ const evmDirect = flow.lastTxEntry?.settlement === "direct";
10933
+ const evmConfirmed = flow.verdict?.status === "confirmed";
10934
+ const evmDelivery = useDelivery(engine, (flow.status === "success" || flow.status === "pending") && !evmDirect ? flow.txHash : null);
10935
+ const solDelivery = useDelivery(engine, solActive && solFlow.status === "sent" ? solFlow.signature : null);
10124
10936
  const quoting = solActive ? solFlow.status === "quoting" : addressed ? flow.status === "loading" : preview.status === "loading";
10125
10937
  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;
10126
10938
  const gatewayAmountError = !quoteError || solActive ? null : addressed ? flow.fieldError : preview.fieldError ?? null;
@@ -10131,6 +10943,10 @@ function ExchangeCard(props) {
10131
10943
  const receiveSideRef = react.useRef(null);
10132
10944
  const receiveShown = `${receive ?? ""}|${quoting}|${toTicker}`;
10133
10945
  useFitText(receiveOutRef, receiveShown);
10946
+ react.useLayoutEffect(() => {
10947
+ const h2 = receiveOutRef.current?.closest(".sg-widget")?.getBoundingClientRect().height;
10948
+ if (h2 && Math.round(h2) !== takeoverHeight) setTakeoverHeight(Math.round(h2));
10949
+ });
10134
10950
  useFitText(receiveSideRef, receiveShown);
10135
10951
  const toDecimals = react.useMemo(() => {
10136
10952
  try {
@@ -10165,8 +10981,8 @@ function ExchangeCard(props) {
10165
10981
  const rateRows = hasQuote ? [{ label: "Network fee", value: networkFee }, ...eta ? [{ label: "Estimated time", value: eta }] : []] : [];
10166
10982
  const via = selected ? selected.legs.length > 1 ? selected.legs[0]?.toTicker || selected.legs[0]?.toAsset || "" : null : preview.data?.via ?? null;
10167
10983
  const routeShape = via === null ? "Direct" : via ? `Via ${via}` : "Two steps";
10168
- const compliance = selected?.quote.compliance;
10169
- const complianceHasQuote = Boolean(selected && flow.status !== "loading");
10984
+ const compliance = solActive ? solanaQuoteCompliance(solFlow.plan?.preview.quote) : selected?.quote.compliance;
10985
+ const complianceHasQuote = solActive ? Boolean(solFlow.plan && solFlow.status !== "quoting") : Boolean(selected && flow.status !== "loading");
10170
10986
  const fromUsd = usdOf2(normalizedAmount, prices[from?.symbol ?? ""]);
10171
10987
  const toUsd = usdOf2(receive, prices[to?.symbol ?? ""]);
10172
10988
  const flippable = !rampMode && !submitting && Boolean(to && sourceTokens.some((t) => Number(t.chainId) === to.chainId && symbolKey(t.symbol) === to.symbol));
@@ -10177,12 +10993,26 @@ function ExchangeCard(props) {
10177
10993
  };
10178
10994
  const walletSlot = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-head-tools", children: [
10179
10995
  connected2 ? /* @__PURE__ */ jsxRuntime.jsx(HistoryButton, { btnRef: histBtnRef, disabled: submitting, onClick: () => setHist({}) }) : null,
10180
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-wallet", "data-connected": connected2 || void 0, onClick: connected2 ? void 0 : wallet.connect, disabled: wallet.connecting, children: connected2 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10181
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-wallet-dot", "aria-hidden": "true" }),
10182
- " ",
10183
- shortAddress2(wallet.account)
10184
- ] }) : wallet.connecting ? "Connecting\u2026" : "Connect wallet" })
10996
+ /* @__PURE__ */ jsxRuntime.jsx(
10997
+ WalletChip,
10998
+ {
10999
+ addresses: sheetWallets.map((w) => w.address),
11000
+ connecting: wallet.connecting,
11001
+ onConnect: wallet.connect,
11002
+ btnRef: walletChipRef,
11003
+ disabled: submitting,
11004
+ onOpen: () => {
11005
+ setSheet(null);
11006
+ setWalletsOpen(true);
11007
+ }
11008
+ }
11009
+ )
10185
11010
  ] });
11011
+ const closeWallets = () => {
11012
+ setWalletsOpen(false);
11013
+ setWalletDetails(false);
11014
+ requestAnimationFrame(() => walletChipRef.current?.focus());
11015
+ };
10186
11016
  const closeSelector = (isFrom) => {
10187
11017
  setView("main");
10188
11018
  requestAnimationFrame(() => (isFrom ? fromTileRef : toTileRef).current?.focus());
@@ -10225,7 +11055,19 @@ function ExchangeCard(props) {
10225
11055
  }
10226
11056
  );
10227
11057
  const rateBox = (open) => /* @__PURE__ */ jsxRuntime.jsx(RateBox, { rate, fromSymbol: from?.symbol ?? "", fromLogoUrl: fromToken?.logoUrl, toTicker, rows: rateRows, defaultOpen: open, paused: quotePaused });
10228
- const sheetBody = recipientState.open ? /* @__PURE__ */ jsxRuntime.jsx(RecipientSheet, { state: recipientState, symbol: toTicker }) : sheet === "compliance" ? /* @__PURE__ */ jsxRuntime.jsx(ComplianceSheet, { compliance, direct: selected?.state === "DIRECT", hasQuote: complianceHasQuote, onClose: closeSheet }) : sheet === "quote" && hasQuote ? /* @__PURE__ */ jsxRuntime.jsx(
11058
+ const walletScreens = sheetWallets.map((w) => screens[w.address]).flatMap((s) => s?.status === "done" ? [s.screen] : []);
11059
+ const sheetBody = walletsOpen && walletDetails ? /* @__PURE__ */ jsxRuntime.jsx(ComplianceSheet, { compliance: directComplianceFromScreens(walletScreens), direct: true, hasQuote: true, onClose: () => setWalletDetails(false) }) : walletsOpen ? /* @__PURE__ */ jsxRuntime.jsx(
11060
+ WalletsSheet,
11061
+ {
11062
+ wallets: sheetWallets,
11063
+ screens,
11064
+ wide,
11065
+ onClose: closeWallets,
11066
+ onDetails: walletScreens.length ? () => setWalletDetails(true) : void 0,
11067
+ connect: !wallet.account ? { family: "evm", onClick: () => void wallet.connect(), busy: wallet.connecting } : !solanaWallet.address ? { family: "solana", onClick: (name) => void solanaWallet.connect(name), busy: solanaWallet.status === "connecting", choices: solanaWallet.wallets.map((w) => w.name) } : void 0,
11068
+ error: solanaWallet.error || wallet.error
11069
+ }
11070
+ ) : recipientState.open ? /* @__PURE__ */ jsxRuntime.jsx(RecipientSheet, { state: recipientState, wide }) : sheet === "compliance" ? /* @__PURE__ */ jsxRuntime.jsx(ComplianceSheet, { compliance, direct: selected?.state === "DIRECT", hasQuote: complianceHasQuote, onClose: closeSheet }) : sheet === "quote" && hasQuote ? /* @__PURE__ */ jsxRuntime.jsx(
10229
11071
  QuoteSheet,
10230
11072
  {
10231
11073
  onClose: closeSheet,
@@ -10266,10 +11108,18 @@ function ExchangeCard(props) {
10266
11108
  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"
10267
11109
  }
10268
11110
  );
10269
- const solanaSteps = solActive && solFlow.plan && connected2 && solanaWallet.address ? /* @__PURE__ */ jsxRuntime.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;
11111
+ const solanaSteps = solActive && solFlow.plan && connected2 && solanaWallet.address && solFlow.solShort && solFlow.cost ? /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "sg-cp-summary-sub", style: { textAlign: "center", margin: "0 0 8px" }, "data-testid": "sol-shortfall", children: [
11112
+ "This order needs about ",
11113
+ (solFlow.cost.lamports / 1e9).toFixed(4),
11114
+ " SOL for network fees and rent; the wallet holds",
11115
+ " ",
11116
+ (solFlow.cost.balanceLamports / 1e9).toFixed(4),
11117
+ " SOL."
11118
+ ] }) : null;
10270
11119
  let body;
11120
+ let takeover = false;
10271
11121
  if (hist && connected2) {
10272
- body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
11122
+ body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, engine, solanaAccount: solanaWallet.address, tokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
10273
11123
  } else if (view === "from" || view === "to") {
10274
11124
  const isFrom = view === "from";
10275
11125
  body = /* @__PURE__ */ jsxRuntime.jsx(
@@ -10292,20 +11142,22 @@ function ExchangeCard(props) {
10292
11142
  }
10293
11143
  );
10294
11144
  } else if (sheetBody && !wide) {
11145
+ takeover = walletsOpen && !walletDetails || recipientState.open;
10295
11146
  body = sheetBody;
10296
11147
  } else if (solActive && solFlow.status === "sent") {
10297
11148
  body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10298
11149
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success", children: [
10299
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-success-check", "data-pending": "true", children: /* @__PURE__ */ jsxRuntime.jsx(CheckGlyph5, {}) }),
11150
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-success-check", "data-pending": !isDelivered(solDelivery, false), children: /* @__PURE__ */ jsxRuntime.jsx(CheckGlyph5, {}) }),
10300
11151
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-amt sg-mono", children: [
10301
11152
  solFlow.sent?.receive ?? receive,
10302
11153
  " ",
10303
11154
  solFlow.sent?.toTicker ?? toTicker
10304
11155
  ] }),
10305
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
10306
- "Submitted on Solana \u2014 ZeroDelta delivers it",
11156
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", role: "status", "aria-live": "polite", children: [
11157
+ solDelivery.phase === "tracking" ? "Submitted on Solana \u2014 tracking delivery" : deliveryHeadline(solDelivery, true),
10307
11158
  solFlow.sent?.recipient ? ` \xB7 ${shortAddress2(solFlow.sent.recipient)}` : ""
10308
- ] })
11159
+ ] }),
11160
+ /* @__PURE__ */ jsxRuntime.jsx(DeliverySteps, { delivery: solDelivery })
10309
11161
  ] }),
10310
11162
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
10311
11163
  solFlow.signature ? /* @__PURE__ */ jsxRuntime.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,
@@ -10316,16 +11168,17 @@ function ExchangeCard(props) {
10316
11168
  } else if (flow.status === "success" || flow.status === "pending") {
10317
11169
  body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10318
11170
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success", children: [
10319
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-success-check", "data-pending": flow.verdict?.status !== "confirmed", children: /* @__PURE__ */ jsxRuntime.jsx(CheckGlyph5, {}) }),
11171
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-success-check", "data-pending": !isDelivered(evmDelivery, evmConfirmed, evmDirect), children: /* @__PURE__ */ jsxRuntime.jsx(CheckGlyph5, {}) }),
10320
11172
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-amt sg-mono", children: [
10321
11173
  receive,
10322
11174
  " ",
10323
11175
  toTicker
10324
11176
  ] }),
10325
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
10326
- flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
11177
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", role: "status", "aria-live": "polite", children: [
11178
+ deliveryHeadline(evmDelivery, evmConfirmed, evmDirect),
10327
11179
  recipientState.recipientFamily === "solana" ? ` \xB7 ${shortAddress2(flow.lastTxEntry?.recipient || recipient2)}` : props.recipient ? ` \xB7 ${shortAddress2(props.recipient)}` : ""
10328
- ] })
11180
+ ] }),
11181
+ evmDirect ? null : /* @__PURE__ */ jsxRuntime.jsx(DeliverySteps, { delivery: evmDelivery })
10329
11182
  ] }),
10330
11183
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
10331
11184
  lastTxOwned ? /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", onClick: () => setHist({ entry: flow.lastTxEntry }), children: "View transaction" }) : null,
@@ -10338,7 +11191,6 @@ function ExchangeCard(props) {
10338
11191
  const cta = solActive ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
10339
11192
  solanaSteps,
10340
11193
  solanaCta,
10341
- /* @__PURE__ */ jsxRuntime.jsx(RecipientNote, { state: recipientState, disabled: submitting }),
10342
11194
  solanaWallet.error ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: solanaWallet.error }) : null,
10343
11195
  wallet.error ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: wallet.error }) : null
10344
11196
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
@@ -10347,7 +11199,6 @@ function ExchangeCard(props) {
10347
11199
  recipientState.recipientFamily === "solana" ? "Solana" : "EVM",
10348
11200
  " wallet"
10349
11201
  ] }) : /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: rampMode ? void 0 : flow.submit, busy: submitting, disabled: needsRecipient || rampMode || !quotable || !cryptoReady || connected2 && (!flow.selected || flow.insufficient || !!flow.nativeShortfall || flow.status === "loading"), children: ctaLabel }),
10350
- !rampMode ? /* @__PURE__ */ jsxRuntime.jsx(RecipientNote, { state: recipientState, disabled: submitting }) : null,
10351
11202
  wallet.error ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: wallet.error }) : null
10352
11203
  ] });
10353
11204
  const notices = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -10397,6 +11248,7 @@ function ExchangeCard(props) {
10397
11248
  ] }),
10398
11249
  /* @__PURE__ */ jsxRuntime.jsx(PaneFoot, { usd: hasQuote ? toUsd : null })
10399
11250
  ] }),
11251
+ !rampMode && (connected2 || recipientState.managed) ? /* @__PURE__ */ jsxRuntime.jsx(RecipientRow, { state: recipientState, disabled: submitting }) : null,
10400
11252
  rampMode ? null : props.inDialog === "drawer" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10401
11253
  complianceButton(true),
10402
11254
  quoteButton(true),
@@ -10414,7 +11266,7 @@ function ExchangeCard(props) {
10414
11266
  cta
10415
11267
  ] });
10416
11268
  }
10417
- const card = /* @__PURE__ */ jsxRuntime.jsx(WidgetShell, { title, theme: config.theme, heightPx: props.heightPx, walletSlot, onClose: props.onClose, wide, children: body });
11269
+ const card = /* @__PURE__ */ jsxRuntime.jsx(WidgetShell, { title, theme: config.theme, heightPx: props.heightPx, walletSlot, onClose: props.onClose, wide, takeover, minHeightPx: takeover ? takeoverHeight : void 0, children: body });
10418
11270
  if (!wide) return card;
10419
11271
  const resolved = resolveTheme(config.theme);
10420
11272
  const vars = themeToVars(resolved);
@@ -10461,6 +11313,7 @@ function ExchangeCard(props) {
10461
11313
  ] })
10462
11314
  ] }),
10463
11315
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-stack", children: [
11316
+ connected2 || recipientState.managed ? /* @__PURE__ */ jsxRuntime.jsx(RecipientRow, { state: recipientState, disabled: submitting, wide: true }) : null,
10464
11317
  rateBox(true),
10465
11318
  complianceButton(true),
10466
11319
  quoteButton(true)