@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/mount.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 useMergedConfig(local) {
578
706
  const ctx = react.useContext(ConfigContext);
@@ -1045,9 +1173,9 @@ function normalizeAddress(value) {
1045
1173
  if (!isAddress(value)) return null;
1046
1174
  return String(value).toLowerCase();
1047
1175
  }
1048
- function assertAddress(value, label) {
1176
+ function assertAddress(value, label2) {
1049
1177
  const normalized = normalizeAddress(value);
1050
- if (!normalized || normalized === ZERO_ADDRESS) throw new Error(`${label} is not a valid EVM address.`);
1178
+ if (!normalized || normalized === ZERO_ADDRESS) throw new Error(`${label2} is not a valid EVM address.`);
1051
1179
  return normalized;
1052
1180
  }
1053
1181
  function resolveSwapReceiver(recipient2, payer, destinationChainId) {
@@ -1065,8 +1193,8 @@ function chainAddressKey(chainId, value) {
1065
1193
  const text = String(value || "");
1066
1194
  return isSolanaChainId(chainId) ? text.trim() : text.toLowerCase();
1067
1195
  }
1068
- function assertChainAddress(chainId, value, label) {
1069
- if (!isSolanaChainId(chainId)) return assertAddress(value, label);
1196
+ function assertChainAddress(chainId, value, label2) {
1197
+ if (!isSolanaChainId(chainId)) return assertAddress(value, label2);
1070
1198
  if (!String(value || "").trim()) throw new Error("Connect a Solana wallet or enter a Solana recipient address.");
1071
1199
  if (!isSolanaAddress(value)) throw new Error("Not a valid Solana address.");
1072
1200
  return String(value).trim();
@@ -1142,9 +1270,9 @@ function encodeSubmitOrder(orders, partnerId = NO_PARTNER_ID) {
1142
1270
  const tuples = orders.map(encodeOrderTuple);
1143
1271
  let offset = 32n * BigInt(tuples.length);
1144
1272
  const offsets = tuples.map((tuple) => {
1145
- const word = uintWord(offset);
1273
+ const word2 = uintWord(offset);
1146
1274
  offset += BigInt(tuple.length / 2);
1147
- return word;
1275
+ return word2;
1148
1276
  }).join("");
1149
1277
  return `0x${SUBMIT_ORDER_SELECTOR.slice(2)}${uintWord(64)}${bytes32Word(partnerId)}${uintWord(tuples.length)}${offsets}${tuples.join("")}`;
1150
1278
  }
@@ -1155,21 +1283,21 @@ function decodeSubmitOrderCalldata(data) {
1155
1283
  if (`0x${hex.slice(0, 8)}` !== SUBMIT_ORDER_SELECTOR) return null;
1156
1284
  const body = hex.slice(8);
1157
1285
  const totalBytes = body.length / 2;
1158
- const word = (byteOffset) => {
1286
+ const word2 = (byteOffset) => {
1159
1287
  if (!Number.isSafeInteger(byteOffset) || byteOffset < 0 || byteOffset + 32 > totalBytes) return null;
1160
1288
  return BigInt(`0x${body.slice(byteOffset * 2, byteOffset * 2 + 64)}`);
1161
1289
  };
1162
1290
  const addressAt = (byteOffset) => {
1163
- const w = word(byteOffset);
1291
+ const w = word2(byteOffset);
1164
1292
  if (w === null || w >= 1n << 160n) return null;
1165
1293
  return `0x${w.toString(16).padStart(40, "0")}`;
1166
1294
  };
1167
1295
  const uint64At = (byteOffset) => {
1168
- const w = word(byteOffset);
1296
+ const w = word2(byteOffset);
1169
1297
  return w === null || w > MAX_UINT64 ? null : w;
1170
1298
  };
1171
1299
  const keyBytesAt = (byteOffset) => {
1172
- const len = word(byteOffset);
1300
+ const len = word2(byteOffset);
1173
1301
  if (len !== 20n && len !== 32n) return null;
1174
1302
  const length = Number(len);
1175
1303
  const padded = Math.ceil(length / 32) * 32;
@@ -1177,25 +1305,25 @@ function decodeSubmitOrderCalldata(data) {
1177
1305
  if (content.length !== padded * 2 || content.slice(length * 2) !== "0".repeat((padded - length) * 2)) return null;
1178
1306
  return { value: `0x${content.slice(0, length * 2)}`, size: 32 + padded };
1179
1307
  };
1180
- if (word(0) !== 64n) return null;
1181
- if (word(32) === null) return null;
1308
+ if (word2(0) !== 64n) return null;
1309
+ if (word2(32) === null) return null;
1182
1310
  const partnerId = `0x${body.slice(64, 128)}`;
1183
- const count = word(64);
1311
+ const count = word2(64);
1184
1312
  if (count === null || count < 1n || count > BigInt(MAX_DECODED_ORDERS)) return null;
1185
1313
  const n = Number(count);
1186
1314
  const arrayBase = 96;
1187
1315
  let next = arrayBase + 32 * n;
1188
1316
  const orders = [];
1189
1317
  for (let i = 0; i < n; i += 1) {
1190
- const rel = word(arrayBase + i * 32);
1318
+ const rel = word2(arrayBase + i * 32);
1191
1319
  if (rel === null || rel !== BigInt(next - arrayBase)) return null;
1192
1320
  const base = next;
1193
1321
  const owner = addressAt(base);
1194
1322
  const bidToken = addressAt(base + 32);
1195
- const bidTokenAmount = word(base + 64);
1196
- const askOffset = word(base + 96);
1197
- const askTokenAmount = word(base + 128);
1198
- const receiverOffset = word(base + 160);
1323
+ const bidTokenAmount = word2(base + 64);
1324
+ const askOffset = word2(base + 96);
1325
+ const askTokenAmount = word2(base + 128);
1326
+ const receiverOffset = word2(base + 160);
1199
1327
  const destinationChainId = uint64At(base + 192);
1200
1328
  const executionChainId = uint64At(base + 224);
1201
1329
  const deadline = uint64At(base + 256);
@@ -1818,8 +1946,8 @@ function freeze(value) {
1818
1946
  }
1819
1947
  return value;
1820
1948
  }
1821
- function raw(value, label, positive = false) {
1822
- if (typeof value !== "string" || !/^\d+$/.test(value) || positive && BigInt(value) <= 0n || BigInt(value) >= 1n << 256n) throw new Error(`Invalid ${label}.`);
1949
+ function raw(value, label2, positive = false) {
1950
+ if (typeof value !== "string" || !/^\d+$/.test(value) || positive && BigInt(value) <= 0n || BigInt(value) >= 1n << 256n) throw new Error(`Invalid ${label2}.`);
1823
1951
  return value;
1824
1952
  }
1825
1953
  function chain(value) {
@@ -1932,6 +2060,12 @@ async function previewSolanaSource(api, input) {
1932
2060
  nativeFeeRaw: "0"
1933
2061
  };
1934
2062
  }
2063
+ function solanaQuoteCompliance(quote) {
2064
+ for (const value of [quote?.complianceDecision, quote?.compliance]) {
2065
+ if (value && typeof value === "object" && !Array.isArray(value)) return value;
2066
+ }
2067
+ return void 0;
2068
+ }
1935
2069
  function denied(value) {
1936
2070
  return typeof value === "string" ? value.toUpperCase() === "DENY" : !!value && typeof value === "object" && denied(value.decision);
1937
2071
  }
@@ -2049,6 +2183,7 @@ function createSolanaRpc(api) {
2049
2183
  body: JSON.stringify({ jsonrpc: "2.0", id: 1, method, params }),
2050
2184
  timeoutMs: 15e3
2051
2185
  });
2186
+ if (body.error && solanaLamportShortfall(body.error.data?.logs) !== null) throw new Error(SOL_SHORTFALL_MESSAGE);
2052
2187
  if (body.error || body.result === void 0) throw new Error(body.error?.message || "Invalid Solana RPC response.");
2053
2188
  return body.result;
2054
2189
  };
@@ -2213,18 +2348,141 @@ async function readSolanaBalance(rpc, owner, mint) {
2213
2348
  return void 0;
2214
2349
  }
2215
2350
  }
2351
+ function solanaLamportShortfall(logs) {
2352
+ if (!Array.isArray(logs)) return null;
2353
+ for (const line of logs) {
2354
+ const m = /insufficient lamports (\d+), need (\d+)/.exec(String(line));
2355
+ if (m) {
2356
+ const need = Number(m[2]);
2357
+ return Number.isSafeInteger(need) && need > 0 ? need : null;
2358
+ }
2359
+ }
2360
+ return null;
2361
+ }
2362
+ 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.";
2216
2363
  async function simulateSolanaCost(rpc, plan) {
2217
2364
  checkSolanaPlan(plan.txData);
2218
2365
  const signer = plan.expected.signer;
2219
2366
  const before = await rpc("getAccountInfo", [signer, { encoding: "base64", commitment: "confirmed" }]);
2220
2367
  const sim = await rpc("simulateTransaction", [plan.txData[0].transaction, { encoding: "base64", sigVerify: false, replaceRecentBlockhash: true, accounts: { addresses: [signer], encoding: "base64" } }]);
2221
- if (sim.value?.err) throw new Error(`Simulation failed: ${JSON.stringify(sim.value.err)}`);
2222
2368
  const balanceLamports = before.value?.lamports ?? 0, post = sim.value?.accounts?.[0]?.lamports;
2369
+ if (sim.value?.err) {
2370
+ const need = solanaLamportShortfall(sim.value.logs);
2371
+ if (need !== null && Number.isSafeInteger(balanceLamports)) return { lamports: need, balanceLamports, sufficient: false };
2372
+ throw new Error(`Simulation failed: ${JSON.stringify(sim.value.err)}`);
2373
+ }
2223
2374
  if (!Number.isSafeInteger(balanceLamports) || balanceLamports < 0 || post !== void 0 && (!Number.isSafeInteger(post) || post < 0)) throw new Error("Invalid simulation lamports.");
2224
2375
  const lamports = typeof post === "number" ? Math.max(0, balanceLamports - post) : 0;
2225
2376
  return { lamports, balanceLamports, sufficient: balanceLamports >= lamports };
2226
2377
  }
2227
2378
 
2379
+ // src/core/history.ts
2380
+ var WALLET_HISTORY_LIMIT = 50;
2381
+ var HASH2 = /^(?:0x[0-9a-fA-F]{64}|[1-9A-HJ-NP-Za-km-z]{64,88})$/;
2382
+ var WALLET = /^(?:0x[0-9a-fA-F]{40}|[1-9A-HJ-NP-Za-km-z]{32,44})$/;
2383
+ function historyKey(value) {
2384
+ return value.startsWith("0x") ? value.toLowerCase() : value;
2385
+ }
2386
+ var str = (v) => typeof v === "string" ? v : typeof v === "number" ? String(v) : "";
2387
+ function tokenAt(tokens, chainId, address) {
2388
+ if (!address) return void 0;
2389
+ const key = historyKey(address);
2390
+ return tokens.find((t) => Number(t.chainId) === chainId && historyKey(String(t.address)) === key);
2391
+ }
2392
+ function amountOf(raw2, token, rowDecimals, rowAmount) {
2393
+ const decimals = token ? Number(token.decimals) : Number(rowDecimals);
2394
+ if (/^\d{1,78}$/.test(raw2) && Number.isInteger(decimals) && decimals > 0 && decimals <= 36) return formatUnits(raw2, decimals);
2395
+ return Number(rowDecimals) > 0 && /^\d+(?:\.\d+)?$/.test(rowAmount) ? rowAmount.slice(0, 40) : "";
2396
+ }
2397
+ function historyEntryFromOrder(raw2, tokens) {
2398
+ if (!raw2 || typeof raw2 !== "object" || Array.isArray(raw2)) return null;
2399
+ const r = raw2;
2400
+ const hash2 = str(r.txHash);
2401
+ if (!HASH2.test(hash2)) return null;
2402
+ const fromChainId = Number(r.sourceChainId) || 0;
2403
+ const toChainId = Number(r.finalDestChainId ?? r.destChainId) || 0;
2404
+ const from = tokenAt(tokens, fromChainId, str(r.fromTokenAddress));
2405
+ const toAddress = str(r.finalToTokenAddress) || str(r.toTokenAddress);
2406
+ const to = tokenAt(tokens, toChainId, toAddress);
2407
+ const fromAsset = (from?.symbol ?? str(r.fromTokenSymbol)).slice(0, 10);
2408
+ const toAsset = (to?.symbol ?? (str(r.finalToTokenSymbol) || str(r.toTokenSymbol))).slice(0, 10);
2409
+ const payAmount = amountOf(str(r.fromTokenRawAmount), from, r.fromTokenDecimals, str(r.fromTokenAmount));
2410
+ 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));
2411
+ const delivery = normalizeDelivery(r).phase;
2412
+ const wallet = str(r.wallet);
2413
+ const receiver = str(r.destinationReceiver);
2414
+ const at = str(r.createdAt) || str(r.submittedAt);
2415
+ return {
2416
+ kind: "swap",
2417
+ hash: hash2,
2418
+ txKind: "submitOrder",
2419
+ chainId: fromChainId || null,
2420
+ chainName: "",
2421
+ fromAsset,
2422
+ toAsset,
2423
+ fromTicker: from ? tokenTicker(from).slice(0, 12) : void 0,
2424
+ toTicker: to ? tokenTicker(to).slice(0, 12) : void 0,
2425
+ payAmount,
2426
+ receiveAmount,
2427
+ account: WALLET.test(wallet) ? historyKey(wallet) : "",
2428
+ recipient: WALLET.test(receiver) ? receiver : "",
2429
+ settlement: "escrow",
2430
+ status: "submitted",
2431
+ at: Number.isNaN(Date.parse(at)) ? (/* @__PURE__ */ new Date(0)).toISOString() : new Date(at).toISOString(),
2432
+ delivery: delivery === "tracking" || delivery === "unavailable" ? void 0 : delivery,
2433
+ legs: [
2434
+ {
2435
+ index: 1,
2436
+ fromAsset,
2437
+ fromTicker: from ? tokenTicker(from).slice(0, 12) : void 0,
2438
+ fromChainId,
2439
+ fromChainName: "",
2440
+ fromAmount: payAmount,
2441
+ toAsset,
2442
+ toTicker: to ? tokenTicker(to).slice(0, 12) : void 0,
2443
+ toChainId,
2444
+ toChainName: "",
2445
+ toAmount: receiveAmount,
2446
+ executionChainId: Number(r.executionChainId) || 0,
2447
+ executionChainName: ""
2448
+ }
2449
+ ]
2450
+ };
2451
+ }
2452
+ async function fetchWalletHistory(api, wallets) {
2453
+ const asked = [...new Set(wallets.filter((w) => WALLET.test(w)).map(historyKey))];
2454
+ if (!asked.length) return [];
2455
+ const tokens = await api.fetchTokens().catch(() => []);
2456
+ const reads = await Promise.all(
2457
+ asked.map(async (wallet) => {
2458
+ try {
2459
+ const rows = await api.apiRequest(`/transactions?wallet=${encodeURIComponent(wallet)}&limit=${WALLET_HISTORY_LIMIT}`, { timeoutMs: 1e4 });
2460
+ if (!Array.isArray(rows)) return null;
2461
+ return rows.filter((row) => historyKey(str(row?.wallet)) === wallet).map((row) => historyEntryFromOrder(row, tokens));
2462
+ } catch {
2463
+ return null;
2464
+ }
2465
+ })
2466
+ );
2467
+ if (reads.every((read) => read === null)) return null;
2468
+ return reads.flatMap((read) => read ?? []).filter((e) => e !== null);
2469
+ }
2470
+ function mergeHistory(local, remote, limit = WALLET_HISTORY_LIMIT) {
2471
+ const byHash = /* @__PURE__ */ new Map();
2472
+ for (const entry of remote ?? []) if (!byHash.has(historyKey(entry.hash))) byHash.set(historyKey(entry.hash), entry);
2473
+ const out = [];
2474
+ const seen = /* @__PURE__ */ new Set();
2475
+ for (const entry of local) {
2476
+ const key = historyKey(entry.hash);
2477
+ if (seen.has(key)) continue;
2478
+ seen.add(key);
2479
+ const known = byHash.get(key);
2480
+ out.push(known ? { ...entry, delivery: known.delivery, legs: entry.legs ?? known.legs } : entry);
2481
+ }
2482
+ for (const [key, entry] of byHash) if (!seen.has(key)) out.push(entry);
2483
+ return out.sort((a, b) => Date.parse(b.at) - Date.parse(a.at)).slice(0, limit);
2484
+ }
2485
+
2228
2486
  // src/core/escrow.ts
2229
2487
  function checkEscrow(chainId, quoteEscrow, chainsEscrow) {
2230
2488
  const fromQuote = normalizeAddress(quoteEscrow);
@@ -2479,11 +2737,11 @@ function complianceView(compliance, hasQuote = true) {
2479
2737
  };
2480
2738
  }
2481
2739
  if (decision === "REVIEW" || decision === "REMEDIATE") {
2482
- const word = decision.toLowerCase();
2740
+ const word2 = decision.toLowerCase();
2483
2741
  return {
2484
2742
  tone: "warn",
2485
- label: `Compliance: ${word} required`,
2486
- headline: `Manual ${word} required`,
2743
+ label: `Compliance: ${word2} required`,
2744
+ headline: `Manual ${word2} required`,
2487
2745
  blocked: false,
2488
2746
  needsAction: true,
2489
2747
  screened
@@ -2717,8 +2975,8 @@ var BLOCK_CATEGORY_LABELS = {
2717
2975
  var BLOCK_LABEL_DEFAULT = "flagged by compliance screening";
2718
2976
  function blockLabelFor(categories) {
2719
2977
  for (const raw2 of categories) {
2720
- const label = BLOCK_CATEGORY_LABELS[String(raw2 || "").trim().toUpperCase()];
2721
- if (label) return label;
2978
+ const label2 = BLOCK_CATEGORY_LABELS[String(raw2 || "").trim().toUpperCase()];
2979
+ if (label2) return label2;
2722
2980
  }
2723
2981
  return BLOCK_LABEL_DEFAULT;
2724
2982
  }
@@ -2918,8 +3176,8 @@ function normalizeOrderRequest(order, payer, destination, fallbackExecutionChain
2918
3176
  const executionChainId = String(order.executionChainId || fallbackExecutionChainId || "0");
2919
3177
  if (!/^\d+$/.test(executionChainId) || BigInt(executionChainId) <= 0n) throw new Error("ZeroDelta quote did not include an execution chain.");
2920
3178
  const solana = isSolanaChainId(order.destinationChainId || destination.chainId);
2921
- const keyBytes2 = (value, label) => {
2922
- if (!/^0x[0-9a-fA-F]{64}$/.test(String(value || ""))) throw new Error(`${label} is not a valid 32-byte Solana key.`);
3179
+ const keyBytes2 = (value, label2) => {
3180
+ if (!/^0x[0-9a-fA-F]{64}$/.test(String(value || ""))) throw new Error(`${label2} is not a valid 32-byte Solana key.`);
2923
3181
  return String(value).toLowerCase();
2924
3182
  };
2925
3183
  return {
@@ -3038,7 +3296,7 @@ function routeLabelFor(option, destinationToken, result) {
3038
3296
  const bridge = result.quote.bridge ? ` via ${result.quote.bridge}` : "";
3039
3297
  return `Swap ${optionTicker(option)} to ${tokenTicker(destinationToken)} and settle on ZeroDelta${bridge}.`;
3040
3298
  }
3041
- function tokenAt(tokens, chainId, address) {
3299
+ function tokenAt2(tokens, chainId, address) {
3042
3300
  const key = isSolanaChainId(chainId) ? hexToSolanaKey(address) || address : address;
3043
3301
  const wanted = isChainAddress(chainId, key) ? chainAddressKey(chainId, key) : null;
3044
3302
  if (!wanted || !tokens?.length) return void 0;
@@ -3062,7 +3320,7 @@ function buildLegs(orders, ctx) {
3062
3320
  const order = orders[index];
3063
3321
  const isLast = index === orders.length - 1;
3064
3322
  const toChainId = Number(order.destinationChainId);
3065
- const askToken = isLast ? ctx.destinationToken : tokenAt(ctx.tokens, toChainId, order.askToken);
3323
+ const askToken = isLast ? ctx.destinationToken : tokenAt2(ctx.tokens, toChainId, order.askToken);
3066
3324
  const toAsset = isLast ? ctx.destinationToken.symbol : askToken?.symbol ?? "";
3067
3325
  const toTicker = askToken ? tokenTicker(askToken) : "";
3068
3326
  const toDecimals = askToken ? assetDecimals(askToken) : void 0;
@@ -3280,7 +3538,7 @@ var CHANNEL_HEADER = "x-zd-channel";
3280
3538
  var CHANNEL_VERSION_HEADER = "x-zd-channel-version";
3281
3539
  var CHANNEL_ORIGIN_HEADER = "x-zd-channel-origin";
3282
3540
  var WIDGET_CHANNEL = "widget";
3283
- var WIDGET_VERSION = "4.13.0" ;
3541
+ var WIDGET_VERSION = "4.14.0" ;
3284
3542
  var MAX_CHANNEL_VERSION_LEN = 32;
3285
3543
  function sanitizeVersion(raw2) {
3286
3544
  const v = String(raw2).trim();
@@ -3361,12 +3619,12 @@ function classifyQuoteError(error) {
3361
3619
  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);
3362
3620
  if (!isBlock) return null;
3363
3621
  const category = (catMatch?.[1] || "").toUpperCase() || "COMPLIANCE";
3364
- const label = blockLabelFor([category]);
3622
+ const label2 = blockLabelFor([category]);
3365
3623
  return {
3366
3624
  blocked: true,
3367
3625
  category,
3368
3626
  reason: reasons.join(", ") || error.message || "",
3369
- message: `This payment was blocked by compliance screening \u2014 the recipient is ${label}. Choose a different recipient or connect a different wallet.`
3627
+ message: `This payment was blocked by compliance screening \u2014 the recipient is ${label2}. Choose a different recipient or connect a different wallet.`
3370
3628
  };
3371
3629
  }
3372
3630
  function amountFieldError(error) {
@@ -3939,16 +4197,16 @@ function isHexQuantity(value) {
3939
4197
  return /^0x[0-9a-fA-F]+$/.test(String(value));
3940
4198
  }
3941
4199
  function dataWord(data, index) {
3942
- const word = String(data || "").slice(10 + index * 64, 10 + (index + 1) * 64);
3943
- return /^[a-fA-F0-9]{64}$/.test(word) ? word : "";
4200
+ const word2 = String(data || "").slice(10 + index * 64, 10 + (index + 1) * 64);
4201
+ return /^[a-fA-F0-9]{64}$/.test(word2) ? word2 : "";
3944
4202
  }
3945
4203
  function dataAddress(data, index) {
3946
- const word = dataWord(data, index);
3947
- return word ? `0x${word.slice(24)}` : "";
4204
+ const word2 = dataWord(data, index);
4205
+ return word2 ? `0x${word2.slice(24)}` : "";
3948
4206
  }
3949
4207
  function dataUint(data, index) {
3950
- const word = dataWord(data, index);
3951
- return word ? BigInt(`0x${word}`) : null;
4208
+ const word2 = dataWord(data, index);
4209
+ return word2 ? BigInt(`0x${word2}`) : null;
3952
4210
  }
3953
4211
  function rawEquals(value, expected) {
3954
4212
  try {
@@ -4366,6 +4624,8 @@ function createEngine(config = {}) {
4366
4624
  executeSolanaPlan: (input) => executeSolanaPlan({ ...input, rpc: input.rpc ?? solanaRpc }),
4367
4625
  executeSolanaPlanStaged: (input) => executeSolanaPlanStaged({ ...input, rpc: input.rpc ?? solanaRpc }),
4368
4626
  previewSolanaSource: (input) => previewSolanaSource(api, input),
4627
+ trackDelivery: (hash2) => fetchDelivery(api, hash2),
4628
+ fetchWalletHistory: (wallets) => fetchWalletHistory(api, wallets),
4369
4629
  readSolanaBalance: (owner, mint) => readSolanaBalance(solanaRpc, owner, mint),
4370
4630
  simulateSolanaCost: (plan) => simulateSolanaCost(solanaRpc, plan),
4371
4631
  payerNonceBaseline: verifier.payerNonceBaseline,
@@ -4561,18 +4821,20 @@ function useWallet(injected2) {
4561
4821
  const [connecting, setConnecting] = react.useState(false);
4562
4822
  const [error, setError] = react.useState(null);
4563
4823
  const providerRef = react.useRef(injected2 ?? null);
4824
+ const forgotten = react.useRef(false);
4825
+ const generation = react.useRef(0);
4564
4826
  react.useEffect(() => {
4565
4827
  const p = provider;
4566
4828
  if (!p) return;
4567
4829
  let alive = true;
4568
- const onAccounts = (accs) => alive && setAccount(Array.isArray(accs) && accs[0] ? accs[0] : null);
4830
+ const onAccounts = (accs) => alive && !forgotten.current && setAccount(Array.isArray(accs) && accs[0] ? accs[0] : null);
4569
4831
  const onChain = (hex) => alive && setChainId(hexToChain(hex));
4570
4832
  p.on?.("accountsChanged", onAccounts);
4571
4833
  p.on?.("chainChanged", onChain);
4572
4834
  (async () => {
4573
4835
  try {
4574
4836
  const accs = await getAccounts(p);
4575
- if (alive && accs[0]) setAccount(accs[0]);
4837
+ if (alive && accs[0] && !forgotten.current) setAccount(accs[0]);
4576
4838
  const cid = await getChainId(p);
4577
4839
  if (alive) setChainId(cid);
4578
4840
  } catch {
@@ -4593,11 +4855,14 @@ function useWallet(injected2) {
4593
4855
  const connect = react.useCallback(async () => {
4594
4856
  setConnecting(true);
4595
4857
  setError(null);
4858
+ forgotten.current = false;
4859
+ const request = ++generation.current;
4596
4860
  try {
4597
4861
  const p = providerRef.current ?? await resolveProvider(injected2);
4598
4862
  providerRef.current = p;
4599
4863
  setProvider(p);
4600
4864
  const accs = await requestAccounts(p);
4865
+ if (request !== generation.current) return;
4601
4866
  setAccount(accs[0] ?? null);
4602
4867
  setChainId(await getChainId(p));
4603
4868
  } catch (e) {
@@ -4606,7 +4871,19 @@ function useWallet(injected2) {
4606
4871
  setConnecting(false);
4607
4872
  }
4608
4873
  }, [injected2]);
4609
- return { provider, account, chainId, connecting, error, connect };
4874
+ const disconnect = react.useCallback(async () => {
4875
+ forgotten.current = true;
4876
+ generation.current += 1;
4877
+ setConnecting(false);
4878
+ setAccount(null);
4879
+ setError(null);
4880
+ const p = providerRef.current;
4881
+ try {
4882
+ await p?.request({ method: "wallet_revokePermissions", params: [{ eth_accounts: {} }] });
4883
+ } catch {
4884
+ }
4885
+ }, []);
4886
+ return { provider, account, chainId, connecting, error, connect, disconnect };
4610
4887
  }
4611
4888
 
4612
4889
  // src/react/txHistoryStore.ts
@@ -5239,6 +5516,7 @@ var WIDGET_CSS = `
5239
5516
  .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}
5240
5517
  /* Broadcast but not receipt-confirmed: mute the disc so a pending settlement never wears the
5241
5518
  accent-coloured "paid" affordance. Mirrors .sg-settle-disc[data-pending] in the island. */
5519
+ .sg-success-steps{font-size:12px;color:var(--sg-text-muted);margin-top:6px;text-align:center}
5242
5520
  .sg-success-check[data-pending="true"]{background:var(--sg-surface);color:var(--sg-text-muted);border:1px solid var(--sg-border)}
5243
5521
  .sg-success-amt{font-size:20px;font-weight:700;font-variant-numeric:tabular-nums}
5244
5522
  .sg-success-sub{font-size:12px;color:var(--sg-text-muted);margin-top:2px}
@@ -5848,6 +6126,106 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
5848
6126
  .sg-overlay[data-sg-overlay="drawer"] .sg-pane--note{min-height:145px}
5849
6127
  @keyframes sg-drawer-in{from{transform:translateX(100%)}to{transform:none}}
5850
6128
  @media (prefers-reduced-motion:reduce){.sg-overlay,.sg-dialog{animation:none!important}.sg-pillbtn{transition:none}}
6129
+ /* \u2500\u2500 Wallets + Recipient sheets \u2014 Figma ZD-dApp 3154:48121 / 3155:49634 (2026-10-28) \u2500\u2500 */
6130
+ .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}
6131
+ .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)}
6132
+ .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)}
6133
+ .sg-wallet[data-connected="true"]:hover:not(:disabled){border-color:var(--sg-accent);color:var(--sg-t80)}
6134
+ .sg-wallet[data-connected="true"]:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px}
6135
+ .sg-wallet-label{opacity:.9}
6136
+ .sg-wallet[data-connected="true"] svg{flex:0 0 auto;margin-right:-1px}
6137
+ .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}
6138
+ .sg-ws:focus{outline:none}
6139
+ .sg-ws-top{display:flex;flex-direction:column;gap:28px}
6140
+ .sg-ws-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
6141
+ .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}
6142
+ .sg-ws-back svg{flex:0 0 auto}
6143
+ .sg-ws-back:hover{color:var(--sg-text)}
6144
+ .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}
6145
+ .sg-ws-close:hover{color:var(--sg-text)}
6146
+ .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}
6147
+ .sg-ws-main{display:flex;flex-direction:column;gap:16px}
6148
+ .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)}
6149
+ .sg-ws[data-wide]{gap:16px}
6150
+ .sg-ws[data-wide] .sg-ws-sum-lead{min-width:0}
6151
+ .sg-ws[data-wide] .sg-ws-sum-text{overflow:hidden;text-overflow:ellipsis}
6152
+ .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)}
6153
+ .sg-ws[data-wide] .sg-ws-back{font-size:12px;font-weight:400}
6154
+ .sg-ws[data-wide] .sg-ws-title{font-family:var(--sg-font);font-size:18px;font-weight:500;letter-spacing:0}
6155
+ .sg-ws-list{display:flex;flex-direction:column;gap:4px}
6156
+ .sg-ws-list[data-gap="8"]{gap:8px}
6157
+ .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}
6158
+ .sg-ws-row-line{display:flex;align-items:center;justify-content:space-between;gap:12px}
6159
+ .sg-ws-id{display:flex;align-items:center;gap:20px;min-width:0}
6160
+ .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}
6161
+ .sg-ws-id-label{display:inline-flex;align-items:center;gap:8px;font-size:12px;color:var(--sg-t50)}
6162
+ .sg-ws-addr{font-size:16px;font-weight:500;color:var(--sg-t80)}
6163
+ .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}
6164
+ .sg-ws-pill[data-tone="blocked"]{background:color-mix(in srgb,var(--sg-flag) 12%,transparent);color:var(--sg-flag)}
6165
+ .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)}
6166
+ .sg-ws-note{margin:0;font-size:12px;line-height:1.2;color:var(--sg-t60)}
6167
+ .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}
6168
+ .sg-ws-avatar[data-family="solana"]{background:#1a2ba3;color:#fff}
6169
+ .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}
6170
+ .sg-ws-avatar-chain img{display:block;width:12px;height:12px;border-radius:8px;object-fit:cover}
6171
+ .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}
6172
+ .sg-ws-icon-btn:hover{background:var(--sg-a12)}
6173
+ .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}
6174
+ .sg-ws-action:hover:not(:disabled){background:color-mix(in srgb,var(--sg-accent) 8%,transparent)}
6175
+ .sg-ws-action:disabled{cursor:progress;opacity:.7}
6176
+ .sg-ws-action svg{flex:0 0 auto}
6177
+ .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)}
6178
+ button.sg-ws-sum{cursor:pointer}
6179
+ .sg-ws-sum[data-tone="ok"]{background:color-mix(in srgb,var(--sg-success) 4%,transparent)}
6180
+ .sg-ws-sum[data-tone="blocked"]{background:color-mix(in srgb,var(--sg-flag) 8%,transparent)}
6181
+ .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}
6182
+ .sg-ws-sum-lead svg{flex:0 0 auto;color:var(--sg-accent)}
6183
+ .sg-ws-sum[data-tone="ok"] .sg-ws-sum-lead svg{color:var(--sg-success)}
6184
+ .sg-ws-sum[data-tone="blocked"] .sg-ws-sum-lead svg{color:var(--sg-flag)}
6185
+ .sg-ws-sum[data-tone="unknown"] .sg-ws-sum-lead svg{color:var(--sg-text-muted)}
6186
+ .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}
6187
+ .sg-ws-sum[data-tone="ok"] .sg-ws-sum-act{color:var(--sg-ok-ink)}
6188
+ .sg-ws-sum[data-tone="ok"] .sg-ws-sum-act svg{color:color-mix(in srgb,var(--sg-success) 80%,transparent)}
6189
+ .sg-ws-sum[data-tone="blocked"] .sg-ws-sum-act{color:var(--sg-flag)}
6190
+ .sg-ws-sum[data-tone="unknown"] .sg-ws-sum-act{color:var(--sg-text-muted)}
6191
+ .sg-ws-spin{animation:sg-ws-spin 900ms linear infinite}
6192
+ @keyframes sg-ws-spin{to{transform:rotate(360deg)}}
6193
+ .sg-ws-error{margin:0;font-size:12px;line-height:1.3;color:var(--sg-danger)}
6194
+ .sg-ws-foot{flex:0 0 auto}
6195
+ .sg-btn.sg-ws-cta{height:44px;min-height:44px;padding:0 24px}
6196
+ .sg-btn.sg-ws-cta:disabled{opacity:.2;cursor:not-allowed}
6197
+ .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}
6198
+ .sg-rcp-row[data-wide]{background:transparent;border:1px solid var(--sg-a12);padding:12px 16px}
6199
+ .sg-rcp-row[data-tone="error"]{white-space:normal;color:var(--sg-danger);background:color-mix(in srgb,var(--sg-danger) 8%,transparent)}
6200
+ .sg-rcp-label{color:var(--sg-t60)}
6201
+ .sg-rcp-end{display:inline-flex;align-items:center;gap:8px;min-width:0}
6202
+ .sg-rcp-value{color:var(--sg-t90);overflow:hidden;text-overflow:ellipsis}
6203
+ .sg-rcp-value[data-empty]{color:var(--sg-t50)}
6204
+ .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}
6205
+ .sg-rcp-change:hover:not(:disabled){text-decoration:underline}
6206
+ .sg-rcp-change:disabled{opacity:.5;cursor:not-allowed}
6207
+ .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}
6208
+ .sg-rcp-opt[data-selected]{border-color:transparent;background:var(--sg-a4)}
6209
+ .sg-rcp-opt:hover:not(:disabled):not([data-selected]){border-color:color-mix(in srgb,var(--sg-accent) 40%,transparent)}
6210
+ .sg-rcp-opt:disabled{cursor:not-allowed;opacity:.45}
6211
+ .sg-rcp-tick{display:flex;color:var(--sg-accent);flex:0 0 auto}
6212
+ .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}
6213
+ .sg-rcp-custom svg{flex:0 0 auto}
6214
+ .sg-rcp-custom[data-open]{flex-direction:column;align-items:stretch;gap:8px;border-color:transparent;background:var(--sg-a4);cursor:default}
6215
+ .sg-rcp-custom-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
6216
+ .sg-rcp-custom-head label{cursor:text}
6217
+ .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}
6218
+ .sg-rcp-input::placeholder{color:var(--sg-t50)}
6219
+ .sg-rcp-input:focus{border-color:var(--sg-accent)}
6220
+ .sg-rcp-input[aria-invalid="true"]{border-color:var(--sg-danger)}
6221
+ .sg-rcp-hint{margin:0;font-size:12px;font-weight:400;line-height:1.2;color:var(--sg-t60)}
6222
+ .sg-widget[data-sg-takeover]{display:flex;flex-direction:column}
6223
+ .sg-widget[data-sg-takeover]>.sg-head,.sg-widget[data-sg-takeover]>.sg-foot{display:none}
6224
+ .sg-widget[data-sg-takeover]>.sg-body{display:flex;flex-direction:column;flex:1 1 auto}
6225
+ .sg-widget[data-sg-takeover]>.sg-body>.sg-ws{flex:1 1 auto}
6226
+ .sg-widget[data-sg-side]:has(>.sg-ws){display:flex;flex-direction:column}
6227
+ .sg-widget[data-sg-side]>.sg-ws{flex:1 1 auto}
6228
+ @media (prefers-reduced-motion:reduce){.sg-ws{animation:none}.sg-ws-spin{animation:none}}
5851
6229
  `;
5852
6230
  var injected = false;
5853
6231
  function injectStyles() {
@@ -6129,7 +6507,7 @@ function StepList(props) {
6129
6507
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: s.state === "done" ? "sg-muted" : "", children: s.label }),
6130
6508
  rich ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-sr-only", children: ` \u2014 ${STEP_STATE_WORD[s.state]}` }) : null
6131
6509
  ] }, s.id)) }),
6132
- 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
6510
+ 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
6133
6511
  ] });
6134
6512
  }
6135
6513
  var SHOW_ROADMAP_METHODS = true;
@@ -6469,8 +6847,8 @@ var CHAIN_ALIASES = {
6469
6847
  137: ["matic"],
6470
6848
  43114: ["avax"]
6471
6849
  };
6472
- function labelForms(label) {
6473
- const lower2 = label.trim().toLowerCase();
6850
+ function labelForms(label2) {
6851
+ const lower2 = label2.trim().toLowerCase();
6474
6852
  if (!lower2) return [];
6475
6853
  const compact = lower2.replace(/[^a-z0-9]/g, "");
6476
6854
  return compact && compact !== lower2 ? [lower2, compact] : [lower2];
@@ -6481,8 +6859,8 @@ function buildChainSearchTerms(chains) {
6481
6859
  for (const id of ids) {
6482
6860
  const chain2 = chains.find((c) => Number(c.chainId) === id);
6483
6861
  const terms = /* @__PURE__ */ new Set();
6484
- for (const label of [chain2?.displayName, chain2?.name, typeof chain2?.slug === "string" ? chain2.slug : void 0, CHAIN_LABELS[id]]) {
6485
- if (label) for (const form of labelForms(label)) terms.add(form);
6862
+ for (const label2 of [chain2?.displayName, chain2?.name, typeof chain2?.slug === "string" ? chain2.slug : void 0, CHAIN_LABELS[id]]) {
6863
+ if (label2) for (const form of labelForms(label2)) terms.add(form);
6486
6864
  }
6487
6865
  for (const alias of CHAIN_ALIASES[id] ?? []) terms.add(alias);
6488
6866
  byId.set(id, [...terms]);
@@ -6854,7 +7232,7 @@ function TokenSelect(props) {
6854
7232
  const members = g.deployments;
6855
7233
  const multi = members.length > 1;
6856
7234
  const single = members[0];
6857
- const label = multi ? g.symbol : tokenTicker(single.token);
7235
+ const label2 = multi ? g.symbol : tokenTicker(single.token);
6858
7236
  const blocked = !!g.unavailable;
6859
7237
  const opensNetworks = multi || blocked;
6860
7238
  const zero = showBalances && g.amount === 0 || blocked;
@@ -6878,7 +7256,7 @@ function TokenSelect(props) {
6878
7256
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-pk-left", children: [
6879
7257
  /* @__PURE__ */ jsxRuntime.jsx(TokenPlate, { symbol: g.symbol, logoUrl: g.logoUrl }),
6880
7258
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-pk-text", children: [
6881
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-label", children: label }),
7259
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-label", children: label2 }),
6882
7260
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-pk-line", children: [
6883
7261
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-sub", children: multi ? showBalances ? "Total across" : "Available on" : `On ${chainName3(Number(single.token.chainId))}` }),
6884
7262
  /* @__PURE__ */ jsxRuntime.jsx(ChainMarks, { chainIds: members.map((m) => Number(m.token.chainId)), chainById: chainById2, decorative: !multi }),
@@ -6887,7 +7265,7 @@ function TokenSelect(props) {
6887
7265
  !multi && single.hint ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-pk-note", "data-testid": "lane-limit", children: single.hint }) : null
6888
7266
  ] })
6889
7267
  ] }),
6890
- 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
7268
+ 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
6891
7269
  ]
6892
7270
  },
6893
7271
  g.key
@@ -7061,7 +7439,7 @@ function WidgetShell(props) {
7061
7439
  const resolved = resolveTheme(props.theme);
7062
7440
  const vars = themeToVars(resolved);
7063
7441
  const fixed = Number.isFinite(props.heightPx) && props.heightPx > 0;
7064
- const style = fixed ? { ...vars, height: props.heightPx } : vars;
7442
+ const style = fixed ? { ...vars, height: props.heightPx } : props.minHeightPx ? { ...vars, minHeight: props.minHeightPx } : vars;
7065
7443
  return /* @__PURE__ */ jsxRuntime.jsxs(
7066
7444
  "div",
7067
7445
  {
@@ -7070,6 +7448,7 @@ function WidgetShell(props) {
7070
7448
  "data-sg-fixed": fixed || void 0,
7071
7449
  "data-sg-express": props.variant === "express" || void 0,
7072
7450
  "data-sg-wide": props.wide || void 0,
7451
+ "data-sg-takeover": props.takeover || void 0,
7073
7452
  style,
7074
7453
  children: [
7075
7454
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-head", children: [
@@ -7173,12 +7552,12 @@ function TriggerGlyph({ cv }) {
7173
7552
  return /* @__PURE__ */ jsxRuntime.jsx(ShieldTick, {});
7174
7553
  }
7175
7554
  function CheckRow({ check: check2, onViewPolicy }) {
7176
- const label = check2.id === "risk" ? check2.ok ? "Risk screening passed" : "Risk screening failed" : check2.label;
7555
+ const label2 = check2.id === "risk" ? check2.ok ? "Risk screening passed" : "Risk screening failed" : check2.label;
7177
7556
  return /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "sg-cp-check", "data-ok": check2.ok, children: [
7178
7557
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-check-head", children: [
7179
7558
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-cp-check-label", children: [
7180
7559
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-cp-check-mark", "data-ok": check2.ok, children: check2.ok ? /* @__PURE__ */ jsxRuntime.jsx(Tick, {}) : /* @__PURE__ */ jsxRuntime.jsx(Cross, {}) }),
7181
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: label }),
7560
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: label2 }),
7182
7561
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-sr-only", children: check2.ok ? " \u2014 passed" : " \u2014 failed" })
7183
7562
  ] }),
7184
7563
  check2.id === "risk" ? /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-cp-link", onClick: onViewPolicy, children: [
@@ -7246,9 +7625,9 @@ function QuoteChecks({
7246
7625
  ] }) : null
7247
7626
  ] });
7248
7627
  }
7249
- function Fact({ label, value, title, mono = false }) {
7628
+ function Fact({ label: label2, value, title, mono = false }) {
7250
7629
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-fact", children: [
7251
- /* @__PURE__ */ jsxRuntime.jsx("dt", { children: label }),
7630
+ /* @__PURE__ */ jsxRuntime.jsx("dt", { children: label2 }),
7252
7631
  /* @__PURE__ */ jsxRuntime.jsx("dd", { title, className: mono ? "sg-mono" : void 0, children: value })
7253
7632
  ] });
7254
7633
  }
@@ -7377,6 +7756,39 @@ function useTxHistory(account) {
7377
7756
  }, [account]);
7378
7757
  return entries;
7379
7758
  }
7759
+ var WALLET_HISTORY_REFRESH_MS = 3e4;
7760
+ var hidden2 = () => typeof document !== "undefined" && document.visibilityState === "hidden";
7761
+ var travelling = (entries) => !!entries?.some((e) => e.delivery === "in-progress" || e.delivery === "attention");
7762
+ function useWalletHistory(engine, wallets) {
7763
+ const [entries, setEntries] = react.useState(null);
7764
+ const key = wallets.filter((w) => !!w).join("|");
7765
+ react.useEffect(() => {
7766
+ setEntries(null);
7767
+ if (!engine || !key) return;
7768
+ let alive = true;
7769
+ let timer2;
7770
+ const read = async () => {
7771
+ if (timer2) clearTimeout(timer2);
7772
+ timer2 = void 0;
7773
+ if (!hidden2()) {
7774
+ const next = await engine.fetchWalletHistory(key.split("|"));
7775
+ if (!alive) return;
7776
+ if (next) setEntries(next);
7777
+ if (!travelling(next)) return;
7778
+ }
7779
+ timer2 = setTimeout(read, WALLET_HISTORY_REFRESH_MS);
7780
+ };
7781
+ void read();
7782
+ const onRecorded = () => void read();
7783
+ if (typeof window !== "undefined") window.addEventListener(TX_HISTORY_EVENT, onRecorded);
7784
+ return () => {
7785
+ alive = false;
7786
+ if (timer2) clearTimeout(timer2);
7787
+ if (typeof window !== "undefined") window.removeEventListener(TX_HISTORY_EVENT, onRecorded);
7788
+ };
7789
+ }, [engine, key]);
7790
+ return entries;
7791
+ }
7380
7792
  function BackGlyph() {
7381
7793
  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: [
7382
7794
  /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M19 12H5" }),
@@ -7460,7 +7872,15 @@ function TxLegs(props) {
7460
7872
  ] }, `${leg.index}:${leg.fromChainId}:${leg.toChainId}`)) })
7461
7873
  ] });
