@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/LICENSE +21 -21
- package/README.md +223 -223
- package/dist/{chunk-BYAKXZ5E.js → chunk-C2PORICM.js} +820 -139
- package/dist/{chunk-52MY5D3D.js → chunk-ST3DQXYH.js} +198 -28
- package/dist/core/index.cjs +208 -27
- package/dist/core/index.d.cts +85 -3
- package/dist/core/index.d.ts +85 -3
- package/dist/core/index.js +1 -1
- package/dist/index.cjs +1029 -176
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/{mount-bKSKIGmW.d.ts → mount-B6soKC-9.d.ts} +1 -1
- package/dist/{mount-BR3wWmjt.d.cts → mount-CEy4Nqky.d.cts} +1 -1
- package/dist/mount.cjs +1029 -176
- package/dist/mount.d.cts +2 -2
- package/dist/mount.d.ts +2 -2
- package/dist/mount.js +2 -2
- package/dist/standalone.global.js +109 -8
- package/dist/{verify-DdSA23GJ.d.cts → verify-Y9jZ83T5.d.cts} +3 -0
- package/dist/{verify-DdSA23GJ.d.ts → verify-Y9jZ83T5.d.ts} +3 -0
- package/package.json +134 -134
|
@@ -1,8 +1,96 @@
|
|
|
1
|
-
import { CHAIN_DISPLAY_NAMES, EXECUTABLE_STABLE_ASSETS, STABLE_ASSETS, SUPPORTED_ASSETS, complianceView, complianceTagOf, symbolKey, normalizeDecimalText, findToken, laneLimitFor, laneLimitSymbol, tokenTicker, exceedsLaneLimit, assetDecimals, parseUnitsDecimal, counterpartTokens, assetClassOf, brokenLaneFor, brokenLaneReason, destinationAvailability, laneLimitHint, tickerOn, laneLimitError, routeNativeValue, formatNative, nativeSymbol, isSolanaChainId, formatUnits, amountFieldError, SUPPORTED_CHAIN_IDS, complianceChecks, DIRECT_CHECK_IDS, isSolanaAddress, createEngine, isAddress, checkNativeFee, nativeFeeShortLabel, nativeFeeShortMessage, allowanceCovers, validatePlannedTransaction, solanaPlanNeedsPreparation, SOLANA_CHAIN_ID, unattributedComplianceReasons, distinctScreenedWallets, formatJurisdiction, humanizeComplianceReason, DIRECT_SCOPE_NOTE, categoryLabel, SCREENING_BUCKETS, BUNDLED_RPC, foldTicker } from './chunk-
|
|
2
|
-
import { createContext, useState, useRef, useMemo, useEffect, useCallback, useId, createElement, useContext,
|
|
1
|
+
import { CHAIN_DISPLAY_NAMES, EXECUTABLE_STABLE_ASSETS, STABLE_ASSETS, SUPPORTED_ASSETS, complianceView, complianceTagOf, symbolKey, normalizeDecimalText, findToken, laneLimitFor, laneLimitSymbol, tokenTicker, exceedsLaneLimit, assetDecimals, parseUnitsDecimal, counterpartTokens, assetClassOf, brokenLaneFor, brokenLaneReason, destinationAvailability, laneLimitHint, tickerOn, laneLimitError, routeNativeValue, formatNative, nativeSymbol, isSolanaChainId, formatUnits, amountFieldError, solanaQuoteCompliance, directComplianceFromScreens, SUPPORTED_CHAIN_IDS, complianceChecks, DIRECT_CHECK_IDS, isSolanaAddress, createEngine, isAddress, checkNativeFee, nativeFeeShortLabel, nativeFeeShortMessage, allowanceCovers, validatePlannedTransaction, TRACKING, mergeHistory, solanaPlanNeedsPreparation, SOLANA_CHAIN_ID, unattributedComplianceReasons, distinctScreenedWallets, formatJurisdiction, humanizeComplianceReason, DIRECT_SCOPE_NOTE, categoryLabel, SCREENING_BUCKETS, BUNDLED_RPC, foldTicker } from './chunk-ST3DQXYH.js';
|
|
2
|
+
import { createContext, useState, useRef, useMemo, useEffect, useCallback, useId, useLayoutEffect, createElement, useContext, useSyncExternalStore, useReducer } from 'react';
|
|
3
3
|
import { createRoot } from 'react-dom/client';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
|
+
function deliveryPollDelay(elapsedMs) {
|
|
7
|
+
if (elapsedMs < 6e4) return 5e3;
|
|
8
|
+
if (elapsedMs < 11 * 6e4) return 15e3;
|
|
9
|
+
return 3e4;
|
|
10
|
+
}
|
|
11
|
+
var DELIVERY_GIVE_UP_MS = 2 * 60 * 60 * 1e3;
|
|
12
|
+
var UNANSWERED_LIMIT = 20;
|
|
13
|
+
var UNAVAILABLE = Object.freeze({ phase: "unavailable", status: "", steps: [] });
|
|
14
|
+
var hidden = () => typeof document !== "undefined" && document.visibilityState === "hidden";
|
|
15
|
+
function useDelivery(engine, hash) {
|
|
16
|
+
const [state, setState] = useState({ hash: null, value: TRACKING });
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (!hash) return;
|
|
19
|
+
let alive = true;
|
|
20
|
+
let timer2;
|
|
21
|
+
let answered = false;
|
|
22
|
+
let unanswered = 0;
|
|
23
|
+
const started2 = Date.now();
|
|
24
|
+
setState({ hash, value: TRACKING });
|
|
25
|
+
const schedule = () => {
|
|
26
|
+
if (Date.now() - started2 > DELIVERY_GIVE_UP_MS) return setState({ hash, value: UNAVAILABLE });
|
|
27
|
+
timer2 = setTimeout(tick, deliveryPollDelay(Date.now() - started2));
|
|
28
|
+
};
|
|
29
|
+
const tick = async () => {
|
|
30
|
+
timer2 = void 0;
|
|
31
|
+
if (hidden()) return schedule();
|
|
32
|
+
const next = await engine.trackDelivery(hash);
|
|
33
|
+
if (!alive) return;
|
|
34
|
+
if (next.phase === "tracking") {
|
|
35
|
+
if (!answered && ++unanswered >= UNANSWERED_LIMIT) return setState({ hash, value: UNAVAILABLE });
|
|
36
|
+
return schedule();
|
|
37
|
+
}
|
|
38
|
+
answered = true;
|
|
39
|
+
setState({ hash, value: next });
|
|
40
|
+
if (next.phase === "delivered" || next.phase === "failed") return;
|
|
41
|
+
schedule();
|
|
42
|
+
};
|
|
43
|
+
const onVisible2 = () => {
|
|
44
|
+
if (!alive || hidden() || !timer2) return;
|
|
45
|
+
clearTimeout(timer2);
|
|
46
|
+
void tick();
|
|
47
|
+
};
|
|
48
|
+
void tick();
|
|
49
|
+
if (typeof document !== "undefined") document.addEventListener("visibilitychange", onVisible2);
|
|
50
|
+
return () => {
|
|
51
|
+
alive = false;
|
|
52
|
+
if (timer2) clearTimeout(timer2);
|
|
53
|
+
if (typeof document !== "undefined") document.removeEventListener("visibilitychange", onVisible2);
|
|
54
|
+
};
|
|
55
|
+
}, [engine, hash]);
|
|
56
|
+
return state.hash === hash ? state.value : TRACKING;
|
|
57
|
+
}
|
|
58
|
+
var STEP_LABEL = {
|
|
59
|
+
submitted: "Submitted",
|
|
60
|
+
arrived: "Arrived",
|
|
61
|
+
filled: "Filled",
|
|
62
|
+
outbound_bridging: "Bridging",
|
|
63
|
+
delivered: "Delivered"
|
|
64
|
+
};
|
|
65
|
+
var label = (name) => STEP_LABEL[name] ?? name.replace(/_/g, " ");
|
|
66
|
+
function deliveryHeadline(delivery, sourceConfirmed, direct = false) {
|
|
67
|
+
if (direct) return sourceConfirmed ? "Delivered" : "Submitted \u2014 awaiting confirmation";
|
|
68
|
+
switch (delivery.phase) {
|
|
69
|
+
case "delivered":
|
|
70
|
+
return "Delivered";
|
|
71
|
+
case "failed":
|
|
72
|
+
return delivery.status === "cancelled" ? "Cancelled \u2014 not delivered" : `Not delivered (${delivery.status.replace(/_/g, " ")}) \u2014 open the transaction for details`;
|
|
73
|
+
case "attention":
|
|
74
|
+
return delivery.status === "cancel_pending" ? "Being cancelled \u2014 not delivered" : "Waiting to be claimed \u2014 open the transaction";
|
|
75
|
+
case "in-progress": {
|
|
76
|
+
if (delivery.status === "continuing") return "On its way \u2014 final leg next";
|
|
77
|
+
const next = delivery.steps.find((s) => !s.done);
|
|
78
|
+
return next ? `On its way \u2014 ${label(next.name).toLowerCase()} next` : "On its way";
|
|
79
|
+
}
|
|
80
|
+
case "unavailable":
|
|
81
|
+
return sourceConfirmed ? "Sent \u2014 open the transaction to follow delivery" : "Submitted \u2014 awaiting confirmation";
|
|
82
|
+
default:
|
|
83
|
+
return sourceConfirmed ? "Sent \u2014 tracking delivery" : "Submitted \u2014 awaiting confirmation";
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function isDelivered(delivery, sourceConfirmed, direct = false) {
|
|
87
|
+
return direct ? sourceConfirmed : delivery.phase === "delivered";
|
|
88
|
+
}
|
|
89
|
+
function DeliverySteps(props) {
|
|
90
|
+
const { steps, phase } = props.delivery;
|
|
91
|
+
if (!steps.length || phase === "failed") return null;
|
|
92
|
+
return /* @__PURE__ */ jsx("div", { className: "sg-success-steps", "data-testid": "delivery-steps", "data-phase": phase, children: steps.map((s) => `${label(s.name)}${s.done ? " \u2713" : ""}`).join(" \xB7 ") });
|
|
93
|
+
}
|
|
6
94
|
var ConfigContext = createContext({});
|
|
7
95
|
function StableGenieProvider({ children, ...config }) {
|
|
8
96
|
return /* @__PURE__ */ jsx(ConfigContext.Provider, { value: config, children });
|
|
@@ -187,18 +275,20 @@ function useWallet(injected2) {
|
|
|
187
275
|
const [connecting, setConnecting] = useState(false);
|
|
188
276
|
const [error, setError] = useState(null);
|
|
189
277
|
const providerRef = useRef(injected2 ?? null);
|
|
278
|
+
const forgotten = useRef(false);
|
|
279
|
+
const generation = useRef(0);
|
|
190
280
|
useEffect(() => {
|
|
191
281
|
const p = provider;
|
|
192
282
|
if (!p) return;
|
|
193
283
|
let alive = true;
|
|
194
|
-
const onAccounts = (accs) => alive && setAccount(Array.isArray(accs) && accs[0] ? accs[0] : null);
|
|
284
|
+
const onAccounts = (accs) => alive && !forgotten.current && setAccount(Array.isArray(accs) && accs[0] ? accs[0] : null);
|
|
195
285
|
const onChain = (hex) => alive && setChainId(hexToChain(hex));
|
|
196
286
|
p.on?.("accountsChanged", onAccounts);
|
|
197
287
|
p.on?.("chainChanged", onChain);
|
|
198
288
|
(async () => {
|
|
199
289
|
try {
|
|
200
290
|
const accs = await getAccounts(p);
|
|
201
|
-
if (alive && accs[0]) setAccount(accs[0]);
|
|
291
|
+
if (alive && accs[0] && !forgotten.current) setAccount(accs[0]);
|
|
202
292
|
const cid = await getChainId(p);
|
|
203
293
|
if (alive) setChainId(cid);
|
|
204
294
|
} catch {
|
|
@@ -219,11 +309,14 @@ function useWallet(injected2) {
|
|
|
219
309
|
const connect = useCallback(async () => {
|
|
220
310
|
setConnecting(true);
|
|
221
311
|
setError(null);
|
|
312
|
+
forgotten.current = false;
|
|
313
|
+
const request = ++generation.current;
|
|
222
314
|
try {
|
|
223
315
|
const p = providerRef.current ?? await resolveProvider(injected2);
|
|
224
316
|
providerRef.current = p;
|
|
225
317
|
setProvider(p);
|
|
226
318
|
const accs = await requestAccounts(p);
|
|
319
|
+
if (request !== generation.current) return;
|
|
227
320
|
setAccount(accs[0] ?? null);
|
|
228
321
|
setChainId(await getChainId(p));
|
|
229
322
|
} catch (e) {
|
|
@@ -232,7 +325,19 @@ function useWallet(injected2) {
|
|
|
232
325
|
setConnecting(false);
|
|
233
326
|
}
|
|
234
327
|
}, [injected2]);
|
|
235
|
-
|
|
328
|
+
const disconnect = useCallback(async () => {
|
|
329
|
+
forgotten.current = true;
|
|
330
|
+
generation.current += 1;
|
|
331
|
+
setConnecting(false);
|
|
332
|
+
setAccount(null);
|
|
333
|
+
setError(null);
|
|
334
|
+
const p = providerRef.current;
|
|
335
|
+
try {
|
|
336
|
+
await p?.request({ method: "wallet_revokePermissions", params: [{ eth_accounts: {} }] });
|
|
337
|
+
} catch {
|
|
338
|
+
}
|
|
339
|
+
}, []);
|
|
340
|
+
return { provider, account, chainId, connecting, error, connect, disconnect };
|
|
236
341
|
}
|
|
237
342
|
|
|
238
343
|
// src/react/txHistoryStore.ts
|
|
@@ -865,6 +970,7 @@ var WIDGET_CSS = `
|
|
|
865
970
|
.sg-success-check{width:40px;height:40px;border-radius:999px;background:var(--sg-accent);color:var(--sg-accent-text);display:inline-flex;align-items:center;justify-content:center;margin-bottom:8px}
|
|
866
971
|
/* Broadcast but not receipt-confirmed: mute the disc so a pending settlement never wears the
|
|
867
972
|
accent-coloured "paid" affordance. Mirrors .sg-settle-disc[data-pending] in the island. */
|
|
973
|
+
.sg-success-steps{font-size:12px;color:var(--sg-text-muted);margin-top:6px;text-align:center}
|
|
868
974
|
.sg-success-check[data-pending="true"]{background:var(--sg-surface);color:var(--sg-text-muted);border:1px solid var(--sg-border)}
|
|
869
975
|
.sg-success-amt{font-size:20px;font-weight:700;font-variant-numeric:tabular-nums}
|
|
870
976
|
.sg-success-sub{font-size:12px;color:var(--sg-text-muted);margin-top:2px}
|
|
@@ -1474,6 +1580,106 @@ img.sg-tok-badge{width:16px;padding:0;object-fit:cover;background:var(--sg-bg)}
|
|
|
1474
1580
|
.sg-overlay[data-sg-overlay="drawer"] .sg-pane--note{min-height:145px}
|
|
1475
1581
|
@keyframes sg-drawer-in{from{transform:translateX(100%)}to{transform:none}}
|
|
1476
1582
|
@media (prefers-reduced-motion:reduce){.sg-overlay,.sg-dialog{animation:none!important}.sg-pillbtn{transition:none}}
|
|
1583
|
+
/* \u2500\u2500 Wallets + Recipient sheets \u2014 Figma ZD-dApp 3154:48121 / 3155:49634 (2026-10-28) \u2500\u2500 */
|
|
1584
|
+
.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}
|
|
1585
|
+
.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)}
|
|
1586
|
+
.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)}
|
|
1587
|
+
.sg-wallet[data-connected="true"]:hover:not(:disabled){border-color:var(--sg-accent);color:var(--sg-t80)}
|
|
1588
|
+
.sg-wallet[data-connected="true"]:focus-visible{outline:2px solid var(--sg-accent);outline-offset:2px}
|
|
1589
|
+
.sg-wallet-label{opacity:.9}
|
|
1590
|
+
.sg-wallet[data-connected="true"] svg{flex:0 0 auto;margin-right:-1px}
|
|
1591
|
+
.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}
|
|
1592
|
+
.sg-ws:focus{outline:none}
|
|
1593
|
+
.sg-ws-top{display:flex;flex-direction:column;gap:28px}
|
|
1594
|
+
.sg-ws-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
|
|
1595
|
+
.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}
|
|
1596
|
+
.sg-ws-back svg{flex:0 0 auto}
|
|
1597
|
+
.sg-ws-back:hover{color:var(--sg-text)}
|
|
1598
|
+
.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}
|
|
1599
|
+
.sg-ws-close:hover{color:var(--sg-text)}
|
|
1600
|
+
.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}
|
|
1601
|
+
.sg-ws-main{display:flex;flex-direction:column;gap:16px}
|
|
1602
|
+
.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)}
|
|
1603
|
+
.sg-ws[data-wide]{gap:16px}
|
|
1604
|
+
.sg-ws[data-wide] .sg-ws-sum-lead{min-width:0}
|
|
1605
|
+
.sg-ws[data-wide] .sg-ws-sum-text{overflow:hidden;text-overflow:ellipsis}
|
|
1606
|
+
.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)}
|
|
1607
|
+
.sg-ws[data-wide] .sg-ws-back{font-size:12px;font-weight:400}
|
|
1608
|
+
.sg-ws[data-wide] .sg-ws-title{font-family:var(--sg-font);font-size:18px;font-weight:500;letter-spacing:0}
|
|
1609
|
+
.sg-ws-list{display:flex;flex-direction:column;gap:4px}
|
|
1610
|
+
.sg-ws-list[data-gap="8"]{gap:8px}
|
|
1611
|
+
.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}
|
|
1612
|
+
.sg-ws-row-line{display:flex;align-items:center;justify-content:space-between;gap:12px}
|
|
1613
|
+
.sg-ws-id{display:flex;align-items:center;gap:20px;min-width:0}
|
|
1614
|
+
.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}
|
|
1615
|
+
.sg-ws-id-label{display:inline-flex;align-items:center;gap:8px;font-size:12px;color:var(--sg-t50)}
|
|
1616
|
+
.sg-ws-addr{font-size:16px;font-weight:500;color:var(--sg-t80)}
|
|
1617
|
+
.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}
|
|
1618
|
+
.sg-ws-pill[data-tone="blocked"]{background:color-mix(in srgb,var(--sg-flag) 12%,transparent);color:var(--sg-flag)}
|
|
1619
|
+
.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)}
|
|
1620
|
+
.sg-ws-note{margin:0;font-size:12px;line-height:1.2;color:var(--sg-t60)}
|
|
1621
|
+
.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}
|
|
1622
|
+
.sg-ws-avatar[data-family="solana"]{background:#1a2ba3;color:#fff}
|
|
1623
|
+
.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}
|
|
1624
|
+
.sg-ws-avatar-chain img{display:block;width:12px;height:12px;border-radius:8px;object-fit:cover}
|
|
1625
|
+
.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}
|
|
1626
|
+
.sg-ws-icon-btn:hover{background:var(--sg-a12)}
|
|
1627
|
+
.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}
|
|
1628
|
+
.sg-ws-action:hover:not(:disabled){background:color-mix(in srgb,var(--sg-accent) 8%,transparent)}
|
|
1629
|
+
.sg-ws-action:disabled{cursor:progress;opacity:.7}
|
|
1630
|
+
.sg-ws-action svg{flex:0 0 auto}
|
|
1631
|
+
.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)}
|
|
1632
|
+
button.sg-ws-sum{cursor:pointer}
|
|
1633
|
+
.sg-ws-sum[data-tone="ok"]{background:color-mix(in srgb,var(--sg-success) 4%,transparent)}
|
|
1634
|
+
.sg-ws-sum[data-tone="blocked"]{background:color-mix(in srgb,var(--sg-flag) 8%,transparent)}
|
|
1635
|
+
.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}
|
|
1636
|
+
.sg-ws-sum-lead svg{flex:0 0 auto;color:var(--sg-accent)}
|
|
1637
|
+
.sg-ws-sum[data-tone="ok"] .sg-ws-sum-lead svg{color:var(--sg-success)}
|
|
1638
|
+
.sg-ws-sum[data-tone="blocked"] .sg-ws-sum-lead svg{color:var(--sg-flag)}
|
|
1639
|
+
.sg-ws-sum[data-tone="unknown"] .sg-ws-sum-lead svg{color:var(--sg-text-muted)}
|
|
1640
|
+
.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}
|
|
1641
|
+
.sg-ws-sum[data-tone="ok"] .sg-ws-sum-act{color:var(--sg-ok-ink)}
|
|
1642
|
+
.sg-ws-sum[data-tone="ok"] .sg-ws-sum-act svg{color:color-mix(in srgb,var(--sg-success) 80%,transparent)}
|
|
1643
|
+
.sg-ws-sum[data-tone="blocked"] .sg-ws-sum-act{color:var(--sg-flag)}
|
|
1644
|
+
.sg-ws-sum[data-tone="unknown"] .sg-ws-sum-act{color:var(--sg-text-muted)}
|
|
1645
|
+
.sg-ws-spin{animation:sg-ws-spin 900ms linear infinite}
|
|
1646
|
+
@keyframes sg-ws-spin{to{transform:rotate(360deg)}}
|
|
1647
|
+
.sg-ws-error{margin:0;font-size:12px;line-height:1.3;color:var(--sg-danger)}
|
|
1648
|
+
.sg-ws-foot{flex:0 0 auto}
|
|
1649
|
+
.sg-btn.sg-ws-cta{height:44px;min-height:44px;padding:0 24px}
|
|
1650
|
+
.sg-btn.sg-ws-cta:disabled{opacity:.2;cursor:not-allowed}
|
|
1651
|
+
.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}
|
|
1652
|
+
.sg-rcp-row[data-wide]{background:transparent;border:1px solid var(--sg-a12);padding:12px 16px}
|
|
1653
|
+
.sg-rcp-row[data-tone="error"]{white-space:normal;color:var(--sg-danger);background:color-mix(in srgb,var(--sg-danger) 8%,transparent)}
|
|
1654
|
+
.sg-rcp-label{color:var(--sg-t60)}
|
|
1655
|
+
.sg-rcp-end{display:inline-flex;align-items:center;gap:8px;min-width:0}
|
|
1656
|
+
.sg-rcp-value{color:var(--sg-t90);overflow:hidden;text-overflow:ellipsis}
|
|
1657
|
+
.sg-rcp-value[data-empty]{color:var(--sg-t50)}
|
|
1658
|
+
.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}
|
|
1659
|
+
.sg-rcp-change:hover:not(:disabled){text-decoration:underline}
|
|
1660
|
+
.sg-rcp-change:disabled{opacity:.5;cursor:not-allowed}
|
|
1661
|
+
.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}
|
|
1662
|
+
.sg-rcp-opt[data-selected]{border-color:transparent;background:var(--sg-a4)}
|
|
1663
|
+
.sg-rcp-opt:hover:not(:disabled):not([data-selected]){border-color:color-mix(in srgb,var(--sg-accent) 40%,transparent)}
|
|
1664
|
+
.sg-rcp-opt:disabled{cursor:not-allowed;opacity:.45}
|
|
1665
|
+
.sg-rcp-tick{display:flex;color:var(--sg-accent);flex:0 0 auto}
|
|
1666
|
+
.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}
|
|
1667
|
+
.sg-rcp-custom svg{flex:0 0 auto}
|
|
1668
|
+
.sg-rcp-custom[data-open]{flex-direction:column;align-items:stretch;gap:8px;border-color:transparent;background:var(--sg-a4);cursor:default}
|
|
1669
|
+
.sg-rcp-custom-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
|
|
1670
|
+
.sg-rcp-custom-head label{cursor:text}
|
|
1671
|
+
.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}
|
|
1672
|
+
.sg-rcp-input::placeholder{color:var(--sg-t50)}
|
|
1673
|
+
.sg-rcp-input:focus{border-color:var(--sg-accent)}
|
|
1674
|
+
.sg-rcp-input[aria-invalid="true"]{border-color:var(--sg-danger)}
|
|
1675
|
+
.sg-rcp-hint{margin:0;font-size:12px;font-weight:400;line-height:1.2;color:var(--sg-t60)}
|
|
1676
|
+
.sg-widget[data-sg-takeover]{display:flex;flex-direction:column}
|
|
1677
|
+
.sg-widget[data-sg-takeover]>.sg-head,.sg-widget[data-sg-takeover]>.sg-foot{display:none}
|
|
1678
|
+
.sg-widget[data-sg-takeover]>.sg-body{display:flex;flex-direction:column;flex:1 1 auto}
|
|
1679
|
+
.sg-widget[data-sg-takeover]>.sg-body>.sg-ws{flex:1 1 auto}
|
|
1680
|
+
.sg-widget[data-sg-side]:has(>.sg-ws){display:flex;flex-direction:column}
|
|
1681
|
+
.sg-widget[data-sg-side]>.sg-ws{flex:1 1 auto}
|
|
1682
|
+
@media (prefers-reduced-motion:reduce){.sg-ws{animation:none}.sg-ws-spin{animation:none}}
|
|
1477
1683
|
`;
|
|
1478
1684
|
var injected = false;
|
|
1479
1685
|
function injectStyles() {
|
|
@@ -1755,7 +1961,7 @@ function StepList(props) {
|
|
|
1755
1961
|
/* @__PURE__ */ jsx("span", { className: s.state === "done" ? "sg-muted" : "", children: s.label }),
|
|
1756
1962
|
rich ? /* @__PURE__ */ jsx("span", { className: "sg-sr-only", children: ` \u2014 ${STEP_STATE_WORD[s.state]}` }) : null
|
|
1757
1963
|
] }, s.id)) }),
|
|
1758
|
-
rich && props.verdict && verifyDone ? /* @__PURE__ */ jsx("div", { className: "sg-step-verdict", children: props.verdict.status === "confirmed" ? "Confirmed on-chain \u2014
|
|
1964
|
+
rich && props.verdict && verifyDone ? /* @__PURE__ */ jsx("div", { className: "sg-step-verdict", children: props.verdict.status === "confirmed" ? "Confirmed on-chain \u2014 on its way to the merchant." : props.verdict.status === "mismatch" ? "The submitted transaction did not match the reviewed plan." : "Payment sent \u2014 confirmation is still pending." }) : null
|
|
1759
1965
|
] });
|
|
1760
1966
|
}
|
|
1761
1967
|
var SHOW_ROADMAP_METHODS = true;
|
|
@@ -2095,8 +2301,8 @@ var CHAIN_ALIASES = {
|
|
|
2095
2301
|
137: ["matic"],
|
|
2096
2302
|
43114: ["avax"]
|
|
2097
2303
|
};
|
|
2098
|
-
function labelForms(
|
|
2099
|
-
const lower =
|
|
2304
|
+
function labelForms(label2) {
|
|
2305
|
+
const lower = label2.trim().toLowerCase();
|
|
2100
2306
|
if (!lower) return [];
|
|
2101
2307
|
const compact = lower.replace(/[^a-z0-9]/g, "");
|
|
2102
2308
|
return compact && compact !== lower ? [lower, compact] : [lower];
|
|
@@ -2107,8 +2313,8 @@ function buildChainSearchTerms(chains) {
|
|
|
2107
2313
|
for (const id of ids) {
|
|
2108
2314
|
const chain = chains.find((c) => Number(c.chainId) === id);
|
|
2109
2315
|
const terms = /* @__PURE__ */ new Set();
|
|
2110
|
-
for (const
|
|
2111
|
-
if (
|
|
2316
|
+
for (const label2 of [chain?.displayName, chain?.name, typeof chain?.slug === "string" ? chain.slug : void 0, CHAIN_LABELS[id]]) {
|
|
2317
|
+
if (label2) for (const form of labelForms(label2)) terms.add(form);
|
|
2112
2318
|
}
|
|
2113
2319
|
for (const alias of CHAIN_ALIASES[id] ?? []) terms.add(alias);
|
|
2114
2320
|
byId.set(id, [...terms]);
|
|
@@ -2480,7 +2686,7 @@ function TokenSelect(props) {
|
|
|
2480
2686
|
const members = g.deployments;
|
|
2481
2687
|
const multi = members.length > 1;
|
|
2482
2688
|
const single = members[0];
|
|
2483
|
-
const
|
|
2689
|
+
const label2 = multi ? g.symbol : tokenTicker(single.token);
|
|
2484
2690
|
const blocked = !!g.unavailable;
|
|
2485
2691
|
const opensNetworks = multi || blocked;
|
|
2486
2692
|
const zero = showBalances && g.amount === 0 || blocked;
|
|
@@ -2504,7 +2710,7 @@ function TokenSelect(props) {
|
|
|
2504
2710
|
/* @__PURE__ */ jsxs("span", { className: "sg-pk-left", children: [
|
|
2505
2711
|
/* @__PURE__ */ jsx(TokenPlate, { symbol: g.symbol, logoUrl: g.logoUrl }),
|
|
2506
2712
|
/* @__PURE__ */ jsxs("span", { className: "sg-pk-text", children: [
|
|
2507
|
-
/* @__PURE__ */ jsx("span", { className: "sg-pk-label", children:
|
|
2713
|
+
/* @__PURE__ */ jsx("span", { className: "sg-pk-label", children: label2 }),
|
|
2508
2714
|
/* @__PURE__ */ jsxs("span", { className: "sg-pk-line", children: [
|
|
2509
2715
|
/* @__PURE__ */ jsx("span", { className: "sg-pk-sub", children: multi ? showBalances ? "Total across" : "Available on" : `On ${chainName3(Number(single.token.chainId))}` }),
|
|
2510
2716
|
/* @__PURE__ */ jsx(ChainMarks, { chainIds: members.map((m) => Number(m.token.chainId)), chainById, decorative: !multi }),
|
|
@@ -2513,7 +2719,7 @@ function TokenSelect(props) {
|
|
|
2513
2719
|
!multi && single.hint ? /* @__PURE__ */ jsx("span", { className: "sg-pk-note", "data-testid": "lane-limit", children: single.hint }) : null
|
|
2514
2720
|
] })
|
|
2515
2721
|
] }),
|
|
2516
|
-
showBalances ? /* @__PURE__ */ jsx(BalanceColumn, { amount: g.amount, usd: g.usd, symbol:
|
|
2722
|
+
showBalances ? /* @__PURE__ */ jsx(BalanceColumn, { amount: g.amount, usd: g.usd, symbol: label2 }) : opensNetworks ? /* @__PURE__ */ jsx("span", { className: "sg-pk-chev", "aria-hidden": "true", children: /* @__PURE__ */ jsx(ChevronGlyph, {}) }) : null
|
|
2517
2723
|
]
|
|
2518
2724
|
},
|
|
2519
2725
|
g.key
|
|
@@ -2687,7 +2893,7 @@ function WidgetShell(props) {
|
|
|
2687
2893
|
const resolved = resolveTheme(props.theme);
|
|
2688
2894
|
const vars = themeToVars(resolved);
|
|
2689
2895
|
const fixed = Number.isFinite(props.heightPx) && props.heightPx > 0;
|
|
2690
|
-
const style = fixed ? { ...vars, height: props.heightPx } : vars;
|
|
2896
|
+
const style = fixed ? { ...vars, height: props.heightPx } : props.minHeightPx ? { ...vars, minHeight: props.minHeightPx } : vars;
|
|
2691
2897
|
return /* @__PURE__ */ jsxs(
|
|
2692
2898
|
"div",
|
|
2693
2899
|
{
|
|
@@ -2696,6 +2902,7 @@ function WidgetShell(props) {
|
|
|
2696
2902
|
"data-sg-fixed": fixed || void 0,
|
|
2697
2903
|
"data-sg-express": props.variant === "express" || void 0,
|
|
2698
2904
|
"data-sg-wide": props.wide || void 0,
|
|
2905
|
+
"data-sg-takeover": props.takeover || void 0,
|
|
2699
2906
|
style,
|
|
2700
2907
|
children: [
|
|
2701
2908
|
/* @__PURE__ */ jsxs("div", { className: "sg-head", children: [
|
|
@@ -2799,12 +3006,12 @@ function TriggerGlyph({ cv }) {
|
|
|
2799
3006
|
return /* @__PURE__ */ jsx(ShieldTick, {});
|
|
2800
3007
|
}
|
|
2801
3008
|
function CheckRow({ check: check2, onViewPolicy }) {
|
|
2802
|
-
const
|
|
3009
|
+
const label2 = check2.id === "risk" ? check2.ok ? "Risk screening passed" : "Risk screening failed" : check2.label;
|
|
2803
3010
|
return /* @__PURE__ */ jsxs("li", { className: "sg-cp-check", "data-ok": check2.ok, children: [
|
|
2804
3011
|
/* @__PURE__ */ jsxs("div", { className: "sg-cp-check-head", children: [
|
|
2805
3012
|
/* @__PURE__ */ jsxs("span", { className: "sg-cp-check-label", children: [
|
|
2806
3013
|
/* @__PURE__ */ jsx("span", { className: "sg-cp-check-mark", "data-ok": check2.ok, children: check2.ok ? /* @__PURE__ */ jsx(Tick, {}) : /* @__PURE__ */ jsx(Cross, {}) }),
|
|
2807
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
3014
|
+
/* @__PURE__ */ jsx("span", { children: label2 }),
|
|
2808
3015
|
/* @__PURE__ */ jsx("span", { className: "sg-sr-only", children: check2.ok ? " \u2014 passed" : " \u2014 failed" })
|
|
2809
3016
|
] }),
|
|
2810
3017
|
check2.id === "risk" ? /* @__PURE__ */ jsxs("button", { type: "button", className: "sg-cp-link", onClick: onViewPolicy, children: [
|
|
@@ -2872,9 +3079,9 @@ function QuoteChecks({
|
|
|
2872
3079
|
] }) : null
|
|
2873
3080
|
] });
|
|
2874
3081
|
}
|
|
2875
|
-
function Fact({ label, value, title, mono = false }) {
|
|
3082
|
+
function Fact({ label: label2, value, title, mono = false }) {
|
|
2876
3083
|
return /* @__PURE__ */ jsxs("div", { className: "sg-cp-fact", children: [
|
|
2877
|
-
/* @__PURE__ */ jsx("dt", { children:
|
|
3084
|
+
/* @__PURE__ */ jsx("dt", { children: label2 }),
|
|
2878
3085
|
/* @__PURE__ */ jsx("dd", { title, className: mono ? "sg-mono" : void 0, children: value })
|
|
2879
3086
|
] });
|
|
2880
3087
|
}
|
|
@@ -3003,6 +3210,39 @@ function useTxHistory(account) {
|
|
|
3003
3210
|
}, [account]);
|
|
3004
3211
|
return entries;
|
|
3005
3212
|
}
|
|
3213
|
+
var WALLET_HISTORY_REFRESH_MS = 3e4;
|
|
3214
|
+
var hidden2 = () => typeof document !== "undefined" && document.visibilityState === "hidden";
|
|
3215
|
+
var travelling = (entries) => !!entries?.some((e) => e.delivery === "in-progress" || e.delivery === "attention");
|
|
3216
|
+
function useWalletHistory(engine, wallets) {
|
|
3217
|
+
const [entries, setEntries] = useState(null);
|
|
3218
|
+
const key = wallets.filter((w) => !!w).join("|");
|
|
3219
|
+
useEffect(() => {
|
|
3220
|
+
setEntries(null);
|
|
3221
|
+
if (!engine || !key) return;
|
|
3222
|
+
let alive = true;
|
|
3223
|
+
let timer2;
|
|
3224
|
+
const read = async () => {
|
|
3225
|
+
if (timer2) clearTimeout(timer2);
|
|
3226
|
+
timer2 = void 0;
|
|
3227
|
+
if (!hidden2()) {
|
|
3228
|
+
const next = await engine.fetchWalletHistory(key.split("|"));
|
|
3229
|
+
if (!alive) return;
|
|
3230
|
+
if (next) setEntries(next);
|
|
3231
|
+
if (!travelling(next)) return;
|
|
3232
|
+
}
|
|
3233
|
+
timer2 = setTimeout(read, WALLET_HISTORY_REFRESH_MS);
|
|
3234
|
+
};
|
|
3235
|
+
void read();
|
|
3236
|
+
const onRecorded = () => void read();
|
|
3237
|
+
if (typeof window !== "undefined") window.addEventListener(TX_HISTORY_EVENT, onRecorded);
|
|
3238
|
+
return () => {
|
|
3239
|
+
alive = false;
|
|
3240
|
+
if (timer2) clearTimeout(timer2);
|
|
3241
|
+
if (typeof window !== "undefined") window.removeEventListener(TX_HISTORY_EVENT, onRecorded);
|
|
3242
|
+
};
|
|
3243
|
+
}, [engine, key]);
|
|
3244
|
+
return entries;
|
|
3245
|
+
}
|
|
3006
3246
|
function BackGlyph() {
|
|
3007
3247
|
return /* @__PURE__ */ jsxs("svg", { width: "17", height: "17", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.4", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
3008
3248
|
/* @__PURE__ */ jsx("path", { d: "M19 12H5" }),
|
|
@@ -3086,7 +3326,15 @@ function TxLegs(props) {
|
|
|
3086
3326
|
] }, `${leg.index}:${leg.fromChainId}:${leg.toChainId}`)) })
|
|
3087
3327
|
] });
|
|
3088
3328
|
}
|
|
3089
|
-
function statusBadge(
|
|
3329
|
+
function statusBadge(entry) {
|
|
3330
|
+
if (entry.delivery === "delivered")
|
|
3331
|
+
return /* @__PURE__ */ jsx("span", { className: "sg-badge", "data-tone": "ok", children: "Delivered" });
|
|
3332
|
+
if (entry.delivery === "failed")
|
|
3333
|
+
return /* @__PURE__ */ jsx("span", { className: "sg-badge", "data-tone": "warn", children: "Not delivered" });
|
|
3334
|
+
if (entry.delivery === "attention")
|
|
3335
|
+
return /* @__PURE__ */ jsx("span", { className: "sg-badge", "data-tone": "warn", children: "Needs action" });
|
|
3336
|
+
if (entry.delivery === "in-progress") return /* @__PURE__ */ jsx("span", { className: "sg-badge", children: "On its way" });
|
|
3337
|
+
const status = entry.status;
|
|
3090
3338
|
if (status === "confirmed")
|
|
3091
3339
|
return /* @__PURE__ */ jsx("span", { className: "sg-badge", "data-tone": "ok", children: "Confirmed" });
|
|
3092
3340
|
if (status === "error")
|
|
@@ -3158,7 +3406,7 @@ function TxHistoryList(props) {
|
|
|
3158
3406
|
] }),
|
|
3159
3407
|
whenLabel(e.at) ? /* @__PURE__ */ jsx("span", { className: "sg-txrow-time", children: whenLabel(e.at) }) : null
|
|
3160
3408
|
] }),
|
|
3161
|
-
/* @__PURE__ */ jsx("span", { className: "sg-txrow-end", children: statusBadge(e
|
|
3409
|
+
/* @__PURE__ */ jsx("span", { className: "sg-txrow-end", children: statusBadge(e) })
|
|
3162
3410
|
] })
|
|
3163
3411
|
] }, `${e.hash}:${e.at}`)
|
|
3164
3412
|
)) });
|
|
@@ -3198,7 +3446,7 @@ function TxDetail(props) {
|
|
|
3198
3446
|
/* @__PURE__ */ jsxs("div", { className: "sg-meta", children: [
|
|
3199
3447
|
/* @__PURE__ */ jsxs("div", { className: "sg-meta-row", children: [
|
|
3200
3448
|
/* @__PURE__ */ jsx("span", { className: "sg-meta-label", children: "Status" }),
|
|
3201
|
-
statusBadge(e
|
|
3449
|
+
statusBadge(e)
|
|
3202
3450
|
] }),
|
|
3203
3451
|
/* @__PURE__ */ jsxs("div", { className: "sg-meta-row", children: [
|
|
3204
3452
|
/* @__PURE__ */ jsx("span", { className: "sg-meta-label", children: "You sent" }),
|
|
@@ -3234,18 +3482,21 @@ function displayableHistory(entries, account) {
|
|
|
3234
3482
|
}
|
|
3235
3483
|
function TxHistoryPanel(props) {
|
|
3236
3484
|
const account = props.account;
|
|
3237
|
-
const
|
|
3238
|
-
const
|
|
3239
|
-
const
|
|
3485
|
+
const stored = useTxHistory(account);
|
|
3486
|
+
const remote = useWalletHistory(props.engine, [account, props.solanaAccount]);
|
|
3487
|
+
const entries = useMemo(() => mergeHistory(displayableHistory(stored, account), remote), [stored, account, remote]);
|
|
3488
|
+
const linked = props.initialEntry && displayableHistory([props.initialEntry], account).length ? props.initialEntry : null;
|
|
3489
|
+
const [selectedHash, setSelectedHash] = useState(linked?.hash ?? null);
|
|
3490
|
+
const selected = selectedHash ? entries.find((e) => e.hash === selectedHash) ?? (linked?.hash === selectedHash ? linked : null) : null;
|
|
3240
3491
|
const backRef = useRef(null);
|
|
3241
|
-
useEffect(() =>
|
|
3492
|
+
useEffect(() => setSelectedHash(linked?.hash ?? null), [linked?.hash]);
|
|
3242
3493
|
const pick = (entry) => {
|
|
3243
|
-
|
|
3494
|
+
setSelectedHash(entry.hash);
|
|
3244
3495
|
requestAnimationFrame(() => backRef.current?.focus());
|
|
3245
3496
|
};
|
|
3246
3497
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
3247
3498
|
/* @__PURE__ */ jsxs("div", { className: "sg-sel-head", children: [
|
|
3248
|
-
/* @__PURE__ */ jsx("button", { type: "button", autoFocus: true, ref: backRef, className: "sg-back", onClick: selected ? () =>
|
|
3499
|
+
/* @__PURE__ */ jsx("button", { type: "button", autoFocus: true, ref: backRef, className: "sg-back", onClick: selected ? () => setSelectedHash(null) : props.onBack, "aria-label": "Back", children: /* @__PURE__ */ jsx(BackGlyph, {}) }),
|
|
3249
3500
|
/* @__PURE__ */ jsxs("div", { className: "sg-sel-title", children: [
|
|
3250
3501
|
selected ? "Transaction" : "Transaction history",
|
|
3251
3502
|
account ? /* @__PURE__ */ jsx("span", { className: "sg-sel-sub sg-mono", children: shortAddress(account) }) : null
|
|
@@ -3561,12 +3812,19 @@ function useRecipient(destinationChainId, hostRecipient, opts = {}) {
|
|
|
3561
3812
|
const [custom, setCustom] = useState({});
|
|
3562
3813
|
const [open, setOpen] = useState(false);
|
|
3563
3814
|
const triggerRef = useRef(null);
|
|
3815
|
+
const evmAccount = opts.evm?.account ?? null;
|
|
3564
3816
|
const evmManaged = recipientFamily === "evm" && Boolean(opts.sourceIsSolana);
|
|
3565
|
-
const
|
|
3817
|
+
const required = recipientFamily === "solana" || evmManaged;
|
|
3818
|
+
const managed = hostRecipient === void 0 && (required || Boolean(opts.evm));
|
|
3566
3819
|
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;
|
|
3567
|
-
const recipient = hostRecipient !== void 0 ? hostRecipient : recipientFamily === "solana" ? custom.solana || wallet.address || void 0 : evmManaged ? custom.evm || opts.evm
|
|
3568
|
-
const missing = managed && !recipient;
|
|
3569
|
-
const
|
|
3820
|
+
const recipient = 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;
|
|
3821
|
+
const missing = managed && required && !recipient;
|
|
3822
|
+
const shown = recipient ?? (recipientFamily === "evm" && !required ? evmAccount ?? void 0 : void 0);
|
|
3823
|
+
const typed = hostRecipient === void 0 ? custom[recipientFamily] || "" : "";
|
|
3824
|
+
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 };
|
|
3825
|
+
const wallets = [];
|
|
3826
|
+
if (evmAccount) wallets.push({ family: "evm", address: evmAccount, eligible: recipientFamily === "evm" });
|
|
3827
|
+
if (wallet.address) wallets.push({ family: "solana", address: wallet.address, eligible: recipientFamily === "solana" });
|
|
3570
3828
|
const close = () => {
|
|
3571
3829
|
setOpen(false);
|
|
3572
3830
|
requestAnimationFrame(() => triggerRef.current?.focus());
|
|
@@ -3577,7 +3835,7 @@ function useRecipient(destinationChainId, hostRecipient, opts = {}) {
|
|
|
3577
3835
|
};
|
|
3578
3836
|
const connect = async (name) => {
|
|
3579
3837
|
if (recipientFamily === "evm") {
|
|
3580
|
-
if (
|
|
3838
|
+
if (evmAccount) selectAddress("");
|
|
3581
3839
|
else opts.evm?.connect();
|
|
3582
3840
|
return;
|
|
3583
3841
|
}
|
|
@@ -3593,38 +3851,170 @@ function useRecipient(destinationChainId, hostRecipient, opts = {}) {
|
|
|
3593
3851
|
if (typeof address === "string") selectAddress("");
|
|
3594
3852
|
else setOpen(true);
|
|
3595
3853
|
};
|
|
3596
|
-
const recipientFor = (account) =>
|
|
3597
|
-
return { recipientFamily, recipient, recipientFor, managed, missing, error, wallet, familyWallet, open: open && managed, show: () => setOpen(true), close, selectAddress, connect, triggerRef };
|
|
3854
|
+
const recipientFor = (account) => required ? recipient || "" : hostRecipient || custom.evm || account;
|
|
3855
|
+
return { recipientFamily, recipientChainId: destinationChainId, recipient, shown, typed, recipientFor, managed, missing, error, wallet, familyWallet, wallets, open: open && managed, show: () => setOpen(true), close, selectAddress, connect, triggerRef };
|
|
3598
3856
|
}
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3857
|
+
|
|
3858
|
+
// src/core/checksum.ts
|
|
3859
|
+
var RC = [
|
|
3860
|
+
0x0000000000000001n,
|
|
3861
|
+
0x0000000000008082n,
|
|
3862
|
+
0x800000000000808an,
|
|
3863
|
+
0x8000000080008000n,
|
|
3864
|
+
0x000000000000808bn,
|
|
3865
|
+
0x0000000080000001n,
|
|
3866
|
+
0x8000000080008081n,
|
|
3867
|
+
0x8000000000008009n,
|
|
3868
|
+
0x000000000000008an,
|
|
3869
|
+
0x0000000000000088n,
|
|
3870
|
+
0x0000000080008009n,
|
|
3871
|
+
0x000000008000000an,
|
|
3872
|
+
0x000000008000808bn,
|
|
3873
|
+
0x800000000000008bn,
|
|
3874
|
+
0x8000000000008089n,
|
|
3875
|
+
0x8000000000008003n,
|
|
3876
|
+
0x8000000000008002n,
|
|
3877
|
+
0x8000000000000080n,
|
|
3878
|
+
0x000000000000800an,
|
|
3879
|
+
0x800000008000000an,
|
|
3880
|
+
0x8000000080008081n,
|
|
3881
|
+
0x8000000000008080n,
|
|
3882
|
+
0x0000000080000001n,
|
|
3883
|
+
0x8000000080008008n
|
|
3884
|
+
];
|
|
3885
|
+
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];
|
|
3886
|
+
var MASK = (1n << 64n) - 1n;
|
|
3887
|
+
var rotl = (x, n) => n === 0 ? x : (x << BigInt(n) | x >> BigInt(64 - n)) & MASK;
|
|
3888
|
+
function keccakF(s) {
|
|
3889
|
+
for (let round = 0; round < 24; round++) {
|
|
3890
|
+
const c = [0, 1, 2, 3, 4].map((x) => s[x] ^ s[x + 5] ^ s[x + 10] ^ s[x + 15] ^ s[x + 20]);
|
|
3891
|
+
for (let x = 0; x < 5; x++) {
|
|
3892
|
+
const d = c[(x + 4) % 5] ^ rotl(c[(x + 1) % 5], 1);
|
|
3893
|
+
for (let y = 0; y < 25; y += 5) s[y + x] = s[y + x] ^ d;
|
|
3894
|
+
}
|
|
3895
|
+
const b = new Array(25);
|
|
3896
|
+
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]);
|
|
3897
|
+
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];
|
|
3898
|
+
s[0] = s[0] ^ RC[round];
|
|
3899
|
+
}
|
|
3900
|
+
}
|
|
3901
|
+
function keccak256Hex(bytes) {
|
|
3902
|
+
const rate = 136;
|
|
3903
|
+
const padded = new Uint8Array(Math.ceil((bytes.length + 1) / rate) * rate);
|
|
3904
|
+
padded.set(bytes);
|
|
3905
|
+
padded[bytes.length] = padded[bytes.length] ^ 1;
|
|
3906
|
+
padded[padded.length - 1] = padded[padded.length - 1] ^ 128;
|
|
3907
|
+
const s = new Array(25).fill(0n);
|
|
3908
|
+
for (let off = 0; off < padded.length; off += rate) {
|
|
3909
|
+
for (let i = 0; i < rate / 8; i++) {
|
|
3910
|
+
let lane = 0n;
|
|
3911
|
+
for (let j = 7; j >= 0; j--) lane = lane << 8n | BigInt(padded[off + i * 8 + j]);
|
|
3912
|
+
s[i] = s[i] ^ lane;
|
|
3913
|
+
}
|
|
3914
|
+
keccakF(s);
|
|
3915
|
+
}
|
|
3916
|
+
let out = "";
|
|
3917
|
+
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");
|
|
3918
|
+
return out;
|
|
3919
|
+
}
|
|
3920
|
+
function toChecksumAddress(address) {
|
|
3921
|
+
const lower = address.slice(2).toLowerCase();
|
|
3922
|
+
const hash = keccak256Hex(new TextEncoder().encode(lower));
|
|
3923
|
+
let out = "0x";
|
|
3924
|
+
for (let i = 0; i < 40; i++) out += Number.parseInt(hash[i], 16) >= 8 ? lower[i].toUpperCase() : lower[i];
|
|
3925
|
+
return out;
|
|
3926
|
+
}
|
|
3927
|
+
function hasValidChecksum(address) {
|
|
3928
|
+
if (!/^0x[0-9a-fA-F]{40}$/.test(address)) return false;
|
|
3929
|
+
const body = address.slice(2);
|
|
3930
|
+
if (body === body.toLowerCase() || body === body.toUpperCase()) return true;
|
|
3931
|
+
return toChecksumAddress(address) === address;
|
|
3932
|
+
}
|
|
3933
|
+
function ArrowLeft() {
|
|
3934
|
+
return /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
3935
|
+
/* @__PURE__ */ jsx("path", { d: "M6.38 3.95312L2.33333 7.99979L6.38 12.0465", stroke: "currentColor", strokeWidth: "1.2", strokeMiterlimit: "10", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
3936
|
+
/* @__PURE__ */ jsx("path", { d: "M13.6667 8H2.44667", stroke: "currentColor", strokeWidth: "1.2", strokeMiterlimit: "10", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
3613
3937
|
] });
|
|
3614
3938
|
}
|
|
3615
|
-
function
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3939
|
+
function CloseX() {
|
|
3940
|
+
return /* @__PURE__ */ jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M18 6L6 18M6 6L18 18", stroke: "currentColor", strokeWidth: "1.49983", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
3941
|
+
}
|
|
3942
|
+
function AddCircle() {
|
|
3943
|
+
return /* @__PURE__ */ jsxs("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": "true", children: [
|
|
3944
|
+
/* @__PURE__ */ 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" }),
|
|
3945
|
+
/* @__PURE__ */ jsx("path", { d: "M6 9H12M9 12V6", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
3946
|
+
] });
|
|
3947
|
+
}
|
|
3948
|
+
function Tick2() {
|
|
3949
|
+
return /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M2.0625 6.5625L4.6875 9.1875L9.9375 3.5625", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
3950
|
+
}
|
|
3951
|
+
function Logout() {
|
|
3952
|
+
return /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
3953
|
+
"path",
|
|
3954
|
+
{
|
|
3955
|
+
fill: "currentColor",
|
|
3956
|
+
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"
|
|
3957
|
+
}
|
|
3958
|
+
) });
|
|
3959
|
+
}
|
|
3960
|
+
function ShieldTickBold() {
|
|
3961
|
+
return /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
3962
|
+
"path",
|
|
3963
|
+
{
|
|
3964
|
+
fill: "currentColor",
|
|
3965
|
+
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"
|
|
3966
|
+
}
|
|
3967
|
+
) });
|
|
3968
|
+
}
|
|
3969
|
+
function CloseCircleBold() {
|
|
3970
|
+
return /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
3971
|
+
"path",
|
|
3972
|
+
{
|
|
3973
|
+
fill: "currentColor",
|
|
3974
|
+
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"
|
|
3975
|
+
}
|
|
3976
|
+
) });
|
|
3977
|
+
}
|
|
3978
|
+
function Loader() {
|
|
3979
|
+
return /* @__PURE__ */ jsx("svg", { className: "sg-ws-spin", width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
3980
|
+
"path",
|
|
3981
|
+
{
|
|
3982
|
+
fill: "currentColor",
|
|
3983
|
+
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"
|
|
3984
|
+
}
|
|
3985
|
+
) });
|
|
3986
|
+
}
|
|
3987
|
+
function SmallChevron() {
|
|
3988
|
+
return /* @__PURE__ */ jsx("svg", { width: "5", height: "10", viewBox: "0 0 5 10", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M0.503906 9L3.50391 6L0.503906 3", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
3989
|
+
}
|
|
3990
|
+
function PixelGlyph() {
|
|
3991
|
+
return /* @__PURE__ */ jsxs("svg", { width: "21.5888", height: "17.3869", viewBox: "0 0 21.5888 17.3869", fill: "none", "aria-hidden": "true", children: [
|
|
3992
|
+
/* @__PURE__ */ 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" }),
|
|
3993
|
+
/* @__PURE__ */ 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" })
|
|
3994
|
+
] });
|
|
3995
|
+
}
|
|
3996
|
+
var FAMILY_LABEL = { evm: "EVM", solana: "Solana" };
|
|
3997
|
+
function walletShort(address) {
|
|
3998
|
+
return address.length > 14 ? `${address.slice(0, 7)}\u2026${address.slice(-5)}` : address;
|
|
3999
|
+
}
|
|
4000
|
+
function chipShort(address) {
|
|
4001
|
+
return address.length > 12 ? `${address.slice(0, 6)}\u2026${address.slice(-4)}` : address;
|
|
4002
|
+
}
|
|
4003
|
+
function WalletAvatar({ family, chainId }) {
|
|
4004
|
+
const [failed, setFailed] = useState([]);
|
|
4005
|
+
const mark = chainLogoCandidates(family === "solana" ? SOLANA_CHAIN_ID : chainId ?? 1).find((url) => !failed.includes(url));
|
|
4006
|
+
return /* @__PURE__ */ jsxs("span", { className: "sg-ws-avatar", "data-family": family, "aria-hidden": "true", children: [
|
|
4007
|
+
/* @__PURE__ */ jsx(PixelGlyph, {}),
|
|
4008
|
+
mark ? /* @__PURE__ */ jsx("span", { className: "sg-ws-avatar-chain", children: /* @__PURE__ */ jsx("img", { src: mark, alt: "", onError: () => setFailed((prev) => [...prev, mark]) }) }) : null
|
|
4009
|
+
] });
|
|
4010
|
+
}
|
|
4011
|
+
function SheetFrame(props) {
|
|
3619
4012
|
const sheetRef = useRef(null);
|
|
3620
|
-
const closeRef = useRef(
|
|
3621
|
-
closeRef.current =
|
|
3622
|
-
const
|
|
3623
|
-
const valid = state.recipientFamily === "solana" ? isSolanaAddress(draft) : /^0x[0-9a-fA-F]{40}$/.test(draft.trim());
|
|
3624
|
-
const invalid = Boolean(draft.trim()) && !valid;
|
|
3625
|
-
const noWallet = state.recipientFamily === "solana" && !state.familyWallet.address && !state.familyWallet.wallets.length;
|
|
4013
|
+
const closeRef = useRef(props.onClose);
|
|
4014
|
+
closeRef.current = props.onClose;
|
|
4015
|
+
const titleId = useId();
|
|
3626
4016
|
useEffect(() => {
|
|
3627
|
-
(
|
|
4017
|
+
(props.initialFocus?.current ?? sheetRef.current)?.focus();
|
|
3628
4018
|
const onKey = (event) => {
|
|
3629
4019
|
if (event.key === "Escape") {
|
|
3630
4020
|
event.stopPropagation();
|
|
@@ -3633,63 +4023,263 @@ function RecipientSheet({ state, symbol }) {
|
|
|
3633
4023
|
};
|
|
3634
4024
|
document.addEventListener("keydown", onKey, true);
|
|
3635
4025
|
return () => document.removeEventListener("keydown", onKey, true);
|
|
3636
|
-
}, [
|
|
3637
|
-
return /* @__PURE__ */ jsxs(
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
4026
|
+
}, []);
|
|
4027
|
+
return /* @__PURE__ */ jsxs(
|
|
4028
|
+
"div",
|
|
4029
|
+
{
|
|
4030
|
+
className: "sg-ws",
|
|
4031
|
+
"data-wide": props.wide || void 0,
|
|
4032
|
+
role: "dialog",
|
|
4033
|
+
"aria-modal": "true",
|
|
4034
|
+
"aria-label": props.label,
|
|
4035
|
+
ref: sheetRef,
|
|
4036
|
+
tabIndex: -1,
|
|
4037
|
+
style: props.minHeight ? { minHeight: props.minHeight } : void 0,
|
|
4038
|
+
children: [
|
|
4039
|
+
/* @__PURE__ */ jsxs("div", { className: "sg-ws-top", children: [
|
|
4040
|
+
/* @__PURE__ */ jsxs("div", { className: "sg-ws-head", children: [
|
|
4041
|
+
/* @__PURE__ */ jsxs("button", { type: "button", className: "sg-ws-back", onClick: () => closeRef.current(), children: [
|
|
4042
|
+
/* @__PURE__ */ jsx(ArrowLeft, {}),
|
|
4043
|
+
props.backLabel ?? "Back to Exchange"
|
|
4044
|
+
] }),
|
|
4045
|
+
props.wide ? null : /* @__PURE__ */ jsx("button", { type: "button", className: "sg-ws-close", onClick: () => closeRef.current(), "aria-label": `Close ${props.label.toLowerCase()}`, children: /* @__PURE__ */ jsx(CloseX, {}) })
|
|
4046
|
+
] }),
|
|
4047
|
+
/* @__PURE__ */ jsxs("div", { className: "sg-ws-main", children: [
|
|
4048
|
+
/* @__PURE__ */ jsx("h4", { className: "sg-ws-title", id: titleId, children: props.title }),
|
|
4049
|
+
props.children
|
|
4050
|
+
] })
|
|
4051
|
+
] }),
|
|
4052
|
+
props.footer ? /* @__PURE__ */ jsx("div", { className: "sg-ws-foot", children: props.footer }) : null
|
|
4053
|
+
]
|
|
4054
|
+
}
|
|
4055
|
+
);
|
|
4056
|
+
}
|
|
4057
|
+
function WalletChip(props) {
|
|
4058
|
+
const count = props.addresses.length;
|
|
4059
|
+
if (!count) {
|
|
4060
|
+
return /* @__PURE__ */ jsx("button", { type: "button", className: "sg-wallet", onClick: props.onConnect, disabled: props.connecting, children: props.connecting ? "Connecting\u2026" : "Connect wallet" });
|
|
4061
|
+
}
|
|
4062
|
+
const label2 = count === 1 ? chipShort(props.addresses[0]) : `${count} wallets`;
|
|
4063
|
+
return /* @__PURE__ */ 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: [
|
|
4064
|
+
/* @__PURE__ */ jsx("span", { className: "sg-wallet-dot", "aria-hidden": "true" }),
|
|
4065
|
+
/* @__PURE__ */ jsx("span", { className: "sg-wallet-label", children: label2 }),
|
|
4066
|
+
/* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 15.9961 15.9961", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M4 6.99854L7.99902 10.9976L11.998 6.99854", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
4067
|
+
] });
|
|
4068
|
+
}
|
|
4069
|
+
function screeningSummary(states) {
|
|
4070
|
+
if (!states.length || states.some((s) => s.status === "pending")) return { tone: "pending", text: "Checking...", action: "Pending" };
|
|
4071
|
+
const blocked = states.filter((s) => s.status === "done" && s.screen.blocked).length;
|
|
4072
|
+
if (blocked) {
|
|
4073
|
+
const text = blocked === states.length ? states.length === 1 ? "Wallet restricted" : states.length === 2 ? "Both wallets restricted" : "All wallets restricted" : `${blocked} of ${states.length} wallets restricted`;
|
|
4074
|
+
return { tone: "blocked", text, action: "View details" };
|
|
4075
|
+
}
|
|
4076
|
+
if (states.some((s) => s.status === "error")) return { tone: "unknown", text: "Screening unavailable", action: "Try later" };
|
|
4077
|
+
return { tone: "ok", text: `${states.length} wallet${states.length === 1 ? "" : "s"} screened`, action: "No flags" };
|
|
4078
|
+
}
|
|
4079
|
+
function WalletsSheet(props) {
|
|
4080
|
+
const states = props.wallets.map((w) => props.screens[w.address] ?? { status: "pending" });
|
|
4081
|
+
const summary = screeningSummary(states);
|
|
4082
|
+
const anyRestricted = states.some((s) => s.status === "done" && s.screen.blocked);
|
|
4083
|
+
const summaryInner = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4084
|
+
/* @__PURE__ */ jsxs("span", { className: "sg-ws-sum-lead", children: [
|
|
4085
|
+
summary.tone === "pending" ? /* @__PURE__ */ jsx(Loader, {}) : summary.tone === "blocked" ? /* @__PURE__ */ jsx(CloseCircleBold, {}) : /* @__PURE__ */ jsx(ShieldTickBold, {}),
|
|
4086
|
+
/* @__PURE__ */ jsx("span", { className: "sg-ws-sum-text", children: summary.text })
|
|
3644
4087
|
] }),
|
|
3645
|
-
/* @__PURE__ */ jsxs("
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
4088
|
+
/* @__PURE__ */ jsxs("span", { className: "sg-ws-sum-act", children: [
|
|
4089
|
+
summary.action,
|
|
4090
|
+
/* @__PURE__ */ jsx(SmallChevron, {})
|
|
4091
|
+
] })
|
|
4092
|
+
] });
|
|
4093
|
+
return /* @__PURE__ */ jsx(SheetFrame, { label: "Wallets", title: "Wallets", wide: props.wide, onClose: props.onClose, minHeight: props.minHeight, children: /* @__PURE__ */ jsxs("div", { className: "sg-ws-list", "data-gap": "8", children: [
|
|
4094
|
+
/* @__PURE__ */ jsxs("div", { className: "sg-ws-list", children: [
|
|
4095
|
+
props.wallets.map((w, i) => {
|
|
4096
|
+
const state = states[i];
|
|
4097
|
+
const restricted = state.status === "done" && state.screen.blocked;
|
|
4098
|
+
const pill = restricted ? "Restricted" : anyRestricted && state.status === "done" ? "No flags" : null;
|
|
4099
|
+
return /* @__PURE__ */ jsxs("div", { className: "sg-ws-row", "data-restricted": restricted || void 0, children: [
|
|
4100
|
+
/* @__PURE__ */ jsxs("div", { className: "sg-ws-row-line", children: [
|
|
4101
|
+
/* @__PURE__ */ jsxs("span", { className: "sg-ws-id", children: [
|
|
4102
|
+
/* @__PURE__ */ jsx(WalletAvatar, { family: w.family, chainId: w.chainId }),
|
|
4103
|
+
/* @__PURE__ */ jsxs("span", { className: "sg-ws-id-text", children: [
|
|
4104
|
+
/* @__PURE__ */ jsxs("span", { className: "sg-ws-id-label", children: [
|
|
4105
|
+
FAMILY_LABEL[w.family],
|
|
4106
|
+
" Wallet",
|
|
4107
|
+
pill ? /* @__PURE__ */ jsx("span", { className: "sg-ws-pill", "data-tone": restricted ? "blocked" : "ok", children: pill }) : null
|
|
4108
|
+
] }),
|
|
4109
|
+
/* @__PURE__ */ jsx("span", { className: "sg-ws-addr", title: w.address, children: walletShort(w.address) })
|
|
4110
|
+
] })
|
|
4111
|
+
] }),
|
|
4112
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "sg-ws-icon-btn", onClick: w.disconnect, "aria-label": `Disconnect ${FAMILY_LABEL[w.family]} wallet`, children: /* @__PURE__ */ jsx(Logout, {}) })
|
|
4113
|
+
] }),
|
|
4114
|
+
restricted ? /* @__PURE__ */ jsx("p", { className: "sg-ws-note", children: "This wallet can\u2019t be used because it didn\u2019t pass compliance screening." }) : null
|
|
4115
|
+
] }, w.address);
|
|
4116
|
+
}),
|
|
4117
|
+
props.connect && (props.connect.choices?.length ?? 0) > 1 ? props.connect.choices.map((name) => /* @__PURE__ */ jsxs("button", { type: "button", className: "sg-ws-row sg-ws-action", onClick: () => props.connect.onClick(name), disabled: props.connect.busy, children: [
|
|
4118
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
4119
|
+
"Connect ",
|
|
4120
|
+
name
|
|
3652
4121
|
] }),
|
|
3653
|
-
/* @__PURE__ */ jsx(
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
4122
|
+
/* @__PURE__ */ jsx(AddCircle, {})
|
|
4123
|
+
] }, name)) : props.connect ? /* @__PURE__ */ jsxs("button", { type: "button", className: "sg-ws-row sg-ws-action", onClick: () => props.connect.onClick(props.connect.choices?.[0]), disabled: props.connect.busy, children: [
|
|
4124
|
+
/* @__PURE__ */ jsx("span", { children: props.connect.busy ? "Connecting\u2026" : `Connect ${FAMILY_LABEL[props.connect.family]} wallet` }),
|
|
4125
|
+
/* @__PURE__ */ jsx(AddCircle, {})
|
|
4126
|
+
] }) : null
|
|
4127
|
+
] }),
|
|
4128
|
+
props.wallets.length ? props.onDetails && states.every((s) => s.status === "done") ? /* @__PURE__ */ jsx("button", { type: "button", className: "sg-ws-sum", "data-tone": summary.tone, onClick: props.onDetails, children: summaryInner }) : /* @__PURE__ */ jsx("div", { className: "sg-ws-sum", "data-tone": summary.tone, role: "status", children: summaryInner }) : null,
|
|
4129
|
+
props.error ? /* @__PURE__ */ jsx("p", { className: "sg-ws-error", role: "alert", children: props.error }) : null
|
|
4130
|
+
] }) });
|
|
4131
|
+
}
|
|
4132
|
+
function RecipientRow({ state, disabled, wide }) {
|
|
4133
|
+
if (state.error) return /* @__PURE__ */ jsx("div", { className: "sg-rcp-row", "data-wide": wide || void 0, "data-tone": "error", role: "alert", children: state.error });
|
|
4134
|
+
const address = state.shown;
|
|
4135
|
+
if (!address && !state.managed) return null;
|
|
4136
|
+
return /* @__PURE__ */ jsxs("div", { className: "sg-rcp-row", "data-wide": wide || void 0, children: [
|
|
4137
|
+
/* @__PURE__ */ jsx("span", { className: "sg-rcp-label", children: "Recipient" }),
|
|
4138
|
+
/* @__PURE__ */ jsxs("span", { className: "sg-rcp-end", children: [
|
|
4139
|
+
address ? /* @__PURE__ */ jsxs("span", { className: "sg-rcp-value", title: address, children: [
|
|
4140
|
+
FAMILY_LABEL[state.recipientFamily],
|
|
4141
|
+
" \xB7 ",
|
|
4142
|
+
chipShort(address)
|
|
4143
|
+
] }) : /* @__PURE__ */ jsx("span", { className: "sg-rcp-value", "data-empty": "true", children: "Not set" }),
|
|
4144
|
+
state.managed ? /* @__PURE__ */ jsx("button", { ref: state.triggerRef, type: "button", className: "sg-rcp-change", onClick: state.show, disabled, "aria-haspopup": "dialog", children: address ? "Change" : "Add" }) : null
|
|
4145
|
+
] })
|
|
4146
|
+
] });
|
|
4147
|
+
}
|
|
4148
|
+
function RecipientSheet({ state, wide, minHeight }) {
|
|
4149
|
+
const family = state.recipientFamily;
|
|
4150
|
+
const label2 = FAMILY_LABEL[family];
|
|
4151
|
+
const eligible = state.wallets.filter((w) => w.eligible);
|
|
4152
|
+
const [choice, setChoice] = useState(() => {
|
|
4153
|
+
if (state.typed) return { kind: "custom" };
|
|
4154
|
+
const current = eligible.find((w) => w.address === state.recipient) ?? eligible[0];
|
|
4155
|
+
return current ? { kind: "wallet", address: current.address } : { kind: "custom" };
|
|
4156
|
+
});
|
|
4157
|
+
const [draft, setDraft] = useState(state.typed);
|
|
4158
|
+
const [editing, setEditing] = useState(false);
|
|
4159
|
+
const id = useId();
|
|
4160
|
+
const inputRef = useRef(null);
|
|
4161
|
+
const noWallet = family === "solana" && !state.familyWallet.address && !state.familyWallet.wallets.length;
|
|
4162
|
+
const canConnect = !state.familyWallet.address && (family === "evm" || state.familyWallet.wallets.length > 0);
|
|
4163
|
+
const shapeOk = family === "solana" ? isSolanaAddress(draft.trim()) : /^0x[0-9a-fA-F]{40}$/.test(draft.trim());
|
|
4164
|
+
const checksumOk = family === "solana" || !shapeOk || hasValidChecksum(draft.trim());
|
|
4165
|
+
const valid = shapeOk && checksumOk;
|
|
4166
|
+
const invalid = choice.kind === "custom" && Boolean(draft.trim()) && !valid;
|
|
4167
|
+
const chosenWallet = choice.kind === "wallet" ? eligible.find((w) => w.address === choice.address) : void 0;
|
|
4168
|
+
const ready = choice.kind === "wallet" ? Boolean(chosenWallet) : valid;
|
|
4169
|
+
const custom = choice.kind === "custom";
|
|
4170
|
+
useEffect(() => {
|
|
4171
|
+
if (custom) inputRef.current?.focus();
|
|
4172
|
+
}, [custom]);
|
|
4173
|
+
const confirm = () => {
|
|
4174
|
+
if (!ready) return;
|
|
4175
|
+
state.selectAddress(choice.kind === "custom" ? draft.trim() : "");
|
|
4176
|
+
};
|
|
4177
|
+
const row = (w) => {
|
|
4178
|
+
const selected = choice.kind === "wallet" && choice.address === w.address && w.eligible;
|
|
4179
|
+
return /* @__PURE__ */ jsxs(
|
|
4180
|
+
"button",
|
|
4181
|
+
{
|
|
4182
|
+
type: "button",
|
|
4183
|
+
className: "sg-rcp-opt",
|
|
4184
|
+
"data-selected": selected || void 0,
|
|
4185
|
+
disabled: !w.eligible,
|
|
4186
|
+
"aria-pressed": selected,
|
|
4187
|
+
title: w.eligible ? w.address : `A ${FAMILY_LABEL[w.family]} wallet cannot receive on this chain`,
|
|
4188
|
+
onClick: () => setChoice({ kind: "wallet", address: w.address }),
|
|
4189
|
+
children: [
|
|
4190
|
+
/* @__PURE__ */ jsxs("span", { className: "sg-ws-id", children: [
|
|
4191
|
+
/* @__PURE__ */ jsx(WalletAvatar, { family: w.family, chainId: w.family === "evm" ? state.recipientChainId : void 0 }),
|
|
4192
|
+
/* @__PURE__ */ jsxs("span", { className: "sg-ws-id-text", children: [
|
|
4193
|
+
/* @__PURE__ */ jsxs("span", { className: "sg-ws-id-label", children: [
|
|
4194
|
+
FAMILY_LABEL[w.family],
|
|
4195
|
+
" Wallet"
|
|
4196
|
+
] }),
|
|
4197
|
+
/* @__PURE__ */ jsx("span", { className: "sg-ws-addr", children: walletShort(w.address) })
|
|
4198
|
+
] })
|
|
4199
|
+
] }),
|
|
4200
|
+
selected ? /* @__PURE__ */ jsx("span", { className: "sg-rcp-tick", children: /* @__PURE__ */ jsx(Tick2, {}) }) : null
|
|
4201
|
+
]
|
|
4202
|
+
},
|
|
4203
|
+
w.address
|
|
4204
|
+
);
|
|
4205
|
+
};
|
|
4206
|
+
return /* @__PURE__ */ jsx(
|
|
4207
|
+
SheetFrame,
|
|
4208
|
+
{
|
|
4209
|
+
label: "Recipient",
|
|
4210
|
+
title: "Recipient",
|
|
4211
|
+
wide,
|
|
4212
|
+
onClose: state.close,
|
|
4213
|
+
minHeight,
|
|
4214
|
+
initialFocus: noWallet ? inputRef : void 0,
|
|
4215
|
+
footer: /* @__PURE__ */ jsx("button", { type: "button", className: "sg-btn sg-ws-cta", disabled: !ready, onClick: confirm, children: "Use this address" }),
|
|
4216
|
+
children: /* @__PURE__ */ jsxs("div", { className: "sg-ws-list", children: [
|
|
4217
|
+
state.wallets.map(row),
|
|
4218
|
+
canConnect ? /* @__PURE__ */ jsxs("button", { type: "button", className: "sg-ws-row sg-ws-action", onClick: () => void state.connect(), disabled: state.familyWallet.connecting, children: [
|
|
4219
|
+
/* @__PURE__ */ jsx("span", { children: state.familyWallet.connecting ? "Connecting\u2026" : `Connect ${label2} wallet` }),
|
|
4220
|
+
/* @__PURE__ */ jsx(AddCircle, {})
|
|
3661
4221
|
] }) : null,
|
|
3662
|
-
state.familyWallet.
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
4222
|
+
!state.familyWallet.address && state.familyWallet.wallets.length > 1 ? state.familyWallet.wallets.map((wallet) => /* @__PURE__ */ jsxs("button", { type: "button", className: "sg-ws-row sg-ws-action", onClick: () => void state.connect(wallet.name), disabled: state.familyWallet.connecting, children: [
|
|
4223
|
+
/* @__PURE__ */ jsx("span", { children: wallet.name }),
|
|
4224
|
+
/* @__PURE__ */ jsx(AddCircle, {})
|
|
4225
|
+
] }, wallet.name)) : null,
|
|
4226
|
+
custom ? /* @__PURE__ */ jsxs("div", { className: "sg-rcp-custom", "data-open": "true", children: [
|
|
4227
|
+
/* @__PURE__ */ jsxs("div", { className: "sg-rcp-custom-head", children: [
|
|
4228
|
+
/* @__PURE__ */ jsx("label", { htmlFor: id, children: "Add another address" }),
|
|
4229
|
+
/* @__PURE__ */ jsx("span", { className: "sg-rcp-tick", children: /* @__PURE__ */ jsx(Tick2, {}) })
|
|
4230
|
+
] }),
|
|
3667
4231
|
/* @__PURE__ */ jsx(
|
|
3668
4232
|
"input",
|
|
3669
4233
|
{
|
|
3670
4234
|
ref: inputRef,
|
|
3671
4235
|
id,
|
|
3672
|
-
className: "sg-input
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
"aria-label": `${family} recipient address`,
|
|
4236
|
+
className: "sg-rcp-input",
|
|
4237
|
+
placeholder: family === "solana" ? "Solana recipient address" : "0x...Recipient address",
|
|
4238
|
+
"aria-label": `${label2} recipient address`,
|
|
3676
4239
|
"aria-invalid": invalid || void 0,
|
|
3677
|
-
"aria-describedby":
|
|
3678
|
-
value: draft,
|
|
4240
|
+
"aria-describedby": invalid ? `${id}-error` : void 0,
|
|
4241
|
+
value: editing || draft.length <= 34 ? draft : `${draft.slice(0, 13)}..${draft.slice(-15)}`,
|
|
4242
|
+
onFocus: () => setEditing(true),
|
|
4243
|
+
onBlur: () => setEditing(false),
|
|
3679
4244
|
onChange: (event) => setDraft(event.target.value),
|
|
3680
|
-
|
|
4245
|
+
onKeyDown: (event) => {
|
|
4246
|
+
if (event.key === "Enter") confirm();
|
|
4247
|
+
},
|
|
4248
|
+
spellCheck: false,
|
|
4249
|
+
autoComplete: "off"
|
|
3681
4250
|
}
|
|
3682
|
-
)
|
|
4251
|
+
),
|
|
4252
|
+
invalid ? /* @__PURE__ */ 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,
|
|
4253
|
+
noWallet ? /* @__PURE__ */ jsxs("p", { className: "sg-rcp-hint", children: [
|
|
4254
|
+
"No ",
|
|
4255
|
+
label2,
|
|
4256
|
+
" wallet found. Enter a ",
|
|
4257
|
+
label2,
|
|
4258
|
+
" address instead."
|
|
4259
|
+
] }) : null
|
|
4260
|
+
] }) : /* @__PURE__ */ jsxs("button", { type: "button", className: "sg-rcp-custom", onClick: () => setChoice({ kind: "custom" }), children: [
|
|
4261
|
+
/* @__PURE__ */ jsx("span", { children: "Add another address" }),
|
|
4262
|
+
/* @__PURE__ */ jsx(AddCircle, {})
|
|
3683
4263
|
] }),
|
|
3684
|
-
|
|
3685
|
-
"Not a valid ",
|
|
3686
|
-
family,
|
|
3687
|
-
" address."
|
|
3688
|
-
] }) }) : null,
|
|
3689
|
-
/* @__PURE__ */ 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." }),
|
|
3690
|
-
/* @__PURE__ */ jsx(Button, { disabled: !valid, onClick: () => state.selectAddress(draft.trim()), children: "Use this address" })
|
|
4264
|
+
state.familyWallet.error ? /* @__PURE__ */ jsx("p", { className: "sg-ws-error", children: state.familyWallet.error }) : null
|
|
3691
4265
|
] })
|
|
3692
|
-
|
|
4266
|
+
}
|
|
4267
|
+
);
|
|
4268
|
+
}
|
|
4269
|
+
var short = (address) => `${address.slice(0, 4)}\u2026${address.slice(-4)}`;
|
|
4270
|
+
function RecipientNote({ state, disabled }) {
|
|
4271
|
+
if (state.error) return /* @__PURE__ */ jsx(StatusPanel, { tone: "error", children: state.error });
|
|
4272
|
+
if (!state.managed) return null;
|
|
4273
|
+
const family = state.recipientFamily === "solana" ? "Solana" : "EVM";
|
|
4274
|
+
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "center", gap: 6, marginTop: 10, fontSize: 13, color: "var(--sg-text-muted)", flexWrap: "wrap" }, children: [
|
|
4275
|
+
state.recipient ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4276
|
+
"To ",
|
|
4277
|
+
/* @__PURE__ */ jsx("b", { className: "sg-mono", title: state.recipient, style: { color: "var(--sg-text)" }, children: short(state.recipient) }),
|
|
4278
|
+
" on ",
|
|
4279
|
+
family,
|
|
4280
|
+
" \xB7 "
|
|
4281
|
+
] }) : null,
|
|
4282
|
+
/* @__PURE__ */ 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" })
|
|
3693
4283
|
] });
|
|
3694
4284
|
}
|
|
3695
4285
|
var IDENTITY_KEY_PREFIX = "sg:link:v1:";
|
|
@@ -4334,6 +4924,9 @@ function PaymentIsland(props) {
|
|
|
4334
4924
|
const selectedVisible = Boolean(sel && visibleRoutes.some((r) => r.id === sel.id));
|
|
4335
4925
|
const selBal = sel ? holdings.balances[balanceKey(sel.source.chainId, sel.source.tokenAddress)] : void 0;
|
|
4336
4926
|
const lastTxOwned = Boolean(flow.lastTxEntry?.hash && wallet.account && flow.lastTxEntry.account === wallet.account.toLowerCase());
|
|
4927
|
+
const evmDirect = flow.lastTxEntry?.settlement === "direct";
|
|
4928
|
+
const evmConfirmed = flow.verdict?.status === "confirmed";
|
|
4929
|
+
const evmDelivery = useDelivery(engine, (flow.status === "success" || flow.status === "pending") && !evmDirect ? flow.txHash : null);
|
|
4337
4930
|
const mismatch = flow.status === "error" && flow.verdict?.status === "mismatch";
|
|
4338
4931
|
const destTicker = isPay ? tickerOn(registryTokens, props.toChainId, props.toAsset ?? "") : exToToken ? tokenTicker(exToToken) : exToAsset ?? "";
|
|
4339
4932
|
const exFromTicker = exFromToken ? tokenTicker(exFromToken) : exFromAsset ?? "";
|
|
@@ -4391,7 +4984,11 @@ function PaymentIsland(props) {
|
|
|
4391
4984
|
linkMenu
|
|
4392
4985
|
] }) : void 0;
|
|
4393
4986
|
const activeStep = flow.steps.find((s) => s.state === "active");
|
|
4394
|
-
const liveMsg = flow.status === "loading" ? isPay ? "Finding the best way to pay." : "Finding the best route." : flow.status === "submitting" ? `${activeStep?.label ?? (isPay ? "Processing your payment" : `Processing your ${verb.present.toLowerCase()}`)} \u2014 in progress.` : flow.status === "success" || flow.status === "pending" ?
|
|
4987
|
+
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" ? (
|
|
4988
|
+
// Announces what the receipt shows: delivery from the tracker, never settlement on the
|
|
4989
|
+
// source receipt alone (review 2026-10-28).
|
|
4990
|
+
`${isPay ? "Payment" : verb.past}: ${deliveryHeadline(evmDelivery, evmConfirmed, evmDirect)}.`
|
|
4991
|
+
) : "";
|
|
4395
4992
|
const loading = flow.status === "loading";
|
|
4396
4993
|
const payReady = isPay ? Boolean(sel && selectedVisible) : Boolean(sel) && !needsRecipient;
|
|
4397
4994
|
const ctaLabel = submitting ? isPay ? "Paying\u2026" : kind === "swap" ? "Swapping\u2026" : "Exchanging\u2026" : flow.quoteStale ? flow.quotePaused ? "Refresh quote" : "Refreshing quote\u2026" : flow.insufficient ? "Insufficient balance" : flow.nativeShortfall ? flow.nativeShortfall : loading ? "Getting a price\u2026" : isPay ? sel && selectedVisible ? `Pay ${sel.source.payAmount} ${sel.source.ticker || sel.source.asset}` : "Pay" : kind === "swap" ? "Swap" : "Exchange";
|
|
@@ -4436,7 +5033,7 @@ function PaymentIsland(props) {
|
|
|
4436
5033
|
] });
|
|
4437
5034
|
let body;
|
|
4438
5035
|
if (hist && wallet.account) {
|
|
4439
|
-
body = /* @__PURE__ */ jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
|
|
5036
|
+
body = /* @__PURE__ */ jsx(TxHistoryPanel, { account: wallet.account, engine, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
|
|
4440
5037
|
} else if (isPay && view === "select" && wallet.account) {
|
|
4441
5038
|
body = /* @__PURE__ */ jsx(
|
|
4442
5039
|
TokenSelect,
|
|
@@ -4514,7 +5111,7 @@ function PaymentIsland(props) {
|
|
|
4514
5111
|
] })
|
|
4515
5112
|
] });
|
|
4516
5113
|
} else if (paid || settling) {
|
|
4517
|
-
const confirmed =
|
|
5114
|
+
const confirmed = isDelivered(evmDelivery, evmConfirmed, evmDirect);
|
|
4518
5115
|
body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4519
5116
|
/* @__PURE__ */ jsx(IdentityLine, { account: wallet.account, email: identity?.email }),
|
|
4520
5117
|
/* @__PURE__ */ jsxs("div", { className: "sg-receipt", children: [
|
|
@@ -4526,9 +5123,10 @@ function PaymentIsland(props) {
|
|
|
4526
5123
|
destTicker
|
|
4527
5124
|
] }),
|
|
4528
5125
|
/* @__PURE__ */ jsxs("div", { className: "sg-receipt-sub", children: [
|
|
4529
|
-
|
|
5126
|
+
deliveryHeadline(evmDelivery, evmConfirmed, evmDirect),
|
|
4530
5127
|
(flow.lastTxEntry?.recipient || recipient) && (isPay || recipientState.recipientFamily === "solana") ? ` \xB7 ${shortAddress(flow.lastTxEntry?.recipient || recipient)}` : ""
|
|
4531
|
-
] })
|
|
5128
|
+
] }),
|
|
5129
|
+
evmDirect ? null : /* @__PURE__ */ jsx(DeliverySteps, { delivery: evmDelivery })
|
|
4532
5130
|
] }),
|
|
4533
5131
|
!identityMatchesWallet ? /* @__PURE__ */ jsxs("div", { className: "sg-remember", children: [
|
|
4534
5132
|
/* @__PURE__ */ jsxs("label", { className: "sg-remember-top", children: [
|
|
@@ -4953,6 +5551,9 @@ function PayCard(props) {
|
|
|
4953
5551
|
};
|
|
4954
5552
|
useEffect(() => setHist(null), [wallet.account]);
|
|
4955
5553
|
const lastTxOwned = Boolean(flow.lastTxEntry?.hash && wallet.account && flow.lastTxEntry.account === wallet.account.toLowerCase());
|
|
5554
|
+
const evmDirect = flow.lastTxEntry?.settlement === "direct";
|
|
5555
|
+
const evmConfirmed = flow.verdict?.status === "confirmed";
|
|
5556
|
+
const evmDelivery = useDelivery(engine, (flow.status === "success" || flow.status === "pending") && !evmDirect ? flow.txHash : null);
|
|
4956
5557
|
const pickFunding = (pick) => {
|
|
4957
5558
|
setPickError(null);
|
|
4958
5559
|
const r = visibleRoutes.find((x) => x.source.chainId === pick.chainId && symbolKey(x.source.asset) === symbolKey(pick.symbol));
|
|
@@ -5012,7 +5613,7 @@ function PayCard(props) {
|
|
|
5012
5613
|
...durationLabel(sel.quote.estimatedDuration) ? [{ label: "Estimated time", value: durationLabel(sel.quote.estimatedDuration) }] : []
|
|
5013
5614
|
] : [];
|
|
5014
5615
|
const loadingPlan = flow.status === "loading" || holdings.loading && !sel || pricing !== null;
|
|
5015
|
-
return /* @__PURE__ */ jsx(WidgetShell, { title: config.title || "Complete payment", theme: config.theme, heightPx: props.heightPx, walletSlot, onClose: props.onClose, children: hist && wallet.account ? /* @__PURE__ */ jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory }) : view === "select" && wallet.account ? /* @__PURE__ */ jsx(
|
|
5616
|
+
return /* @__PURE__ */ jsx(WidgetShell, { title: config.title || "Complete payment", theme: config.theme, heightPx: props.heightPx, walletSlot, onClose: props.onClose, children: hist && wallet.account ? /* @__PURE__ */ jsx(TxHistoryPanel, { account: wallet.account, engine, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory }) : view === "select" && wallet.account ? /* @__PURE__ */ jsx(
|
|
5016
5617
|
TokenSelect,
|
|
5017
5618
|
{
|
|
5018
5619
|
title: "Pay with",
|
|
@@ -5034,17 +5635,18 @@ function PayCard(props) {
|
|
|
5034
5635
|
] })
|
|
5035
5636
|
] }) : flow.status === "success" || flow.status === "pending" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5036
5637
|
/* @__PURE__ */ jsxs("div", { className: "sg-success", children: [
|
|
5037
|
-
/* @__PURE__ */ jsx("div", { className: "sg-success-check", "data-pending":
|
|
5638
|
+
/* @__PURE__ */ jsx("div", { className: "sg-success-check", "data-pending": !isDelivered(evmDelivery, evmConfirmed, evmDirect), children: /* @__PURE__ */ jsx(CheckGlyph3, {}) }),
|
|
5038
5639
|
/* @__PURE__ */ jsxs("div", { className: "sg-success-amt sg-mono", children: [
|
|
5039
5640
|
props.amount,
|
|
5040
5641
|
" ",
|
|
5041
5642
|
tickerOn(registryTokens, props.toChainId, props.toAsset)
|
|
5042
5643
|
] }),
|
|
5043
|
-
/* @__PURE__ */ jsxs("div", { className: "sg-success-sub", children: [
|
|
5044
|
-
|
|
5644
|
+
/* @__PURE__ */ jsxs("div", { className: "sg-success-sub", role: "status", "aria-live": "polite", children: [
|
|
5645
|
+
deliveryHeadline(evmDelivery, evmConfirmed, evmDirect),
|
|
5045
5646
|
" \xB7 ",
|
|
5046
5647
|
shortAddress(props.recipient)
|
|
5047
|
-
] })
|
|
5648
|
+
] }),
|
|
5649
|
+
evmDirect ? null : /* @__PURE__ */ jsx(DeliverySteps, { delivery: evmDelivery })
|
|
5048
5650
|
] }),
|
|
5049
5651
|
lastTxOwned ? /* @__PURE__ */ jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => setHist({ entry: flow.lastTxEntry }), children: "View transaction" }) }) : null
|
|
5050
5652
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -5196,28 +5798,32 @@ function StableGenieSwap(props) {
|
|
|
5196
5798
|
};
|
|
5197
5799
|
}, [engine, props.variant, hist]);
|
|
5198
5800
|
const lastTxOwned = Boolean(flow.lastTxEntry?.hash && wallet.account && flow.lastTxEntry.account === wallet.account.toLowerCase());
|
|
5801
|
+
const evmDirect = flow.lastTxEntry?.settlement === "direct";
|
|
5802
|
+
const evmConfirmed = flow.verdict?.status === "confirmed";
|
|
5803
|
+
const evmDelivery = useDelivery(engine, (flow.status === "success" || flow.status === "pending") && !evmDirect ? flow.txHash : null);
|
|
5199
5804
|
if (props.variant === "pill") return /* @__PURE__ */ jsx(PaymentIsland, { kind: "swap", ...props });
|
|
5200
5805
|
const walletSlot = wallet.account ? /* @__PURE__ */ jsxs("div", { className: "sg-head-tools", children: [
|
|
5201
5806
|
/* @__PURE__ */ jsx(HistoryButton, { btnRef: histBtnRef, disabled: submitting, onClick: () => setHist({}) }),
|
|
5202
5807
|
/* @__PURE__ */ jsx("div", { className: "sg-brand", children: "ZeroDelta" })
|
|
5203
5808
|
] }) : void 0;
|
|
5204
5809
|
if (hist && wallet.account) {
|
|
5205
|
-
return /* @__PURE__ */ jsx(WidgetShell, { title: config.title || "Swap", theme: config.theme, walletSlot, children: /* @__PURE__ */ jsx(TxHistoryPanel, { account: wallet.account, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory }) });
|
|
5810
|
+
return /* @__PURE__ */ jsx(WidgetShell, { title: config.title || "Swap", theme: config.theme, walletSlot, children: /* @__PURE__ */ jsx(TxHistoryPanel, { account: wallet.account, engine, tokens: registryTokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory }) });
|
|
5206
5811
|
}
|
|
5207
5812
|
if (recipientState.open) return /* @__PURE__ */ jsx(WidgetShell, { title: config.title || "Swap", theme: config.theme, walletSlot, children: /* @__PURE__ */ jsx(RecipientSheet, { state: recipientState, symbol: toAsset }) });
|
|
5208
5813
|
if (flow.status === "success" || flow.status === "pending") {
|
|
5209
5814
|
return /* @__PURE__ */ jsxs(WidgetShell, { title: config.title || "Swap", theme: config.theme, walletSlot, children: [
|
|
5210
5815
|
/* @__PURE__ */ jsxs("div", { className: "sg-success", children: [
|
|
5211
|
-
/* @__PURE__ */ jsx("div", { className: "sg-success-check", "data-pending":
|
|
5816
|
+
/* @__PURE__ */ jsx("div", { className: "sg-success-check", "data-pending": !isDelivered(evmDelivery, evmConfirmed, evmDirect), children: /* @__PURE__ */ jsx(CheckGlyph4, {}) }),
|
|
5212
5817
|
/* @__PURE__ */ jsxs("div", { className: "sg-success-amt sg-mono", children: [
|
|
5213
5818
|
receive,
|
|
5214
5819
|
" ",
|
|
5215
5820
|
tickerOn(registryTokens, toChainId, toAsset)
|
|
5216
5821
|
] }),
|
|
5217
|
-
/* @__PURE__ */ jsxs("div", { className: "sg-success-sub", children: [
|
|
5218
|
-
|
|
5822
|
+
/* @__PURE__ */ jsxs("div", { className: "sg-success-sub", role: "status", "aria-live": "polite", children: [
|
|
5823
|
+
deliveryHeadline(evmDelivery, evmConfirmed, evmDirect),
|
|
5219
5824
|
recipientState.recipientFamily === "solana" ? ` \xB7 ${shortAddress(flow.lastTxEntry?.recipient || recipient)}` : props.recipient ? ` \xB7 ${shortAddress(props.recipient)}` : ""
|
|
5220
|
-
] })
|
|
5825
|
+
] }),
|
|
5826
|
+
evmDirect ? null : /* @__PURE__ */ jsx(DeliverySteps, { delivery: evmDelivery })
|
|
5221
5827
|
] }),
|
|
5222
5828
|
lastTxOwned ? /* @__PURE__ */ jsx("div", { className: "sg-cta-wrap", children: /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => setHist({ entry: flow.lastTxEntry }), children: "View transaction" }) }) : null
|
|
5223
5829
|
] });
|
|
@@ -5558,6 +6164,11 @@ function ExchangeCard(props) {
|
|
|
5558
6164
|
evm: { account: wallet.account, connect: wallet.connect, connecting: wallet.connecting }
|
|
5559
6165
|
});
|
|
5560
6166
|
const recipient = recipientState.recipient;
|
|
6167
|
+
const [walletsOpen, setWalletsOpen] = useState(false);
|
|
6168
|
+
const [walletDetails, setWalletDetails] = useState(false);
|
|
6169
|
+
const [screens, setScreens] = useState({});
|
|
6170
|
+
const walletChipRef = useRef(null);
|
|
6171
|
+
const [takeoverHeight, setTakeoverHeight] = useState(void 0);
|
|
5561
6172
|
const needsRecipient = recipientState.missing || !!recipientState.error;
|
|
5562
6173
|
const onInputChange = useRef(props.onInputChange);
|
|
5563
6174
|
onInputChange.current = props.onInputChange;
|
|
@@ -5727,7 +6338,36 @@ function ExchangeCard(props) {
|
|
|
5727
6338
|
const connected2 = Boolean(wallet.account);
|
|
5728
6339
|
const addressed = connected2 && !needsRecipient;
|
|
5729
6340
|
const submitting = solActive ? solFlow.status === "preparing" || solFlow.status === "submitting" : flow.status === "submitting";
|
|
6341
|
+
const sheetWallets = [
|
|
6342
|
+
...wallet.account ? [{ family: "evm", address: wallet.account, chainId: wallet.chainId, disconnect: () => void wallet.disconnect() }] : [],
|
|
6343
|
+
...solanaWallet.address ? [{ family: "solana", address: solanaWallet.address, disconnect: () => void solanaWallet.disconnect() }] : []
|
|
6344
|
+
];
|
|
6345
|
+
const walletKey = sheetWallets.map((w) => `${w.family}:${w.address}`).join("|");
|
|
6346
|
+
useEffect(() => {
|
|
6347
|
+
if (!walletsOpen) return;
|
|
6348
|
+
let alive = true;
|
|
6349
|
+
for (const w of sheetWallets) {
|
|
6350
|
+
setScreens((prev) => prev[w.address]?.status === "done" ? prev : { ...prev, [w.address]: { status: "pending" } });
|
|
6351
|
+
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" } })));
|
|
6352
|
+
}
|
|
6353
|
+
return () => {
|
|
6354
|
+
alive = false;
|
|
6355
|
+
};
|
|
6356
|
+
}, [walletsOpen, walletKey, engine]);
|
|
6357
|
+
useEffect(() => {
|
|
6358
|
+
if (!submitting) return;
|
|
6359
|
+
setWalletsOpen(false);
|
|
6360
|
+
setWalletDetails(false);
|
|
6361
|
+
if (recipientState.open) recipientState.close();
|
|
6362
|
+
}, [submitting]);
|
|
6363
|
+
useEffect(() => {
|
|
6364
|
+
if (!sheetWallets.length) setWalletsOpen(false);
|
|
6365
|
+
}, [sheetWallets.length]);
|
|
5730
6366
|
const lastTxOwned = Boolean(flow.lastTxEntry?.hash && wallet.account && flow.lastTxEntry.account === wallet.account.toLowerCase());
|
|
6367
|
+
const evmDirect = flow.lastTxEntry?.settlement === "direct";
|
|
6368
|
+
const evmConfirmed = flow.verdict?.status === "confirmed";
|
|
6369
|
+
const evmDelivery = useDelivery(engine, (flow.status === "success" || flow.status === "pending") && !evmDirect ? flow.txHash : null);
|
|
6370
|
+
const solDelivery = useDelivery(engine, solActive && solFlow.status === "sent" ? solFlow.signature : null);
|
|
5731
6371
|
const quoting = solActive ? solFlow.status === "quoting" : addressed ? flow.status === "loading" : preview.status === "loading";
|
|
5732
6372
|
const quoteError = !quotable ? null : solActive ? solFlow.status === "error" || solFlow.status === "failed" ? solFlow.error : null : addressed ? flow.status === "error" ? flow.error : null : preview.status === "error" ? preview.error ?? "No route." : null;
|
|
5733
6373
|
const gatewayAmountError = !quoteError || solActive ? null : addressed ? flow.fieldError : preview.fieldError ?? null;
|
|
@@ -5738,6 +6378,10 @@ function ExchangeCard(props) {
|
|
|
5738
6378
|
const receiveSideRef = useRef(null);
|
|
5739
6379
|
const receiveShown = `${receive ?? ""}|${quoting}|${toTicker}`;
|
|
5740
6380
|
useFitText(receiveOutRef, receiveShown);
|
|
6381
|
+
useLayoutEffect(() => {
|
|
6382
|
+
const h = receiveOutRef.current?.closest(".sg-widget")?.getBoundingClientRect().height;
|
|
6383
|
+
if (h && Math.round(h) !== takeoverHeight) setTakeoverHeight(Math.round(h));
|
|
6384
|
+
});
|
|
5741
6385
|
useFitText(receiveSideRef, receiveShown);
|
|
5742
6386
|
const toDecimals = useMemo(() => {
|
|
5743
6387
|
try {
|
|
@@ -5772,8 +6416,8 @@ function ExchangeCard(props) {
|
|
|
5772
6416
|
const rateRows = hasQuote ? [{ label: "Network fee", value: networkFee }, ...eta ? [{ label: "Estimated time", value: eta }] : []] : [];
|
|
5773
6417
|
const via = selected ? selected.legs.length > 1 ? selected.legs[0]?.toTicker || selected.legs[0]?.toAsset || "" : null : preview.data?.via ?? null;
|
|
5774
6418
|
const routeShape = via === null ? "Direct" : via ? `Via ${via}` : "Two steps";
|
|
5775
|
-
const compliance = selected?.quote.compliance;
|
|
5776
|
-
const complianceHasQuote = Boolean(selected && flow.status !== "loading");
|
|
6419
|
+
const compliance = solActive ? solanaQuoteCompliance(solFlow.plan?.preview.quote) : selected?.quote.compliance;
|
|
6420
|
+
const complianceHasQuote = solActive ? Boolean(solFlow.plan && solFlow.status !== "quoting") : Boolean(selected && flow.status !== "loading");
|
|
5777
6421
|
const fromUsd = usdOf2(normalizedAmount, prices[from?.symbol ?? ""]);
|
|
5778
6422
|
const toUsd = usdOf2(receive, prices[to?.symbol ?? ""]);
|
|
5779
6423
|
const flippable = !rampMode && !submitting && Boolean(to && sourceTokens.some((t) => Number(t.chainId) === to.chainId && symbolKey(t.symbol) === to.symbol));
|
|
@@ -5784,12 +6428,26 @@ function ExchangeCard(props) {
|
|
|
5784
6428
|
};
|
|
5785
6429
|
const walletSlot = /* @__PURE__ */ jsxs("div", { className: "sg-head-tools", children: [
|
|
5786
6430
|
connected2 ? /* @__PURE__ */ jsx(HistoryButton, { btnRef: histBtnRef, disabled: submitting, onClick: () => setHist({}) }) : null,
|
|
5787
|
-
/* @__PURE__ */ jsx(
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
6431
|
+
/* @__PURE__ */ jsx(
|
|
6432
|
+
WalletChip,
|
|
6433
|
+
{
|
|
6434
|
+
addresses: sheetWallets.map((w) => w.address),
|
|
6435
|
+
connecting: wallet.connecting,
|
|
6436
|
+
onConnect: wallet.connect,
|
|
6437
|
+
btnRef: walletChipRef,
|
|
6438
|
+
disabled: submitting,
|
|
6439
|
+
onOpen: () => {
|
|
6440
|
+
setSheet(null);
|
|
6441
|
+
setWalletsOpen(true);
|
|
6442
|
+
}
|
|
6443
|
+
}
|
|
6444
|
+
)
|
|
5792
6445
|
] });
|
|
6446
|
+
const closeWallets = () => {
|
|
6447
|
+
setWalletsOpen(false);
|
|
6448
|
+
setWalletDetails(false);
|
|
6449
|
+
requestAnimationFrame(() => walletChipRef.current?.focus());
|
|
6450
|
+
};
|
|
5793
6451
|
const closeSelector = (isFrom) => {
|
|
5794
6452
|
setView("main");
|
|
5795
6453
|
requestAnimationFrame(() => (isFrom ? fromTileRef : toTileRef).current?.focus());
|
|
@@ -5832,7 +6490,19 @@ function ExchangeCard(props) {
|
|
|
5832
6490
|
}
|
|
5833
6491
|
);
|
|
5834
6492
|
const rateBox = (open) => /* @__PURE__ */ jsx(RateBox, { rate, fromSymbol: from?.symbol ?? "", fromLogoUrl: fromToken?.logoUrl, toTicker, rows: rateRows, defaultOpen: open, paused: quotePaused });
|
|
5835
|
-
const
|
|
6493
|
+
const walletScreens = sheetWallets.map((w) => screens[w.address]).flatMap((s) => s?.status === "done" ? [s.screen] : []);
|
|
6494
|
+
const sheetBody = walletsOpen && walletDetails ? /* @__PURE__ */ jsx(ComplianceSheet, { compliance: directComplianceFromScreens(walletScreens), direct: true, hasQuote: true, onClose: () => setWalletDetails(false) }) : walletsOpen ? /* @__PURE__ */ jsx(
|
|
6495
|
+
WalletsSheet,
|
|
6496
|
+
{
|
|
6497
|
+
wallets: sheetWallets,
|
|
6498
|
+
screens,
|
|
6499
|
+
wide,
|
|
6500
|
+
onClose: closeWallets,
|
|
6501
|
+
onDetails: walletScreens.length ? () => setWalletDetails(true) : void 0,
|
|
6502
|
+
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,
|
|
6503
|
+
error: solanaWallet.error || wallet.error
|
|
6504
|
+
}
|
|
6505
|
+
) : recipientState.open ? /* @__PURE__ */ jsx(RecipientSheet, { state: recipientState, wide }) : sheet === "compliance" ? /* @__PURE__ */ jsx(ComplianceSheet, { compliance, direct: selected?.state === "DIRECT", hasQuote: complianceHasQuote, onClose: closeSheet }) : sheet === "quote" && hasQuote ? /* @__PURE__ */ jsx(
|
|
5836
6506
|
QuoteSheet,
|
|
5837
6507
|
{
|
|
5838
6508
|
onClose: closeSheet,
|
|
@@ -5873,10 +6543,18 @@ function ExchangeCard(props) {
|
|
|
5873
6543
|
children: solFlow.status === "preparing" ? "Preparing order\u2026" : solFlow.status === "submitting" ? "Submitting\u2026" : solFlow.insufficient ? "Insufficient balance" : solFlow.solShort ? "Not enough SOL for network fees" : solFlow.status === "failed" ? "Try again" : !solFlow.plan ? "Exchange" : solFlow.needsPreparation ? "Continue in wallet" : "Submit"
|
|
5874
6544
|
}
|
|
5875
6545
|
);
|
|
5876
|
-
const solanaSteps = solActive && solFlow.plan && connected2 && solanaWallet.address ? /* @__PURE__ */
|
|
6546
|
+
const solanaSteps = solActive && solFlow.plan && connected2 && solanaWallet.address && solFlow.solShort && solFlow.cost ? /* @__PURE__ */ jsxs("p", { className: "sg-cp-summary-sub", style: { textAlign: "center", margin: "0 0 8px" }, "data-testid": "sol-shortfall", children: [
|
|
6547
|
+
"This order needs about ",
|
|
6548
|
+
(solFlow.cost.lamports / 1e9).toFixed(4),
|
|
6549
|
+
" SOL for network fees and rent; the wallet holds",
|
|
6550
|
+
" ",
|
|
6551
|
+
(solFlow.cost.balanceLamports / 1e9).toFixed(4),
|
|
6552
|
+
" SOL."
|
|
6553
|
+
] }) : null;
|
|
5877
6554
|
let body;
|
|
6555
|
+
let takeover = false;
|
|
5878
6556
|
if (hist && connected2) {
|
|
5879
|
-
body = /* @__PURE__ */ jsx(TxHistoryPanel, { account: wallet.account, tokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
|
|
6557
|
+
body = /* @__PURE__ */ jsx(TxHistoryPanel, { account: wallet.account, engine, solanaAccount: solanaWallet.address, tokens, vaultIcons: catalogue?.vaultIcons, initialEntry: hist.entry ?? null, onBack: closeHistory });
|
|
5880
6558
|
} else if (view === "from" || view === "to") {
|
|
5881
6559
|
const isFrom = view === "from";
|
|
5882
6560
|
body = /* @__PURE__ */ jsx(
|
|
@@ -5899,20 +6577,22 @@ function ExchangeCard(props) {
|
|
|
5899
6577
|
}
|
|
5900
6578
|
);
|
|
5901
6579
|
} else if (sheetBody && !wide) {
|
|
6580
|
+
takeover = walletsOpen && !walletDetails || recipientState.open;
|
|
5902
6581
|
body = sheetBody;
|
|
5903
6582
|
} else if (solActive && solFlow.status === "sent") {
|
|
5904
6583
|
body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5905
6584
|
/* @__PURE__ */ jsxs("div", { className: "sg-success", children: [
|
|
5906
|
-
/* @__PURE__ */ jsx("div", { className: "sg-success-check", "data-pending":
|
|
6585
|
+
/* @__PURE__ */ jsx("div", { className: "sg-success-check", "data-pending": !isDelivered(solDelivery, false), children: /* @__PURE__ */ jsx(CheckGlyph5, {}) }),
|
|
5907
6586
|
/* @__PURE__ */ jsxs("div", { className: "sg-success-amt sg-mono", children: [
|
|
5908
6587
|
solFlow.sent?.receive ?? receive,
|
|
5909
6588
|
" ",
|
|
5910
6589
|
solFlow.sent?.toTicker ?? toTicker
|
|
5911
6590
|
] }),
|
|
5912
|
-
/* @__PURE__ */ jsxs("div", { className: "sg-success-sub", children: [
|
|
5913
|
-
"Submitted on Solana \u2014
|
|
6591
|
+
/* @__PURE__ */ jsxs("div", { className: "sg-success-sub", role: "status", "aria-live": "polite", children: [
|
|
6592
|
+
solDelivery.phase === "tracking" ? "Submitted on Solana \u2014 tracking delivery" : deliveryHeadline(solDelivery, true),
|
|
5914
6593
|
solFlow.sent?.recipient ? ` \xB7 ${shortAddress(solFlow.sent.recipient)}` : ""
|
|
5915
|
-
] })
|
|
6594
|
+
] }),
|
|
6595
|
+
/* @__PURE__ */ jsx(DeliverySteps, { delivery: solDelivery })
|
|
5916
6596
|
] }),
|
|
5917
6597
|
/* @__PURE__ */ jsxs("div", { className: "sg-cta-wrap", children: [
|
|
5918
6598
|
solFlow.signature ? /* @__PURE__ */ jsx("a", { className: "sg-btn sg-btn-ghost", href: `https://solscan.io/tx/${solFlow.signature}`, target: "_blank", rel: "noopener noreferrer", children: "View on Solscan" }) : null,
|
|
@@ -5923,16 +6603,17 @@ function ExchangeCard(props) {
|
|
|
5923
6603
|
} else if (flow.status === "success" || flow.status === "pending") {
|
|
5924
6604
|
body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5925
6605
|
/* @__PURE__ */ jsxs("div", { className: "sg-success", children: [
|
|
5926
|
-
/* @__PURE__ */ jsx("div", { className: "sg-success-check", "data-pending":
|
|
6606
|
+
/* @__PURE__ */ jsx("div", { className: "sg-success-check", "data-pending": !isDelivered(evmDelivery, evmConfirmed, evmDirect), children: /* @__PURE__ */ jsx(CheckGlyph5, {}) }),
|
|
5927
6607
|
/* @__PURE__ */ jsxs("div", { className: "sg-success-amt sg-mono", children: [
|
|
5928
6608
|
receive,
|
|
5929
6609
|
" ",
|
|
5930
6610
|
toTicker
|
|
5931
6611
|
] }),
|
|
5932
|
-
/* @__PURE__ */ jsxs("div", { className: "sg-success-sub", children: [
|
|
5933
|
-
|
|
6612
|
+
/* @__PURE__ */ jsxs("div", { className: "sg-success-sub", role: "status", "aria-live": "polite", children: [
|
|
6613
|
+
deliveryHeadline(evmDelivery, evmConfirmed, evmDirect),
|
|
5934
6614
|
recipientState.recipientFamily === "solana" ? ` \xB7 ${shortAddress(flow.lastTxEntry?.recipient || recipient)}` : props.recipient ? ` \xB7 ${shortAddress(props.recipient)}` : ""
|
|
5935
|
-
] })
|
|
6615
|
+
] }),
|
|
6616
|
+
evmDirect ? null : /* @__PURE__ */ jsx(DeliverySteps, { delivery: evmDelivery })
|
|
5936
6617
|
] }),
|
|
5937
6618
|
/* @__PURE__ */ jsxs("div", { className: "sg-cta-wrap", children: [
|
|
5938
6619
|
lastTxOwned ? /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => setHist({ entry: flow.lastTxEntry }), children: "View transaction" }) : null,
|
|
@@ -5945,7 +6626,6 @@ function ExchangeCard(props) {
|
|
|
5945
6626
|
const cta = solActive ? /* @__PURE__ */ jsxs("div", { className: "sg-cta-wrap", children: [
|
|
5946
6627
|
solanaSteps,
|
|
5947
6628
|
solanaCta,
|
|
5948
|
-
/* @__PURE__ */ jsx(RecipientNote, { state: recipientState, disabled: submitting }),
|
|
5949
6629
|
solanaWallet.error ? /* @__PURE__ */ jsx(StatusPanel, { tone: "error", children: solanaWallet.error }) : null,
|
|
5950
6630
|
wallet.error ? /* @__PURE__ */ jsx(StatusPanel, { tone: "error", children: wallet.error }) : null
|
|
5951
6631
|
] }) : /* @__PURE__ */ jsxs("div", { className: "sg-cta-wrap", children: [
|
|
@@ -5954,7 +6634,6 @@ function ExchangeCard(props) {
|
|
|
5954
6634
|
recipientState.recipientFamily === "solana" ? "Solana" : "EVM",
|
|
5955
6635
|
" wallet"
|
|
5956
6636
|
] }) : /* @__PURE__ */ 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 }),
|
|
5957
|
-
!rampMode ? /* @__PURE__ */ jsx(RecipientNote, { state: recipientState, disabled: submitting }) : null,
|
|
5958
6637
|
wallet.error ? /* @__PURE__ */ jsx(StatusPanel, { tone: "error", children: wallet.error }) : null
|
|
5959
6638
|
] });
|
|
5960
6639
|
const notices = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -6004,6 +6683,7 @@ function ExchangeCard(props) {
|
|
|
6004
6683
|
] }),
|
|
6005
6684
|
/* @__PURE__ */ jsx(PaneFoot, { usd: hasQuote ? toUsd : null })
|
|
6006
6685
|
] }),
|
|
6686
|
+
!rampMode && (connected2 || recipientState.managed) ? /* @__PURE__ */ jsx(RecipientRow, { state: recipientState, disabled: submitting }) : null,
|
|
6007
6687
|
rampMode ? null : props.inDialog === "drawer" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6008
6688
|
complianceButton(true),
|
|
6009
6689
|
quoteButton(true),
|
|
@@ -6021,7 +6701,7 @@ function ExchangeCard(props) {
|
|
|
6021
6701
|
cta
|
|
6022
6702
|
] });
|
|
6023
6703
|
}
|
|
6024
|
-
const card = /* @__PURE__ */ jsx(WidgetShell, { title, theme: config.theme, heightPx: props.heightPx, walletSlot, onClose: props.onClose, wide, children: body });
|
|
6704
|
+
const card = /* @__PURE__ */ jsx(WidgetShell, { title, theme: config.theme, heightPx: props.heightPx, walletSlot, onClose: props.onClose, wide, takeover, minHeightPx: takeover ? takeoverHeight : void 0, children: body });
|
|
6025
6705
|
if (!wide) return card;
|
|
6026
6706
|
const resolved = resolveTheme(config.theme);
|
|
6027
6707
|
const vars = themeToVars(resolved);
|
|
@@ -6068,6 +6748,7 @@ function ExchangeCard(props) {
|
|
|
6068
6748
|
] })
|
|
6069
6749
|
] }),
|
|
6070
6750
|
/* @__PURE__ */ jsxs("div", { className: "sg-stack", children: [
|
|
6751
|
+
connected2 || recipientState.managed ? /* @__PURE__ */ jsx(RecipientRow, { state: recipientState, disabled: submitting, wide: true }) : null,
|
|
6071
6752
|
rateBox(true),
|
|
6072
6753
|
complianceButton(true),
|
|
6073
6754
|
quoteButton(true)
|