@rhinestone/deposit-modal 0.3.0-alpha.12 → 0.3.0-alpha.14
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/README.md +59 -0
- package/dist/{DepositModalReown-EC4DJ3EC.cjs → DepositModalReown-4I47KSPN.cjs} +6 -6
- package/dist/{DepositModalReown-QOTUF4JC.mjs → DepositModalReown-DIUIB3MU.mjs} +3 -3
- package/dist/{QRCode-KG47KTGX.cjs → QRCode-5DXFNKI2.cjs} +1 -1
- package/dist/{QRCode-YJ3EGWQS.mjs → QRCode-WUC652SH.mjs} +1 -1
- package/dist/{WithdrawModalReown-QEQPCSWT.mjs → WithdrawModalReown-WRUEALDP.mjs} +3 -3
- package/dist/{WithdrawModalReown-Z5JVENP6.cjs → WithdrawModalReown-Y3NRAKXJ.cjs} +6 -6
- package/dist/{chunk-YI63OMXN.cjs → chunk-2NUXDEEO.cjs} +57 -57
- package/dist/{chunk-I5G5ULRP.cjs → chunk-3CYGTYMY.cjs} +1322 -320
- package/dist/{chunk-WVE3JN3C.mjs → chunk-4ZN726P5.mjs} +345 -54
- package/dist/{chunk-QXIJLRKC.mjs → chunk-JTMGFWXO.mjs} +1 -1
- package/dist/{chunk-FGVSNARE.cjs → chunk-JTULAFMU.cjs} +2 -2
- package/dist/{chunk-2TWQGPPB.cjs → chunk-N4XRQPVA.cjs} +374 -83
- package/dist/{chunk-7MZNQ4C2.mjs → chunk-VD4WTEHP.mjs} +2 -2
- package/dist/{chunk-HR6BABPX.mjs → chunk-XG474KUR.mjs} +1433 -431
- package/dist/deposit.cjs +3 -3
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +3 -3
- package/dist/styles.css +525 -66
- package/dist/{types-D6wrO4Ow.d.cts → types-C8i2ebY1.d.cts} +25 -0
- package/dist/{types-D6wrO4Ow.d.ts → types-C8i2ebY1.d.ts} +25 -0
- package/dist/withdraw.cjs +3 -3
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +2 -2
- package/dist/withdraw.mjs +2 -2
- package/package.json +3 -3
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AlertTriangleIcon,
|
|
3
3
|
ArrowUpRightIcon,
|
|
4
|
+
BankIcon,
|
|
4
5
|
BodyHeader,
|
|
5
6
|
Button,
|
|
6
7
|
Callout,
|
|
@@ -12,6 +13,7 @@ import {
|
|
|
12
13
|
ConnectStep,
|
|
13
14
|
CopyIcon,
|
|
14
15
|
ExternalLinkIcon,
|
|
16
|
+
HandCoinsIcon,
|
|
15
17
|
HistoryIcon,
|
|
16
18
|
InfoIcon,
|
|
17
19
|
Modal,
|
|
@@ -32,11 +34,14 @@ import {
|
|
|
32
34
|
currencyFormatter,
|
|
33
35
|
debugError,
|
|
34
36
|
debugLog,
|
|
37
|
+
failureMessageForEvent,
|
|
35
38
|
formatUserError,
|
|
36
39
|
getAssetId,
|
|
40
|
+
getEventSourceDetails,
|
|
37
41
|
getEventTxHash,
|
|
38
42
|
getPublicClient,
|
|
39
43
|
isDepositEvent,
|
|
44
|
+
isFailedEvent,
|
|
40
45
|
isNativeAsset,
|
|
41
46
|
isSolanaCaip2,
|
|
42
47
|
loadSessionOwnerFromStorage,
|
|
@@ -47,7 +52,7 @@ import {
|
|
|
47
52
|
tokenFormatter,
|
|
48
53
|
txRefsMatch,
|
|
49
54
|
useLatestRef
|
|
50
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-4ZN726P5.mjs";
|
|
51
56
|
import {
|
|
52
57
|
DEFAULT_BACKEND_URL,
|
|
53
58
|
DEFAULT_SIGNER_ADDRESS,
|
|
@@ -73,17 +78,24 @@ import {
|
|
|
73
78
|
|
|
74
79
|
// src/DepositModal.tsx
|
|
75
80
|
import {
|
|
76
|
-
useMemo as
|
|
77
|
-
useEffect as
|
|
78
|
-
useRef as
|
|
79
|
-
useState as
|
|
80
|
-
useCallback as
|
|
81
|
+
useMemo as useMemo9,
|
|
82
|
+
useEffect as useEffect11,
|
|
83
|
+
useRef as useRef9,
|
|
84
|
+
useState as useState13,
|
|
85
|
+
useCallback as useCallback9,
|
|
81
86
|
lazy as lazy2,
|
|
82
87
|
Suspense as Suspense2
|
|
83
88
|
} from "react";
|
|
84
89
|
|
|
85
90
|
// src/DepositFlow.tsx
|
|
86
|
-
import {
|
|
91
|
+
import {
|
|
92
|
+
useState as useState11,
|
|
93
|
+
useCallback as useCallback7,
|
|
94
|
+
useMemo as useMemo7,
|
|
95
|
+
useEffect as useEffect10,
|
|
96
|
+
useLayoutEffect as useLayoutEffect2,
|
|
97
|
+
useRef as useRef8
|
|
98
|
+
} from "react";
|
|
87
99
|
import { formatUnits as formatUnits7 } from "viem";
|
|
88
100
|
|
|
89
101
|
// src/components/steps/AssetSelectStep.tsx
|
|
@@ -1228,7 +1240,38 @@ function DepositNotification({
|
|
|
1228
1240
|
const destExplorerUrl = destinationTxHash ? getExplorerTxUrl(targetChain, destinationTxHash) : null;
|
|
1229
1241
|
const title = status === "complete" ? "Deposit completed" : status === "failed" ? "Deposit failed" : "Deposit received and processing\u2026";
|
|
1230
1242
|
const subtitle = status === "complete" ? "Your deposit has been credited to your account." : status === "failed" ? "Your deposit could not be processed." : "Your deposit will be credited to your account shortly.";
|
|
1231
|
-
const statusIcon = status === "complete" ? /* @__PURE__ */ jsx5("div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--complete", children: /* @__PURE__ */ jsx5(CheckIcon, {}) }) : status === "failed" ? /* @__PURE__ */ jsx5("div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--failed", children: /* @__PURE__ */ jsx5(CloseIcon, {}) }) : /* @__PURE__ */ jsx5("div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--processing", children: /* @__PURE__ */
|
|
1243
|
+
const statusIcon = status === "complete" ? /* @__PURE__ */ jsx5("div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--complete", children: /* @__PURE__ */ jsx5(CheckIcon, {}) }) : status === "failed" ? /* @__PURE__ */ jsx5("div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--failed", children: /* @__PURE__ */ jsx5(CloseIcon, {}) }) : /* @__PURE__ */ jsx5("div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--processing", children: /* @__PURE__ */ jsxs5(
|
|
1244
|
+
"svg",
|
|
1245
|
+
{
|
|
1246
|
+
className: "rs-deposit-notification-spinner",
|
|
1247
|
+
viewBox: "0 0 44 44",
|
|
1248
|
+
fill: "none",
|
|
1249
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1250
|
+
"aria-hidden": "true",
|
|
1251
|
+
children: [
|
|
1252
|
+
/* @__PURE__ */ jsx5(
|
|
1253
|
+
"path",
|
|
1254
|
+
{
|
|
1255
|
+
className: "rs-deposit-notification-spinner-track",
|
|
1256
|
+
d: "M21.5882 42.1765C32.9588 42.1765 42.1765 32.9588 42.1765 21.5882C42.1765 10.2177 32.9588 1 21.5882 1C10.2177 1 1 10.2177 1 21.5882C1 32.9588 10.2177 42.1765 21.5882 42.1765Z",
|
|
1257
|
+
stroke: "#D4D4D8",
|
|
1258
|
+
strokeWidth: "2",
|
|
1259
|
+
strokeLinecap: "round"
|
|
1260
|
+
}
|
|
1261
|
+
),
|
|
1262
|
+
/* @__PURE__ */ jsx5(
|
|
1263
|
+
"path",
|
|
1264
|
+
{
|
|
1265
|
+
className: "rs-deposit-notification-spinner-head",
|
|
1266
|
+
d: "M28.0422 2.03186C31.4239 3.1515 34.458 5.1279 36.8489 7.76854C39.2398 10.4092 40.906 13.624 41.6852 17.1",
|
|
1267
|
+
stroke: "#52525C",
|
|
1268
|
+
strokeWidth: "2",
|
|
1269
|
+
strokeLinecap: "round"
|
|
1270
|
+
}
|
|
1271
|
+
)
|
|
1272
|
+
]
|
|
1273
|
+
}
|
|
1274
|
+
) });
|
|
1232
1275
|
const showClose = status !== "processing";
|
|
1233
1276
|
return /* @__PURE__ */ jsxs5(
|
|
1234
1277
|
"div",
|
|
@@ -1317,7 +1360,7 @@ function DepositNotification({
|
|
|
1317
1360
|
// src/components/steps/DepositAddressStep.tsx
|
|
1318
1361
|
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1319
1362
|
var QRCode = lazy(
|
|
1320
|
-
() => import("./QRCode-
|
|
1363
|
+
() => import("./QRCode-WUC652SH.mjs").then((m) => ({ default: m.QRCode }))
|
|
1321
1364
|
);
|
|
1322
1365
|
var POLL_INTERVAL_MS = 4e3;
|
|
1323
1366
|
function isRecord(value) {
|
|
@@ -1406,7 +1449,6 @@ function pickFallbackToken(tokens, current) {
|
|
|
1406
1449
|
function DepositAddressStep({
|
|
1407
1450
|
smartAccount,
|
|
1408
1451
|
solanaDepositAddress,
|
|
1409
|
-
isUpdating = false,
|
|
1410
1452
|
service,
|
|
1411
1453
|
allowedRoutes,
|
|
1412
1454
|
targetChain,
|
|
@@ -1532,7 +1574,6 @@ function DepositAddressStep({
|
|
|
1532
1574
|
};
|
|
1533
1575
|
}, [chainDropdownOpen, tokenDropdownOpen]);
|
|
1534
1576
|
const handleCopy = useCallback2(async () => {
|
|
1535
|
-
if (isUpdating) return;
|
|
1536
1577
|
onCopyAddress?.();
|
|
1537
1578
|
try {
|
|
1538
1579
|
await navigator.clipboard.writeText(displayAddress);
|
|
@@ -1550,7 +1591,7 @@ function DepositAddressStep({
|
|
|
1550
1591
|
setCopied(true);
|
|
1551
1592
|
setTimeout(() => setCopied(false), 2e3);
|
|
1552
1593
|
}
|
|
1553
|
-
}, [displayAddress, onCopyAddress
|
|
1594
|
+
}, [displayAddress, onCopyAddress]);
|
|
1554
1595
|
const handleSelectChain = useCallback2(
|
|
1555
1596
|
(nextChain) => {
|
|
1556
1597
|
const nextTokens = computeTokensForChain(nextChain, allowedTokenSet);
|
|
@@ -1806,38 +1847,17 @@ function DepositAddressStep({
|
|
|
1806
1847
|
{
|
|
1807
1848
|
style: { display: "flex", flexDirection: "column", gap: 4, width: "100%" },
|
|
1808
1849
|
children: [
|
|
1850
|
+
/* @__PURE__ */ jsxs6("div", { className: "rs-deposit-address-well", children: [
|
|
1851
|
+
/* @__PURE__ */ jsx6("div", { className: "rs-deposit-address-qr", children: /* @__PURE__ */ jsx6(
|
|
1852
|
+
Suspense,
|
|
1853
|
+
{
|
|
1854
|
+
fallback: /* @__PURE__ */ jsx6("div", { className: "rs-skeleton rs-skeleton-qr", "aria-hidden": "true" }),
|
|
1855
|
+
children: /* @__PURE__ */ jsx6(QRCode, { value: displayAddress, size: 190, iconSrc: qrIconSrc })
|
|
1856
|
+
}
|
|
1857
|
+
) }),
|
|
1858
|
+
/* @__PURE__ */ jsx6("div", { className: "rs-deposit-address-value", children: displayAddress })
|
|
1859
|
+
] }),
|
|
1809
1860
|
/* @__PURE__ */ jsxs6(
|
|
1810
|
-
"div",
|
|
1811
|
-
{
|
|
1812
|
-
className: `rs-deposit-address-well ${isUpdating ? "rs-deposit-address-well--updating" : ""}`,
|
|
1813
|
-
children: [
|
|
1814
|
-
/* @__PURE__ */ jsx6("div", { className: "rs-deposit-address-qr", children: /* @__PURE__ */ jsx6(
|
|
1815
|
-
Suspense,
|
|
1816
|
-
{
|
|
1817
|
-
fallback: /* @__PURE__ */ jsx6(
|
|
1818
|
-
"div",
|
|
1819
|
-
{
|
|
1820
|
-
style: {
|
|
1821
|
-
width: 200,
|
|
1822
|
-
height: 200,
|
|
1823
|
-
display: "flex",
|
|
1824
|
-
alignItems: "center",
|
|
1825
|
-
justifyContent: "center"
|
|
1826
|
-
},
|
|
1827
|
-
children: /* @__PURE__ */ jsx6(Spinner, {})
|
|
1828
|
-
}
|
|
1829
|
-
),
|
|
1830
|
-
children: /* @__PURE__ */ jsx6(QRCode, { value: displayAddress, size: 200, iconSrc: qrIconSrc })
|
|
1831
|
-
}
|
|
1832
|
-
) }),
|
|
1833
|
-
/* @__PURE__ */ jsx6("div", { className: "rs-deposit-address-value", children: displayAddress })
|
|
1834
|
-
]
|
|
1835
|
-
}
|
|
1836
|
-
),
|
|
1837
|
-
isUpdating ? /* @__PURE__ */ jsxs6("output", { className: "rs-deposit-address-updating", children: [
|
|
1838
|
-
/* @__PURE__ */ jsx6(Spinner, { className: "rs-spinner--sm" }),
|
|
1839
|
-
"Updating deposit details\u2026"
|
|
1840
|
-
] }) : /* @__PURE__ */ jsxs6(
|
|
1841
1861
|
"button",
|
|
1842
1862
|
{
|
|
1843
1863
|
type: "button",
|
|
@@ -1948,8 +1968,672 @@ function DepositAddressStep({
|
|
|
1948
1968
|
}
|
|
1949
1969
|
DepositAddressStep.displayName = "DepositAddressStep";
|
|
1950
1970
|
|
|
1951
|
-
// src/components/steps/
|
|
1971
|
+
// src/components/steps/FiatOnrampStep.tsx
|
|
1972
|
+
import { useCallback as useCallback3 } from "react";
|
|
1973
|
+
|
|
1974
|
+
// src/components/steps/SwappedIframeStep.tsx
|
|
1975
|
+
import { useState as useState6, useEffect as useEffect6, useRef as useRef6, useMemo as useMemo4 } from "react";
|
|
1976
|
+
|
|
1977
|
+
// src/components/steps/SwappedOrderTracker.tsx
|
|
1952
1978
|
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1979
|
+
var STEP_LABELS = [
|
|
1980
|
+
"Payment received",
|
|
1981
|
+
null,
|
|
1982
|
+
"Processing App deposit",
|
|
1983
|
+
"Deposit successful"
|
|
1984
|
+
];
|
|
1985
|
+
function SwappedOrderTracker({
|
|
1986
|
+
amount,
|
|
1987
|
+
currency = "USDC",
|
|
1988
|
+
chainLabel = "Base",
|
|
1989
|
+
stepStates,
|
|
1990
|
+
terminal = null,
|
|
1991
|
+
onRetry
|
|
1992
|
+
}) {
|
|
1993
|
+
const formattedAmount = formatTrackerAmount(amount);
|
|
1994
|
+
const title = terminal ? terminal.kind === "cancelled" ? "Order cancelled" : "Deposit failed" : formattedAmount ? `Depositing ${formattedAmount} ${currency}` : `Depositing ${currency}`;
|
|
1995
|
+
const labels = [
|
|
1996
|
+
STEP_LABELS[0],
|
|
1997
|
+
`${currency} received on ${chainLabel}`,
|
|
1998
|
+
STEP_LABELS[2],
|
|
1999
|
+
STEP_LABELS[3]
|
|
2000
|
+
];
|
|
2001
|
+
return /* @__PURE__ */ jsxs7("div", { className: "rs-screen rs-swapped-tracker", children: [
|
|
2002
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2003
|
+
/* @__PURE__ */ jsx7(BodyHeader, { icon: /* @__PURE__ */ jsx7(HandCoinsIcon, {}), title }),
|
|
2004
|
+
/* @__PURE__ */ jsx7("ol", { className: "rs-swapped-tracker-steps", children: labels.map((label, idx) => {
|
|
2005
|
+
const status = stepStates[idx];
|
|
2006
|
+
return /* @__PURE__ */ jsxs7(
|
|
2007
|
+
"li",
|
|
2008
|
+
{
|
|
2009
|
+
className: `rs-swapped-tracker-step rs-swapped-tracker-step--${status}`,
|
|
2010
|
+
children: [
|
|
2011
|
+
/* @__PURE__ */ jsx7("span", { className: "rs-swapped-tracker-step-label", children: label }),
|
|
2012
|
+
/* @__PURE__ */ jsx7(
|
|
2013
|
+
"span",
|
|
2014
|
+
{
|
|
2015
|
+
className: "rs-swapped-tracker-step-marker",
|
|
2016
|
+
"aria-hidden": "true",
|
|
2017
|
+
children: status === "complete" ? /* @__PURE__ */ jsx7(CheckIcon, {}) : status === "failed" ? /* @__PURE__ */ jsx7(CloseIcon, {}) : status === "active" ? /* @__PURE__ */ jsx7(Spinner, {}) : null
|
|
2018
|
+
}
|
|
2019
|
+
)
|
|
2020
|
+
]
|
|
2021
|
+
},
|
|
2022
|
+
label
|
|
2023
|
+
);
|
|
2024
|
+
}) }),
|
|
2025
|
+
terminal && /* @__PURE__ */ jsxs7(
|
|
2026
|
+
"div",
|
|
2027
|
+
{
|
|
2028
|
+
className: `rs-swapped-tracker-terminal rs-swapped-tracker-terminal--${terminal.kind}`,
|
|
2029
|
+
children: [
|
|
2030
|
+
/* @__PURE__ */ jsx7("p", { className: "rs-swapped-tracker-terminal-message", children: terminal.message }),
|
|
2031
|
+
terminal.kind === "cancelled" && onRetry && /* @__PURE__ */ jsx7(
|
|
2032
|
+
"button",
|
|
2033
|
+
{
|
|
2034
|
+
type: "button",
|
|
2035
|
+
className: "rs-swapped-tracker-retry",
|
|
2036
|
+
onClick: onRetry,
|
|
2037
|
+
children: "Try again"
|
|
2038
|
+
}
|
|
2039
|
+
)
|
|
2040
|
+
]
|
|
2041
|
+
}
|
|
2042
|
+
)
|
|
2043
|
+
] }),
|
|
2044
|
+
/* @__PURE__ */ jsx7(PoweredBy, {})
|
|
2045
|
+
] });
|
|
2046
|
+
}
|
|
2047
|
+
function formatTrackerAmount(amount) {
|
|
2048
|
+
if (!amount) return null;
|
|
2049
|
+
const num = Number(amount);
|
|
2050
|
+
if (!Number.isFinite(num)) return amount;
|
|
2051
|
+
return num.toFixed(2);
|
|
2052
|
+
}
|
|
2053
|
+
SwappedOrderTracker.displayName = "SwappedOrderTracker";
|
|
2054
|
+
|
|
2055
|
+
// src/components/steps/SwappedIframeStep.tsx
|
|
2056
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2057
|
+
var STATUS_POLL_INTERVAL_MS = 2e3;
|
|
2058
|
+
var DEPOSIT_POLL_INTERVAL_MS = 2e3;
|
|
2059
|
+
var DEPOSIT_POLL_FAST_INITIAL_DELAY_MS = 1e3;
|
|
2060
|
+
var DEPOSIT_POLL_FAST_INTERVAL_MS = 500;
|
|
2061
|
+
var IFRAME_LOAD_TIMEOUT_MS = 15e3;
|
|
2062
|
+
var SWAPPED_IFRAME_ORIGINS = /* @__PURE__ */ new Set([
|
|
2063
|
+
"https://sandbox.swapped.com",
|
|
2064
|
+
"https://widget.swapped.com"
|
|
2065
|
+
]);
|
|
2066
|
+
var SWAPPED_TERMINAL_STATUSES = /* @__PURE__ */ new Set([
|
|
2067
|
+
"order_completed",
|
|
2068
|
+
"order_broadcasted"
|
|
2069
|
+
]);
|
|
2070
|
+
var SWAPPED_STATUS_VALUES = /* @__PURE__ */ new Set([
|
|
2071
|
+
"payment_pending",
|
|
2072
|
+
"order_completed",
|
|
2073
|
+
"order_broadcasted",
|
|
2074
|
+
"order_cancelled"
|
|
2075
|
+
]);
|
|
2076
|
+
function parseSwappedIframeMessage(raw) {
|
|
2077
|
+
let data = raw;
|
|
2078
|
+
if (typeof data === "string") {
|
|
2079
|
+
try {
|
|
2080
|
+
data = JSON.parse(data);
|
|
2081
|
+
} catch {
|
|
2082
|
+
return null;
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
2085
|
+
if (!data || typeof data !== "object") return null;
|
|
2086
|
+
const obj = data;
|
|
2087
|
+
const inner = obj.data && typeof obj.data === "object" ? obj.data : obj;
|
|
2088
|
+
const rawStatus = inner.order_status ?? inner.status ?? obj.status;
|
|
2089
|
+
if (typeof rawStatus !== "string" || !SWAPPED_STATUS_VALUES.has(rawStatus)) {
|
|
2090
|
+
return null;
|
|
2091
|
+
}
|
|
2092
|
+
const asString2 = (v) => typeof v === "string" && v.length > 0 ? v : void 0;
|
|
2093
|
+
return {
|
|
2094
|
+
status: rawStatus,
|
|
2095
|
+
orderId: asString2(inner.order_id) ?? asString2(obj.orderId),
|
|
2096
|
+
orderCrypto: asString2(inner.order_crypto) ?? asString2(obj.orderCrypto),
|
|
2097
|
+
orderCryptoAmount: asString2(inner.order_crypto_amount) ?? asString2(obj.orderCryptoAmount),
|
|
2098
|
+
transactionId: asString2(inner.transaction_id) ?? asString2(obj.transactionId)
|
|
2099
|
+
};
|
|
2100
|
+
}
|
|
2101
|
+
function SwappedIframeStep({
|
|
2102
|
+
smartAccount,
|
|
2103
|
+
service,
|
|
2104
|
+
variant,
|
|
2105
|
+
loadUrl,
|
|
2106
|
+
iframeTitle,
|
|
2107
|
+
loadErrorCode,
|
|
2108
|
+
loadErrorFallback,
|
|
2109
|
+
bannerForStatus,
|
|
2110
|
+
onSwappedComplete,
|
|
2111
|
+
onSwappedFailed,
|
|
2112
|
+
onClose,
|
|
2113
|
+
onError
|
|
2114
|
+
}) {
|
|
2115
|
+
const [widgetUrl, setWidgetUrl] = useState6(null);
|
|
2116
|
+
const [loadError, setLoadError] = useState6(null);
|
|
2117
|
+
const [iframeLoaded, setIframeLoaded] = useState6(false);
|
|
2118
|
+
const [retryToken, setRetryToken] = useState6(0);
|
|
2119
|
+
const [orderState, setOrderState] = useState6(null);
|
|
2120
|
+
const [latestEvent, setLatestEvent] = useState6(null);
|
|
2121
|
+
const [phase, setPhase] = useState6("iframe");
|
|
2122
|
+
const completeFiredRef = useRef6(false);
|
|
2123
|
+
const failedFiredRef = useRef6(false);
|
|
2124
|
+
const expectedOrderUuidRef = useRef6(null);
|
|
2125
|
+
const baselineDepositTxHashRef = useRef6(void 0);
|
|
2126
|
+
const currentDepositTxHashRef = useRef6(null);
|
|
2127
|
+
const fastDepositPollEnabledRef = useRef6(false);
|
|
2128
|
+
const rescheduleDepositPollRef = useRef6(
|
|
2129
|
+
null
|
|
2130
|
+
);
|
|
2131
|
+
const onSwappedCompleteRef = useRef6(onSwappedComplete);
|
|
2132
|
+
onSwappedCompleteRef.current = onSwappedComplete;
|
|
2133
|
+
const onSwappedFailedRef = useRef6(onSwappedFailed);
|
|
2134
|
+
onSwappedFailedRef.current = onSwappedFailed;
|
|
2135
|
+
const onErrorRef = useRef6(onError);
|
|
2136
|
+
onErrorRef.current = onError;
|
|
2137
|
+
const loadUrlRef = useRef6(loadUrl);
|
|
2138
|
+
loadUrlRef.current = loadUrl;
|
|
2139
|
+
useEffect6(() => {
|
|
2140
|
+
let cancelled = false;
|
|
2141
|
+
setLoadError(null);
|
|
2142
|
+
setIframeLoaded(false);
|
|
2143
|
+
setWidgetUrl(null);
|
|
2144
|
+
setOrderState(null);
|
|
2145
|
+
setLatestEvent(null);
|
|
2146
|
+
setPhase("iframe");
|
|
2147
|
+
expectedOrderUuidRef.current = null;
|
|
2148
|
+
completeFiredRef.current = false;
|
|
2149
|
+
failedFiredRef.current = false;
|
|
2150
|
+
baselineDepositTxHashRef.current = void 0;
|
|
2151
|
+
currentDepositTxHashRef.current = null;
|
|
2152
|
+
fastDepositPollEnabledRef.current = false;
|
|
2153
|
+
loadUrlRef.current().then((res) => {
|
|
2154
|
+
if (cancelled) return;
|
|
2155
|
+
setWidgetUrl(res.url);
|
|
2156
|
+
const sep = res.externalCustomerId.indexOf(":");
|
|
2157
|
+
expectedOrderUuidRef.current = sep >= 0 ? res.externalCustomerId.slice(sep + 1) : null;
|
|
2158
|
+
}).catch((err) => {
|
|
2159
|
+
if (cancelled) return;
|
|
2160
|
+
const message = err instanceof Error ? err.message : loadErrorFallback;
|
|
2161
|
+
setLoadError(message);
|
|
2162
|
+
onErrorRef.current?.(message, loadErrorCode);
|
|
2163
|
+
});
|
|
2164
|
+
return () => {
|
|
2165
|
+
cancelled = true;
|
|
2166
|
+
};
|
|
2167
|
+
}, [service, smartAccount, retryToken, loadErrorCode, loadErrorFallback]);
|
|
2168
|
+
useEffect6(() => {
|
|
2169
|
+
if (!widgetUrl || iframeLoaded || loadError) return;
|
|
2170
|
+
const timer = setTimeout(() => {
|
|
2171
|
+
setLoadError("Iframe took too long to load.");
|
|
2172
|
+
}, IFRAME_LOAD_TIMEOUT_MS);
|
|
2173
|
+
return () => clearTimeout(timer);
|
|
2174
|
+
}, [widgetUrl, iframeLoaded, loadError]);
|
|
2175
|
+
useEffect6(() => {
|
|
2176
|
+
let cancelled = false;
|
|
2177
|
+
let timeoutId;
|
|
2178
|
+
async function poll() {
|
|
2179
|
+
if (cancelled) return;
|
|
2180
|
+
try {
|
|
2181
|
+
const res = await service.fetchSwappedOrderStatus(smartAccount);
|
|
2182
|
+
if (cancelled) return;
|
|
2183
|
+
const isCurrentOrder = res !== null && expectedOrderUuidRef.current !== null && res.orderId === expectedOrderUuidRef.current;
|
|
2184
|
+
if (isCurrentOrder) {
|
|
2185
|
+
setOrderState(res);
|
|
2186
|
+
}
|
|
2187
|
+
} catch {
|
|
2188
|
+
}
|
|
2189
|
+
if (!cancelled) {
|
|
2190
|
+
timeoutId = setTimeout(poll, STATUS_POLL_INTERVAL_MS);
|
|
2191
|
+
}
|
|
2192
|
+
}
|
|
2193
|
+
poll();
|
|
2194
|
+
return () => {
|
|
2195
|
+
cancelled = true;
|
|
2196
|
+
clearTimeout(timeoutId);
|
|
2197
|
+
};
|
|
2198
|
+
}, [service, smartAccount]);
|
|
2199
|
+
useEffect6(() => {
|
|
2200
|
+
let cancelled = false;
|
|
2201
|
+
let timeoutId;
|
|
2202
|
+
async function pollDeposit() {
|
|
2203
|
+
if (cancelled) return;
|
|
2204
|
+
try {
|
|
2205
|
+
const status = await service.fetchLatestStatus(smartAccount);
|
|
2206
|
+
if (cancelled) return;
|
|
2207
|
+
const event = status.lastEvent;
|
|
2208
|
+
const eventTxHash = isDepositEvent(event) ? getEventTxHash(event) ?? null : null;
|
|
2209
|
+
if (baselineDepositTxHashRef.current === void 0) {
|
|
2210
|
+
baselineDepositTxHashRef.current = eventTxHash;
|
|
2211
|
+
} else if (eventTxHash && (!baselineDepositTxHashRef.current || !txRefsMatch(eventTxHash, baselineDepositTxHashRef.current))) {
|
|
2212
|
+
currentDepositTxHashRef.current = eventTxHash;
|
|
2213
|
+
setLatestEvent(event ?? null);
|
|
2214
|
+
}
|
|
2215
|
+
} catch {
|
|
2216
|
+
}
|
|
2217
|
+
if (!cancelled) {
|
|
2218
|
+
const nextInterval = fastDepositPollEnabledRef.current ? DEPOSIT_POLL_FAST_INTERVAL_MS : DEPOSIT_POLL_INTERVAL_MS;
|
|
2219
|
+
timeoutId = setTimeout(pollDeposit, nextInterval);
|
|
2220
|
+
}
|
|
2221
|
+
}
|
|
2222
|
+
rescheduleDepositPollRef.current = (delayMs) => {
|
|
2223
|
+
if (cancelled) return;
|
|
2224
|
+
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
2225
|
+
timeoutId = setTimeout(pollDeposit, delayMs);
|
|
2226
|
+
};
|
|
2227
|
+
pollDeposit();
|
|
2228
|
+
return () => {
|
|
2229
|
+
cancelled = true;
|
|
2230
|
+
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
2231
|
+
rescheduleDepositPollRef.current = null;
|
|
2232
|
+
};
|
|
2233
|
+
}, [service, smartAccount]);
|
|
2234
|
+
useEffect6(() => {
|
|
2235
|
+
if (fastDepositPollEnabledRef.current) return;
|
|
2236
|
+
const status = orderState?.status;
|
|
2237
|
+
if (!status || !SWAPPED_TERMINAL_STATUSES.has(status)) return;
|
|
2238
|
+
fastDepositPollEnabledRef.current = true;
|
|
2239
|
+
rescheduleDepositPollRef.current?.(DEPOSIT_POLL_FAST_INITIAL_DELAY_MS);
|
|
2240
|
+
}, [orderState]);
|
|
2241
|
+
useEffect6(() => {
|
|
2242
|
+
function onMessage(e) {
|
|
2243
|
+
if (!SWAPPED_IFRAME_ORIGINS.has(e.origin)) return;
|
|
2244
|
+
const parsed = parseSwappedIframeMessage(e.data);
|
|
2245
|
+
if (!parsed) return;
|
|
2246
|
+
setOrderState((prev) => ({
|
|
2247
|
+
orderId: parsed.orderId ?? prev?.orderId ?? "",
|
|
2248
|
+
status: parsed.status,
|
|
2249
|
+
orderCrypto: parsed.orderCrypto ?? prev?.orderCrypto ?? null,
|
|
2250
|
+
orderCryptoAmount: parsed.orderCryptoAmount ?? prev?.orderCryptoAmount ?? null,
|
|
2251
|
+
transactionId: parsed.transactionId ?? prev?.transactionId ?? null,
|
|
2252
|
+
receivedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2253
|
+
paidAmountUsd: prev?.paidAmountUsd ?? null,
|
|
2254
|
+
paidAmountEur: prev?.paidAmountEur ?? null,
|
|
2255
|
+
onrampFeeUsd: prev?.onrampFeeUsd ?? null,
|
|
2256
|
+
paymentMethod: prev?.paymentMethod ?? null
|
|
2257
|
+
}));
|
|
2258
|
+
}
|
|
2259
|
+
window.addEventListener("message", onMessage);
|
|
2260
|
+
return () => window.removeEventListener("message", onMessage);
|
|
2261
|
+
}, []);
|
|
2262
|
+
useEffect6(() => {
|
|
2263
|
+
if (phase === "iframe" && orderState !== null) {
|
|
2264
|
+
setPhase("tracker");
|
|
2265
|
+
}
|
|
2266
|
+
}, [phase, orderState]);
|
|
2267
|
+
const stepStates = useMemo4(
|
|
2268
|
+
() => deriveStepStates(orderState?.status ?? null, latestEvent),
|
|
2269
|
+
[orderState, latestEvent]
|
|
2270
|
+
);
|
|
2271
|
+
const terminalState = useMemo4(() => {
|
|
2272
|
+
if (isFailedEvent(latestEvent ?? void 0)) {
|
|
2273
|
+
return {
|
|
2274
|
+
kind: "failed",
|
|
2275
|
+
message: failureMessageForEvent(latestEvent ?? void 0)
|
|
2276
|
+
};
|
|
2277
|
+
}
|
|
2278
|
+
if (orderState?.status === "order_cancelled") {
|
|
2279
|
+
const banner = bannerForStatus("order_cancelled", {});
|
|
2280
|
+
return { kind: "cancelled", message: banner.detail ?? banner.title };
|
|
2281
|
+
}
|
|
2282
|
+
return null;
|
|
2283
|
+
}, [latestEvent, orderState, bannerForStatus]);
|
|
2284
|
+
useEffect6(() => {
|
|
2285
|
+
if (completeFiredRef.current || failedFiredRef.current) return;
|
|
2286
|
+
const t = latestEvent?.type;
|
|
2287
|
+
const isSuccess = t === "bridge-complete" || t === "post-bridge-swap-complete";
|
|
2288
|
+
if (!isSuccess) return;
|
|
2289
|
+
const txHash = currentDepositTxHashRef.current;
|
|
2290
|
+
if (!txHash) return;
|
|
2291
|
+
completeFiredRef.current = true;
|
|
2292
|
+
onSwappedCompleteRef.current({
|
|
2293
|
+
txHash,
|
|
2294
|
+
orderCrypto: orderState?.orderCrypto ?? null,
|
|
2295
|
+
// Base-unit source amount from the deposit row/event, consistent with the
|
|
2296
|
+
// wallet/QR path. ProcessingStep + onLifecycle expect base units.
|
|
2297
|
+
amount: getEventSourceDetails(latestEvent ?? void 0).amount ?? null
|
|
2298
|
+
});
|
|
2299
|
+
}, [latestEvent, orderState]);
|
|
2300
|
+
useEffect6(() => {
|
|
2301
|
+
if (failedFiredRef.current || completeFiredRef.current) return;
|
|
2302
|
+
if (!isFailedEvent(latestEvent ?? void 0)) return;
|
|
2303
|
+
const txHash = currentDepositTxHashRef.current;
|
|
2304
|
+
if (!txHash) return;
|
|
2305
|
+
failedFiredRef.current = true;
|
|
2306
|
+
setPhase("tracker");
|
|
2307
|
+
onSwappedFailedRef.current?.(
|
|
2308
|
+
txHash,
|
|
2309
|
+
failureMessageForEvent(latestEvent ?? void 0)
|
|
2310
|
+
);
|
|
2311
|
+
}, [latestEvent]);
|
|
2312
|
+
if (phase === "tracker") {
|
|
2313
|
+
return /* @__PURE__ */ jsx8(
|
|
2314
|
+
SwappedOrderTracker,
|
|
2315
|
+
{
|
|
2316
|
+
amount: orderState?.orderCryptoAmount ?? null,
|
|
2317
|
+
currency: orderState?.orderCrypto ?? "USDC",
|
|
2318
|
+
stepStates,
|
|
2319
|
+
terminal: terminalState,
|
|
2320
|
+
onRetry: () => setRetryToken((n) => n + 1),
|
|
2321
|
+
onClose
|
|
2322
|
+
}
|
|
2323
|
+
);
|
|
2324
|
+
}
|
|
2325
|
+
return /* @__PURE__ */ jsxs8("div", { className: "rs-screen rs-fiat-onramp", "data-variant": variant, children: [
|
|
2326
|
+
/* @__PURE__ */ jsxs8("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2327
|
+
/* @__PURE__ */ jsx8(
|
|
2328
|
+
BodyHeader,
|
|
2329
|
+
{
|
|
2330
|
+
icon: /* @__PURE__ */ jsx8(HandCoinsIcon, {}),
|
|
2331
|
+
title: "Deposit",
|
|
2332
|
+
subtitle: "Add money to your balance"
|
|
2333
|
+
}
|
|
2334
|
+
),
|
|
2335
|
+
/* @__PURE__ */ jsxs8("div", { className: "rs-fiat-onramp-iframe-wrap", children: [
|
|
2336
|
+
loadError && /* @__PURE__ */ jsxs8("div", { className: "rs-fiat-onramp-error", children: [
|
|
2337
|
+
/* @__PURE__ */ jsx8("div", { children: loadError }),
|
|
2338
|
+
/* @__PURE__ */ jsx8(
|
|
2339
|
+
"button",
|
|
2340
|
+
{
|
|
2341
|
+
type: "button",
|
|
2342
|
+
className: "rs-fiat-onramp-retry",
|
|
2343
|
+
onClick: () => setRetryToken((n) => n + 1),
|
|
2344
|
+
children: "Retry"
|
|
2345
|
+
}
|
|
2346
|
+
)
|
|
2347
|
+
] }),
|
|
2348
|
+
!loadError && !iframeLoaded && /* @__PURE__ */ jsx8("div", { className: "rs-fiat-onramp-loading", children: /* @__PURE__ */ jsx8(Spinner, {}) }),
|
|
2349
|
+
widgetUrl && !loadError && /* @__PURE__ */ jsx8(
|
|
2350
|
+
"iframe",
|
|
2351
|
+
{
|
|
2352
|
+
src: widgetUrl,
|
|
2353
|
+
title: iframeTitle,
|
|
2354
|
+
className: "rs-fiat-onramp-iframe",
|
|
2355
|
+
sandbox: "allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation",
|
|
2356
|
+
allow: "payment; camera; microphone; clipboard-write; geolocation",
|
|
2357
|
+
onLoad: () => setIframeLoaded(true)
|
|
2358
|
+
},
|
|
2359
|
+
retryToken
|
|
2360
|
+
)
|
|
2361
|
+
] })
|
|
2362
|
+
] }),
|
|
2363
|
+
/* @__PURE__ */ jsx8(PoweredBy, {})
|
|
2364
|
+
] });
|
|
2365
|
+
}
|
|
2366
|
+
function deriveStepStates(swappedStatus, latestEvent) {
|
|
2367
|
+
if (isFailedEvent(latestEvent ?? void 0)) {
|
|
2368
|
+
return ["complete", "complete", "failed", "pending"];
|
|
2369
|
+
}
|
|
2370
|
+
if (swappedStatus === "order_cancelled") {
|
|
2371
|
+
return ["failed", "pending", "pending", "pending"];
|
|
2372
|
+
}
|
|
2373
|
+
const step1Complete = swappedStatus === "order_completed" || swappedStatus === "order_broadcasted";
|
|
2374
|
+
const step2Complete = latestEvent !== null;
|
|
2375
|
+
const step3Complete = latestEvent?.type === "bridge-complete" || latestEvent?.type === "post-bridge-swap-complete";
|
|
2376
|
+
if (step3Complete) {
|
|
2377
|
+
return ["complete", "complete", "complete", "pending"];
|
|
2378
|
+
}
|
|
2379
|
+
if (step2Complete) {
|
|
2380
|
+
return ["complete", "complete", "active", "pending"];
|
|
2381
|
+
}
|
|
2382
|
+
if (step1Complete) {
|
|
2383
|
+
return ["complete", "active", "pending", "pending"];
|
|
2384
|
+
}
|
|
2385
|
+
return ["active", "pending", "pending", "pending"];
|
|
2386
|
+
}
|
|
2387
|
+
SwappedIframeStep.displayName = "SwappedIframeStep";
|
|
2388
|
+
|
|
2389
|
+
// src/components/steps/FiatOnrampStep.tsx
|
|
2390
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
2391
|
+
function fiatBannerForStatus(status, context) {
|
|
2392
|
+
if (context.currencyMismatch) {
|
|
2393
|
+
return {
|
|
2394
|
+
level: "warning",
|
|
2395
|
+
title: "Currency mismatch",
|
|
2396
|
+
detail: "Funds may not bridge automatically. Contact support if your balance does not arrive."
|
|
2397
|
+
};
|
|
2398
|
+
}
|
|
2399
|
+
switch (status) {
|
|
2400
|
+
case "payment_pending":
|
|
2401
|
+
return { level: "info", title: "Verifying payment\u2026" };
|
|
2402
|
+
case "order_completed":
|
|
2403
|
+
return { level: "success", title: "Payment received \u2014 sending crypto" };
|
|
2404
|
+
case "order_broadcasted":
|
|
2405
|
+
return {
|
|
2406
|
+
level: "success",
|
|
2407
|
+
title: "Crypto sent \u2014 confirming on-chain"
|
|
2408
|
+
};
|
|
2409
|
+
case "order_cancelled":
|
|
2410
|
+
return {
|
|
2411
|
+
level: "warning",
|
|
2412
|
+
title: "Order cancelled",
|
|
2413
|
+
detail: "If you were charged, Swapped will refund within 5 business days."
|
|
2414
|
+
};
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2417
|
+
function FiatOnrampStep({
|
|
2418
|
+
smartAccount,
|
|
2419
|
+
service,
|
|
2420
|
+
paymentMethod,
|
|
2421
|
+
onSwappedComplete,
|
|
2422
|
+
onSwappedFailed,
|
|
2423
|
+
onClose,
|
|
2424
|
+
onError
|
|
2425
|
+
}) {
|
|
2426
|
+
const loadUrl = useCallback3(async () => {
|
|
2427
|
+
const res = await service.getSwappedWidgetUrl({
|
|
2428
|
+
smartAccount,
|
|
2429
|
+
method: paymentMethod
|
|
2430
|
+
});
|
|
2431
|
+
if (res.currencyCode !== "USDC_BASE") {
|
|
2432
|
+
console.warn(
|
|
2433
|
+
`[FiatOnrampStep] Expected backend to return currencyCode=USDC_BASE, got ${res.currencyCode}. Swapped purchases may not bridge as expected.`
|
|
2434
|
+
);
|
|
2435
|
+
}
|
|
2436
|
+
return res;
|
|
2437
|
+
}, [service, smartAccount, paymentMethod]);
|
|
2438
|
+
return /* @__PURE__ */ jsx9(
|
|
2439
|
+
SwappedIframeStep,
|
|
2440
|
+
{
|
|
2441
|
+
smartAccount,
|
|
2442
|
+
service,
|
|
2443
|
+
variant: "fiat",
|
|
2444
|
+
loadUrl,
|
|
2445
|
+
iframeTitle: "Buy crypto with Swapped",
|
|
2446
|
+
loadErrorCode: "SWAPPED_URL_FAILED",
|
|
2447
|
+
loadErrorFallback: "Failed to load on-ramp",
|
|
2448
|
+
bannerForStatus: fiatBannerForStatus,
|
|
2449
|
+
onSwappedComplete,
|
|
2450
|
+
onSwappedFailed,
|
|
2451
|
+
onClose,
|
|
2452
|
+
onError
|
|
2453
|
+
}
|
|
2454
|
+
);
|
|
2455
|
+
}
|
|
2456
|
+
FiatOnrampStep.displayName = "FiatOnrampStep";
|
|
2457
|
+
|
|
2458
|
+
// src/components/steps/ExchangeConnectStep.tsx
|
|
2459
|
+
import { useCallback as useCallback4 } from "react";
|
|
2460
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
2461
|
+
function connectBannerForStatus(status, context) {
|
|
2462
|
+
if (context.currencyMismatch) {
|
|
2463
|
+
return {
|
|
2464
|
+
level: "warning",
|
|
2465
|
+
title: "Currency mismatch",
|
|
2466
|
+
detail: "Funds may not bridge automatically. Contact support if your balance does not arrive."
|
|
2467
|
+
};
|
|
2468
|
+
}
|
|
2469
|
+
switch (status) {
|
|
2470
|
+
case "payment_pending":
|
|
2471
|
+
return { level: "info", title: "Waiting for exchange transfer\u2026" };
|
|
2472
|
+
case "order_completed":
|
|
2473
|
+
return {
|
|
2474
|
+
level: "success",
|
|
2475
|
+
title: "Exchange transfer received \u2014 sending crypto"
|
|
2476
|
+
};
|
|
2477
|
+
case "order_broadcasted":
|
|
2478
|
+
return {
|
|
2479
|
+
level: "success",
|
|
2480
|
+
title: "Crypto sent \u2014 confirming on-chain"
|
|
2481
|
+
};
|
|
2482
|
+
case "order_cancelled":
|
|
2483
|
+
return {
|
|
2484
|
+
level: "warning",
|
|
2485
|
+
title: "Order cancelled",
|
|
2486
|
+
detail: "If your exchange already debited the funds, Swapped will refund within 5 business days."
|
|
2487
|
+
};
|
|
2488
|
+
}
|
|
2489
|
+
}
|
|
2490
|
+
function ExchangeConnectStep({
|
|
2491
|
+
smartAccount,
|
|
2492
|
+
service,
|
|
2493
|
+
connection,
|
|
2494
|
+
onSwappedComplete,
|
|
2495
|
+
onSwappedFailed,
|
|
2496
|
+
onClose,
|
|
2497
|
+
onError
|
|
2498
|
+
}) {
|
|
2499
|
+
const loadUrl = useCallback4(async () => {
|
|
2500
|
+
const res = await service.getSwappedConnectUrl({
|
|
2501
|
+
smartAccount,
|
|
2502
|
+
connection
|
|
2503
|
+
});
|
|
2504
|
+
if (res.currencyCode !== "USDC_BASE") {
|
|
2505
|
+
console.warn(
|
|
2506
|
+
`[ExchangeConnectStep] Expected backend to return currencyCode=USDC_BASE, got ${res.currencyCode}. Swapped Connect pulls may not bridge as expected.`
|
|
2507
|
+
);
|
|
2508
|
+
}
|
|
2509
|
+
return res;
|
|
2510
|
+
}, [service, smartAccount, connection]);
|
|
2511
|
+
return /* @__PURE__ */ jsx10(
|
|
2512
|
+
SwappedIframeStep,
|
|
2513
|
+
{
|
|
2514
|
+
smartAccount,
|
|
2515
|
+
service,
|
|
2516
|
+
variant: "connect",
|
|
2517
|
+
loadUrl,
|
|
2518
|
+
iframeTitle: "Fund from exchange via Swapped",
|
|
2519
|
+
loadErrorCode: "SWAPPED_CONNECT_URL_FAILED",
|
|
2520
|
+
loadErrorFallback: "Failed to load Connect",
|
|
2521
|
+
bannerForStatus: connectBannerForStatus,
|
|
2522
|
+
onSwappedComplete,
|
|
2523
|
+
onSwappedFailed,
|
|
2524
|
+
onClose,
|
|
2525
|
+
onError
|
|
2526
|
+
}
|
|
2527
|
+
);
|
|
2528
|
+
}
|
|
2529
|
+
ExchangeConnectStep.displayName = "ExchangeConnectStep";
|
|
2530
|
+
|
|
2531
|
+
// src/components/steps/ExchangeSelectStep.tsx
|
|
2532
|
+
import { useCallback as useCallback5, useEffect as useEffect7, useState as useState7 } from "react";
|
|
2533
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2534
|
+
function ExchangeLogo({ exchange }) {
|
|
2535
|
+
const [failed, setFailed] = useState7(false);
|
|
2536
|
+
if (!exchange.logoUrl || failed) {
|
|
2537
|
+
return /* @__PURE__ */ jsx11(BankIcon, {});
|
|
2538
|
+
}
|
|
2539
|
+
return /* @__PURE__ */ jsx11(
|
|
2540
|
+
"img",
|
|
2541
|
+
{
|
|
2542
|
+
src: exchange.logoUrl,
|
|
2543
|
+
alt: "",
|
|
2544
|
+
onError: () => setFailed(true)
|
|
2545
|
+
}
|
|
2546
|
+
);
|
|
2547
|
+
}
|
|
2548
|
+
function ExchangeSelectStep({
|
|
2549
|
+
service,
|
|
2550
|
+
onSelectExchange,
|
|
2551
|
+
onError
|
|
2552
|
+
}) {
|
|
2553
|
+
const [exchanges, setExchanges] = useState7([]);
|
|
2554
|
+
const [loading, setLoading] = useState7(true);
|
|
2555
|
+
const [error, setError] = useState7(null);
|
|
2556
|
+
const [retryToken, setRetryToken] = useState7(0);
|
|
2557
|
+
const retry = useCallback5(() => {
|
|
2558
|
+
setRetryToken((n) => n + 1);
|
|
2559
|
+
}, []);
|
|
2560
|
+
useEffect7(() => {
|
|
2561
|
+
let cancelled = false;
|
|
2562
|
+
setLoading(true);
|
|
2563
|
+
setError(null);
|
|
2564
|
+
service.getSwappedConnectExchanges().then((res) => {
|
|
2565
|
+
if (cancelled) return;
|
|
2566
|
+
setExchanges(res.exchanges);
|
|
2567
|
+
}).catch((err) => {
|
|
2568
|
+
if (cancelled) return;
|
|
2569
|
+
const message = err instanceof Error ? err.message : "Failed to load exchanges";
|
|
2570
|
+
setExchanges([]);
|
|
2571
|
+
setError(message);
|
|
2572
|
+
onError?.(message, "SWAPPED_CONNECT_EXCHANGES_FAILED");
|
|
2573
|
+
}).finally(() => {
|
|
2574
|
+
if (!cancelled) setLoading(false);
|
|
2575
|
+
});
|
|
2576
|
+
return () => {
|
|
2577
|
+
cancelled = true;
|
|
2578
|
+
};
|
|
2579
|
+
}, [service, retryToken, onError]);
|
|
2580
|
+
return /* @__PURE__ */ jsxs9("div", { className: "rs-screen rs-exchange-select", children: [
|
|
2581
|
+
/* @__PURE__ */ jsxs9("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2582
|
+
/* @__PURE__ */ jsx11(
|
|
2583
|
+
BodyHeader,
|
|
2584
|
+
{
|
|
2585
|
+
icon: /* @__PURE__ */ jsx11(BankIcon, {}),
|
|
2586
|
+
title: "Fund from Exchange",
|
|
2587
|
+
subtitle: "Choose your exchange"
|
|
2588
|
+
}
|
|
2589
|
+
),
|
|
2590
|
+
loading && /* @__PURE__ */ jsx11("div", { className: "rs-exchange-select-state", "aria-live": "polite", children: /* @__PURE__ */ jsx11(Spinner, {}) }),
|
|
2591
|
+
!loading && error && /* @__PURE__ */ jsxs9("div", { className: "rs-exchange-select-state", "aria-live": "polite", children: [
|
|
2592
|
+
/* @__PURE__ */ jsx11("div", { className: "rs-exchange-select-state-title", children: "Couldn\u2019t load exchanges" }),
|
|
2593
|
+
/* @__PURE__ */ jsx11(
|
|
2594
|
+
"button",
|
|
2595
|
+
{
|
|
2596
|
+
type: "button",
|
|
2597
|
+
className: "rs-fiat-onramp-retry",
|
|
2598
|
+
onClick: retry,
|
|
2599
|
+
children: "Retry"
|
|
2600
|
+
}
|
|
2601
|
+
)
|
|
2602
|
+
] }),
|
|
2603
|
+
!loading && !error && exchanges.length === 0 && /* @__PURE__ */ jsxs9("div", { className: "rs-exchange-select-state", "aria-live": "polite", children: [
|
|
2604
|
+
/* @__PURE__ */ jsx11("div", { className: "rs-exchange-select-state-title", children: "No exchanges available" }),
|
|
2605
|
+
/* @__PURE__ */ jsx11(
|
|
2606
|
+
"button",
|
|
2607
|
+
{
|
|
2608
|
+
type: "button",
|
|
2609
|
+
className: "rs-fiat-onramp-retry",
|
|
2610
|
+
onClick: retry,
|
|
2611
|
+
children: "Retry"
|
|
2612
|
+
}
|
|
2613
|
+
)
|
|
2614
|
+
] }),
|
|
2615
|
+
!loading && !error && exchanges.length > 0 && /* @__PURE__ */ jsx11("div", { className: "rs-exchange-grid", children: exchanges.map((exchange) => /* @__PURE__ */ jsxs9(
|
|
2616
|
+
"button",
|
|
2617
|
+
{
|
|
2618
|
+
type: "button",
|
|
2619
|
+
className: "rs-exchange-card",
|
|
2620
|
+
onClick: () => onSelectExchange(exchange.connection),
|
|
2621
|
+
"aria-label": `Select ${exchange.name}`,
|
|
2622
|
+
children: [
|
|
2623
|
+
/* @__PURE__ */ jsx11("span", { className: "rs-exchange-card-logo", children: /* @__PURE__ */ jsx11(ExchangeLogo, { exchange }) }),
|
|
2624
|
+
/* @__PURE__ */ jsx11("span", { className: "rs-exchange-card-name", children: exchange.name })
|
|
2625
|
+
]
|
|
2626
|
+
},
|
|
2627
|
+
exchange.connection
|
|
2628
|
+
)) })
|
|
2629
|
+
] }),
|
|
2630
|
+
/* @__PURE__ */ jsx11(PoweredBy, {})
|
|
2631
|
+
] });
|
|
2632
|
+
}
|
|
2633
|
+
ExchangeSelectStep.displayName = "ExchangeSelectStep";
|
|
2634
|
+
|
|
2635
|
+
// src/components/steps/DepositAddressSkeleton.tsx
|
|
2636
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1953
2637
|
var BASE_CHAIN_ID = 8453;
|
|
1954
2638
|
function DepositAddressSkeleton({
|
|
1955
2639
|
uiConfig,
|
|
@@ -1970,15 +2654,15 @@ function DepositAddressSkeleton({
|
|
|
1970
2654
|
const chainName = getChainName(defaultChainId);
|
|
1971
2655
|
const chainIcon = getChainIcon(defaultChainId);
|
|
1972
2656
|
const tokenIcon = getTokenIcon(defaultToken);
|
|
1973
|
-
return /* @__PURE__ */
|
|
1974
|
-
/* @__PURE__ */
|
|
1975
|
-
/* @__PURE__ */
|
|
1976
|
-
/* @__PURE__ */
|
|
1977
|
-
/* @__PURE__ */
|
|
1978
|
-
/* @__PURE__ */
|
|
1979
|
-
/* @__PURE__ */
|
|
1980
|
-
/* @__PURE__ */
|
|
1981
|
-
chainIcon && /* @__PURE__ */
|
|
2657
|
+
return /* @__PURE__ */ jsxs10("div", { className: "rs-screen", "aria-busy": "true", children: [
|
|
2658
|
+
/* @__PURE__ */ jsx12("span", { className: "rs-sr-only", role: "status", children: "Preparing deposit details\u2026" }),
|
|
2659
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-screen-body", children: [
|
|
2660
|
+
/* @__PURE__ */ jsx12(BodyHeader, { icon: /* @__PURE__ */ jsx12(TransferCryptoIcon, {}), title: "Transfer crypto" }),
|
|
2661
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-selectors", "aria-hidden": "true", children: [
|
|
2662
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown", children: [
|
|
2663
|
+
/* @__PURE__ */ jsx12("div", { className: "rs-deposit-address-dropdown-label", children: "Supported chain" }),
|
|
2664
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown-trigger", children: [
|
|
2665
|
+
chainIcon && /* @__PURE__ */ jsx12(
|
|
1982
2666
|
"img",
|
|
1983
2667
|
{
|
|
1984
2668
|
src: chainIcon,
|
|
@@ -1986,17 +2670,17 @@ function DepositAddressSkeleton({
|
|
|
1986
2670
|
className: "rs-deposit-address-dropdown-icon"
|
|
1987
2671
|
}
|
|
1988
2672
|
),
|
|
1989
|
-
/* @__PURE__ */
|
|
1990
|
-
/* @__PURE__ */
|
|
2673
|
+
/* @__PURE__ */ jsx12("span", { children: chainName }),
|
|
2674
|
+
/* @__PURE__ */ jsx12(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
|
|
1991
2675
|
] })
|
|
1992
2676
|
] }),
|
|
1993
|
-
/* @__PURE__ */
|
|
1994
|
-
/* @__PURE__ */
|
|
1995
|
-
/* @__PURE__ */
|
|
1996
|
-
/* @__PURE__ */
|
|
2677
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown", children: [
|
|
2678
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown-label rs-deposit-address-dropdown-label--with-min", children: [
|
|
2679
|
+
/* @__PURE__ */ jsx12("span", { children: "Supported token" }),
|
|
2680
|
+
/* @__PURE__ */ jsxs10("span", { className: "rs-deposit-address-min", children: [
|
|
1997
2681
|
"Min.$",
|
|
1998
2682
|
(uiConfig?.minDepositUsd ?? 0.1).toFixed(2),
|
|
1999
|
-
/* @__PURE__ */
|
|
2683
|
+
/* @__PURE__ */ jsx12(Tooltip, { content: "Minimum deposit amount required for the selected chain.", children: /* @__PURE__ */ jsx12(
|
|
2000
2684
|
InfoIcon,
|
|
2001
2685
|
{
|
|
2002
2686
|
className: "rs-deposit-address-min-icon",
|
|
@@ -2005,8 +2689,8 @@ function DepositAddressSkeleton({
|
|
|
2005
2689
|
) })
|
|
2006
2690
|
] })
|
|
2007
2691
|
] }),
|
|
2008
|
-
/* @__PURE__ */
|
|
2009
|
-
tokenIcon && /* @__PURE__ */
|
|
2692
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown-trigger", children: [
|
|
2693
|
+
tokenIcon && /* @__PURE__ */ jsx12(
|
|
2010
2694
|
"img",
|
|
2011
2695
|
{
|
|
2012
2696
|
src: tokenIcon,
|
|
@@ -2014,21 +2698,21 @@ function DepositAddressSkeleton({
|
|
|
2014
2698
|
className: "rs-deposit-address-dropdown-icon"
|
|
2015
2699
|
}
|
|
2016
2700
|
),
|
|
2017
|
-
/* @__PURE__ */
|
|
2018
|
-
/* @__PURE__ */
|
|
2701
|
+
/* @__PURE__ */ jsx12("span", { children: defaultToken }),
|
|
2702
|
+
/* @__PURE__ */ jsx12(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
|
|
2019
2703
|
] })
|
|
2020
2704
|
] })
|
|
2021
2705
|
] }),
|
|
2022
|
-
/* @__PURE__ */
|
|
2706
|
+
/* @__PURE__ */ jsxs10(
|
|
2023
2707
|
"div",
|
|
2024
2708
|
{
|
|
2025
2709
|
style: { display: "flex", flexDirection: "column", gap: 4, width: "100%" },
|
|
2026
2710
|
children: [
|
|
2027
|
-
/* @__PURE__ */
|
|
2028
|
-
/* @__PURE__ */
|
|
2029
|
-
/* @__PURE__ */
|
|
2711
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-well", children: [
|
|
2712
|
+
/* @__PURE__ */ jsx12("div", { className: "rs-deposit-address-qr", children: /* @__PURE__ */ jsx12("div", { className: "rs-skeleton rs-skeleton-qr", "aria-hidden": "true" }) }),
|
|
2713
|
+
/* @__PURE__ */ jsx12("div", { className: "rs-skeleton rs-skeleton-address", "aria-hidden": "true" })
|
|
2030
2714
|
] }),
|
|
2031
|
-
/* @__PURE__ */
|
|
2715
|
+
/* @__PURE__ */ jsxs10(
|
|
2032
2716
|
"button",
|
|
2033
2717
|
{
|
|
2034
2718
|
type: "button",
|
|
@@ -2036,7 +2720,7 @@ function DepositAddressSkeleton({
|
|
|
2036
2720
|
disabled: true,
|
|
2037
2721
|
"aria-hidden": "true",
|
|
2038
2722
|
children: [
|
|
2039
|
-
/* @__PURE__ */
|
|
2723
|
+
/* @__PURE__ */ jsx12(CopyIcon, {}),
|
|
2040
2724
|
"Copy address"
|
|
2041
2725
|
]
|
|
2042
2726
|
}
|
|
@@ -2044,20 +2728,20 @@ function DepositAddressSkeleton({
|
|
|
2044
2728
|
]
|
|
2045
2729
|
}
|
|
2046
2730
|
),
|
|
2047
|
-
/* @__PURE__ */
|
|
2048
|
-
/* @__PURE__ */
|
|
2049
|
-
/* @__PURE__ */
|
|
2050
|
-
/* @__PURE__ */
|
|
2051
|
-
/* @__PURE__ */
|
|
2731
|
+
/* @__PURE__ */ jsx12("div", { className: "rs-price-impact", "aria-hidden": "true", children: /* @__PURE__ */ jsxs10("div", { className: "rs-price-impact-header", children: [
|
|
2732
|
+
/* @__PURE__ */ jsxs10("span", { className: "rs-price-impact-header-left", children: [
|
|
2733
|
+
/* @__PURE__ */ jsx12("span", { className: "rs-price-impact-label", children: "Price impact" }),
|
|
2734
|
+
/* @__PURE__ */ jsx12("span", { className: "rs-price-impact-label", children: /* @__PURE__ */ jsx12("strong", { children: "0.00%" }) }),
|
|
2735
|
+
/* @__PURE__ */ jsx12(
|
|
2052
2736
|
Tooltip,
|
|
2053
2737
|
{
|
|
2054
2738
|
className: "rs-price-impact-info",
|
|
2055
2739
|
content: "Price impact is the difference between expected and execution price, due to trade size and liquidity.",
|
|
2056
|
-
children: /* @__PURE__ */
|
|
2740
|
+
children: /* @__PURE__ */ jsx12(InfoIcon, { "aria-hidden": "true" })
|
|
2057
2741
|
}
|
|
2058
2742
|
)
|
|
2059
2743
|
] }),
|
|
2060
|
-
/* @__PURE__ */
|
|
2744
|
+
/* @__PURE__ */ jsx12(
|
|
2061
2745
|
ChevronDownIcon,
|
|
2062
2746
|
{
|
|
2063
2747
|
className: "rs-price-impact-chevron",
|
|
@@ -2066,15 +2750,15 @@ function DepositAddressSkeleton({
|
|
|
2066
2750
|
)
|
|
2067
2751
|
] }) })
|
|
2068
2752
|
] }),
|
|
2069
|
-
/* @__PURE__ */
|
|
2753
|
+
/* @__PURE__ */ jsx12(PoweredBy, {})
|
|
2070
2754
|
] });
|
|
2071
2755
|
}
|
|
2072
2756
|
DepositAddressSkeleton.displayName = "DepositAddressSkeleton";
|
|
2073
2757
|
|
|
2074
2758
|
// src/components/steps/SolanaTokenSelectStep.tsx
|
|
2075
|
-
import { useState as
|
|
2759
|
+
import { useState as useState8, useEffect as useEffect8, useMemo as useMemo5 } from "react";
|
|
2076
2760
|
import { formatUnits as formatUnits4 } from "viem";
|
|
2077
|
-
import { jsx as
|
|
2761
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2078
2762
|
function SolanaTokenSelectStep({
|
|
2079
2763
|
solanaAddress,
|
|
2080
2764
|
service,
|
|
@@ -2083,11 +2767,11 @@ function SolanaTokenSelectStep({
|
|
|
2083
2767
|
onDisconnect,
|
|
2084
2768
|
debug
|
|
2085
2769
|
}) {
|
|
2086
|
-
const [tokenBalances, setTokenBalances] =
|
|
2087
|
-
const [selectedSymbol, setSelectedSymbol] =
|
|
2088
|
-
const [loading, setLoading] =
|
|
2089
|
-
const [error, setError] =
|
|
2090
|
-
|
|
2770
|
+
const [tokenBalances, setTokenBalances] = useState8([]);
|
|
2771
|
+
const [selectedSymbol, setSelectedSymbol] = useState8(null);
|
|
2772
|
+
const [loading, setLoading] = useState8(true);
|
|
2773
|
+
const [error, setError] = useState8(null);
|
|
2774
|
+
useEffect8(() => {
|
|
2091
2775
|
let active = true;
|
|
2092
2776
|
async function loadBalances() {
|
|
2093
2777
|
if (!solanaAddress) {
|
|
@@ -2158,7 +2842,7 @@ function SolanaTokenSelectStep({
|
|
|
2158
2842
|
active = false;
|
|
2159
2843
|
};
|
|
2160
2844
|
}, [debug, solanaAddress, service, onTotalBalanceComputed]);
|
|
2161
|
-
const rows =
|
|
2845
|
+
const rows = useMemo5(
|
|
2162
2846
|
() => [...tokenBalances].sort((a, b) => {
|
|
2163
2847
|
if (a.balanceUsd !== b.balanceUsd) return b.balanceUsd - a.balanceUsd;
|
|
2164
2848
|
if (b.balance > a.balance) return 1;
|
|
@@ -2180,30 +2864,30 @@ function SolanaTokenSelectStep({
|
|
|
2180
2864
|
};
|
|
2181
2865
|
const chainIcon = getChainIcon("solana");
|
|
2182
2866
|
const chainName = getChainName("solana");
|
|
2183
|
-
return /* @__PURE__ */
|
|
2184
|
-
/* @__PURE__ */
|
|
2185
|
-
/* @__PURE__ */
|
|
2867
|
+
return /* @__PURE__ */ jsxs11("div", { className: "rs-screen", children: [
|
|
2868
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-screen-body", children: [
|
|
2869
|
+
/* @__PURE__ */ jsx13(
|
|
2186
2870
|
BodyHeader,
|
|
2187
2871
|
{
|
|
2188
|
-
icon: /* @__PURE__ */
|
|
2872
|
+
icon: /* @__PURE__ */ jsx13(WalletIcon, {}),
|
|
2189
2873
|
title: "Your assets",
|
|
2190
2874
|
subtitle: "Select source assets to transfer"
|
|
2191
2875
|
}
|
|
2192
2876
|
),
|
|
2193
|
-
loading && /* @__PURE__ */
|
|
2194
|
-
/* @__PURE__ */
|
|
2195
|
-
/* @__PURE__ */
|
|
2877
|
+
loading && /* @__PURE__ */ jsxs11("div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
2878
|
+
/* @__PURE__ */ jsx13(Spinner, { className: "rs-text-tertiary" }),
|
|
2879
|
+
/* @__PURE__ */ jsx13("span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
2196
2880
|
] }),
|
|
2197
|
-
error && /* @__PURE__ */
|
|
2198
|
-
!loading && !error && rows.length === 0 && /* @__PURE__ */
|
|
2199
|
-
/* @__PURE__ */
|
|
2200
|
-
/* @__PURE__ */
|
|
2201
|
-
/* @__PURE__ */
|
|
2881
|
+
error && /* @__PURE__ */ jsx13(Callout, { variant: "error", children: error }),
|
|
2882
|
+
!loading && !error && rows.length === 0 && /* @__PURE__ */ jsxs11("div", { className: "rs-empty-state", children: [
|
|
2883
|
+
/* @__PURE__ */ jsx13(WalletIcon, { className: "rs-empty-icon" }),
|
|
2884
|
+
/* @__PURE__ */ jsx13("div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
|
|
2885
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-empty-address", children: [
|
|
2202
2886
|
solanaAddress.slice(0, 6),
|
|
2203
2887
|
"...",
|
|
2204
2888
|
solanaAddress.slice(-4)
|
|
2205
2889
|
] }),
|
|
2206
|
-
onDisconnect && /* @__PURE__ */
|
|
2890
|
+
onDisconnect && /* @__PURE__ */ jsx13(
|
|
2207
2891
|
"button",
|
|
2208
2892
|
{
|
|
2209
2893
|
type: "button",
|
|
@@ -2213,11 +2897,11 @@ function SolanaTokenSelectStep({
|
|
|
2213
2897
|
}
|
|
2214
2898
|
)
|
|
2215
2899
|
] }),
|
|
2216
|
-
!loading && !error && rows.length > 0 && /* @__PURE__ */
|
|
2900
|
+
!loading && !error && rows.length > 0 && /* @__PURE__ */ jsx13("div", { className: "rs-asset-list", children: rows.map((entry) => {
|
|
2217
2901
|
const isSelected = selectedSymbol === entry.token.symbol;
|
|
2218
2902
|
const tokenAmount = formatBalance(entry);
|
|
2219
2903
|
const tokenIcon = getTokenIcon(entry.token.symbol);
|
|
2220
|
-
return /* @__PURE__ */
|
|
2904
|
+
return /* @__PURE__ */ jsxs11(
|
|
2221
2905
|
"button",
|
|
2222
2906
|
{
|
|
2223
2907
|
type: "button",
|
|
@@ -2225,33 +2909,33 @@ function SolanaTokenSelectStep({
|
|
|
2225
2909
|
className: `rs-asset-row ${isSelected ? "rs-asset-row--selected" : ""}`,
|
|
2226
2910
|
"aria-pressed": isSelected,
|
|
2227
2911
|
children: [
|
|
2228
|
-
/* @__PURE__ */
|
|
2229
|
-
/* @__PURE__ */
|
|
2230
|
-
tokenIcon ? /* @__PURE__ */
|
|
2231
|
-
chainIcon && /* @__PURE__ */
|
|
2912
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-asset-info", children: [
|
|
2913
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-asset-icon-wrapper", children: [
|
|
2914
|
+
tokenIcon ? /* @__PURE__ */ jsx13("span", { className: "rs-asset-icon", children: /* @__PURE__ */ jsx13("img", { src: tokenIcon, alt: entry.token.symbol }) }) : /* @__PURE__ */ jsx13("span", { className: "rs-asset-icon", children: entry.token.symbol.slice(0, 4) }),
|
|
2915
|
+
chainIcon && /* @__PURE__ */ jsx13("span", { className: "rs-asset-chain-badge", children: /* @__PURE__ */ jsx13("img", { src: chainIcon, alt: chainName }) })
|
|
2232
2916
|
] }),
|
|
2233
|
-
/* @__PURE__ */
|
|
2234
|
-
/* @__PURE__ */
|
|
2235
|
-
/* @__PURE__ */
|
|
2236
|
-
/* @__PURE__ */
|
|
2917
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-asset-text", children: [
|
|
2918
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-asset-name-row", children: [
|
|
2919
|
+
/* @__PURE__ */ jsx13("span", { className: "rs-asset-name", children: entry.token.symbol }),
|
|
2920
|
+
/* @__PURE__ */ jsxs11("span", { className: "rs-asset-chain", children: [
|
|
2237
2921
|
"on ",
|
|
2238
2922
|
chainName
|
|
2239
2923
|
] })
|
|
2240
2924
|
] }),
|
|
2241
|
-
/* @__PURE__ */
|
|
2925
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-asset-balance-small", children: [
|
|
2242
2926
|
tokenAmount,
|
|
2243
2927
|
" ",
|
|
2244
2928
|
entry.token.symbol
|
|
2245
2929
|
] })
|
|
2246
2930
|
] })
|
|
2247
2931
|
] }),
|
|
2248
|
-
/* @__PURE__ */
|
|
2932
|
+
/* @__PURE__ */ jsx13("div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ? currencyFormatter.format(entry.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${entry.token.symbol}` : "--" })
|
|
2249
2933
|
]
|
|
2250
2934
|
},
|
|
2251
2935
|
entry.token.symbol
|
|
2252
2936
|
);
|
|
2253
2937
|
}) }),
|
|
2254
|
-
/* @__PURE__ */
|
|
2938
|
+
/* @__PURE__ */ jsx13(
|
|
2255
2939
|
Button,
|
|
2256
2940
|
{
|
|
2257
2941
|
onClick: () => selectedEntry && onContinue(
|
|
@@ -2265,14 +2949,14 @@ function SolanaTokenSelectStep({
|
|
|
2265
2949
|
}
|
|
2266
2950
|
)
|
|
2267
2951
|
] }),
|
|
2268
|
-
/* @__PURE__ */
|
|
2952
|
+
/* @__PURE__ */ jsx13(PoweredBy, {})
|
|
2269
2953
|
] });
|
|
2270
2954
|
}
|
|
2271
2955
|
|
|
2272
2956
|
// src/components/steps/SolanaAmountStep.tsx
|
|
2273
|
-
import { useCallback as
|
|
2957
|
+
import { useCallback as useCallback6, useEffect as useEffect9, useMemo as useMemo6, useRef as useRef7, useState as useState9 } from "react";
|
|
2274
2958
|
import { formatUnits as formatUnits5, parseUnits as parseUnits3 } from "viem";
|
|
2275
|
-
import { Fragment as Fragment2, jsx as
|
|
2959
|
+
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2276
2960
|
var SOL_FEE_RESERVE_LAMPORTS = 1000000n;
|
|
2277
2961
|
var PRESETS2 = [
|
|
2278
2962
|
{ value: 25, label: "25%" },
|
|
@@ -2293,12 +2977,12 @@ function SolanaAmountStep({
|
|
|
2293
2977
|
onContinue,
|
|
2294
2978
|
debug
|
|
2295
2979
|
}) {
|
|
2296
|
-
const [amount, setAmount] =
|
|
2297
|
-
const [error, setError] =
|
|
2298
|
-
const hasAppliedDefaultRef =
|
|
2980
|
+
const [amount, setAmount] = useState9("");
|
|
2981
|
+
const [error, setError] = useState9(null);
|
|
2982
|
+
const hasAppliedDefaultRef = useRef7(false);
|
|
2299
2983
|
const isSourceStablecoin = isStablecoinSymbol(token.symbol);
|
|
2300
2984
|
const isMaxDefault = defaultAmount?.trim().toLowerCase() === "max";
|
|
2301
|
-
const tokenPriceUsd =
|
|
2985
|
+
const tokenPriceUsd = useMemo6(() => {
|
|
2302
2986
|
if (isSourceStablecoin) return 1;
|
|
2303
2987
|
try {
|
|
2304
2988
|
const balanceUnits = Number(formatUnits5(balance, token.decimals));
|
|
@@ -2312,7 +2996,7 @@ function SolanaAmountStep({
|
|
|
2312
2996
|
}
|
|
2313
2997
|
}, [isSourceStablecoin, balance, token.decimals, balanceUsd]);
|
|
2314
2998
|
const hasPricing = tokenPriceUsd !== null;
|
|
2315
|
-
const formattedBalance =
|
|
2999
|
+
const formattedBalance = useMemo6(() => {
|
|
2316
3000
|
try {
|
|
2317
3001
|
const raw = formatUnits5(balance, token.decimals);
|
|
2318
3002
|
const numeric = Number(raw);
|
|
@@ -2322,7 +3006,7 @@ function SolanaAmountStep({
|
|
|
2322
3006
|
return "\u2026";
|
|
2323
3007
|
}
|
|
2324
3008
|
}, [balance, token.decimals]);
|
|
2325
|
-
const computedBalanceUsd =
|
|
3009
|
+
const computedBalanceUsd = useMemo6(() => {
|
|
2326
3010
|
try {
|
|
2327
3011
|
const balanceUnits = Number(formatUnits5(balance, token.decimals));
|
|
2328
3012
|
if (!Number.isFinite(balanceUnits) || balanceUnits < 0) return null;
|
|
@@ -2333,11 +3017,11 @@ function SolanaAmountStep({
|
|
|
2333
3017
|
return null;
|
|
2334
3018
|
}
|
|
2335
3019
|
}, [balance, token.decimals, tokenPriceUsd, balanceUsd]);
|
|
2336
|
-
const spendableBalance =
|
|
3020
|
+
const spendableBalance = useMemo6(() => {
|
|
2337
3021
|
if (!isNativeSol(token)) return balance;
|
|
2338
3022
|
return balance > SOL_FEE_RESERVE_LAMPORTS ? balance - SOL_FEE_RESERVE_LAMPORTS : 0n;
|
|
2339
3023
|
}, [balance, token]);
|
|
2340
|
-
const spendableBalanceUsd =
|
|
3024
|
+
const spendableBalanceUsd = useMemo6(() => {
|
|
2341
3025
|
try {
|
|
2342
3026
|
const spendableUnits = Number(formatUnits5(spendableBalance, token.decimals));
|
|
2343
3027
|
if (!Number.isFinite(spendableUnits) || spendableUnits < 0) return null;
|
|
@@ -2347,7 +3031,7 @@ function SolanaAmountStep({
|
|
|
2347
3031
|
return null;
|
|
2348
3032
|
}
|
|
2349
3033
|
}, [spendableBalance, token.decimals, tokenPriceUsd]);
|
|
2350
|
-
const computePresetAmount =
|
|
3034
|
+
const computePresetAmount = useCallback6(
|
|
2351
3035
|
(percentage) => {
|
|
2352
3036
|
try {
|
|
2353
3037
|
const spendableUnits = Number(
|
|
@@ -2370,7 +3054,7 @@ function SolanaAmountStep({
|
|
|
2370
3054
|
spendableBalanceUsd
|
|
2371
3055
|
]
|
|
2372
3056
|
);
|
|
2373
|
-
|
|
3057
|
+
useEffect9(() => {
|
|
2374
3058
|
if (hasAppliedDefaultRef.current || !defaultAmount) return;
|
|
2375
3059
|
if (isMaxDefault) {
|
|
2376
3060
|
const next = computePresetAmount(100);
|
|
@@ -2386,11 +3070,11 @@ function SolanaAmountStep({
|
|
|
2386
3070
|
hasAppliedDefaultRef.current = true;
|
|
2387
3071
|
}
|
|
2388
3072
|
}, [defaultAmount, isMaxDefault, computePresetAmount]);
|
|
2389
|
-
const numericAmount =
|
|
3073
|
+
const numericAmount = useMemo6(() => {
|
|
2390
3074
|
const parsed = parseFloat(amount);
|
|
2391
3075
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : 0;
|
|
2392
3076
|
}, [amount]);
|
|
2393
|
-
const sourceAmountUnits =
|
|
3077
|
+
const sourceAmountUnits = useMemo6(() => {
|
|
2394
3078
|
if (numericAmount <= 0) return null;
|
|
2395
3079
|
const raw = isSourceStablecoin || !hasPricing ? numericAmount : numericAmount / (tokenPriceUsd ?? 1);
|
|
2396
3080
|
try {
|
|
@@ -2472,12 +3156,12 @@ function SolanaAmountStep({
|
|
|
2472
3156
|
const continueLabel = exceedsBalance ? "Insufficient balance" : isAboveMax ? "Continue with max allowed deposit" : isBelowMin ? "Continue with minimum deposit" : "Continue";
|
|
2473
3157
|
const continueDisabled = exceedsBalance || numericAmount === 0 && !isBelowMin;
|
|
2474
3158
|
const sourceTokenIcon = getTokenIcon(token.symbol);
|
|
2475
|
-
return /* @__PURE__ */
|
|
2476
|
-
/* @__PURE__ */
|
|
2477
|
-
/* @__PURE__ */
|
|
2478
|
-
/* @__PURE__ */
|
|
2479
|
-
/* @__PURE__ */
|
|
2480
|
-
/* @__PURE__ */
|
|
3159
|
+
return /* @__PURE__ */ jsxs12("div", { className: "rs-screen", children: [
|
|
3160
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
3161
|
+
/* @__PURE__ */ jsx14(BodyHeader, { icon: /* @__PURE__ */ jsx14(WalletIcon, {}), title: "Wallet deposit" }),
|
|
3162
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-amount-section", children: [
|
|
3163
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-amount-display", children: [
|
|
3164
|
+
/* @__PURE__ */ jsx14(
|
|
2481
3165
|
AnimatedAmountInput,
|
|
2482
3166
|
{
|
|
2483
3167
|
value: amount,
|
|
@@ -2486,25 +3170,25 @@ function SolanaAmountStep({
|
|
|
2486
3170
|
autoFocus: true
|
|
2487
3171
|
}
|
|
2488
3172
|
),
|
|
2489
|
-
/* @__PURE__ */
|
|
2490
|
-
/* @__PURE__ */
|
|
3173
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-amount-meta", children: [
|
|
3174
|
+
/* @__PURE__ */ jsxs12("span", { className: "rs-amount-meta-balance", children: [
|
|
2491
3175
|
formattedBalance,
|
|
2492
3176
|
" ",
|
|
2493
3177
|
token.symbol,
|
|
2494
3178
|
" available",
|
|
2495
|
-
computedBalanceUsd !== null && /* @__PURE__ */
|
|
3179
|
+
computedBalanceUsd !== null && /* @__PURE__ */ jsxs12(Fragment2, { children: [
|
|
2496
3180
|
" (~",
|
|
2497
3181
|
currencyFormatter.format(computedBalanceUsd),
|
|
2498
3182
|
")"
|
|
2499
3183
|
] })
|
|
2500
3184
|
] }),
|
|
2501
|
-
minDepositUsd !== null && /* @__PURE__ */
|
|
3185
|
+
minDepositUsd !== null && /* @__PURE__ */ jsxs12("span", { className: "rs-amount-meta-minimum", children: [
|
|
2502
3186
|
"Min. deposit ",
|
|
2503
3187
|
currencyFormatter.format(minDepositUsd)
|
|
2504
3188
|
] })
|
|
2505
3189
|
] })
|
|
2506
3190
|
] }),
|
|
2507
|
-
/* @__PURE__ */
|
|
3191
|
+
/* @__PURE__ */ jsx14("div", { className: "rs-amount-presets", children: PRESETS2.map((preset) => /* @__PURE__ */ jsx14(
|
|
2508
3192
|
"button",
|
|
2509
3193
|
{
|
|
2510
3194
|
type: "button",
|
|
@@ -2515,35 +3199,35 @@ function SolanaAmountStep({
|
|
|
2515
3199
|
preset.value
|
|
2516
3200
|
)) })
|
|
2517
3201
|
] }),
|
|
2518
|
-
/* @__PURE__ */
|
|
2519
|
-
/* @__PURE__ */
|
|
2520
|
-
/* @__PURE__ */
|
|
2521
|
-
/* @__PURE__ */
|
|
2522
|
-
/* @__PURE__ */
|
|
3202
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-amount-details", children: [
|
|
3203
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-amount-detail-row", children: [
|
|
3204
|
+
/* @__PURE__ */ jsx14("span", { children: "You send" }),
|
|
3205
|
+
/* @__PURE__ */ jsxs12("span", { className: "rs-amount-detail-value", children: [
|
|
3206
|
+
/* @__PURE__ */ jsxs12("span", { children: [
|
|
2523
3207
|
"Solana ",
|
|
2524
3208
|
token.symbol
|
|
2525
3209
|
] }),
|
|
2526
|
-
sourceTokenIcon && /* @__PURE__ */
|
|
3210
|
+
sourceTokenIcon && /* @__PURE__ */ jsx14("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx14("img", { src: sourceTokenIcon, alt: "" }) })
|
|
2527
3211
|
] })
|
|
2528
3212
|
] }),
|
|
2529
|
-
targetChainName && targetTokenSymbol && /* @__PURE__ */
|
|
2530
|
-
/* @__PURE__ */
|
|
2531
|
-
/* @__PURE__ */
|
|
2532
|
-
/* @__PURE__ */
|
|
3213
|
+
targetChainName && targetTokenSymbol && /* @__PURE__ */ jsxs12("div", { className: "rs-amount-detail-row", children: [
|
|
3214
|
+
/* @__PURE__ */ jsx14("span", { children: "Receive" }),
|
|
3215
|
+
/* @__PURE__ */ jsxs12("span", { className: "rs-amount-detail-value", children: [
|
|
3216
|
+
/* @__PURE__ */ jsxs12("span", { children: [
|
|
2533
3217
|
targetChainName,
|
|
2534
3218
|
" ",
|
|
2535
3219
|
targetTokenSymbol
|
|
2536
3220
|
] }),
|
|
2537
|
-
targetTokenIcon && /* @__PURE__ */
|
|
3221
|
+
targetTokenIcon && /* @__PURE__ */ jsx14("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx14("img", { src: targetTokenIcon, alt: "" }) })
|
|
2538
3222
|
] })
|
|
2539
3223
|
] }),
|
|
2540
|
-
balanceAfterUsd !== null && /* @__PURE__ */
|
|
2541
|
-
/* @__PURE__ */
|
|
2542
|
-
/* @__PURE__ */
|
|
3224
|
+
balanceAfterUsd !== null && /* @__PURE__ */ jsxs12("div", { className: "rs-amount-detail-row", children: [
|
|
3225
|
+
/* @__PURE__ */ jsx14("span", { children: "Balance after deposit" }),
|
|
3226
|
+
/* @__PURE__ */ jsx14("span", { className: "rs-amount-detail-value", children: currencyFormatter.format(balanceAfterUsd) })
|
|
2543
3227
|
] })
|
|
2544
3228
|
] }),
|
|
2545
|
-
error && /* @__PURE__ */
|
|
2546
|
-
/* @__PURE__ */
|
|
3229
|
+
error && /* @__PURE__ */ jsx14(Callout, { variant: "error", children: error }),
|
|
3230
|
+
/* @__PURE__ */ jsx14(
|
|
2547
3231
|
Button,
|
|
2548
3232
|
{
|
|
2549
3233
|
onClick: handleContinue,
|
|
@@ -2553,12 +3237,12 @@ function SolanaAmountStep({
|
|
|
2553
3237
|
}
|
|
2554
3238
|
)
|
|
2555
3239
|
] }),
|
|
2556
|
-
/* @__PURE__ */
|
|
3240
|
+
/* @__PURE__ */ jsx14(PoweredBy, {})
|
|
2557
3241
|
] });
|
|
2558
3242
|
}
|
|
2559
3243
|
|
|
2560
3244
|
// src/components/steps/SolanaConfirmStep.tsx
|
|
2561
|
-
import { useState as
|
|
3245
|
+
import { useState as useState10 } from "react";
|
|
2562
3246
|
import { parseUnits as parseUnits4 } from "viem";
|
|
2563
3247
|
|
|
2564
3248
|
// src/core/solana.ts
|
|
@@ -2666,7 +3350,7 @@ async function sendSolanaTransaction(provider, _connection, transaction) {
|
|
|
2666
3350
|
}
|
|
2667
3351
|
|
|
2668
3352
|
// src/components/steps/SolanaConfirmStep.tsx
|
|
2669
|
-
import { jsx as
|
|
3353
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2670
3354
|
function SolanaConfirmStep({
|
|
2671
3355
|
smartAccount,
|
|
2672
3356
|
solanaAddress,
|
|
@@ -2687,8 +3371,8 @@ function SolanaConfirmStep({
|
|
|
2687
3371
|
onError,
|
|
2688
3372
|
debug
|
|
2689
3373
|
}) {
|
|
2690
|
-
const [isSubmitting, setIsSubmitting] =
|
|
2691
|
-
const [error, setError] =
|
|
3374
|
+
const [isSubmitting, setIsSubmitting] = useState10(false);
|
|
3375
|
+
const [error, setError] = useState10(null);
|
|
2692
3376
|
const targetSymbol = getTargetTokenSymbol(targetToken, targetChain);
|
|
2693
3377
|
const isSameToken = token.symbol.toUpperCase() === targetSymbol.toUpperCase();
|
|
2694
3378
|
const sourceChainName = getChainName("solana");
|
|
@@ -2807,66 +3491,66 @@ function SolanaConfirmStep({
|
|
|
2807
3491
|
setIsSubmitting(false);
|
|
2808
3492
|
}
|
|
2809
3493
|
};
|
|
2810
|
-
return /* @__PURE__ */
|
|
2811
|
-
/* @__PURE__ */
|
|
2812
|
-
/* @__PURE__ */
|
|
2813
|
-
/* @__PURE__ */
|
|
2814
|
-
/* @__PURE__ */
|
|
2815
|
-
/* @__PURE__ */
|
|
2816
|
-
/* @__PURE__ */
|
|
2817
|
-
/* @__PURE__ */
|
|
2818
|
-
sourceChainIcon && /* @__PURE__ */
|
|
3494
|
+
return /* @__PURE__ */ jsxs13("div", { className: "rs-screen", children: [
|
|
3495
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
3496
|
+
/* @__PURE__ */ jsx15(BodyHeader, { icon: /* @__PURE__ */ jsx15(WalletIcon, {}), title: "Review deposit" }),
|
|
3497
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-details", children: [
|
|
3498
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
|
|
3499
|
+
/* @__PURE__ */ jsx15("span", { children: "Source chain" }),
|
|
3500
|
+
/* @__PURE__ */ jsxs13("span", { className: "rs-review-detail-value", children: [
|
|
3501
|
+
/* @__PURE__ */ jsx15("span", { children: sourceChainName }),
|
|
3502
|
+
sourceChainIcon && /* @__PURE__ */ jsx15("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx15("img", { src: sourceChainIcon, alt: "" }) })
|
|
2819
3503
|
] })
|
|
2820
3504
|
] }),
|
|
2821
|
-
/* @__PURE__ */
|
|
2822
|
-
/* @__PURE__ */
|
|
2823
|
-
/* @__PURE__ */
|
|
2824
|
-
/* @__PURE__ */
|
|
2825
|
-
targetChainIcon && /* @__PURE__ */
|
|
3505
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
|
|
3506
|
+
/* @__PURE__ */ jsx15("span", { children: "Destination chain" }),
|
|
3507
|
+
/* @__PURE__ */ jsxs13("span", { className: "rs-review-detail-value", children: [
|
|
3508
|
+
/* @__PURE__ */ jsx15("span", { children: targetChainName }),
|
|
3509
|
+
targetChainIcon && /* @__PURE__ */ jsx15("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx15("img", { src: targetChainIcon, alt: "" }) })
|
|
2826
3510
|
] })
|
|
2827
3511
|
] }),
|
|
2828
|
-
/* @__PURE__ */
|
|
2829
|
-
/* @__PURE__ */
|
|
2830
|
-
/* @__PURE__ */
|
|
3512
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
|
|
3513
|
+
/* @__PURE__ */ jsx15("span", { children: "Estimated time" }),
|
|
3514
|
+
/* @__PURE__ */ jsx15("span", { className: "rs-review-detail-value", children: estimatedTime })
|
|
2831
3515
|
] }),
|
|
2832
|
-
/* @__PURE__ */
|
|
2833
|
-
/* @__PURE__ */
|
|
2834
|
-
/* @__PURE__ */
|
|
2835
|
-
/* @__PURE__ */
|
|
3516
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
|
|
3517
|
+
/* @__PURE__ */ jsx15("span", { children: "You send" }),
|
|
3518
|
+
/* @__PURE__ */ jsxs13("span", { className: "rs-review-detail-value", children: [
|
|
3519
|
+
/* @__PURE__ */ jsxs13("span", { children: [
|
|
2836
3520
|
formattedAmount,
|
|
2837
3521
|
" ",
|
|
2838
3522
|
token.symbol
|
|
2839
3523
|
] }),
|
|
2840
|
-
sourceTokenIcon && /* @__PURE__ */
|
|
3524
|
+
sourceTokenIcon && /* @__PURE__ */ jsx15("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx15("img", { src: sourceTokenIcon, alt: "" }) })
|
|
2841
3525
|
] })
|
|
2842
3526
|
] }),
|
|
2843
|
-
/* @__PURE__ */
|
|
2844
|
-
/* @__PURE__ */
|
|
2845
|
-
/* @__PURE__ */
|
|
2846
|
-
/* @__PURE__ */
|
|
3527
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
|
|
3528
|
+
/* @__PURE__ */ jsx15("span", { children: "Receive" }),
|
|
3529
|
+
/* @__PURE__ */ jsxs13("span", { className: "rs-review-detail-value", children: [
|
|
3530
|
+
/* @__PURE__ */ jsxs13("span", { children: [
|
|
2847
3531
|
receiveAmount,
|
|
2848
3532
|
" ",
|
|
2849
3533
|
targetSymbol
|
|
2850
3534
|
] }),
|
|
2851
|
-
targetTokenIcon && /* @__PURE__ */
|
|
3535
|
+
targetTokenIcon && /* @__PURE__ */ jsx15("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx15("img", { src: targetTokenIcon, alt: "" }) })
|
|
2852
3536
|
] })
|
|
2853
3537
|
] }),
|
|
2854
|
-
/* @__PURE__ */
|
|
2855
|
-
/* @__PURE__ */
|
|
2856
|
-
/* @__PURE__ */
|
|
2857
|
-
/* @__PURE__ */
|
|
3538
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
|
|
3539
|
+
/* @__PURE__ */ jsx15("span", { children: "Fees" }),
|
|
3540
|
+
/* @__PURE__ */ jsxs13("span", { className: "rs-review-detail-value", children: [
|
|
3541
|
+
/* @__PURE__ */ jsx15(
|
|
2858
3542
|
"span",
|
|
2859
3543
|
{
|
|
2860
3544
|
style: feeSponsored ? { textDecoration: "line-through" } : void 0,
|
|
2861
3545
|
children: "$0.04"
|
|
2862
3546
|
}
|
|
2863
3547
|
),
|
|
2864
|
-
/* @__PURE__ */
|
|
3548
|
+
/* @__PURE__ */ jsx15(Tooltip, { content: feeTooltip, children: /* @__PURE__ */ jsx15("span", { className: "rs-review-detail-info", "aria-label": "Fee info", children: /* @__PURE__ */ jsx15(InfoIcon, {}) }) })
|
|
2865
3549
|
] })
|
|
2866
3550
|
] })
|
|
2867
3551
|
] }),
|
|
2868
|
-
error && /* @__PURE__ */
|
|
2869
|
-
/* @__PURE__ */
|
|
3552
|
+
error && /* @__PURE__ */ jsx15(Callout, { variant: "error", children: error }),
|
|
3553
|
+
/* @__PURE__ */ jsx15(
|
|
2870
3554
|
Button,
|
|
2871
3555
|
{
|
|
2872
3556
|
onClick: handleConfirm,
|
|
@@ -2878,28 +3562,28 @@ function SolanaConfirmStep({
|
|
|
2878
3562
|
}
|
|
2879
3563
|
)
|
|
2880
3564
|
] }),
|
|
2881
|
-
/* @__PURE__ */
|
|
3565
|
+
/* @__PURE__ */ jsx15(PoweredBy, {})
|
|
2882
3566
|
] });
|
|
2883
3567
|
}
|
|
2884
3568
|
|
|
2885
3569
|
// src/components/steps/DappImportAssetSelectStep.tsx
|
|
2886
|
-
import { jsx as
|
|
3570
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2887
3571
|
function DappImportAssetSelectStep({
|
|
2888
3572
|
sourceLabel,
|
|
2889
3573
|
assets,
|
|
2890
3574
|
onSelect
|
|
2891
3575
|
}) {
|
|
2892
|
-
return /* @__PURE__ */
|
|
2893
|
-
/* @__PURE__ */
|
|
2894
|
-
/* @__PURE__ */
|
|
3576
|
+
return /* @__PURE__ */ jsxs14("div", { className: "rs-screen", children: [
|
|
3577
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
3578
|
+
/* @__PURE__ */ jsx16(
|
|
2895
3579
|
BodyHeader,
|
|
2896
3580
|
{
|
|
2897
|
-
icon: /* @__PURE__ */
|
|
3581
|
+
icon: /* @__PURE__ */ jsx16(WalletIcon, {}),
|
|
2898
3582
|
title: `Transfer from ${sourceLabel}`,
|
|
2899
3583
|
subtitle: "Pick the balance to import"
|
|
2900
3584
|
}
|
|
2901
3585
|
),
|
|
2902
|
-
/* @__PURE__ */
|
|
3586
|
+
/* @__PURE__ */ jsx16("div", { className: "rs-asset-list", children: assets.map((asset) => {
|
|
2903
3587
|
const tokenAmount = asset.balance ? tokenFormatter.format(
|
|
2904
3588
|
Number(asset.balance) / 10 ** asset.decimals
|
|
2905
3589
|
) : "0";
|
|
@@ -2907,23 +3591,23 @@ function DappImportAssetSelectStep({
|
|
|
2907
3591
|
const tokenIcon = asset.icon ?? getTokenIcon(asset.symbol);
|
|
2908
3592
|
const chainIcon = getChainIcon(asset.chainId);
|
|
2909
3593
|
const badge = getChainBadge(asset.chainId);
|
|
2910
|
-
return /* @__PURE__ */
|
|
3594
|
+
return /* @__PURE__ */ jsxs14(
|
|
2911
3595
|
"button",
|
|
2912
3596
|
{
|
|
2913
3597
|
type: "button",
|
|
2914
3598
|
className: "rs-asset-row",
|
|
2915
3599
|
onClick: () => onSelect(asset),
|
|
2916
3600
|
children: [
|
|
2917
|
-
/* @__PURE__ */
|
|
2918
|
-
/* @__PURE__ */
|
|
2919
|
-
/* @__PURE__ */
|
|
2920
|
-
chainIcon ? /* @__PURE__ */
|
|
3601
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-asset-info", children: [
|
|
3602
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-asset-icon-wrapper", children: [
|
|
3603
|
+
/* @__PURE__ */ jsx16("span", { className: "rs-asset-icon", children: tokenIcon ? /* @__PURE__ */ jsx16("img", { src: tokenIcon, alt: asset.symbol }) : asset.symbol.slice(0, 4) }),
|
|
3604
|
+
chainIcon ? /* @__PURE__ */ jsx16("span", { className: "rs-asset-chain-badge", children: /* @__PURE__ */ jsx16(
|
|
2921
3605
|
"img",
|
|
2922
3606
|
{
|
|
2923
3607
|
src: chainIcon,
|
|
2924
3608
|
alt: getChainName(asset.chainId)
|
|
2925
3609
|
}
|
|
2926
|
-
) }) : /* @__PURE__ */
|
|
3610
|
+
) }) : /* @__PURE__ */ jsx16(
|
|
2927
3611
|
"span",
|
|
2928
3612
|
{
|
|
2929
3613
|
className: "rs-asset-chain-badge",
|
|
@@ -2932,29 +3616,29 @@ function DappImportAssetSelectStep({
|
|
|
2932
3616
|
}
|
|
2933
3617
|
)
|
|
2934
3618
|
] }),
|
|
2935
|
-
/* @__PURE__ */
|
|
2936
|
-
/* @__PURE__ */
|
|
2937
|
-
/* @__PURE__ */
|
|
2938
|
-
/* @__PURE__ */
|
|
3619
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-asset-text", children: [
|
|
3620
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-asset-name-row", children: [
|
|
3621
|
+
/* @__PURE__ */ jsx16("span", { className: "rs-asset-name", children: asset.symbol }),
|
|
3622
|
+
/* @__PURE__ */ jsxs14("span", { className: "rs-asset-chain", children: [
|
|
2939
3623
|
"on ",
|
|
2940
3624
|
asset.sourceLabel
|
|
2941
3625
|
] })
|
|
2942
3626
|
] }),
|
|
2943
|
-
/* @__PURE__ */
|
|
3627
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-asset-balance-small", children: [
|
|
2944
3628
|
tokenAmount,
|
|
2945
3629
|
" ",
|
|
2946
3630
|
asset.symbol
|
|
2947
3631
|
] })
|
|
2948
3632
|
] })
|
|
2949
3633
|
] }),
|
|
2950
|
-
/* @__PURE__ */
|
|
3634
|
+
/* @__PURE__ */ jsx16("div", { className: "rs-asset-balance", children: balanceUsd })
|
|
2951
3635
|
]
|
|
2952
3636
|
},
|
|
2953
3637
|
asset.id
|
|
2954
3638
|
);
|
|
2955
3639
|
}) })
|
|
2956
3640
|
] }),
|
|
2957
|
-
/* @__PURE__ */
|
|
3641
|
+
/* @__PURE__ */ jsx16(PoweredBy, {})
|
|
2958
3642
|
] });
|
|
2959
3643
|
}
|
|
2960
3644
|
DappImportAssetSelectStep.displayName = "DappImportAssetSelectStep";
|
|
@@ -3569,8 +4253,19 @@ function applyBack(state, hasWalletOptions) {
|
|
|
3569
4253
|
},
|
|
3570
4254
|
flow: { ...state.flow, step: "solana-amount", hasNavigatedBack: true }
|
|
3571
4255
|
};
|
|
4256
|
+
case "exchange-connect":
|
|
4257
|
+
return {
|
|
4258
|
+
...state,
|
|
4259
|
+
flow: {
|
|
4260
|
+
...state.flow,
|
|
4261
|
+
step: "exchange-select",
|
|
4262
|
+
hasNavigatedBack: true
|
|
4263
|
+
}
|
|
4264
|
+
};
|
|
3572
4265
|
case "select-asset":
|
|
3573
4266
|
case "deposit-address":
|
|
4267
|
+
case "fiat-onramp":
|
|
4268
|
+
case "exchange-select":
|
|
3574
4269
|
case "solana-token-select":
|
|
3575
4270
|
case "dapp-import-asset-select":
|
|
3576
4271
|
return {
|
|
@@ -3587,7 +4282,8 @@ function applyBack(state, hasWalletOptions) {
|
|
|
3587
4282
|
...state.dappImport,
|
|
3588
4283
|
activeProviderId: null,
|
|
3589
4284
|
selectedAsset: null
|
|
3590
|
-
}
|
|
4285
|
+
},
|
|
4286
|
+
exchange: { selectedConnection: null }
|
|
3591
4287
|
};
|
|
3592
4288
|
case "connect":
|
|
3593
4289
|
case "setup":
|
|
@@ -3600,7 +4296,8 @@ function applyBack(state, hasWalletOptions) {
|
|
|
3600
4296
|
mode: null,
|
|
3601
4297
|
isConnectSelectionConfirmed: false,
|
|
3602
4298
|
hasNavigatedBack: hasWalletOptions || state.flow.hasNavigatedBack
|
|
3603
|
-
}
|
|
4299
|
+
},
|
|
4300
|
+
exchange: { selectedConnection: null }
|
|
3604
4301
|
};
|
|
3605
4302
|
}
|
|
3606
4303
|
return state;
|
|
@@ -3620,6 +4317,10 @@ function modeEntryStep(mode) {
|
|
|
3620
4317
|
return "solana-token-select";
|
|
3621
4318
|
case "dapp-import":
|
|
3622
4319
|
return "dapp-import-asset-select";
|
|
4320
|
+
case "fiat-onramp":
|
|
4321
|
+
return "fiat-onramp";
|
|
4322
|
+
case "exchange-connect":
|
|
4323
|
+
return "exchange-select";
|
|
3623
4324
|
}
|
|
3624
4325
|
}
|
|
3625
4326
|
function updateSetupEntry(state, owner, update) {
|
|
@@ -3665,7 +4366,8 @@ function applyAction(state, action) {
|
|
|
3665
4366
|
...state.dappImport,
|
|
3666
4367
|
activeProviderId: null,
|
|
3667
4368
|
selectedAsset: null
|
|
3668
|
-
}
|
|
4369
|
+
},
|
|
4370
|
+
exchange: { selectedConnection: null }
|
|
3669
4371
|
};
|
|
3670
4372
|
case "connect/wallet-confirmed":
|
|
3671
4373
|
if (!action.mode) return state;
|
|
@@ -3689,6 +4391,39 @@ function applyAction(state, action) {
|
|
|
3689
4391
|
step: "deposit-address"
|
|
3690
4392
|
}
|
|
3691
4393
|
};
|
|
4394
|
+
case "connect/fiat-onramp-selected":
|
|
4395
|
+
return {
|
|
4396
|
+
...state,
|
|
4397
|
+
flow: {
|
|
4398
|
+
...state.flow,
|
|
4399
|
+
mode: "fiat-onramp",
|
|
4400
|
+
isConnectSelectionConfirmed: true,
|
|
4401
|
+
step: modeEntryStep("fiat-onramp")
|
|
4402
|
+
},
|
|
4403
|
+
fiat: { ...state.fiat, selectedMethod: action.paymentMethod ?? null }
|
|
4404
|
+
};
|
|
4405
|
+
case "connect/exchange-selected":
|
|
4406
|
+
return {
|
|
4407
|
+
...state,
|
|
4408
|
+
flow: {
|
|
4409
|
+
...state.flow,
|
|
4410
|
+
mode: "exchange-connect",
|
|
4411
|
+
isConnectSelectionConfirmed: true,
|
|
4412
|
+
step: modeEntryStep("exchange-connect")
|
|
4413
|
+
},
|
|
4414
|
+
exchange: { selectedConnection: null }
|
|
4415
|
+
};
|
|
4416
|
+
case "exchange/connection-selected":
|
|
4417
|
+
return {
|
|
4418
|
+
...state,
|
|
4419
|
+
flow: {
|
|
4420
|
+
...state.flow,
|
|
4421
|
+
mode: "exchange-connect",
|
|
4422
|
+
isConnectSelectionConfirmed: true,
|
|
4423
|
+
step: "exchange-connect"
|
|
4424
|
+
},
|
|
4425
|
+
exchange: { selectedConnection: action.connection }
|
|
4426
|
+
};
|
|
3692
4427
|
case "connect/auto-locked":
|
|
3693
4428
|
return {
|
|
3694
4429
|
...state,
|
|
@@ -3714,7 +4449,8 @@ function applyAction(state, action) {
|
|
|
3714
4449
|
...state.dappImport,
|
|
3715
4450
|
activeProviderId: null,
|
|
3716
4451
|
selectedAsset: null
|
|
3717
|
-
}
|
|
4452
|
+
},
|
|
4453
|
+
exchange: { selectedConnection: null }
|
|
3718
4454
|
};
|
|
3719
4455
|
case "setup/started": {
|
|
3720
4456
|
const existing = state.setup.byOwner[ownerKey(action.owner)];
|
|
@@ -3949,7 +4685,9 @@ function applyAction(state, action) {
|
|
|
3949
4685
|
activeProviderId: null,
|
|
3950
4686
|
selectedAsset: null
|
|
3951
4687
|
},
|
|
3952
|
-
setup: { byOwner: preservedByOwner }
|
|
4688
|
+
setup: { byOwner: preservedByOwner },
|
|
4689
|
+
fiat: { selectedMethod: null },
|
|
4690
|
+
exchange: { selectedConnection: null }
|
|
3953
4691
|
};
|
|
3954
4692
|
}
|
|
3955
4693
|
case "target/changed": {
|
|
@@ -4023,6 +4761,12 @@ function createInitialState(overrides) {
|
|
|
4023
4761
|
},
|
|
4024
4762
|
setup: {
|
|
4025
4763
|
byOwner: {}
|
|
4764
|
+
},
|
|
4765
|
+
fiat: {
|
|
4766
|
+
selectedMethod: null
|
|
4767
|
+
},
|
|
4768
|
+
exchange: {
|
|
4769
|
+
selectedConnection: null
|
|
4026
4770
|
}
|
|
4027
4771
|
};
|
|
4028
4772
|
}
|
|
@@ -4325,23 +5069,23 @@ function mapError(error) {
|
|
|
4325
5069
|
}
|
|
4326
5070
|
|
|
4327
5071
|
// src/DepositFlow.tsx
|
|
4328
|
-
import { Fragment as Fragment3, jsx as
|
|
5072
|
+
import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4329
5073
|
function AccountPreparingSkeleton({
|
|
4330
5074
|
errorMessage,
|
|
4331
5075
|
onRetry
|
|
4332
5076
|
}) {
|
|
4333
|
-
return /* @__PURE__ */
|
|
4334
|
-
/* @__PURE__ */
|
|
4335
|
-
/* @__PURE__ */
|
|
4336
|
-
/* @__PURE__ */
|
|
4337
|
-
] }) : /* @__PURE__ */
|
|
4338
|
-
errorMessage && onRetry && /* @__PURE__ */
|
|
5077
|
+
return /* @__PURE__ */ jsxs15("div", { className: "rs-step", children: [
|
|
5078
|
+
/* @__PURE__ */ jsx17("div", { className: "rs-step-body", style: { paddingTop: 0 }, children: /* @__PURE__ */ jsx17("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsx17("div", { className: "rs-loading-text", children: errorMessage ? /* @__PURE__ */ jsxs15(Fragment3, { children: [
|
|
5079
|
+
/* @__PURE__ */ jsx17("div", { className: "rs-loading-title rs-text-error", children: "Couldn\u2019t prepare account" }),
|
|
5080
|
+
/* @__PURE__ */ jsx17("div", { className: "rs-loading-subtitle", children: errorMessage })
|
|
5081
|
+
] }) : /* @__PURE__ */ jsx17("div", { className: "rs-loading-title", children: "Preparing\u2026" }) }) }) }),
|
|
5082
|
+
errorMessage && onRetry && /* @__PURE__ */ jsx17("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx17(
|
|
4339
5083
|
"button",
|
|
4340
5084
|
{
|
|
4341
5085
|
type: "button",
|
|
4342
5086
|
className: "rs-button rs-button--default rs-button--full-width",
|
|
4343
5087
|
onClick: onRetry,
|
|
4344
|
-
children: /* @__PURE__ */
|
|
5088
|
+
children: /* @__PURE__ */ jsx17("span", { children: "Try again" })
|
|
4345
5089
|
}
|
|
4346
5090
|
) })
|
|
4347
5091
|
] });
|
|
@@ -4350,10 +5094,12 @@ var QR_AUTO_ADVANCE_HYDRATION_GRACE_MS = 1e3;
|
|
|
4350
5094
|
function isSameRoute2(sourceChain, sourceToken, targetChain, targetToken) {
|
|
4351
5095
|
return sourceChain === targetChain && sourceToken.toLowerCase() === targetToken.toLowerCase();
|
|
4352
5096
|
}
|
|
5097
|
+
var SWAPPED_SOURCE_CHAIN = 8453;
|
|
5098
|
+
var SWAPPED_SOURCE_TOKEN = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
4353
5099
|
function getAddressKey(address) {
|
|
4354
5100
|
return address ? address.toLowerCase() : null;
|
|
4355
5101
|
}
|
|
4356
|
-
function deriveStep(flow, d, p, activeEntry) {
|
|
5102
|
+
function deriveStep(flow, d, p, activeEntry, fiat, exchange) {
|
|
4357
5103
|
const flowStep = flow.step;
|
|
4358
5104
|
const smartAccount = activeEntry.smartAccount;
|
|
4359
5105
|
const solanaDepositAddress = activeEntry.solanaDepositAddress;
|
|
@@ -4368,6 +5114,23 @@ function deriveStep(flow, d, p, activeEntry) {
|
|
|
4368
5114
|
smartAccount,
|
|
4369
5115
|
solanaDepositAddress: solanaDepositAddress ?? void 0
|
|
4370
5116
|
};
|
|
5117
|
+
case "fiat-onramp":
|
|
5118
|
+
if (!smartAccount) return { type: "setup" };
|
|
5119
|
+
return {
|
|
5120
|
+
type: "fiat-onramp",
|
|
5121
|
+
smartAccount,
|
|
5122
|
+
paymentMethod: fiat.selectedMethod ?? void 0
|
|
5123
|
+
};
|
|
5124
|
+
case "exchange-select":
|
|
5125
|
+
return { type: "exchange-select" };
|
|
5126
|
+
case "exchange-connect":
|
|
5127
|
+
if (!exchange.selectedConnection) return { type: "exchange-select" };
|
|
5128
|
+
if (!smartAccount) return { type: "setup" };
|
|
5129
|
+
return {
|
|
5130
|
+
type: "exchange-connect",
|
|
5131
|
+
smartAccount,
|
|
5132
|
+
connection: exchange.selectedConnection
|
|
5133
|
+
};
|
|
4371
5134
|
case "select-asset":
|
|
4372
5135
|
if (!smartAccount) return { type: "setup" };
|
|
4373
5136
|
return { type: "select-asset", smartAccount };
|
|
@@ -4456,6 +5219,8 @@ function resolveOwnerForMode(mode, ctx) {
|
|
|
4456
5219
|
switch (mode) {
|
|
4457
5220
|
case "deposit-address":
|
|
4458
5221
|
case "solana-wallet":
|
|
5222
|
+
case "fiat-onramp":
|
|
5223
|
+
case "exchange-connect":
|
|
4459
5224
|
return ctx.dappAddress ?? null;
|
|
4460
5225
|
case "wallet":
|
|
4461
5226
|
return ctx.walletOwner ?? null;
|
|
@@ -4486,6 +5251,10 @@ function DepositFlow({
|
|
|
4486
5251
|
forceRegister = false,
|
|
4487
5252
|
enableSolana = true,
|
|
4488
5253
|
dappImports,
|
|
5254
|
+
enableFiatOnramp = false,
|
|
5255
|
+
enableQrTransfer = true,
|
|
5256
|
+
fiatOnrampMethods,
|
|
5257
|
+
enableExchangeConnect = false,
|
|
4489
5258
|
reownWallet,
|
|
4490
5259
|
onConnect,
|
|
4491
5260
|
onDisconnect,
|
|
@@ -4514,31 +5283,33 @@ function DepositFlow({
|
|
|
4514
5283
|
const depositSlice = useDepositStore((s) => s.deposit);
|
|
4515
5284
|
const processingSlice = useDepositStore((s) => s.processing);
|
|
4516
5285
|
const setupSlice = useDepositStore((s) => s.setup);
|
|
5286
|
+
const fiatSlice = useDepositStore((s) => s.fiat);
|
|
5287
|
+
const exchangeSlice = useDepositStore((s) => s.exchange);
|
|
4517
5288
|
const flowMode = flowSlice.mode;
|
|
4518
5289
|
const isConnectSelectionConfirmed = flowSlice.isConnectSelectionConfirmed;
|
|
4519
5290
|
const hasNavigatedBack = flowSlice.hasNavigatedBack;
|
|
4520
5291
|
const selectedWalletId = useDepositStore(selectedWalletIdSelector);
|
|
4521
|
-
const [totalBalanceUsd, setTotalBalanceUsd] =
|
|
4522
|
-
const [hasQrAutoAdvanceGraceElapsed, setHasQrAutoAdvanceGraceElapsed] =
|
|
4523
|
-
const portfolioAssetsRef =
|
|
4524
|
-
const stableWalletSignerRef =
|
|
4525
|
-
const stableWalletSelectionKeyRef =
|
|
4526
|
-
const logFlow =
|
|
5292
|
+
const [totalBalanceUsd, setTotalBalanceUsd] = useState11(0);
|
|
5293
|
+
const [hasQrAutoAdvanceGraceElapsed, setHasQrAutoAdvanceGraceElapsed] = useState11(() => !hasInitialWalletHydrationPending);
|
|
5294
|
+
const portfolioAssetsRef = useRef8([]);
|
|
5295
|
+
const stableWalletSignerRef = useRef8(null);
|
|
5296
|
+
const stableWalletSelectionKeyRef = useRef8(null);
|
|
5297
|
+
const logFlow = useCallback7(
|
|
4527
5298
|
(message, data) => {
|
|
4528
5299
|
debugLog(debug, "deposit-flow", message, data);
|
|
4529
5300
|
},
|
|
4530
5301
|
[debug]
|
|
4531
5302
|
);
|
|
4532
|
-
const logFlowError =
|
|
5303
|
+
const logFlowError = useCallback7(
|
|
4533
5304
|
(message, error, data) => {
|
|
4534
5305
|
debugError(debug, "deposit-flow", message, error, data);
|
|
4535
5306
|
},
|
|
4536
5307
|
[debug]
|
|
4537
5308
|
);
|
|
4538
|
-
const handleAssetsLoaded =
|
|
5309
|
+
const handleAssetsLoaded = useCallback7((assets) => {
|
|
4539
5310
|
portfolioAssetsRef.current = assets;
|
|
4540
5311
|
}, []);
|
|
4541
|
-
const getTokenPriceUsd =
|
|
5312
|
+
const getTokenPriceUsd = useCallback7((symbol) => {
|
|
4542
5313
|
const sym = symbol.toLowerCase();
|
|
4543
5314
|
for (const asset of portfolioAssetsRef.current) {
|
|
4544
5315
|
if (asset.symbol.toLowerCase() === sym && asset.balanceUsd && asset.balance) {
|
|
@@ -4553,14 +5324,14 @@ function DepositFlow({
|
|
|
4553
5324
|
}
|
|
4554
5325
|
return null;
|
|
4555
5326
|
}, []);
|
|
4556
|
-
const dappSwitchChain =
|
|
5327
|
+
const dappSwitchChain = useMemo7(() => {
|
|
4557
5328
|
if (!dappWalletClient?.switchChain) return void 0;
|
|
4558
5329
|
return async (chainId) => {
|
|
4559
5330
|
await dappWalletClient.switchChain?.({ id: chainId });
|
|
4560
5331
|
};
|
|
4561
5332
|
}, [dappWalletClient]);
|
|
4562
5333
|
const connectedWalletAddress = dappWalletClient?.account?.address ?? null;
|
|
4563
|
-
const walletOptions =
|
|
5334
|
+
const walletOptions = useMemo7(() => {
|
|
4564
5335
|
const options = [];
|
|
4565
5336
|
const seen = /* @__PURE__ */ new Set();
|
|
4566
5337
|
if (connectedWalletAddress && dappAddress) {
|
|
@@ -4612,7 +5383,7 @@ function DepositFlow({
|
|
|
4612
5383
|
reownWallet?.solanaAddress,
|
|
4613
5384
|
reownWallet?.caipAddress
|
|
4614
5385
|
]);
|
|
4615
|
-
const canAutoLock = dappWalletClient?.account && dappAddress && !reownWallet;
|
|
5386
|
+
const canAutoLock = dappWalletClient?.account && dappAddress && !reownWallet && !enableFiatOnramp && !enableExchangeConnect;
|
|
4616
5387
|
const hasWalletOptions = walletOptions.length > 0;
|
|
4617
5388
|
const hasReownSession = Boolean(
|
|
4618
5389
|
enableSolana ? reownWallet?.isConnected || reownWallet?.address : reownWallet?.address
|
|
@@ -4621,7 +5392,7 @@ function DepositFlow({
|
|
|
4621
5392
|
dappAddress && !hasWalletOptions && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasReownSession && !reownWallet.isReady)
|
|
4622
5393
|
);
|
|
4623
5394
|
const showConnectStep = flowMode === null && !isConnectSelectionConfirmed;
|
|
4624
|
-
|
|
5395
|
+
useEffect10(() => {
|
|
4625
5396
|
if (!isWalletHydrationPending) {
|
|
4626
5397
|
setHasQrAutoAdvanceGraceElapsed(true);
|
|
4627
5398
|
return;
|
|
@@ -4632,7 +5403,7 @@ function DepositFlow({
|
|
|
4632
5403
|
}, QR_AUTO_ADVANCE_HYDRATION_GRACE_MS);
|
|
4633
5404
|
return () => window.clearTimeout(timeout);
|
|
4634
5405
|
}, [isWalletHydrationPending]);
|
|
4635
|
-
const walletSelectionKey =
|
|
5406
|
+
const walletSelectionKey = useMemo7(() => {
|
|
4636
5407
|
if (flowMode !== "wallet" && flowMode !== "dapp-import") return null;
|
|
4637
5408
|
if (canAutoLock) {
|
|
4638
5409
|
return getAddressKey(connectedWalletAddress);
|
|
@@ -4649,8 +5420,8 @@ function DepositFlow({
|
|
|
4649
5420
|
const setupChainId = typeof targetChain === "number" ? targetChain : typeof defaultSourceChain === "number" ? defaultSourceChain : base.id;
|
|
4650
5421
|
const targetSymbol = getTargetTokenSymbol(targetToken, targetChain);
|
|
4651
5422
|
const isTargetStablecoin = isStablecoinSymbol(targetSymbol);
|
|
4652
|
-
const targetMarketPriceRef =
|
|
4653
|
-
|
|
5423
|
+
const targetMarketPriceRef = useRef8(null);
|
|
5424
|
+
useEffect10(() => {
|
|
4654
5425
|
targetMarketPriceRef.current = null;
|
|
4655
5426
|
if (isTargetStablecoin || targetSymbol === "Token") {
|
|
4656
5427
|
return;
|
|
@@ -4665,7 +5436,7 @@ function DepositFlow({
|
|
|
4665
5436
|
cancelled = true;
|
|
4666
5437
|
};
|
|
4667
5438
|
}, [service, targetSymbol, isTargetStablecoin]);
|
|
4668
|
-
const walletSignerContext =
|
|
5439
|
+
const walletSignerContext = useMemo7(() => {
|
|
4669
5440
|
if (flowMode === "deposit-address") {
|
|
4670
5441
|
return null;
|
|
4671
5442
|
}
|
|
@@ -4731,7 +5502,7 @@ function DepositFlow({
|
|
|
4731
5502
|
reownWallet,
|
|
4732
5503
|
setupChainId
|
|
4733
5504
|
]);
|
|
4734
|
-
|
|
5505
|
+
useEffect10(() => {
|
|
4735
5506
|
if (flowMode !== "wallet" && flowMode !== "dapp-import") {
|
|
4736
5507
|
stableWalletSelectionKeyRef.current = null;
|
|
4737
5508
|
stableWalletSignerRef.current = null;
|
|
@@ -4746,7 +5517,7 @@ function DepositFlow({
|
|
|
4746
5517
|
stableWalletSignerRef.current = walletSignerContext;
|
|
4747
5518
|
}
|
|
4748
5519
|
}, [flowMode, walletSelectionKey, walletSignerContext]);
|
|
4749
|
-
const signerContext =
|
|
5520
|
+
const signerContext = useMemo7(() => {
|
|
4750
5521
|
if (flowMode === "deposit-address") {
|
|
4751
5522
|
if (!dappAddress) return null;
|
|
4752
5523
|
return {
|
|
@@ -4774,7 +5545,7 @@ function DepositFlow({
|
|
|
4774
5545
|
walletSignerContext,
|
|
4775
5546
|
walletSelectionKey
|
|
4776
5547
|
]);
|
|
4777
|
-
const selectedEvmWalletOwner =
|
|
5548
|
+
const selectedEvmWalletOwner = useMemo7(() => {
|
|
4778
5549
|
if (!selectedWalletId) return null;
|
|
4779
5550
|
const opt = walletOptions.find((o) => o.id === selectedWalletId);
|
|
4780
5551
|
if (opt?.kind === "external" && opt.address) {
|
|
@@ -4785,7 +5556,7 @@ function DepositFlow({
|
|
|
4785
5556
|
}
|
|
4786
5557
|
return null;
|
|
4787
5558
|
}, [selectedWalletId, walletOptions]);
|
|
4788
|
-
const dappImportOwner =
|
|
5559
|
+
const dappImportOwner = useMemo7(() => {
|
|
4789
5560
|
if (selectedEvmWalletOwner) return selectedEvmWalletOwner;
|
|
4790
5561
|
if (reownWallet?.address && reownWallet.isConnected) {
|
|
4791
5562
|
return reownWallet.address;
|
|
@@ -4798,7 +5569,7 @@ function DepositFlow({
|
|
|
4798
5569
|
reownWallet?.isConnected,
|
|
4799
5570
|
connectedWalletAddress
|
|
4800
5571
|
]);
|
|
4801
|
-
const activeOwner =
|
|
5572
|
+
const activeOwner = useMemo7(
|
|
4802
5573
|
() => resolveOwnerForMode(flowMode, {
|
|
4803
5574
|
dappAddress,
|
|
4804
5575
|
walletOwner: signerContext?.ownerAddress ?? (canAutoLock ? connectedWalletAddress : selectedEvmWalletOwner),
|
|
@@ -4814,12 +5585,12 @@ function DepositFlow({
|
|
|
4814
5585
|
dappImportOwner
|
|
4815
5586
|
]
|
|
4816
5587
|
);
|
|
4817
|
-
const activeEntry =
|
|
5588
|
+
const activeEntry = useMemo7(
|
|
4818
5589
|
() => readSetupForOwner(setupSlice, activeOwner),
|
|
4819
5590
|
[setupSlice, activeOwner]
|
|
4820
5591
|
);
|
|
4821
|
-
const lastActiveSetupLifecycleKeyRef =
|
|
4822
|
-
|
|
5592
|
+
const lastActiveSetupLifecycleKeyRef = useRef8(null);
|
|
5593
|
+
useEffect10(() => {
|
|
4823
5594
|
if (!flowMode || !isConnectSelectionConfirmed) {
|
|
4824
5595
|
lastActiveSetupLifecycleKeyRef.current = null;
|
|
4825
5596
|
return;
|
|
@@ -4855,12 +5626,26 @@ function DepositFlow({
|
|
|
4855
5626
|
activeEntry.solanaDepositAddress,
|
|
4856
5627
|
onLifecycleRef
|
|
4857
5628
|
]);
|
|
4858
|
-
const effectiveStep =
|
|
4859
|
-
() => deriveStep(
|
|
4860
|
-
|
|
5629
|
+
const effectiveStep = useMemo7(
|
|
5630
|
+
() => deriveStep(
|
|
5631
|
+
flowSlice,
|
|
5632
|
+
depositSlice,
|
|
5633
|
+
processingSlice,
|
|
5634
|
+
activeEntry,
|
|
5635
|
+
fiatSlice,
|
|
5636
|
+
exchangeSlice
|
|
5637
|
+
),
|
|
5638
|
+
[
|
|
5639
|
+
flowSlice,
|
|
5640
|
+
depositSlice,
|
|
5641
|
+
processingSlice,
|
|
5642
|
+
activeEntry,
|
|
5643
|
+
fiatSlice,
|
|
5644
|
+
exchangeSlice
|
|
5645
|
+
]
|
|
4861
5646
|
);
|
|
4862
5647
|
const step = effectiveStep;
|
|
4863
|
-
const handleBack =
|
|
5648
|
+
const handleBack = useCallback7(() => {
|
|
4864
5649
|
const stepBeforeBack = storeApi.getState().flow.step;
|
|
4865
5650
|
storeApi.dispatch({
|
|
4866
5651
|
type: "back/requested",
|
|
@@ -4870,16 +5655,52 @@ function DepositFlow({
|
|
|
4870
5655
|
portfolioAssetsRef.current = [];
|
|
4871
5656
|
}
|
|
4872
5657
|
}, [storeApi, hasWalletOptions, reownWallet]);
|
|
4873
|
-
const canGoBackFromHere = effectiveStep.type === "deposit-address" || effectiveStep.type === "solana-token-select" || effectiveStep.type === "solana-amount" || effectiveStep.type === "solana-confirm" || effectiveStep.type === "amount" || effectiveStep.type === "confirm" || effectiveStep.type === "dapp-import-asset-select" || effectiveStep.type === "select-asset" && signerContext && !canAutoLock;
|
|
5658
|
+
const canGoBackFromHere = effectiveStep.type === "deposit-address" || effectiveStep.type === "solana-token-select" || effectiveStep.type === "solana-amount" || effectiveStep.type === "solana-confirm" || effectiveStep.type === "amount" || effectiveStep.type === "confirm" || effectiveStep.type === "dapp-import-asset-select" || effectiveStep.type === "fiat-onramp" || effectiveStep.type === "exchange-select" || effectiveStep.type === "exchange-connect" || effectiveStep.type === "select-asset" && signerContext && !canAutoLock;
|
|
4874
5659
|
const currentBackHandler = canGoBackFromHere ? handleBack : void 0;
|
|
4875
5660
|
const currentScreen = showConnectStep ? "connect" : effectiveStep.type;
|
|
4876
|
-
|
|
5661
|
+
useEffect10(() => {
|
|
4877
5662
|
onStepChangeRef.current?.(currentBackHandler, currentScreen);
|
|
4878
5663
|
}, [currentBackHandler, currentScreen, onStepChangeRef]);
|
|
5664
|
+
const lastModalHeightRef = useRef8(0);
|
|
5665
|
+
const modalContentElRef = useRef8(null);
|
|
5666
|
+
useEffect10(() => {
|
|
5667
|
+
const mc = document.querySelector(".rs-modal-content");
|
|
5668
|
+
if (!mc) return;
|
|
5669
|
+
modalContentElRef.current = mc;
|
|
5670
|
+
const ro = new ResizeObserver((entries) => {
|
|
5671
|
+
for (const entry of entries) {
|
|
5672
|
+
const border = entry.borderBoxSize?.[0]?.blockSize;
|
|
5673
|
+
lastModalHeightRef.current = typeof border === "number" ? border : entry.contentRect.height;
|
|
5674
|
+
}
|
|
5675
|
+
});
|
|
5676
|
+
ro.observe(mc);
|
|
5677
|
+
return () => {
|
|
5678
|
+
ro.disconnect();
|
|
5679
|
+
modalContentElRef.current = null;
|
|
5680
|
+
};
|
|
5681
|
+
}, []);
|
|
5682
|
+
const stepPinKey = `${flowMode ?? "none"}:${step.type}`;
|
|
5683
|
+
const prevStepPinKeyRef = useRef8(stepPinKey);
|
|
5684
|
+
useLayoutEffect2(() => {
|
|
5685
|
+
if (prevStepPinKeyRef.current === stepPinKey) return;
|
|
5686
|
+
prevStepPinKeyRef.current = stepPinKey;
|
|
5687
|
+
const mc = document.querySelector(".rs-modal-content");
|
|
5688
|
+
const lastHeight = lastModalHeightRef.current;
|
|
5689
|
+
if (!mc || lastHeight <= 0) return;
|
|
5690
|
+
const prevTransition = mc.style.transition;
|
|
5691
|
+
mc.style.transition = "none";
|
|
5692
|
+
mc.style.setProperty("min-height", `${lastHeight}px`, "important");
|
|
5693
|
+
void mc.offsetHeight;
|
|
5694
|
+
const rafId = requestAnimationFrame(() => {
|
|
5695
|
+
mc.style.transition = prevTransition;
|
|
5696
|
+
mc.style.removeProperty("min-height");
|
|
5697
|
+
});
|
|
5698
|
+
return () => cancelAnimationFrame(rafId);
|
|
5699
|
+
}, [stepPinKey]);
|
|
4879
5700
|
const stepSendToken = effectiveStep.type === "amount" ? effectiveStep.asset.symbol : null;
|
|
4880
5701
|
const stepOpenEventKey = effectiveStep.type === "select-asset" ? "select-asset" : effectiveStep.type === "deposit-address" ? "deposit-address" : effectiveStep.type === "amount" && stepSendToken ? `amount:${stepSendToken.toLowerCase()}` : null;
|
|
4881
|
-
const lastStepOpenEventKeyRef =
|
|
4882
|
-
|
|
5702
|
+
const lastStepOpenEventKeyRef = useRef8(null);
|
|
5703
|
+
useEffect10(() => {
|
|
4883
5704
|
if (!stepOpenEventKey) {
|
|
4884
5705
|
lastStepOpenEventKeyRef.current = null;
|
|
4885
5706
|
return;
|
|
@@ -4921,7 +5742,7 @@ function DepositFlow({
|
|
|
4921
5742
|
totalBalanceUsd,
|
|
4922
5743
|
onEventRef
|
|
4923
5744
|
]);
|
|
4924
|
-
|
|
5745
|
+
useEffect10(() => {
|
|
4925
5746
|
logFlow("state:changed", {
|
|
4926
5747
|
step: effectiveStep.type,
|
|
4927
5748
|
flowMode,
|
|
@@ -4937,7 +5758,7 @@ function DepositFlow({
|
|
|
4937
5758
|
targetChain,
|
|
4938
5759
|
targetToken
|
|
4939
5760
|
]);
|
|
4940
|
-
|
|
5761
|
+
useEffect10(() => {
|
|
4941
5762
|
onLifecycleRef.current?.({
|
|
4942
5763
|
type: "balance-changed",
|
|
4943
5764
|
totalUsd: totalBalanceUsd
|
|
@@ -4946,10 +5767,12 @@ function DepositFlow({
|
|
|
4946
5767
|
const isDepositAddressMode = flowMode === "deposit-address";
|
|
4947
5768
|
const isSolanaWalletMode = flowMode === "solana-wallet";
|
|
4948
5769
|
const isDappImportMode = flowMode === "dapp-import";
|
|
4949
|
-
const
|
|
5770
|
+
const isFiatOnrampMode = flowMode === "fiat-onramp";
|
|
5771
|
+
const isExchangeConnectMode = flowMode === "exchange-connect";
|
|
5772
|
+
const handleSelectTransferCrypto = useCallback7(() => {
|
|
4950
5773
|
storeApi.dispatch({ type: "connect/transfer-crypto-selected" });
|
|
4951
5774
|
}, [storeApi]);
|
|
4952
|
-
const handleConfirmWallet =
|
|
5775
|
+
const handleConfirmWallet = useCallback7(
|
|
4953
5776
|
(walletId) => {
|
|
4954
5777
|
const selectedOption = walletOptions.find((o) => o.id === walletId);
|
|
4955
5778
|
const mode = enableSolana && selectedOption?.kind === "solana" ? "solana-wallet" : "wallet";
|
|
@@ -4965,12 +5788,12 @@ function DepositFlow({
|
|
|
4965
5788
|
enableSolana && reownWallet?.isConnected && reownWallet?.isSolana
|
|
4966
5789
|
);
|
|
4967
5790
|
const dappImportsKey = dappImports ? Object.keys(dappImports).filter((k) => dappImports[k]).sort().join(",") : "";
|
|
4968
|
-
const enabledDappImportProviders =
|
|
5791
|
+
const enabledDappImportProviders = useMemo7(
|
|
4969
5792
|
() => isSolanaWalletConnected ? [] : getEnabledProviders(dappImports),
|
|
4970
5793
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- intentional: keyed on dappImportsKey, not the dappImports object identity
|
|
4971
5794
|
[dappImportsKey, isSolanaWalletConnected]
|
|
4972
5795
|
);
|
|
4973
|
-
const handleSelectDappImport =
|
|
5796
|
+
const handleSelectDappImport = useCallback7(
|
|
4974
5797
|
(providerId) => {
|
|
4975
5798
|
const owner = dappImportOwner;
|
|
4976
5799
|
if (owner) {
|
|
@@ -4991,13 +5814,13 @@ function DepositFlow({
|
|
|
4991
5814
|
},
|
|
4992
5815
|
[storeApi, walletOptions, dappImportOwner]
|
|
4993
5816
|
);
|
|
4994
|
-
const handleDappImportAssetSelected =
|
|
5817
|
+
const handleDappImportAssetSelected = useCallback7(
|
|
4995
5818
|
(asset) => {
|
|
4996
5819
|
storeApi.dispatch({ type: "dapp-import/asset-selected", asset });
|
|
4997
5820
|
},
|
|
4998
5821
|
[storeApi]
|
|
4999
5822
|
);
|
|
5000
|
-
|
|
5823
|
+
useEffect10(() => {
|
|
5001
5824
|
if (!dappImportOwner || enabledDappImportProviders.length === 0) {
|
|
5002
5825
|
storeApi.dispatch({ type: "dapp-import/availability-cleared" });
|
|
5003
5826
|
return;
|
|
@@ -5046,7 +5869,7 @@ function DepositFlow({
|
|
|
5046
5869
|
const activeDappImportProviderId = useDepositStore(
|
|
5047
5870
|
(s) => s.dappImport.activeProviderId
|
|
5048
5871
|
);
|
|
5049
|
-
const connectStepDappImports =
|
|
5872
|
+
const connectStepDappImports = useMemo7(
|
|
5050
5873
|
() => enabledDappImportProviders.map((provider) => {
|
|
5051
5874
|
const baseRow = {
|
|
5052
5875
|
id: provider.id,
|
|
@@ -5096,13 +5919,13 @@ function DepositFlow({
|
|
|
5096
5919
|
dappImportOwner
|
|
5097
5920
|
]
|
|
5098
5921
|
);
|
|
5099
|
-
const activeDappImportProvider =
|
|
5922
|
+
const activeDappImportProvider = useMemo7(() => {
|
|
5100
5923
|
if (!activeDappImportProviderId) return null;
|
|
5101
5924
|
return enabledDappImportProviders.find(
|
|
5102
5925
|
(p) => p.id === activeDappImportProviderId
|
|
5103
5926
|
) ?? null;
|
|
5104
5927
|
}, [activeDappImportProviderId, enabledDappImportProviders]);
|
|
5105
|
-
const activeDappImportAvailability =
|
|
5928
|
+
const activeDappImportAvailability = useMemo7(() => {
|
|
5106
5929
|
if (!activeDappImportProviderId) return null;
|
|
5107
5930
|
if (!dappImportOwner || dappImportAvailabilityOwner?.toLowerCase() !== dappImportOwner.toLowerCase()) {
|
|
5108
5931
|
return null;
|
|
@@ -5116,7 +5939,28 @@ function DepositFlow({
|
|
|
5116
5939
|
dappImportAvailabilityOwner,
|
|
5117
5940
|
dappImportOwner
|
|
5118
5941
|
]);
|
|
5119
|
-
const
|
|
5942
|
+
const handleSelectFiatMethod = useCallback7(
|
|
5943
|
+
(paymentMethod) => {
|
|
5944
|
+
storeApi.dispatch({
|
|
5945
|
+
type: "connect/fiat-onramp-selected",
|
|
5946
|
+
paymentMethod
|
|
5947
|
+
});
|
|
5948
|
+
},
|
|
5949
|
+
[storeApi]
|
|
5950
|
+
);
|
|
5951
|
+
const handleSelectExchange = useCallback7(() => {
|
|
5952
|
+
storeApi.dispatch({ type: "connect/exchange-selected" });
|
|
5953
|
+
}, [storeApi]);
|
|
5954
|
+
const handleSelectExchangeConnection = useCallback7(
|
|
5955
|
+
(connection) => {
|
|
5956
|
+
storeApi.dispatch({
|
|
5957
|
+
type: "exchange/connection-selected",
|
|
5958
|
+
connection
|
|
5959
|
+
});
|
|
5960
|
+
},
|
|
5961
|
+
[storeApi]
|
|
5962
|
+
);
|
|
5963
|
+
const handleNewDeposit = useCallback7(() => {
|
|
5120
5964
|
onLifecycleRef.current?.({
|
|
5121
5965
|
type: "smart-account-changed",
|
|
5122
5966
|
evm: null,
|
|
@@ -5127,7 +5971,7 @@ function DepositFlow({
|
|
|
5127
5971
|
stableWalletSignerRef.current = null;
|
|
5128
5972
|
stableWalletSelectionKeyRef.current = null;
|
|
5129
5973
|
}, [onLifecycleRef, storeApi]);
|
|
5130
|
-
const setupInputBase =
|
|
5974
|
+
const setupInputBase = useMemo7(
|
|
5131
5975
|
() => ({
|
|
5132
5976
|
targetChain,
|
|
5133
5977
|
targetToken,
|
|
@@ -5153,7 +5997,7 @@ function DepositFlow({
|
|
|
5153
5997
|
enableSolana
|
|
5154
5998
|
]
|
|
5155
5999
|
);
|
|
5156
|
-
const desiredOwnersKey =
|
|
6000
|
+
const desiredOwnersKey = useMemo7(() => {
|
|
5157
6001
|
const owners = [];
|
|
5158
6002
|
const seen = /* @__PURE__ */ new Set();
|
|
5159
6003
|
const push = (addr) => {
|
|
@@ -5174,7 +6018,7 @@ function DepositFlow({
|
|
|
5174
6018
|
reownWallet?.address,
|
|
5175
6019
|
dappImportOwner
|
|
5176
6020
|
]);
|
|
5177
|
-
|
|
6021
|
+
useEffect10(() => {
|
|
5178
6022
|
desiredOwnersKey.forEach((owner) => {
|
|
5179
6023
|
void (async () => {
|
|
5180
6024
|
const input = {
|
|
@@ -5269,7 +6113,7 @@ function DepositFlow({
|
|
|
5269
6113
|
storeApi,
|
|
5270
6114
|
setupSlice.byOwner
|
|
5271
6115
|
]);
|
|
5272
|
-
const handleDepositAddressSubmitted =
|
|
6116
|
+
const handleDepositAddressSubmitted = useCallback7(
|
|
5273
6117
|
(data) => {
|
|
5274
6118
|
logFlow("deposit-address:detected", {
|
|
5275
6119
|
txHash: data.txHash,
|
|
@@ -5280,7 +6124,7 @@ function DepositFlow({
|
|
|
5280
6124
|
},
|
|
5281
6125
|
[logFlow, onLifecycleRef]
|
|
5282
6126
|
);
|
|
5283
|
-
const handleSolanaTokenContinue =
|
|
6127
|
+
const handleSolanaTokenContinue = useCallback7(
|
|
5284
6128
|
(token, balance, balanceUsd) => {
|
|
5285
6129
|
logFlow("solana:token:continue", { token: token.symbol });
|
|
5286
6130
|
storeApi.dispatch({
|
|
@@ -5293,7 +6137,7 @@ function DepositFlow({
|
|
|
5293
6137
|
},
|
|
5294
6138
|
[defaultAmount, logFlow, storeApi]
|
|
5295
6139
|
);
|
|
5296
|
-
const handleSolanaAmountContinue =
|
|
6140
|
+
const handleSolanaAmountContinue = useCallback7(
|
|
5297
6141
|
(token, sourceAmount, inputAmountUsd) => {
|
|
5298
6142
|
const targetSym = getTargetTokenSymbol(targetToken, targetChain);
|
|
5299
6143
|
const isTargetStable = isStablecoinSymbol(targetSym);
|
|
@@ -5315,7 +6159,7 @@ function DepositFlow({
|
|
|
5315
6159
|
},
|
|
5316
6160
|
[targetToken, targetChain, getTokenPriceUsd, logFlow, storeApi]
|
|
5317
6161
|
);
|
|
5318
|
-
const handleSolanaConfirmed =
|
|
6162
|
+
const handleSolanaConfirmed = useCallback7(
|
|
5319
6163
|
(txHash, amountUnits) => {
|
|
5320
6164
|
const tokenAtSubmit = storeApi.getState().deposit.selectedSolanaToken;
|
|
5321
6165
|
if (!tokenAtSubmit) return;
|
|
@@ -5342,7 +6186,7 @@ function DepositFlow({
|
|
|
5342
6186
|
},
|
|
5343
6187
|
[logFlow, onLifecycleRef, storeApi]
|
|
5344
6188
|
);
|
|
5345
|
-
const handleAssetContinue =
|
|
6189
|
+
const handleAssetContinue = useCallback7(
|
|
5346
6190
|
(asset) => {
|
|
5347
6191
|
onEventRef.current?.({
|
|
5348
6192
|
type: "deposit_modal_connected_wallet_select_source_cta_click",
|
|
@@ -5360,7 +6204,7 @@ function DepositFlow({
|
|
|
5360
6204
|
},
|
|
5361
6205
|
[defaultAmount, onEventRef, totalBalanceUsd, storeApi]
|
|
5362
6206
|
);
|
|
5363
|
-
const handleAmountContinue =
|
|
6207
|
+
const handleAmountContinue = useCallback7(
|
|
5364
6208
|
(amount, targetAmount, balance, liquidityWarning) => {
|
|
5365
6209
|
const entry = readSetupForOwner(
|
|
5366
6210
|
storeApi.getState().setup,
|
|
@@ -5381,7 +6225,7 @@ function DepositFlow({
|
|
|
5381
6225
|
},
|
|
5382
6226
|
[targetToken, targetChain, getTokenPriceUsd, storeApi, activeOwner]
|
|
5383
6227
|
);
|
|
5384
|
-
const handleDepositSubmitted =
|
|
6228
|
+
const handleDepositSubmitted = useCallback7(
|
|
5385
6229
|
(txHash, chainId, amount, token) => {
|
|
5386
6230
|
logFlow("evm:submitted", {
|
|
5387
6231
|
txHash,
|
|
@@ -5404,7 +6248,32 @@ function DepositFlow({
|
|
|
5404
6248
|
},
|
|
5405
6249
|
[logFlow, storeApi, targetChain, targetToken]
|
|
5406
6250
|
);
|
|
5407
|
-
const
|
|
6251
|
+
const handleSwappedComplete = useCallback7(
|
|
6252
|
+
(info) => {
|
|
6253
|
+
logFlow("swapped:complete", {
|
|
6254
|
+
txHash: info.txHash,
|
|
6255
|
+
orderCrypto: info.orderCrypto
|
|
6256
|
+
});
|
|
6257
|
+
const amount = info.amount ?? "0";
|
|
6258
|
+
storeApi.dispatch({
|
|
6259
|
+
type: "deposit/submitted",
|
|
6260
|
+
txHash: info.txHash,
|
|
6261
|
+
sourceChain: SWAPPED_SOURCE_CHAIN,
|
|
6262
|
+
sourceToken: SWAPPED_SOURCE_TOKEN,
|
|
6263
|
+
amount,
|
|
6264
|
+
sourceSymbol: info.orderCrypto ?? "USDC",
|
|
6265
|
+
sourceDecimals: 6
|
|
6266
|
+
});
|
|
6267
|
+
onLifecycleRef.current?.({
|
|
6268
|
+
type: "submitted",
|
|
6269
|
+
txHash: info.txHash,
|
|
6270
|
+
sourceChain: SWAPPED_SOURCE_CHAIN,
|
|
6271
|
+
amount
|
|
6272
|
+
});
|
|
6273
|
+
},
|
|
6274
|
+
[logFlow, storeApi, onLifecycleRef]
|
|
6275
|
+
);
|
|
6276
|
+
const handleDepositSubmittedCallback = useCallback7(
|
|
5408
6277
|
(txHash, sourceChain, amount) => {
|
|
5409
6278
|
onLifecycleRef.current?.({
|
|
5410
6279
|
type: "submitted",
|
|
@@ -5415,7 +6284,7 @@ function DepositFlow({
|
|
|
5415
6284
|
},
|
|
5416
6285
|
[onLifecycleRef]
|
|
5417
6286
|
);
|
|
5418
|
-
const handleDepositComplete =
|
|
6287
|
+
const handleDepositComplete = useCallback7(
|
|
5419
6288
|
(txHash, destinationTxHash, context) => {
|
|
5420
6289
|
logFlow("deposit:complete", { txHash, destinationTxHash, ...context });
|
|
5421
6290
|
onLifecycleRef.current?.({
|
|
@@ -5427,28 +6296,28 @@ function DepositFlow({
|
|
|
5427
6296
|
},
|
|
5428
6297
|
[logFlow, onLifecycleRef]
|
|
5429
6298
|
);
|
|
5430
|
-
const handleDepositFailed =
|
|
6299
|
+
const handleDepositFailed = useCallback7(
|
|
5431
6300
|
(txHash, error) => {
|
|
5432
6301
|
logFlowError("deposit:failed", error, { txHash });
|
|
5433
6302
|
onLifecycleRef.current?.({ type: "failed", txHash, error });
|
|
5434
6303
|
},
|
|
5435
6304
|
[logFlowError, onLifecycleRef]
|
|
5436
6305
|
);
|
|
5437
|
-
const handleError =
|
|
6306
|
+
const handleError = useCallback7(
|
|
5438
6307
|
(message, code) => {
|
|
5439
6308
|
logFlowError("flow:error", message, { code });
|
|
5440
6309
|
onErrorRef.current?.({ message, code });
|
|
5441
6310
|
},
|
|
5442
6311
|
[logFlowError, onErrorRef]
|
|
5443
6312
|
);
|
|
5444
|
-
const handleTotalBalanceComputed =
|
|
6313
|
+
const handleTotalBalanceComputed = useCallback7((total) => {
|
|
5445
6314
|
setTotalBalanceUsd(total);
|
|
5446
6315
|
}, []);
|
|
5447
|
-
const walletOptionsKey =
|
|
6316
|
+
const walletOptionsKey = useMemo7(
|
|
5448
6317
|
() => walletOptions.map((option) => option.id).join(","),
|
|
5449
6318
|
[walletOptions]
|
|
5450
6319
|
);
|
|
5451
|
-
|
|
6320
|
+
useEffect10(() => {
|
|
5452
6321
|
if (storeApi.getState().flow.mode) {
|
|
5453
6322
|
return;
|
|
5454
6323
|
}
|
|
@@ -5458,12 +6327,12 @@ function DepositFlow({
|
|
|
5458
6327
|
storeApi.dispatch({ type: "flow/step-set", step: "connect" });
|
|
5459
6328
|
}
|
|
5460
6329
|
}, [walletOptionsKey]);
|
|
5461
|
-
|
|
6330
|
+
useEffect10(() => {
|
|
5462
6331
|
if (!showConnectStep && isConnectSelectionConfirmed && (flowMode === "wallet" || flowMode === "dapp-import") && !signerContext) {
|
|
5463
6332
|
storeApi.dispatch({ type: "wallet/cleared" });
|
|
5464
6333
|
}
|
|
5465
6334
|
}, [showConnectStep, isConnectSelectionConfirmed, flowMode, signerContext, storeApi]);
|
|
5466
|
-
|
|
6335
|
+
useEffect10(() => {
|
|
5467
6336
|
if (enableSolana || flowMode !== "solana-wallet") {
|
|
5468
6337
|
return;
|
|
5469
6338
|
}
|
|
@@ -5472,14 +6341,15 @@ function DepositFlow({
|
|
|
5472
6341
|
storeApi.dispatch({ type: "flow/step-set", step: "connect" });
|
|
5473
6342
|
}
|
|
5474
6343
|
}, [enableSolana, flowMode, storeApi]);
|
|
5475
|
-
|
|
5476
|
-
if (hasNavigatedBack || isConnectSelectionConfirmed || flowMode) {
|
|
6344
|
+
useEffect10(() => {
|
|
6345
|
+
if (hasNavigatedBack || isConnectSelectionConfirmed || flowMode || enableFiatOnramp || enableExchangeConnect) {
|
|
5477
6346
|
return;
|
|
5478
6347
|
}
|
|
5479
|
-
if (!hasWalletOptions && dappAddress && !hasReownSession && !dappWalletClient && hasQrAutoAdvanceGraceElapsed) {
|
|
6348
|
+
if (enableQrTransfer && !hasWalletOptions && dappAddress && !hasReownSession && !dappWalletClient && hasQrAutoAdvanceGraceElapsed) {
|
|
5480
6349
|
handleSelectTransferCrypto();
|
|
5481
6350
|
}
|
|
5482
6351
|
}, [
|
|
6352
|
+
enableQrTransfer,
|
|
5483
6353
|
hasWalletOptions,
|
|
5484
6354
|
hasReownSession,
|
|
5485
6355
|
hasQrAutoAdvanceGraceElapsed,
|
|
@@ -5490,7 +6360,7 @@ function DepositFlow({
|
|
|
5490
6360
|
dappWalletClient,
|
|
5491
6361
|
handleSelectTransferCrypto
|
|
5492
6362
|
]);
|
|
5493
|
-
const walletRows =
|
|
6363
|
+
const walletRows = useMemo7(() => {
|
|
5494
6364
|
return walletOptions.map((option) => {
|
|
5495
6365
|
const ownerForRow = option.kind === "solana" ? dappAddress : option.address ?? null;
|
|
5496
6366
|
const entry = readSetupForOwner(setupSlice, ownerForRow ?? null);
|
|
@@ -5506,32 +6376,35 @@ function DepositFlow({
|
|
|
5506
6376
|
};
|
|
5507
6377
|
});
|
|
5508
6378
|
}, [walletOptions, setupSlice, dappAddress]);
|
|
5509
|
-
const transferCryptoEntry =
|
|
6379
|
+
const transferCryptoEntry = useMemo7(
|
|
5510
6380
|
() => readSetupForOwner(setupSlice, dappAddress),
|
|
5511
6381
|
[setupSlice, dappAddress]
|
|
5512
6382
|
);
|
|
5513
6383
|
const transferCryptoState = transferCryptoEntry.status === "ready" ? "ready" : transferCryptoEntry.status === "error" ? "error" : "loading";
|
|
5514
|
-
const handleRetrySetup =
|
|
6384
|
+
const handleRetrySetup = useCallback7(
|
|
5515
6385
|
(owner) => {
|
|
5516
6386
|
storeApi.dispatch({ type: "setup/retry-requested", owner });
|
|
5517
6387
|
},
|
|
5518
6388
|
[storeApi]
|
|
5519
6389
|
);
|
|
5520
6390
|
if (showConnectStep) {
|
|
5521
|
-
return /* @__PURE__ */
|
|
6391
|
+
return /* @__PURE__ */ jsx17("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx17(
|
|
5522
6392
|
ConnectStep,
|
|
5523
6393
|
{
|
|
5524
6394
|
walletRows,
|
|
5525
6395
|
transferCryptoState: dappAddress ? transferCryptoState : void 0,
|
|
5526
6396
|
transferCryptoErrorReason: dappAddress ? transferCryptoEntry.message ?? void 0 : void 0,
|
|
5527
|
-
onSelectTransferCrypto: dappAddress ? () => {
|
|
6397
|
+
onSelectTransferCrypto: enableQrTransfer && dappAddress ? () => {
|
|
5528
6398
|
if (transferCryptoState === "error") {
|
|
5529
6399
|
handleRetrySetup(dappAddress);
|
|
5530
6400
|
return;
|
|
5531
6401
|
}
|
|
5532
|
-
if (transferCryptoState !== "ready") return;
|
|
5533
6402
|
handleSelectTransferCrypto();
|
|
5534
6403
|
} : void 0,
|
|
6404
|
+
onSelectPayWithCard: enableFiatOnramp && dappAddress && (!fiatOnrampMethods || fiatOnrampMethods.length === 0) ? () => handleSelectFiatMethod() : void 0,
|
|
6405
|
+
fiatPaymentMethods: enableFiatOnramp && dappAddress ? fiatOnrampMethods : void 0,
|
|
6406
|
+
onSelectFiatMethod: enableFiatOnramp && dappAddress ? (method) => handleSelectFiatMethod(method) : void 0,
|
|
6407
|
+
onSelectFundFromExchange: enableExchangeConnect && dappAddress ? () => handleSelectExchange() : void 0,
|
|
5535
6408
|
onRequestConnect,
|
|
5536
6409
|
onConnect,
|
|
5537
6410
|
onDisconnect,
|
|
@@ -5565,26 +6438,25 @@ function DepositFlow({
|
|
|
5565
6438
|
}
|
|
5566
6439
|
if (isDepositAddressMode) {
|
|
5567
6440
|
if (!dappAddress) return null;
|
|
5568
|
-
return /* @__PURE__ */
|
|
5569
|
-
effectiveStep.type === "setup" && (activeEntry.status === "error" ? /* @__PURE__ */
|
|
6441
|
+
return /* @__PURE__ */ jsxs15("div", { className: "rs-modal-body", children: [
|
|
6442
|
+
effectiveStep.type === "setup" && (activeEntry.status === "error" ? /* @__PURE__ */ jsx17(
|
|
5570
6443
|
AccountPreparingSkeleton,
|
|
5571
6444
|
{
|
|
5572
6445
|
errorMessage: activeEntry.message ?? void 0,
|
|
5573
6446
|
onRetry: () => handleRetrySetup(dappAddress)
|
|
5574
6447
|
}
|
|
5575
|
-
) : /* @__PURE__ */
|
|
6448
|
+
) : /* @__PURE__ */ jsx17(
|
|
5576
6449
|
DepositAddressSkeleton,
|
|
5577
6450
|
{
|
|
5578
6451
|
uiConfig,
|
|
5579
6452
|
allowedRoutes
|
|
5580
6453
|
}
|
|
5581
6454
|
)),
|
|
5582
|
-
effectiveStep.type === "deposit-address" && /* @__PURE__ */
|
|
6455
|
+
effectiveStep.type === "deposit-address" && /* @__PURE__ */ jsx17(
|
|
5583
6456
|
DepositAddressStep,
|
|
5584
6457
|
{
|
|
5585
6458
|
smartAccount: effectiveStep.smartAccount,
|
|
5586
6459
|
solanaDepositAddress: enableSolana ? effectiveStep.solanaDepositAddress : void 0,
|
|
5587
|
-
isUpdating: activeEntry.status !== "ready",
|
|
5588
6460
|
service,
|
|
5589
6461
|
allowedRoutes,
|
|
5590
6462
|
targetChain,
|
|
@@ -5611,19 +6483,141 @@ function DepositFlow({
|
|
|
5611
6483
|
)
|
|
5612
6484
|
] });
|
|
5613
6485
|
}
|
|
6486
|
+
if (isFiatOnrampMode) {
|
|
6487
|
+
if (!dappAddress) return null;
|
|
6488
|
+
return /* @__PURE__ */ jsxs15(
|
|
6489
|
+
"div",
|
|
6490
|
+
{
|
|
6491
|
+
className: "rs-modal-body",
|
|
6492
|
+
"data-flow-mode": "fiat-onramp",
|
|
6493
|
+
"data-step-type": step.type,
|
|
6494
|
+
children: [
|
|
6495
|
+
step.type === "setup" && /* @__PURE__ */ jsx17(
|
|
6496
|
+
AccountPreparingSkeleton,
|
|
6497
|
+
{
|
|
6498
|
+
errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
|
|
6499
|
+
onRetry: activeEntry.status === "error" ? () => handleRetrySetup(dappAddress) : void 0
|
|
6500
|
+
}
|
|
6501
|
+
),
|
|
6502
|
+
step.type === "fiat-onramp" && /* @__PURE__ */ jsx17(
|
|
6503
|
+
FiatOnrampStep,
|
|
6504
|
+
{
|
|
6505
|
+
smartAccount: step.smartAccount,
|
|
6506
|
+
service,
|
|
6507
|
+
paymentMethod: step.paymentMethod,
|
|
6508
|
+
onSwappedComplete: handleSwappedComplete,
|
|
6509
|
+
onSwappedFailed: handleDepositFailed,
|
|
6510
|
+
onClose: onClose ?? (() => {
|
|
6511
|
+
}),
|
|
6512
|
+
onError: handleError
|
|
6513
|
+
}
|
|
6514
|
+
),
|
|
6515
|
+
step.type === "processing" && /* @__PURE__ */ jsx17(
|
|
6516
|
+
ProcessingStep,
|
|
6517
|
+
{
|
|
6518
|
+
smartAccount: step.smartAccount,
|
|
6519
|
+
solanaDepositAddress: step.solanaDepositAddress,
|
|
6520
|
+
txHash: step.txHash,
|
|
6521
|
+
sourceChain: step.sourceChain,
|
|
6522
|
+
sourceToken: step.sourceToken,
|
|
6523
|
+
targetChain,
|
|
6524
|
+
targetToken,
|
|
6525
|
+
amount: step.amount,
|
|
6526
|
+
sourceSymbol: step.sourceSymbol,
|
|
6527
|
+
sourceDecimals: step.sourceDecimals,
|
|
6528
|
+
hasPostBridgeActions: Boolean(postBridgeActions?.length),
|
|
6529
|
+
service,
|
|
6530
|
+
directTransfer: step.directTransfer,
|
|
6531
|
+
onClose,
|
|
6532
|
+
onNewDeposit: handleNewDeposit,
|
|
6533
|
+
onDepositComplete: handleDepositComplete,
|
|
6534
|
+
onDepositFailed: handleDepositFailed,
|
|
6535
|
+
onError: handleError,
|
|
6536
|
+
debug
|
|
6537
|
+
}
|
|
6538
|
+
)
|
|
6539
|
+
]
|
|
6540
|
+
}
|
|
6541
|
+
);
|
|
6542
|
+
}
|
|
6543
|
+
if (isExchangeConnectMode) {
|
|
6544
|
+
if (!dappAddress) return null;
|
|
6545
|
+
return /* @__PURE__ */ jsxs15(
|
|
6546
|
+
"div",
|
|
6547
|
+
{
|
|
6548
|
+
className: "rs-modal-body",
|
|
6549
|
+
"data-flow-mode": "exchange-connect",
|
|
6550
|
+
"data-step-type": step.type,
|
|
6551
|
+
children: [
|
|
6552
|
+
step.type === "setup" && /* @__PURE__ */ jsx17(
|
|
6553
|
+
AccountPreparingSkeleton,
|
|
6554
|
+
{
|
|
6555
|
+
errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
|
|
6556
|
+
onRetry: activeEntry.status === "error" ? () => handleRetrySetup(dappAddress) : void 0
|
|
6557
|
+
}
|
|
6558
|
+
),
|
|
6559
|
+
step.type === "exchange-select" && /* @__PURE__ */ jsx17(
|
|
6560
|
+
ExchangeSelectStep,
|
|
6561
|
+
{
|
|
6562
|
+
service,
|
|
6563
|
+
onSelectExchange: handleSelectExchangeConnection,
|
|
6564
|
+
onError: handleError
|
|
6565
|
+
}
|
|
6566
|
+
),
|
|
6567
|
+
step.type === "exchange-connect" && /* @__PURE__ */ jsx17(
|
|
6568
|
+
ExchangeConnectStep,
|
|
6569
|
+
{
|
|
6570
|
+
smartAccount: step.smartAccount,
|
|
6571
|
+
service,
|
|
6572
|
+
connection: step.connection,
|
|
6573
|
+
onSwappedComplete: handleSwappedComplete,
|
|
6574
|
+
onSwappedFailed: handleDepositFailed,
|
|
6575
|
+
onClose: onClose ?? (() => {
|
|
6576
|
+
}),
|
|
6577
|
+
onError: handleError
|
|
6578
|
+
}
|
|
6579
|
+
),
|
|
6580
|
+
step.type === "processing" && /* @__PURE__ */ jsx17(
|
|
6581
|
+
ProcessingStep,
|
|
6582
|
+
{
|
|
6583
|
+
smartAccount: step.smartAccount,
|
|
6584
|
+
solanaDepositAddress: step.solanaDepositAddress,
|
|
6585
|
+
txHash: step.txHash,
|
|
6586
|
+
sourceChain: step.sourceChain,
|
|
6587
|
+
sourceToken: step.sourceToken,
|
|
6588
|
+
targetChain,
|
|
6589
|
+
targetToken,
|
|
6590
|
+
amount: step.amount,
|
|
6591
|
+
sourceSymbol: step.sourceSymbol,
|
|
6592
|
+
sourceDecimals: step.sourceDecimals,
|
|
6593
|
+
hasPostBridgeActions: Boolean(postBridgeActions?.length),
|
|
6594
|
+
service,
|
|
6595
|
+
directTransfer: step.directTransfer,
|
|
6596
|
+
onClose,
|
|
6597
|
+
onNewDeposit: handleNewDeposit,
|
|
6598
|
+
onDepositComplete: handleDepositComplete,
|
|
6599
|
+
onDepositFailed: handleDepositFailed,
|
|
6600
|
+
onError: handleError,
|
|
6601
|
+
debug
|
|
6602
|
+
}
|
|
6603
|
+
)
|
|
6604
|
+
]
|
|
6605
|
+
}
|
|
6606
|
+
);
|
|
6607
|
+
}
|
|
5614
6608
|
if (isSolanaWalletMode) {
|
|
5615
6609
|
if (!dappAddress) return null;
|
|
5616
6610
|
const solanaAddr = reownWallet?.solanaAddress;
|
|
5617
6611
|
const solanaProvider = reownWallet?.solanaProvider;
|
|
5618
|
-
return /* @__PURE__ */
|
|
5619
|
-
effectiveStep.type === "setup" && /* @__PURE__ */
|
|
6612
|
+
return /* @__PURE__ */ jsxs15("div", { className: "rs-modal-body", children: [
|
|
6613
|
+
effectiveStep.type === "setup" && /* @__PURE__ */ jsx17(
|
|
5620
6614
|
AccountPreparingSkeleton,
|
|
5621
6615
|
{
|
|
5622
6616
|
errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
|
|
5623
6617
|
onRetry: activeEntry.status === "error" ? () => handleRetrySetup(dappAddress) : void 0
|
|
5624
6618
|
}
|
|
5625
6619
|
),
|
|
5626
|
-
effectiveStep.type === "solana-token-select" && solanaAddr && /* @__PURE__ */
|
|
6620
|
+
effectiveStep.type === "solana-token-select" && solanaAddr && /* @__PURE__ */ jsx17(
|
|
5627
6621
|
SolanaTokenSelectStep,
|
|
5628
6622
|
{
|
|
5629
6623
|
solanaAddress: solanaAddr,
|
|
@@ -5637,7 +6631,7 @@ function DepositFlow({
|
|
|
5637
6631
|
debug
|
|
5638
6632
|
}
|
|
5639
6633
|
),
|
|
5640
|
-
effectiveStep.type === "solana-amount" && /* @__PURE__ */
|
|
6634
|
+
effectiveStep.type === "solana-amount" && /* @__PURE__ */ jsx17(
|
|
5641
6635
|
SolanaAmountStep,
|
|
5642
6636
|
{
|
|
5643
6637
|
token: effectiveStep.token,
|
|
@@ -5655,7 +6649,7 @@ function DepositFlow({
|
|
|
5655
6649
|
debug
|
|
5656
6650
|
}
|
|
5657
6651
|
),
|
|
5658
|
-
effectiveStep.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */
|
|
6652
|
+
effectiveStep.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */ jsx17(
|
|
5659
6653
|
SolanaConfirmStep,
|
|
5660
6654
|
{
|
|
5661
6655
|
smartAccount: effectiveStep.smartAccount,
|
|
@@ -5676,16 +6670,16 @@ function DepositFlow({
|
|
|
5676
6670
|
onError: handleError,
|
|
5677
6671
|
debug
|
|
5678
6672
|
}
|
|
5679
|
-
) : effectiveStep.type === "solana-confirm" ? /* @__PURE__ */
|
|
5680
|
-
/* @__PURE__ */
|
|
5681
|
-
/* @__PURE__ */
|
|
6673
|
+
) : effectiveStep.type === "solana-confirm" ? /* @__PURE__ */ jsxs15("div", { className: "rs-step", children: [
|
|
6674
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-loading-state", children: [
|
|
6675
|
+
/* @__PURE__ */ jsx17("div", { className: "rs-step-icon rs-step-icon--error", children: /* @__PURE__ */ jsx17(
|
|
5682
6676
|
"svg",
|
|
5683
6677
|
{
|
|
5684
6678
|
viewBox: "0 0 24 24",
|
|
5685
6679
|
fill: "none",
|
|
5686
6680
|
stroke: "currentColor",
|
|
5687
6681
|
strokeWidth: "2",
|
|
5688
|
-
children: /* @__PURE__ */
|
|
6682
|
+
children: /* @__PURE__ */ jsx17(
|
|
5689
6683
|
"path",
|
|
5690
6684
|
{
|
|
5691
6685
|
strokeLinecap: "round",
|
|
@@ -5695,22 +6689,22 @@ function DepositFlow({
|
|
|
5695
6689
|
)
|
|
5696
6690
|
}
|
|
5697
6691
|
) }),
|
|
5698
|
-
/* @__PURE__ */
|
|
5699
|
-
/* @__PURE__ */
|
|
5700
|
-
/* @__PURE__ */
|
|
6692
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-loading-text", children: [
|
|
6693
|
+
/* @__PURE__ */ jsx17("div", { className: "rs-loading-title rs-text-error", children: "Wallet disconnected" }),
|
|
6694
|
+
/* @__PURE__ */ jsx17("div", { className: "rs-loading-subtitle", children: "Please reconnect your Solana wallet to continue." })
|
|
5701
6695
|
] })
|
|
5702
6696
|
] }),
|
|
5703
|
-
/* @__PURE__ */
|
|
6697
|
+
/* @__PURE__ */ jsx17("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx17(
|
|
5704
6698
|
"button",
|
|
5705
6699
|
{
|
|
5706
6700
|
type: "button",
|
|
5707
6701
|
className: "rs-button rs-button--default rs-button--full-width",
|
|
5708
6702
|
onClick: handleBack,
|
|
5709
|
-
children: /* @__PURE__ */
|
|
6703
|
+
children: /* @__PURE__ */ jsx17("span", { children: "Go Back" })
|
|
5710
6704
|
}
|
|
5711
6705
|
) })
|
|
5712
6706
|
] }) : null,
|
|
5713
|
-
effectiveStep.type === "processing" && /* @__PURE__ */
|
|
6707
|
+
effectiveStep.type === "processing" && /* @__PURE__ */ jsx17(
|
|
5714
6708
|
ProcessingStep,
|
|
5715
6709
|
{
|
|
5716
6710
|
smartAccount: effectiveStep.smartAccount,
|
|
@@ -5737,7 +6731,7 @@ function DepositFlow({
|
|
|
5737
6731
|
] });
|
|
5738
6732
|
}
|
|
5739
6733
|
if (!signerContext?.walletClient || !signerContext?.publicClient) {
|
|
5740
|
-
return /* @__PURE__ */
|
|
6734
|
+
return /* @__PURE__ */ jsx17("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx17("div", { className: "rs-step", children: /* @__PURE__ */ jsx17("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsx17("div", { className: "rs-loading-text", children: /* @__PURE__ */ jsx17("div", { className: "rs-loading-title", children: "Connecting wallet\u2026" }) }) }) }) });
|
|
5741
6735
|
}
|
|
5742
6736
|
const ownerAddress = signerContext.ownerAddress;
|
|
5743
6737
|
const ownerChainId = signerContext.walletClient?.chain?.id ?? signerContext.publicClient.chain?.id ?? setupChainId;
|
|
@@ -5747,15 +6741,15 @@ function DepositFlow({
|
|
|
5747
6741
|
}
|
|
5748
6742
|
return getPublicClient(chainId);
|
|
5749
6743
|
};
|
|
5750
|
-
return /* @__PURE__ */
|
|
5751
|
-
effectiveStep.type === "setup" && /* @__PURE__ */
|
|
6744
|
+
return /* @__PURE__ */ jsxs15("div", { className: "rs-modal-body", children: [
|
|
6745
|
+
effectiveStep.type === "setup" && /* @__PURE__ */ jsx17(
|
|
5752
6746
|
AccountPreparingSkeleton,
|
|
5753
6747
|
{
|
|
5754
6748
|
errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
|
|
5755
6749
|
onRetry: activeEntry.status === "error" ? () => handleRetrySetup(ownerAddress) : void 0
|
|
5756
6750
|
}
|
|
5757
6751
|
),
|
|
5758
|
-
effectiveStep.type === "select-asset" && /* @__PURE__ */
|
|
6752
|
+
effectiveStep.type === "select-asset" && /* @__PURE__ */ jsx17(
|
|
5759
6753
|
AssetSelectStep,
|
|
5760
6754
|
{
|
|
5761
6755
|
address: ownerAddress,
|
|
@@ -5773,7 +6767,7 @@ function DepositFlow({
|
|
|
5773
6767
|
} : void 0
|
|
5774
6768
|
}
|
|
5775
6769
|
),
|
|
5776
|
-
effectiveStep.type === "dapp-import-asset-select" && activeDappImportProvider && activeDappImportAvailability && /* @__PURE__ */
|
|
6770
|
+
effectiveStep.type === "dapp-import-asset-select" && activeDappImportProvider && activeDappImportAvailability && /* @__PURE__ */ jsx17(
|
|
5777
6771
|
DappImportAssetSelectStep,
|
|
5778
6772
|
{
|
|
5779
6773
|
sourceLabel: activeDappImportAvailability.assets[0]?.sourceLabel ?? activeDappImportProvider.label,
|
|
@@ -5781,7 +6775,7 @@ function DepositFlow({
|
|
|
5781
6775
|
onSelect: handleDappImportAssetSelected
|
|
5782
6776
|
}
|
|
5783
6777
|
),
|
|
5784
|
-
effectiveStep.type === "amount" && /* @__PURE__ */
|
|
6778
|
+
effectiveStep.type === "amount" && /* @__PURE__ */ jsx17(
|
|
5785
6779
|
AmountStep,
|
|
5786
6780
|
{
|
|
5787
6781
|
walletClient: signerContext.walletClient,
|
|
@@ -5813,7 +6807,7 @@ function DepositFlow({
|
|
|
5813
6807
|
}
|
|
5814
6808
|
}
|
|
5815
6809
|
),
|
|
5816
|
-
effectiveStep.type === "confirm" && /* @__PURE__ */
|
|
6810
|
+
effectiveStep.type === "confirm" && /* @__PURE__ */ jsx17(
|
|
5817
6811
|
ConfirmStep,
|
|
5818
6812
|
{
|
|
5819
6813
|
walletClient: signerContext.walletClient,
|
|
@@ -5853,7 +6847,7 @@ function DepositFlow({
|
|
|
5853
6847
|
onError: handleError
|
|
5854
6848
|
}
|
|
5855
6849
|
),
|
|
5856
|
-
effectiveStep.type === "processing" && /* @__PURE__ */
|
|
6850
|
+
effectiveStep.type === "processing" && /* @__PURE__ */ jsx17(
|
|
5857
6851
|
ProcessingStep,
|
|
5858
6852
|
{
|
|
5859
6853
|
smartAccount: effectiveStep.smartAccount,
|
|
@@ -5883,8 +6877,8 @@ function DepositFlow({
|
|
|
5883
6877
|
}
|
|
5884
6878
|
|
|
5885
6879
|
// src/components/history/DepositHistoryPanel.tsx
|
|
5886
|
-
import { useCallback as
|
|
5887
|
-
import { jsx as
|
|
6880
|
+
import { useCallback as useCallback8, useMemo as useMemo8, useState as useState12 } from "react";
|
|
6881
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5888
6882
|
function shortenHash(hash) {
|
|
5889
6883
|
if (hash.length <= 14) return hash;
|
|
5890
6884
|
return `${hash.slice(0, 6)}\u2026${hash.slice(-4)}`;
|
|
@@ -5994,7 +6988,7 @@ function DepositHistoryPanel({
|
|
|
5994
6988
|
onClose,
|
|
5995
6989
|
onCloseModal
|
|
5996
6990
|
}) {
|
|
5997
|
-
const handleKeyDown =
|
|
6991
|
+
const handleKeyDown = useCallback8(
|
|
5998
6992
|
(e) => {
|
|
5999
6993
|
if (e.key === "Escape") {
|
|
6000
6994
|
e.stopPropagation();
|
|
@@ -6003,7 +6997,7 @@ function DepositHistoryPanel({
|
|
|
6003
6997
|
},
|
|
6004
6998
|
[onClose]
|
|
6005
6999
|
);
|
|
6006
|
-
const visibleDeposits =
|
|
7000
|
+
const visibleDeposits = useMemo8(() => {
|
|
6007
7001
|
const sourceHashes = new Set(
|
|
6008
7002
|
deposits.map((d) => d.sourceTxHash?.toLowerCase()).filter((h) => Boolean(h))
|
|
6009
7003
|
);
|
|
@@ -6011,7 +7005,7 @@ function DepositHistoryPanel({
|
|
|
6011
7005
|
(d) => !(d.txHash && sourceHashes.has(d.txHash.toLowerCase()))
|
|
6012
7006
|
);
|
|
6013
7007
|
}, [deposits]);
|
|
6014
|
-
return /* @__PURE__ */
|
|
7008
|
+
return /* @__PURE__ */ jsxs16(
|
|
6015
7009
|
"div",
|
|
6016
7010
|
{
|
|
6017
7011
|
className: "rs-history-panel",
|
|
@@ -6019,55 +7013,55 @@ function DepositHistoryPanel({
|
|
|
6019
7013
|
"aria-label": "Deposit history",
|
|
6020
7014
|
onKeyDown: handleKeyDown,
|
|
6021
7015
|
children: [
|
|
6022
|
-
/* @__PURE__ */
|
|
6023
|
-
/* @__PURE__ */
|
|
7016
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-modal-header--redesigned", children: [
|
|
7017
|
+
/* @__PURE__ */ jsx18("div", { className: "rs-modal-header-nav-left", children: /* @__PURE__ */ jsx18(
|
|
6024
7018
|
"button",
|
|
6025
7019
|
{
|
|
6026
7020
|
type: "button",
|
|
6027
7021
|
className: "rs-modal-header-back",
|
|
6028
7022
|
"aria-label": "Back",
|
|
6029
7023
|
onClick: onClose,
|
|
6030
|
-
children: /* @__PURE__ */
|
|
7024
|
+
children: /* @__PURE__ */ jsx18(ChevronLeftIcon, {})
|
|
6031
7025
|
}
|
|
6032
7026
|
) }),
|
|
6033
|
-
/* @__PURE__ */
|
|
7027
|
+
/* @__PURE__ */ jsx18("div", { className: "rs-modal-header-nav-right", children: onCloseModal && /* @__PURE__ */ jsx18(
|
|
6034
7028
|
"button",
|
|
6035
7029
|
{
|
|
6036
7030
|
type: "button",
|
|
6037
7031
|
className: "rs-modal-close",
|
|
6038
7032
|
"aria-label": "Close",
|
|
6039
7033
|
onClick: onCloseModal,
|
|
6040
|
-
children: /* @__PURE__ */
|
|
7034
|
+
children: /* @__PURE__ */ jsx18(CloseIcon, {})
|
|
6041
7035
|
}
|
|
6042
7036
|
) })
|
|
6043
7037
|
] }),
|
|
6044
|
-
/* @__PURE__ */
|
|
6045
|
-
/* @__PURE__ */
|
|
6046
|
-
/* @__PURE__ */
|
|
6047
|
-
isLoading && deposits.length === 0 && /* @__PURE__ */
|
|
6048
|
-
/* @__PURE__ */
|
|
6049
|
-
/* @__PURE__ */
|
|
6050
|
-
/* @__PURE__ */
|
|
6051
|
-
/* @__PURE__ */
|
|
7038
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-history-screen", children: [
|
|
7039
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-history-screen-body", children: [
|
|
7040
|
+
/* @__PURE__ */ jsx18(BodyHeader, { icon: /* @__PURE__ */ jsx18(HistoryIcon, {}), title: "History" }),
|
|
7041
|
+
isLoading && deposits.length === 0 && /* @__PURE__ */ jsxs16("div", { className: "rs-history-empty", children: [
|
|
7042
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(HistoryIcon, {}) }),
|
|
7043
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-history-empty-text", children: [
|
|
7044
|
+
/* @__PURE__ */ jsx18(Spinner, { className: "rs-spinner--sm" }),
|
|
7045
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-empty-hint", children: "Loading history\u2026" })
|
|
6052
7046
|
] })
|
|
6053
7047
|
] }),
|
|
6054
|
-
error && !isLoading && /* @__PURE__ */
|
|
6055
|
-
/* @__PURE__ */
|
|
6056
|
-
/* @__PURE__ */
|
|
6057
|
-
/* @__PURE__ */
|
|
6058
|
-
/* @__PURE__ */
|
|
7048
|
+
error && !isLoading && /* @__PURE__ */ jsxs16("div", { className: "rs-history-empty", children: [
|
|
7049
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(AlertTriangleIcon, {}) }),
|
|
7050
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-history-empty-text", children: [
|
|
7051
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-empty-title", children: "Couldn't load history" }),
|
|
7052
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-empty-hint", children: error })
|
|
6059
7053
|
] })
|
|
6060
7054
|
] }),
|
|
6061
|
-
!isLoading && !error && visibleDeposits.length === 0 && /* @__PURE__ */
|
|
6062
|
-
/* @__PURE__ */
|
|
6063
|
-
/* @__PURE__ */
|
|
6064
|
-
/* @__PURE__ */
|
|
6065
|
-
/* @__PURE__ */
|
|
7055
|
+
!isLoading && !error && visibleDeposits.length === 0 && /* @__PURE__ */ jsxs16("div", { className: "rs-history-empty", children: [
|
|
7056
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(HistoryIcon, {}) }),
|
|
7057
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-history-empty-text", children: [
|
|
7058
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-empty-title", children: "No deposits yet" }),
|
|
7059
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-empty-hint", children: "Your deposit history will appear here" })
|
|
6066
7060
|
] })
|
|
6067
7061
|
] }),
|
|
6068
|
-
visibleDeposits.length > 0 && /* @__PURE__ */
|
|
6069
|
-
visibleDeposits.map((deposit, i) => /* @__PURE__ */
|
|
6070
|
-
hasMore && /* @__PURE__ */
|
|
7062
|
+
visibleDeposits.length > 0 && /* @__PURE__ */ jsxs16("div", { className: "rs-history-list", children: [
|
|
7063
|
+
visibleDeposits.map((deposit, i) => /* @__PURE__ */ jsx18(HistoryCard, { deposit }, deposit.txHash || i)),
|
|
7064
|
+
hasMore && /* @__PURE__ */ jsx18(
|
|
6071
7065
|
"button",
|
|
6072
7066
|
{
|
|
6073
7067
|
type: "button",
|
|
@@ -6079,14 +7073,14 @@ function DepositHistoryPanel({
|
|
|
6079
7073
|
)
|
|
6080
7074
|
] })
|
|
6081
7075
|
] }),
|
|
6082
|
-
/* @__PURE__ */
|
|
7076
|
+
/* @__PURE__ */ jsx18(PoweredBy, {})
|
|
6083
7077
|
] })
|
|
6084
7078
|
]
|
|
6085
7079
|
}
|
|
6086
7080
|
);
|
|
6087
7081
|
}
|
|
6088
7082
|
function HistoryCard({ deposit }) {
|
|
6089
|
-
const [expanded, setExpanded] =
|
|
7083
|
+
const [expanded, setExpanded] = useState12(false);
|
|
6090
7084
|
const status = normalizeStatus(deposit.status, deposit.isSpam);
|
|
6091
7085
|
const sourceChainId = resolveChainId(deposit.chain);
|
|
6092
7086
|
const targetChainId = resolveChainId(deposit.targetChain);
|
|
@@ -6105,7 +7099,7 @@ function HistoryCard({ deposit }) {
|
|
|
6105
7099
|
const date = deposit.createdAt ? formatDate(deposit.createdAt) : null;
|
|
6106
7100
|
const txTypeLabel = `Deposit${sourceSymbol ? ` ${sourceSymbol}` : ""}`;
|
|
6107
7101
|
const srcTxUrl = deposit.sourceTxHash ? getTxExplorerUrl(deposit.sourceTxHash, sourceChainId) : null;
|
|
6108
|
-
return /* @__PURE__ */
|
|
7102
|
+
return /* @__PURE__ */ jsxs16(
|
|
6109
7103
|
"button",
|
|
6110
7104
|
{
|
|
6111
7105
|
type: "button",
|
|
@@ -6113,38 +7107,38 @@ function HistoryCard({ deposit }) {
|
|
|
6113
7107
|
onClick: () => setExpanded((v) => !v),
|
|
6114
7108
|
"aria-expanded": expanded,
|
|
6115
7109
|
children: [
|
|
6116
|
-
/* @__PURE__ */
|
|
6117
|
-
/* @__PURE__ */
|
|
6118
|
-
/* @__PURE__ */
|
|
6119
|
-
sourceChainIcon && /* @__PURE__ */
|
|
7110
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-history-card-row", children: [
|
|
7111
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-history-card-icons", children: [
|
|
7112
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-card-token", children: sourceTokenIcon ? /* @__PURE__ */ jsx18("img", { src: sourceTokenIcon, alt: "" }) : sourceSymbol.slice(0, 2) }),
|
|
7113
|
+
sourceChainIcon && /* @__PURE__ */ jsx18("span", { className: "rs-history-card-chain", children: /* @__PURE__ */ jsx18("img", { src: sourceChainIcon, alt: "" }) })
|
|
6120
7114
|
] }),
|
|
6121
|
-
/* @__PURE__ */
|
|
6122
|
-
/* @__PURE__ */
|
|
6123
|
-
date && /* @__PURE__ */
|
|
7115
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-history-card-text", children: [
|
|
7116
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-card-title", children: txTypeLabel }),
|
|
7117
|
+
date && /* @__PURE__ */ jsx18("span", { className: "rs-history-card-date", children: date })
|
|
6124
7118
|
] }),
|
|
6125
|
-
/* @__PURE__ */
|
|
6126
|
-
/* @__PURE__ */
|
|
6127
|
-
/* @__PURE__ */
|
|
7119
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-history-card-side", children: [
|
|
7120
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-card-amount", children: displayAmount }),
|
|
7121
|
+
/* @__PURE__ */ jsx18("span", { className: `rs-history-badge rs-history-badge--${status}`, children: STATUS_LABEL[status] })
|
|
6128
7122
|
] })
|
|
6129
7123
|
] }),
|
|
6130
|
-
/* @__PURE__ */
|
|
6131
|
-
sourceChainName && /* @__PURE__ */
|
|
6132
|
-
/* @__PURE__ */
|
|
6133
|
-
/* @__PURE__ */
|
|
6134
|
-
/* @__PURE__ */
|
|
6135
|
-
sourceChainIcon && /* @__PURE__ */
|
|
7124
|
+
/* @__PURE__ */ jsx18("div", { className: "rs-history-card-panel", children: /* @__PURE__ */ jsx18("div", { className: "rs-history-card-panel-inner", children: /* @__PURE__ */ jsxs16("div", { className: "rs-history-card-details", children: [
|
|
7125
|
+
sourceChainName && /* @__PURE__ */ jsxs16("div", { className: "rs-amount-detail-row", children: [
|
|
7126
|
+
/* @__PURE__ */ jsx18("span", { children: "Source chain" }),
|
|
7127
|
+
/* @__PURE__ */ jsxs16("span", { className: "rs-amount-detail-value", children: [
|
|
7128
|
+
/* @__PURE__ */ jsx18("span", { children: sourceChainName }),
|
|
7129
|
+
sourceChainIcon && /* @__PURE__ */ jsx18("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx18("img", { src: sourceChainIcon, alt: "" }) })
|
|
6136
7130
|
] })
|
|
6137
7131
|
] }),
|
|
6138
|
-
targetChainName && /* @__PURE__ */
|
|
6139
|
-
/* @__PURE__ */
|
|
6140
|
-
/* @__PURE__ */
|
|
6141
|
-
/* @__PURE__ */
|
|
6142
|
-
targetChainIcon && /* @__PURE__ */
|
|
7132
|
+
targetChainName && /* @__PURE__ */ jsxs16("div", { className: "rs-amount-detail-row", children: [
|
|
7133
|
+
/* @__PURE__ */ jsx18("span", { children: "Destination chain" }),
|
|
7134
|
+
/* @__PURE__ */ jsxs16("span", { className: "rs-amount-detail-value", children: [
|
|
7135
|
+
/* @__PURE__ */ jsx18("span", { children: targetChainName }),
|
|
7136
|
+
targetChainIcon && /* @__PURE__ */ jsx18("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx18("img", { src: targetChainIcon, alt: "" }) })
|
|
6143
7137
|
] })
|
|
6144
7138
|
] }),
|
|
6145
|
-
srcTxUrl && deposit.sourceTxHash && /* @__PURE__ */
|
|
6146
|
-
/* @__PURE__ */
|
|
6147
|
-
/* @__PURE__ */
|
|
7139
|
+
srcTxUrl && deposit.sourceTxHash && /* @__PURE__ */ jsxs16("div", { className: "rs-amount-detail-row", children: [
|
|
7140
|
+
/* @__PURE__ */ jsx18("span", { children: "Transaction details" }),
|
|
7141
|
+
/* @__PURE__ */ jsxs16(
|
|
6148
7142
|
"a",
|
|
6149
7143
|
{
|
|
6150
7144
|
href: srcTxUrl,
|
|
@@ -6153,8 +7147,8 @@ function HistoryCard({ deposit }) {
|
|
|
6153
7147
|
className: "rs-history-card-link",
|
|
6154
7148
|
onClick: (e) => e.stopPropagation(),
|
|
6155
7149
|
children: [
|
|
6156
|
-
/* @__PURE__ */
|
|
6157
|
-
/* @__PURE__ */
|
|
7150
|
+
/* @__PURE__ */ jsx18("span", { children: shortenHash(deposit.sourceTxHash) }),
|
|
7151
|
+
/* @__PURE__ */ jsx18(ArrowUpRightIcon, {})
|
|
6158
7152
|
]
|
|
6159
7153
|
}
|
|
6160
7154
|
)
|
|
@@ -6167,9 +7161,9 @@ function HistoryCard({ deposit }) {
|
|
|
6167
7161
|
DepositHistoryPanel.displayName = "DepositHistoryPanel";
|
|
6168
7162
|
|
|
6169
7163
|
// src/DepositModal.tsx
|
|
6170
|
-
import { jsx as
|
|
7164
|
+
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6171
7165
|
var ReownDepositInner = lazy2(
|
|
6172
|
-
() => import("./DepositModalReown-
|
|
7166
|
+
() => import("./DepositModalReown-DIUIB3MU.mjs").then((m) => ({ default: m.DepositModalReown }))
|
|
6173
7167
|
);
|
|
6174
7168
|
function sortByCreatedAtDesc(items) {
|
|
6175
7169
|
return [...items].sort((a, b) => {
|
|
@@ -6185,7 +7179,7 @@ function DepositModal(props) {
|
|
|
6185
7179
|
"dappWalletClient"
|
|
6186
7180
|
);
|
|
6187
7181
|
if (needsReown) {
|
|
6188
|
-
return /* @__PURE__ */
|
|
7182
|
+
return /* @__PURE__ */ jsx19(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx19(
|
|
6189
7183
|
ReownDepositInner,
|
|
6190
7184
|
{
|
|
6191
7185
|
...props,
|
|
@@ -6193,7 +7187,7 @@ function DepositModal(props) {
|
|
|
6193
7187
|
}
|
|
6194
7188
|
) });
|
|
6195
7189
|
}
|
|
6196
|
-
return /* @__PURE__ */
|
|
7190
|
+
return /* @__PURE__ */ jsx19(
|
|
6197
7191
|
DepositModalInner,
|
|
6198
7192
|
{
|
|
6199
7193
|
...props,
|
|
@@ -6225,6 +7219,10 @@ function DepositModalInner({
|
|
|
6225
7219
|
forceRegister = false,
|
|
6226
7220
|
enableSolana = true,
|
|
6227
7221
|
dappImports,
|
|
7222
|
+
enableFiatOnramp = false,
|
|
7223
|
+
enableQrTransfer = true,
|
|
7224
|
+
fiatOnrampMethods,
|
|
7225
|
+
enableExchangeConnect = false,
|
|
6228
7226
|
postBridgeActions,
|
|
6229
7227
|
outputTokenRules,
|
|
6230
7228
|
rejectUnmapped,
|
|
@@ -6242,61 +7240,61 @@ function DepositModalInner({
|
|
|
6242
7240
|
onError,
|
|
6243
7241
|
debug
|
|
6244
7242
|
}) {
|
|
6245
|
-
const modalRef =
|
|
7243
|
+
const modalRef = useRef9(null);
|
|
6246
7244
|
const onReadyRef = useLatestRef(onReady);
|
|
6247
|
-
const [currentScreen, setCurrentScreen] =
|
|
6248
|
-
const [backHandler, setBackHandler] =
|
|
7245
|
+
const [currentScreen, setCurrentScreen] = useState13("connect");
|
|
7246
|
+
const [backHandler, setBackHandler] = useState13(
|
|
6249
7247
|
void 0
|
|
6250
7248
|
);
|
|
6251
7249
|
const showHistoryButton = uiConfig?.showHistoryButton ?? false;
|
|
6252
7250
|
const historyButtonVisible = showHistoryButton && (currentScreen === "select-asset" || currentScreen === "deposit-address");
|
|
6253
|
-
const [historyOpen, setHistoryOpen] =
|
|
6254
|
-
const [historyDeposits, setHistoryDeposits] =
|
|
6255
|
-
const [hasMoreHistory, setHasMoreHistory] =
|
|
6256
|
-
const [historyLoading, setHistoryLoading] =
|
|
6257
|
-
const [historyLoadingMore, setHistoryLoadingMore] =
|
|
6258
|
-
const [historyError, setHistoryError] =
|
|
6259
|
-
const cursorRef =
|
|
6260
|
-
const historyStaleRef =
|
|
6261
|
-
const historyLoadedRef =
|
|
7251
|
+
const [historyOpen, setHistoryOpen] = useState13(false);
|
|
7252
|
+
const [historyDeposits, setHistoryDeposits] = useState13([]);
|
|
7253
|
+
const [hasMoreHistory, setHasMoreHistory] = useState13(false);
|
|
7254
|
+
const [historyLoading, setHistoryLoading] = useState13(false);
|
|
7255
|
+
const [historyLoadingMore, setHistoryLoadingMore] = useState13(false);
|
|
7256
|
+
const [historyError, setHistoryError] = useState13(null);
|
|
7257
|
+
const cursorRef = useRef9(null);
|
|
7258
|
+
const historyStaleRef = useRef9(false);
|
|
7259
|
+
const historyLoadedRef = useRef9(false);
|
|
6262
7260
|
const targetChain = targetChainProp === "solana" ? "solana" : getChainId(targetChainProp);
|
|
6263
7261
|
const sourceChain = sourceChainProp ? getChainId(sourceChainProp) : void 0;
|
|
6264
|
-
const service =
|
|
7262
|
+
const service = useMemo9(
|
|
6265
7263
|
() => createDepositService(backendUrl, {
|
|
6266
7264
|
debug,
|
|
6267
7265
|
debugScope: "service:deposit"
|
|
6268
7266
|
}),
|
|
6269
7267
|
[backendUrl, debug]
|
|
6270
7268
|
);
|
|
6271
|
-
const store =
|
|
7269
|
+
const store = useMemo9(
|
|
6272
7270
|
() => createDepositStore({ targetChain, targetToken }),
|
|
6273
7271
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6274
7272
|
[]
|
|
6275
7273
|
);
|
|
6276
|
-
|
|
7274
|
+
useEffect11(() => {
|
|
6277
7275
|
store.dispatch({ type: "target/changed", targetChain, targetToken });
|
|
6278
7276
|
}, [store, targetChain, targetToken]);
|
|
6279
|
-
|
|
7277
|
+
useEffect11(() => {
|
|
6280
7278
|
if (isOpen && modalRef.current) {
|
|
6281
7279
|
applyTheme(modalRef.current, theme);
|
|
6282
7280
|
}
|
|
6283
7281
|
}, [isOpen, theme]);
|
|
6284
|
-
|
|
7282
|
+
useEffect11(() => {
|
|
6285
7283
|
configureSolanaRpcUrl(solanaRpcUrl);
|
|
6286
7284
|
}, [solanaRpcUrl]);
|
|
6287
|
-
|
|
7285
|
+
useEffect11(() => {
|
|
6288
7286
|
if (isOpen) {
|
|
6289
7287
|
onReadyRef.current?.();
|
|
6290
7288
|
}
|
|
6291
7289
|
}, [isOpen, onReadyRef]);
|
|
6292
|
-
const handleStepChange =
|
|
7290
|
+
const handleStepChange = useCallback9(
|
|
6293
7291
|
(onBack, screen) => {
|
|
6294
7292
|
setBackHandler(() => onBack);
|
|
6295
7293
|
if (screen) setCurrentScreen(screen);
|
|
6296
7294
|
},
|
|
6297
7295
|
[]
|
|
6298
7296
|
);
|
|
6299
|
-
const fetchHistory =
|
|
7297
|
+
const fetchHistory = useCallback9(
|
|
6300
7298
|
async (mode = "initial") => {
|
|
6301
7299
|
if (!recipient) return;
|
|
6302
7300
|
const isInitial = mode === "initial";
|
|
@@ -6344,26 +7342,26 @@ function DepositModalInner({
|
|
|
6344
7342
|
},
|
|
6345
7343
|
[recipient, service]
|
|
6346
7344
|
);
|
|
6347
|
-
const handleHistoryOpen =
|
|
7345
|
+
const handleHistoryOpen = useCallback9(() => {
|
|
6348
7346
|
setHistoryOpen(true);
|
|
6349
7347
|
if (!historyLoadedRef.current || historyStaleRef.current) {
|
|
6350
7348
|
fetchHistory("initial");
|
|
6351
7349
|
}
|
|
6352
7350
|
}, [fetchHistory]);
|
|
6353
|
-
const handleHistoryClose =
|
|
7351
|
+
const handleHistoryClose = useCallback9(() => {
|
|
6354
7352
|
setHistoryOpen(false);
|
|
6355
7353
|
}, []);
|
|
6356
|
-
const handleHistoryLoadMore =
|
|
7354
|
+
const handleHistoryLoadMore = useCallback9(() => {
|
|
6357
7355
|
fetchHistory("more");
|
|
6358
7356
|
}, [fetchHistory]);
|
|
6359
|
-
const markHistoryStale =
|
|
7357
|
+
const markHistoryStale = useCallback9(() => {
|
|
6360
7358
|
historyStaleRef.current = true;
|
|
6361
7359
|
if (historyOpen) {
|
|
6362
7360
|
fetchHistory("initial");
|
|
6363
7361
|
}
|
|
6364
7362
|
}, [historyOpen, fetchHistory]);
|
|
6365
7363
|
const onLifecycleRef = useLatestRef(onLifecycle);
|
|
6366
|
-
const handleLifecycle =
|
|
7364
|
+
const handleLifecycle = useCallback9(
|
|
6367
7365
|
(event) => {
|
|
6368
7366
|
onLifecycleRef.current?.(event);
|
|
6369
7367
|
if (event.type === "smart-account-changed" && !event.evm && !event.solana) {
|
|
@@ -6375,7 +7373,7 @@ function DepositModalInner({
|
|
|
6375
7373
|
},
|
|
6376
7374
|
[onLifecycleRef, showHistoryButton, markHistoryStale]
|
|
6377
7375
|
);
|
|
6378
|
-
|
|
7376
|
+
useEffect11(() => {
|
|
6379
7377
|
if (!isOpen) {
|
|
6380
7378
|
setHistoryOpen(false);
|
|
6381
7379
|
setHistoryDeposits([]);
|
|
@@ -6386,14 +7384,14 @@ function DepositModalInner({
|
|
|
6386
7384
|
historyLoadedRef.current = false;
|
|
6387
7385
|
}
|
|
6388
7386
|
}, [isOpen]);
|
|
6389
|
-
|
|
7387
|
+
useEffect11(() => {
|
|
6390
7388
|
if (!isOpen) {
|
|
6391
7389
|
store.dispatch({ type: "flow/reset" });
|
|
6392
7390
|
}
|
|
6393
7391
|
}, [isOpen, store]);
|
|
6394
7392
|
const showBackButton = uiConfig?.showBackButton ?? true;
|
|
6395
7393
|
const canGoBack = backHandler !== void 0;
|
|
6396
|
-
return /* @__PURE__ */
|
|
7394
|
+
return /* @__PURE__ */ jsx19(DepositStoreProvider, { store, children: /* @__PURE__ */ jsx19(
|
|
6397
7395
|
Modal,
|
|
6398
7396
|
{
|
|
6399
7397
|
isOpen,
|
|
@@ -6401,20 +7399,20 @@ function DepositModalInner({
|
|
|
6401
7399
|
className,
|
|
6402
7400
|
inline,
|
|
6403
7401
|
closeOnOverlayClick,
|
|
6404
|
-
children: /* @__PURE__ */
|
|
6405
|
-
/* @__PURE__ */
|
|
6406
|
-
/* @__PURE__ */
|
|
7402
|
+
children: /* @__PURE__ */ jsxs17("div", { ref: modalRef, className: "rs-modal", children: [
|
|
7403
|
+
/* @__PURE__ */ jsxs17("div", { className: "rs-modal-header--redesigned", children: [
|
|
7404
|
+
/* @__PURE__ */ jsx19("div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && backHandler && /* @__PURE__ */ jsx19(
|
|
6407
7405
|
"button",
|
|
6408
7406
|
{
|
|
6409
7407
|
type: "button",
|
|
6410
7408
|
className: "rs-modal-header-back",
|
|
6411
7409
|
"aria-label": "Go back",
|
|
6412
7410
|
onClick: backHandler,
|
|
6413
|
-
children: /* @__PURE__ */
|
|
7411
|
+
children: /* @__PURE__ */ jsx19(ChevronLeftIcon, {})
|
|
6414
7412
|
}
|
|
6415
7413
|
) }),
|
|
6416
|
-
/* @__PURE__ */
|
|
6417
|
-
historyButtonVisible && /* @__PURE__ */
|
|
7414
|
+
/* @__PURE__ */ jsxs17("div", { className: "rs-modal-header-nav-right", children: [
|
|
7415
|
+
historyButtonVisible && /* @__PURE__ */ jsx19(
|
|
6418
7416
|
"button",
|
|
6419
7417
|
{
|
|
6420
7418
|
type: "button",
|
|
@@ -6422,22 +7420,22 @@ function DepositModalInner({
|
|
|
6422
7420
|
"aria-label": "Deposit history",
|
|
6423
7421
|
onClick: handleHistoryOpen,
|
|
6424
7422
|
disabled: !recipient,
|
|
6425
|
-
children: /* @__PURE__ */
|
|
7423
|
+
children: /* @__PURE__ */ jsx19(HistoryIcon, {})
|
|
6426
7424
|
}
|
|
6427
7425
|
),
|
|
6428
|
-
/* @__PURE__ */
|
|
7426
|
+
/* @__PURE__ */ jsx19(
|
|
6429
7427
|
"button",
|
|
6430
7428
|
{
|
|
6431
7429
|
type: "button",
|
|
6432
7430
|
onClick: onClose,
|
|
6433
7431
|
className: "rs-modal-close",
|
|
6434
7432
|
"aria-label": "Close",
|
|
6435
|
-
children: /* @__PURE__ */
|
|
7433
|
+
children: /* @__PURE__ */ jsx19(CloseIcon, {})
|
|
6436
7434
|
}
|
|
6437
7435
|
)
|
|
6438
7436
|
] })
|
|
6439
7437
|
] }),
|
|
6440
|
-
/* @__PURE__ */
|
|
7438
|
+
/* @__PURE__ */ jsx19(
|
|
6441
7439
|
DepositFlow,
|
|
6442
7440
|
{
|
|
6443
7441
|
dappWalletClient,
|
|
@@ -6460,6 +7458,10 @@ function DepositModalInner({
|
|
|
6460
7458
|
forceRegister,
|
|
6461
7459
|
enableSolana,
|
|
6462
7460
|
dappImports,
|
|
7461
|
+
enableFiatOnramp,
|
|
7462
|
+
enableQrTransfer,
|
|
7463
|
+
fiatOnrampMethods,
|
|
7464
|
+
enableExchangeConnect,
|
|
6463
7465
|
reownWallet,
|
|
6464
7466
|
onConnect,
|
|
6465
7467
|
onDisconnect,
|
|
@@ -6474,7 +7476,7 @@ function DepositModalInner({
|
|
|
6474
7476
|
debug
|
|
6475
7477
|
}
|
|
6476
7478
|
),
|
|
6477
|
-
showHistoryButton && historyOpen && /* @__PURE__ */
|
|
7479
|
+
showHistoryButton && historyOpen && /* @__PURE__ */ jsx19(
|
|
6478
7480
|
DepositHistoryPanel,
|
|
6479
7481
|
{
|
|
6480
7482
|
deposits: historyDeposits,
|