7462
7874
  }
7463
- function statusBadge(status) {
7875
+ function statusBadge(entry) {
7876
+ if (entry.delivery === "delivered")
7877
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", "data-tone": "ok", children: "Delivered" });
7878
+ if (entry.delivery === "failed")
7879
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", "data-tone": "warn", children: "Not delivered" });
7880
+ if (entry.delivery === "attention")
7881
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", "data-tone": "warn", children: "Needs action" });
7882
+ if (entry.delivery === "in-progress") return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", children: "On its way" });
7883
+ const status = entry.status;
7464
7884
  if (status === "confirmed")
7465
7885
  return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-badge", "data-tone": "ok", children: "Confirmed" });
7466
7886
  if (status === "error")
@@ -7532,7 +7952,7 @@ function TxHistoryList(props) {
7532
7952
  ] }),
7533
7953
  whenLabel(e.at) ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-time", children: whenLabel(e.at) }) : null
7534
7954
  ] }),
7535
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-end", children: statusBadge(e.status) })
7955
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-txrow-end", children: statusBadge(e) })
7536
7956
  ] })
7537
7957
  ] }, `${e.hash}:${e.at}`)
7538
7958
  )) });
@@ -7572,7 +7992,7 @@ function TxDetail(props) {
7572
7992
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta", children: [
7573
7993
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
7574
7994
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "Status" }),
7575
- statusBadge(e.status)
7995
+ statusBadge(e)
7576
7996
  ] }),
