@rhinestone/deposit-modal 0.3.0-alpha.11 → 0.3.0-alpha.13
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-KXFF6ZXY.cjs → DepositModalReown-CXPRZRXL.cjs} +6 -6
- package/dist/{DepositModalReown-UNFGBOIJ.mjs → DepositModalReown-HBAWSK6K.mjs} +3 -3
- package/dist/{WithdrawModalReown-QEQPCSWT.mjs → WithdrawModalReown-EEWQRENY.mjs} +3 -3
- package/dist/{WithdrawModalReown-Z5JVENP6.cjs → WithdrawModalReown-T3TPJIME.cjs} +6 -6
- package/dist/{chunk-WVE3JN3C.mjs → chunk-6K4JHM2D.mjs} +343 -50
- package/dist/{chunk-YI63OMXN.cjs → chunk-6RCOF3XU.cjs} +57 -57
- package/dist/{chunk-2TWQGPPB.cjs → chunk-DZNXG5JK.cjs} +372 -79
- package/dist/{chunk-7MZNQ4C2.mjs → chunk-EC63ZHY4.mjs} +2 -2
- package/dist/{chunk-V63GWJHB.mjs → chunk-HZBO2SIZ.mjs} +1503 -366
- package/dist/{chunk-FGVSNARE.cjs → chunk-PWV2UJP3.cjs} +2 -2
- package/dist/{chunk-Y4CESMTH.cjs → chunk-SEOQ66FW.cjs} +1420 -283
- package/dist/{chunk-QXIJLRKC.mjs → chunk-YB3JPWJW.mjs} +1 -1
- 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 +547 -12
- 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-6K4JHM2D.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
|
|
@@ -1438,8 +1450,8 @@ function DepositAddressStep({
|
|
|
1438
1450
|
options.splice(1, 0, "solana");
|
|
1439
1451
|
return options;
|
|
1440
1452
|
}, [evmChainIds, hasSolana]);
|
|
1441
|
-
const
|
|
1442
|
-
const defaultChainId = evmChainIds.includes(
|
|
1453
|
+
const BASE_CHAIN_ID2 = 8453;
|
|
1454
|
+
const defaultChainId = evmChainIds.includes(BASE_CHAIN_ID2) ? BASE_CHAIN_ID2 : evmChainIds[0];
|
|
1443
1455
|
const [sourceChainId, setSourceChainId] = useState5(defaultChainId);
|
|
1444
1456
|
const isSolana = sourceChainId === "solana";
|
|
1445
1457
|
const tokensForChain = useMemo3(
|
|
@@ -1948,10 +1960,797 @@ function DepositAddressStep({
|
|
|
1948
1960
|
}
|
|
1949
1961
|
DepositAddressStep.displayName = "DepositAddressStep";
|
|
1950
1962
|
|
|
1963
|
+
// src/components/steps/FiatOnrampStep.tsx
|
|
1964
|
+
import { useCallback as useCallback3 } from "react";
|
|
1965
|
+
|
|
1966
|
+
// src/components/steps/SwappedIframeStep.tsx
|
|
1967
|
+
import { useState as useState6, useEffect as useEffect6, useRef as useRef6, useMemo as useMemo4 } from "react";
|
|
1968
|
+
|
|
1969
|
+
// src/components/steps/SwappedOrderTracker.tsx
|
|
1970
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1971
|
+
var STEP_LABELS = [
|
|
1972
|
+
"Payment received",
|
|
1973
|
+
null,
|
|
1974
|
+
"Processing App deposit",
|
|
1975
|
+
"Deposit successful"
|
|
1976
|
+
];
|
|
1977
|
+
function SwappedOrderTracker({
|
|
1978
|
+
amount,
|
|
1979
|
+
currency = "USDC",
|
|
1980
|
+
chainLabel = "Base",
|
|
1981
|
+
stepStates,
|
|
1982
|
+
terminal = null,
|
|
1983
|
+
onRetry
|
|
1984
|
+
}) {
|
|
1985
|
+
const formattedAmount = formatTrackerAmount(amount);
|
|
1986
|
+
const title = terminal ? terminal.kind === "cancelled" ? "Order cancelled" : "Deposit failed" : formattedAmount ? `Depositing ${formattedAmount} ${currency}` : `Depositing ${currency}`;
|
|
1987
|
+
const labels = [
|
|
1988
|
+
STEP_LABELS[0],
|
|
1989
|
+
`${currency} received on ${chainLabel}`,
|
|
1990
|
+
STEP_LABELS[2],
|
|
1991
|
+
STEP_LABELS[3]
|
|
1992
|
+
];
|
|
1993
|
+
return /* @__PURE__ */ jsxs7("div", { className: "rs-screen rs-swapped-tracker", children: [
|
|
1994
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
1995
|
+
/* @__PURE__ */ jsx7(BodyHeader, { icon: /* @__PURE__ */ jsx7(HandCoinsIcon, {}), title }),
|
|
1996
|
+
/* @__PURE__ */ jsx7("ol", { className: "rs-swapped-tracker-steps", children: labels.map((label, idx) => {
|
|
1997
|
+
const status = stepStates[idx];
|
|
1998
|
+
return /* @__PURE__ */ jsxs7(
|
|
1999
|
+
"li",
|
|
2000
|
+
{
|
|
2001
|
+
className: `rs-swapped-tracker-step rs-swapped-tracker-step--${status}`,
|
|
2002
|
+
children: [
|
|
2003
|
+
/* @__PURE__ */ jsx7("span", { className: "rs-swapped-tracker-step-label", children: label }),
|
|
2004
|
+
/* @__PURE__ */ jsx7(
|
|
2005
|
+
"span",
|
|
2006
|
+
{
|
|
2007
|
+
className: "rs-swapped-tracker-step-marker",
|
|
2008
|
+
"aria-hidden": "true",
|
|
2009
|
+
children: status === "complete" ? /* @__PURE__ */ jsx7(CheckIcon, {}) : status === "failed" ? /* @__PURE__ */ jsx7(CloseIcon, {}) : status === "active" ? /* @__PURE__ */ jsx7(Spinner, {}) : null
|
|
2010
|
+
}
|
|
2011
|
+
)
|
|
2012
|
+
]
|
|
2013
|
+
},
|
|
2014
|
+
label
|
|
2015
|
+
);
|
|
2016
|
+
}) }),
|
|
2017
|
+
terminal && /* @__PURE__ */ jsxs7(
|
|
2018
|
+
"div",
|
|
2019
|
+
{
|
|
2020
|
+
className: `rs-swapped-tracker-terminal rs-swapped-tracker-terminal--${terminal.kind}`,
|
|
2021
|
+
children: [
|
|
2022
|
+
/* @__PURE__ */ jsx7("p", { className: "rs-swapped-tracker-terminal-message", children: terminal.message }),
|
|
2023
|
+
terminal.kind === "cancelled" && onRetry && /* @__PURE__ */ jsx7(
|
|
2024
|
+
"button",
|
|
2025
|
+
{
|
|
2026
|
+
type: "button",
|
|
2027
|
+
className: "rs-swapped-tracker-retry",
|
|
2028
|
+
onClick: onRetry,
|
|
2029
|
+
children: "Try again"
|
|
2030
|
+
}
|
|
2031
|
+
)
|
|
2032
|
+
]
|
|
2033
|
+
}
|
|
2034
|
+
)
|
|
2035
|
+
] }),
|
|
2036
|
+
/* @__PURE__ */ jsx7(PoweredBy, {})
|
|
2037
|
+
] });
|
|
2038
|
+
}
|
|
2039
|
+
function formatTrackerAmount(amount) {
|
|
2040
|
+
if (!amount) return null;
|
|
2041
|
+
const num = Number(amount);
|
|
2042
|
+
if (!Number.isFinite(num)) return amount;
|
|
2043
|
+
return num.toFixed(2);
|
|
2044
|
+
}
|
|
2045
|
+
SwappedOrderTracker.displayName = "SwappedOrderTracker";
|
|
2046
|
+
|
|
2047
|
+
// src/components/steps/SwappedIframeStep.tsx
|
|
2048
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2049
|
+
var STATUS_POLL_INTERVAL_MS = 2e3;
|
|
2050
|
+
var DEPOSIT_POLL_INTERVAL_MS = 2e3;
|
|
2051
|
+
var DEPOSIT_POLL_FAST_INITIAL_DELAY_MS = 1e3;
|
|
2052
|
+
var DEPOSIT_POLL_FAST_INTERVAL_MS = 500;
|
|
2053
|
+
var IFRAME_LOAD_TIMEOUT_MS = 15e3;
|
|
2054
|
+
var SWAPPED_IFRAME_ORIGINS = /* @__PURE__ */ new Set([
|
|
2055
|
+
"https://sandbox.swapped.com",
|
|
2056
|
+
"https://widget.swapped.com"
|
|
2057
|
+
]);
|
|
2058
|
+
var SWAPPED_TERMINAL_STATUSES = /* @__PURE__ */ new Set([
|
|
2059
|
+
"order_completed",
|
|
2060
|
+
"order_broadcasted"
|
|
2061
|
+
]);
|
|
2062
|
+
var SWAPPED_STATUS_VALUES = /* @__PURE__ */ new Set([
|
|
2063
|
+
"payment_pending",
|
|
2064
|
+
"order_completed",
|
|
2065
|
+
"order_broadcasted",
|
|
2066
|
+
"order_cancelled"
|
|
2067
|
+
]);
|
|
2068
|
+
function parseSwappedIframeMessage(raw) {
|
|
2069
|
+
let data = raw;
|
|
2070
|
+
if (typeof data === "string") {
|
|
2071
|
+
try {
|
|
2072
|
+
data = JSON.parse(data);
|
|
2073
|
+
} catch {
|
|
2074
|
+
return null;
|
|
2075
|
+
}
|
|
2076
|
+
}
|
|
2077
|
+
if (!data || typeof data !== "object") return null;
|
|
2078
|
+
const obj = data;
|
|
2079
|
+
const inner = obj.data && typeof obj.data === "object" ? obj.data : obj;
|
|
2080
|
+
const rawStatus = inner.order_status ?? inner.status ?? obj.status;
|
|
2081
|
+
if (typeof rawStatus !== "string" || !SWAPPED_STATUS_VALUES.has(rawStatus)) {
|
|
2082
|
+
return null;
|
|
2083
|
+
}
|
|
2084
|
+
const asString2 = (v) => typeof v === "string" && v.length > 0 ? v : void 0;
|
|
2085
|
+
return {
|
|
2086
|
+
status: rawStatus,
|
|
2087
|
+
orderId: asString2(inner.order_id) ?? asString2(obj.orderId),
|
|
2088
|
+
orderCrypto: asString2(inner.order_crypto) ?? asString2(obj.orderCrypto),
|
|
2089
|
+
orderCryptoAmount: asString2(inner.order_crypto_amount) ?? asString2(obj.orderCryptoAmount),
|
|
2090
|
+
transactionId: asString2(inner.transaction_id) ?? asString2(obj.transactionId)
|
|
2091
|
+
};
|
|
2092
|
+
}
|
|
2093
|
+
function SwappedIframeStep({
|
|
2094
|
+
smartAccount,
|
|
2095
|
+
service,
|
|
2096
|
+
variant,
|
|
2097
|
+
loadUrl,
|
|
2098
|
+
iframeTitle,
|
|
2099
|
+
loadErrorCode,
|
|
2100
|
+
loadErrorFallback,
|
|
2101
|
+
bannerForStatus,
|
|
2102
|
+
onSwappedComplete,
|
|
2103
|
+
onSwappedFailed,
|
|
2104
|
+
onClose,
|
|
2105
|
+
onError
|
|
2106
|
+
}) {
|
|
2107
|
+
const [widgetUrl, setWidgetUrl] = useState6(null);
|
|
2108
|
+
const [loadError, setLoadError] = useState6(null);
|
|
2109
|
+
const [iframeLoaded, setIframeLoaded] = useState6(false);
|
|
2110
|
+
const [retryToken, setRetryToken] = useState6(0);
|
|
2111
|
+
const [orderState, setOrderState] = useState6(null);
|
|
2112
|
+
const [latestEvent, setLatestEvent] = useState6(null);
|
|
2113
|
+
const [phase, setPhase] = useState6("iframe");
|
|
2114
|
+
const completeFiredRef = useRef6(false);
|
|
2115
|
+
const failedFiredRef = useRef6(false);
|
|
2116
|
+
const expectedOrderUuidRef = useRef6(null);
|
|
2117
|
+
const baselineDepositTxHashRef = useRef6(void 0);
|
|
2118
|
+
const currentDepositTxHashRef = useRef6(null);
|
|
2119
|
+
const fastDepositPollEnabledRef = useRef6(false);
|
|
2120
|
+
const rescheduleDepositPollRef = useRef6(
|
|
2121
|
+
null
|
|
2122
|
+
);
|
|
2123
|
+
const onSwappedCompleteRef = useRef6(onSwappedComplete);
|
|
2124
|
+
onSwappedCompleteRef.current = onSwappedComplete;
|
|
2125
|
+
const onSwappedFailedRef = useRef6(onSwappedFailed);
|
|
2126
|
+
onSwappedFailedRef.current = onSwappedFailed;
|
|
2127
|
+
const onErrorRef = useRef6(onError);
|
|
2128
|
+
onErrorRef.current = onError;
|
|
2129
|
+
const loadUrlRef = useRef6(loadUrl);
|
|
2130
|
+
loadUrlRef.current = loadUrl;
|
|
2131
|
+
useEffect6(() => {
|
|
2132
|
+
let cancelled = false;
|
|
2133
|
+
setLoadError(null);
|
|
2134
|
+
setIframeLoaded(false);
|
|
2135
|
+
setWidgetUrl(null);
|
|
2136
|
+
setOrderState(null);
|
|
2137
|
+
setLatestEvent(null);
|
|
2138
|
+
setPhase("iframe");
|
|
2139
|
+
expectedOrderUuidRef.current = null;
|
|
2140
|
+
completeFiredRef.current = false;
|
|
2141
|
+
failedFiredRef.current = false;
|
|
2142
|
+
baselineDepositTxHashRef.current = void 0;
|
|
2143
|
+
currentDepositTxHashRef.current = null;
|
|
2144
|
+
fastDepositPollEnabledRef.current = false;
|
|
2145
|
+
loadUrlRef.current().then((res) => {
|
|
2146
|
+
if (cancelled) return;
|
|
2147
|
+
setWidgetUrl(res.url);
|
|
2148
|
+
const sep = res.externalCustomerId.indexOf(":");
|
|
2149
|
+
expectedOrderUuidRef.current = sep >= 0 ? res.externalCustomerId.slice(sep + 1) : null;
|
|
2150
|
+
}).catch((err) => {
|
|
2151
|
+
if (cancelled) return;
|
|
2152
|
+
const message = err instanceof Error ? err.message : loadErrorFallback;
|
|
2153
|
+
setLoadError(message);
|
|
2154
|
+
onErrorRef.current?.(message, loadErrorCode);
|
|
2155
|
+
});
|
|
2156
|
+
return () => {
|
|
2157
|
+
cancelled = true;
|
|
2158
|
+
};
|
|
2159
|
+
}, [service, smartAccount, retryToken, loadErrorCode, loadErrorFallback]);
|
|
2160
|
+
useEffect6(() => {
|
|
2161
|
+
if (!widgetUrl || iframeLoaded || loadError) return;
|
|
2162
|
+
const timer = setTimeout(() => {
|
|
2163
|
+
setLoadError("Iframe took too long to load.");
|
|
2164
|
+
}, IFRAME_LOAD_TIMEOUT_MS);
|
|
2165
|
+
return () => clearTimeout(timer);
|
|
2166
|
+
}, [widgetUrl, iframeLoaded, loadError]);
|
|
2167
|
+
useEffect6(() => {
|
|
2168
|
+
let cancelled = false;
|
|
2169
|
+
let timeoutId;
|
|
2170
|
+
async function poll() {
|
|
2171
|
+
if (cancelled) return;
|
|
2172
|
+
try {
|
|
2173
|
+
const res = await service.fetchSwappedOrderStatus(smartAccount);
|
|
2174
|
+
if (cancelled) return;
|
|
2175
|
+
const isCurrentOrder = res !== null && expectedOrderUuidRef.current !== null && res.orderId === expectedOrderUuidRef.current;
|
|
2176
|
+
if (isCurrentOrder) {
|
|
2177
|
+
setOrderState(res);
|
|
2178
|
+
}
|
|
2179
|
+
} catch {
|
|
2180
|
+
}
|
|
2181
|
+
if (!cancelled) {
|
|
2182
|
+
timeoutId = setTimeout(poll, STATUS_POLL_INTERVAL_MS);
|
|
2183
|
+
}
|
|
2184
|
+
}
|
|
2185
|
+
poll();
|
|
2186
|
+
return () => {
|
|
2187
|
+
cancelled = true;
|
|
2188
|
+
clearTimeout(timeoutId);
|
|
2189
|
+
};
|
|
2190
|
+
}, [service, smartAccount]);
|
|
2191
|
+
useEffect6(() => {
|
|
2192
|
+
let cancelled = false;
|
|
2193
|
+
let timeoutId;
|
|
2194
|
+
async function pollDeposit() {
|
|
2195
|
+
if (cancelled) return;
|
|
2196
|
+
try {
|
|
2197
|
+
const status = await service.fetchLatestStatus(smartAccount);
|
|
2198
|
+
if (cancelled) return;
|
|
2199
|
+
const event = status.lastEvent;
|
|
2200
|
+
const eventTxHash = isDepositEvent(event) ? getEventTxHash(event) ?? null : null;
|
|
2201
|
+
if (baselineDepositTxHashRef.current === void 0) {
|
|
2202
|
+
baselineDepositTxHashRef.current = eventTxHash;
|
|
2203
|
+
} else if (eventTxHash && (!baselineDepositTxHashRef.current || !txRefsMatch(eventTxHash, baselineDepositTxHashRef.current))) {
|
|
2204
|
+
currentDepositTxHashRef.current = eventTxHash;
|
|
2205
|
+
setLatestEvent(event ?? null);
|
|
2206
|
+
}
|
|
2207
|
+
} catch {
|
|
2208
|
+
}
|
|
2209
|
+
if (!cancelled) {
|
|
2210
|
+
const nextInterval = fastDepositPollEnabledRef.current ? DEPOSIT_POLL_FAST_INTERVAL_MS : DEPOSIT_POLL_INTERVAL_MS;
|
|
2211
|
+
timeoutId = setTimeout(pollDeposit, nextInterval);
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
rescheduleDepositPollRef.current = (delayMs) => {
|
|
2215
|
+
if (cancelled) return;
|
|
2216
|
+
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
2217
|
+
timeoutId = setTimeout(pollDeposit, delayMs);
|
|
2218
|
+
};
|
|
2219
|
+
pollDeposit();
|
|
2220
|
+
return () => {
|
|
2221
|
+
cancelled = true;
|
|
2222
|
+
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
2223
|
+
rescheduleDepositPollRef.current = null;
|
|
2224
|
+
};
|
|
2225
|
+
}, [service, smartAccount]);
|
|
2226
|
+
useEffect6(() => {
|
|
2227
|
+
if (fastDepositPollEnabledRef.current) return;
|
|
2228
|
+
const status = orderState?.status;
|
|
2229
|
+
if (!status || !SWAPPED_TERMINAL_STATUSES.has(status)) return;
|
|
2230
|
+
fastDepositPollEnabledRef.current = true;
|
|
2231
|
+
rescheduleDepositPollRef.current?.(DEPOSIT_POLL_FAST_INITIAL_DELAY_MS);
|
|
2232
|
+
}, [orderState]);
|
|
2233
|
+
useEffect6(() => {
|
|
2234
|
+
function onMessage(e) {
|
|
2235
|
+
if (!SWAPPED_IFRAME_ORIGINS.has(e.origin)) return;
|
|
2236
|
+
const parsed = parseSwappedIframeMessage(e.data);
|
|
2237
|
+
if (!parsed) return;
|
|
2238
|
+
setOrderState((prev) => ({
|
|
2239
|
+
orderId: parsed.orderId ?? prev?.orderId ?? "",
|
|
2240
|
+
status: parsed.status,
|
|
2241
|
+
orderCrypto: parsed.orderCrypto ?? prev?.orderCrypto ?? null,
|
|
2242
|
+
orderCryptoAmount: parsed.orderCryptoAmount ?? prev?.orderCryptoAmount ?? null,
|
|
2243
|
+
transactionId: parsed.transactionId ?? prev?.transactionId ?? null,
|
|
2244
|
+
receivedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2245
|
+
paidAmountUsd: prev?.paidAmountUsd ?? null,
|
|
2246
|
+
paidAmountEur: prev?.paidAmountEur ?? null,
|
|
2247
|
+
onrampFeeUsd: prev?.onrampFeeUsd ?? null,
|
|
2248
|
+
paymentMethod: prev?.paymentMethod ?? null
|
|
2249
|
+
}));
|
|
2250
|
+
}
|
|
2251
|
+
window.addEventListener("message", onMessage);
|
|
2252
|
+
return () => window.removeEventListener("message", onMessage);
|
|
2253
|
+
}, []);
|
|
2254
|
+
useEffect6(() => {
|
|
2255
|
+
if (phase === "iframe" && orderState !== null) {
|
|
2256
|
+
setPhase("tracker");
|
|
2257
|
+
}
|
|
2258
|
+
}, [phase, orderState]);
|
|
2259
|
+
const stepStates = useMemo4(
|
|
2260
|
+
() => deriveStepStates(orderState?.status ?? null, latestEvent),
|
|
2261
|
+
[orderState, latestEvent]
|
|
2262
|
+
);
|
|
2263
|
+
const terminalState = useMemo4(() => {
|
|
2264
|
+
if (isFailedEvent(latestEvent ?? void 0)) {
|
|
2265
|
+
return {
|
|
2266
|
+
kind: "failed",
|
|
2267
|
+
message: failureMessageForEvent(latestEvent ?? void 0)
|
|
2268
|
+
};
|
|
2269
|
+
}
|
|
2270
|
+
if (orderState?.status === "order_cancelled") {
|
|
2271
|
+
const banner = bannerForStatus("order_cancelled", {});
|
|
2272
|
+
return { kind: "cancelled", message: banner.detail ?? banner.title };
|
|
2273
|
+
}
|
|
2274
|
+
return null;
|
|
2275
|
+
}, [latestEvent, orderState, bannerForStatus]);
|
|
2276
|
+
useEffect6(() => {
|
|
2277
|
+
if (completeFiredRef.current || failedFiredRef.current) return;
|
|
2278
|
+
const t = latestEvent?.type;
|
|
2279
|
+
const isSuccess = t === "bridge-complete" || t === "post-bridge-swap-complete";
|
|
2280
|
+
if (!isSuccess) return;
|
|
2281
|
+
const txHash = currentDepositTxHashRef.current;
|
|
2282
|
+
if (!txHash) return;
|
|
2283
|
+
completeFiredRef.current = true;
|
|
2284
|
+
onSwappedCompleteRef.current({
|
|
2285
|
+
txHash,
|
|
2286
|
+
orderCrypto: orderState?.orderCrypto ?? null,
|
|
2287
|
+
// Base-unit source amount from the deposit row/event, consistent with the
|
|
2288
|
+
// wallet/QR path. ProcessingStep + onLifecycle expect base units.
|
|
2289
|
+
amount: getEventSourceDetails(latestEvent ?? void 0).amount ?? null
|
|
2290
|
+
});
|
|
2291
|
+
}, [latestEvent, orderState]);
|
|
2292
|
+
useEffect6(() => {
|
|
2293
|
+
if (failedFiredRef.current || completeFiredRef.current) return;
|
|
2294
|
+
if (!isFailedEvent(latestEvent ?? void 0)) return;
|
|
2295
|
+
const txHash = currentDepositTxHashRef.current;
|
|
2296
|
+
if (!txHash) return;
|
|
2297
|
+
failedFiredRef.current = true;
|
|
2298
|
+
setPhase("tracker");
|
|
2299
|
+
onSwappedFailedRef.current?.(
|
|
2300
|
+
txHash,
|
|
2301
|
+
failureMessageForEvent(latestEvent ?? void 0)
|
|
2302
|
+
);
|
|
2303
|
+
}, [latestEvent]);
|
|
2304
|
+
if (phase === "tracker") {
|
|
2305
|
+
return /* @__PURE__ */ jsx8(
|
|
2306
|
+
SwappedOrderTracker,
|
|
2307
|
+
{
|
|
2308
|
+
amount: orderState?.orderCryptoAmount ?? null,
|
|
2309
|
+
currency: orderState?.orderCrypto ?? "USDC",
|
|
2310
|
+
stepStates,
|
|
2311
|
+
terminal: terminalState,
|
|
2312
|
+
onRetry: () => setRetryToken((n) => n + 1),
|
|
2313
|
+
onClose
|
|
2314
|
+
}
|
|
2315
|
+
);
|
|
2316
|
+
}
|
|
2317
|
+
return /* @__PURE__ */ jsxs8("div", { className: "rs-screen rs-fiat-onramp", "data-variant": variant, children: [
|
|
2318
|
+
/* @__PURE__ */ jsxs8("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2319
|
+
/* @__PURE__ */ jsx8(
|
|
2320
|
+
BodyHeader,
|
|
2321
|
+
{
|
|
2322
|
+
icon: /* @__PURE__ */ jsx8(HandCoinsIcon, {}),
|
|
2323
|
+
title: "Deposit",
|
|
2324
|
+
subtitle: "Add money to your balance"
|
|
2325
|
+
}
|
|
2326
|
+
),
|
|
2327
|
+
/* @__PURE__ */ jsxs8("div", { className: "rs-fiat-onramp-iframe-wrap", children: [
|
|
2328
|
+
loadError && /* @__PURE__ */ jsxs8("div", { className: "rs-fiat-onramp-error", children: [
|
|
2329
|
+
/* @__PURE__ */ jsx8("div", { children: loadError }),
|
|
2330
|
+
/* @__PURE__ */ jsx8(
|
|
2331
|
+
"button",
|
|
2332
|
+
{
|
|
2333
|
+
type: "button",
|
|
2334
|
+
className: "rs-fiat-onramp-retry",
|
|
2335
|
+
onClick: () => setRetryToken((n) => n + 1),
|
|
2336
|
+
children: "Retry"
|
|
2337
|
+
}
|
|
2338
|
+
)
|
|
2339
|
+
] }),
|
|
2340
|
+
!loadError && !iframeLoaded && /* @__PURE__ */ jsx8("div", { className: "rs-fiat-onramp-loading", children: /* @__PURE__ */ jsx8(Spinner, {}) }),
|
|
2341
|
+
widgetUrl && !loadError && /* @__PURE__ */ jsx8(
|
|
2342
|
+
"iframe",
|
|
2343
|
+
{
|
|
2344
|
+
src: widgetUrl,
|
|
2345
|
+
title: iframeTitle,
|
|
2346
|
+
className: "rs-fiat-onramp-iframe",
|
|
2347
|
+
sandbox: "allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation",
|
|
2348
|
+
allow: "payment; camera; microphone; clipboard-write; geolocation",
|
|
2349
|
+
onLoad: () => setIframeLoaded(true)
|
|
2350
|
+
},
|
|
2351
|
+
retryToken
|
|
2352
|
+
)
|
|
2353
|
+
] })
|
|
2354
|
+
] }),
|
|
2355
|
+
/* @__PURE__ */ jsx8(PoweredBy, {})
|
|
2356
|
+
] });
|
|
2357
|
+
}
|
|
2358
|
+
function deriveStepStates(swappedStatus, latestEvent) {
|
|
2359
|
+
if (isFailedEvent(latestEvent ?? void 0)) {
|
|
2360
|
+
return ["complete", "complete", "failed", "pending"];
|
|
2361
|
+
}
|
|
2362
|
+
if (swappedStatus === "order_cancelled") {
|
|
2363
|
+
return ["failed", "pending", "pending", "pending"];
|
|
2364
|
+
}
|
|
2365
|
+
const step1Complete = swappedStatus === "order_completed" || swappedStatus === "order_broadcasted";
|
|
2366
|
+
const step2Complete = latestEvent !== null;
|
|
2367
|
+
const step3Complete = latestEvent?.type === "bridge-complete" || latestEvent?.type === "post-bridge-swap-complete";
|
|
2368
|
+
if (step3Complete) {
|
|
2369
|
+
return ["complete", "complete", "complete", "pending"];
|
|
2370
|
+
}
|
|
2371
|
+
if (step2Complete) {
|
|
2372
|
+
return ["complete", "complete", "active", "pending"];
|
|
2373
|
+
}
|
|
2374
|
+
if (step1Complete) {
|
|
2375
|
+
return ["complete", "active", "pending", "pending"];
|
|
2376
|
+
}
|
|
2377
|
+
return ["active", "pending", "pending", "pending"];
|
|
2378
|
+
}
|
|
2379
|
+
SwappedIframeStep.displayName = "SwappedIframeStep";
|
|
2380
|
+
|
|
2381
|
+
// src/components/steps/FiatOnrampStep.tsx
|
|
2382
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
2383
|
+
function fiatBannerForStatus(status, context) {
|
|
2384
|
+
if (context.currencyMismatch) {
|
|
2385
|
+
return {
|
|
2386
|
+
level: "warning",
|
|
2387
|
+
title: "Currency mismatch",
|
|
2388
|
+
detail: "Funds may not bridge automatically. Contact support if your balance does not arrive."
|
|
2389
|
+
};
|
|
2390
|
+
}
|
|
2391
|
+
switch (status) {
|
|
2392
|
+
case "payment_pending":
|
|
2393
|
+
return { level: "info", title: "Verifying payment\u2026" };
|
|
2394
|
+
case "order_completed":
|
|
2395
|
+
return { level: "success", title: "Payment received \u2014 sending crypto" };
|
|
2396
|
+
case "order_broadcasted":
|
|
2397
|
+
return {
|
|
2398
|
+
level: "success",
|
|
2399
|
+
title: "Crypto sent \u2014 confirming on-chain"
|
|
2400
|
+
};
|
|
2401
|
+
case "order_cancelled":
|
|
2402
|
+
return {
|
|
2403
|
+
level: "warning",
|
|
2404
|
+
title: "Order cancelled",
|
|
2405
|
+
detail: "If you were charged, Swapped will refund within 5 business days."
|
|
2406
|
+
};
|
|
2407
|
+
}
|
|
2408
|
+
}
|
|
2409
|
+
function FiatOnrampStep({
|
|
2410
|
+
smartAccount,
|
|
2411
|
+
service,
|
|
2412
|
+
paymentMethod,
|
|
2413
|
+
onSwappedComplete,
|
|
2414
|
+
onSwappedFailed,
|
|
2415
|
+
onClose,
|
|
2416
|
+
onError
|
|
2417
|
+
}) {
|
|
2418
|
+
const loadUrl = useCallback3(async () => {
|
|
2419
|
+
const res = await service.getSwappedWidgetUrl({
|
|
2420
|
+
smartAccount,
|
|
2421
|
+
method: paymentMethod
|
|
2422
|
+
});
|
|
2423
|
+
if (res.currencyCode !== "USDC_BASE") {
|
|
2424
|
+
console.warn(
|
|
2425
|
+
`[FiatOnrampStep] Expected backend to return currencyCode=USDC_BASE, got ${res.currencyCode}. Swapped purchases may not bridge as expected.`
|
|
2426
|
+
);
|
|
2427
|
+
}
|
|
2428
|
+
return res;
|
|
2429
|
+
}, [service, smartAccount, paymentMethod]);
|
|
2430
|
+
return /* @__PURE__ */ jsx9(
|
|
2431
|
+
SwappedIframeStep,
|
|
2432
|
+
{
|
|
2433
|
+
smartAccount,
|
|
2434
|
+
service,
|
|
2435
|
+
variant: "fiat",
|
|
2436
|
+
loadUrl,
|
|
2437
|
+
iframeTitle: "Buy crypto with Swapped",
|
|
2438
|
+
loadErrorCode: "SWAPPED_URL_FAILED",
|
|
2439
|
+
loadErrorFallback: "Failed to load on-ramp",
|
|
2440
|
+
bannerForStatus: fiatBannerForStatus,
|
|
2441
|
+
onSwappedComplete,
|
|
2442
|
+
onSwappedFailed,
|
|
2443
|
+
onClose,
|
|
2444
|
+
onError
|
|
2445
|
+
}
|
|
2446
|
+
);
|
|
2447
|
+
}
|
|
2448
|
+
FiatOnrampStep.displayName = "FiatOnrampStep";
|
|
2449
|
+
|
|
2450
|
+
// src/components/steps/ExchangeConnectStep.tsx
|
|
2451
|
+
import { useCallback as useCallback4 } from "react";
|
|
2452
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
2453
|
+
function connectBannerForStatus(status, context) {
|
|
2454
|
+
if (context.currencyMismatch) {
|
|
2455
|
+
return {
|
|
2456
|
+
level: "warning",
|
|
2457
|
+
title: "Currency mismatch",
|
|
2458
|
+
detail: "Funds may not bridge automatically. Contact support if your balance does not arrive."
|
|
2459
|
+
};
|
|
2460
|
+
}
|
|
2461
|
+
switch (status) {
|
|
2462
|
+
case "payment_pending":
|
|
2463
|
+
return { level: "info", title: "Waiting for exchange transfer\u2026" };
|
|
2464
|
+
case "order_completed":
|
|
2465
|
+
return {
|
|
2466
|
+
level: "success",
|
|
2467
|
+
title: "Exchange transfer received \u2014 sending crypto"
|
|
2468
|
+
};
|
|
2469
|
+
case "order_broadcasted":
|
|
2470
|
+
return {
|
|
2471
|
+
level: "success",
|
|
2472
|
+
title: "Crypto sent \u2014 confirming on-chain"
|
|
2473
|
+
};
|
|
2474
|
+
case "order_cancelled":
|
|
2475
|
+
return {
|
|
2476
|
+
level: "warning",
|
|
2477
|
+
title: "Order cancelled",
|
|
2478
|
+
detail: "If your exchange already debited the funds, Swapped will refund within 5 business days."
|
|
2479
|
+
};
|
|
2480
|
+
}
|
|
2481
|
+
}
|
|
2482
|
+
function ExchangeConnectStep({
|
|
2483
|
+
smartAccount,
|
|
2484
|
+
service,
|
|
2485
|
+
connection,
|
|
2486
|
+
onSwappedComplete,
|
|
2487
|
+
onSwappedFailed,
|
|
2488
|
+
onClose,
|
|
2489
|
+
onError
|
|
2490
|
+
}) {
|
|
2491
|
+
const loadUrl = useCallback4(async () => {
|
|
2492
|
+
const res = await service.getSwappedConnectUrl({
|
|
2493
|
+
smartAccount,
|
|
2494
|
+
connection
|
|
2495
|
+
});
|
|
2496
|
+
if (res.currencyCode !== "USDC_BASE") {
|
|
2497
|
+
console.warn(
|
|
2498
|
+
`[ExchangeConnectStep] Expected backend to return currencyCode=USDC_BASE, got ${res.currencyCode}. Swapped Connect pulls may not bridge as expected.`
|
|
2499
|
+
);
|
|
2500
|
+
}
|
|
2501
|
+
return res;
|
|
2502
|
+
}, [service, smartAccount, connection]);
|
|
2503
|
+
return /* @__PURE__ */ jsx10(
|
|
2504
|
+
SwappedIframeStep,
|
|
2505
|
+
{
|
|
2506
|
+
smartAccount,
|
|
2507
|
+
service,
|
|
2508
|
+
variant: "connect",
|
|
2509
|
+
loadUrl,
|
|
2510
|
+
iframeTitle: "Fund from exchange via Swapped",
|
|
2511
|
+
loadErrorCode: "SWAPPED_CONNECT_URL_FAILED",
|
|
2512
|
+
loadErrorFallback: "Failed to load Connect",
|
|
2513
|
+
bannerForStatus: connectBannerForStatus,
|
|
2514
|
+
onSwappedComplete,
|
|
2515
|
+
onSwappedFailed,
|
|
2516
|
+
onClose,
|
|
2517
|
+
onError
|
|
2518
|
+
}
|
|
2519
|
+
);
|
|
2520
|
+
}
|
|
2521
|
+
ExchangeConnectStep.displayName = "ExchangeConnectStep";
|
|
2522
|
+
|
|
2523
|
+
// src/components/steps/ExchangeSelectStep.tsx
|
|
2524
|
+
import { useCallback as useCallback5, useEffect as useEffect7, useState as useState7 } from "react";
|
|
2525
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2526
|
+
function ExchangeLogo({ exchange }) {
|
|
2527
|
+
const [failed, setFailed] = useState7(false);
|
|
2528
|
+
if (!exchange.logoUrl || failed) {
|
|
2529
|
+
return /* @__PURE__ */ jsx11(BankIcon, {});
|
|
2530
|
+
}
|
|
2531
|
+
return /* @__PURE__ */ jsx11(
|
|
2532
|
+
"img",
|
|
2533
|
+
{
|
|
2534
|
+
src: exchange.logoUrl,
|
|
2535
|
+
alt: "",
|
|
2536
|
+
onError: () => setFailed(true)
|
|
2537
|
+
}
|
|
2538
|
+
);
|
|
2539
|
+
}
|
|
2540
|
+
function ExchangeSelectStep({
|
|
2541
|
+
service,
|
|
2542
|
+
onSelectExchange,
|
|
2543
|
+
onError
|
|
2544
|
+
}) {
|
|
2545
|
+
const [exchanges, setExchanges] = useState7([]);
|
|
2546
|
+
const [loading, setLoading] = useState7(true);
|
|
2547
|
+
const [error, setError] = useState7(null);
|
|
2548
|
+
const [retryToken, setRetryToken] = useState7(0);
|
|
2549
|
+
const retry = useCallback5(() => {
|
|
2550
|
+
setRetryToken((n) => n + 1);
|
|
2551
|
+
}, []);
|
|
2552
|
+
useEffect7(() => {
|
|
2553
|
+
let cancelled = false;
|
|
2554
|
+
setLoading(true);
|
|
2555
|
+
setError(null);
|
|
2556
|
+
service.getSwappedConnectExchanges().then((res) => {
|
|
2557
|
+
if (cancelled) return;
|
|
2558
|
+
setExchanges(res.exchanges);
|
|
2559
|
+
}).catch((err) => {
|
|
2560
|
+
if (cancelled) return;
|
|
2561
|
+
const message = err instanceof Error ? err.message : "Failed to load exchanges";
|
|
2562
|
+
setExchanges([]);
|
|
2563
|
+
setError(message);
|
|
2564
|
+
onError?.(message, "SWAPPED_CONNECT_EXCHANGES_FAILED");
|
|
2565
|
+
}).finally(() => {
|
|
2566
|
+
if (!cancelled) setLoading(false);
|
|
2567
|
+
});
|
|
2568
|
+
return () => {
|
|
2569
|
+
cancelled = true;
|
|
2570
|
+
};
|
|
2571
|
+
}, [service, retryToken, onError]);
|
|
2572
|
+
return /* @__PURE__ */ jsxs9("div", { className: "rs-screen rs-exchange-select", children: [
|
|
2573
|
+
/* @__PURE__ */ jsxs9("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
2574
|
+
/* @__PURE__ */ jsx11(
|
|
2575
|
+
BodyHeader,
|
|
2576
|
+
{
|
|
2577
|
+
icon: /* @__PURE__ */ jsx11(BankIcon, {}),
|
|
2578
|
+
title: "Fund from Exchange",
|
|
2579
|
+
subtitle: "Choose your exchange"
|
|
2580
|
+
}
|
|
2581
|
+
),
|
|
2582
|
+
loading && /* @__PURE__ */ jsx11("div", { className: "rs-exchange-select-state", "aria-live": "polite", children: /* @__PURE__ */ jsx11(Spinner, {}) }),
|
|
2583
|
+
!loading && error && /* @__PURE__ */ jsxs9("div", { className: "rs-exchange-select-state", "aria-live": "polite", children: [
|
|
2584
|
+
/* @__PURE__ */ jsx11("div", { className: "rs-exchange-select-state-title", children: "Couldn\u2019t load exchanges" }),
|
|
2585
|
+
/* @__PURE__ */ jsx11(
|
|
2586
|
+
"button",
|
|
2587
|
+
{
|
|
2588
|
+
type: "button",
|
|
2589
|
+
className: "rs-fiat-onramp-retry",
|
|
2590
|
+
onClick: retry,
|
|
2591
|
+
children: "Retry"
|
|
2592
|
+
}
|
|
2593
|
+
)
|
|
2594
|
+
] }),
|
|
2595
|
+
!loading && !error && exchanges.length === 0 && /* @__PURE__ */ jsxs9("div", { className: "rs-exchange-select-state", "aria-live": "polite", children: [
|
|
2596
|
+
/* @__PURE__ */ jsx11("div", { className: "rs-exchange-select-state-title", children: "No exchanges available" }),
|
|
2597
|
+
/* @__PURE__ */ jsx11(
|
|
2598
|
+
"button",
|
|
2599
|
+
{
|
|
2600
|
+
type: "button",
|
|
2601
|
+
className: "rs-fiat-onramp-retry",
|
|
2602
|
+
onClick: retry,
|
|
2603
|
+
children: "Retry"
|
|
2604
|
+
}
|
|
2605
|
+
)
|
|
2606
|
+
] }),
|
|
2607
|
+
!loading && !error && exchanges.length > 0 && /* @__PURE__ */ jsx11("div", { className: "rs-exchange-grid", children: exchanges.map((exchange) => /* @__PURE__ */ jsxs9(
|
|
2608
|
+
"button",
|
|
2609
|
+
{
|
|
2610
|
+
type: "button",
|
|
2611
|
+
className: "rs-exchange-card",
|
|
2612
|
+
onClick: () => onSelectExchange(exchange.connection),
|
|
2613
|
+
"aria-label": `Select ${exchange.name}`,
|
|
2614
|
+
children: [
|
|
2615
|
+
/* @__PURE__ */ jsx11("span", { className: "rs-exchange-card-logo", children: /* @__PURE__ */ jsx11(ExchangeLogo, { exchange }) }),
|
|
2616
|
+
/* @__PURE__ */ jsx11("span", { className: "rs-exchange-card-name", children: exchange.name })
|
|
2617
|
+
]
|
|
2618
|
+
},
|
|
2619
|
+
exchange.connection
|
|
2620
|
+
)) })
|
|
2621
|
+
] }),
|
|
2622
|
+
/* @__PURE__ */ jsx11(PoweredBy, {})
|
|
2623
|
+
] });
|
|
2624
|
+
}
|
|
2625
|
+
ExchangeSelectStep.displayName = "ExchangeSelectStep";
|
|
2626
|
+
|
|
2627
|
+
// src/components/steps/DepositAddressSkeleton.tsx
|
|
2628
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2629
|
+
var BASE_CHAIN_ID = 8453;
|
|
2630
|
+
function DepositAddressSkeleton({
|
|
2631
|
+
uiConfig,
|
|
2632
|
+
allowedRoutes
|
|
2633
|
+
}) {
|
|
2634
|
+
const allowedChainSet = allowedRoutes?.sourceChains ? new Set(allowedRoutes.sourceChains) : null;
|
|
2635
|
+
const allowedTokenSet = allowedRoutes?.sourceTokens ? new Set(allowedRoutes.sourceTokens.map((s) => s.toUpperCase())) : null;
|
|
2636
|
+
const evmChainIds = (() => {
|
|
2637
|
+
const all = getSupportedChainIds();
|
|
2638
|
+
return allowedChainSet ? all.filter((id) => allowedChainSet.has(id)) : all;
|
|
2639
|
+
})();
|
|
2640
|
+
const defaultChainId = evmChainIds.includes(BASE_CHAIN_ID) ? BASE_CHAIN_ID : evmChainIds[0];
|
|
2641
|
+
const tokensForChain = (() => {
|
|
2642
|
+
const all = getTargetTokenSymbolsForChain(defaultChainId);
|
|
2643
|
+
return allowedTokenSet ? all.filter((s) => allowedTokenSet.has(s.toUpperCase())) : all;
|
|
2644
|
+
})();
|
|
2645
|
+
const defaultToken = tokensForChain.includes("USDC") ? "USDC" : tokensForChain[0] ?? "USDC";
|
|
2646
|
+
const chainName = getChainName(defaultChainId);
|
|
2647
|
+
const chainIcon = getChainIcon(defaultChainId);
|
|
2648
|
+
const tokenIcon = getTokenIcon(defaultToken);
|
|
2649
|
+
return /* @__PURE__ */ jsxs10("div", { className: "rs-screen", "aria-busy": "true", children: [
|
|
2650
|
+
/* @__PURE__ */ jsx12("span", { className: "rs-sr-only", role: "status", children: "Preparing deposit details\u2026" }),
|
|
2651
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-screen-body", children: [
|
|
2652
|
+
/* @__PURE__ */ jsx12(BodyHeader, { icon: /* @__PURE__ */ jsx12(TransferCryptoIcon, {}), title: "Transfer crypto" }),
|
|
2653
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-selectors", "aria-hidden": "true", children: [
|
|
2654
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown", children: [
|
|
2655
|
+
/* @__PURE__ */ jsx12("div", { className: "rs-deposit-address-dropdown-label", children: "Supported chain" }),
|
|
2656
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown-trigger", children: [
|
|
2657
|
+
chainIcon && /* @__PURE__ */ jsx12(
|
|
2658
|
+
"img",
|
|
2659
|
+
{
|
|
2660
|
+
src: chainIcon,
|
|
2661
|
+
alt: "",
|
|
2662
|
+
className: "rs-deposit-address-dropdown-icon"
|
|
2663
|
+
}
|
|
2664
|
+
),
|
|
2665
|
+
/* @__PURE__ */ jsx12("span", { children: chainName }),
|
|
2666
|
+
/* @__PURE__ */ jsx12(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
|
|
2667
|
+
] })
|
|
2668
|
+
] }),
|
|
2669
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown", children: [
|
|
2670
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown-label rs-deposit-address-dropdown-label--with-min", children: [
|
|
2671
|
+
/* @__PURE__ */ jsx12("span", { children: "Supported token" }),
|
|
2672
|
+
/* @__PURE__ */ jsxs10("span", { className: "rs-deposit-address-min", children: [
|
|
2673
|
+
"Min.$",
|
|
2674
|
+
(uiConfig?.minDepositUsd ?? 0.1).toFixed(2),
|
|
2675
|
+
/* @__PURE__ */ jsx12(Tooltip, { content: "Minimum deposit amount required for the selected chain.", children: /* @__PURE__ */ jsx12(
|
|
2676
|
+
InfoIcon,
|
|
2677
|
+
{
|
|
2678
|
+
className: "rs-deposit-address-min-icon",
|
|
2679
|
+
"aria-hidden": "true"
|
|
2680
|
+
}
|
|
2681
|
+
) })
|
|
2682
|
+
] })
|
|
2683
|
+
] }),
|
|
2684
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown-trigger", children: [
|
|
2685
|
+
tokenIcon && /* @__PURE__ */ jsx12(
|
|
2686
|
+
"img",
|
|
2687
|
+
{
|
|
2688
|
+
src: tokenIcon,
|
|
2689
|
+
alt: "",
|
|
2690
|
+
className: "rs-deposit-address-dropdown-icon"
|
|
2691
|
+
}
|
|
2692
|
+
),
|
|
2693
|
+
/* @__PURE__ */ jsx12("span", { children: defaultToken }),
|
|
2694
|
+
/* @__PURE__ */ jsx12(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
|
|
2695
|
+
] })
|
|
2696
|
+
] })
|
|
2697
|
+
] }),
|
|
2698
|
+
/* @__PURE__ */ jsxs10(
|
|
2699
|
+
"div",
|
|
2700
|
+
{
|
|
2701
|
+
style: { display: "flex", flexDirection: "column", gap: 4, width: "100%" },
|
|
2702
|
+
children: [
|
|
2703
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-well", children: [
|
|
2704
|
+
/* @__PURE__ */ jsx12("div", { className: "rs-deposit-address-qr", children: /* @__PURE__ */ jsx12("div", { className: "rs-skeleton rs-skeleton-qr", "aria-hidden": "true" }) }),
|
|
2705
|
+
/* @__PURE__ */ jsx12("div", { className: "rs-skeleton rs-skeleton-address", "aria-hidden": "true" })
|
|
2706
|
+
] }),
|
|
2707
|
+
/* @__PURE__ */ jsxs10(
|
|
2708
|
+
"button",
|
|
2709
|
+
{
|
|
2710
|
+
type: "button",
|
|
2711
|
+
className: "rs-deposit-address-copy",
|
|
2712
|
+
disabled: true,
|
|
2713
|
+
"aria-hidden": "true",
|
|
2714
|
+
children: [
|
|
2715
|
+
/* @__PURE__ */ jsx12(CopyIcon, {}),
|
|
2716
|
+
"Copy address"
|
|
2717
|
+
]
|
|
2718
|
+
}
|
|
2719
|
+
)
|
|
2720
|
+
]
|
|
2721
|
+
}
|
|
2722
|
+
),
|
|
2723
|
+
/* @__PURE__ */ jsx12("div", { className: "rs-price-impact", "aria-hidden": "true", children: /* @__PURE__ */ jsxs10("div", { className: "rs-price-impact-header", children: [
|
|
2724
|
+
/* @__PURE__ */ jsxs10("span", { className: "rs-price-impact-header-left", children: [
|
|
2725
|
+
/* @__PURE__ */ jsx12("span", { className: "rs-price-impact-label", children: "Price impact" }),
|
|
2726
|
+
/* @__PURE__ */ jsx12("span", { className: "rs-price-impact-label", children: /* @__PURE__ */ jsx12("strong", { children: "0.00%" }) }),
|
|
2727
|
+
/* @__PURE__ */ jsx12(
|
|
2728
|
+
Tooltip,
|
|
2729
|
+
{
|
|
2730
|
+
className: "rs-price-impact-info",
|
|
2731
|
+
content: "Price impact is the difference between expected and execution price, due to trade size and liquidity.",
|
|
2732
|
+
children: /* @__PURE__ */ jsx12(InfoIcon, { "aria-hidden": "true" })
|
|
2733
|
+
}
|
|
2734
|
+
)
|
|
2735
|
+
] }),
|
|
2736
|
+
/* @__PURE__ */ jsx12(
|
|
2737
|
+
ChevronDownIcon,
|
|
2738
|
+
{
|
|
2739
|
+
className: "rs-price-impact-chevron",
|
|
2740
|
+
"aria-hidden": "true"
|
|
2741
|
+
}
|
|
2742
|
+
)
|
|
2743
|
+
] }) })
|
|
2744
|
+
] }),
|
|
2745
|
+
/* @__PURE__ */ jsx12(PoweredBy, {})
|
|
2746
|
+
] });
|
|
2747
|
+
}
|
|
2748
|
+
DepositAddressSkeleton.displayName = "DepositAddressSkeleton";
|
|
2749
|
+
|
|
1951
2750
|
// src/components/steps/SolanaTokenSelectStep.tsx
|
|
1952
|
-
import { useState as
|
|
2751
|
+
import { useState as useState8, useEffect as useEffect8, useMemo as useMemo5 } from "react";
|
|
1953
2752
|
import { formatUnits as formatUnits4 } from "viem";
|
|
1954
|
-
import { jsx as
|
|
2753
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1955
2754
|
function SolanaTokenSelectStep({
|
|
1956
2755
|
solanaAddress,
|
|
1957
2756
|
service,
|
|
@@ -1960,11 +2759,11 @@ function SolanaTokenSelectStep({
|
|
|
1960
2759
|
onDisconnect,
|
|
1961
2760
|
debug
|
|
1962
2761
|
}) {
|
|
1963
|
-
const [tokenBalances, setTokenBalances] =
|
|
1964
|
-
const [selectedSymbol, setSelectedSymbol] =
|
|
1965
|
-
const [loading, setLoading] =
|
|
1966
|
-
const [error, setError] =
|
|
1967
|
-
|
|
2762
|
+
const [tokenBalances, setTokenBalances] = useState8([]);
|
|
2763
|
+
const [selectedSymbol, setSelectedSymbol] = useState8(null);
|
|
2764
|
+
const [loading, setLoading] = useState8(true);
|
|
2765
|
+
const [error, setError] = useState8(null);
|
|
2766
|
+
useEffect8(() => {
|
|
1968
2767
|
let active = true;
|
|
1969
2768
|
async function loadBalances() {
|
|
1970
2769
|
if (!solanaAddress) {
|
|
@@ -2035,7 +2834,7 @@ function SolanaTokenSelectStep({
|
|
|
2035
2834
|
active = false;
|
|
2036
2835
|
};
|
|
2037
2836
|
}, [debug, solanaAddress, service, onTotalBalanceComputed]);
|
|
2038
|
-
const rows =
|
|
2837
|
+
const rows = useMemo5(
|
|
2039
2838
|
() => [...tokenBalances].sort((a, b) => {
|
|
2040
2839
|
if (a.balanceUsd !== b.balanceUsd) return b.balanceUsd - a.balanceUsd;
|
|
2041
2840
|
if (b.balance > a.balance) return 1;
|
|
@@ -2057,30 +2856,30 @@ function SolanaTokenSelectStep({
|
|
|
2057
2856
|
};
|
|
2058
2857
|
const chainIcon = getChainIcon("solana");
|
|
2059
2858
|
const chainName = getChainName("solana");
|
|
2060
|
-
return /* @__PURE__ */
|
|
2061
|
-
/* @__PURE__ */
|
|
2062
|
-
/* @__PURE__ */
|
|
2859
|
+
return /* @__PURE__ */ jsxs11("div", { className: "rs-screen", children: [
|
|
2860
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-screen-body", children: [
|
|
2861
|
+
/* @__PURE__ */ jsx13(
|
|
2063
2862
|
BodyHeader,
|
|
2064
2863
|
{
|
|
2065
|
-
icon: /* @__PURE__ */
|
|
2864
|
+
icon: /* @__PURE__ */ jsx13(WalletIcon, {}),
|
|
2066
2865
|
title: "Your assets",
|
|
2067
2866
|
subtitle: "Select source assets to transfer"
|
|
2068
2867
|
}
|
|
2069
2868
|
),
|
|
2070
|
-
loading && /* @__PURE__ */
|
|
2071
|
-
/* @__PURE__ */
|
|
2072
|
-
/* @__PURE__ */
|
|
2869
|
+
loading && /* @__PURE__ */ jsxs11("div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
2870
|
+
/* @__PURE__ */ jsx13(Spinner, { className: "rs-text-tertiary" }),
|
|
2871
|
+
/* @__PURE__ */ jsx13("span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
2073
2872
|
] }),
|
|
2074
|
-
error && /* @__PURE__ */
|
|
2075
|
-
!loading && !error && rows.length === 0 && /* @__PURE__ */
|
|
2076
|
-
/* @__PURE__ */
|
|
2077
|
-
/* @__PURE__ */
|
|
2078
|
-
/* @__PURE__ */
|
|
2873
|
+
error && /* @__PURE__ */ jsx13(Callout, { variant: "error", children: error }),
|
|
2874
|
+
!loading && !error && rows.length === 0 && /* @__PURE__ */ jsxs11("div", { className: "rs-empty-state", children: [
|
|
2875
|
+
/* @__PURE__ */ jsx13(WalletIcon, { className: "rs-empty-icon" }),
|
|
2876
|
+
/* @__PURE__ */ jsx13("div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
|
|
2877
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-empty-address", children: [
|
|
2079
2878
|
solanaAddress.slice(0, 6),
|
|
2080
2879
|
"...",
|
|
2081
2880
|
solanaAddress.slice(-4)
|
|
2082
2881
|
] }),
|
|
2083
|
-
onDisconnect && /* @__PURE__ */
|
|
2882
|
+
onDisconnect && /* @__PURE__ */ jsx13(
|
|
2084
2883
|
"button",
|
|
2085
2884
|
{
|
|
2086
2885
|
type: "button",
|
|
@@ -2090,11 +2889,11 @@ function SolanaTokenSelectStep({
|
|
|
2090
2889
|
}
|
|
2091
2890
|
)
|
|
2092
2891
|
] }),
|
|
2093
|
-
!loading && !error && rows.length > 0 && /* @__PURE__ */
|
|
2892
|
+
!loading && !error && rows.length > 0 && /* @__PURE__ */ jsx13("div", { className: "rs-asset-list", children: rows.map((entry) => {
|
|
2094
2893
|
const isSelected = selectedSymbol === entry.token.symbol;
|
|
2095
2894
|
const tokenAmount = formatBalance(entry);
|
|
2096
2895
|
const tokenIcon = getTokenIcon(entry.token.symbol);
|
|
2097
|
-
return /* @__PURE__ */
|
|
2896
|
+
return /* @__PURE__ */ jsxs11(
|
|
2098
2897
|
"button",
|
|
2099
2898
|
{
|
|
2100
2899
|
type: "button",
|
|
@@ -2102,33 +2901,33 @@ function SolanaTokenSelectStep({
|
|
|
2102
2901
|
className: `rs-asset-row ${isSelected ? "rs-asset-row--selected" : ""}`,
|
|
2103
2902
|
"aria-pressed": isSelected,
|
|
2104
2903
|
children: [
|
|
2105
|
-
/* @__PURE__ */
|
|
2106
|
-
/* @__PURE__ */
|
|
2107
|
-
tokenIcon ? /* @__PURE__ */
|
|
2108
|
-
chainIcon && /* @__PURE__ */
|
|
2904
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-asset-info", children: [
|
|
2905
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-asset-icon-wrapper", children: [
|
|
2906
|
+
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) }),
|
|
2907
|
+
chainIcon && /* @__PURE__ */ jsx13("span", { className: "rs-asset-chain-badge", children: /* @__PURE__ */ jsx13("img", { src: chainIcon, alt: chainName }) })
|
|
2109
2908
|
] }),
|
|
2110
|
-
/* @__PURE__ */
|
|
2111
|
-
/* @__PURE__ */
|
|
2112
|
-
/* @__PURE__ */
|
|
2113
|
-
/* @__PURE__ */
|
|
2909
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-asset-text", children: [
|
|
2910
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-asset-name-row", children: [
|
|
2911
|
+
/* @__PURE__ */ jsx13("span", { className: "rs-asset-name", children: entry.token.symbol }),
|
|
2912
|
+
/* @__PURE__ */ jsxs11("span", { className: "rs-asset-chain", children: [
|
|
2114
2913
|
"on ",
|
|
2115
2914
|
chainName
|
|
2116
2915
|
] })
|
|
2117
2916
|
] }),
|
|
2118
|
-
/* @__PURE__ */
|
|
2917
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-asset-balance-small", children: [
|
|
2119
2918
|
tokenAmount,
|
|
2120
2919
|
" ",
|
|
2121
2920
|
entry.token.symbol
|
|
2122
2921
|
] })
|
|
2123
2922
|
] })
|
|
2124
2923
|
] }),
|
|
2125
|
-
/* @__PURE__ */
|
|
2924
|
+
/* @__PURE__ */ jsx13("div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ? currencyFormatter.format(entry.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${entry.token.symbol}` : "--" })
|
|
2126
2925
|
]
|
|
2127
2926
|
},
|
|
2128
2927
|
entry.token.symbol
|
|
2129
2928
|
);
|
|
2130
2929
|
}) }),
|
|
2131
|
-
/* @__PURE__ */
|
|
2930
|
+
/* @__PURE__ */ jsx13(
|
|
2132
2931
|
Button,
|
|
2133
2932
|
{
|
|
2134
2933
|
onClick: () => selectedEntry && onContinue(
|
|
@@ -2142,14 +2941,14 @@ function SolanaTokenSelectStep({
|
|
|
2142
2941
|
}
|
|
2143
2942
|
)
|
|
2144
2943
|
] }),
|
|
2145
|
-
/* @__PURE__ */
|
|
2944
|
+
/* @__PURE__ */ jsx13(PoweredBy, {})
|
|
2146
2945
|
] });
|
|
2147
2946
|
}
|
|
2148
2947
|
|
|
2149
2948
|
// src/components/steps/SolanaAmountStep.tsx
|
|
2150
|
-
import { useCallback as
|
|
2949
|
+
import { useCallback as useCallback6, useEffect as useEffect9, useMemo as useMemo6, useRef as useRef7, useState as useState9 } from "react";
|
|
2151
2950
|
import { formatUnits as formatUnits5, parseUnits as parseUnits3 } from "viem";
|
|
2152
|
-
import { Fragment as Fragment2, jsx as
|
|
2951
|
+
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2153
2952
|
var SOL_FEE_RESERVE_LAMPORTS = 1000000n;
|
|
2154
2953
|
var PRESETS2 = [
|
|
2155
2954
|
{ value: 25, label: "25%" },
|
|
@@ -2170,12 +2969,12 @@ function SolanaAmountStep({
|
|
|
2170
2969
|
onContinue,
|
|
2171
2970
|
debug
|
|
2172
2971
|
}) {
|
|
2173
|
-
const [amount, setAmount] =
|
|
2174
|
-
const [error, setError] =
|
|
2175
|
-
const hasAppliedDefaultRef =
|
|
2972
|
+
const [amount, setAmount] = useState9("");
|
|
2973
|
+
const [error, setError] = useState9(null);
|
|
2974
|
+
const hasAppliedDefaultRef = useRef7(false);
|
|
2176
2975
|
const isSourceStablecoin = isStablecoinSymbol(token.symbol);
|
|
2177
2976
|
const isMaxDefault = defaultAmount?.trim().toLowerCase() === "max";
|
|
2178
|
-
const tokenPriceUsd =
|
|
2977
|
+
const tokenPriceUsd = useMemo6(() => {
|
|
2179
2978
|
if (isSourceStablecoin) return 1;
|
|
2180
2979
|
try {
|
|
2181
2980
|
const balanceUnits = Number(formatUnits5(balance, token.decimals));
|
|
@@ -2189,7 +2988,7 @@ function SolanaAmountStep({
|
|
|
2189
2988
|
}
|
|
2190
2989
|
}, [isSourceStablecoin, balance, token.decimals, balanceUsd]);
|
|
2191
2990
|
const hasPricing = tokenPriceUsd !== null;
|
|
2192
|
-
const formattedBalance =
|
|
2991
|
+
const formattedBalance = useMemo6(() => {
|
|
2193
2992
|
try {
|
|
2194
2993
|
const raw = formatUnits5(balance, token.decimals);
|
|
2195
2994
|
const numeric = Number(raw);
|
|
@@ -2199,7 +2998,7 @@ function SolanaAmountStep({
|
|
|
2199
2998
|
return "\u2026";
|
|
2200
2999
|
}
|
|
2201
3000
|
}, [balance, token.decimals]);
|
|
2202
|
-
const computedBalanceUsd =
|
|
3001
|
+
const computedBalanceUsd = useMemo6(() => {
|
|
2203
3002
|
try {
|
|
2204
3003
|
const balanceUnits = Number(formatUnits5(balance, token.decimals));
|
|
2205
3004
|
if (!Number.isFinite(balanceUnits) || balanceUnits < 0) return null;
|
|
@@ -2210,11 +3009,11 @@ function SolanaAmountStep({
|
|
|
2210
3009
|
return null;
|
|
2211
3010
|
}
|
|
2212
3011
|
}, [balance, token.decimals, tokenPriceUsd, balanceUsd]);
|
|
2213
|
-
const spendableBalance =
|
|
3012
|
+
const spendableBalance = useMemo6(() => {
|
|
2214
3013
|
if (!isNativeSol(token)) return balance;
|
|
2215
3014
|
return balance > SOL_FEE_RESERVE_LAMPORTS ? balance - SOL_FEE_RESERVE_LAMPORTS : 0n;
|
|
2216
3015
|
}, [balance, token]);
|
|
2217
|
-
const spendableBalanceUsd =
|
|
3016
|
+
const spendableBalanceUsd = useMemo6(() => {
|
|
2218
3017
|
try {
|
|
2219
3018
|
const spendableUnits = Number(formatUnits5(spendableBalance, token.decimals));
|
|
2220
3019
|
if (!Number.isFinite(spendableUnits) || spendableUnits < 0) return null;
|
|
@@ -2224,7 +3023,7 @@ function SolanaAmountStep({
|
|
|
2224
3023
|
return null;
|
|
2225
3024
|
}
|
|
2226
3025
|
}, [spendableBalance, token.decimals, tokenPriceUsd]);
|
|
2227
|
-
const computePresetAmount =
|
|
3026
|
+
const computePresetAmount = useCallback6(
|
|
2228
3027
|
(percentage) => {
|
|
2229
3028
|
try {
|
|
2230
3029
|
const spendableUnits = Number(
|
|
@@ -2247,7 +3046,7 @@ function SolanaAmountStep({
|
|
|
2247
3046
|
spendableBalanceUsd
|
|
2248
3047
|
]
|
|
2249
3048
|
);
|
|
2250
|
-
|
|
3049
|
+
useEffect9(() => {
|
|
2251
3050
|
if (hasAppliedDefaultRef.current || !defaultAmount) return;
|
|
2252
3051
|
if (isMaxDefault) {
|
|
2253
3052
|
const next = computePresetAmount(100);
|
|
@@ -2263,11 +3062,11 @@ function SolanaAmountStep({
|
|
|
2263
3062
|
hasAppliedDefaultRef.current = true;
|
|
2264
3063
|
}
|
|
2265
3064
|
}, [defaultAmount, isMaxDefault, computePresetAmount]);
|
|
2266
|
-
const numericAmount =
|
|
3065
|
+
const numericAmount = useMemo6(() => {
|
|
2267
3066
|
const parsed = parseFloat(amount);
|
|
2268
3067
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : 0;
|
|
2269
3068
|
}, [amount]);
|
|
2270
|
-
const sourceAmountUnits =
|
|
3069
|
+
const sourceAmountUnits = useMemo6(() => {
|
|
2271
3070
|
if (numericAmount <= 0) return null;
|
|
2272
3071
|
const raw = isSourceStablecoin || !hasPricing ? numericAmount : numericAmount / (tokenPriceUsd ?? 1);
|
|
2273
3072
|
try {
|
|
@@ -2349,12 +3148,12 @@ function SolanaAmountStep({
|
|
|
2349
3148
|
const continueLabel = exceedsBalance ? "Insufficient balance" : isAboveMax ? "Continue with max allowed deposit" : isBelowMin ? "Continue with minimum deposit" : "Continue";
|
|
2350
3149
|
const continueDisabled = exceedsBalance || numericAmount === 0 && !isBelowMin;
|
|
2351
3150
|
const sourceTokenIcon = getTokenIcon(token.symbol);
|
|
2352
|
-
return /* @__PURE__ */
|
|
2353
|
-
/* @__PURE__ */
|
|
2354
|
-
/* @__PURE__ */
|
|
2355
|
-
/* @__PURE__ */
|
|
2356
|
-
/* @__PURE__ */
|
|
2357
|
-
/* @__PURE__ */
|
|
3151
|
+
return /* @__PURE__ */ jsxs12("div", { className: "rs-screen", children: [
|
|
3152
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
3153
|
+
/* @__PURE__ */ jsx14(BodyHeader, { icon: /* @__PURE__ */ jsx14(WalletIcon, {}), title: "Wallet deposit" }),
|
|
3154
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-amount-section", children: [
|
|
3155
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-amount-display", children: [
|
|
3156
|
+
/* @__PURE__ */ jsx14(
|
|
2358
3157
|
AnimatedAmountInput,
|
|
2359
3158
|
{
|
|
2360
3159
|
value: amount,
|
|
@@ -2363,25 +3162,25 @@ function SolanaAmountStep({
|
|
|
2363
3162
|
autoFocus: true
|
|
2364
3163
|
}
|
|
2365
3164
|
),
|
|
2366
|
-
/* @__PURE__ */
|
|
2367
|
-
/* @__PURE__ */
|
|
3165
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-amount-meta", children: [
|
|
3166
|
+
/* @__PURE__ */ jsxs12("span", { className: "rs-amount-meta-balance", children: [
|
|
2368
3167
|
formattedBalance,
|
|
2369
3168
|
" ",
|
|
2370
3169
|
token.symbol,
|
|
2371
3170
|
" available",
|
|
2372
|
-
computedBalanceUsd !== null && /* @__PURE__ */
|
|
3171
|
+
computedBalanceUsd !== null && /* @__PURE__ */ jsxs12(Fragment2, { children: [
|
|
2373
3172
|
" (~",
|
|
2374
3173
|
currencyFormatter.format(computedBalanceUsd),
|
|
2375
3174
|
")"
|
|
2376
3175
|
] })
|
|
2377
3176
|
] }),
|
|
2378
|
-
minDepositUsd !== null && /* @__PURE__ */
|
|
3177
|
+
minDepositUsd !== null && /* @__PURE__ */ jsxs12("span", { className: "rs-amount-meta-minimum", children: [
|
|
2379
3178
|
"Min. deposit ",
|
|
2380
3179
|
currencyFormatter.format(minDepositUsd)
|
|
2381
3180
|
] })
|
|
2382
3181
|
] })
|
|
2383
3182
|
] }),
|
|
2384
|
-
/* @__PURE__ */
|
|
3183
|
+
/* @__PURE__ */ jsx14("div", { className: "rs-amount-presets", children: PRESETS2.map((preset) => /* @__PURE__ */ jsx14(
|
|
2385
3184
|
"button",
|
|
2386
3185
|
{
|
|
2387
3186
|
type: "button",
|
|
@@ -2392,35 +3191,35 @@ function SolanaAmountStep({
|
|
|
2392
3191
|
preset.value
|
|
2393
3192
|
)) })
|
|
2394
3193
|
] }),
|
|
2395
|
-
/* @__PURE__ */
|
|
2396
|
-
/* @__PURE__ */
|
|
2397
|
-
/* @__PURE__ */
|
|
2398
|
-
/* @__PURE__ */
|
|
2399
|
-
/* @__PURE__ */
|
|
3194
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-amount-details", children: [
|
|
3195
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-amount-detail-row", children: [
|
|
3196
|
+
/* @__PURE__ */ jsx14("span", { children: "You send" }),
|
|
3197
|
+
/* @__PURE__ */ jsxs12("span", { className: "rs-amount-detail-value", children: [
|
|
3198
|
+
/* @__PURE__ */ jsxs12("span", { children: [
|
|
2400
3199
|
"Solana ",
|
|
2401
3200
|
token.symbol
|
|
2402
3201
|
] }),
|
|
2403
|
-
sourceTokenIcon && /* @__PURE__ */
|
|
3202
|
+
sourceTokenIcon && /* @__PURE__ */ jsx14("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx14("img", { src: sourceTokenIcon, alt: "" }) })
|
|
2404
3203
|
] })
|
|
2405
3204
|
] }),
|
|
2406
|
-
targetChainName && targetTokenSymbol && /* @__PURE__ */
|
|
2407
|
-
/* @__PURE__ */
|
|
2408
|
-
/* @__PURE__ */
|
|
2409
|
-
/* @__PURE__ */
|
|
3205
|
+
targetChainName && targetTokenSymbol && /* @__PURE__ */ jsxs12("div", { className: "rs-amount-detail-row", children: [
|
|
3206
|
+
/* @__PURE__ */ jsx14("span", { children: "Receive" }),
|
|
3207
|
+
/* @__PURE__ */ jsxs12("span", { className: "rs-amount-detail-value", children: [
|
|
3208
|
+
/* @__PURE__ */ jsxs12("span", { children: [
|
|
2410
3209
|
targetChainName,
|
|
2411
3210
|
" ",
|
|
2412
3211
|
targetTokenSymbol
|
|
2413
3212
|
] }),
|
|
2414
|
-
targetTokenIcon && /* @__PURE__ */
|
|
3213
|
+
targetTokenIcon && /* @__PURE__ */ jsx14("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx14("img", { src: targetTokenIcon, alt: "" }) })
|
|
2415
3214
|
] })
|
|
2416
3215
|
] }),
|
|
2417
|
-
balanceAfterUsd !== null && /* @__PURE__ */
|
|
2418
|
-
/* @__PURE__ */
|
|
2419
|
-
/* @__PURE__ */
|
|
3216
|
+
balanceAfterUsd !== null && /* @__PURE__ */ jsxs12("div", { className: "rs-amount-detail-row", children: [
|
|
3217
|
+
/* @__PURE__ */ jsx14("span", { children: "Balance after deposit" }),
|
|
3218
|
+
/* @__PURE__ */ jsx14("span", { className: "rs-amount-detail-value", children: currencyFormatter.format(balanceAfterUsd) })
|
|
2420
3219
|
] })
|
|
2421
3220
|
] }),
|
|
2422
|
-
error && /* @__PURE__ */
|
|
2423
|
-
/* @__PURE__ */
|
|
3221
|
+
error && /* @__PURE__ */ jsx14(Callout, { variant: "error", children: error }),
|
|
3222
|
+
/* @__PURE__ */ jsx14(
|
|
2424
3223
|
Button,
|
|
2425
3224
|
{
|
|
2426
3225
|
onClick: handleContinue,
|
|
@@ -2430,12 +3229,12 @@ function SolanaAmountStep({
|
|
|
2430
3229
|
}
|
|
2431
3230
|
)
|
|
2432
3231
|
] }),
|
|
2433
|
-
/* @__PURE__ */
|
|
3232
|
+
/* @__PURE__ */ jsx14(PoweredBy, {})
|
|
2434
3233
|
] });
|
|
2435
3234
|
}
|
|
2436
3235
|
|
|
2437
3236
|
// src/components/steps/SolanaConfirmStep.tsx
|
|
2438
|
-
import { useState as
|
|
3237
|
+
import { useState as useState10 } from "react";
|
|
2439
3238
|
import { parseUnits as parseUnits4 } from "viem";
|
|
2440
3239
|
|
|
2441
3240
|
// src/core/solana.ts
|
|
@@ -2543,7 +3342,7 @@ async function sendSolanaTransaction(provider, _connection, transaction) {
|
|
|
2543
3342
|
}
|
|
2544
3343
|
|
|
2545
3344
|
// src/components/steps/SolanaConfirmStep.tsx
|
|
2546
|
-
import { jsx as
|
|
3345
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2547
3346
|
function SolanaConfirmStep({
|
|
2548
3347
|
smartAccount,
|
|
2549
3348
|
solanaAddress,
|
|
@@ -2564,8 +3363,8 @@ function SolanaConfirmStep({
|
|
|
2564
3363
|
onError,
|
|
2565
3364
|
debug
|
|
2566
3365
|
}) {
|
|
2567
|
-
const [isSubmitting, setIsSubmitting] =
|
|
2568
|
-
const [error, setError] =
|
|
3366
|
+
const [isSubmitting, setIsSubmitting] = useState10(false);
|
|
3367
|
+
const [error, setError] = useState10(null);
|
|
2569
3368
|
const targetSymbol = getTargetTokenSymbol(targetToken, targetChain);
|
|
2570
3369
|
const isSameToken = token.symbol.toUpperCase() === targetSymbol.toUpperCase();
|
|
2571
3370
|
const sourceChainName = getChainName("solana");
|
|
@@ -2684,66 +3483,66 @@ function SolanaConfirmStep({
|
|
|
2684
3483
|
setIsSubmitting(false);
|
|
2685
3484
|
}
|
|
2686
3485
|
};
|
|
2687
|
-
return /* @__PURE__ */
|
|
2688
|
-
/* @__PURE__ */
|
|
2689
|
-
/* @__PURE__ */
|
|
2690
|
-
/* @__PURE__ */
|
|
2691
|
-
/* @__PURE__ */
|
|
2692
|
-
/* @__PURE__ */
|
|
2693
|
-
/* @__PURE__ */
|
|
2694
|
-
/* @__PURE__ */
|
|
2695
|
-
sourceChainIcon && /* @__PURE__ */
|
|
3486
|
+
return /* @__PURE__ */ jsxs13("div", { className: "rs-screen", children: [
|
|
3487
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
3488
|
+
/* @__PURE__ */ jsx15(BodyHeader, { icon: /* @__PURE__ */ jsx15(WalletIcon, {}), title: "Review deposit" }),
|
|
3489
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-details", children: [
|
|
3490
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
|
|
3491
|
+
/* @__PURE__ */ jsx15("span", { children: "Source chain" }),
|
|
3492
|
+
/* @__PURE__ */ jsxs13("span", { className: "rs-review-detail-value", children: [
|
|
3493
|
+
/* @__PURE__ */ jsx15("span", { children: sourceChainName }),
|
|
3494
|
+
sourceChainIcon && /* @__PURE__ */ jsx15("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx15("img", { src: sourceChainIcon, alt: "" }) })
|
|
2696
3495
|
] })
|
|
2697
3496
|
] }),
|
|
2698
|
-
/* @__PURE__ */
|
|
2699
|
-
/* @__PURE__ */
|
|
2700
|
-
/* @__PURE__ */
|
|
2701
|
-
/* @__PURE__ */
|
|
2702
|
-
targetChainIcon && /* @__PURE__ */
|
|
3497
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
|
|
3498
|
+
/* @__PURE__ */ jsx15("span", { children: "Destination chain" }),
|
|
3499
|
+
/* @__PURE__ */ jsxs13("span", { className: "rs-review-detail-value", children: [
|
|
3500
|
+
/* @__PURE__ */ jsx15("span", { children: targetChainName }),
|
|
3501
|
+
targetChainIcon && /* @__PURE__ */ jsx15("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx15("img", { src: targetChainIcon, alt: "" }) })
|
|
2703
3502
|
] })
|
|
2704
3503
|
] }),
|
|
2705
|
-
/* @__PURE__ */
|
|
2706
|
-
/* @__PURE__ */
|
|
2707
|
-
/* @__PURE__ */
|
|
3504
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
|
|
3505
|
+
/* @__PURE__ */ jsx15("span", { children: "Estimated time" }),
|
|
3506
|
+
/* @__PURE__ */ jsx15("span", { className: "rs-review-detail-value", children: estimatedTime })
|
|
2708
3507
|
] }),
|
|
2709
|
-
/* @__PURE__ */
|
|
2710
|
-
/* @__PURE__ */
|
|
2711
|
-
/* @__PURE__ */
|
|
2712
|
-
/* @__PURE__ */
|
|
3508
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
|
|
3509
|
+
/* @__PURE__ */ jsx15("span", { children: "You send" }),
|
|
3510
|
+
/* @__PURE__ */ jsxs13("span", { className: "rs-review-detail-value", children: [
|
|
3511
|
+
/* @__PURE__ */ jsxs13("span", { children: [
|
|
2713
3512
|
formattedAmount,
|
|
2714
3513
|
" ",
|
|
2715
3514
|
token.symbol
|
|
2716
3515
|
] }),
|
|
2717
|
-
sourceTokenIcon && /* @__PURE__ */
|
|
3516
|
+
sourceTokenIcon && /* @__PURE__ */ jsx15("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx15("img", { src: sourceTokenIcon, alt: "" }) })
|
|
2718
3517
|
] })
|
|
2719
3518
|
] }),
|
|
2720
|
-
/* @__PURE__ */
|
|
2721
|
-
/* @__PURE__ */
|
|
2722
|
-
/* @__PURE__ */
|
|
2723
|
-
/* @__PURE__ */
|
|
3519
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
|
|
3520
|
+
/* @__PURE__ */ jsx15("span", { children: "Receive" }),
|
|
3521
|
+
/* @__PURE__ */ jsxs13("span", { className: "rs-review-detail-value", children: [
|
|
3522
|
+
/* @__PURE__ */ jsxs13("span", { children: [
|
|
2724
3523
|
receiveAmount,
|
|
2725
3524
|
" ",
|
|
2726
3525
|
targetSymbol
|
|
2727
3526
|
] }),
|
|
2728
|
-
targetTokenIcon && /* @__PURE__ */
|
|
3527
|
+
targetTokenIcon && /* @__PURE__ */ jsx15("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx15("img", { src: targetTokenIcon, alt: "" }) })
|
|
2729
3528
|
] })
|
|
2730
3529
|
] }),
|
|
2731
|
-
/* @__PURE__ */
|
|
2732
|
-
/* @__PURE__ */
|
|
2733
|
-
/* @__PURE__ */
|
|
2734
|
-
/* @__PURE__ */
|
|
3530
|
+
/* @__PURE__ */ jsxs13("div", { className: "rs-review-detail-row", children: [
|
|
3531
|
+
/* @__PURE__ */ jsx15("span", { children: "Fees" }),
|
|
3532
|
+
/* @__PURE__ */ jsxs13("span", { className: "rs-review-detail-value", children: [
|
|
3533
|
+
/* @__PURE__ */ jsx15(
|
|
2735
3534
|
"span",
|
|
2736
3535
|
{
|
|
2737
3536
|
style: feeSponsored ? { textDecoration: "line-through" } : void 0,
|
|
2738
3537
|
children: "$0.04"
|
|
2739
3538
|
}
|
|
2740
3539
|
),
|
|
2741
|
-
/* @__PURE__ */
|
|
3540
|
+
/* @__PURE__ */ jsx15(Tooltip, { content: feeTooltip, children: /* @__PURE__ */ jsx15("span", { className: "rs-review-detail-info", "aria-label": "Fee info", children: /* @__PURE__ */ jsx15(InfoIcon, {}) }) })
|
|
2742
3541
|
] })
|
|
2743
3542
|
] })
|
|
2744
3543
|
] }),
|
|
2745
|
-
error && /* @__PURE__ */
|
|
2746
|
-
/* @__PURE__ */
|
|
3544
|
+
error && /* @__PURE__ */ jsx15(Callout, { variant: "error", children: error }),
|
|
3545
|
+
/* @__PURE__ */ jsx15(
|
|
2747
3546
|
Button,
|
|
2748
3547
|
{
|
|
2749
3548
|
onClick: handleConfirm,
|
|
@@ -2755,28 +3554,28 @@ function SolanaConfirmStep({
|
|
|
2755
3554
|
}
|
|
2756
3555
|
)
|
|
2757
3556
|
] }),
|
|
2758
|
-
/* @__PURE__ */
|
|
3557
|
+
/* @__PURE__ */ jsx15(PoweredBy, {})
|
|
2759
3558
|
] });
|
|
2760
3559
|
}
|
|
2761
3560
|
|
|
2762
3561
|
// src/components/steps/DappImportAssetSelectStep.tsx
|
|
2763
|
-
import { jsx as
|
|
3562
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2764
3563
|
function DappImportAssetSelectStep({
|
|
2765
3564
|
sourceLabel,
|
|
2766
3565
|
assets,
|
|
2767
3566
|
onSelect
|
|
2768
3567
|
}) {
|
|
2769
|
-
return /* @__PURE__ */
|
|
2770
|
-
/* @__PURE__ */
|
|
2771
|
-
/* @__PURE__ */
|
|
3568
|
+
return /* @__PURE__ */ jsxs14("div", { className: "rs-screen", children: [
|
|
3569
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
3570
|
+
/* @__PURE__ */ jsx16(
|
|
2772
3571
|
BodyHeader,
|
|
2773
3572
|
{
|
|
2774
|
-
icon: /* @__PURE__ */
|
|
3573
|
+
icon: /* @__PURE__ */ jsx16(WalletIcon, {}),
|
|
2775
3574
|
title: `Transfer from ${sourceLabel}`,
|
|
2776
3575
|
subtitle: "Pick the balance to import"
|
|
2777
3576
|
}
|
|
2778
3577
|
),
|
|
2779
|
-
/* @__PURE__ */
|
|
3578
|
+
/* @__PURE__ */ jsx16("div", { className: "rs-asset-list", children: assets.map((asset) => {
|
|
2780
3579
|
const tokenAmount = asset.balance ? tokenFormatter.format(
|
|
2781
3580
|
Number(asset.balance) / 10 ** asset.decimals
|
|
2782
3581
|
) : "0";
|
|
@@ -2784,23 +3583,23 @@ function DappImportAssetSelectStep({
|
|
|
2784
3583
|
const tokenIcon = asset.icon ?? getTokenIcon(asset.symbol);
|
|
2785
3584
|
const chainIcon = getChainIcon(asset.chainId);
|
|
2786
3585
|
const badge = getChainBadge(asset.chainId);
|
|
2787
|
-
return /* @__PURE__ */
|
|
3586
|
+
return /* @__PURE__ */ jsxs14(
|
|
2788
3587
|
"button",
|
|
2789
3588
|
{
|
|
2790
3589
|
type: "button",
|
|
2791
3590
|
className: "rs-asset-row",
|
|
2792
3591
|
onClick: () => onSelect(asset),
|
|
2793
3592
|
children: [
|
|
2794
|
-
/* @__PURE__ */
|
|
2795
|
-
/* @__PURE__ */
|
|
2796
|
-
/* @__PURE__ */
|
|
2797
|
-
chainIcon ? /* @__PURE__ */
|
|
3593
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-asset-info", children: [
|
|
3594
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-asset-icon-wrapper", children: [
|
|
3595
|
+
/* @__PURE__ */ jsx16("span", { className: "rs-asset-icon", children: tokenIcon ? /* @__PURE__ */ jsx16("img", { src: tokenIcon, alt: asset.symbol }) : asset.symbol.slice(0, 4) }),
|
|
3596
|
+
chainIcon ? /* @__PURE__ */ jsx16("span", { className: "rs-asset-chain-badge", children: /* @__PURE__ */ jsx16(
|
|
2798
3597
|
"img",
|
|
2799
3598
|
{
|
|
2800
3599
|
src: chainIcon,
|
|
2801
3600
|
alt: getChainName(asset.chainId)
|
|
2802
3601
|
}
|
|
2803
|
-
) }) : /* @__PURE__ */
|
|
3602
|
+
) }) : /* @__PURE__ */ jsx16(
|
|
2804
3603
|
"span",
|
|
2805
3604
|
{
|
|
2806
3605
|
className: "rs-asset-chain-badge",
|
|
@@ -2809,29 +3608,29 @@ function DappImportAssetSelectStep({
|
|
|
2809
3608
|
}
|
|
2810
3609
|
)
|
|
2811
3610
|
] }),
|
|
2812
|
-
/* @__PURE__ */
|
|
2813
|
-
/* @__PURE__ */
|
|
2814
|
-
/* @__PURE__ */
|
|
2815
|
-
/* @__PURE__ */
|
|
3611
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-asset-text", children: [
|
|
3612
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-asset-name-row", children: [
|
|
3613
|
+
/* @__PURE__ */ jsx16("span", { className: "rs-asset-name", children: asset.symbol }),
|
|
3614
|
+
/* @__PURE__ */ jsxs14("span", { className: "rs-asset-chain", children: [
|
|
2816
3615
|
"on ",
|
|
2817
3616
|
asset.sourceLabel
|
|
2818
3617
|
] })
|
|
2819
3618
|
] }),
|
|
2820
|
-
/* @__PURE__ */
|
|
3619
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-asset-balance-small", children: [
|
|
2821
3620
|
tokenAmount,
|
|
2822
3621
|
" ",
|
|
2823
3622
|
asset.symbol
|
|
2824
3623
|
] })
|
|
2825
3624
|
] })
|
|
2826
3625
|
] }),
|
|
2827
|
-
/* @__PURE__ */
|
|
3626
|
+
/* @__PURE__ */ jsx16("div", { className: "rs-asset-balance", children: balanceUsd })
|
|
2828
3627
|
]
|
|
2829
3628
|
},
|
|
2830
3629
|
asset.id
|
|
2831
3630
|
);
|
|
2832
3631
|
}) })
|
|
2833
3632
|
] }),
|
|
2834
|
-
/* @__PURE__ */
|
|
3633
|
+
/* @__PURE__ */ jsx16(PoweredBy, {})
|
|
2835
3634
|
] });
|
|
2836
3635
|
}
|
|
2837
3636
|
DappImportAssetSelectStep.displayName = "DappImportAssetSelectStep";
|
|
@@ -3400,6 +4199,7 @@ function applyBack(state, hasWalletOptions) {
|
|
|
3400
4199
|
targetAmount: null,
|
|
3401
4200
|
targetTokenPriceUsd: null,
|
|
3402
4201
|
balance: null,
|
|
4202
|
+
inputAmountUsd: null,
|
|
3403
4203
|
liquidityWarning: null
|
|
3404
4204
|
},
|
|
3405
4205
|
flow: {
|
|
@@ -3445,8 +4245,19 @@ function applyBack(state, hasWalletOptions) {
|
|
|
3445
4245
|
},
|
|
3446
4246
|
flow: { ...state.flow, step: "solana-amount", hasNavigatedBack: true }
|
|
3447
4247
|
};
|
|
4248
|
+
case "exchange-connect":
|
|
4249
|
+
return {
|
|
4250
|
+
...state,
|
|
4251
|
+
flow: {
|
|
4252
|
+
...state.flow,
|
|
4253
|
+
step: "exchange-select",
|
|
4254
|
+
hasNavigatedBack: true
|
|
4255
|
+
}
|
|
4256
|
+
};
|
|
3448
4257
|
case "select-asset":
|
|
3449
4258
|
case "deposit-address":
|
|
4259
|
+
case "fiat-onramp":
|
|
4260
|
+
case "exchange-select":
|
|
3450
4261
|
case "solana-token-select":
|
|
3451
4262
|
case "dapp-import-asset-select":
|
|
3452
4263
|
return {
|
|
@@ -3463,7 +4274,8 @@ function applyBack(state, hasWalletOptions) {
|
|
|
3463
4274
|
...state.dappImport,
|
|
3464
4275
|
activeProviderId: null,
|
|
3465
4276
|
selectedAsset: null
|
|
3466
|
-
}
|
|
4277
|
+
},
|
|
4278
|
+
exchange: { selectedConnection: null }
|
|
3467
4279
|
};
|
|
3468
4280
|
case "connect":
|
|
3469
4281
|
case "setup":
|
|
@@ -3476,7 +4288,8 @@ function applyBack(state, hasWalletOptions) {
|
|
|
3476
4288
|
mode: null,
|
|
3477
4289
|
isConnectSelectionConfirmed: false,
|
|
3478
4290
|
hasNavigatedBack: hasWalletOptions || state.flow.hasNavigatedBack
|
|
3479
|
-
}
|
|
4291
|
+
},
|
|
4292
|
+
exchange: { selectedConnection: null }
|
|
3480
4293
|
};
|
|
3481
4294
|
}
|
|
3482
4295
|
return state;
|
|
@@ -3496,6 +4309,10 @@ function modeEntryStep(mode) {
|
|
|
3496
4309
|
return "solana-token-select";
|
|
3497
4310
|
case "dapp-import":
|
|
3498
4311
|
return "dapp-import-asset-select";
|
|
4312
|
+
case "fiat-onramp":
|
|
4313
|
+
return "fiat-onramp";
|
|
4314
|
+
case "exchange-connect":
|
|
4315
|
+
return "exchange-select";
|
|
3499
4316
|
}
|
|
3500
4317
|
}
|
|
3501
4318
|
function updateSetupEntry(state, owner, update) {
|
|
@@ -3541,7 +4358,8 @@ function applyAction(state, action) {
|
|
|
3541
4358
|
...state.dappImport,
|
|
3542
4359
|
activeProviderId: null,
|
|
3543
4360
|
selectedAsset: null
|
|
3544
|
-
}
|
|
4361
|
+
},
|
|
4362
|
+
exchange: { selectedConnection: null }
|
|
3545
4363
|
};
|
|
3546
4364
|
case "connect/wallet-confirmed":
|
|
3547
4365
|
if (!action.mode) return state;
|
|
@@ -3565,6 +4383,39 @@ function applyAction(state, action) {
|
|
|
3565
4383
|
step: "deposit-address"
|
|
3566
4384
|
}
|
|
3567
4385
|
};
|
|
4386
|
+
case "connect/fiat-onramp-selected":
|
|
4387
|
+
return {
|
|
4388
|
+
...state,
|
|
4389
|
+
flow: {
|
|
4390
|
+
...state.flow,
|
|
4391
|
+
mode: "fiat-onramp",
|
|
4392
|
+
isConnectSelectionConfirmed: true,
|
|
4393
|
+
step: modeEntryStep("fiat-onramp")
|
|
4394
|
+
},
|
|
4395
|
+
fiat: { ...state.fiat, selectedMethod: action.paymentMethod ?? null }
|
|
4396
|
+
};
|
|
4397
|
+
case "connect/exchange-selected":
|
|
4398
|
+
return {
|
|
4399
|
+
...state,
|
|
4400
|
+
flow: {
|
|
4401
|
+
...state.flow,
|
|
4402
|
+
mode: "exchange-connect",
|
|
4403
|
+
isConnectSelectionConfirmed: true,
|
|
4404
|
+
step: modeEntryStep("exchange-connect")
|
|
4405
|
+
},
|
|
4406
|
+
exchange: { selectedConnection: null }
|
|
4407
|
+
};
|
|
4408
|
+
case "exchange/connection-selected":
|
|
4409
|
+
return {
|
|
4410
|
+
...state,
|
|
4411
|
+
flow: {
|
|
4412
|
+
...state.flow,
|
|
4413
|
+
mode: "exchange-connect",
|
|
4414
|
+
isConnectSelectionConfirmed: true,
|
|
4415
|
+
step: "exchange-connect"
|
|
4416
|
+
},
|
|
4417
|
+
exchange: { selectedConnection: action.connection }
|
|
4418
|
+
};
|
|
3568
4419
|
case "connect/auto-locked":
|
|
3569
4420
|
return {
|
|
3570
4421
|
...state,
|
|
@@ -3590,7 +4441,8 @@ function applyAction(state, action) {
|
|
|
3590
4441
|
...state.dappImport,
|
|
3591
4442
|
activeProviderId: null,
|
|
3592
4443
|
selectedAsset: null
|
|
3593
|
-
}
|
|
4444
|
+
},
|
|
4445
|
+
exchange: { selectedConnection: null }
|
|
3594
4446
|
};
|
|
3595
4447
|
case "setup/started": {
|
|
3596
4448
|
const existing = state.setup.byOwner[ownerKey(action.owner)];
|
|
@@ -3655,7 +4507,11 @@ function applyAction(state, action) {
|
|
|
3655
4507
|
selectedAsset: action.asset,
|
|
3656
4508
|
// Seed the user-facing amount input with the modal's defaultAmount
|
|
3657
4509
|
// on first visit. Subsequent visits override via amount/entered.
|
|
3658
|
-
|
|
4510
|
+
// `inputAmountUsd` is the USD-style value the input shows; it (not
|
|
4511
|
+
// the native `amount`) is what re-seeds the input on back, so seed
|
|
4512
|
+
// it here too and reset it on a fresh pick.
|
|
4513
|
+
amount: action.seedAmount ?? state.deposit.amount,
|
|
4514
|
+
inputAmountUsd: action.seedAmount ?? null
|
|
3659
4515
|
},
|
|
3660
4516
|
flow: { ...state.flow, step: "amount" }
|
|
3661
4517
|
};
|
|
@@ -3668,6 +4524,11 @@ function applyAction(state, action) {
|
|
|
3668
4524
|
targetAmount: action.targetAmount,
|
|
3669
4525
|
targetTokenPriceUsd: action.targetTokenPriceUsd,
|
|
3670
4526
|
balance: action.balance ?? null,
|
|
4527
|
+
// `targetAmount` is the USD-style value the user typed. Preserve it
|
|
4528
|
+
// as `inputAmountUsd` so back-from-confirm re-seeds the input with
|
|
4529
|
+
// the typed USD value rather than the converted native `amount`
|
|
4530
|
+
// (which corrupts the input for non-stablecoin priced tokens).
|
|
4531
|
+
inputAmountUsd: action.targetAmount,
|
|
3671
4532
|
liquidityWarning: action.liquidityWarning ?? null
|
|
3672
4533
|
},
|
|
3673
4534
|
flow: { ...state.flow, step: "confirm" }
|
|
@@ -3816,7 +4677,9 @@ function applyAction(state, action) {
|
|
|
3816
4677
|
activeProviderId: null,
|
|
3817
4678
|
selectedAsset: null
|
|
3818
4679
|
},
|
|
3819
|
-
setup: { byOwner: preservedByOwner }
|
|
4680
|
+
setup: { byOwner: preservedByOwner },
|
|
4681
|
+
fiat: { selectedMethod: null },
|
|
4682
|
+
exchange: { selectedConnection: null }
|
|
3820
4683
|
};
|
|
3821
4684
|
}
|
|
3822
4685
|
case "target/changed": {
|
|
@@ -3890,6 +4753,12 @@ function createInitialState(overrides) {
|
|
|
3890
4753
|
},
|
|
3891
4754
|
setup: {
|
|
3892
4755
|
byOwner: {}
|
|
4756
|
+
},
|
|
4757
|
+
fiat: {
|
|
4758
|
+
selectedMethod: null
|
|
4759
|
+
},
|
|
4760
|
+
exchange: {
|
|
4761
|
+
selectedConnection: null
|
|
3893
4762
|
}
|
|
3894
4763
|
};
|
|
3895
4764
|
}
|
|
@@ -4192,23 +5061,23 @@ function mapError(error) {
|
|
|
4192
5061
|
}
|
|
4193
5062
|
|
|
4194
5063
|
// src/DepositFlow.tsx
|
|
4195
|
-
import { Fragment as Fragment3, jsx as
|
|
5064
|
+
import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4196
5065
|
function AccountPreparingSkeleton({
|
|
4197
5066
|
errorMessage,
|
|
4198
5067
|
onRetry
|
|
4199
5068
|
}) {
|
|
4200
|
-
return /* @__PURE__ */
|
|
4201
|
-
/* @__PURE__ */
|
|
4202
|
-
/* @__PURE__ */
|
|
4203
|
-
/* @__PURE__ */
|
|
4204
|
-
] }) : /* @__PURE__ */
|
|
4205
|
-
errorMessage && onRetry && /* @__PURE__ */
|
|
5069
|
+
return /* @__PURE__ */ jsxs15("div", { className: "rs-step", children: [
|
|
5070
|
+
/* @__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: [
|
|
5071
|
+
/* @__PURE__ */ jsx17("div", { className: "rs-loading-title rs-text-error", children: "Couldn\u2019t prepare account" }),
|
|
5072
|
+
/* @__PURE__ */ jsx17("div", { className: "rs-loading-subtitle", children: errorMessage })
|
|
5073
|
+
] }) : /* @__PURE__ */ jsx17("div", { className: "rs-loading-title", children: "Preparing\u2026" }) }) }) }),
|
|
5074
|
+
errorMessage && onRetry && /* @__PURE__ */ jsx17("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx17(
|
|
4206
5075
|
"button",
|
|
4207
5076
|
{
|
|
4208
5077
|
type: "button",
|
|
4209
5078
|
className: "rs-button rs-button--default rs-button--full-width",
|
|
4210
5079
|
onClick: onRetry,
|
|
4211
|
-
children: /* @__PURE__ */
|
|
5080
|
+
children: /* @__PURE__ */ jsx17("span", { children: "Try again" })
|
|
4212
5081
|
}
|
|
4213
5082
|
) })
|
|
4214
5083
|
] });
|
|
@@ -4217,10 +5086,12 @@ var QR_AUTO_ADVANCE_HYDRATION_GRACE_MS = 1e3;
|
|
|
4217
5086
|
function isSameRoute2(sourceChain, sourceToken, targetChain, targetToken) {
|
|
4218
5087
|
return sourceChain === targetChain && sourceToken.toLowerCase() === targetToken.toLowerCase();
|
|
4219
5088
|
}
|
|
5089
|
+
var SWAPPED_SOURCE_CHAIN = 8453;
|
|
5090
|
+
var SWAPPED_SOURCE_TOKEN = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
4220
5091
|
function getAddressKey(address) {
|
|
4221
5092
|
return address ? address.toLowerCase() : null;
|
|
4222
5093
|
}
|
|
4223
|
-
function deriveStep(flow, d, p, activeEntry) {
|
|
5094
|
+
function deriveStep(flow, d, p, activeEntry, fiat, exchange) {
|
|
4224
5095
|
const flowStep = flow.step;
|
|
4225
5096
|
const smartAccount = activeEntry.smartAccount;
|
|
4226
5097
|
const solanaDepositAddress = activeEntry.solanaDepositAddress;
|
|
@@ -4235,6 +5106,23 @@ function deriveStep(flow, d, p, activeEntry) {
|
|
|
4235
5106
|
smartAccount,
|
|
4236
5107
|
solanaDepositAddress: solanaDepositAddress ?? void 0
|
|
4237
5108
|
};
|
|
5109
|
+
case "fiat-onramp":
|
|
5110
|
+
if (!smartAccount) return { type: "setup" };
|
|
5111
|
+
return {
|
|
5112
|
+
type: "fiat-onramp",
|
|
5113
|
+
smartAccount,
|
|
5114
|
+
paymentMethod: fiat.selectedMethod ?? void 0
|
|
5115
|
+
};
|
|
5116
|
+
case "exchange-select":
|
|
5117
|
+
return { type: "exchange-select" };
|
|
5118
|
+
case "exchange-connect":
|
|
5119
|
+
if (!exchange.selectedConnection) return { type: "exchange-select" };
|
|
5120
|
+
if (!smartAccount) return { type: "setup" };
|
|
5121
|
+
return {
|
|
5122
|
+
type: "exchange-connect",
|
|
5123
|
+
smartAccount,
|
|
5124
|
+
connection: exchange.selectedConnection
|
|
5125
|
+
};
|
|
4238
5126
|
case "select-asset":
|
|
4239
5127
|
if (!smartAccount) return { type: "setup" };
|
|
4240
5128
|
return { type: "select-asset", smartAccount };
|
|
@@ -4244,7 +5132,9 @@ function deriveStep(flow, d, p, activeEntry) {
|
|
|
4244
5132
|
type: "amount",
|
|
4245
5133
|
smartAccount,
|
|
4246
5134
|
asset: d.selectedAsset,
|
|
4247
|
-
|
|
5135
|
+
// Seed the input from the USD-style value the user typed, not the
|
|
5136
|
+
// native source `amount` (which would corrupt the input on back).
|
|
5137
|
+
inputAmountUsd: d.inputAmountUsd ?? void 0
|
|
4248
5138
|
};
|
|
4249
5139
|
case "confirm":
|
|
4250
5140
|
if (!smartAccount || !d.selectedAsset || !d.amount || !d.targetAmount) {
|
|
@@ -4321,6 +5211,8 @@ function resolveOwnerForMode(mode, ctx) {
|
|
|
4321
5211
|
switch (mode) {
|
|
4322
5212
|
case "deposit-address":
|
|
4323
5213
|
case "solana-wallet":
|
|
5214
|
+
case "fiat-onramp":
|
|
5215
|
+
case "exchange-connect":
|
|
4324
5216
|
return ctx.dappAddress ?? null;
|
|
4325
5217
|
case "wallet":
|
|
4326
5218
|
return ctx.walletOwner ?? null;
|
|
@@ -4351,6 +5243,10 @@ function DepositFlow({
|
|
|
4351
5243
|
forceRegister = false,
|
|
4352
5244
|
enableSolana = true,
|
|
4353
5245
|
dappImports,
|
|
5246
|
+
enableFiatOnramp = false,
|
|
5247
|
+
enableQrTransfer = true,
|
|
5248
|
+
fiatOnrampMethods,
|
|
5249
|
+
enableExchangeConnect = false,
|
|
4354
5250
|
reownWallet,
|
|
4355
5251
|
onConnect,
|
|
4356
5252
|
onDisconnect,
|
|
@@ -4379,31 +5275,33 @@ function DepositFlow({
|
|
|
4379
5275
|
const depositSlice = useDepositStore((s) => s.deposit);
|
|
4380
5276
|
const processingSlice = useDepositStore((s) => s.processing);
|
|
4381
5277
|
const setupSlice = useDepositStore((s) => s.setup);
|
|
5278
|
+
const fiatSlice = useDepositStore((s) => s.fiat);
|
|
5279
|
+
const exchangeSlice = useDepositStore((s) => s.exchange);
|
|
4382
5280
|
const flowMode = flowSlice.mode;
|
|
4383
5281
|
const isConnectSelectionConfirmed = flowSlice.isConnectSelectionConfirmed;
|
|
4384
5282
|
const hasNavigatedBack = flowSlice.hasNavigatedBack;
|
|
4385
5283
|
const selectedWalletId = useDepositStore(selectedWalletIdSelector);
|
|
4386
|
-
const [totalBalanceUsd, setTotalBalanceUsd] =
|
|
4387
|
-
const [hasQrAutoAdvanceGraceElapsed, setHasQrAutoAdvanceGraceElapsed] =
|
|
4388
|
-
const portfolioAssetsRef =
|
|
4389
|
-
const stableWalletSignerRef =
|
|
4390
|
-
const stableWalletSelectionKeyRef =
|
|
4391
|
-
const logFlow =
|
|
5284
|
+
const [totalBalanceUsd, setTotalBalanceUsd] = useState11(0);
|
|
5285
|
+
const [hasQrAutoAdvanceGraceElapsed, setHasQrAutoAdvanceGraceElapsed] = useState11(() => !hasInitialWalletHydrationPending);
|
|
5286
|
+
const portfolioAssetsRef = useRef8([]);
|
|
5287
|
+
const stableWalletSignerRef = useRef8(null);
|
|
5288
|
+
const stableWalletSelectionKeyRef = useRef8(null);
|
|
5289
|
+
const logFlow = useCallback7(
|
|
4392
5290
|
(message, data) => {
|
|
4393
5291
|
debugLog(debug, "deposit-flow", message, data);
|
|
4394
5292
|
},
|
|
4395
5293
|
[debug]
|
|
4396
5294
|
);
|
|
4397
|
-
const logFlowError =
|
|
5295
|
+
const logFlowError = useCallback7(
|
|
4398
5296
|
(message, error, data) => {
|
|
4399
5297
|
debugError(debug, "deposit-flow", message, error, data);
|
|
4400
5298
|
},
|
|
4401
5299
|
[debug]
|
|
4402
5300
|
);
|
|
4403
|
-
const handleAssetsLoaded =
|
|
5301
|
+
const handleAssetsLoaded = useCallback7((assets) => {
|
|
4404
5302
|
portfolioAssetsRef.current = assets;
|
|
4405
5303
|
}, []);
|
|
4406
|
-
const getTokenPriceUsd =
|
|
5304
|
+
const getTokenPriceUsd = useCallback7((symbol) => {
|
|
4407
5305
|
const sym = symbol.toLowerCase();
|
|
4408
5306
|
for (const asset of portfolioAssetsRef.current) {
|
|
4409
5307
|
if (asset.symbol.toLowerCase() === sym && asset.balanceUsd && asset.balance) {
|
|
@@ -4418,14 +5316,14 @@ function DepositFlow({
|
|
|
4418
5316
|
}
|
|
4419
5317
|
return null;
|
|
4420
5318
|
}, []);
|
|
4421
|
-
const dappSwitchChain =
|
|
5319
|
+
const dappSwitchChain = useMemo7(() => {
|
|
4422
5320
|
if (!dappWalletClient?.switchChain) return void 0;
|
|
4423
5321
|
return async (chainId) => {
|
|
4424
5322
|
await dappWalletClient.switchChain?.({ id: chainId });
|
|
4425
5323
|
};
|
|
4426
5324
|
}, [dappWalletClient]);
|
|
4427
5325
|
const connectedWalletAddress = dappWalletClient?.account?.address ?? null;
|
|
4428
|
-
const walletOptions =
|
|
5326
|
+
const walletOptions = useMemo7(() => {
|
|
4429
5327
|
const options = [];
|
|
4430
5328
|
const seen = /* @__PURE__ */ new Set();
|
|
4431
5329
|
if (connectedWalletAddress && dappAddress) {
|
|
@@ -4477,7 +5375,7 @@ function DepositFlow({
|
|
|
4477
5375
|
reownWallet?.solanaAddress,
|
|
4478
5376
|
reownWallet?.caipAddress
|
|
4479
5377
|
]);
|
|
4480
|
-
const canAutoLock = dappWalletClient?.account && dappAddress && !reownWallet;
|
|
5378
|
+
const canAutoLock = dappWalletClient?.account && dappAddress && !reownWallet && !enableFiatOnramp && !enableExchangeConnect;
|
|
4481
5379
|
const hasWalletOptions = walletOptions.length > 0;
|
|
4482
5380
|
const hasReownSession = Boolean(
|
|
4483
5381
|
enableSolana ? reownWallet?.isConnected || reownWallet?.address : reownWallet?.address
|
|
@@ -4486,7 +5384,7 @@ function DepositFlow({
|
|
|
4486
5384
|
dappAddress && !hasWalletOptions && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasReownSession && !reownWallet.isReady)
|
|
4487
5385
|
);
|
|
4488
5386
|
const showConnectStep = flowMode === null && !isConnectSelectionConfirmed;
|
|
4489
|
-
|
|
5387
|
+
useEffect10(() => {
|
|
4490
5388
|
if (!isWalletHydrationPending) {
|
|
4491
5389
|
setHasQrAutoAdvanceGraceElapsed(true);
|
|
4492
5390
|
return;
|
|
@@ -4497,7 +5395,7 @@ function DepositFlow({
|
|
|
4497
5395
|
}, QR_AUTO_ADVANCE_HYDRATION_GRACE_MS);
|
|
4498
5396
|
return () => window.clearTimeout(timeout);
|
|
4499
5397
|
}, [isWalletHydrationPending]);
|
|
4500
|
-
const walletSelectionKey =
|
|
5398
|
+
const walletSelectionKey = useMemo7(() => {
|
|
4501
5399
|
if (flowMode !== "wallet" && flowMode !== "dapp-import") return null;
|
|
4502
5400
|
if (canAutoLock) {
|
|
4503
5401
|
return getAddressKey(connectedWalletAddress);
|
|
@@ -4514,8 +5412,8 @@ function DepositFlow({
|
|
|
4514
5412
|
const setupChainId = typeof targetChain === "number" ? targetChain : typeof defaultSourceChain === "number" ? defaultSourceChain : base.id;
|
|
4515
5413
|
const targetSymbol = getTargetTokenSymbol(targetToken, targetChain);
|
|
4516
5414
|
const isTargetStablecoin = isStablecoinSymbol(targetSymbol);
|
|
4517
|
-
const targetMarketPriceRef =
|
|
4518
|
-
|
|
5415
|
+
const targetMarketPriceRef = useRef8(null);
|
|
5416
|
+
useEffect10(() => {
|
|
4519
5417
|
targetMarketPriceRef.current = null;
|
|
4520
5418
|
if (isTargetStablecoin || targetSymbol === "Token") {
|
|
4521
5419
|
return;
|
|
@@ -4530,7 +5428,7 @@ function DepositFlow({
|
|
|
4530
5428
|
cancelled = true;
|
|
4531
5429
|
};
|
|
4532
5430
|
}, [service, targetSymbol, isTargetStablecoin]);
|
|
4533
|
-
const walletSignerContext =
|
|
5431
|
+
const walletSignerContext = useMemo7(() => {
|
|
4534
5432
|
if (flowMode === "deposit-address") {
|
|
4535
5433
|
return null;
|
|
4536
5434
|
}
|
|
@@ -4596,7 +5494,7 @@ function DepositFlow({
|
|
|
4596
5494
|
reownWallet,
|
|
4597
5495
|
setupChainId
|
|
4598
5496
|
]);
|
|
4599
|
-
|
|
5497
|
+
useEffect10(() => {
|
|
4600
5498
|
if (flowMode !== "wallet" && flowMode !== "dapp-import") {
|
|
4601
5499
|
stableWalletSelectionKeyRef.current = null;
|
|
4602
5500
|
stableWalletSignerRef.current = null;
|
|
@@ -4611,7 +5509,7 @@ function DepositFlow({
|
|
|
4611
5509
|
stableWalletSignerRef.current = walletSignerContext;
|
|
4612
5510
|
}
|
|
4613
5511
|
}, [flowMode, walletSelectionKey, walletSignerContext]);
|
|
4614
|
-
const signerContext =
|
|
5512
|
+
const signerContext = useMemo7(() => {
|
|
4615
5513
|
if (flowMode === "deposit-address") {
|
|
4616
5514
|
if (!dappAddress) return null;
|
|
4617
5515
|
return {
|
|
@@ -4639,7 +5537,7 @@ function DepositFlow({
|
|
|
4639
5537
|
walletSignerContext,
|
|
4640
5538
|
walletSelectionKey
|
|
4641
5539
|
]);
|
|
4642
|
-
const selectedEvmWalletOwner =
|
|
5540
|
+
const selectedEvmWalletOwner = useMemo7(() => {
|
|
4643
5541
|
if (!selectedWalletId) return null;
|
|
4644
5542
|
const opt = walletOptions.find((o) => o.id === selectedWalletId);
|
|
4645
5543
|
if (opt?.kind === "external" && opt.address) {
|
|
@@ -4650,7 +5548,7 @@ function DepositFlow({
|
|
|
4650
5548
|
}
|
|
4651
5549
|
return null;
|
|
4652
5550
|
}, [selectedWalletId, walletOptions]);
|
|
4653
|
-
const dappImportOwner =
|
|
5551
|
+
const dappImportOwner = useMemo7(() => {
|
|
4654
5552
|
if (selectedEvmWalletOwner) return selectedEvmWalletOwner;
|
|
4655
5553
|
if (reownWallet?.address && reownWallet.isConnected) {
|
|
4656
5554
|
return reownWallet.address;
|
|
@@ -4663,7 +5561,7 @@ function DepositFlow({
|
|
|
4663
5561
|
reownWallet?.isConnected,
|
|
4664
5562
|
connectedWalletAddress
|
|
4665
5563
|
]);
|
|
4666
|
-
const activeOwner =
|
|
5564
|
+
const activeOwner = useMemo7(
|
|
4667
5565
|
() => resolveOwnerForMode(flowMode, {
|
|
4668
5566
|
dappAddress,
|
|
4669
5567
|
walletOwner: signerContext?.ownerAddress ?? (canAutoLock ? connectedWalletAddress : selectedEvmWalletOwner),
|
|
@@ -4679,12 +5577,12 @@ function DepositFlow({
|
|
|
4679
5577
|
dappImportOwner
|
|
4680
5578
|
]
|
|
4681
5579
|
);
|
|
4682
|
-
const activeEntry =
|
|
5580
|
+
const activeEntry = useMemo7(
|
|
4683
5581
|
() => readSetupForOwner(setupSlice, activeOwner),
|
|
4684
5582
|
[setupSlice, activeOwner]
|
|
4685
5583
|
);
|
|
4686
|
-
const lastActiveSetupLifecycleKeyRef =
|
|
4687
|
-
|
|
5584
|
+
const lastActiveSetupLifecycleKeyRef = useRef8(null);
|
|
5585
|
+
useEffect10(() => {
|
|
4688
5586
|
if (!flowMode || !isConnectSelectionConfirmed) {
|
|
4689
5587
|
lastActiveSetupLifecycleKeyRef.current = null;
|
|
4690
5588
|
return;
|
|
@@ -4720,12 +5618,26 @@ function DepositFlow({
|
|
|
4720
5618
|
activeEntry.solanaDepositAddress,
|
|
4721
5619
|
onLifecycleRef
|
|
4722
5620
|
]);
|
|
4723
|
-
const effectiveStep =
|
|
4724
|
-
() => deriveStep(
|
|
4725
|
-
|
|
5621
|
+
const effectiveStep = useMemo7(
|
|
5622
|
+
() => deriveStep(
|
|
5623
|
+
flowSlice,
|
|
5624
|
+
depositSlice,
|
|
5625
|
+
processingSlice,
|
|
5626
|
+
activeEntry,
|
|
5627
|
+
fiatSlice,
|
|
5628
|
+
exchangeSlice
|
|
5629
|
+
),
|
|
5630
|
+
[
|
|
5631
|
+
flowSlice,
|
|
5632
|
+
depositSlice,
|
|
5633
|
+
processingSlice,
|
|
5634
|
+
activeEntry,
|
|
5635
|
+
fiatSlice,
|
|
5636
|
+
exchangeSlice
|
|
5637
|
+
]
|
|
4726
5638
|
);
|
|
4727
5639
|
const step = effectiveStep;
|
|
4728
|
-
const handleBack =
|
|
5640
|
+
const handleBack = useCallback7(() => {
|
|
4729
5641
|
const stepBeforeBack = storeApi.getState().flow.step;
|
|
4730
5642
|
storeApi.dispatch({
|
|
4731
5643
|
type: "back/requested",
|
|
@@ -4735,16 +5647,52 @@ function DepositFlow({
|
|
|
4735
5647
|
portfolioAssetsRef.current = [];
|
|
4736
5648
|
}
|
|
4737
5649
|
}, [storeApi, hasWalletOptions, reownWallet]);
|
|
4738
|
-
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;
|
|
5650
|
+
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;
|
|
4739
5651
|
const currentBackHandler = canGoBackFromHere ? handleBack : void 0;
|
|
4740
5652
|
const currentScreen = showConnectStep ? "connect" : effectiveStep.type;
|
|
4741
|
-
|
|
5653
|
+
useEffect10(() => {
|
|
4742
5654
|
onStepChangeRef.current?.(currentBackHandler, currentScreen);
|
|
4743
5655
|
}, [currentBackHandler, currentScreen, onStepChangeRef]);
|
|
5656
|
+
const lastModalHeightRef = useRef8(0);
|
|
5657
|
+
const modalContentElRef = useRef8(null);
|
|
5658
|
+
useEffect10(() => {
|
|
5659
|
+
const mc = document.querySelector(".rs-modal-content");
|
|
5660
|
+
if (!mc) return;
|
|
5661
|
+
modalContentElRef.current = mc;
|
|
5662
|
+
const ro = new ResizeObserver((entries) => {
|
|
5663
|
+
for (const entry of entries) {
|
|
5664
|
+
const border = entry.borderBoxSize?.[0]?.blockSize;
|
|
5665
|
+
lastModalHeightRef.current = typeof border === "number" ? border : entry.contentRect.height;
|
|
5666
|
+
}
|
|
5667
|
+
});
|
|
5668
|
+
ro.observe(mc);
|
|
5669
|
+
return () => {
|
|
5670
|
+
ro.disconnect();
|
|
5671
|
+
modalContentElRef.current = null;
|
|
5672
|
+
};
|
|
5673
|
+
}, []);
|
|
5674
|
+
const stepPinKey = `${flowMode ?? "none"}:${step.type}`;
|
|
5675
|
+
const prevStepPinKeyRef = useRef8(stepPinKey);
|
|
5676
|
+
useLayoutEffect2(() => {
|
|
5677
|
+
if (prevStepPinKeyRef.current === stepPinKey) return;
|
|
5678
|
+
prevStepPinKeyRef.current = stepPinKey;
|
|
5679
|
+
const mc = document.querySelector(".rs-modal-content");
|
|
5680
|
+
const lastHeight = lastModalHeightRef.current;
|
|
5681
|
+
if (!mc || lastHeight <= 0) return;
|
|
5682
|
+
const prevTransition = mc.style.transition;
|
|
5683
|
+
mc.style.transition = "none";
|
|
5684
|
+
mc.style.setProperty("min-height", `${lastHeight}px`, "important");
|
|
5685
|
+
void mc.offsetHeight;
|
|
5686
|
+
const rafId = requestAnimationFrame(() => {
|
|
5687
|
+
mc.style.transition = prevTransition;
|
|
5688
|
+
mc.style.removeProperty("min-height");
|
|
5689
|
+
});
|
|
5690
|
+
return () => cancelAnimationFrame(rafId);
|
|
5691
|
+
}, [stepPinKey]);
|
|
4744
5692
|
const stepSendToken = effectiveStep.type === "amount" ? effectiveStep.asset.symbol : null;
|
|
4745
5693
|
const stepOpenEventKey = effectiveStep.type === "select-asset" ? "select-asset" : effectiveStep.type === "deposit-address" ? "deposit-address" : effectiveStep.type === "amount" && stepSendToken ? `amount:${stepSendToken.toLowerCase()}` : null;
|
|
4746
|
-
const lastStepOpenEventKeyRef =
|
|
4747
|
-
|
|
5694
|
+
const lastStepOpenEventKeyRef = useRef8(null);
|
|
5695
|
+
useEffect10(() => {
|
|
4748
5696
|
if (!stepOpenEventKey) {
|
|
4749
5697
|
lastStepOpenEventKeyRef.current = null;
|
|
4750
5698
|
return;
|
|
@@ -4786,7 +5734,7 @@ function DepositFlow({
|
|
|
4786
5734
|
totalBalanceUsd,
|
|
4787
5735
|
onEventRef
|
|
4788
5736
|
]);
|
|
4789
|
-
|
|
5737
|
+
useEffect10(() => {
|
|
4790
5738
|
logFlow("state:changed", {
|
|
4791
5739
|
step: effectiveStep.type,
|
|
4792
5740
|
flowMode,
|
|
@@ -4802,7 +5750,7 @@ function DepositFlow({
|
|
|
4802
5750
|
targetChain,
|
|
4803
5751
|
targetToken
|
|
4804
5752
|
]);
|
|
4805
|
-
|
|
5753
|
+
useEffect10(() => {
|
|
4806
5754
|
onLifecycleRef.current?.({
|
|
4807
5755
|
type: "balance-changed",
|
|
4808
5756
|
totalUsd: totalBalanceUsd
|
|
@@ -4811,10 +5759,12 @@ function DepositFlow({
|
|
|
4811
5759
|
const isDepositAddressMode = flowMode === "deposit-address";
|
|
4812
5760
|
const isSolanaWalletMode = flowMode === "solana-wallet";
|
|
4813
5761
|
const isDappImportMode = flowMode === "dapp-import";
|
|
4814
|
-
const
|
|
5762
|
+
const isFiatOnrampMode = flowMode === "fiat-onramp";
|
|
5763
|
+
const isExchangeConnectMode = flowMode === "exchange-connect";
|
|
5764
|
+
const handleSelectTransferCrypto = useCallback7(() => {
|
|
4815
5765
|
storeApi.dispatch({ type: "connect/transfer-crypto-selected" });
|
|
4816
5766
|
}, [storeApi]);
|
|
4817
|
-
const handleConfirmWallet =
|
|
5767
|
+
const handleConfirmWallet = useCallback7(
|
|
4818
5768
|
(walletId) => {
|
|
4819
5769
|
const selectedOption = walletOptions.find((o) => o.id === walletId);
|
|
4820
5770
|
const mode = enableSolana && selectedOption?.kind === "solana" ? "solana-wallet" : "wallet";
|
|
@@ -4830,12 +5780,12 @@ function DepositFlow({
|
|
|
4830
5780
|
enableSolana && reownWallet?.isConnected && reownWallet?.isSolana
|
|
4831
5781
|
);
|
|
4832
5782
|
const dappImportsKey = dappImports ? Object.keys(dappImports).filter((k) => dappImports[k]).sort().join(",") : "";
|
|
4833
|
-
const enabledDappImportProviders =
|
|
5783
|
+
const enabledDappImportProviders = useMemo7(
|
|
4834
5784
|
() => isSolanaWalletConnected ? [] : getEnabledProviders(dappImports),
|
|
4835
5785
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- intentional: keyed on dappImportsKey, not the dappImports object identity
|
|
4836
5786
|
[dappImportsKey, isSolanaWalletConnected]
|
|
4837
5787
|
);
|
|
4838
|
-
const handleSelectDappImport =
|
|
5788
|
+
const handleSelectDappImport = useCallback7(
|
|
4839
5789
|
(providerId) => {
|
|
4840
5790
|
const owner = dappImportOwner;
|
|
4841
5791
|
if (owner) {
|
|
@@ -4856,13 +5806,13 @@ function DepositFlow({
|
|
|
4856
5806
|
},
|
|
4857
5807
|
[storeApi, walletOptions, dappImportOwner]
|
|
4858
5808
|
);
|
|
4859
|
-
const handleDappImportAssetSelected =
|
|
5809
|
+
const handleDappImportAssetSelected = useCallback7(
|
|
4860
5810
|
(asset) => {
|
|
4861
5811
|
storeApi.dispatch({ type: "dapp-import/asset-selected", asset });
|
|
4862
5812
|
},
|
|
4863
5813
|
[storeApi]
|
|
4864
5814
|
);
|
|
4865
|
-
|
|
5815
|
+
useEffect10(() => {
|
|
4866
5816
|
if (!dappImportOwner || enabledDappImportProviders.length === 0) {
|
|
4867
5817
|
storeApi.dispatch({ type: "dapp-import/availability-cleared" });
|
|
4868
5818
|
return;
|
|
@@ -4911,7 +5861,7 @@ function DepositFlow({
|
|
|
4911
5861
|
const activeDappImportProviderId = useDepositStore(
|
|
4912
5862
|
(s) => s.dappImport.activeProviderId
|
|
4913
5863
|
);
|
|
4914
|
-
const connectStepDappImports =
|
|
5864
|
+
const connectStepDappImports = useMemo7(
|
|
4915
5865
|
() => enabledDappImportProviders.map((provider) => {
|
|
4916
5866
|
const baseRow = {
|
|
4917
5867
|
id: provider.id,
|
|
@@ -4961,13 +5911,13 @@ function DepositFlow({
|
|
|
4961
5911
|
dappImportOwner
|
|
4962
5912
|
]
|
|
4963
5913
|
);
|
|
4964
|
-
const activeDappImportProvider =
|
|
5914
|
+
const activeDappImportProvider = useMemo7(() => {
|
|
4965
5915
|
if (!activeDappImportProviderId) return null;
|
|
4966
5916
|
return enabledDappImportProviders.find(
|
|
4967
5917
|
(p) => p.id === activeDappImportProviderId
|
|
4968
5918
|
) ?? null;
|
|
4969
5919
|
}, [activeDappImportProviderId, enabledDappImportProviders]);
|
|
4970
|
-
const activeDappImportAvailability =
|
|
5920
|
+
const activeDappImportAvailability = useMemo7(() => {
|
|
4971
5921
|
if (!activeDappImportProviderId) return null;
|
|
4972
5922
|
if (!dappImportOwner || dappImportAvailabilityOwner?.toLowerCase() !== dappImportOwner.toLowerCase()) {
|
|
4973
5923
|
return null;
|
|
@@ -4981,7 +5931,28 @@ function DepositFlow({
|
|
|
4981
5931
|
dappImportAvailabilityOwner,
|
|
4982
5932
|
dappImportOwner
|
|
4983
5933
|
]);
|
|
4984
|
-
const
|
|
5934
|
+
const handleSelectFiatMethod = useCallback7(
|
|
5935
|
+
(paymentMethod) => {
|
|
5936
|
+
storeApi.dispatch({
|
|
5937
|
+
type: "connect/fiat-onramp-selected",
|
|
5938
|
+
paymentMethod
|
|
5939
|
+
});
|
|
5940
|
+
},
|
|
5941
|
+
[storeApi]
|
|
5942
|
+
);
|
|
5943
|
+
const handleSelectExchange = useCallback7(() => {
|
|
5944
|
+
storeApi.dispatch({ type: "connect/exchange-selected" });
|
|
5945
|
+
}, [storeApi]);
|
|
5946
|
+
const handleSelectExchangeConnection = useCallback7(
|
|
5947
|
+
(connection) => {
|
|
5948
|
+
storeApi.dispatch({
|
|
5949
|
+
type: "exchange/connection-selected",
|
|
5950
|
+
connection
|
|
5951
|
+
});
|
|
5952
|
+
},
|
|
5953
|
+
[storeApi]
|
|
5954
|
+
);
|
|
5955
|
+
const handleNewDeposit = useCallback7(() => {
|
|
4985
5956
|
onLifecycleRef.current?.({
|
|
4986
5957
|
type: "smart-account-changed",
|
|
4987
5958
|
evm: null,
|
|
@@ -4992,7 +5963,7 @@ function DepositFlow({
|
|
|
4992
5963
|
stableWalletSignerRef.current = null;
|
|
4993
5964
|
stableWalletSelectionKeyRef.current = null;
|
|
4994
5965
|
}, [onLifecycleRef, storeApi]);
|
|
4995
|
-
const setupInputBase =
|
|
5966
|
+
const setupInputBase = useMemo7(
|
|
4996
5967
|
() => ({
|
|
4997
5968
|
targetChain,
|
|
4998
5969
|
targetToken,
|
|
@@ -5018,7 +5989,7 @@ function DepositFlow({
|
|
|
5018
5989
|
enableSolana
|
|
5019
5990
|
]
|
|
5020
5991
|
);
|
|
5021
|
-
const desiredOwnersKey =
|
|
5992
|
+
const desiredOwnersKey = useMemo7(() => {
|
|
5022
5993
|
const owners = [];
|
|
5023
5994
|
const seen = /* @__PURE__ */ new Set();
|
|
5024
5995
|
const push = (addr) => {
|
|
@@ -5039,7 +6010,7 @@ function DepositFlow({
|
|
|
5039
6010
|
reownWallet?.address,
|
|
5040
6011
|
dappImportOwner
|
|
5041
6012
|
]);
|
|
5042
|
-
|
|
6013
|
+
useEffect10(() => {
|
|
5043
6014
|
desiredOwnersKey.forEach((owner) => {
|
|
5044
6015
|
void (async () => {
|
|
5045
6016
|
const input = {
|
|
@@ -5134,7 +6105,7 @@ function DepositFlow({
|
|
|
5134
6105
|
storeApi,
|
|
5135
6106
|
setupSlice.byOwner
|
|
5136
6107
|
]);
|
|
5137
|
-
const handleDepositAddressSubmitted =
|
|
6108
|
+
const handleDepositAddressSubmitted = useCallback7(
|
|
5138
6109
|
(data) => {
|
|
5139
6110
|
logFlow("deposit-address:detected", {
|
|
5140
6111
|
txHash: data.txHash,
|
|
@@ -5145,7 +6116,7 @@ function DepositFlow({
|
|
|
5145
6116
|
},
|
|
5146
6117
|
[logFlow, onLifecycleRef]
|
|
5147
6118
|
);
|
|
5148
|
-
const handleSolanaTokenContinue =
|
|
6119
|
+
const handleSolanaTokenContinue = useCallback7(
|
|
5149
6120
|
(token, balance, balanceUsd) => {
|
|
5150
6121
|
logFlow("solana:token:continue", { token: token.symbol });
|
|
5151
6122
|
storeApi.dispatch({
|
|
@@ -5158,7 +6129,7 @@ function DepositFlow({
|
|
|
5158
6129
|
},
|
|
5159
6130
|
[defaultAmount, logFlow, storeApi]
|
|
5160
6131
|
);
|
|
5161
|
-
const handleSolanaAmountContinue =
|
|
6132
|
+
const handleSolanaAmountContinue = useCallback7(
|
|
5162
6133
|
(token, sourceAmount, inputAmountUsd) => {
|
|
5163
6134
|
const targetSym = getTargetTokenSymbol(targetToken, targetChain);
|
|
5164
6135
|
const isTargetStable = isStablecoinSymbol(targetSym);
|
|
@@ -5180,7 +6151,7 @@ function DepositFlow({
|
|
|
5180
6151
|
},
|
|
5181
6152
|
[targetToken, targetChain, getTokenPriceUsd, logFlow, storeApi]
|
|
5182
6153
|
);
|
|
5183
|
-
const handleSolanaConfirmed =
|
|
6154
|
+
const handleSolanaConfirmed = useCallback7(
|
|
5184
6155
|
(txHash, amountUnits) => {
|
|
5185
6156
|
const tokenAtSubmit = storeApi.getState().deposit.selectedSolanaToken;
|
|
5186
6157
|
if (!tokenAtSubmit) return;
|
|
@@ -5207,7 +6178,7 @@ function DepositFlow({
|
|
|
5207
6178
|
},
|
|
5208
6179
|
[logFlow, onLifecycleRef, storeApi]
|
|
5209
6180
|
);
|
|
5210
|
-
const handleAssetContinue =
|
|
6181
|
+
const handleAssetContinue = useCallback7(
|
|
5211
6182
|
(asset) => {
|
|
5212
6183
|
onEventRef.current?.({
|
|
5213
6184
|
type: "deposit_modal_connected_wallet_select_source_cta_click",
|
|
@@ -5225,7 +6196,7 @@ function DepositFlow({
|
|
|
5225
6196
|
},
|
|
5226
6197
|
[defaultAmount, onEventRef, totalBalanceUsd, storeApi]
|
|
5227
6198
|
);
|
|
5228
|
-
const handleAmountContinue =
|
|
6199
|
+
const handleAmountContinue = useCallback7(
|
|
5229
6200
|
(amount, targetAmount, balance, liquidityWarning) => {
|
|
5230
6201
|
const entry = readSetupForOwner(
|
|
5231
6202
|
storeApi.getState().setup,
|
|
@@ -5246,7 +6217,7 @@ function DepositFlow({
|
|
|
5246
6217
|
},
|
|
5247
6218
|
[targetToken, targetChain, getTokenPriceUsd, storeApi, activeOwner]
|
|
5248
6219
|
);
|
|
5249
|
-
const handleDepositSubmitted =
|
|
6220
|
+
const handleDepositSubmitted = useCallback7(
|
|
5250
6221
|
(txHash, chainId, amount, token) => {
|
|
5251
6222
|
logFlow("evm:submitted", {
|
|
5252
6223
|
txHash,
|
|
@@ -5269,7 +6240,32 @@ function DepositFlow({
|
|
|
5269
6240
|
},
|
|
5270
6241
|
[logFlow, storeApi, targetChain, targetToken]
|
|
5271
6242
|
);
|
|
5272
|
-
const
|
|
6243
|
+
const handleSwappedComplete = useCallback7(
|
|
6244
|
+
(info) => {
|
|
6245
|
+
logFlow("swapped:complete", {
|
|
6246
|
+
txHash: info.txHash,
|
|
6247
|
+
orderCrypto: info.orderCrypto
|
|
6248
|
+
});
|
|
6249
|
+
const amount = info.amount ?? "0";
|
|
6250
|
+
storeApi.dispatch({
|
|
6251
|
+
type: "deposit/submitted",
|
|
6252
|
+
txHash: info.txHash,
|
|
6253
|
+
sourceChain: SWAPPED_SOURCE_CHAIN,
|
|
6254
|
+
sourceToken: SWAPPED_SOURCE_TOKEN,
|
|
6255
|
+
amount,
|
|
6256
|
+
sourceSymbol: info.orderCrypto ?? "USDC",
|
|
6257
|
+
sourceDecimals: 6
|
|
6258
|
+
});
|
|
6259
|
+
onLifecycleRef.current?.({
|
|
6260
|
+
type: "submitted",
|
|
6261
|
+
txHash: info.txHash,
|
|
6262
|
+
sourceChain: SWAPPED_SOURCE_CHAIN,
|
|
6263
|
+
amount
|
|
6264
|
+
});
|
|
6265
|
+
},
|
|
6266
|
+
[logFlow, storeApi, onLifecycleRef]
|
|
6267
|
+
);
|
|
6268
|
+
const handleDepositSubmittedCallback = useCallback7(
|
|
5273
6269
|
(txHash, sourceChain, amount) => {
|
|
5274
6270
|
onLifecycleRef.current?.({
|
|
5275
6271
|
type: "submitted",
|
|
@@ -5280,7 +6276,7 @@ function DepositFlow({
|
|
|
5280
6276
|
},
|
|
5281
6277
|
[onLifecycleRef]
|
|
5282
6278
|
);
|
|
5283
|
-
const handleDepositComplete =
|
|
6279
|
+
const handleDepositComplete = useCallback7(
|
|
5284
6280
|
(txHash, destinationTxHash, context) => {
|
|
5285
6281
|
logFlow("deposit:complete", { txHash, destinationTxHash, ...context });
|
|
5286
6282
|
onLifecycleRef.current?.({
|
|
@@ -5292,28 +6288,28 @@ function DepositFlow({
|
|
|
5292
6288
|
},
|
|
5293
6289
|
[logFlow, onLifecycleRef]
|
|
5294
6290
|
);
|
|
5295
|
-
const handleDepositFailed =
|
|
6291
|
+
const handleDepositFailed = useCallback7(
|
|
5296
6292
|
(txHash, error) => {
|
|
5297
6293
|
logFlowError("deposit:failed", error, { txHash });
|
|
5298
6294
|
onLifecycleRef.current?.({ type: "failed", txHash, error });
|
|
5299
6295
|
},
|
|
5300
6296
|
[logFlowError, onLifecycleRef]
|
|
5301
6297
|
);
|
|
5302
|
-
const handleError =
|
|
6298
|
+
const handleError = useCallback7(
|
|
5303
6299
|
(message, code) => {
|
|
5304
6300
|
logFlowError("flow:error", message, { code });
|
|
5305
6301
|
onErrorRef.current?.({ message, code });
|
|
5306
6302
|
},
|
|
5307
6303
|
[logFlowError, onErrorRef]
|
|
5308
6304
|
);
|
|
5309
|
-
const handleTotalBalanceComputed =
|
|
6305
|
+
const handleTotalBalanceComputed = useCallback7((total) => {
|
|
5310
6306
|
setTotalBalanceUsd(total);
|
|
5311
6307
|
}, []);
|
|
5312
|
-
const walletOptionsKey =
|
|
6308
|
+
const walletOptionsKey = useMemo7(
|
|
5313
6309
|
() => walletOptions.map((option) => option.id).join(","),
|
|
5314
6310
|
[walletOptions]
|
|
5315
6311
|
);
|
|
5316
|
-
|
|
6312
|
+
useEffect10(() => {
|
|
5317
6313
|
if (storeApi.getState().flow.mode) {
|
|
5318
6314
|
return;
|
|
5319
6315
|
}
|
|
@@ -5323,12 +6319,12 @@ function DepositFlow({
|
|
|
5323
6319
|
storeApi.dispatch({ type: "flow/step-set", step: "connect" });
|
|
5324
6320
|
}
|
|
5325
6321
|
}, [walletOptionsKey]);
|
|
5326
|
-
|
|
6322
|
+
useEffect10(() => {
|
|
5327
6323
|
if (!showConnectStep && isConnectSelectionConfirmed && (flowMode === "wallet" || flowMode === "dapp-import") && !signerContext) {
|
|
5328
6324
|
storeApi.dispatch({ type: "wallet/cleared" });
|
|
5329
6325
|
}
|
|
5330
6326
|
}, [showConnectStep, isConnectSelectionConfirmed, flowMode, signerContext, storeApi]);
|
|
5331
|
-
|
|
6327
|
+
useEffect10(() => {
|
|
5332
6328
|
if (enableSolana || flowMode !== "solana-wallet") {
|
|
5333
6329
|
return;
|
|
5334
6330
|
}
|
|
@@ -5337,14 +6333,15 @@ function DepositFlow({
|
|
|
5337
6333
|
storeApi.dispatch({ type: "flow/step-set", step: "connect" });
|
|
5338
6334
|
}
|
|
5339
6335
|
}, [enableSolana, flowMode, storeApi]);
|
|
5340
|
-
|
|
5341
|
-
if (hasNavigatedBack || isConnectSelectionConfirmed || flowMode) {
|
|
6336
|
+
useEffect10(() => {
|
|
6337
|
+
if (hasNavigatedBack || isConnectSelectionConfirmed || flowMode || enableFiatOnramp || enableExchangeConnect) {
|
|
5342
6338
|
return;
|
|
5343
6339
|
}
|
|
5344
|
-
if (!hasWalletOptions && dappAddress && !hasReownSession && !dappWalletClient && hasQrAutoAdvanceGraceElapsed) {
|
|
6340
|
+
if (enableQrTransfer && !hasWalletOptions && dappAddress && !hasReownSession && !dappWalletClient && hasQrAutoAdvanceGraceElapsed) {
|
|
5345
6341
|
handleSelectTransferCrypto();
|
|
5346
6342
|
}
|
|
5347
6343
|
}, [
|
|
6344
|
+
enableQrTransfer,
|
|
5348
6345
|
hasWalletOptions,
|
|
5349
6346
|
hasReownSession,
|
|
5350
6347
|
hasQrAutoAdvanceGraceElapsed,
|
|
@@ -5355,7 +6352,7 @@ function DepositFlow({
|
|
|
5355
6352
|
dappWalletClient,
|
|
5356
6353
|
handleSelectTransferCrypto
|
|
5357
6354
|
]);
|
|
5358
|
-
const walletRows =
|
|
6355
|
+
const walletRows = useMemo7(() => {
|
|
5359
6356
|
return walletOptions.map((option) => {
|
|
5360
6357
|
const ownerForRow = option.kind === "solana" ? dappAddress : option.address ?? null;
|
|
5361
6358
|
const entry = readSetupForOwner(setupSlice, ownerForRow ?? null);
|
|
@@ -5371,25 +6368,25 @@ function DepositFlow({
|
|
|
5371
6368
|
};
|
|
5372
6369
|
});
|
|
5373
6370
|
}, [walletOptions, setupSlice, dappAddress]);
|
|
5374
|
-
const transferCryptoEntry =
|
|
6371
|
+
const transferCryptoEntry = useMemo7(
|
|
5375
6372
|
() => readSetupForOwner(setupSlice, dappAddress),
|
|
5376
6373
|
[setupSlice, dappAddress]
|
|
5377
6374
|
);
|
|
5378
6375
|
const transferCryptoState = transferCryptoEntry.status === "ready" ? "ready" : transferCryptoEntry.status === "error" ? "error" : "loading";
|
|
5379
|
-
const handleRetrySetup =
|
|
6376
|
+
const handleRetrySetup = useCallback7(
|
|
5380
6377
|
(owner) => {
|
|
5381
6378
|
storeApi.dispatch({ type: "setup/retry-requested", owner });
|
|
5382
6379
|
},
|
|
5383
6380
|
[storeApi]
|
|
5384
6381
|
);
|
|
5385
6382
|
if (showConnectStep) {
|
|
5386
|
-
return /* @__PURE__ */
|
|
6383
|
+
return /* @__PURE__ */ jsx17("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx17(
|
|
5387
6384
|
ConnectStep,
|
|
5388
6385
|
{
|
|
5389
6386
|
walletRows,
|
|
5390
6387
|
transferCryptoState: dappAddress ? transferCryptoState : void 0,
|
|
5391
6388
|
transferCryptoErrorReason: dappAddress ? transferCryptoEntry.message ?? void 0 : void 0,
|
|
5392
|
-
onSelectTransferCrypto: dappAddress ? () => {
|
|
6389
|
+
onSelectTransferCrypto: enableQrTransfer && dappAddress ? () => {
|
|
5393
6390
|
if (transferCryptoState === "error") {
|
|
5394
6391
|
handleRetrySetup(dappAddress);
|
|
5395
6392
|
return;
|
|
@@ -5397,6 +6394,10 @@ function DepositFlow({
|
|
|
5397
6394
|
if (transferCryptoState !== "ready") return;
|
|
5398
6395
|
handleSelectTransferCrypto();
|
|
5399
6396
|
} : void 0,
|
|
6397
|
+
onSelectPayWithCard: enableFiatOnramp && dappAddress && (!fiatOnrampMethods || fiatOnrampMethods.length === 0) ? () => handleSelectFiatMethod() : void 0,
|
|
6398
|
+
fiatPaymentMethods: enableFiatOnramp && dappAddress ? fiatOnrampMethods : void 0,
|
|
6399
|
+
onSelectFiatMethod: enableFiatOnramp && dappAddress ? (method) => handleSelectFiatMethod(method) : void 0,
|
|
6400
|
+
onSelectFundFromExchange: enableExchangeConnect && dappAddress ? () => handleSelectExchange() : void 0,
|
|
5400
6401
|
onRequestConnect,
|
|
5401
6402
|
onConnect,
|
|
5402
6403
|
onDisconnect,
|
|
@@ -5430,15 +6431,21 @@ function DepositFlow({
|
|
|
5430
6431
|
}
|
|
5431
6432
|
if (isDepositAddressMode) {
|
|
5432
6433
|
if (!dappAddress) return null;
|
|
5433
|
-
return /* @__PURE__ */
|
|
5434
|
-
effectiveStep.type === "setup" && /* @__PURE__ */
|
|
6434
|
+
return /* @__PURE__ */ jsxs15("div", { className: "rs-modal-body", children: [
|
|
6435
|
+
effectiveStep.type === "setup" && (activeEntry.status === "error" ? /* @__PURE__ */ jsx17(
|
|
5435
6436
|
AccountPreparingSkeleton,
|
|
5436
6437
|
{
|
|
5437
|
-
errorMessage: activeEntry.
|
|
5438
|
-
onRetry:
|
|
6438
|
+
errorMessage: activeEntry.message ?? void 0,
|
|
6439
|
+
onRetry: () => handleRetrySetup(dappAddress)
|
|
5439
6440
|
}
|
|
5440
|
-
)
|
|
5441
|
-
|
|
6441
|
+
) : /* @__PURE__ */ jsx17(
|
|
6442
|
+
DepositAddressSkeleton,
|
|
6443
|
+
{
|
|
6444
|
+
uiConfig,
|
|
6445
|
+
allowedRoutes
|
|
6446
|
+
}
|
|
6447
|
+
)),
|
|
6448
|
+
effectiveStep.type === "deposit-address" && /* @__PURE__ */ jsx17(
|
|
5442
6449
|
DepositAddressStep,
|
|
5443
6450
|
{
|
|
5444
6451
|
smartAccount: effectiveStep.smartAccount,
|
|
@@ -5470,19 +6477,141 @@ function DepositFlow({
|
|
|
5470
6477
|
)
|
|
5471
6478
|
] });
|
|
5472
6479
|
}
|
|
6480
|
+
if (isFiatOnrampMode) {
|
|
6481
|
+
if (!dappAddress) return null;
|
|
6482
|
+
return /* @__PURE__ */ jsxs15(
|
|
6483
|
+
"div",
|
|
6484
|
+
{
|
|
6485
|
+
className: "rs-modal-body",
|
|
6486
|
+
"data-flow-mode": "fiat-onramp",
|
|
6487
|
+
"data-step-type": step.type,
|
|
6488
|
+
children: [
|
|
6489
|
+
step.type === "setup" && /* @__PURE__ */ jsx17(
|
|
6490
|
+
AccountPreparingSkeleton,
|
|
6491
|
+
{
|
|
6492
|
+
errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
|
|
6493
|
+
onRetry: activeEntry.status === "error" ? () => handleRetrySetup(dappAddress) : void 0
|
|
6494
|
+
}
|
|
6495
|
+
),
|
|
6496
|
+
step.type === "fiat-onramp" && /* @__PURE__ */ jsx17(
|
|
6497
|
+
FiatOnrampStep,
|
|
6498
|
+
{
|
|
6499
|
+
smartAccount: step.smartAccount,
|
|
6500
|
+
service,
|
|
6501
|
+
paymentMethod: step.paymentMethod,
|
|
6502
|
+
onSwappedComplete: handleSwappedComplete,
|
|
6503
|
+
onSwappedFailed: handleDepositFailed,
|
|
6504
|
+
onClose: onClose ?? (() => {
|
|
6505
|
+
}),
|
|
6506
|
+
onError: handleError
|
|
6507
|
+
}
|
|
6508
|
+
),
|
|
6509
|
+
step.type === "processing" && /* @__PURE__ */ jsx17(
|
|
6510
|
+
ProcessingStep,
|
|
6511
|
+
{
|
|
6512
|
+
smartAccount: step.smartAccount,
|
|
6513
|
+
solanaDepositAddress: step.solanaDepositAddress,
|
|
6514
|
+
txHash: step.txHash,
|
|
6515
|
+
sourceChain: step.sourceChain,
|
|
6516
|
+
sourceToken: step.sourceToken,
|
|
6517
|
+
targetChain,
|
|
6518
|
+
targetToken,
|
|
6519
|
+
amount: step.amount,
|
|
6520
|
+
sourceSymbol: step.sourceSymbol,
|
|
6521
|
+
sourceDecimals: step.sourceDecimals,
|
|
6522
|
+
hasPostBridgeActions: Boolean(postBridgeActions?.length),
|
|
6523
|
+
service,
|
|
6524
|
+
directTransfer: step.directTransfer,
|
|
6525
|
+
onClose,
|
|
6526
|
+
onNewDeposit: handleNewDeposit,
|
|
6527
|
+
onDepositComplete: handleDepositComplete,
|
|
6528
|
+
onDepositFailed: handleDepositFailed,
|
|
6529
|
+
onError: handleError,
|
|
6530
|
+
debug
|
|
6531
|
+
}
|
|
6532
|
+
)
|
|
6533
|
+
]
|
|
6534
|
+
}
|
|
6535
|
+
);
|
|
6536
|
+
}
|
|
6537
|
+
if (isExchangeConnectMode) {
|
|
6538
|
+
if (!dappAddress) return null;
|
|
6539
|
+
return /* @__PURE__ */ jsxs15(
|
|
6540
|
+
"div",
|
|
6541
|
+
{
|
|
6542
|
+
className: "rs-modal-body",
|
|
6543
|
+
"data-flow-mode": "exchange-connect",
|
|
6544
|
+
"data-step-type": step.type,
|
|
6545
|
+
children: [
|
|
6546
|
+
step.type === "setup" && /* @__PURE__ */ jsx17(
|
|
6547
|
+
AccountPreparingSkeleton,
|
|
6548
|
+
{
|
|
6549
|
+
errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
|
|
6550
|
+
onRetry: activeEntry.status === "error" ? () => handleRetrySetup(dappAddress) : void 0
|
|
6551
|
+
}
|
|
6552
|
+
),
|
|
6553
|
+
step.type === "exchange-select" && /* @__PURE__ */ jsx17(
|
|
6554
|
+
ExchangeSelectStep,
|
|
6555
|
+
{
|
|
6556
|
+
service,
|
|
6557
|
+
onSelectExchange: handleSelectExchangeConnection,
|
|
6558
|
+
onError: handleError
|
|
6559
|
+
}
|
|
6560
|
+
),
|
|
6561
|
+
step.type === "exchange-connect" && /* @__PURE__ */ jsx17(
|
|
6562
|
+
ExchangeConnectStep,
|
|
6563
|
+
{
|
|
6564
|
+
smartAccount: step.smartAccount,
|
|
6565
|
+
service,
|
|
6566
|
+
connection: step.connection,
|
|
6567
|
+
onSwappedComplete: handleSwappedComplete,
|
|
6568
|
+
onSwappedFailed: handleDepositFailed,
|
|
6569
|
+
onClose: onClose ?? (() => {
|
|
6570
|
+
}),
|
|
6571
|
+
onError: handleError
|
|
6572
|
+
}
|
|
6573
|
+
),
|
|
6574
|
+
step.type === "processing" && /* @__PURE__ */ jsx17(
|
|
6575
|
+
ProcessingStep,
|
|
6576
|
+
{
|
|
6577
|
+
smartAccount: step.smartAccount,
|
|
6578
|
+
solanaDepositAddress: step.solanaDepositAddress,
|
|
6579
|
+
txHash: step.txHash,
|
|
6580
|
+
sourceChain: step.sourceChain,
|
|
6581
|
+
sourceToken: step.sourceToken,
|
|
6582
|
+
targetChain,
|
|
6583
|
+
targetToken,
|
|
6584
|
+
amount: step.amount,
|
|
6585
|
+
sourceSymbol: step.sourceSymbol,
|
|
6586
|
+
sourceDecimals: step.sourceDecimals,
|
|
6587
|
+
hasPostBridgeActions: Boolean(postBridgeActions?.length),
|
|
6588
|
+
service,
|
|
6589
|
+
directTransfer: step.directTransfer,
|
|
6590
|
+
onClose,
|
|
6591
|
+
onNewDeposit: handleNewDeposit,
|
|
6592
|
+
onDepositComplete: handleDepositComplete,
|
|
6593
|
+
onDepositFailed: handleDepositFailed,
|
|
6594
|
+
onError: handleError,
|
|
6595
|
+
debug
|
|
6596
|
+
}
|
|
6597
|
+
)
|
|
6598
|
+
]
|
|
6599
|
+
}
|
|
6600
|
+
);
|
|
6601
|
+
}
|
|
5473
6602
|
if (isSolanaWalletMode) {
|
|
5474
6603
|
if (!dappAddress) return null;
|
|
5475
6604
|
const solanaAddr = reownWallet?.solanaAddress;
|
|
5476
6605
|
const solanaProvider = reownWallet?.solanaProvider;
|
|
5477
|
-
return /* @__PURE__ */
|
|
5478
|
-
effectiveStep.type === "setup" && /* @__PURE__ */
|
|
6606
|
+
return /* @__PURE__ */ jsxs15("div", { className: "rs-modal-body", children: [
|
|
6607
|
+
effectiveStep.type === "setup" && /* @__PURE__ */ jsx17(
|
|
5479
6608
|
AccountPreparingSkeleton,
|
|
5480
6609
|
{
|
|
5481
6610
|
errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
|
|
5482
6611
|
onRetry: activeEntry.status === "error" ? () => handleRetrySetup(dappAddress) : void 0
|
|
5483
6612
|
}
|
|
5484
6613
|
),
|
|
5485
|
-
effectiveStep.type === "solana-token-select" && solanaAddr && /* @__PURE__ */
|
|
6614
|
+
effectiveStep.type === "solana-token-select" && solanaAddr && /* @__PURE__ */ jsx17(
|
|
5486
6615
|
SolanaTokenSelectStep,
|
|
5487
6616
|
{
|
|
5488
6617
|
solanaAddress: solanaAddr,
|
|
@@ -5496,7 +6625,7 @@ function DepositFlow({
|
|
|
5496
6625
|
debug
|
|
5497
6626
|
}
|
|
5498
6627
|
),
|
|
5499
|
-
effectiveStep.type === "solana-amount" && /* @__PURE__ */
|
|
6628
|
+
effectiveStep.type === "solana-amount" && /* @__PURE__ */ jsx17(
|
|
5500
6629
|
SolanaAmountStep,
|
|
5501
6630
|
{
|
|
5502
6631
|
token: effectiveStep.token,
|
|
@@ -5514,7 +6643,7 @@ function DepositFlow({
|
|
|
5514
6643
|
debug
|
|
5515
6644
|
}
|
|
5516
6645
|
),
|
|
5517
|
-
effectiveStep.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */
|
|
6646
|
+
effectiveStep.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */ jsx17(
|
|
5518
6647
|
SolanaConfirmStep,
|
|
5519
6648
|
{
|
|
5520
6649
|
smartAccount: effectiveStep.smartAccount,
|
|
@@ -5535,16 +6664,16 @@ function DepositFlow({
|
|
|
5535
6664
|
onError: handleError,
|
|
5536
6665
|
debug
|
|
5537
6666
|
}
|
|
5538
|
-
) : effectiveStep.type === "solana-confirm" ? /* @__PURE__ */
|
|
5539
|
-
/* @__PURE__ */
|
|
5540
|
-
/* @__PURE__ */
|
|
6667
|
+
) : effectiveStep.type === "solana-confirm" ? /* @__PURE__ */ jsxs15("div", { className: "rs-step", children: [
|
|
6668
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-loading-state", children: [
|
|
6669
|
+
/* @__PURE__ */ jsx17("div", { className: "rs-step-icon rs-step-icon--error", children: /* @__PURE__ */ jsx17(
|
|
5541
6670
|
"svg",
|
|
5542
6671
|
{
|
|
5543
6672
|
viewBox: "0 0 24 24",
|
|
5544
6673
|
fill: "none",
|
|
5545
6674
|
stroke: "currentColor",
|
|
5546
6675
|
strokeWidth: "2",
|
|
5547
|
-
children: /* @__PURE__ */
|
|
6676
|
+
children: /* @__PURE__ */ jsx17(
|
|
5548
6677
|
"path",
|
|
5549
6678
|
{
|
|
5550
6679
|
strokeLinecap: "round",
|
|
@@ -5554,22 +6683,22 @@ function DepositFlow({
|
|
|
5554
6683
|
)
|
|
5555
6684
|
}
|
|
5556
6685
|
) }),
|
|
5557
|
-
/* @__PURE__ */
|
|
5558
|
-
/* @__PURE__ */
|
|
5559
|
-
/* @__PURE__ */
|
|
6686
|
+
/* @__PURE__ */ jsxs15("div", { className: "rs-loading-text", children: [
|
|
6687
|
+
/* @__PURE__ */ jsx17("div", { className: "rs-loading-title rs-text-error", children: "Wallet disconnected" }),
|
|
6688
|
+
/* @__PURE__ */ jsx17("div", { className: "rs-loading-subtitle", children: "Please reconnect your Solana wallet to continue." })
|
|
5560
6689
|
] })
|
|
5561
6690
|
] }),
|
|
5562
|
-
/* @__PURE__ */
|
|
6691
|
+
/* @__PURE__ */ jsx17("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx17(
|
|
5563
6692
|
"button",
|
|
5564
6693
|
{
|
|
5565
6694
|
type: "button",
|
|
5566
6695
|
className: "rs-button rs-button--default rs-button--full-width",
|
|
5567
6696
|
onClick: handleBack,
|
|
5568
|
-
children: /* @__PURE__ */
|
|
6697
|
+
children: /* @__PURE__ */ jsx17("span", { children: "Go Back" })
|
|
5569
6698
|
}
|
|
5570
6699
|
) })
|
|
5571
6700
|
] }) : null,
|
|
5572
|
-
effectiveStep.type === "processing" && /* @__PURE__ */
|
|
6701
|
+
effectiveStep.type === "processing" && /* @__PURE__ */ jsx17(
|
|
5573
6702
|
ProcessingStep,
|
|
5574
6703
|
{
|
|
5575
6704
|
smartAccount: effectiveStep.smartAccount,
|
|
@@ -5596,7 +6725,7 @@ function DepositFlow({
|
|
|
5596
6725
|
] });
|
|
5597
6726
|
}
|
|
5598
6727
|
if (!signerContext?.walletClient || !signerContext?.publicClient) {
|
|
5599
|
-
return /* @__PURE__ */
|
|
6728
|
+
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" }) }) }) }) });
|
|
5600
6729
|
}
|
|
5601
6730
|
const ownerAddress = signerContext.ownerAddress;
|
|
5602
6731
|
const ownerChainId = signerContext.walletClient?.chain?.id ?? signerContext.publicClient.chain?.id ?? setupChainId;
|
|
@@ -5606,15 +6735,15 @@ function DepositFlow({
|
|
|
5606
6735
|
}
|
|
5607
6736
|
return getPublicClient(chainId);
|
|
5608
6737
|
};
|
|
5609
|
-
return /* @__PURE__ */
|
|
5610
|
-
effectiveStep.type === "setup" && /* @__PURE__ */
|
|
6738
|
+
return /* @__PURE__ */ jsxs15("div", { className: "rs-modal-body", children: [
|
|
6739
|
+
effectiveStep.type === "setup" && /* @__PURE__ */ jsx17(
|
|
5611
6740
|
AccountPreparingSkeleton,
|
|
5612
6741
|
{
|
|
5613
6742
|
errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
|
|
5614
6743
|
onRetry: activeEntry.status === "error" ? () => handleRetrySetup(ownerAddress) : void 0
|
|
5615
6744
|
}
|
|
5616
6745
|
),
|
|
5617
|
-
effectiveStep.type === "select-asset" && /* @__PURE__ */
|
|
6746
|
+
effectiveStep.type === "select-asset" && /* @__PURE__ */ jsx17(
|
|
5618
6747
|
AssetSelectStep,
|
|
5619
6748
|
{
|
|
5620
6749
|
address: ownerAddress,
|
|
@@ -5632,7 +6761,7 @@ function DepositFlow({
|
|
|
5632
6761
|
} : void 0
|
|
5633
6762
|
}
|
|
5634
6763
|
),
|
|
5635
|
-
effectiveStep.type === "dapp-import-asset-select" && activeDappImportProvider && activeDappImportAvailability && /* @__PURE__ */
|
|
6764
|
+
effectiveStep.type === "dapp-import-asset-select" && activeDappImportProvider && activeDappImportAvailability && /* @__PURE__ */ jsx17(
|
|
5636
6765
|
DappImportAssetSelectStep,
|
|
5637
6766
|
{
|
|
5638
6767
|
sourceLabel: activeDappImportAvailability.assets[0]?.sourceLabel ?? activeDappImportProvider.label,
|
|
@@ -5640,7 +6769,7 @@ function DepositFlow({
|
|
|
5640
6769
|
onSelect: handleDappImportAssetSelected
|
|
5641
6770
|
}
|
|
5642
6771
|
),
|
|
5643
|
-
effectiveStep.type === "amount" && /* @__PURE__ */
|
|
6772
|
+
effectiveStep.type === "amount" && /* @__PURE__ */ jsx17(
|
|
5644
6773
|
AmountStep,
|
|
5645
6774
|
{
|
|
5646
6775
|
walletClient: signerContext.walletClient,
|
|
@@ -5652,7 +6781,7 @@ function DepositFlow({
|
|
|
5652
6781
|
chainId: effectiveStep.asset.depositChainId,
|
|
5653
6782
|
token: effectiveStep.asset.depositToken
|
|
5654
6783
|
} : void 0,
|
|
5655
|
-
defaultAmount: effectiveStep.
|
|
6784
|
+
defaultAmount: effectiveStep.inputAmountUsd ?? defaultAmount,
|
|
5656
6785
|
switchChain: signerContext.switchChain,
|
|
5657
6786
|
targetChain,
|
|
5658
6787
|
targetToken,
|
|
@@ -5672,7 +6801,7 @@ function DepositFlow({
|
|
|
5672
6801
|
}
|
|
5673
6802
|
}
|
|
5674
6803
|
),
|
|
5675
|
-
effectiveStep.type === "confirm" && /* @__PURE__ */
|
|
6804
|
+
effectiveStep.type === "confirm" && /* @__PURE__ */ jsx17(
|
|
5676
6805
|
ConfirmStep,
|
|
5677
6806
|
{
|
|
5678
6807
|
walletClient: signerContext.walletClient,
|
|
@@ -5712,7 +6841,7 @@ function DepositFlow({
|
|
|
5712
6841
|
onError: handleError
|
|
5713
6842
|
}
|
|
5714
6843
|
),
|
|
5715
|
-
effectiveStep.type === "processing" && /* @__PURE__ */
|
|
6844
|
+
effectiveStep.type === "processing" && /* @__PURE__ */ jsx17(
|
|
5716
6845
|
ProcessingStep,
|
|
5717
6846
|
{
|
|
5718
6847
|
smartAccount: effectiveStep.smartAccount,
|
|
@@ -5742,8 +6871,8 @@ function DepositFlow({
|
|
|
5742
6871
|
}
|
|
5743
6872
|
|
|
5744
6873
|
// src/components/history/DepositHistoryPanel.tsx
|
|
5745
|
-
import { useCallback as
|
|
5746
|
-
import { jsx as
|
|
6874
|
+
import { useCallback as useCallback8, useMemo as useMemo8, useState as useState12 } from "react";
|
|
6875
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5747
6876
|
function shortenHash(hash) {
|
|
5748
6877
|
if (hash.length <= 14) return hash;
|
|
5749
6878
|
return `${hash.slice(0, 6)}\u2026${hash.slice(-4)}`;
|
|
@@ -5853,7 +6982,7 @@ function DepositHistoryPanel({
|
|
|
5853
6982
|
onClose,
|
|
5854
6983
|
onCloseModal
|
|
5855
6984
|
}) {
|
|
5856
|
-
const handleKeyDown =
|
|
6985
|
+
const handleKeyDown = useCallback8(
|
|
5857
6986
|
(e) => {
|
|
5858
6987
|
if (e.key === "Escape") {
|
|
5859
6988
|
e.stopPropagation();
|
|
@@ -5862,7 +6991,7 @@ function DepositHistoryPanel({
|
|
|
5862
6991
|
},
|
|
5863
6992
|
[onClose]
|
|
5864
6993
|
);
|
|
5865
|
-
const visibleDeposits =
|
|
6994
|
+
const visibleDeposits = useMemo8(() => {
|
|
5866
6995
|
const sourceHashes = new Set(
|
|
5867
6996
|
deposits.map((d) => d.sourceTxHash?.toLowerCase()).filter((h) => Boolean(h))
|
|
5868
6997
|
);
|
|
@@ -5870,7 +6999,7 @@ function DepositHistoryPanel({
|
|
|
5870
6999
|
(d) => !(d.txHash && sourceHashes.has(d.txHash.toLowerCase()))
|
|
5871
7000
|
);
|
|
5872
7001
|
}, [deposits]);
|
|
5873
|
-
return /* @__PURE__ */
|
|
7002
|
+
return /* @__PURE__ */ jsxs16(
|
|
5874
7003
|
"div",
|
|
5875
7004
|
{
|
|
5876
7005
|
className: "rs-history-panel",
|
|
@@ -5878,55 +7007,55 @@ function DepositHistoryPanel({
|
|
|
5878
7007
|
"aria-label": "Deposit history",
|
|
5879
7008
|
onKeyDown: handleKeyDown,
|
|
5880
7009
|
children: [
|
|
5881
|
-
/* @__PURE__ */
|
|
5882
|
-
/* @__PURE__ */
|
|
7010
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-modal-header--redesigned", children: [
|
|
7011
|
+
/* @__PURE__ */ jsx18("div", { className: "rs-modal-header-nav-left", children: /* @__PURE__ */ jsx18(
|
|
5883
7012
|
"button",
|
|
5884
7013
|
{
|
|
5885
7014
|
type: "button",
|
|
5886
7015
|
className: "rs-modal-header-back",
|
|
5887
7016
|
"aria-label": "Back",
|
|
5888
7017
|
onClick: onClose,
|
|
5889
|
-
children: /* @__PURE__ */
|
|
7018
|
+
children: /* @__PURE__ */ jsx18(ChevronLeftIcon, {})
|
|
5890
7019
|
}
|
|
5891
7020
|
) }),
|
|
5892
|
-
/* @__PURE__ */
|
|
7021
|
+
/* @__PURE__ */ jsx18("div", { className: "rs-modal-header-nav-right", children: onCloseModal && /* @__PURE__ */ jsx18(
|
|
5893
7022
|
"button",
|
|
5894
7023
|
{
|
|
5895
7024
|
type: "button",
|
|
5896
7025
|
className: "rs-modal-close",
|
|
5897
7026
|
"aria-label": "Close",
|
|
5898
7027
|
onClick: onCloseModal,
|
|
5899
|
-
children: /* @__PURE__ */
|
|
7028
|
+
children: /* @__PURE__ */ jsx18(CloseIcon, {})
|
|
5900
7029
|
}
|
|
5901
7030
|
) })
|
|
5902
7031
|
] }),
|
|
5903
|
-
/* @__PURE__ */
|
|
5904
|
-
/* @__PURE__ */
|
|
5905
|
-
/* @__PURE__ */
|
|
5906
|
-
isLoading && deposits.length === 0 && /* @__PURE__ */
|
|
5907
|
-
/* @__PURE__ */
|
|
5908
|
-
/* @__PURE__ */
|
|
5909
|
-
/* @__PURE__ */
|
|
5910
|
-
/* @__PURE__ */
|
|
7032
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-history-screen", children: [
|
|
7033
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-history-screen-body", children: [
|
|
7034
|
+
/* @__PURE__ */ jsx18(BodyHeader, { icon: /* @__PURE__ */ jsx18(HistoryIcon, {}), title: "History" }),
|
|
7035
|
+
isLoading && deposits.length === 0 && /* @__PURE__ */ jsxs16("div", { className: "rs-history-empty", children: [
|
|
7036
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(HistoryIcon, {}) }),
|
|
7037
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-history-empty-text", children: [
|
|
7038
|
+
/* @__PURE__ */ jsx18(Spinner, { className: "rs-spinner--sm" }),
|
|
7039
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-empty-hint", children: "Loading history\u2026" })
|
|
5911
7040
|
] })
|
|
5912
7041
|
] }),
|
|
5913
|
-
error && !isLoading && /* @__PURE__ */
|
|
5914
|
-
/* @__PURE__ */
|
|
5915
|
-
/* @__PURE__ */
|
|
5916
|
-
/* @__PURE__ */
|
|
5917
|
-
/* @__PURE__ */
|
|
7042
|
+
error && !isLoading && /* @__PURE__ */ jsxs16("div", { className: "rs-history-empty", children: [
|
|
7043
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(AlertTriangleIcon, {}) }),
|
|
7044
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-history-empty-text", children: [
|
|
7045
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-empty-title", children: "Couldn't load history" }),
|
|
7046
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-empty-hint", children: error })
|
|
5918
7047
|
] })
|
|
5919
7048
|
] }),
|
|
5920
|
-
!isLoading && !error && visibleDeposits.length === 0 && /* @__PURE__ */
|
|
5921
|
-
/* @__PURE__ */
|
|
5922
|
-
/* @__PURE__ */
|
|
5923
|
-
/* @__PURE__ */
|
|
5924
|
-
/* @__PURE__ */
|
|
7049
|
+
!isLoading && !error && visibleDeposits.length === 0 && /* @__PURE__ */ jsxs16("div", { className: "rs-history-empty", children: [
|
|
7050
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(HistoryIcon, {}) }),
|
|
7051
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-history-empty-text", children: [
|
|
7052
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-empty-title", children: "No deposits yet" }),
|
|
7053
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-empty-hint", children: "Your deposit history will appear here" })
|
|
5925
7054
|
] })
|
|
5926
7055
|
] }),
|
|
5927
|
-
visibleDeposits.length > 0 && /* @__PURE__ */
|
|
5928
|
-
visibleDeposits.map((deposit, i) => /* @__PURE__ */
|
|
5929
|
-
hasMore && /* @__PURE__ */
|
|
7056
|
+
visibleDeposits.length > 0 && /* @__PURE__ */ jsxs16("div", { className: "rs-history-list", children: [
|
|
7057
|
+
visibleDeposits.map((deposit, i) => /* @__PURE__ */ jsx18(HistoryCard, { deposit }, deposit.txHash || i)),
|
|
7058
|
+
hasMore && /* @__PURE__ */ jsx18(
|
|
5930
7059
|
"button",
|
|
5931
7060
|
{
|
|
5932
7061
|
type: "button",
|
|
@@ -5938,14 +7067,14 @@ function DepositHistoryPanel({
|
|
|
5938
7067
|
)
|
|
5939
7068
|
] })
|
|
5940
7069
|
] }),
|
|
5941
|
-
/* @__PURE__ */
|
|
7070
|
+
/* @__PURE__ */ jsx18(PoweredBy, {})
|
|
5942
7071
|
] })
|
|
5943
7072
|
]
|
|
5944
7073
|
}
|
|
5945
7074
|
);
|
|
5946
7075
|
}
|
|
5947
7076
|
function HistoryCard({ deposit }) {
|
|
5948
|
-
const [expanded, setExpanded] =
|
|
7077
|
+
const [expanded, setExpanded] = useState12(false);
|
|
5949
7078
|
const status = normalizeStatus(deposit.status, deposit.isSpam);
|
|
5950
7079
|
const sourceChainId = resolveChainId(deposit.chain);
|
|
5951
7080
|
const targetChainId = resolveChainId(deposit.targetChain);
|
|
@@ -5964,7 +7093,7 @@ function HistoryCard({ deposit }) {
|
|
|
5964
7093
|
const date = deposit.createdAt ? formatDate(deposit.createdAt) : null;
|
|
5965
7094
|
const txTypeLabel = `Deposit${sourceSymbol ? ` ${sourceSymbol}` : ""}`;
|
|
5966
7095
|
const srcTxUrl = deposit.sourceTxHash ? getTxExplorerUrl(deposit.sourceTxHash, sourceChainId) : null;
|
|
5967
|
-
return /* @__PURE__ */
|
|
7096
|
+
return /* @__PURE__ */ jsxs16(
|
|
5968
7097
|
"button",
|
|
5969
7098
|
{
|
|
5970
7099
|
type: "button",
|
|
@@ -5972,38 +7101,38 @@ function HistoryCard({ deposit }) {
|
|
|
5972
7101
|
onClick: () => setExpanded((v) => !v),
|
|
5973
7102
|
"aria-expanded": expanded,
|
|
5974
7103
|
children: [
|
|
5975
|
-
/* @__PURE__ */
|
|
5976
|
-
/* @__PURE__ */
|
|
5977
|
-
/* @__PURE__ */
|
|
5978
|
-
sourceChainIcon && /* @__PURE__ */
|
|
7104
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-history-card-row", children: [
|
|
7105
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-history-card-icons", children: [
|
|
7106
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-card-token", children: sourceTokenIcon ? /* @__PURE__ */ jsx18("img", { src: sourceTokenIcon, alt: "" }) : sourceSymbol.slice(0, 2) }),
|
|
7107
|
+
sourceChainIcon && /* @__PURE__ */ jsx18("span", { className: "rs-history-card-chain", children: /* @__PURE__ */ jsx18("img", { src: sourceChainIcon, alt: "" }) })
|
|
5979
7108
|
] }),
|
|
5980
|
-
/* @__PURE__ */
|
|
5981
|
-
/* @__PURE__ */
|
|
5982
|
-
date && /* @__PURE__ */
|
|
7109
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-history-card-text", children: [
|
|
7110
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-card-title", children: txTypeLabel }),
|
|
7111
|
+
date && /* @__PURE__ */ jsx18("span", { className: "rs-history-card-date", children: date })
|
|
5983
7112
|
] }),
|
|
5984
|
-
/* @__PURE__ */
|
|
5985
|
-
/* @__PURE__ */
|
|
5986
|
-
/* @__PURE__ */
|
|
7113
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-history-card-side", children: [
|
|
7114
|
+
/* @__PURE__ */ jsx18("span", { className: "rs-history-card-amount", children: displayAmount }),
|
|
7115
|
+
/* @__PURE__ */ jsx18("span", { className: `rs-history-badge rs-history-badge--${status}`, children: STATUS_LABEL[status] })
|
|
5987
7116
|
] })
|
|
5988
7117
|
] }),
|
|
5989
|
-
|
|
5990
|
-
sourceChainName && /* @__PURE__ */
|
|
5991
|
-
/* @__PURE__ */
|
|
5992
|
-
/* @__PURE__ */
|
|
5993
|
-
/* @__PURE__ */
|
|
5994
|
-
sourceChainIcon && /* @__PURE__ */
|
|
7118
|
+
/* @__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: [
|
|
7119
|
+
sourceChainName && /* @__PURE__ */ jsxs16("div", { className: "rs-amount-detail-row", children: [
|
|
7120
|
+
/* @__PURE__ */ jsx18("span", { children: "Source chain" }),
|
|
7121
|
+
/* @__PURE__ */ jsxs16("span", { className: "rs-amount-detail-value", children: [
|
|
7122
|
+
/* @__PURE__ */ jsx18("span", { children: sourceChainName }),
|
|
7123
|
+
sourceChainIcon && /* @__PURE__ */ jsx18("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx18("img", { src: sourceChainIcon, alt: "" }) })
|
|
5995
7124
|
] })
|
|
5996
7125
|
] }),
|
|
5997
|
-
targetChainName && /* @__PURE__ */
|
|
5998
|
-
/* @__PURE__ */
|
|
5999
|
-
/* @__PURE__ */
|
|
6000
|
-
/* @__PURE__ */
|
|
6001
|
-
targetChainIcon && /* @__PURE__ */
|
|
7126
|
+
targetChainName && /* @__PURE__ */ jsxs16("div", { className: "rs-amount-detail-row", children: [
|
|
7127
|
+
/* @__PURE__ */ jsx18("span", { children: "Destination chain" }),
|
|
7128
|
+
/* @__PURE__ */ jsxs16("span", { className: "rs-amount-detail-value", children: [
|
|
7129
|
+
/* @__PURE__ */ jsx18("span", { children: targetChainName }),
|
|
7130
|
+
targetChainIcon && /* @__PURE__ */ jsx18("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx18("img", { src: targetChainIcon, alt: "" }) })
|
|
6002
7131
|
] })
|
|
6003
7132
|
] }),
|
|
6004
|
-
srcTxUrl && deposit.sourceTxHash && /* @__PURE__ */
|
|
6005
|
-
/* @__PURE__ */
|
|
6006
|
-
/* @__PURE__ */
|
|
7133
|
+
srcTxUrl && deposit.sourceTxHash && /* @__PURE__ */ jsxs16("div", { className: "rs-amount-detail-row", children: [
|
|
7134
|
+
/* @__PURE__ */ jsx18("span", { children: "Transaction details" }),
|
|
7135
|
+
/* @__PURE__ */ jsxs16(
|
|
6007
7136
|
"a",
|
|
6008
7137
|
{
|
|
6009
7138
|
href: srcTxUrl,
|
|
@@ -6012,13 +7141,13 @@ function HistoryCard({ deposit }) {
|
|
|
6012
7141
|
className: "rs-history-card-link",
|
|
6013
7142
|
onClick: (e) => e.stopPropagation(),
|
|
6014
7143
|
children: [
|
|
6015
|
-
/* @__PURE__ */
|
|
6016
|
-
/* @__PURE__ */
|
|
7144
|
+
/* @__PURE__ */ jsx18("span", { children: shortenHash(deposit.sourceTxHash) }),
|
|
7145
|
+
/* @__PURE__ */ jsx18(ArrowUpRightIcon, {})
|
|
6017
7146
|
]
|
|
6018
7147
|
}
|
|
6019
7148
|
)
|
|
6020
7149
|
] })
|
|
6021
|
-
] })
|
|
7150
|
+
] }) }) })
|
|
6022
7151
|
]
|
|
6023
7152
|
}
|
|
6024
7153
|
);
|
|
@@ -6026,9 +7155,9 @@ function HistoryCard({ deposit }) {
|
|
|
6026
7155
|
DepositHistoryPanel.displayName = "DepositHistoryPanel";
|
|
6027
7156
|
|
|
6028
7157
|
// src/DepositModal.tsx
|
|
6029
|
-
import { jsx as
|
|
7158
|
+
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6030
7159
|
var ReownDepositInner = lazy2(
|
|
6031
|
-
() => import("./DepositModalReown-
|
|
7160
|
+
() => import("./DepositModalReown-HBAWSK6K.mjs").then((m) => ({ default: m.DepositModalReown }))
|
|
6032
7161
|
);
|
|
6033
7162
|
function sortByCreatedAtDesc(items) {
|
|
6034
7163
|
return [...items].sort((a, b) => {
|
|
@@ -6044,7 +7173,7 @@ function DepositModal(props) {
|
|
|
6044
7173
|
"dappWalletClient"
|
|
6045
7174
|
);
|
|
6046
7175
|
if (needsReown) {
|
|
6047
|
-
return /* @__PURE__ */
|
|
7176
|
+
return /* @__PURE__ */ jsx19(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx19(
|
|
6048
7177
|
ReownDepositInner,
|
|
6049
7178
|
{
|
|
6050
7179
|
...props,
|
|
@@ -6052,7 +7181,7 @@ function DepositModal(props) {
|
|
|
6052
7181
|
}
|
|
6053
7182
|
) });
|
|
6054
7183
|
}
|
|
6055
|
-
return /* @__PURE__ */
|
|
7184
|
+
return /* @__PURE__ */ jsx19(
|
|
6056
7185
|
DepositModalInner,
|
|
6057
7186
|
{
|
|
6058
7187
|
...props,
|
|
@@ -6084,6 +7213,10 @@ function DepositModalInner({
|
|
|
6084
7213
|
forceRegister = false,
|
|
6085
7214
|
enableSolana = true,
|
|
6086
7215
|
dappImports,
|
|
7216
|
+
enableFiatOnramp = false,
|
|
7217
|
+
enableQrTransfer = true,
|
|
7218
|
+
fiatOnrampMethods,
|
|
7219
|
+
enableExchangeConnect = false,
|
|
6087
7220
|
postBridgeActions,
|
|
6088
7221
|
outputTokenRules,
|
|
6089
7222
|
rejectUnmapped,
|
|
@@ -6101,61 +7234,61 @@ function DepositModalInner({
|
|
|
6101
7234
|
onError,
|
|
6102
7235
|
debug
|
|
6103
7236
|
}) {
|
|
6104
|
-
const modalRef =
|
|
7237
|
+
const modalRef = useRef9(null);
|
|
6105
7238
|
const onReadyRef = useLatestRef(onReady);
|
|
6106
|
-
const [currentScreen, setCurrentScreen] =
|
|
6107
|
-
const [backHandler, setBackHandler] =
|
|
7239
|
+
const [currentScreen, setCurrentScreen] = useState13("connect");
|
|
7240
|
+
const [backHandler, setBackHandler] = useState13(
|
|
6108
7241
|
void 0
|
|
6109
7242
|
);
|
|
6110
7243
|
const showHistoryButton = uiConfig?.showHistoryButton ?? false;
|
|
6111
7244
|
const historyButtonVisible = showHistoryButton && (currentScreen === "select-asset" || currentScreen === "deposit-address");
|
|
6112
|
-
const [historyOpen, setHistoryOpen] =
|
|
6113
|
-
const [historyDeposits, setHistoryDeposits] =
|
|
6114
|
-
const [hasMoreHistory, setHasMoreHistory] =
|
|
6115
|
-
const [historyLoading, setHistoryLoading] =
|
|
6116
|
-
const [historyLoadingMore, setHistoryLoadingMore] =
|
|
6117
|
-
const [historyError, setHistoryError] =
|
|
6118
|
-
const cursorRef =
|
|
6119
|
-
const historyStaleRef =
|
|
6120
|
-
const historyLoadedRef =
|
|
7245
|
+
const [historyOpen, setHistoryOpen] = useState13(false);
|
|
7246
|
+
const [historyDeposits, setHistoryDeposits] = useState13([]);
|
|
7247
|
+
const [hasMoreHistory, setHasMoreHistory] = useState13(false);
|
|
7248
|
+
const [historyLoading, setHistoryLoading] = useState13(false);
|
|
7249
|
+
const [historyLoadingMore, setHistoryLoadingMore] = useState13(false);
|
|
7250
|
+
const [historyError, setHistoryError] = useState13(null);
|
|
7251
|
+
const cursorRef = useRef9(null);
|
|
7252
|
+
const historyStaleRef = useRef9(false);
|
|
7253
|
+
const historyLoadedRef = useRef9(false);
|
|
6121
7254
|
const targetChain = targetChainProp === "solana" ? "solana" : getChainId(targetChainProp);
|
|
6122
7255
|
const sourceChain = sourceChainProp ? getChainId(sourceChainProp) : void 0;
|
|
6123
|
-
const service =
|
|
7256
|
+
const service = useMemo9(
|
|
6124
7257
|
() => createDepositService(backendUrl, {
|
|
6125
7258
|
debug,
|
|
6126
7259
|
debugScope: "service:deposit"
|
|
6127
7260
|
}),
|
|
6128
7261
|
[backendUrl, debug]
|
|
6129
7262
|
);
|
|
6130
|
-
const store =
|
|
7263
|
+
const store = useMemo9(
|
|
6131
7264
|
() => createDepositStore({ targetChain, targetToken }),
|
|
6132
7265
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6133
7266
|
[]
|
|
6134
7267
|
);
|
|
6135
|
-
|
|
7268
|
+
useEffect11(() => {
|
|
6136
7269
|
store.dispatch({ type: "target/changed", targetChain, targetToken });
|
|
6137
7270
|
}, [store, targetChain, targetToken]);
|
|
6138
|
-
|
|
7271
|
+
useEffect11(() => {
|
|
6139
7272
|
if (isOpen && modalRef.current) {
|
|
6140
7273
|
applyTheme(modalRef.current, theme);
|
|
6141
7274
|
}
|
|
6142
7275
|
}, [isOpen, theme]);
|
|
6143
|
-
|
|
7276
|
+
useEffect11(() => {
|
|
6144
7277
|
configureSolanaRpcUrl(solanaRpcUrl);
|
|
6145
7278
|
}, [solanaRpcUrl]);
|
|
6146
|
-
|
|
7279
|
+
useEffect11(() => {
|
|
6147
7280
|
if (isOpen) {
|
|
6148
7281
|
onReadyRef.current?.();
|
|
6149
7282
|
}
|
|
6150
7283
|
}, [isOpen, onReadyRef]);
|
|
6151
|
-
const handleStepChange =
|
|
7284
|
+
const handleStepChange = useCallback9(
|
|
6152
7285
|
(onBack, screen) => {
|
|
6153
7286
|
setBackHandler(() => onBack);
|
|
6154
7287
|
if (screen) setCurrentScreen(screen);
|
|
6155
7288
|
},
|
|
6156
7289
|
[]
|
|
6157
7290
|
);
|
|
6158
|
-
const fetchHistory =
|
|
7291
|
+
const fetchHistory = useCallback9(
|
|
6159
7292
|
async (mode = "initial") => {
|
|
6160
7293
|
if (!recipient) return;
|
|
6161
7294
|
const isInitial = mode === "initial";
|
|
@@ -6203,26 +7336,26 @@ function DepositModalInner({
|
|
|
6203
7336
|
},
|
|
6204
7337
|
[recipient, service]
|
|
6205
7338
|
);
|
|
6206
|
-
const handleHistoryOpen =
|
|
7339
|
+
const handleHistoryOpen = useCallback9(() => {
|
|
6207
7340
|
setHistoryOpen(true);
|
|
6208
7341
|
if (!historyLoadedRef.current || historyStaleRef.current) {
|
|
6209
7342
|
fetchHistory("initial");
|
|
6210
7343
|
}
|
|
6211
7344
|
}, [fetchHistory]);
|
|
6212
|
-
const handleHistoryClose =
|
|
7345
|
+
const handleHistoryClose = useCallback9(() => {
|
|
6213
7346
|
setHistoryOpen(false);
|
|
6214
7347
|
}, []);
|
|
6215
|
-
const handleHistoryLoadMore =
|
|
7348
|
+
const handleHistoryLoadMore = useCallback9(() => {
|
|
6216
7349
|
fetchHistory("more");
|
|
6217
7350
|
}, [fetchHistory]);
|
|
6218
|
-
const markHistoryStale =
|
|
7351
|
+
const markHistoryStale = useCallback9(() => {
|
|
6219
7352
|
historyStaleRef.current = true;
|
|
6220
7353
|
if (historyOpen) {
|
|
6221
7354
|
fetchHistory("initial");
|
|
6222
7355
|
}
|
|
6223
7356
|
}, [historyOpen, fetchHistory]);
|
|
6224
7357
|
const onLifecycleRef = useLatestRef(onLifecycle);
|
|
6225
|
-
const handleLifecycle =
|
|
7358
|
+
const handleLifecycle = useCallback9(
|
|
6226
7359
|
(event) => {
|
|
6227
7360
|
onLifecycleRef.current?.(event);
|
|
6228
7361
|
if (event.type === "smart-account-changed" && !event.evm && !event.solana) {
|
|
@@ -6234,7 +7367,7 @@ function DepositModalInner({
|
|
|
6234
7367
|
},
|
|
6235
7368
|
[onLifecycleRef, showHistoryButton, markHistoryStale]
|
|
6236
7369
|
);
|
|
6237
|
-
|
|
7370
|
+
useEffect11(() => {
|
|
6238
7371
|
if (!isOpen) {
|
|
6239
7372
|
setHistoryOpen(false);
|
|
6240
7373
|
setHistoryDeposits([]);
|
|
@@ -6245,14 +7378,14 @@ function DepositModalInner({
|
|
|
6245
7378
|
historyLoadedRef.current = false;
|
|
6246
7379
|
}
|
|
6247
7380
|
}, [isOpen]);
|
|
6248
|
-
|
|
7381
|
+
useEffect11(() => {
|
|
6249
7382
|
if (!isOpen) {
|
|
6250
7383
|
store.dispatch({ type: "flow/reset" });
|
|
6251
7384
|
}
|
|
6252
7385
|
}, [isOpen, store]);
|
|
6253
7386
|
const showBackButton = uiConfig?.showBackButton ?? true;
|
|
6254
7387
|
const canGoBack = backHandler !== void 0;
|
|
6255
|
-
return /* @__PURE__ */
|
|
7388
|
+
return /* @__PURE__ */ jsx19(DepositStoreProvider, { store, children: /* @__PURE__ */ jsx19(
|
|
6256
7389
|
Modal,
|
|
6257
7390
|
{
|
|
6258
7391
|
isOpen,
|
|
@@ -6260,20 +7393,20 @@ function DepositModalInner({
|
|
|
6260
7393
|
className,
|
|
6261
7394
|
inline,
|
|
6262
7395
|
closeOnOverlayClick,
|
|
6263
|
-
children: /* @__PURE__ */
|
|
6264
|
-
/* @__PURE__ */
|
|
6265
|
-
/* @__PURE__ */
|
|
7396
|
+
children: /* @__PURE__ */ jsxs17("div", { ref: modalRef, className: "rs-modal", children: [
|
|
7397
|
+
/* @__PURE__ */ jsxs17("div", { className: "rs-modal-header--redesigned", children: [
|
|
7398
|
+
/* @__PURE__ */ jsx19("div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && backHandler && /* @__PURE__ */ jsx19(
|
|
6266
7399
|
"button",
|
|
6267
7400
|
{
|
|
6268
7401
|
type: "button",
|
|
6269
7402
|
className: "rs-modal-header-back",
|
|
6270
7403
|
"aria-label": "Go back",
|
|
6271
7404
|
onClick: backHandler,
|
|
6272
|
-
children: /* @__PURE__ */
|
|
7405
|
+
children: /* @__PURE__ */ jsx19(ChevronLeftIcon, {})
|
|
6273
7406
|
}
|
|
6274
7407
|
) }),
|
|
6275
|
-
/* @__PURE__ */
|
|
6276
|
-
historyButtonVisible && /* @__PURE__ */
|
|
7408
|
+
/* @__PURE__ */ jsxs17("div", { className: "rs-modal-header-nav-right", children: [
|
|
7409
|
+
historyButtonVisible && /* @__PURE__ */ jsx19(
|
|
6277
7410
|
"button",
|
|
6278
7411
|
{
|
|
6279
7412
|
type: "button",
|
|
@@ -6281,22 +7414,22 @@ function DepositModalInner({
|
|
|
6281
7414
|
"aria-label": "Deposit history",
|
|
6282
7415
|
onClick: handleHistoryOpen,
|
|
6283
7416
|
disabled: !recipient,
|
|
6284
|
-
children: /* @__PURE__ */
|
|
7417
|
+
children: /* @__PURE__ */ jsx19(HistoryIcon, {})
|
|
6285
7418
|
}
|
|
6286
7419
|
),
|
|
6287
|
-
/* @__PURE__ */
|
|
7420
|
+
/* @__PURE__ */ jsx19(
|
|
6288
7421
|
"button",
|
|
6289
7422
|
{
|
|
6290
7423
|
type: "button",
|
|
6291
7424
|
onClick: onClose,
|
|
6292
7425
|
className: "rs-modal-close",
|
|
6293
7426
|
"aria-label": "Close",
|
|
6294
|
-
children: /* @__PURE__ */
|
|
7427
|
+
children: /* @__PURE__ */ jsx19(CloseIcon, {})
|
|
6295
7428
|
}
|
|
6296
7429
|
)
|
|
6297
7430
|
] })
|
|
6298
7431
|
] }),
|
|
6299
|
-
/* @__PURE__ */
|
|
7432
|
+
/* @__PURE__ */ jsx19(
|
|
6300
7433
|
DepositFlow,
|
|
6301
7434
|
{
|
|
6302
7435
|
dappWalletClient,
|
|
@@ -6319,6 +7452,10 @@ function DepositModalInner({
|
|
|
6319
7452
|
forceRegister,
|
|
6320
7453
|
enableSolana,
|
|
6321
7454
|
dappImports,
|
|
7455
|
+
enableFiatOnramp,
|
|
7456
|
+
enableQrTransfer,
|
|
7457
|
+
fiatOnrampMethods,
|
|
7458
|
+
enableExchangeConnect,
|
|
6322
7459
|
reownWallet,
|
|
6323
7460
|
onConnect,
|
|
6324
7461
|
onDisconnect,
|
|
@@ -6333,7 +7470,7 @@ function DepositModalInner({
|
|
|
6333
7470
|
debug
|
|
6334
7471
|
}
|
|
6335
7472
|
),
|
|
6336
|
-
showHistoryButton && historyOpen && /* @__PURE__ */
|
|
7473
|
+
showHistoryButton && historyOpen && /* @__PURE__ */ jsx19(
|
|
6337
7474
|
DepositHistoryPanel,
|
|
6338
7475
|
{
|
|
6339
7476
|
deposits: historyDeposits,
|