7577
7997
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-meta-row", children: [
7578
7998
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-meta-label", children: "You sent" }),
@@ -7608,18 +8028,21 @@ function displayableHistory(entries, account) {
7608
8028
  }
7609
8029
  function TxHistoryPanel(props) {
7610
8030
  const account = props.account;
7611
- const entries = displayableHistory(useTxHistory(account), account);
7612
- const deepLink = props.initialEntry && displayableHistory([props.initialEntry], account).length ? props.initialEntry : null;
7613
- const [selected, setSelected] = react.useState(deepLink);
8031
+ const stored = useTxHistory(account);
8032
+ const remote = useWalletHistory(props.engine, [account, props.solanaAccount]);
8033
+ const entries = react.useMemo(() => mergeHistory(displayableHistory(stored, account), remote), [stored, account, remote]);
8034
+ const linked = props.initialEntry && displayableHistory([props.initialEntry], account).length ? props.initialEntry : null;
8035
+ const [selectedHash, setSelectedHash] = react.useState(linked?.hash ?? null);
8036
+ const selected = selectedHash ? entries.find((e) => e.hash === selectedHash) ?? (linked?.hash === selectedHash ? linked : null) : null;
7614
8037
  const backRef = react.useRef(null);
7615
- react.useEffect(() => setSelected(deepLink), [deepLink]);
8038
+ react.useEffect(() => setSelectedHash(linked?.hash ?? null), [linked?.hash]);
7616
8039
  const pick = (entry) => {
7617
- setSelected(entry);
8040
+ setSelectedHash(entry.hash);
7618
8041
  requestAnimationFrame(() => backRef.current?.focus());
7619
8042
  };
7620
8043
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
7621
8044
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-sel-head", children: [
7622
- /* @__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, {}) }),
8045
+ /* @__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, {}) }),
7623
8046
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-sel-title", children: [
7624
8047
  selected ? "Transaction" : "Transaction history",
7625
8048
  account ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-sel-sub sg-mono", children: shortAddress2(account) }) : null
@@ -7935,12 +8358,19 @@ function useRecipient(destinationChainId, hostRecipient, opts = {}) {
7935
8358
  const [custom, setCustom] = react.useState({});
7936
8359
  const [open, setOpen] = react.useState(false);
7937
8360
  const triggerRef = react.useRef(null);
8361
+ const evmAccount = opts.evm?.account ?? null;
7938
8362
  const evmManaged = recipientFamily === "evm" && Boolean(opts.sourceIsSolana);
7939
- const managed = hostRecipient === void 0 && (recipientFamily === "solana" || evmManaged);
8363
+ const required = recipientFamily === "solana" || evmManaged;
8364
+ const managed = hostRecipient === void 0 && (required || Boolean(opts.evm));
7940
8365
  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;
7941
- const recipient2 = hostRecipient !== void 0 ? hostRecipient : recipientFamily === "solana" ? custom.solana || wallet.address || void 0 : evmManaged ? custom.evm || opts.evm?.account || void 0 : void 0;
7942
- const missing = managed && !recipient2;
7943
- 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 };
8366
+ 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;
8367
+ const missing = managed && required && !recipient2;
8368
+ const shown = recipient2 ?? (recipientFamily === "evm" && !required ? evmAccount ?? void 0 : void 0);
8369
+ const typed = hostRecipient === void 0 ? custom[recipientFamily] || "" : "";
8370
+ 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 };
8371
+ const wallets = [];
8372
+ if (evmAccount) wallets.push({ family: "evm", address: evmAccount, eligible: recipientFamily === "evm" });
8373
+ if (wallet.address) wallets.push({ family: "solana", address: wallet.address, eligible: recipientFamily === "solana" });
7944
8374
  const close = () => {
7945
8375
  setOpen(false);
7946
8376
  requestAnimationFrame(() => triggerRef.current?.focus());
@@ -7951,7 +8381,7 @@ function useRecipient(destinationChainId, hostRecipient, opts = {}) {
7951
8381
  };
7952
8382
  const connect = async (name) => {
7953
8383
  if (recipientFamily === "evm") {
7954
- if (opts.evm?.account) selectAddress("");
8384
+ if (evmAccount) selectAddress("");
7955
8385
  else opts.evm?.connect();
7956
8386
  return;
7957
8387
  }
@@ -7967,38 +8397,170 @@ function useRecipient(destinationChainId, hostRecipient, opts = {}) {
7967
8397
  if (typeof address === "string") selectAddress("");
7968
8398
  else setOpen(true);
7969
8399
  };
7970
- const recipientFor = (account) => recipientFamily === "solana" || evmManaged ? recipient2 || "" : hostRecipient || account;
7971
- return { recipientFamily, recipient: recipient2, recipientFor, managed, missing, error, wallet, familyWallet, open: open && managed, show: () => setOpen(true), close, selectAddress, connect, triggerRef };
8400
+ const recipientFor = (account) => required ? recipient2 || "" : hostRecipient || custom.evm || account;
8401
+ 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 };
7972
8402
  }
7973
- var short = (address) => `${address.slice(0, 4)}\u2026${address.slice(-4)}`;
7974
- function RecipientNote({ state, disabled }) {
7975
- if (state.error) return /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: state.error });
7976
- if (!state.managed) return null;
7977
- const family = state.recipientFamily === "solana" ? "Solana" : "EVM";
7978
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "center", gap: 6, marginTop: 10, fontSize: 13, color: "var(--sg-text-muted)", flexWrap: "wrap" }, children: [
7979
- state.recipient ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7980
- "To ",
7981
- /* @__PURE__ */ jsxRuntime.jsx("b", { className: "sg-mono", title: state.recipient, style: { color: "var(--sg-text)" }, children: short(state.recipient) }),
7982
- " on ",
7983
- family,
7984
- " \xB7 "
7985
- ] }) : null,
7986
- /* @__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" })
8403
+
8404
+ // src/core/checksum.ts
8405
+ var RC = [
8406
+ 0x0000000000000001n,
8407
+ 0x0000000000008082n,
8408
+ 0x800000000000808an,
8409
+ 0x8000000080008000n,
8410
+ 0x000000000000808bn,
8411
+ 0x0000000080000001n,
8412
+ 0x8000000080008081n,
8413
+ 0x8000000000008009n,
8414
+ 0x000000000000008an,
8415
+ 0x0000000000000088n,
8416
+ 0x0000000080008009n,
8417
+ 0x000000008000000an,
8418
+ 0x000000008000808bn,
8419
+ 0x800000000000008bn,
8420
+ 0x8000000000008089n,
8421
+ 0x8000000000008003n,
8422
+ 0x8000000000008002n,
8423
+ 0x8000000000000080n,
8424
+ 0x000000000000800an,
8425
+ 0x800000008000000an,
8426
+ 0x8000000080008081n,
8427
+ 0x8000000000008080n,
8428
+ 0x0000000080000001n,
8429
+ 0x8000000080008008n
8430
+ ];
8431
+ 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];
8432
+ var MASK = (1n << 64n) - 1n;
8433
+ var rotl = (x, n) => n === 0 ? x : (x << BigInt(n) | x >> BigInt(64 - n)) & MASK;
8434
+ function keccakF(s) {
8435
+ for (let round = 0; round < 24; round++) {
8436
+ const c = [0, 1, 2, 3, 4].map((x) => s[x] ^ s[x + 5] ^ s[x + 10] ^ s[x + 15] ^ s[x + 20]);
8437
+ for (let x = 0; x < 5; x++) {
8438
+ const d = c[(x + 4) % 5] ^ rotl(c[(x + 1) % 5], 1);
8439
+ for (let y = 0; y < 25; y += 5) s[y + x] = s[y + x] ^ d;
8440
+ }
8441
+ const b = new Array(25);
8442
+ 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]);
8443
+ 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];
8444
+ s[0] = s[0] ^ RC[round];
8445
+ }
8446
+ }
8447
+ function keccak256Hex(bytes) {
8448
+ const rate = 136;
8449
+ const padded = new Uint8Array(Math.ceil((bytes.length + 1) / rate) * rate);
8450
+ padded.set(bytes);
8451
+ padded[bytes.length] = padded[bytes.length] ^ 1;
8452
+ padded[padded.length - 1] = padded[padded.length - 1] ^ 128;
8453
+ const s = new Array(25).fill(0n);
8454
+ for (let off = 0; off < padded.length; off += rate) {
8455
+ for (let i = 0; i < rate / 8; i++) {
8456
+ let lane = 0n;
8457
+ for (let j = 7; j >= 0; j--) lane = lane << 8n | BigInt(padded[off + i * 8 + j]);
8458
+ s[i] = s[i] ^ lane;
8459
+ }
8460
+ keccakF(s);
8461
+ }
8462
+ let out = "";
8463
+ 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");
8464
+ return out;
8465
+ }
8466
+ function toChecksumAddress(address) {
8467
+ const lower2 = address.slice(2).toLowerCase();
8468
+ const hash2 = keccak256Hex(new TextEncoder().encode(lower2));
8469
+ let out = "0x";
8470
+ for (let i = 0; i < 40; i++) out += Number.parseInt(hash2[i], 16) >= 8 ? lower2[i].toUpperCase() : lower2[i];
8471
+ return out;
8472
+ }
8473
+ function hasValidChecksum(address) {
8474
+ if (!/^0x[0-9a-fA-F]{40}$/.test(address)) return false;
8475
+ const body = address.slice(2);
8476
+ if (body === body.toLowerCase() || body === body.toUpperCase()) return true;
8477
+ return toChecksumAddress(address) === address;
8478
+ }
8479
+ function ArrowLeft() {
8480
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
8481
+ /* @__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" }),
8482
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M13.6667 8H2.44667", stroke: "currentColor", strokeWidth: "1.2", strokeMiterlimit: "10", strokeLinecap: "round", strokeLinejoin: "round" })
7987
8483
  ] });
7988
8484
  }
7989
- function RecipientSheet({ state, symbol }) {
7990
- const [draft, setDraft] = react.useState(state.recipient ?? "");
7991
- const id = react.useId();
7992
- const inputRef = react.useRef(null);
8485
+ function CloseX() {
8486
+ 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" }) });
8487
+ }
8488
+ function AddCircle() {
8489
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": "true", children: [
8490
+ /* @__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" }),
8491
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6 9H12M9 12V6", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round" })
8492
+ ] });
8493
+ }
8494
+ function Tick2() {
8495
+ 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" }) });
8496
+ }
8497
+ function Logout() {
8498
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
8499
+ "path",
8500
+ {
8501
+ fill: "currentColor",
8502
+ 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"
8503
+ }
8504
+ ) });
8505
+ }
8506
+ function ShieldTickBold() {
8507
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
8508
+ "path",
8509
+ {
8510
+ fill: "currentColor",
8511
+ 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"
8512
+ }
8513
+ ) });
8514
+ }
8515
+ function CloseCircleBold() {
8516
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
8517
+ "path",
8518
+ {
8519
+ fill: "currentColor",
8520
+ 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"
8521
+ }
8522
+ ) });
8523
+ }
8524
+ function Loader() {
8525
+ 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(
8526
+ "path",
8527
+ {
8528
+ fill: "currentColor",
8529
+ 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"
8530
+ }
8531
+ ) });
8532
+ }
8533
+ function SmallChevron() {
8534
+ 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" }) });
8535
+ }
8536
+ function PixelGlyph() {
8537
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "21.5888", height: "17.3869", viewBox: "0 0 21.5888 17.3869", fill: "none", "aria-hidden": "true", children: [
8538
+ /* @__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" }),
8539
+ /* @__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" })
8540
+ ] });
8541
+ }
8542
+ var FAMILY_LABEL = { evm: "EVM", solana: "Solana" };
8543
+ function walletShort(address) {
8544
+ return address.length > 14 ? `${address.slice(0, 7)}\u2026${address.slice(-5)}` : address;
8545
+ }
8546
+ function chipShort(address) {
8547
+ return address.length > 12 ? `${address.slice(0, 6)}\u2026${address.slice(-4)}` : address;
8548
+ }
8549
+ function WalletAvatar({ family, chainId }) {
8550
+ const [failed, setFailed] = react.useState([]);
8551
+ const mark = chainLogoCandidates(family === "solana" ? SOLANA_CHAIN_ID : chainId ?? 1).find((url) => !failed.includes(url));
8552
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-ws-avatar", "data-family": family, "aria-hidden": "true", children: [
8553
+ /* @__PURE__ */ jsxRuntime.jsx(PixelGlyph, {}),
8554
+ mark ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-ws-avatar-chain", children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: mark, alt: "", onError: () => setFailed((prev) => [...prev, mark]) }) }) : null
8555
+ ] });
8556
+ }
8557
+ function SheetFrame(props) {
7993
8558
  const sheetRef = react.useRef(null);
7994
- const closeRef = react.useRef(state.close);
7995
- closeRef.current = state.close;
7996
- const family = state.recipientFamily === "solana" ? "Solana" : "EVM";
7997
- const valid = state.recipientFamily === "solana" ? isSolanaAddress(draft) : /^0x[0-9a-fA-F]{40}$/.test(draft.trim());
7998
- const invalid = Boolean(draft.trim()) && !valid;
7999
- const noWallet = state.recipientFamily === "solana" && !state.familyWallet.address && !state.familyWallet.wallets.length;
8559
+ const closeRef = react.useRef(props.onClose);
8560
+ closeRef.current = props.onClose;
8561
+ const titleId = react.useId();
8000
8562
  react.useEffect(() => {
8001
- (noWallet ? inputRef : sheetRef).current?.focus();
8563
+ (props.initialFocus?.current ?? sheetRef.current)?.focus();
8002
8564
  const onKey = (event) => {
8003
8565
  if (event.key === "Escape") {
8004
8566
  event.stopPropagation();
@@ -8007,63 +8569,263 @@ function RecipientSheet({ state, symbol }) {
8007
8569
  };
8008
8570
  document.addEventListener("keydown", onKey, true);
8009
8571
  return () => document.removeEventListener("keydown", onKey, true);
8010
- }, [noWallet]);
8011
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-sheet", role: "dialog", "aria-modal": "true", "aria-label": `${family} recipient`, ref: sheetRef, tabIndex: -1, children: [
8012
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-sheet-head", children: [
8013
- /* @__PURE__ */ jsxRuntime.jsxs("h4", { className: "sg-cp-sheet-title", children: [
8014
- family,
8015
- " recipient"
8016
- ] }),
8017
- /* @__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" }) }) })
8572
+ }, []);
8573
+ return /* @__PURE__ */ jsxRuntime.jsxs(
8574
+ "div",
8575
+ {
8576
+ className: "sg-ws",
8577
+ "data-wide": props.wide || void 0,
8578
+ role: "dialog",
8579
+ "aria-modal": "true",
8580
+ "aria-label": props.label,
8581
+ ref: sheetRef,
8582
+ tabIndex: -1,
8583
+ style: props.minHeight ? { minHeight: props.minHeight } : void 0,
8584
+ children: [
8585
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-ws-top", children: [
8586
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-ws-head", children: [
8587
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-ws-back", onClick: () => closeRef.current(), children: [
8588
+ /* @__PURE__ */ jsxRuntime.jsx(ArrowLeft, {}),
8589
+ props.backLabel ?? "Back to Exchange"
8590
+ ] }),
8591
+ 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, {}) })
8592
+ ] }),
8593
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-ws-main", children: [
8594
+ /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "sg-ws-title", id: titleId, children: props.title }),
8595
+ props.children
8596
+ ] })
8597
+ ] }),
8598
+ props.footer ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-ws-foot", children: props.footer }) : null
8599
+ ]
8600
+ }
8601
+ );
8602
+ }
8603
+ function WalletChip(props) {
8604
+ const count = props.addresses.length;
8605
+ if (!count) {
8606
+ return /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-wallet", onClick: props.onConnect, disabled: props.connecting, children: props.connecting ? "Connecting\u2026" : "Connect wallet" });
8607
+ }
8608
+ const label2 = count === 1 ? chipShort(props.addresses[0]) : `${count} wallets`;
8609
+ 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: [
8610
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-wallet-dot", "aria-hidden": "true" }),
8611
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-wallet-label", children: label2 }),
8612
+ /* @__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" }) })
8613
+ ] });
8614
+ }
8615
+ function screeningSummary(states2) {
8616
+ if (!states2.length || states2.some((s) => s.status === "pending")) return { tone: "pending", text: "Checking...", action: "Pending" };
8617
+ const blocked = states2.filter((s) => s.status === "done" && s.screen.blocked).length;
8618
+ if (blocked) {
8619
+ 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`;
8620
+ return { tone: "blocked", text, action: "View details" };
8621
+ }
8622
+ if (states2.some((s) => s.status === "error")) return { tone: "unknown", text: "Screening unavailable", action: "Try later" };
8623
+ return { tone: "ok", text: `${states2.length} wallet${states2.length === 1 ? "" : "s"} screened`, action: "No flags" };
8624
+ }
8625
+ function WalletsSheet(props) {
8626
+ const states2 = props.wallets.map((w) => props.screens[w.address] ?? { status: "pending" });
8627
+ const summary = screeningSummary(states2);
8628
+ const anyRestricted = states2.some((s) => s.status === "done" && s.screen.blocked);
8629
+ const summaryInner = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8630
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-ws-sum-lead", children: [
8631
+ summary.tone === "pending" ? /* @__PURE__ */ jsxRuntime.jsx(Loader, {}) : summary.tone === "blocked" ? /* @__PURE__ */ jsxRuntime.jsx(CloseCircleBold, {}) : /* @__PURE__ */ jsxRuntime.jsx(ShieldTickBold, {}),
8632
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-ws-sum-text", children: summary.text })
8018
8633
  ] }),
8019
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cp-sheet-body", children: [
8020
- /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card", children: [
8021
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "sg-cp-summary-sub", style: { margin: "0 0 12px" }, children: [
8022
- symbol,
8023
- " is delivered to a ",
8024
- family,
8025
- " wallet. Your EVM wallet stays the owner of the order and can cancel it."
8634
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-ws-sum-act", children: [
8635
+ summary.action,
8636
+ /* @__PURE__ */ jsxRuntime.jsx(SmallChevron, {})
8637
+ ] })
8638
+ ] });
8639
+ 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: [
8640
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-ws-list", children: [
8641
+ props.wallets.map((w, i) => {
8642
+ const state = states2[i];
8643
+ const restricted = state.status === "done" && state.screen.blocked;
8644
+ const pill = restricted ? "Restricted" : anyRestricted && state.status === "done" ? "No flags" : null;
8645
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-ws-row", "data-restricted": restricted || void 0, children: [
8646
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-ws-row-line", children: [
8647
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-ws-id", children: [
8648
+ /* @__PURE__ */ jsxRuntime.jsx(WalletAvatar, { family: w.family, chainId: w.chainId }),
8649
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-ws-id-text", children: [
8650
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-ws-id-label", children: [
8651
+ FAMILY_LABEL[w.family],
8652
+ " Wallet",
8653
+ pill ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-ws-pill", "data-tone": restricted ? "blocked" : "ok", children: pill }) : null
8654
+ ] }),
8655
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-ws-addr", title: w.address, children: walletShort(w.address) })
8656
+ ] })
8657
+ ] }),
8658
+ /* @__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, {}) })
8659
+ ] }),
8660
+ restricted ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-ws-note", children: "This wallet can\u2019t be used because it didn\u2019t pass compliance screening." }) : null
8661
+ ] }, w.address);
8662
+ }),
8663
+ 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: [
8664
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
8665
+ "Connect ",
8666
+ name
8026
8667
  ] }),
8027
- /* @__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` }),
8028
- !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,
8029
- noWallet ? /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "sg-cp-summary-sub", children: [
8030
- "No ",
8031
- family,
8032
- " wallet found. Enter a ",
8033
- family,
8034
- " address instead."
8668
+ /* @__PURE__ */ jsxRuntime.jsx(AddCircle, {})
8669
+ ] }, 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: [
8670
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: props.connect.busy ? "Connecting\u2026" : `Connect ${FAMILY_LABEL[props.connect.family]} wallet` }),
8671
+ /* @__PURE__ */ jsxRuntime.jsx(AddCircle, {})
8672
+ ] }) : null
8673
+ ] }),
8674
+ 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,
8675
+ props.error ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-ws-error", role: "alert", children: props.error }) : null
8676
+ ] }) });
8677
+ }
8678
+ function RecipientRow({ state, disabled, wide }) {
8679
+ 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 });
8680
+ const address = state.shown;
8681
+ if (!address && !state.managed) return null;
8682
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-rcp-row", "data-wide": wide || void 0, children: [
8683
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-rcp-label", children: "Recipient" }),
8684
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-rcp-end", children: [
8685
+ address ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-rcp-value", title: address, children: [
8686
+ FAMILY_LABEL[state.recipientFamily],
8687
+ " \xB7 ",
8688
+ chipShort(address)
8689
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-rcp-value", "data-empty": "true", children: "Not set" }),
8690
+ 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
8691
+ ] })
8692
+ ] });
8693
+ }
8694
+ function RecipientSheet({ state, wide, minHeight }) {
8695
+ const family = state.recipientFamily;
8696
+ const label2 = FAMILY_LABEL[family];
8697
+ const eligible = state.wallets.filter((w) => w.eligible);
8698
+ const [choice, setChoice] = react.useState(() => {
8699
+ if (state.typed) return { kind: "custom" };
8700
+ const current = eligible.find((w) => w.address === state.recipient) ?? eligible[0];
8701
+ return current ? { kind: "wallet", address: current.address } : { kind: "custom" };
8702
+ });
8703
+ const [draft, setDraft] = react.useState(state.typed);
8704
+ const [editing, setEditing] = react.useState(false);
8705
+ const id = react.useId();
8706
+ const inputRef = react.useRef(null);
8707
+ const noWallet = family === "solana" && !state.familyWallet.address && !state.familyWallet.wallets.length;
8708
+ const canConnect = !state.familyWallet.address && (family === "evm" || state.familyWallet.wallets.length > 0);
8709
+ const shapeOk = family === "solana" ? isSolanaAddress(draft.trim()) : /^0x[0-9a-fA-F]{40}$/.test(draft.trim());
8710
+ const checksumOk = family === "solana" || !shapeOk || hasValidChecksum(draft.trim());
8711
+ const valid = shapeOk && checksumOk;
8712
+ const invalid = choice.kind === "custom" && Boolean(draft.trim()) && !valid;
8713
+ const chosenWallet = choice.kind === "wallet" ? eligible.find((w) => w.address === choice.address) : void 0;
8714
+ const ready = choice.kind === "wallet" ? Boolean(chosenWallet) : valid;
8715
+ const custom = choice.kind === "custom";
8716
+ react.useEffect(() => {
8717
+ if (custom) inputRef.current?.focus();
8718
+ }, [custom]);
8719
+ const confirm = () => {
8720
+ if (!ready) return;
8721
+ state.selectAddress(choice.kind === "custom" ? draft.trim() : "");
8722
+ };
8723
+ const row = (w) => {
8724
+ const selected = choice.kind === "wallet" && choice.address === w.address && w.eligible;
8725
+ return /* @__PURE__ */ jsxRuntime.jsxs(
8726
+ "button",
8727
+ {
8728
+ type: "button",
8729
+ className: "sg-rcp-opt",
8730
+ "data-selected": selected || void 0,
8731
+ disabled: !w.eligible,
8732
+ "aria-pressed": selected,
8733
+ title: w.eligible ? w.address : `A ${FAMILY_LABEL[w.family]} wallet cannot receive on this chain`,
8734
+ onClick: () => setChoice({ kind: "wallet", address: w.address }),
8735
+ children: [
8736
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-ws-id", children: [
8737
+ /* @__PURE__ */ jsxRuntime.jsx(WalletAvatar, { family: w.family, chainId: w.family === "evm" ? state.recipientChainId : void 0 }),
8738
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-ws-id-text", children: [
8739
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sg-ws-id-label", children: [
8740
+ FAMILY_LABEL[w.family],
8741
+ " Wallet"
8742
+ ] }),
8743
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-ws-addr", children: walletShort(w.address) })
8744
+ ] })
8745
+ ] }),
8746
+ selected ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-rcp-tick", children: /* @__PURE__ */ jsxRuntime.jsx(Tick2, {}) }) : null
8747
+ ]
8748
+ },
8749
+ w.address
8750
+ );
8751
+ };
8752
+ return /* @__PURE__ */ jsxRuntime.jsx(
8753
+ SheetFrame,
8754
+ {
8755
+ label: "Recipient",
8756
+ title: "Recipient",
8757
+ wide,
8758
+ onClose: state.close,
8759
+ minHeight,
8760
+ initialFocus: noWallet ? inputRef : void 0,
8761
+ footer: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "sg-btn sg-ws-cta", disabled: !ready, onClick: confirm, children: "Use this address" }),
8762
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-ws-list", children: [
8763
+ state.wallets.map(row),
8764
+ canConnect ? /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-ws-row sg-ws-action", onClick: () => void state.connect(), disabled: state.familyWallet.connecting, children: [
8765
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: state.familyWallet.connecting ? "Connecting\u2026" : `Connect ${label2} wallet` }),
8766
+ /* @__PURE__ */ jsxRuntime.jsx(AddCircle, {})
8035
8767
  ] }) : null,
8036
- state.familyWallet.error ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: state.familyWallet.error }) : null
8037
- ] }),
8038
- /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "sg-cp-card", children: [
8039
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-field", style: { margin: 0 }, children: [
8040
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "sg-label", htmlFor: id, children: "Send to a different address" }),
8768
+ !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: [
8769
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: wallet.name }),
8770
+ /* @__PURE__ */ jsxRuntime.jsx(AddCircle, {})
8771
+ ] }, wallet.name)) : null,
8772
+ custom ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-rcp-custom", "data-open": "true", children: [
8773
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-rcp-custom-head", children: [
8774
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, children: "Add another address" }),
8775
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-rcp-tick", children: /* @__PURE__ */ jsxRuntime.jsx(Tick2, {}) })
8776
+ ] }),
8041
8777
  /* @__PURE__ */ jsxRuntime.jsx(
8042
8778
  "input",
8043
8779
  {
8044
8780
  ref: inputRef,
8045
8781
  id,
8046
- className: "sg-input sg-mono",
8047
- 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)" },
8048
- placeholder: `${family} recipient address`,
8049
- "aria-label": `${family} recipient address`,
8782
+ className: "sg-rcp-input",
8783
+ placeholder: family === "solana" ? "Solana recipient address" : "0x...Recipient address",
8784
+ "aria-label": `${label2} recipient address`,
8050
8785
  "aria-invalid": invalid || void 0,
8051
- "aria-describedby": `${id}-help${invalid ? ` ${id}-error` : ""}`,
8052
- value: draft,
8786
+ "aria-describedby": invalid ? `${id}-error` : void 0,
8787
+ value: editing || draft.length <= 34 ? draft : `${draft.slice(0, 13)}..${draft.slice(-15)}`,
8788
+ onFocus: () => setEditing(true),
8789
+ onBlur: () => setEditing(false),
8053
8790
  onChange: (event) => setDraft(event.target.value),
8054
- spellCheck: false
8791
+ onKeyDown: (event) => {
8792
+ if (event.key === "Enter") confirm();
8793
+ },
8794
+ spellCheck: false,
8795
+ autoComplete: "off"
8055
8796
  }
8056
- )
8797
+ ),
8798
+ 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,
8799
+ noWallet ? /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "sg-rcp-hint", children: [
8800
+ "No ",
8801
+ label2,
8802
+ " wallet found. Enter a ",
8803
+ label2,
8804
+ " address instead."
8805
+ ] }) : null
8806
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "sg-rcp-custom", onClick: () => setChoice({ kind: "custom" }), children: [
8807
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Add another address" }),
8808
+ /* @__PURE__ */ jsxRuntime.jsx(AddCircle, {})
8057
8809
  ] }),
8058
- invalid ? /* @__PURE__ */ jsxRuntime.jsx("div", { id: `${id}-error`, children: /* @__PURE__ */ jsxRuntime.jsxs(StatusPanel, { tone: "error", children: [
8059
- "Not a valid ",
8060
- family,
8061
- " address."
8062
- ] }) }) : null,
8063
- /* @__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." }),
8064
- /* @__PURE__ */ jsxRuntime.jsx(Button, { disabled: !valid, onClick: () => state.selectAddress(draft.trim()), children: "Use this address" })
8810
+ state.familyWallet.error ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sg-ws-error", children: state.familyWallet.error }) : null
8065
8811
  ] })
8066
- ] })
8812
+ }
8813
+ );
8814
+ }
8815
+ var short = (address) => `${address.slice(0, 4)}\u2026${address.slice(-4)}`;
8816
+ function RecipientNote({ state, disabled }) {
8817
+ if (state.error) return /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: state.error });
8818
+ if (!state.managed) return null;
8819
+ const family = state.recipientFamily === "solana" ? "Solana" : "EVM";
8820
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "center", gap: 6, marginTop: 10, fontSize: 13, color: "var(--sg-text-muted)", flexWrap: "wrap" }, children: [
8821
+ state.recipient ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8822
+ "To ",
8823
+ /* @__PURE__ */ jsxRuntime.jsx("b", { className: "sg-mono", title: state.recipient, style: { color: "var(--sg-text)" }, children: short(state.recipient) }),
8824
+ " on ",
8825
+ family,
8826
+ " \xB7 "
8827
+ ] }) : null,
8828
+ /* @__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" })
8067
8829
  ] });
8068
8830
  }
8069
8831
  var IDENTITY_KEY_PREFIX = "sg:link:v1:";
@@ -8708,6 +9470,9 @@ function PaymentIsland(props) {
8708
9470
  const selectedVisible = Boolean(sel && visibleRoutes.some((r) => r.id === sel.id));
8709
9471
  const selBal = sel ? holdings.balances[balanceKey(sel.source.chainId, sel.source.tokenAddress)] : void 0;
8710
9472
  const lastTxOwned = Boolean(flow.lastTxEntry?.hash && wallet.account && flow.lastTxEntry.account === wallet.account.toLowerCase());
9473
+ const evmDirect = flow.lastTxEntry?.settlement === "direct";
9474
+ const evmConfirmed = flow.verdict?.status === "confirmed";
9475
+ const evmDelivery = useDelivery(engine, (flow.status === "success" || flow.status === "pending") && !evmDirect ? flow.txHash : null);
8711
9476
  const mismatch = flow.status === "error" && flow.verdict?.status === "mismatch";
8712
9477
  const destTicker = isPay ? tickerOn(registryTokens, props.toChainId, props.toAsset ?? "") : exToToken ? tokenTicker(exToToken) : exToAsset ?? "";
8713
9478
  const exFromTicker = exFromToken ? tokenTicker(exFromToken) : exFromAsset ?? "";
@@ -8765,7 +9530,11 @@ function PaymentIsland(props) {
8765
9530
  linkMenu
8766
9531
  ] }) : void 0;
8767
9532
  const activeStep = flow.steps.find((s) => s.state === "active");
8768
- 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." : "";
9533
+ 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" ? (
9534
+ // Announces what the receipt shows: delivery from the tracker, never settlement on the
9535
+ // source receipt alone (review 2026-10-28).
9536
+ `${isPay ? "Payment" : verb.past}: ${deliveryHeadline(evmDelivery, evmConfirmed, evmDirect)}.`
9537
+ ) : "";
8769
9538
  const loading = flow.status === "loading";
8770
9539
  const payReady = isPay ? Boolean(sel && selectedVisible) : Boolean(sel) && !needsRecipient;
8771
9540
  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";
@@ -8810,7 +9579,7 @@ function PaymentIsland(props) {
8810
9579
  ] });
8811
9580
  let body;
8812
9581
  if (hist && wallet.account) {
8813
- body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
9582
+ body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, engine, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
8814
9583
  } else if (isPay && view === "select" && wallet.account) {
8815
9584
  body = /* @__PURE__ */ jsxRuntime.jsx(
8816
9585
  TokenSelect,
@@ -8888,7 +9657,7 @@ function PaymentIsland(props) {
8888
9657
  ] })
8889
9658
  ] });
8890
9659
  } else if (paid || settling) {
8891
- const confirmed = flow.verdict?.status === "confirmed";
9660
+ const confirmed = isDelivered(evmDelivery, evmConfirmed, evmDirect);
8892
9661
  body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8893
9662
  /* @__PURE__ */ jsxRuntime.jsx(IdentityLine, { account: wallet.account, email: identity?.email }),
8894
9663
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-receipt", children: [
@@ -8900,9 +9669,10 @@ function PaymentIsland(props) {
8900
9669
  destTicker
8901
9670
  ] }),
8902
9671
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-receipt-sub", children: [
8903
- confirmed ? "Confirmed on-chain" : "Confirmation pending",
9672
+ deliveryHeadline(evmDelivery, evmConfirmed, evmDirect),
8904
9673
  (flow.lastTxEntry?.recipient || recipient2) && (isPay || recipientState.recipientFamily === "solana") ? ` \xB7 ${shortAddress2(flow.lastTxEntry?.recipient || recipient2)}` : ""
8905
- ] })
9674
+ ] }),
9675
+ evmDirect ? null : /* @__PURE__ */ jsxRuntime.jsx(DeliverySteps, { delivery: evmDelivery })
8906
9676
  ] }),
8907
9677
  !identityMatchesWallet ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-remember", children: [
8908
9678
  /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "sg-remember-top", children: [
@@ -9327,6 +10097,9 @@ function PayCard(props) {
9327
10097
  };
9328
10098
  react.useEffect(() => setHist(null), [wallet.account]);
9329
10099
  const lastTxOwned = Boolean(flow.lastTxEntry?.hash && wallet.account && flow.lastTxEntry.account === wallet.account.toLowerCase());
10100
+ const evmDirect = flow.lastTxEntry?.settlement === "direct";
10101
+ const evmConfirmed = flow.verdict?.status === "confirmed";
10102
+ const evmDelivery = useDelivery(engine, (flow.status === "success" || flow.status === "pending") && !evmDirect ? flow.txHash : null);
9330
10103
  const pickFunding = (pick) => {
9331
10104
  setPickError(null);
9332
10105
  const r = visibleRoutes.find((x) => x.source.chainId === pick.chainId && symbolKey(x.source.asset) === symbolKey(pick.symbol));
@@ -9386,7 +10159,7 @@ function PayCard(props) {
9386
10159
  ...durationLabel(sel.quote.estimatedDuration) ? [{ label: "Estimated time", value: durationLabel(sel.quote.estimatedDuration) }] : []
9387
10160
  ] : [];
9388
10161
  const loadingPlan = flow.status === "loading" || holdings.loading && !sel || pricing !== null;
9389
- 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(
10162
+ 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(
9390
10163
  TokenSelect,
9391
10164
  {
9392
10165
  title: "Pay with",
@@ -9408,17 +10181,18 @@ function PayCard(props) {
9408
10181
  ] })
9409
10182
  ] }) : flow.status === "success" || flow.status === "pending" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9410
10183
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success", children: [
9411
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-success-check", "data-pending": flow.verdict?.status !== "confirmed", children: /* @__PURE__ */ jsxRuntime.jsx(CheckGlyph3, {}) }),
10184
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-success-check", "data-pending": !isDelivered(evmDelivery, evmConfirmed, evmDirect), children: /* @__PURE__ */ jsxRuntime.jsx(CheckGlyph3, {}) }),
9412
10185
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-amt sg-mono", children: [
9413
10186
  props.amount,
9414
10187
  " ",
9415
10188
  tickerOn(registryTokens, props.toChainId, props.toAsset)
9416
10189
  ] }),
9417
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
9418
- flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
10190
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", role: "status", "aria-live": "polite", children: [
10191
+ deliveryHeadline(evmDelivery, evmConfirmed, evmDirect),
9419
10192
  " \xB7 ",
9420
10193
  shortAddress2(props.recipient)
9421
- ] })
10194
+ ] }),
10195
+ evmDirect ? null : /* @__PURE__ */ jsxRuntime.jsx(DeliverySteps, { delivery: evmDelivery })
9422
10196
  ] }),
9423
10197
  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
9424
10198
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -9570,28 +10344,32 @@ function StableGenieSwap(props) {
9570
10344
  };
9571
10345
  }, [engine, props.variant, hist]);
9572
10346
  const lastTxOwned = Boolean(flow.lastTxEntry?.hash && wallet.account && flow.lastTxEntry.account === wallet.account.toLowerCase());
10347
+ const evmDirect = flow.lastTxEntry?.settlement === "direct";
10348
+ const evmConfirmed = flow.verdict?.status === "confirmed";
10349
+ const evmDelivery = useDelivery(engine, (flow.status === "success" || flow.status === "pending") && !evmDirect ? flow.txHash : null);
9573
10350
  if (props.variant === "pill") return /* @__PURE__ */ jsxRuntime.jsx(PaymentIsland, { kind: "swap", ...props });
9574
10351
  const walletSlot = wallet.account ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-head-tools", children: [
9575
10352
  /* @__PURE__ */ jsxRuntime.jsx(HistoryButton, { btnRef: histBtnRef, disabled: submitting, onClick: () => setHist({}) }),
9576
10353
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-brand", children: "ZeroDelta" })
9577
10354
  ] }) : void 0;
9578
10355
  if (hist && wallet.account) {
9579
- 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 }) });
10356
+ 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 }) });
9580
10357
  }
9581
10358
  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 }) });
9582
10359
  if (flow.status === "success" || flow.status === "pending") {
9583
10360
  return /* @__PURE__ */ jsxRuntime.jsxs(WidgetShell, { title: config.title || "Swap", theme: config.theme, walletSlot, children: [
9584
10361
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success", children: [
9585
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-success-check", "data-pending": flow.verdict?.status !== "confirmed", children: /* @__PURE__ */ jsxRuntime.jsx(CheckGlyph4, {}) }),
10362
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-success-check", "data-pending": !isDelivered(evmDelivery, evmConfirmed, evmDirect), children: /* @__PURE__ */ jsxRuntime.jsx(CheckGlyph4, {}) }),
9586
10363
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-amt sg-mono", children: [
9587
10364
  receive,
9588
10365
  " ",
9589
10366
  tickerOn(registryTokens, toChainId, toAsset)
9590
10367
  ] }),
9591
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
9592
- flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
10368
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", role: "status", "aria-live": "polite", children: [
10369
+ deliveryHeadline(evmDelivery, evmConfirmed, evmDirect),
9593
10370
  recipientState.recipientFamily === "solana" ? ` \xB7 ${shortAddress2(flow.lastTxEntry?.recipient || recipient2)}` : props.recipient ? ` \xB7 ${shortAddress2(props.recipient)}` : ""
9594
- ] })
10371
+ ] }),
10372
+ evmDirect ? null : /* @__PURE__ */ jsxRuntime.jsx(DeliverySteps, { delivery: evmDelivery })
9595
10373
  ] }),
9596
10374
  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
9597
10375
  ] });
@@ -9932,6 +10710,11 @@ function ExchangeCard(props) {
9932
10710
  evm: { account: wallet.account, connect: wallet.connect, connecting: wallet.connecting }
9933
10711
  });
9934
10712
  const recipient2 = recipientState.recipient;
10713
+ const [walletsOpen, setWalletsOpen] = react.useState(false);
10714
+ const [walletDetails, setWalletDetails] = react.useState(false);
10715
+ const [screens, setScreens] = react.useState({});
10716
+ const walletChipRef = react.useRef(null);
10717
+ const [takeoverHeight, setTakeoverHeight] = react.useState(void 0);
9935
10718
  const needsRecipient = recipientState.missing || !!recipientState.error;
9936
10719
  const onInputChange = react.useRef(props.onInputChange);
9937
10720
  onInputChange.current = props.onInputChange;
@@ -10101,7 +10884,36 @@ function ExchangeCard(props) {
10101
10884
  const connected2 = Boolean(wallet.account);
10102
10885
  const addressed = connected2 && !needsRecipient;
10103
10886
  const submitting = solActive ? solFlow.status === "preparing" || solFlow.status === "submitting" : flow.status === "submitting";
10887
+ const sheetWallets = [
10888
+ ...wallet.account ? [{ family: "evm", address: wallet.account, chainId: wallet.chainId, disconnect: () => void wallet.disconnect() }] : [],
10889
+ ...solanaWallet.address ? [{ family: "solana", address: solanaWallet.address, disconnect: () => void solanaWallet.disconnect() }] : []
10890
+ ];
10891
+ const walletKey = sheetWallets.map((w) => `${w.family}:${w.address}`).join("|");
10892
+ react.useEffect(() => {
10893
+ if (!walletsOpen) return;
10894
+ let alive = true;
10895
+ for (const w of sheetWallets) {
10896
+ setScreens((prev) => prev[w.address]?.status === "done" ? prev : { ...prev, [w.address]: { status: "pending" } });
10897
+ 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" } })));
10898
+ }
10899
+ return () => {
10900
+ alive = false;
10901
+ };
10902
+ }, [walletsOpen, walletKey, engine]);
10903
+ react.useEffect(() => {
10904
+ if (!submitting) return;
10905
+ setWalletsOpen(false);
10906
+ setWalletDetails(false);
10907
+ if (recipientState.open) recipientState.close();
10908
+ }, [submitting]);
10909
+ react.useEffect(() => {
10910
+ if (!sheetWallets.length) setWalletsOpen(false);
10911
+ }, [sheetWallets.length]);
10104
10912
  const lastTxOwned = Boolean(flow.lastTxEntry?.hash && wallet.account && flow.lastTxEntry.account === wallet.account.toLowerCase());
10913
+ const evmDirect = flow.lastTxEntry?.settlement === "direct";
10914
+ const evmConfirmed = flow.verdict?.status === "confirmed";
10915
+ const evmDelivery = useDelivery(engine, (flow.status === "success" || flow.status === "pending") && !evmDirect ? flow.txHash : null);
10916
+ const solDelivery = useDelivery(engine, solActive && solFlow.status === "sent" ? solFlow.signature : null);
10105
10917
  const quoting = solActive ? solFlow.status === "quoting" : addressed ? flow.status === "loading" : preview.status === "loading";
10106
10918
  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;
10107
10919
  const gatewayAmountError = !quoteError || solActive ? null : addressed ? flow.fieldError : preview.fieldError ?? null;
@@ -10112,6 +10924,10 @@ function ExchangeCard(props) {
10112
10924
  const receiveSideRef = react.useRef(null);
10113
10925
  const receiveShown = `${receive ?? ""}|${quoting}|${toTicker}`;
10114
10926
  useFitText(receiveOutRef, receiveShown);
10927
+ react.useLayoutEffect(() => {
10928
+ const h2 = receiveOutRef.current?.closest(".sg-widget")?.getBoundingClientRect().height;
10929
+ if (h2 && Math.round(h2) !== takeoverHeight) setTakeoverHeight(Math.round(h2));
10930
+ });
10115
10931
  useFitText(receiveSideRef, receiveShown);
10116
10932
  const toDecimals = react.useMemo(() => {
10117
10933
  try {
@@ -10146,8 +10962,8 @@ function ExchangeCard(props) {
10146
10962
  const rateRows = hasQuote ? [{ label: "Network fee", value: networkFee }, ...eta ? [{ label: "Estimated time", value: eta }] : []] : [];
10147
10963
  const via = selected ? selected.legs.length > 1 ? selected.legs[0]?.toTicker || selected.legs[0]?.toAsset || "" : null : preview.data?.via ?? null;
10148
10964
  const routeShape = via === null ? "Direct" : via ? `Via ${via}` : "Two steps";
10149
- const compliance = selected?.quote.compliance;
10150
- const complianceHasQuote = Boolean(selected && flow.status !== "loading");
10965
+ const compliance = solActive ? solanaQuoteCompliance(solFlow.plan?.preview.quote) : selected?.quote.compliance;
10966
+ const complianceHasQuote = solActive ? Boolean(solFlow.plan && solFlow.status !== "quoting") : Boolean(selected && flow.status !== "loading");
10151
10967
  const fromUsd = usdOf2(normalizedAmount, prices[from?.symbol ?? ""]);
10152
10968
  const toUsd = usdOf2(receive, prices[to?.symbol ?? ""]);
10153
10969
  const flippable = !rampMode && !submitting && Boolean(to && sourceTokens.some((t) => Number(t.chainId) === to.chainId && symbolKey(t.symbol) === to.symbol));
@@ -10158,12 +10974,26 @@ function ExchangeCard(props) {
10158
10974
  };
10159
10975
  const walletSlot = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-head-tools", children: [
10160
10976
  connected2 ? /* @__PURE__ */ jsxRuntime.jsx(HistoryButton, { btnRef: histBtnRef, disabled: submitting, onClick: () => setHist({}) }) : null,
10161
- /* @__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: [
10162
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sg-wallet-dot", "aria-hidden": "true" }),
10163
- " ",
10164
- shortAddress2(wallet.account)
10165
- ] }) : wallet.connecting ? "Connecting\u2026" : "Connect wallet" })
10977
+ /* @__PURE__ */ jsxRuntime.jsx(
10978
+ WalletChip,
10979
+ {
10980
+ addresses: sheetWallets.map((w) => w.address),
10981
+ connecting: wallet.connecting,
10982
+ onConnect: wallet.connect,
10983
+ btnRef: walletChipRef,
10984
+ disabled: submitting,
10985
+ onOpen: () => {
10986
+ setSheet(null);
10987
+ setWalletsOpen(true);
10988
+ }
10989
+ }
10990
+ )
10166
10991
  ] });
10992
+ const closeWallets = () => {
10993
+ setWalletsOpen(false);
10994
+ setWalletDetails(false);
10995
+ requestAnimationFrame(() => walletChipRef.current?.focus());
10996
+ };
10167
10997
  const closeSelector = (isFrom) => {
10168
10998
  setView("main");
10169
10999
  requestAnimationFrame(() => (isFrom ? fromTileRef : toTileRef).current?.focus());
@@ -10206,7 +11036,19 @@ function ExchangeCard(props) {
10206
11036
  }
10207
11037
  );
10208
11038
  const rateBox = (open) => /* @__PURE__ */ jsxRuntime.jsx(RateBox, { rate, fromSymbol: from?.symbol ?? "", fromLogoUrl: fromToken?.logoUrl, toTicker, rows: rateRows, defaultOpen: open, paused: quotePaused });
10209
- 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(
11039
+ const walletScreens = sheetWallets.map((w) => screens[w.address]).flatMap((s) => s?.status === "done" ? [s.screen] : []);
11040
+ const sheetBody = walletsOpen && walletDetails ? /* @__PURE__ */ jsxRuntime.jsx(ComplianceSheet, { compliance: directComplianceFromScreens(walletScreens), direct: true, hasQuote: true, onClose: () => setWalletDetails(false) }) : walletsOpen ? /* @__PURE__ */ jsxRuntime.jsx(
11041
+ WalletsSheet,
11042
+ {
11043
+ wallets: sheetWallets,
11044
+ screens,
11045
+ wide,
11046
+ onClose: closeWallets,
11047
+ onDetails: walletScreens.length ? () => setWalletDetails(true) : void 0,
11048
+ 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,
11049
+ error: solanaWallet.error || wallet.error
11050
+ }
11051
+ ) : 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(
10210
11052
  QuoteSheet,
10211
11053
  {
10212
11054
  onClose: closeSheet,
@@ -10247,10 +11089,18 @@ function ExchangeCard(props) {
10247
11089
  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"
10248
11090
  }
10249
11091
  );
10250
- 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;
11092
+ 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: [
11093
+ "This order needs about ",
11094
+ (solFlow.cost.lamports / 1e9).toFixed(4),
11095
+ " SOL for network fees and rent; the wallet holds",
11096
+ " ",
11097
+ (solFlow.cost.balanceLamports / 1e9).toFixed(4),
11098
+ " SOL."
11099
+ ] }) : null;
10251
11100
  let body;
11101
+ let takeover = false;
10252
11102
  if (hist && connected2) {
10253
- body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, tokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
11103
+ body = /* @__PURE__ */ jsxRuntime.jsx(TxHistoryPanel, { account: wallet.account, engine, solanaAccount: solanaWallet.address, tokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
10254
11104
  } else if (view === "from" || view === "to") {
10255
11105
  const isFrom = view === "from";
10256
11106
  body = /* @__PURE__ */ jsxRuntime.jsx(
@@ -10273,20 +11123,22 @@ function ExchangeCard(props) {
10273
11123
  }
10274
11124
  );
10275
11125
  } else if (sheetBody && !wide) {
11126
+ takeover = walletsOpen && !walletDetails || recipientState.open;
10276
11127
  body = sheetBody;
10277
11128
  } else if (solActive && solFlow.status === "sent") {
10278
11129
  body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10279
11130
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success", children: [
10280
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-success-check", "data-pending": "true", children: /* @__PURE__ */ jsxRuntime.jsx(CheckGlyph5, {}) }),
11131
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-success-check", "data-pending": !isDelivered(solDelivery, false), children: /* @__PURE__ */ jsxRuntime.jsx(CheckGlyph5, {}) }),
10281
11132
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-amt sg-mono", children: [
10282
11133
  solFlow.sent?.receive ?? receive,
10283
11134
  " ",
10284
11135
  solFlow.sent?.toTicker ?? toTicker
10285
11136
  ] }),
10286
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
10287
- "Submitted on Solana \u2014 ZeroDelta delivers it",
11137
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", role: "status", "aria-live": "polite", children: [
11138
+ solDelivery.phase === "tracking" ? "Submitted on Solana \u2014 tracking delivery" : deliveryHeadline(solDelivery, true),
10288
11139
  solFlow.sent?.recipient ? ` \xB7 ${shortAddress2(solFlow.sent.recipient)}` : ""
10289
- ] })
11140
+ ] }),
11141
+ /* @__PURE__ */ jsxRuntime.jsx(DeliverySteps, { delivery: solDelivery })
10290
11142
  ] }),
10291
11143
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
10292
11144
  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,
@@ -10297,16 +11149,17 @@ function ExchangeCard(props) {
10297
11149
  } else if (flow.status === "success" || flow.status === "pending") {
10298
11150
  body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10299
11151
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success", children: [
10300
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-success-check", "data-pending": flow.verdict?.status !== "confirmed", children: /* @__PURE__ */ jsxRuntime.jsx(CheckGlyph5, {}) }),
11152
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sg-success-check", "data-pending": !isDelivered(evmDelivery, evmConfirmed, evmDirect), children: /* @__PURE__ */ jsxRuntime.jsx(CheckGlyph5, {}) }),
10301
11153
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-amt sg-mono", children: [
10302
11154
  receive,
10303
11155
  " ",
10304
11156
  toTicker
10305
11157
  ] }),
10306
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", children: [
10307
- flow.verdict?.status === "confirmed" ? "Confirmed on-chain" : "Submitted \u2014 awaiting confirmation",
11158
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-success-sub", role: "status", "aria-live": "polite", children: [
11159
+ deliveryHeadline(evmDelivery, evmConfirmed, evmDirect),
10308
11160
  recipientState.recipientFamily === "solana" ? ` \xB7 ${shortAddress2(flow.lastTxEntry?.recipient || recipient2)}` : props.recipient ? ` \xB7 ${shortAddress2(props.recipient)}` : ""
10309
- ] })
11161
+ ] }),
11162
+ evmDirect ? null : /* @__PURE__ */ jsxRuntime.jsx(DeliverySteps, { delivery: evmDelivery })
10310
11163
  ] }),
10311
11164
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
10312
11165
  lastTxOwned ? /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "ghost", onClick: () => setHist({ entry: flow.lastTxEntry }), children: "View transaction" }) : null,
@@ -10319,7 +11172,6 @@ function ExchangeCard(props) {
10319
11172
  const cta = solActive ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
10320
11173
  solanaSteps,
10321
11174
  solanaCta,
10322
- /* @__PURE__ */ jsxRuntime.jsx(RecipientNote, { state: recipientState, disabled: submitting }),
10323
11175
  solanaWallet.error ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: solanaWallet.error }) : null,
10324
11176
  wallet.error ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: wallet.error }) : null
10325
11177
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-cta-wrap", children: [
@@ -10328,7 +11180,6 @@ function ExchangeCard(props) {
10328
11180
  recipientState.recipientFamily === "solana" ? "Solana" : "EVM",
10329
11181
  " wallet"
10330
11182
  ] }) : /* @__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 }),
10331
- !rampMode ? /* @__PURE__ */ jsxRuntime.jsx(RecipientNote, { state: recipientState, disabled: submitting }) : null,
10332
11183
  wallet.error ? /* @__PURE__ */ jsxRuntime.jsx(StatusPanel, { tone: "error", children: wallet.error }) : null
10333
11184
  ] });
10334
11185
  const notices = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -10378,6 +11229,7 @@ function ExchangeCard(props) {
10378
11229
  ] }),
10379
11230
  /* @__PURE__ */ jsxRuntime.jsx(PaneFoot, { usd: hasQuote ? toUsd : null })
10380
11231
  ] }),
11232
+ !rampMode && (connected2 || recipientState.managed) ? /* @__PURE__ */ jsxRuntime.jsx(RecipientRow, { state: recipientState, disabled: submitting }) : null,
10381
11233
  rampMode ? null : props.inDialog === "drawer" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10382
11234
  complianceButton(true),
10383
11235
  quoteButton(true),
@@ -10395,7 +11247,7 @@ function ExchangeCard(props) {
10395
11247
  cta
10396
11248
  ] });
10397
11249
  }
10398
- const card = /* @__PURE__ */ jsxRuntime.jsx(WidgetShell, { title, theme: config.theme, heightPx: props.heightPx, walletSlot, onClose: props.onClose, wide, children: body });
11250
+ 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 });
10399
11251
  if (!wide) return card;
10400
11252
  const resolved = resolveTheme(config.theme);
10401
11253
  const vars = themeToVars(resolved);
@@ -10442,6 +11294,7 @@ function ExchangeCard(props) {
10442
11294
  ] })
10443
11295
  ] }),
10444
11296
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sg-stack", children: [
11297
+ connected2 || recipientState.managed ? /* @__PURE__ */ jsxRuntime.jsx(RecipientRow, { state: recipientState, disabled: submitting, wide: true }) : null,
10445
11298
  rateBox(true),
10446
11299
  complianceButton(true),
10447
11300
  quoteButton(true)