@rhinestone/deposit-modal 0.3.0-alpha.12 → 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-EC4DJ3EC.cjs → DepositModalReown-CXPRZRXL.cjs} +6 -6
- package/dist/{DepositModalReown-QOTUF4JC.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-HR6BABPX.mjs → chunk-HZBO2SIZ.mjs} +1389 -393
- package/dist/{chunk-FGVSNARE.cjs → chunk-PWV2UJP3.cjs} +2 -2
- package/dist/{chunk-I5G5ULRP.cjs → chunk-SEOQ66FW.cjs} +1281 -285
- 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 +465 -1
- 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
|
|
@@ -1948,8 +1960,672 @@ function DepositAddressStep({
|
|
|
1948
1960
|
}
|
|
1949
1961
|
DepositAddressStep.displayName = "DepositAddressStep";
|
|
1950
1962
|
|
|
1951
|
-
// src/components/steps/
|
|
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
|
|
1952
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";
|
|
1953
2629
|
var BASE_CHAIN_ID = 8453;
|
|
1954
2630
|
function DepositAddressSkeleton({
|
|
1955
2631
|
uiConfig,
|
|
@@ -1970,15 +2646,15 @@ function DepositAddressSkeleton({
|
|
|
1970
2646
|
const chainName = getChainName(defaultChainId);
|
|
1971
2647
|
const chainIcon = getChainIcon(defaultChainId);
|
|
1972
2648
|
const tokenIcon = getTokenIcon(defaultToken);
|
|
1973
|
-
return /* @__PURE__ */
|
|
1974
|
-
/* @__PURE__ */
|
|
1975
|
-
/* @__PURE__ */
|
|
1976
|
-
/* @__PURE__ */
|
|
1977
|
-
/* @__PURE__ */
|
|
1978
|
-
/* @__PURE__ */
|
|
1979
|
-
/* @__PURE__ */
|
|
1980
|
-
/* @__PURE__ */
|
|
1981
|
-
chainIcon && /* @__PURE__ */
|
|
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(
|
|
1982
2658
|
"img",
|
|
1983
2659
|
{
|
|
1984
2660
|
src: chainIcon,
|
|
@@ -1986,17 +2662,17 @@ function DepositAddressSkeleton({
|
|
|
1986
2662
|
className: "rs-deposit-address-dropdown-icon"
|
|
1987
2663
|
}
|
|
1988
2664
|
),
|
|
1989
|
-
/* @__PURE__ */
|
|
1990
|
-
/* @__PURE__ */
|
|
2665
|
+
/* @__PURE__ */ jsx12("span", { children: chainName }),
|
|
2666
|
+
/* @__PURE__ */ jsx12(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
|
|
1991
2667
|
] })
|
|
1992
2668
|
] }),
|
|
1993
|
-
/* @__PURE__ */
|
|
1994
|
-
/* @__PURE__ */
|
|
1995
|
-
/* @__PURE__ */
|
|
1996
|
-
/* @__PURE__ */
|
|
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: [
|
|
1997
2673
|
"Min.$",
|
|
1998
2674
|
(uiConfig?.minDepositUsd ?? 0.1).toFixed(2),
|
|
1999
|
-
/* @__PURE__ */
|
|
2675
|
+
/* @__PURE__ */ jsx12(Tooltip, { content: "Minimum deposit amount required for the selected chain.", children: /* @__PURE__ */ jsx12(
|
|
2000
2676
|
InfoIcon,
|
|
2001
2677
|
{
|
|
2002
2678
|
className: "rs-deposit-address-min-icon",
|
|
@@ -2005,8 +2681,8 @@ function DepositAddressSkeleton({
|
|
|
2005
2681
|
) })
|
|
2006
2682
|
] })
|
|
2007
2683
|
] }),
|
|
2008
|
-
/* @__PURE__ */
|
|
2009
|
-
tokenIcon && /* @__PURE__ */
|
|
2684
|
+
/* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown-trigger", children: [
|
|
2685
|
+
tokenIcon && /* @__PURE__ */ jsx12(
|
|
2010
2686
|
"img",
|
|
2011
2687
|
{
|
|
2012
2688
|
src: tokenIcon,
|
|
@@ -2014,21 +2690,21 @@ function DepositAddressSkeleton({
|
|
|
2014
2690
|
className: "rs-deposit-address-dropdown-icon"
|
|
2015
2691
|
}
|
|
2016
2692
|
),
|
|
2017
|
-
/* @__PURE__ */
|
|
2018
|
-
/* @__PURE__ */
|
|
2693
|
+
/* @__PURE__ */ jsx12("span", { children: defaultToken }),
|
|
2694
|
+
/* @__PURE__ */ jsx12(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
|
|
2019
2695
|
] })
|
|
2020
2696
|
] })
|
|
2021
2697
|
] }),
|
|
2022
|
-
/* @__PURE__ */
|
|
2698
|
+
/* @__PURE__ */ jsxs10(
|
|
2023
2699
|
"div",
|
|
2024
2700
|
{
|
|
2025
2701
|
style: { display: "flex", flexDirection: "column", gap: 4, width: "100%" },
|
|
2026
2702
|
children: [
|
|
2027
|
-
/* @__PURE__ */
|
|
2028
|
-
/* @__PURE__ */
|
|
2029
|
-
/* @__PURE__ */
|
|
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" })
|
|
2030
2706
|
] }),
|
|
2031
|
-
/* @__PURE__ */
|
|
2707
|
+
/* @__PURE__ */ jsxs10(
|
|
2032
2708
|
"button",
|
|
2033
2709
|
{
|
|
2034
2710
|
type: "button",
|
|
@@ -2036,7 +2712,7 @@ function DepositAddressSkeleton({
|
|
|
2036
2712
|
disabled: true,
|
|
2037
2713
|
"aria-hidden": "true",
|
|
2038
2714
|
children: [
|
|
2039
|
-
/* @__PURE__ */
|
|
2715
|
+
/* @__PURE__ */ jsx12(CopyIcon, {}),
|
|
2040
2716
|
"Copy address"
|
|
2041
2717
|
]
|
|
2042
2718
|
}
|
|
@@ -2044,20 +2720,20 @@ function DepositAddressSkeleton({
|
|
|
2044
2720
|
]
|
|
2045
2721
|
}
|
|
2046
2722
|
),
|
|
2047
|
-
/* @__PURE__ */
|
|
2048
|
-
/* @__PURE__ */
|
|
2049
|
-
/* @__PURE__ */
|
|
2050
|
-
/* @__PURE__ */
|
|
2051
|
-
/* @__PURE__ */
|
|
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(
|
|
2052
2728
|
Tooltip,
|
|
2053
2729
|
{
|
|
2054
2730
|
className: "rs-price-impact-info",
|
|
2055
2731
|
content: "Price impact is the difference between expected and execution price, due to trade size and liquidity.",
|
|
2056
|
-
children: /* @__PURE__ */
|
|
2732
|
+
children: /* @__PURE__ */ jsx12(InfoIcon, { "aria-hidden": "true" })
|
|
2057
2733
|
}
|
|
2058
2734
|
)
|
|
2059
2735
|
] }),
|
|
2060
|
-
/* @__PURE__ */
|
|
2736
|
+
/* @__PURE__ */ jsx12(
|
|
2061
2737
|
ChevronDownIcon,
|
|
2062
2738
|
{
|
|
2063
2739
|
className: "rs-price-impact-chevron",
|
|
@@ -2066,15 +2742,15 @@ function DepositAddressSkeleton({
|
|
|
2066
2742
|
)
|
|
2067
2743
|
] }) })
|
|
2068
2744
|
] }),
|
|
2069
|
-
/* @__PURE__ */
|
|
2745
|
+
/* @__PURE__ */ jsx12(PoweredBy, {})
|
|
2070
2746
|
] });
|
|
2071
2747
|
}
|
|
2072
2748
|
DepositAddressSkeleton.displayName = "DepositAddressSkeleton";
|
|
2073
2749
|
|
|
2074
2750
|
// src/components/steps/SolanaTokenSelectStep.tsx
|
|
2075
|
-
import { useState as
|
|
2751
|
+
import { useState as useState8, useEffect as useEffect8, useMemo as useMemo5 } from "react";
|
|
2076
2752
|
import { formatUnits as formatUnits4 } from "viem";
|
|
2077
|
-
import { jsx as
|
|
2753
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2078
2754
|
function SolanaTokenSelectStep({
|
|
2079
2755
|
solanaAddress,
|
|
2080
2756
|
service,
|
|
@@ -2083,11 +2759,11 @@ function SolanaTokenSelectStep({
|
|
|
2083
2759
|
onDisconnect,
|
|
2084
2760
|
debug
|
|
2085
2761
|
}) {
|
|
2086
|
-
const [tokenBalances, setTokenBalances] =
|
|
2087
|
-
const [selectedSymbol, setSelectedSymbol] =
|
|
2088
|
-
const [loading, setLoading] =
|
|
2089
|
-
const [error, setError] =
|
|
2090
|
-
|
|
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(() => {
|
|
2091
2767
|
let active = true;
|
|
2092
2768
|
async function loadBalances() {
|
|
2093
2769
|
if (!solanaAddress) {
|
|
@@ -2158,7 +2834,7 @@ function SolanaTokenSelectStep({
|
|
|
2158
2834
|
active = false;
|
|
2159
2835
|
};
|
|
2160
2836
|
}, [debug, solanaAddress, service, onTotalBalanceComputed]);
|
|
2161
|
-
const rows =
|
|
2837
|
+
const rows = useMemo5(
|
|
2162
2838
|
() => [...tokenBalances].sort((a, b) => {
|
|
2163
2839
|
if (a.balanceUsd !== b.balanceUsd) return b.balanceUsd - a.balanceUsd;
|
|
2164
2840
|
if (b.balance > a.balance) return 1;
|
|
@@ -2180,30 +2856,30 @@ function SolanaTokenSelectStep({
|
|
|
2180
2856
|
};
|
|
2181
2857
|
const chainIcon = getChainIcon("solana");
|
|
2182
2858
|
const chainName = getChainName("solana");
|
|
2183
|
-
return /* @__PURE__ */
|
|
2184
|
-
/* @__PURE__ */
|
|
2185
|
-
/* @__PURE__ */
|
|
2859
|
+
return /* @__PURE__ */ jsxs11("div", { className: "rs-screen", children: [
|
|
2860
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-screen-body", children: [
|
|
2861
|
+
/* @__PURE__ */ jsx13(
|
|
2186
2862
|
BodyHeader,
|
|
2187
2863
|
{
|
|
2188
|
-
icon: /* @__PURE__ */
|
|
2864
|
+
icon: /* @__PURE__ */ jsx13(WalletIcon, {}),
|
|
2189
2865
|
title: "Your assets",
|
|
2190
2866
|
subtitle: "Select source assets to transfer"
|
|
2191
2867
|
}
|
|
2192
2868
|
),
|
|
2193
|
-
loading && /* @__PURE__ */
|
|
2194
|
-
/* @__PURE__ */
|
|
2195
|
-
/* @__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" })
|
|
2196
2872
|
] }),
|
|
2197
|
-
error && /* @__PURE__ */
|
|
2198
|
-
!loading && !error && rows.length === 0 && /* @__PURE__ */
|
|
2199
|
-
/* @__PURE__ */
|
|
2200
|
-
/* @__PURE__ */
|
|
2201
|
-
/* @__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: [
|
|
2202
2878
|
solanaAddress.slice(0, 6),
|
|
2203
2879
|
"...",
|
|
2204
2880
|
solanaAddress.slice(-4)
|
|
2205
2881
|
] }),
|
|
2206
|
-
onDisconnect && /* @__PURE__ */
|
|
2882
|
+
onDisconnect && /* @__PURE__ */ jsx13(
|
|
2207
2883
|
"button",
|
|
2208
2884
|
{
|
|
2209
2885
|
type: "button",
|
|
@@ -2213,11 +2889,11 @@ function SolanaTokenSelectStep({
|
|
|
2213
2889
|
}
|
|
2214
2890
|
)
|
|
2215
2891
|
] }),
|
|
2216
|
-
!loading && !error && rows.length > 0 && /* @__PURE__ */
|
|
2892
|
+
!loading && !error && rows.length > 0 && /* @__PURE__ */ jsx13("div", { className: "rs-asset-list", children: rows.map((entry) => {
|
|
2217
2893
|
const isSelected = selectedSymbol === entry.token.symbol;
|
|
2218
2894
|
const tokenAmount = formatBalance(entry);
|
|
2219
2895
|
const tokenIcon = getTokenIcon(entry.token.symbol);
|
|
2220
|
-
return /* @__PURE__ */
|
|
2896
|
+
return /* @__PURE__ */ jsxs11(
|
|
2221
2897
|
"button",
|
|
2222
2898
|
{
|
|
2223
2899
|
type: "button",
|
|
@@ -2225,33 +2901,33 @@ function SolanaTokenSelectStep({
|
|
|
2225
2901
|
className: `rs-asset-row ${isSelected ? "rs-asset-row--selected" : ""}`,
|
|
2226
2902
|
"aria-pressed": isSelected,
|
|
2227
2903
|
children: [
|
|
2228
|
-
/* @__PURE__ */
|
|
2229
|
-
/* @__PURE__ */
|
|
2230
|
-
tokenIcon ? /* @__PURE__ */
|
|
2231
|
-
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 }) })
|
|
2232
2908
|
] }),
|
|
2233
|
-
/* @__PURE__ */
|
|
2234
|
-
/* @__PURE__ */
|
|
2235
|
-
/* @__PURE__ */
|
|
2236
|
-
/* @__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: [
|
|
2237
2913
|
"on ",
|
|
2238
2914
|
chainName
|
|
2239
2915
|
] })
|
|
2240
2916
|
] }),
|
|
2241
|
-
/* @__PURE__ */
|
|
2917
|
+
/* @__PURE__ */ jsxs11("div", { className: "rs-asset-balance-small", children: [
|
|
2242
2918
|
tokenAmount,
|
|
2243
2919
|
" ",
|
|
2244
2920
|
entry.token.symbol
|
|
2245
2921
|
] })
|
|
2246
2922
|
] })
|
|
2247
2923
|
] }),
|
|
2248
|
-
/* @__PURE__ */
|
|
2924
|
+
/* @__PURE__ */ jsx13("div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ? currencyFormatter.format(entry.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${entry.token.symbol}` : "--" })
|
|
2249
2925
|
]
|
|
2250
2926
|
},
|
|
2251
2927
|
entry.token.symbol
|
|
2252
2928
|
);
|
|
2253
2929
|
}) }),
|
|
2254
|
-
/* @__PURE__ */
|
|
2930
|
+
/* @__PURE__ */ jsx13(
|
|
2255
2931
|
Button,
|
|
2256
2932
|
{
|
|
2257
2933
|
onClick: () => selectedEntry && onContinue(
|
|
@@ -2265,14 +2941,14 @@ function SolanaTokenSelectStep({
|
|
|
2265
2941
|
}
|
|
2266
2942
|
)
|
|
2267
2943
|
] }),
|
|
2268
|
-
/* @__PURE__ */
|
|
2944
|
+
/* @__PURE__ */ jsx13(PoweredBy, {})
|
|
2269
2945
|
] });
|
|
2270
2946
|
}
|
|
2271
2947
|
|
|
2272
2948
|
// src/components/steps/SolanaAmountStep.tsx
|
|
2273
|
-
import { useCallback as
|
|
2949
|
+
import { useCallback as useCallback6, useEffect as useEffect9, useMemo as useMemo6, useRef as useRef7, useState as useState9 } from "react";
|
|
2274
2950
|
import { formatUnits as formatUnits5, parseUnits as parseUnits3 } from "viem";
|
|
2275
|
-
import { Fragment as Fragment2, jsx as
|
|
2951
|
+
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2276
2952
|
var SOL_FEE_RESERVE_LAMPORTS = 1000000n;
|
|
2277
2953
|
var PRESETS2 = [
|
|
2278
2954
|
{ value: 25, label: "25%" },
|
|
@@ -2293,12 +2969,12 @@ function SolanaAmountStep({
|
|
|
2293
2969
|
onContinue,
|
|
2294
2970
|
debug
|
|
2295
2971
|
}) {
|
|
2296
|
-
const [amount, setAmount] =
|
|
2297
|
-
const [error, setError] =
|
|
2298
|
-
const hasAppliedDefaultRef =
|
|
2972
|
+
const [amount, setAmount] = useState9("");
|
|
2973
|
+
const [error, setError] = useState9(null);
|
|
2974
|
+
const hasAppliedDefaultRef = useRef7(false);
|
|
2299
2975
|
const isSourceStablecoin = isStablecoinSymbol(token.symbol);
|
|
2300
2976
|
const isMaxDefault = defaultAmount?.trim().toLowerCase() === "max";
|
|
2301
|
-
const tokenPriceUsd =
|
|
2977
|
+
const tokenPriceUsd = useMemo6(() => {
|
|
2302
2978
|
if (isSourceStablecoin) return 1;
|
|
2303
2979
|
try {
|
|
2304
2980
|
const balanceUnits = Number(formatUnits5(balance, token.decimals));
|
|
@@ -2312,7 +2988,7 @@ function SolanaAmountStep({
|
|
|
2312
2988
|
}
|
|
2313
2989
|
}, [isSourceStablecoin, balance, token.decimals, balanceUsd]);
|
|
2314
2990
|
const hasPricing = tokenPriceUsd !== null;
|
|
2315
|
-
const formattedBalance =
|
|
2991
|
+
const formattedBalance = useMemo6(() => {
|
|
2316
2992
|
try {
|
|
2317
2993
|
const raw = formatUnits5(balance, token.decimals);
|
|
2318
2994
|
const numeric = Number(raw);
|
|
@@ -2322,7 +2998,7 @@ function SolanaAmountStep({
|
|
|
2322
2998
|
return "\u2026";
|
|
2323
2999
|
}
|
|
2324
3000
|
}, [balance, token.decimals]);
|
|
2325
|
-
const computedBalanceUsd =
|
|
3001
|
+
const computedBalanceUsd = useMemo6(() => {
|
|
2326
3002
|
try {
|
|
2327
3003
|
const balanceUnits = Number(formatUnits5(balance, token.decimals));
|
|
2328
3004
|
if (!Number.isFinite(balanceUnits) || balanceUnits < 0) return null;
|
|
@@ -2333,11 +3009,11 @@ function SolanaAmountStep({
|
|
|
2333
3009
|
return null;
|
|
2334
3010
|
}
|
|
2335
3011
|
}, [balance, token.decimals, tokenPriceUsd, balanceUsd]);
|
|
2336
|
-
const spendableBalance =
|
|
3012
|
+
const spendableBalance = useMemo6(() => {
|
|
2337
3013
|
if (!isNativeSol(token)) return balance;
|
|
2338
3014
|
return balance > SOL_FEE_RESERVE_LAMPORTS ? balance - SOL_FEE_RESERVE_LAMPORTS : 0n;
|
|
2339
3015
|
}, [balance, token]);
|
|
2340
|
-
const spendableBalanceUsd =
|
|
3016
|
+
const spendableBalanceUsd = useMemo6(() => {
|
|
2341
3017
|
try {
|
|
2342
3018
|
const spendableUnits = Number(formatUnits5(spendableBalance, token.decimals));
|
|
2343
3019
|
if (!Number.isFinite(spendableUnits) || spendableUnits < 0) return null;
|
|
@@ -2347,7 +3023,7 @@ function SolanaAmountStep({
|
|
|
2347
3023
|
return null;
|
|
2348
3024
|
}
|
|
2349
3025
|
}, [spendableBalance, token.decimals, tokenPriceUsd]);
|
|
2350
|
-
const computePresetAmount =
|
|
3026
|
+
const computePresetAmount = useCallback6(
|
|
2351
3027
|
(percentage) => {
|
|
2352
3028
|
try {
|
|
2353
3029
|
const spendableUnits = Number(
|
|
@@ -2370,7 +3046,7 @@ function SolanaAmountStep({
|
|
|
2370
3046
|
spendableBalanceUsd
|
|
2371
3047
|
]
|
|
2372
3048
|
);
|
|
2373
|
-
|
|
3049
|
+
useEffect9(() => {
|
|
2374
3050
|
if (hasAppliedDefaultRef.current || !defaultAmount) return;
|
|
2375
3051
|
if (isMaxDefault) {
|
|
2376
3052
|
const next = computePresetAmount(100);
|
|
@@ -2386,11 +3062,11 @@ function SolanaAmountStep({
|
|
|
2386
3062
|
hasAppliedDefaultRef.current = true;
|
|
2387
3063
|
}
|
|
2388
3064
|
}, [defaultAmount, isMaxDefault, computePresetAmount]);
|
|
2389
|
-
const numericAmount =
|
|
3065
|
+
const numericAmount = useMemo6(() => {
|
|
2390
3066
|
const parsed = parseFloat(amount);
|
|
2391
3067
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : 0;
|
|
2392
3068
|
}, [amount]);
|
|
2393
|
-
const sourceAmountUnits =
|
|
3069
|
+
const sourceAmountUnits = useMemo6(() => {
|
|
2394
3070
|
if (numericAmount <= 0) return null;
|
|
2395
3071
|
const raw = isSourceStablecoin || !hasPricing ? numericAmount : numericAmount / (tokenPriceUsd ?? 1);
|
|
2396
3072
|
try {
|
|
@@ -2472,12 +3148,12 @@ function SolanaAmountStep({
|
|
|
2472
3148
|
const continueLabel = exceedsBalance ? "Insufficient balance" : isAboveMax ? "Continue with max allowed deposit" : isBelowMin ? "Continue with minimum deposit" : "Continue";
|
|
2473
3149
|
const continueDisabled = exceedsBalance || numericAmount === 0 && !isBelowMin;
|
|
2474
3150
|
const sourceTokenIcon = getTokenIcon(token.symbol);
|
|
2475
|
-
return /* @__PURE__ */
|
|
2476
|
-
/* @__PURE__ */
|
|
2477
|
-
/* @__PURE__ */
|
|
2478
|
-
/* @__PURE__ */
|
|
2479
|
-
/* @__PURE__ */
|
|
2480
|
-
/* @__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(
|
|
2481
3157
|
AnimatedAmountInput,
|
|
2482
3158
|
{
|
|
2483
3159
|
value: amount,
|
|
@@ -2486,25 +3162,25 @@ function SolanaAmountStep({
|
|
|
2486
3162
|
autoFocus: true
|
|
2487
3163
|
}
|
|
2488
3164
|
),
|
|
2489
|
-
/* @__PURE__ */
|
|
2490
|
-
/* @__PURE__ */
|
|
3165
|
+
/* @__PURE__ */ jsxs12("div", { className: "rs-amount-meta", children: [
|
|
3166
|
+
/* @__PURE__ */ jsxs12("span", { className: "rs-amount-meta-balance", children: [
|
|
2491
3167
|
formattedBalance,
|
|
2492
3168
|
" ",
|
|
2493
3169
|
token.symbol,
|
|
2494
3170
|
" available",
|
|
2495
|
-
computedBalanceUsd !== null && /* @__PURE__ */
|
|
3171
|
+
computedBalanceUsd !== null && /* @__PURE__ */ jsxs12(Fragment2, { children: [
|
|
2496
3172
|
" (~",
|
|
2497
3173
|
currencyFormatter.format(computedBalanceUsd),
|
|
2498
3174
|
")"
|
|
2499
3175
|
] })
|
|
2500
3176
|
] }),
|
|
2501
|
-
minDepositUsd !== null && /* @__PURE__ */
|
|
3177
|
+
minDepositUsd !== null && /* @__PURE__ */ jsxs12("span", { className: "rs-amount-meta-minimum", children: [
|
|
2502
3178
|
"Min. deposit ",
|
|
2503
3179
|
currencyFormatter.format(minDepositUsd)
|
|
2504
3180
|
] })
|
|
2505
3181
|
] })
|
|
2506
3182
|
] }),
|
|
2507
|
-
/* @__PURE__ */
|
|
3183
|
+
/* @__PURE__ */ jsx14("div", { className: "rs-amount-presets", children: PRESETS2.map((preset) => /* @__PURE__ */ jsx14(
|
|
2508
3184
|
"button",
|
|
2509
3185
|
{
|
|
2510
3186
|
type: "button",
|
|
@@ -2515,35 +3191,35 @@ function SolanaAmountStep({
|
|
|
2515
3191
|
preset.value
|
|
2516
3192
|
)) })
|
|
2517
3193
|
] }),
|
|
2518
|
-
/* @__PURE__ */
|
|
2519
|
-
/* @__PURE__ */
|
|
2520
|
-
/* @__PURE__ */
|
|
2521
|
-
/* @__PURE__ */
|
|
2522
|
-
/* @__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: [
|
|
2523
3199
|
"Solana ",
|
|
2524
3200
|
token.symbol
|
|
2525
3201
|
] }),
|
|
2526
|
-
sourceTokenIcon && /* @__PURE__ */
|
|
3202
|
+
sourceTokenIcon && /* @__PURE__ */ jsx14("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx14("img", { src: sourceTokenIcon, alt: "" }) })
|
|
2527
3203
|
] })
|
|
2528
3204
|
] }),
|
|
2529
|
-
targetChainName && targetTokenSymbol && /* @__PURE__ */
|
|
2530
|
-
/* @__PURE__ */
|
|
2531
|
-
/* @__PURE__ */
|
|
2532
|
-
/* @__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: [
|
|
2533
3209
|
targetChainName,
|
|
2534
3210
|
" ",
|
|
2535
3211
|
targetTokenSymbol
|
|
2536
3212
|
] }),
|
|
2537
|
-
targetTokenIcon && /* @__PURE__ */
|
|
3213
|
+
targetTokenIcon && /* @__PURE__ */ jsx14("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx14("img", { src: targetTokenIcon, alt: "" }) })
|
|
2538
3214
|
] })
|
|
2539
3215
|
] }),
|
|
2540
|
-
balanceAfterUsd !== null && /* @__PURE__ */
|
|
2541
|
-
/* @__PURE__ */
|
|
2542
|
-
/* @__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) })
|
|
2543
3219
|
] })
|
|
2544
3220
|
] }),
|
|
2545
|
-
error && /* @__PURE__ */
|
|
2546
|
-
/* @__PURE__ */
|
|
3221
|
+
error && /* @__PURE__ */ jsx14(Callout, { variant: "error", children: error }),
|
|
3222
|
+
/* @__PURE__ */ jsx14(
|
|
2547
3223
|
Button,
|
|
2548
3224
|
{
|
|
2549
3225
|
onClick: handleContinue,
|
|
@@ -2553,12 +3229,12 @@ function SolanaAmountStep({
|
|
|
2553
3229
|
}
|
|
2554
3230
|
)
|
|
2555
3231
|
] }),
|
|
2556
|
-
/* @__PURE__ */
|
|
3232
|
+
/* @__PURE__ */ jsx14(PoweredBy, {})
|
|
2557
3233
|
] });
|
|
2558
3234
|
}
|
|
2559
3235
|
|
|
2560
3236
|
// src/components/steps/SolanaConfirmStep.tsx
|
|
2561
|
-
import { useState as
|
|
3237
|
+
import { useState as useState10 } from "react";
|
|
2562
3238
|
import { parseUnits as parseUnits4 } from "viem";
|
|
2563
3239
|
|
|
2564
3240
|
// src/core/solana.ts
|
|
@@ -2666,7 +3342,7 @@ async function sendSolanaTransaction(provider, _connection, transaction) {
|
|
|
2666
3342
|
}
|
|
2667
3343
|
|
|
2668
3344
|
// src/components/steps/SolanaConfirmStep.tsx
|
|
2669
|
-
import { jsx as
|
|
3345
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2670
3346
|
function SolanaConfirmStep({
|
|
2671
3347
|
smartAccount,
|
|
2672
3348
|
solanaAddress,
|
|
@@ -2687,8 +3363,8 @@ function SolanaConfirmStep({
|
|
|
2687
3363
|
onError,
|
|
2688
3364
|
debug
|
|
2689
3365
|
}) {
|
|
2690
|
-
const [isSubmitting, setIsSubmitting] =
|
|
2691
|
-
const [error, setError] =
|
|
3366
|
+
const [isSubmitting, setIsSubmitting] = useState10(false);
|
|
3367
|
+
const [error, setError] = useState10(null);
|
|
2692
3368
|
const targetSymbol = getTargetTokenSymbol(targetToken, targetChain);
|
|
2693
3369
|
const isSameToken = token.symbol.toUpperCase() === targetSymbol.toUpperCase();
|
|
2694
3370
|
const sourceChainName = getChainName("solana");
|
|
@@ -2807,66 +3483,66 @@ function SolanaConfirmStep({
|
|
|
2807
3483
|
setIsSubmitting(false);
|
|
2808
3484
|
}
|
|
2809
3485
|
};
|
|
2810
|
-
return /* @__PURE__ */
|
|
2811
|
-
/* @__PURE__ */
|
|
2812
|
-
/* @__PURE__ */
|
|
2813
|
-
/* @__PURE__ */
|
|
2814
|
-
/* @__PURE__ */
|
|
2815
|
-
/* @__PURE__ */
|
|
2816
|
-
/* @__PURE__ */
|
|
2817
|
-
/* @__PURE__ */
|
|
2818
|
-
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: "" }) })
|
|
2819
3495
|
] })
|
|
2820
3496
|
] }),
|
|
2821
|
-
/* @__PURE__ */
|
|
2822
|
-
/* @__PURE__ */
|
|
2823
|
-
/* @__PURE__ */
|
|
2824
|
-
/* @__PURE__ */
|
|
2825
|
-
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: "" }) })
|
|
2826
3502
|
] })
|
|
2827
3503
|
] }),
|
|
2828
|
-
/* @__PURE__ */
|
|
2829
|
-
/* @__PURE__ */
|
|
2830
|
-
/* @__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 })
|
|
2831
3507
|
] }),
|
|
2832
|
-
/* @__PURE__ */
|
|
2833
|
-
/* @__PURE__ */
|
|
2834
|
-
/* @__PURE__ */
|
|
2835
|
-
/* @__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: [
|
|
2836
3512
|
formattedAmount,
|
|
2837
3513
|
" ",
|
|
2838
3514
|
token.symbol
|
|
2839
3515
|
] }),
|
|
2840
|
-
sourceTokenIcon && /* @__PURE__ */
|
|
3516
|
+
sourceTokenIcon && /* @__PURE__ */ jsx15("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx15("img", { src: sourceTokenIcon, alt: "" }) })
|
|
2841
3517
|
] })
|
|
2842
3518
|
] }),
|
|
2843
|
-
/* @__PURE__ */
|
|
2844
|
-
/* @__PURE__ */
|
|
2845
|
-
/* @__PURE__ */
|
|
2846
|
-
/* @__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: [
|
|
2847
3523
|
receiveAmount,
|
|
2848
3524
|
" ",
|
|
2849
3525
|
targetSymbol
|
|
2850
3526
|
] }),
|
|
2851
|
-
targetTokenIcon && /* @__PURE__ */
|
|
3527
|
+
targetTokenIcon && /* @__PURE__ */ jsx15("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx15("img", { src: targetTokenIcon, alt: "" }) })
|
|
2852
3528
|
] })
|
|
2853
3529
|
] }),
|
|
2854
|
-
/* @__PURE__ */
|
|
2855
|
-
/* @__PURE__ */
|
|
2856
|
-
/* @__PURE__ */
|
|
2857
|
-
/* @__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(
|
|
2858
3534
|
"span",
|
|
2859
3535
|
{
|
|
2860
3536
|
style: feeSponsored ? { textDecoration: "line-through" } : void 0,
|
|
2861
3537
|
children: "$0.04"
|
|
2862
3538
|
}
|
|
2863
3539
|
),
|
|
2864
|
-
/* @__PURE__ */
|
|
3540
|
+
/* @__PURE__ */ jsx15(Tooltip, { content: feeTooltip, children: /* @__PURE__ */ jsx15("span", { className: "rs-review-detail-info", "aria-label": "Fee info", children: /* @__PURE__ */ jsx15(InfoIcon, {}) }) })
|
|
2865
3541
|
] })
|
|
2866
3542
|
] })
|
|
2867
3543
|
] }),
|
|
2868
|
-
error && /* @__PURE__ */
|
|
2869
|
-
/* @__PURE__ */
|
|
3544
|
+
error && /* @__PURE__ */ jsx15(Callout, { variant: "error", children: error }),
|
|
3545
|
+
/* @__PURE__ */ jsx15(
|
|
2870
3546
|
Button,
|
|
2871
3547
|
{
|
|
2872
3548
|
onClick: handleConfirm,
|
|
@@ -2878,28 +3554,28 @@ function SolanaConfirmStep({
|
|
|
2878
3554
|
}
|
|
2879
3555
|
)
|
|
2880
3556
|
] }),
|
|
2881
|
-
/* @__PURE__ */
|
|
3557
|
+
/* @__PURE__ */ jsx15(PoweredBy, {})
|
|
2882
3558
|
] });
|
|
2883
3559
|
}
|
|
2884
3560
|
|
|
2885
3561
|
// src/components/steps/DappImportAssetSelectStep.tsx
|
|
2886
|
-
import { jsx as
|
|
3562
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2887
3563
|
function DappImportAssetSelectStep({
|
|
2888
3564
|
sourceLabel,
|
|
2889
3565
|
assets,
|
|
2890
3566
|
onSelect
|
|
2891
3567
|
}) {
|
|
2892
|
-
return /* @__PURE__ */
|
|
2893
|
-
/* @__PURE__ */
|
|
2894
|
-
/* @__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(
|
|
2895
3571
|
BodyHeader,
|
|
2896
3572
|
{
|
|
2897
|
-
icon: /* @__PURE__ */
|
|
3573
|
+
icon: /* @__PURE__ */ jsx16(WalletIcon, {}),
|
|
2898
3574
|
title: `Transfer from ${sourceLabel}`,
|
|
2899
3575
|
subtitle: "Pick the balance to import"
|
|
2900
3576
|
}
|
|
2901
3577
|
),
|
|
2902
|
-
/* @__PURE__ */
|
|
3578
|
+
/* @__PURE__ */ jsx16("div", { className: "rs-asset-list", children: assets.map((asset) => {
|
|
2903
3579
|
const tokenAmount = asset.balance ? tokenFormatter.format(
|
|
2904
3580
|
Number(asset.balance) / 10 ** asset.decimals
|
|
2905
3581
|
) : "0";
|
|
@@ -2907,23 +3583,23 @@ function DappImportAssetSelectStep({
|
|
|
2907
3583
|
const tokenIcon = asset.icon ?? getTokenIcon(asset.symbol);
|
|
2908
3584
|
const chainIcon = getChainIcon(asset.chainId);
|
|
2909
3585
|
const badge = getChainBadge(asset.chainId);
|
|
2910
|
-
return /* @__PURE__ */
|
|
3586
|
+
return /* @__PURE__ */ jsxs14(
|
|
2911
3587
|
"button",
|
|
2912
3588
|
{
|
|
2913
3589
|
type: "button",
|
|
2914
3590
|
className: "rs-asset-row",
|
|
2915
3591
|
onClick: () => onSelect(asset),
|
|
2916
3592
|
children: [
|
|
2917
|
-
/* @__PURE__ */
|
|
2918
|
-
/* @__PURE__ */
|
|
2919
|
-
/* @__PURE__ */
|
|
2920
|
-
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(
|
|
2921
3597
|
"img",
|
|
2922
3598
|
{
|
|
2923
3599
|
src: chainIcon,
|
|
2924
3600
|
alt: getChainName(asset.chainId)
|
|
2925
3601
|
}
|
|
2926
|
-
) }) : /* @__PURE__ */
|
|
3602
|
+
) }) : /* @__PURE__ */ jsx16(
|
|
2927
3603
|
"span",
|
|
2928
3604
|
{
|
|
2929
3605
|
className: "rs-asset-chain-badge",
|
|
@@ -2932,29 +3608,29 @@ function DappImportAssetSelectStep({
|
|
|
2932
3608
|
}
|
|
2933
3609
|
)
|
|
2934
3610
|
] }),
|
|
2935
|
-
/* @__PURE__ */
|
|
2936
|
-
/* @__PURE__ */
|
|
2937
|
-
/* @__PURE__ */
|
|
2938
|
-
/* @__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: [
|
|
2939
3615
|
"on ",
|
|
2940
3616
|
asset.sourceLabel
|
|
2941
3617
|
] })
|
|
2942
3618
|
] }),
|
|
2943
|
-
/* @__PURE__ */
|
|
3619
|
+
/* @__PURE__ */ jsxs14("div", { className: "rs-asset-balance-small", children: [
|
|
2944
3620
|
tokenAmount,
|
|
2945
3621
|
" ",
|
|
2946
3622
|
asset.symbol
|
|
2947
3623
|
] })
|
|
2948
3624
|
] })
|
|
2949
3625
|
] }),
|
|
2950
|
-
/* @__PURE__ */
|
|
3626
|
+
/* @__PURE__ */ jsx16("div", { className: "rs-asset-balance", children: balanceUsd })
|
|
2951
3627
|
]
|
|
2952
3628
|
},
|
|
2953
3629
|
asset.id
|
|
2954
3630
|
);
|
|
2955
3631
|
}) })
|
|
2956
3632
|
] }),
|
|
2957
|
-
/* @__PURE__ */
|
|
3633
|
+
/* @__PURE__ */ jsx16(PoweredBy, {})
|
|
2958
3634
|
] });
|
|
2959
3635
|
}
|
|
2960
3636
|
DappImportAssetSelectStep.displayName = "DappImportAssetSelectStep";
|
|
@@ -3569,8 +4245,19 @@ function applyBack(state, hasWalletOptions) {
|
|
|
3569
4245
|
},
|
|
3570
4246
|
flow: { ...state.flow, step: "solana-amount", hasNavigatedBack: true }
|
|
3571
4247
|
};
|
|
4248
|
+
case "exchange-connect":
|
|
4249
|
+
return {
|
|
4250
|
+
...state,
|
|
4251
|
+
flow: {
|
|
4252
|
+
...state.flow,
|
|
4253
|
+
step: "exchange-select",
|
|
4254
|
+
hasNavigatedBack: true
|
|
4255
|
+
}
|
|
4256
|
+
};
|
|
3572
4257
|
case "select-asset":
|
|
3573
4258
|
case "deposit-address":
|
|
4259
|
+
case "fiat-onramp":
|
|
4260
|
+
case "exchange-select":
|
|
3574
4261
|
case "solana-token-select":
|
|
3575
4262
|
case "dapp-import-asset-select":
|
|
3576
4263
|
return {
|
|
@@ -3587,7 +4274,8 @@ function applyBack(state, hasWalletOptions) {
|
|
|
3587
4274
|
...state.dappImport,
|
|
3588
4275
|
activeProviderId: null,
|
|
3589
4276
|
selectedAsset: null
|
|
3590
|
-
}
|
|
4277
|
+
},
|
|
4278
|
+
exchange: { selectedConnection: null }
|
|
3591
4279
|
};
|
|
3592
4280
|
case "connect":
|
|
3593
4281
|
case "setup":
|
|
@@ -3600,7 +4288,8 @@ function applyBack(state, hasWalletOptions) {
|
|
|
3600
4288
|
mode: null,
|
|
3601
4289
|
isConnectSelectionConfirmed: false,
|
|
3602
4290
|
hasNavigatedBack: hasWalletOptions || state.flow.hasNavigatedBack
|
|
3603
|
-
}
|
|
4291
|
+
},
|
|
4292
|
+
exchange: { selectedConnection: null }
|
|
3604
4293
|
};
|
|
3605
4294
|
}
|
|
3606
4295
|
return state;
|
|
@@ -3620,6 +4309,10 @@ function modeEntryStep(mode) {
|
|
|
3620
4309
|
return "solana-token-select";
|
|
3621
4310
|
case "dapp-import":
|
|
3622
4311
|
return "dapp-import-asset-select";
|
|
4312
|
+
case "fiat-onramp":
|
|
4313
|
+
return "fiat-onramp";
|
|
4314
|
+
case "exchange-connect":
|
|
4315
|
+
return "exchange-select";
|
|
3623
4316
|
}
|
|
3624
4317
|
}
|
|
3625
4318
|
function updateSetupEntry(state, owner, update) {
|
|
@@ -3665,7 +4358,8 @@ function applyAction(state, action) {
|
|
|
3665
4358
|
...state.dappImport,
|
|
3666
4359
|
activeProviderId: null,
|
|
3667
4360
|
selectedAsset: null
|
|
3668
|
-
}
|
|
4361
|
+
},
|
|
4362
|
+
exchange: { selectedConnection: null }
|
|
3669
4363
|
};
|
|
3670
4364
|
case "connect/wallet-confirmed":
|
|
3671
4365
|
if (!action.mode) return state;
|
|
@@ -3689,6 +4383,39 @@ function applyAction(state, action) {
|
|
|
3689
4383
|
step: "deposit-address"
|
|
3690
4384
|
}
|
|
3691
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
|
+
};
|
|
3692
4419
|
case "connect/auto-locked":
|
|
3693
4420
|
return {
|
|
3694
4421
|
...state,
|
|
@@ -3714,7 +4441,8 @@ function applyAction(state, action) {
|
|
|
3714
4441
|
...state.dappImport,
|
|
3715
4442
|
activeProviderId: null,
|
|
3716
4443
|
selectedAsset: null
|
|
3717
|
-
}
|
|
4444
|
+
},
|
|
4445
|
+
exchange: { selectedConnection: null }
|
|
3718
4446
|
};
|
|
3719
4447
|
case "setup/started": {
|
|
3720
4448
|
const existing = state.setup.byOwner[ownerKey(action.owner)];
|
|
@@ -3949,7 +4677,9 @@ function applyAction(state, action) {
|
|
|
3949
4677
|
activeProviderId: null,
|
|
3950
4678
|
selectedAsset: null
|
|
3951
4679
|
},
|
|
3952
|
-
setup: { byOwner: preservedByOwner }
|
|
4680
|
+
setup: { byOwner: preservedByOwner },
|
|
4681
|
+
fiat: { selectedMethod: null },
|
|
4682
|
+
exchange: { selectedConnection: null }
|
|
3953
4683
|
};
|
|
3954
4684
|
}
|
|
3955
4685
|
case "target/changed": {
|
|
@@ -4023,6 +4753,12 @@ function createInitialState(overrides) {
|
|
|
4023
4753
|
},
|
|
4024
4754
|
setup: {
|
|
4025
4755
|
byOwner: {}
|
|
4756
|
+
},
|
|
4757
|
+
fiat: {
|
|
4758
|
+
selectedMethod: null
|
|
4759
|
+
},
|
|
4760
|
+
exchange: {
|
|
4761
|
+
selectedConnection: null
|
|
4026
4762
|
}
|
|
4027
4763
|
};
|
|
4028
4764
|
}
|
|
@@ -4325,23 +5061,23 @@ function mapError(error) {
|
|
|
4325
5061
|
}
|
|
4326
5062
|
|
|
4327
5063
|
// src/DepositFlow.tsx
|
|
4328
|
-
import { Fragment as Fragment3, jsx as
|
|
5064
|
+
import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4329
5065
|
function AccountPreparingSkeleton({
|
|
4330
5066
|
errorMessage,
|
|
4331
5067
|
onRetry
|
|
4332
5068
|
}) {
|
|
4333
|
-
return /* @__PURE__ */
|
|
4334
|
-
/* @__PURE__ */
|
|
4335
|
-
/* @__PURE__ */
|
|
4336
|
-
/* @__PURE__ */
|
|
4337
|
-
] }) : /* @__PURE__ */
|
|
4338
|
-
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(
|
|
4339
5075
|
"button",
|
|
4340
5076
|
{
|
|
4341
5077
|
type: "button",
|
|
4342
5078
|
className: "rs-button rs-button--default rs-button--full-width",
|
|
4343
5079
|
onClick: onRetry,
|
|
4344
|
-
children: /* @__PURE__ */
|
|
5080
|
+
children: /* @__PURE__ */ jsx17("span", { children: "Try again" })
|
|
4345
5081
|
}
|
|
4346
5082
|
) })
|
|
4347
5083
|
] });
|
|
@@ -4350,10 +5086,12 @@ var QR_AUTO_ADVANCE_HYDRATION_GRACE_MS = 1e3;
|
|
|
4350
5086
|
function isSameRoute2(sourceChain, sourceToken, targetChain, targetToken) {
|
|
4351
5087
|
return sourceChain === targetChain && sourceToken.toLowerCase() === targetToken.toLowerCase();
|
|
4352
5088
|
}
|
|
5089
|
+
var SWAPPED_SOURCE_CHAIN = 8453;
|
|
5090
|
+
var SWAPPED_SOURCE_TOKEN = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
4353
5091
|
function getAddressKey(address) {
|
|
4354
5092
|
return address ? address.toLowerCase() : null;
|
|
4355
5093
|
}
|
|
4356
|
-
function deriveStep(flow, d, p, activeEntry) {
|
|
5094
|
+
function deriveStep(flow, d, p, activeEntry, fiat, exchange) {
|
|
4357
5095
|
const flowStep = flow.step;
|
|
4358
5096
|
const smartAccount = activeEntry.smartAccount;
|
|
4359
5097
|
const solanaDepositAddress = activeEntry.solanaDepositAddress;
|
|
@@ -4368,6 +5106,23 @@ function deriveStep(flow, d, p, activeEntry) {
|
|
|
4368
5106
|
smartAccount,
|
|
4369
5107
|
solanaDepositAddress: solanaDepositAddress ?? void 0
|
|
4370
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
|
+
};
|
|
4371
5126
|
case "select-asset":
|
|
4372
5127
|
if (!smartAccount) return { type: "setup" };
|
|
4373
5128
|
return { type: "select-asset", smartAccount };
|
|
@@ -4456,6 +5211,8 @@ function resolveOwnerForMode(mode, ctx) {
|
|
|
4456
5211
|
switch (mode) {
|
|
4457
5212
|
case "deposit-address":
|
|
4458
5213
|
case "solana-wallet":
|
|
5214
|
+
case "fiat-onramp":
|
|
5215
|
+
case "exchange-connect":
|
|
4459
5216
|
return ctx.dappAddress ?? null;
|
|
4460
5217
|
case "wallet":
|
|
4461
5218
|
return ctx.walletOwner ?? null;
|
|
@@ -4486,6 +5243,10 @@ function DepositFlow({
|
|
|
4486
5243
|
forceRegister = false,
|
|
4487
5244
|
enableSolana = true,
|
|
4488
5245
|
dappImports,
|
|
5246
|
+
enableFiatOnramp = false,
|
|
5247
|
+
enableQrTransfer = true,
|
|
5248
|
+
fiatOnrampMethods,
|
|
5249
|
+
enableExchangeConnect = false,
|
|
4489
5250
|
reownWallet,
|
|
4490
5251
|
onConnect,
|
|
4491
5252
|
onDisconnect,
|
|
@@ -4514,31 +5275,33 @@ function DepositFlow({
|
|
|
4514
5275
|
const depositSlice = useDepositStore((s) => s.deposit);
|
|
4515
5276
|
const processingSlice = useDepositStore((s) => s.processing);
|
|
4516
5277
|
const setupSlice = useDepositStore((s) => s.setup);
|
|
5278
|
+
const fiatSlice = useDepositStore((s) => s.fiat);
|
|
5279
|
+
const exchangeSlice = useDepositStore((s) => s.exchange);
|
|
4517
5280
|
const flowMode = flowSlice.mode;
|
|
4518
5281
|
const isConnectSelectionConfirmed = flowSlice.isConnectSelectionConfirmed;
|
|
4519
5282
|
const hasNavigatedBack = flowSlice.hasNavigatedBack;
|
|
4520
5283
|
const selectedWalletId = useDepositStore(selectedWalletIdSelector);
|
|
4521
|
-
const [totalBalanceUsd, setTotalBalanceUsd] =
|
|
4522
|
-
const [hasQrAutoAdvanceGraceElapsed, setHasQrAutoAdvanceGraceElapsed] =
|
|
4523
|
-
const portfolioAssetsRef =
|
|
4524
|
-
const stableWalletSignerRef =
|
|
4525
|
-
const stableWalletSelectionKeyRef =
|
|
4526
|
-
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(
|
|
4527
5290
|
(message, data) => {
|
|
4528
5291
|
debugLog(debug, "deposit-flow", message, data);
|
|
4529
5292
|
},
|
|
4530
5293
|
[debug]
|
|
4531
5294
|
);
|
|
4532
|
-
const logFlowError =
|
|
5295
|
+
const logFlowError = useCallback7(
|
|
4533
5296
|
(message, error, data) => {
|
|
4534
5297
|
debugError(debug, "deposit-flow", message, error, data);
|
|
4535
5298
|
},
|
|
4536
5299
|
[debug]
|
|
4537
5300
|
);
|
|
4538
|
-
const handleAssetsLoaded =
|
|
5301
|
+
const handleAssetsLoaded = useCallback7((assets) => {
|
|
4539
5302
|
portfolioAssetsRef.current = assets;
|
|
4540
5303
|
}, []);
|
|
4541
|
-
const getTokenPriceUsd =
|
|
5304
|
+
const getTokenPriceUsd = useCallback7((symbol) => {
|
|
4542
5305
|
const sym = symbol.toLowerCase();
|
|
4543
5306
|
for (const asset of portfolioAssetsRef.current) {
|
|
4544
5307
|
if (asset.symbol.toLowerCase() === sym && asset.balanceUsd && asset.balance) {
|
|
@@ -4553,14 +5316,14 @@ function DepositFlow({
|
|
|
4553
5316
|
}
|
|
4554
5317
|
return null;
|
|
4555
5318
|
}, []);
|
|
4556
|
-
const dappSwitchChain =
|
|
5319
|
+
const dappSwitchChain = useMemo7(() => {
|
|
4557
5320
|
if (!dappWalletClient?.switchChain) return void 0;
|
|
4558
5321
|
return async (chainId) => {
|
|
4559
5322
|
await dappWalletClient.switchChain?.({ id: chainId });
|
|
4560
5323
|
};
|
|
4561
5324
|
}, [dappWalletClient]);
|
|
4562
5325
|
const connectedWalletAddress = dappWalletClient?.account?.address ?? null;
|
|
4563
|
-
const walletOptions =
|
|
5326
|
+
const walletOptions = useMemo7(() => {
|
|
4564
5327
|
const options = [];
|
|
4565
5328
|
const seen = /* @__PURE__ */ new Set();
|
|
4566
5329
|
if (connectedWalletAddress && dappAddress) {
|
|
@@ -4612,7 +5375,7 @@ function DepositFlow({
|
|
|
4612
5375
|
reownWallet?.solanaAddress,
|
|
4613
5376
|
reownWallet?.caipAddress
|
|
4614
5377
|
]);
|
|
4615
|
-
const canAutoLock = dappWalletClient?.account && dappAddress && !reownWallet;
|
|
5378
|
+
const canAutoLock = dappWalletClient?.account && dappAddress && !reownWallet && !enableFiatOnramp && !enableExchangeConnect;
|
|
4616
5379
|
const hasWalletOptions = walletOptions.length > 0;
|
|
4617
5380
|
const hasReownSession = Boolean(
|
|
4618
5381
|
enableSolana ? reownWallet?.isConnected || reownWallet?.address : reownWallet?.address
|
|
@@ -4621,7 +5384,7 @@ function DepositFlow({
|
|
|
4621
5384
|
dappAddress && !hasWalletOptions && (hasDappWalletClientProp && dappWalletClient === void 0 || reownWallet && !hasReownSession && !reownWallet.isReady)
|
|
4622
5385
|
);
|
|
4623
5386
|
const showConnectStep = flowMode === null && !isConnectSelectionConfirmed;
|
|
4624
|
-
|
|
5387
|
+
useEffect10(() => {
|
|
4625
5388
|
if (!isWalletHydrationPending) {
|
|
4626
5389
|
setHasQrAutoAdvanceGraceElapsed(true);
|
|
4627
5390
|
return;
|
|
@@ -4632,7 +5395,7 @@ function DepositFlow({
|
|
|
4632
5395
|
}, QR_AUTO_ADVANCE_HYDRATION_GRACE_MS);
|
|
4633
5396
|
return () => window.clearTimeout(timeout);
|
|
4634
5397
|
}, [isWalletHydrationPending]);
|
|
4635
|
-
const walletSelectionKey =
|
|
5398
|
+
const walletSelectionKey = useMemo7(() => {
|
|
4636
5399
|
if (flowMode !== "wallet" && flowMode !== "dapp-import") return null;
|
|
4637
5400
|
if (canAutoLock) {
|
|
4638
5401
|
return getAddressKey(connectedWalletAddress);
|
|
@@ -4649,8 +5412,8 @@ function DepositFlow({
|
|
|
4649
5412
|
const setupChainId = typeof targetChain === "number" ? targetChain : typeof defaultSourceChain === "number" ? defaultSourceChain : base.id;
|
|
4650
5413
|
const targetSymbol = getTargetTokenSymbol(targetToken, targetChain);
|
|
4651
5414
|
const isTargetStablecoin = isStablecoinSymbol(targetSymbol);
|
|
4652
|
-
const targetMarketPriceRef =
|
|
4653
|
-
|
|
5415
|
+
const targetMarketPriceRef = useRef8(null);
|
|
5416
|
+
useEffect10(() => {
|
|
4654
5417
|
targetMarketPriceRef.current = null;
|
|
4655
5418
|
if (isTargetStablecoin || targetSymbol === "Token") {
|
|
4656
5419
|
return;
|
|
@@ -4665,7 +5428,7 @@ function DepositFlow({
|
|
|
4665
5428
|
cancelled = true;
|
|
4666
5429
|
};
|
|
4667
5430
|
}, [service, targetSymbol, isTargetStablecoin]);
|
|
4668
|
-
const walletSignerContext =
|
|
5431
|
+
const walletSignerContext = useMemo7(() => {
|
|
4669
5432
|
if (flowMode === "deposit-address") {
|
|
4670
5433
|
return null;
|
|
4671
5434
|
}
|
|
@@ -4731,7 +5494,7 @@ function DepositFlow({
|
|
|
4731
5494
|
reownWallet,
|
|
4732
5495
|
setupChainId
|
|
4733
5496
|
]);
|
|
4734
|
-
|
|
5497
|
+
useEffect10(() => {
|
|
4735
5498
|
if (flowMode !== "wallet" && flowMode !== "dapp-import") {
|
|
4736
5499
|
stableWalletSelectionKeyRef.current = null;
|
|
4737
5500
|
stableWalletSignerRef.current = null;
|
|
@@ -4746,7 +5509,7 @@ function DepositFlow({
|
|
|
4746
5509
|
stableWalletSignerRef.current = walletSignerContext;
|
|
4747
5510
|
}
|
|
4748
5511
|
}, [flowMode, walletSelectionKey, walletSignerContext]);
|
|
4749
|
-
const signerContext =
|
|
5512
|
+
const signerContext = useMemo7(() => {
|
|
4750
5513
|
if (flowMode === "deposit-address") {
|
|
4751
5514
|
if (!dappAddress) return null;
|
|
4752
5515
|
return {
|
|
@@ -4774,7 +5537,7 @@ function DepositFlow({
|
|
|
4774
5537
|
walletSignerContext,
|
|
4775
5538
|
walletSelectionKey
|
|
4776
5539
|
]);
|
|
4777
|
-
const selectedEvmWalletOwner =
|
|
5540
|
+
const selectedEvmWalletOwner = useMemo7(() => {
|
|
4778
5541
|
if (!selectedWalletId) return null;
|
|
4779
5542
|
const opt = walletOptions.find((o) => o.id === selectedWalletId);
|
|
4780
5543
|
if (opt?.kind === "external" && opt.address) {
|
|
@@ -4785,7 +5548,7 @@ function DepositFlow({
|
|
|
4785
5548
|
}
|
|
4786
5549
|
return null;
|
|
4787
5550
|
}, [selectedWalletId, walletOptions]);
|
|
4788
|
-
const dappImportOwner =
|
|
5551
|
+
const dappImportOwner = useMemo7(() => {
|
|
4789
5552
|
if (selectedEvmWalletOwner) return selectedEvmWalletOwner;
|
|
4790
5553
|
if (reownWallet?.address && reownWallet.isConnected) {
|
|
4791
5554
|
return reownWallet.address;
|
|
@@ -4798,7 +5561,7 @@ function DepositFlow({
|
|
|
4798
5561
|
reownWallet?.isConnected,
|
|
4799
5562
|
connectedWalletAddress
|
|
4800
5563
|
]);
|
|
4801
|
-
const activeOwner =
|
|
5564
|
+
const activeOwner = useMemo7(
|
|
4802
5565
|
() => resolveOwnerForMode(flowMode, {
|
|
4803
5566
|
dappAddress,
|
|
4804
5567
|
walletOwner: signerContext?.ownerAddress ?? (canAutoLock ? connectedWalletAddress : selectedEvmWalletOwner),
|
|
@@ -4814,12 +5577,12 @@ function DepositFlow({
|
|
|
4814
5577
|
dappImportOwner
|
|
4815
5578
|
]
|
|
4816
5579
|
);
|
|
4817
|
-
const activeEntry =
|
|
5580
|
+
const activeEntry = useMemo7(
|
|
4818
5581
|
() => readSetupForOwner(setupSlice, activeOwner),
|
|
4819
5582
|
[setupSlice, activeOwner]
|
|
4820
5583
|
);
|
|
4821
|
-
const lastActiveSetupLifecycleKeyRef =
|
|
4822
|
-
|
|
5584
|
+
const lastActiveSetupLifecycleKeyRef = useRef8(null);
|
|
5585
|
+
useEffect10(() => {
|
|
4823
5586
|
if (!flowMode || !isConnectSelectionConfirmed) {
|
|
4824
5587
|
lastActiveSetupLifecycleKeyRef.current = null;
|
|
4825
5588
|
return;
|
|
@@ -4855,12 +5618,26 @@ function DepositFlow({
|
|
|
4855
5618
|
activeEntry.solanaDepositAddress,
|
|
4856
5619
|
onLifecycleRef
|
|
4857
5620
|
]);
|
|
4858
|
-
const effectiveStep =
|
|
4859
|
-
() => deriveStep(
|
|
4860
|
-
|
|
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
|
+
]
|
|
4861
5638
|
);
|
|
4862
5639
|
const step = effectiveStep;
|
|
4863
|
-
const handleBack =
|
|
5640
|
+
const handleBack = useCallback7(() => {
|
|
4864
5641
|
const stepBeforeBack = storeApi.getState().flow.step;
|
|
4865
5642
|
storeApi.dispatch({
|
|
4866
5643
|
type: "back/requested",
|
|
@@ -4870,16 +5647,52 @@ function DepositFlow({
|
|
|
4870
5647
|
portfolioAssetsRef.current = [];
|
|
4871
5648
|
}
|
|
4872
5649
|
}, [storeApi, hasWalletOptions, reownWallet]);
|
|
4873
|
-
const canGoBackFromHere = effectiveStep.type === "deposit-address" || effectiveStep.type === "solana-token-select" || effectiveStep.type === "solana-amount" || effectiveStep.type === "solana-confirm" || effectiveStep.type === "amount" || effectiveStep.type === "confirm" || effectiveStep.type === "dapp-import-asset-select" || effectiveStep.type === "select-asset" && signerContext && !canAutoLock;
|
|
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;
|
|
4874
5651
|
const currentBackHandler = canGoBackFromHere ? handleBack : void 0;
|
|
4875
5652
|
const currentScreen = showConnectStep ? "connect" : effectiveStep.type;
|
|
4876
|
-
|
|
5653
|
+
useEffect10(() => {
|
|
4877
5654
|
onStepChangeRef.current?.(currentBackHandler, currentScreen);
|
|
4878
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]);
|
|
4879
5692
|
const stepSendToken = effectiveStep.type === "amount" ? effectiveStep.asset.symbol : null;
|
|
4880
5693
|
const stepOpenEventKey = effectiveStep.type === "select-asset" ? "select-asset" : effectiveStep.type === "deposit-address" ? "deposit-address" : effectiveStep.type === "amount" && stepSendToken ? `amount:${stepSendToken.toLowerCase()}` : null;
|
|
4881
|
-
const lastStepOpenEventKeyRef =
|
|
4882
|
-
|
|
5694
|
+
const lastStepOpenEventKeyRef = useRef8(null);
|
|
5695
|
+
useEffect10(() => {
|
|
4883
5696
|
if (!stepOpenEventKey) {
|
|
4884
5697
|
lastStepOpenEventKeyRef.current = null;
|
|
4885
5698
|
return;
|
|
@@ -4921,7 +5734,7 @@ function DepositFlow({
|
|
|
4921
5734
|
totalBalanceUsd,
|
|
4922
5735
|
onEventRef
|
|
4923
5736
|
]);
|
|
4924
|
-
|
|
5737
|
+
useEffect10(() => {
|
|
4925
5738
|
logFlow("state:changed", {
|
|
4926
5739
|
step: effectiveStep.type,
|
|
4927
5740
|
flowMode,
|
|
@@ -4937,7 +5750,7 @@ function DepositFlow({
|
|
|
4937
5750
|
targetChain,
|
|
4938
5751
|
targetToken
|
|
4939
5752
|
]);
|
|
4940
|
-
|
|
5753
|
+
useEffect10(() => {
|
|
4941
5754
|
onLifecycleRef.current?.({
|
|
4942
5755
|
type: "balance-changed",
|
|
4943
5756
|
totalUsd: totalBalanceUsd
|
|
@@ -4946,10 +5759,12 @@ function DepositFlow({
|
|
|
4946
5759
|
const isDepositAddressMode = flowMode === "deposit-address";
|
|
4947
5760
|
const isSolanaWalletMode = flowMode === "solana-wallet";
|
|
4948
5761
|
const isDappImportMode = flowMode === "dapp-import";
|
|
4949
|
-
const
|
|
5762
|
+
const isFiatOnrampMode = flowMode === "fiat-onramp";
|
|
5763
|
+
const isExchangeConnectMode = flowMode === "exchange-connect";
|
|
5764
|
+
const handleSelectTransferCrypto = useCallback7(() => {
|
|
4950
5765
|
storeApi.dispatch({ type: "connect/transfer-crypto-selected" });
|
|
4951
5766
|
}, [storeApi]);
|
|
4952
|
-
const handleConfirmWallet =
|
|
5767
|
+
const handleConfirmWallet = useCallback7(
|
|
4953
5768
|
(walletId) => {
|
|
4954
5769
|
const selectedOption = walletOptions.find((o) => o.id === walletId);
|
|
4955
5770
|
const mode = enableSolana && selectedOption?.kind === "solana" ? "solana-wallet" : "wallet";
|
|
@@ -4965,12 +5780,12 @@ function DepositFlow({
|
|
|
4965
5780
|
enableSolana && reownWallet?.isConnected && reownWallet?.isSolana
|
|
4966
5781
|
);
|
|
4967
5782
|
const dappImportsKey = dappImports ? Object.keys(dappImports).filter((k) => dappImports[k]).sort().join(",") : "";
|
|
4968
|
-
const enabledDappImportProviders =
|
|
5783
|
+
const enabledDappImportProviders = useMemo7(
|
|
4969
5784
|
() => isSolanaWalletConnected ? [] : getEnabledProviders(dappImports),
|
|
4970
5785
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- intentional: keyed on dappImportsKey, not the dappImports object identity
|
|
4971
5786
|
[dappImportsKey, isSolanaWalletConnected]
|
|
4972
5787
|
);
|
|
4973
|
-
const handleSelectDappImport =
|
|
5788
|
+
const handleSelectDappImport = useCallback7(
|
|
4974
5789
|
(providerId) => {
|
|
4975
5790
|
const owner = dappImportOwner;
|
|
4976
5791
|
if (owner) {
|
|
@@ -4991,13 +5806,13 @@ function DepositFlow({
|
|
|
4991
5806
|
},
|
|
4992
5807
|
[storeApi, walletOptions, dappImportOwner]
|
|
4993
5808
|
);
|
|
4994
|
-
const handleDappImportAssetSelected =
|
|
5809
|
+
const handleDappImportAssetSelected = useCallback7(
|
|
4995
5810
|
(asset) => {
|
|
4996
5811
|
storeApi.dispatch({ type: "dapp-import/asset-selected", asset });
|
|
4997
5812
|
},
|
|
4998
5813
|
[storeApi]
|
|
4999
5814
|
);
|
|
5000
|
-
|
|
5815
|
+
useEffect10(() => {
|
|
5001
5816
|
if (!dappImportOwner || enabledDappImportProviders.length === 0) {
|
|
5002
5817
|
storeApi.dispatch({ type: "dapp-import/availability-cleared" });
|
|
5003
5818
|
return;
|
|
@@ -5046,7 +5861,7 @@ function DepositFlow({
|
|
|
5046
5861
|
const activeDappImportProviderId = useDepositStore(
|
|
5047
5862
|
(s) => s.dappImport.activeProviderId
|
|
5048
5863
|
);
|
|
5049
|
-
const connectStepDappImports =
|
|
5864
|
+
const connectStepDappImports = useMemo7(
|
|
5050
5865
|
() => enabledDappImportProviders.map((provider) => {
|
|
5051
5866
|
const baseRow = {
|
|
5052
5867
|
id: provider.id,
|
|
@@ -5096,13 +5911,13 @@ function DepositFlow({
|
|
|
5096
5911
|
dappImportOwner
|
|
5097
5912
|
]
|
|
5098
5913
|
);
|
|
5099
|
-
const activeDappImportProvider =
|
|
5914
|
+
const activeDappImportProvider = useMemo7(() => {
|
|
5100
5915
|
if (!activeDappImportProviderId) return null;
|
|
5101
5916
|
return enabledDappImportProviders.find(
|
|
5102
5917
|
(p) => p.id === activeDappImportProviderId
|
|
5103
5918
|
) ?? null;
|
|
5104
5919
|
}, [activeDappImportProviderId, enabledDappImportProviders]);
|
|
5105
|
-
const activeDappImportAvailability =
|
|
5920
|
+
const activeDappImportAvailability = useMemo7(() => {
|
|
5106
5921
|
if (!activeDappImportProviderId) return null;
|
|
5107
5922
|
if (!dappImportOwner || dappImportAvailabilityOwner?.toLowerCase() !== dappImportOwner.toLowerCase()) {
|
|
5108
5923
|
return null;
|
|
@@ -5116,7 +5931,28 @@ function DepositFlow({
|
|
|
5116
5931
|
dappImportAvailabilityOwner,
|
|
5117
5932
|
dappImportOwner
|
|
5118
5933
|
]);
|
|
5119
|
-
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(() => {
|
|
5120
5956
|
onLifecycleRef.current?.({
|
|
5121
5957
|
type: "smart-account-changed",
|
|
5122
5958
|
evm: null,
|
|
@@ -5127,7 +5963,7 @@ function DepositFlow({
|
|
|
5127
5963
|
stableWalletSignerRef.current = null;
|
|
5128
5964
|
stableWalletSelectionKeyRef.current = null;
|
|
5129
5965
|
}, [onLifecycleRef, storeApi]);
|
|
5130
|
-
const setupInputBase =
|
|
5966
|
+
const setupInputBase = useMemo7(
|
|
5131
5967
|
() => ({
|
|
5132
5968
|
targetChain,
|
|
5133
5969
|
targetToken,
|
|
@@ -5153,7 +5989,7 @@ function DepositFlow({
|
|
|
5153
5989
|
enableSolana
|
|
5154
5990
|
]
|
|
5155
5991
|
);
|
|
5156
|
-
const desiredOwnersKey =
|
|
5992
|
+
const desiredOwnersKey = useMemo7(() => {
|
|
5157
5993
|
const owners = [];
|
|
5158
5994
|
const seen = /* @__PURE__ */ new Set();
|
|
5159
5995
|
const push = (addr) => {
|
|
@@ -5174,7 +6010,7 @@ function DepositFlow({
|
|
|
5174
6010
|
reownWallet?.address,
|
|
5175
6011
|
dappImportOwner
|
|
5176
6012
|
]);
|
|
5177
|
-
|
|
6013
|
+
useEffect10(() => {
|
|
5178
6014
|
desiredOwnersKey.forEach((owner) => {
|
|
5179
6015
|
void (async () => {
|
|
5180
6016
|
const input = {
|
|
@@ -5269,7 +6105,7 @@ function DepositFlow({
|
|
|
5269
6105
|
storeApi,
|
|
5270
6106
|
setupSlice.byOwner
|
|
5271
6107
|
]);
|
|
5272
|
-
const handleDepositAddressSubmitted =
|
|
6108
|
+
const handleDepositAddressSubmitted = useCallback7(
|
|
5273
6109
|
(data) => {
|
|
5274
6110
|
logFlow("deposit-address:detected", {
|
|
5275
6111
|
txHash: data.txHash,
|
|
@@ -5280,7 +6116,7 @@ function DepositFlow({
|
|
|
5280
6116
|
},
|
|
5281
6117
|
[logFlow, onLifecycleRef]
|
|
5282
6118
|
);
|
|
5283
|
-
const handleSolanaTokenContinue =
|
|
6119
|
+
const handleSolanaTokenContinue = useCallback7(
|
|
5284
6120
|
(token, balance, balanceUsd) => {
|
|
5285
6121
|
logFlow("solana:token:continue", { token: token.symbol });
|
|
5286
6122
|
storeApi.dispatch({
|
|
@@ -5293,7 +6129,7 @@ function DepositFlow({
|
|
|
5293
6129
|
},
|
|
5294
6130
|
[defaultAmount, logFlow, storeApi]
|
|
5295
6131
|
);
|
|
5296
|
-
const handleSolanaAmountContinue =
|
|
6132
|
+
const handleSolanaAmountContinue = useCallback7(
|
|
5297
6133
|
(token, sourceAmount, inputAmountUsd) => {
|
|
5298
6134
|
const targetSym = getTargetTokenSymbol(targetToken, targetChain);
|
|
5299
6135
|
const isTargetStable = isStablecoinSymbol(targetSym);
|
|
@@ -5315,7 +6151,7 @@ function DepositFlow({
|
|
|
5315
6151
|
},
|
|
5316
6152
|
[targetToken, targetChain, getTokenPriceUsd, logFlow, storeApi]
|
|
5317
6153
|
);
|
|
5318
|
-
const handleSolanaConfirmed =
|
|
6154
|
+
const handleSolanaConfirmed = useCallback7(
|
|
5319
6155
|
(txHash, amountUnits) => {
|
|
5320
6156
|
const tokenAtSubmit = storeApi.getState().deposit.selectedSolanaToken;
|
|
5321
6157
|
if (!tokenAtSubmit) return;
|
|
@@ -5342,7 +6178,7 @@ function DepositFlow({
|
|
|
5342
6178
|
},
|
|
5343
6179
|
[logFlow, onLifecycleRef, storeApi]
|
|
5344
6180
|
);
|
|
5345
|
-
const handleAssetContinue =
|
|
6181
|
+
const handleAssetContinue = useCallback7(
|
|
5346
6182
|
(asset) => {
|
|
5347
6183
|
onEventRef.current?.({
|
|
5348
6184
|
type: "deposit_modal_connected_wallet_select_source_cta_click",
|
|
@@ -5360,7 +6196,7 @@ function DepositFlow({
|
|
|
5360
6196
|
},
|
|
5361
6197
|
[defaultAmount, onEventRef, totalBalanceUsd, storeApi]
|
|
5362
6198
|
);
|
|
5363
|
-
const handleAmountContinue =
|
|
6199
|
+
const handleAmountContinue = useCallback7(
|
|
5364
6200
|
(amount, targetAmount, balance, liquidityWarning) => {
|
|
5365
6201
|
const entry = readSetupForOwner(
|
|
5366
6202
|
storeApi.getState().setup,
|
|
@@ -5381,7 +6217,7 @@ function DepositFlow({
|
|
|
5381
6217
|
},
|
|
5382
6218
|
[targetToken, targetChain, getTokenPriceUsd, storeApi, activeOwner]
|
|
5383
6219
|
);
|
|
5384
|
-
const handleDepositSubmitted =
|
|
6220
|
+
const handleDepositSubmitted = useCallback7(
|
|
5385
6221
|
(txHash, chainId, amount, token) => {
|
|
5386
6222
|
logFlow("evm:submitted", {
|
|
5387
6223
|
txHash,
|
|
@@ -5404,7 +6240,32 @@ function DepositFlow({
|
|
|
5404
6240
|
},
|
|
5405
6241
|
[logFlow, storeApi, targetChain, targetToken]
|
|
5406
6242
|
);
|
|
5407
|
-
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(
|
|
5408
6269
|
(txHash, sourceChain, amount) => {
|
|
5409
6270
|
onLifecycleRef.current?.({
|
|
5410
6271
|
type: "submitted",
|
|
@@ -5415,7 +6276,7 @@ function DepositFlow({
|
|
|
5415
6276
|
},
|
|
5416
6277
|
[onLifecycleRef]
|
|
5417
6278
|
);
|
|
5418
|
-
const handleDepositComplete =
|
|
6279
|
+
const handleDepositComplete = useCallback7(
|
|
5419
6280
|
(txHash, destinationTxHash, context) => {
|
|
5420
6281
|
logFlow("deposit:complete", { txHash, destinationTxHash, ...context });
|
|
5421
6282
|
onLifecycleRef.current?.({
|
|
@@ -5427,28 +6288,28 @@ function DepositFlow({
|
|
|
5427
6288
|
},
|
|
5428
6289
|
[logFlow, onLifecycleRef]
|
|
5429
6290
|
);
|
|
5430
|
-
const handleDepositFailed =
|
|
6291
|
+
const handleDepositFailed = useCallback7(
|
|
5431
6292
|
(txHash, error) => {
|
|
5432
6293
|
logFlowError("deposit:failed", error, { txHash });
|
|
5433
6294
|
onLifecycleRef.current?.({ type: "failed", txHash, error });
|
|
5434
6295
|
},
|
|
5435
6296
|
[logFlowError, onLifecycleRef]
|
|
5436
6297
|
);
|
|
5437
|
-
const handleError =
|
|
6298
|
+
const handleError = useCallback7(
|
|
5438
6299
|
(message, code) => {
|
|
5439
6300
|
logFlowError("flow:error", message, { code });
|
|
5440
6301
|
onErrorRef.current?.({ message, code });
|
|
5441
6302
|
},
|
|
5442
6303
|
[logFlowError, onErrorRef]
|
|
5443
6304
|
);
|
|
5444
|
-
const handleTotalBalanceComputed =
|
|
6305
|
+
const handleTotalBalanceComputed = useCallback7((total) => {
|
|
5445
6306
|
setTotalBalanceUsd(total);
|
|
5446
6307
|
}, []);
|
|
5447
|
-
const walletOptionsKey =
|
|
6308
|
+
const walletOptionsKey = useMemo7(
|
|
5448
6309
|
() => walletOptions.map((option) => option.id).join(","),
|
|
5449
6310
|
[walletOptions]
|
|
5450
6311
|
);
|
|
5451
|
-
|
|
6312
|
+
useEffect10(() => {
|
|
5452
6313
|
if (storeApi.getState().flow.mode) {
|
|
5453
6314
|
return;
|
|
5454
6315
|
}
|
|
@@ -5458,12 +6319,12 @@ function DepositFlow({
|
|
|
5458
6319
|
storeApi.dispatch({ type: "flow/step-set", step: "connect" });
|
|
5459
6320
|
}
|
|
5460
6321
|
}, [walletOptionsKey]);
|
|
5461
|
-
|
|
6322
|
+
useEffect10(() => {
|
|
5462
6323
|
if (!showConnectStep && isConnectSelectionConfirmed && (flowMode === "wallet" || flowMode === "dapp-import") && !signerContext) {
|
|
5463
6324
|
storeApi.dispatch({ type: "wallet/cleared" });
|
|
5464
6325
|
}
|
|
5465
6326
|
}, [showConnectStep, isConnectSelectionConfirmed, flowMode, signerContext, storeApi]);
|
|
5466
|
-
|
|
6327
|
+
useEffect10(() => {
|
|
5467
6328
|
if (enableSolana || flowMode !== "solana-wallet") {
|
|
5468
6329
|
return;
|
|
5469
6330
|
}
|
|
@@ -5472,14 +6333,15 @@ function DepositFlow({
|
|
|
5472
6333
|
storeApi.dispatch({ type: "flow/step-set", step: "connect" });
|
|
5473
6334
|
}
|
|
5474
6335
|
}, [enableSolana, flowMode, storeApi]);
|
|
5475
|
-
|
|
5476
|
-
if (hasNavigatedBack || isConnectSelectionConfirmed || flowMode) {
|
|
6336
|
+
useEffect10(() => {
|
|
6337
|
+
if (hasNavigatedBack || isConnectSelectionConfirmed || flowMode || enableFiatOnramp || enableExchangeConnect) {
|
|
5477
6338
|
return;
|
|
5478
6339
|
}
|
|
5479
|
-
if (!hasWalletOptions && dappAddress && !hasReownSession && !dappWalletClient && hasQrAutoAdvanceGraceElapsed) {
|
|
6340
|
+
if (enableQrTransfer && !hasWalletOptions && dappAddress && !hasReownSession && !dappWalletClient && hasQrAutoAdvanceGraceElapsed) {
|
|
5480
6341
|
handleSelectTransferCrypto();
|
|
5481
6342
|
}
|
|
5482
6343
|
}, [
|
|
6344
|
+
enableQrTransfer,
|
|
5483
6345
|
hasWalletOptions,
|
|
5484
6346
|
hasReownSession,
|
|
5485
6347
|
hasQrAutoAdvanceGraceElapsed,
|
|
@@ -5490,7 +6352,7 @@ function DepositFlow({
|
|
|
5490
6352
|
dappWalletClient,
|
|
5491
6353
|
handleSelectTransferCrypto
|
|
5492
6354
|
]);
|
|
5493
|
-
const walletRows =
|
|
6355
|
+
const walletRows = useMemo7(() => {
|
|
5494
6356
|
return walletOptions.map((option) => {
|
|
5495
6357
|
const ownerForRow = option.kind === "solana" ? dappAddress : option.address ?? null;
|
|
5496
6358
|
const entry = readSetupForOwner(setupSlice, ownerForRow ?? null);
|
|
@@ -5506,25 +6368,25 @@ function DepositFlow({
|
|
|
5506
6368
|
};
|
|
5507
6369
|
});
|
|
5508
6370
|
}, [walletOptions, setupSlice, dappAddress]);
|
|
5509
|
-
const transferCryptoEntry =
|
|
6371
|
+
const transferCryptoEntry = useMemo7(
|
|
5510
6372
|
() => readSetupForOwner(setupSlice, dappAddress),
|
|
5511
6373
|
[setupSlice, dappAddress]
|
|
5512
6374
|
);
|
|
5513
6375
|
const transferCryptoState = transferCryptoEntry.status === "ready" ? "ready" : transferCryptoEntry.status === "error" ? "error" : "loading";
|
|
5514
|
-
const handleRetrySetup =
|
|
6376
|
+
const handleRetrySetup = useCallback7(
|
|
5515
6377
|
(owner) => {
|
|
5516
6378
|
storeApi.dispatch({ type: "setup/retry-requested", owner });
|
|
5517
6379
|
},
|
|
5518
6380
|
[storeApi]
|
|
5519
6381
|
);
|
|
5520
6382
|
if (showConnectStep) {
|
|
5521
|
-
return /* @__PURE__ */
|
|
6383
|
+
return /* @__PURE__ */ jsx17("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx17(
|
|
5522
6384
|
ConnectStep,
|
|
5523
6385
|
{
|
|
5524
6386
|
walletRows,
|
|
5525
6387
|
transferCryptoState: dappAddress ? transferCryptoState : void 0,
|
|
5526
6388
|
transferCryptoErrorReason: dappAddress ? transferCryptoEntry.message ?? void 0 : void 0,
|
|
5527
|
-
onSelectTransferCrypto: dappAddress ? () => {
|
|
6389
|
+
onSelectTransferCrypto: enableQrTransfer && dappAddress ? () => {
|
|
5528
6390
|
if (transferCryptoState === "error") {
|
|
5529
6391
|
handleRetrySetup(dappAddress);
|
|
5530
6392
|
return;
|
|
@@ -5532,6 +6394,10 @@ function DepositFlow({
|
|
|
5532
6394
|
if (transferCryptoState !== "ready") return;
|
|
5533
6395
|
handleSelectTransferCrypto();
|
|
5534
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,
|
|
5535
6401
|
onRequestConnect,
|
|
5536
6402
|
onConnect,
|
|
5537
6403
|
onDisconnect,
|
|
@@ -5565,21 +6431,21 @@ function DepositFlow({
|
|
|
5565
6431
|
}
|
|
5566
6432
|
if (isDepositAddressMode) {
|
|
5567
6433
|
if (!dappAddress) return null;
|
|
5568
|
-
return /* @__PURE__ */
|
|
5569
|
-
effectiveStep.type === "setup" && (activeEntry.status === "error" ? /* @__PURE__ */
|
|
6434
|
+
return /* @__PURE__ */ jsxs15("div", { className: "rs-modal-body", children: [
|
|
6435
|
+
effectiveStep.type === "setup" && (activeEntry.status === "error" ? /* @__PURE__ */ jsx17(
|
|
5570
6436
|
AccountPreparingSkeleton,
|
|
5571
6437
|
{
|
|
5572
6438
|
errorMessage: activeEntry.message ?? void 0,
|
|
5573
6439
|
onRetry: () => handleRetrySetup(dappAddress)
|
|
5574
6440
|
}
|
|
5575
|
-
) : /* @__PURE__ */
|
|
6441
|
+
) : /* @__PURE__ */ jsx17(
|
|
5576
6442
|
DepositAddressSkeleton,
|
|
5577
6443
|
{
|
|
5578
6444
|
uiConfig,
|
|
5579
6445
|
allowedRoutes
|
|
5580
6446
|
}
|
|
5581
6447
|
)),
|
|
5582
|
-
effectiveStep.type === "deposit-address" && /* @__PURE__ */
|
|
6448
|
+
effectiveStep.type === "deposit-address" && /* @__PURE__ */ jsx17(
|
|
5583
6449
|
DepositAddressStep,
|
|
5584
6450
|
{
|
|
5585
6451
|
smartAccount: effectiveStep.smartAccount,
|
|
@@ -5611,19 +6477,141 @@ function DepositFlow({
|
|
|
5611
6477
|
)
|
|
5612
6478
|
] });
|
|
5613
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
|
+
}
|
|
5614
6602
|
if (isSolanaWalletMode) {
|
|
5615
6603
|
if (!dappAddress) return null;
|
|
5616
6604
|
const solanaAddr = reownWallet?.solanaAddress;
|
|
5617
6605
|
const solanaProvider = reownWallet?.solanaProvider;
|
|
5618
|
-
return /* @__PURE__ */
|
|
5619
|
-
effectiveStep.type === "setup" && /* @__PURE__ */
|
|
6606
|
+
return /* @__PURE__ */ jsxs15("div", { className: "rs-modal-body", children: [
|
|
6607
|
+
effectiveStep.type === "setup" && /* @__PURE__ */ jsx17(
|
|
5620
6608
|
AccountPreparingSkeleton,
|
|
5621
6609
|
{
|
|
5622
6610
|
errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
|
|
5623
6611
|
onRetry: activeEntry.status === "error" ? () => handleRetrySetup(dappAddress) : void 0
|
|
5624
6612
|
}
|
|
5625
6613
|
),
|
|
5626
|
-
effectiveStep.type === "solana-token-select" && solanaAddr && /* @__PURE__ */
|
|
6614
|
+
effectiveStep.type === "solana-token-select" && solanaAddr && /* @__PURE__ */ jsx17(
|
|
5627
6615
|
SolanaTokenSelectStep,
|
|
5628
6616
|
{
|
|
5629
6617
|
solanaAddress: solanaAddr,
|
|
@@ -5637,7 +6625,7 @@ function DepositFlow({
|
|
|
5637
6625
|
debug
|
|
5638
6626
|
}
|
|
5639
6627
|
),
|
|
5640
|
-
effectiveStep.type === "solana-amount" && /* @__PURE__ */
|
|
6628
|
+
effectiveStep.type === "solana-amount" && /* @__PURE__ */ jsx17(
|
|
5641
6629
|
SolanaAmountStep,
|
|
5642
6630
|
{
|
|
5643
6631
|
token: effectiveStep.token,
|
|
@@ -5655,7 +6643,7 @@ function DepositFlow({
|
|
|
5655
6643
|
debug
|
|
5656
6644
|
}
|
|
5657
6645
|
),
|
|
5658
|
-
effectiveStep.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */
|
|
6646
|
+
effectiveStep.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */ jsx17(
|
|
5659
6647
|
SolanaConfirmStep,
|
|
5660
6648
|
{
|
|
5661
6649
|
smartAccount: effectiveStep.smartAccount,
|
|
@@ -5676,16 +6664,16 @@ function DepositFlow({
|
|
|
5676
6664
|
onError: handleError,
|
|
5677
6665
|
debug
|
|
5678
6666
|
}
|
|
5679
|
-
) : effectiveStep.type === "solana-confirm" ? /* @__PURE__ */
|
|
5680
|
-
/* @__PURE__ */
|
|
5681
|
-
/* @__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(
|
|
5682
6670
|
"svg",
|
|
5683
6671
|
{
|
|
5684
6672
|
viewBox: "0 0 24 24",
|
|
5685
6673
|
fill: "none",
|
|
5686
6674
|
stroke: "currentColor",
|
|
5687
6675
|
strokeWidth: "2",
|
|
5688
|
-
children: /* @__PURE__ */
|
|
6676
|
+
children: /* @__PURE__ */ jsx17(
|
|
5689
6677
|
"path",
|
|
5690
6678
|
{
|
|
5691
6679
|
strokeLinecap: "round",
|
|
@@ -5695,22 +6683,22 @@ function DepositFlow({
|
|
|
5695
6683
|
)
|
|
5696
6684
|
}
|
|
5697
6685
|
) }),
|
|
5698
|
-
/* @__PURE__ */
|
|
5699
|
-
/* @__PURE__ */
|
|
5700
|
-
/* @__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." })
|
|
5701
6689
|
] })
|
|
5702
6690
|
] }),
|
|
5703
|
-
/* @__PURE__ */
|
|
6691
|
+
/* @__PURE__ */ jsx17("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx17(
|
|
5704
6692
|
"button",
|
|
5705
6693
|
{
|
|
5706
6694
|
type: "button",
|
|
5707
6695
|
className: "rs-button rs-button--default rs-button--full-width",
|
|
5708
6696
|
onClick: handleBack,
|
|
5709
|
-
children: /* @__PURE__ */
|
|
6697
|
+
children: /* @__PURE__ */ jsx17("span", { children: "Go Back" })
|
|
5710
6698
|
}
|
|
5711
6699
|
) })
|
|
5712
6700
|
] }) : null,
|
|
5713
|
-
effectiveStep.type === "processing" && /* @__PURE__ */
|
|
6701
|
+
effectiveStep.type === "processing" && /* @__PURE__ */ jsx17(
|
|
5714
6702
|
ProcessingStep,
|
|
5715
6703
|
{
|
|
5716
6704
|
smartAccount: effectiveStep.smartAccount,
|
|
@@ -5737,7 +6725,7 @@ function DepositFlow({
|
|
|
5737
6725
|
] });
|
|
5738
6726
|
}
|
|
5739
6727
|
if (!signerContext?.walletClient || !signerContext?.publicClient) {
|
|
5740
|
-
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" }) }) }) }) });
|
|
5741
6729
|
}
|
|
5742
6730
|
const ownerAddress = signerContext.ownerAddress;
|
|
5743
6731
|
const ownerChainId = signerContext.walletClient?.chain?.id ?? signerContext.publicClient.chain?.id ?? setupChainId;
|
|
@@ -5747,15 +6735,15 @@ function DepositFlow({
|
|
|
5747
6735
|
}
|
|
5748
6736
|
return getPublicClient(chainId);
|
|
5749
6737
|
};
|
|
5750
|
-
return /* @__PURE__ */
|
|
5751
|
-
effectiveStep.type === "setup" && /* @__PURE__ */
|
|
6738
|
+
return /* @__PURE__ */ jsxs15("div", { className: "rs-modal-body", children: [
|
|
6739
|
+
effectiveStep.type === "setup" && /* @__PURE__ */ jsx17(
|
|
5752
6740
|
AccountPreparingSkeleton,
|
|
5753
6741
|
{
|
|
5754
6742
|
errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
|
|
5755
6743
|
onRetry: activeEntry.status === "error" ? () => handleRetrySetup(ownerAddress) : void 0
|
|
5756
6744
|
}
|
|
5757
6745
|
),
|
|
5758
|
-
effectiveStep.type === "select-asset" && /* @__PURE__ */
|
|
6746
|
+
effectiveStep.type === "select-asset" && /* @__PURE__ */ jsx17(
|
|
5759
6747
|
AssetSelectStep,
|
|
5760
6748
|
{
|
|
5761
6749
|
address: ownerAddress,
|
|
@@ -5773,7 +6761,7 @@ function DepositFlow({
|
|
|
5773
6761
|
} : void 0
|
|
5774
6762
|
}
|
|
5775
6763
|
),
|
|
5776
|
-
effectiveStep.type === "dapp-import-asset-select" && activeDappImportProvider && activeDappImportAvailability && /* @__PURE__ */
|
|
6764
|
+
effectiveStep.type === "dapp-import-asset-select" && activeDappImportProvider && activeDappImportAvailability && /* @__PURE__ */ jsx17(
|
|
5777
6765
|
DappImportAssetSelectStep,
|
|
5778
6766
|
{
|
|
5779
6767
|
sourceLabel: activeDappImportAvailability.assets[0]?.sourceLabel ?? activeDappImportProvider.label,
|
|
@@ -5781,7 +6769,7 @@ function DepositFlow({
|
|
|
5781
6769
|
onSelect: handleDappImportAssetSelected
|
|
5782
6770
|
}
|
|
5783
6771
|
),
|
|
5784
|
-
effectiveStep.type === "amount" && /* @__PURE__ */
|
|
6772
|
+
effectiveStep.type === "amount" && /* @__PURE__ */ jsx17(
|
|
5785
6773
|
AmountStep,
|
|
5786
6774
|
{
|
|
5787
6775
|
walletClient: signerContext.walletClient,
|
|
@@ -5813,7 +6801,7 @@ function DepositFlow({
|
|
|
5813
6801
|
}
|
|
5814
6802
|
}
|
|
5815
6803
|
),
|
|
5816
|
-
effectiveStep.type === "confirm" && /* @__PURE__ */
|
|
6804
|
+
effectiveStep.type === "confirm" && /* @__PURE__ */ jsx17(
|
|
5817
6805
|
ConfirmStep,
|
|
5818
6806
|
{
|
|
5819
6807
|
walletClient: signerContext.walletClient,
|
|
@@ -5853,7 +6841,7 @@ function DepositFlow({
|
|
|
5853
6841
|
onError: handleError
|
|
5854
6842
|
}
|
|
5855
6843
|
),
|
|
5856
|
-
effectiveStep.type === "processing" && /* @__PURE__ */
|
|
6844
|
+
effectiveStep.type === "processing" && /* @__PURE__ */ jsx17(
|
|
5857
6845
|
ProcessingStep,
|
|
5858
6846
|
{
|
|
5859
6847
|
smartAccount: effectiveStep.smartAccount,
|
|
@@ -5883,8 +6871,8 @@ function DepositFlow({
|
|
|
5883
6871
|
}
|
|
5884
6872
|
|
|
5885
6873
|
// src/components/history/DepositHistoryPanel.tsx
|
|
5886
|
-
import { useCallback as
|
|
5887
|
-
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";
|
|
5888
6876
|
function shortenHash(hash) {
|
|
5889
6877
|
if (hash.length <= 14) return hash;
|
|
5890
6878
|
return `${hash.slice(0, 6)}\u2026${hash.slice(-4)}`;
|
|
@@ -5994,7 +6982,7 @@ function DepositHistoryPanel({
|
|
|
5994
6982
|
onClose,
|
|
5995
6983
|
onCloseModal
|
|
5996
6984
|
}) {
|
|
5997
|
-
const handleKeyDown =
|
|
6985
|
+
const handleKeyDown = useCallback8(
|
|
5998
6986
|
(e) => {
|
|
5999
6987
|
if (e.key === "Escape") {
|
|
6000
6988
|
e.stopPropagation();
|
|
@@ -6003,7 +6991,7 @@ function DepositHistoryPanel({
|
|
|
6003
6991
|
},
|
|
6004
6992
|
[onClose]
|
|
6005
6993
|
);
|
|
6006
|
-
const visibleDeposits =
|
|
6994
|
+
const visibleDeposits = useMemo8(() => {
|
|
6007
6995
|
const sourceHashes = new Set(
|
|
6008
6996
|
deposits.map((d) => d.sourceTxHash?.toLowerCase()).filter((h) => Boolean(h))
|
|
6009
6997
|
);
|
|
@@ -6011,7 +6999,7 @@ function DepositHistoryPanel({
|
|
|
6011
6999
|
(d) => !(d.txHash && sourceHashes.has(d.txHash.toLowerCase()))
|
|
6012
7000
|
);
|
|
6013
7001
|
}, [deposits]);
|
|
6014
|
-
return /* @__PURE__ */
|
|
7002
|
+
return /* @__PURE__ */ jsxs16(
|
|
6015
7003
|
"div",
|
|
6016
7004
|
{
|
|
6017
7005
|
className: "rs-history-panel",
|
|
@@ -6019,55 +7007,55 @@ function DepositHistoryPanel({
|
|
|
6019
7007
|
"aria-label": "Deposit history",
|
|
6020
7008
|
onKeyDown: handleKeyDown,
|
|
6021
7009
|
children: [
|
|
6022
|
-
/* @__PURE__ */
|
|
6023
|
-
/* @__PURE__ */
|
|
7010
|
+
/* @__PURE__ */ jsxs16("div", { className: "rs-modal-header--redesigned", children: [
|
|
7011
|
+
/* @__PURE__ */ jsx18("div", { className: "rs-modal-header-nav-left", children: /* @__PURE__ */ jsx18(
|
|
6024
7012
|
"button",
|
|
6025
7013
|
{
|
|
6026
7014
|
type: "button",
|
|
6027
7015
|
className: "rs-modal-header-back",
|
|
6028
7016
|
"aria-label": "Back",
|
|
6029
7017
|
onClick: onClose,
|
|
6030
|
-
children: /* @__PURE__ */
|
|
7018
|
+
children: /* @__PURE__ */ jsx18(ChevronLeftIcon, {})
|
|
6031
7019
|
}
|
|
6032
7020
|
) }),
|
|
6033
|
-
/* @__PURE__ */
|
|
7021
|
+
/* @__PURE__ */ jsx18("div", { className: "rs-modal-header-nav-right", children: onCloseModal && /* @__PURE__ */ jsx18(
|
|
6034
7022
|
"button",
|
|
6035
7023
|
{
|
|
6036
7024
|
type: "button",
|
|
6037
7025
|
className: "rs-modal-close",
|
|
6038
7026
|
"aria-label": "Close",
|
|
6039
7027
|
onClick: onCloseModal,
|
|
6040
|
-
children: /* @__PURE__ */
|
|
7028
|
+
children: /* @__PURE__ */ jsx18(CloseIcon, {})
|
|
6041
7029
|
}
|
|
6042
7030
|
) })
|
|
6043
7031
|
] }),
|
|
6044
|
-
/* @__PURE__ */
|
|
6045
|
-
/* @__PURE__ */
|
|
6046
|
-
/* @__PURE__ */
|
|
6047
|
-
isLoading && deposits.length === 0 && /* @__PURE__ */
|
|
6048
|
-
/* @__PURE__ */
|
|
6049
|
-
/* @__PURE__ */
|
|
6050
|
-
/* @__PURE__ */
|
|
6051
|
-
/* @__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" })
|
|
6052
7040
|
] })
|
|
6053
7041
|
] }),
|
|
6054
|
-
error && !isLoading && /* @__PURE__ */
|
|
6055
|
-
/* @__PURE__ */
|
|
6056
|
-
/* @__PURE__ */
|
|
6057
|
-
/* @__PURE__ */
|
|
6058
|
-
/* @__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 })
|
|
6059
7047
|
] })
|
|
6060
7048
|
] }),
|
|
6061
|
-
!isLoading && !error && visibleDeposits.length === 0 && /* @__PURE__ */
|
|
6062
|
-
/* @__PURE__ */
|
|
6063
|
-
/* @__PURE__ */
|
|
6064
|
-
/* @__PURE__ */
|
|
6065
|
-
/* @__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" })
|
|
6066
7054
|
] })
|
|
6067
7055
|
] }),
|
|
6068
|
-
visibleDeposits.length > 0 && /* @__PURE__ */
|
|
6069
|
-
visibleDeposits.map((deposit, i) => /* @__PURE__ */
|
|
6070
|
-
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(
|
|
6071
7059
|
"button",
|
|
6072
7060
|
{
|
|
6073
7061
|
type: "button",
|
|
@@ -6079,14 +7067,14 @@ function DepositHistoryPanel({
|
|
|
6079
7067
|
)
|
|
6080
7068
|
] })
|
|
6081
7069
|
] }),
|
|
6082
|
-
/* @__PURE__ */
|
|
7070
|
+
/* @__PURE__ */ jsx18(PoweredBy, {})
|
|
6083
7071
|
] })
|
|
6084
7072
|
]
|
|
6085
7073
|
}
|
|
6086
7074
|
);
|
|
6087
7075
|
}
|
|
6088
7076
|
function HistoryCard({ deposit }) {
|
|
6089
|
-
const [expanded, setExpanded] =
|
|
7077
|
+
const [expanded, setExpanded] = useState12(false);
|
|
6090
7078
|
const status = normalizeStatus(deposit.status, deposit.isSpam);
|
|
6091
7079
|
const sourceChainId = resolveChainId(deposit.chain);
|
|
6092
7080
|
const targetChainId = resolveChainId(deposit.targetChain);
|
|
@@ -6105,7 +7093,7 @@ function HistoryCard({ deposit }) {
|
|
|
6105
7093
|
const date = deposit.createdAt ? formatDate(deposit.createdAt) : null;
|
|
6106
7094
|
const txTypeLabel = `Deposit${sourceSymbol ? ` ${sourceSymbol}` : ""}`;
|
|
6107
7095
|
const srcTxUrl = deposit.sourceTxHash ? getTxExplorerUrl(deposit.sourceTxHash, sourceChainId) : null;
|
|
6108
|
-
return /* @__PURE__ */
|
|
7096
|
+
return /* @__PURE__ */ jsxs16(
|
|
6109
7097
|
"button",
|
|
6110
7098
|
{
|
|
6111
7099
|
type: "button",
|
|
@@ -6113,38 +7101,38 @@ function HistoryCard({ deposit }) {
|
|
|
6113
7101
|
onClick: () => setExpanded((v) => !v),
|
|
6114
7102
|
"aria-expanded": expanded,
|
|
6115
7103
|
children: [
|
|
6116
|
-
/* @__PURE__ */
|
|
6117
|
-
/* @__PURE__ */
|
|
6118
|
-
/* @__PURE__ */
|
|
6119
|
-
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: "" }) })
|
|
6120
7108
|
] }),
|
|
6121
|
-
/* @__PURE__ */
|
|
6122
|
-
/* @__PURE__ */
|
|
6123
|
-
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 })
|
|
6124
7112
|
] }),
|
|
6125
|
-
/* @__PURE__ */
|
|
6126
|
-
/* @__PURE__ */
|
|
6127
|
-
/* @__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] })
|
|
6128
7116
|
] })
|
|
6129
7117
|
] }),
|
|
6130
|
-
/* @__PURE__ */
|
|
6131
|
-
sourceChainName && /* @__PURE__ */
|
|
6132
|
-
/* @__PURE__ */
|
|
6133
|
-
/* @__PURE__ */
|
|
6134
|
-
/* @__PURE__ */
|
|
6135
|
-
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: "" }) })
|
|
6136
7124
|
] })
|
|
6137
7125
|
] }),
|
|
6138
|
-
targetChainName && /* @__PURE__ */
|
|
6139
|
-
/* @__PURE__ */
|
|
6140
|
-
/* @__PURE__ */
|
|
6141
|
-
/* @__PURE__ */
|
|
6142
|
-
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: "" }) })
|
|
6143
7131
|
] })
|
|
6144
7132
|
] }),
|
|
6145
|
-
srcTxUrl && deposit.sourceTxHash && /* @__PURE__ */
|
|
6146
|
-
/* @__PURE__ */
|
|
6147
|
-
/* @__PURE__ */
|
|
7133
|
+
srcTxUrl && deposit.sourceTxHash && /* @__PURE__ */ jsxs16("div", { className: "rs-amount-detail-row", children: [
|
|
7134
|
+
/* @__PURE__ */ jsx18("span", { children: "Transaction details" }),
|
|
7135
|
+
/* @__PURE__ */ jsxs16(
|
|
6148
7136
|
"a",
|
|
6149
7137
|
{
|
|
6150
7138
|
href: srcTxUrl,
|
|
@@ -6153,8 +7141,8 @@ function HistoryCard({ deposit }) {
|
|
|
6153
7141
|
className: "rs-history-card-link",
|
|
6154
7142
|
onClick: (e) => e.stopPropagation(),
|
|
6155
7143
|
children: [
|
|
6156
|
-
/* @__PURE__ */
|
|
6157
|
-
/* @__PURE__ */
|
|
7144
|
+
/* @__PURE__ */ jsx18("span", { children: shortenHash(deposit.sourceTxHash) }),
|
|
7145
|
+
/* @__PURE__ */ jsx18(ArrowUpRightIcon, {})
|
|
6158
7146
|
]
|
|
6159
7147
|
}
|
|
6160
7148
|
)
|
|
@@ -6167,9 +7155,9 @@ function HistoryCard({ deposit }) {
|
|
|
6167
7155
|
DepositHistoryPanel.displayName = "DepositHistoryPanel";
|
|
6168
7156
|
|
|
6169
7157
|
// src/DepositModal.tsx
|
|
6170
|
-
import { jsx as
|
|
7158
|
+
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6171
7159
|
var ReownDepositInner = lazy2(
|
|
6172
|
-
() => import("./DepositModalReown-
|
|
7160
|
+
() => import("./DepositModalReown-HBAWSK6K.mjs").then((m) => ({ default: m.DepositModalReown }))
|
|
6173
7161
|
);
|
|
6174
7162
|
function sortByCreatedAtDesc(items) {
|
|
6175
7163
|
return [...items].sort((a, b) => {
|
|
@@ -6185,7 +7173,7 @@ function DepositModal(props) {
|
|
|
6185
7173
|
"dappWalletClient"
|
|
6186
7174
|
);
|
|
6187
7175
|
if (needsReown) {
|
|
6188
|
-
return /* @__PURE__ */
|
|
7176
|
+
return /* @__PURE__ */ jsx19(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx19(
|
|
6189
7177
|
ReownDepositInner,
|
|
6190
7178
|
{
|
|
6191
7179
|
...props,
|
|
@@ -6193,7 +7181,7 @@ function DepositModal(props) {
|
|
|
6193
7181
|
}
|
|
6194
7182
|
) });
|
|
6195
7183
|
}
|
|
6196
|
-
return /* @__PURE__ */
|
|
7184
|
+
return /* @__PURE__ */ jsx19(
|
|
6197
7185
|
DepositModalInner,
|
|
6198
7186
|
{
|
|
6199
7187
|
...props,
|
|
@@ -6225,6 +7213,10 @@ function DepositModalInner({
|
|
|
6225
7213
|
forceRegister = false,
|
|
6226
7214
|
enableSolana = true,
|
|
6227
7215
|
dappImports,
|
|
7216
|
+
enableFiatOnramp = false,
|
|
7217
|
+
enableQrTransfer = true,
|
|
7218
|
+
fiatOnrampMethods,
|
|
7219
|
+
enableExchangeConnect = false,
|
|
6228
7220
|
postBridgeActions,
|
|
6229
7221
|
outputTokenRules,
|
|
6230
7222
|
rejectUnmapped,
|
|
@@ -6242,61 +7234,61 @@ function DepositModalInner({
|
|
|
6242
7234
|
onError,
|
|
6243
7235
|
debug
|
|
6244
7236
|
}) {
|
|
6245
|
-
const modalRef =
|
|
7237
|
+
const modalRef = useRef9(null);
|
|
6246
7238
|
const onReadyRef = useLatestRef(onReady);
|
|
6247
|
-
const [currentScreen, setCurrentScreen] =
|
|
6248
|
-
const [backHandler, setBackHandler] =
|
|
7239
|
+
const [currentScreen, setCurrentScreen] = useState13("connect");
|
|
7240
|
+
const [backHandler, setBackHandler] = useState13(
|
|
6249
7241
|
void 0
|
|
6250
7242
|
);
|
|
6251
7243
|
const showHistoryButton = uiConfig?.showHistoryButton ?? false;
|
|
6252
7244
|
const historyButtonVisible = showHistoryButton && (currentScreen === "select-asset" || currentScreen === "deposit-address");
|
|
6253
|
-
const [historyOpen, setHistoryOpen] =
|
|
6254
|
-
const [historyDeposits, setHistoryDeposits] =
|
|
6255
|
-
const [hasMoreHistory, setHasMoreHistory] =
|
|
6256
|
-
const [historyLoading, setHistoryLoading] =
|
|
6257
|
-
const [historyLoadingMore, setHistoryLoadingMore] =
|
|
6258
|
-
const [historyError, setHistoryError] =
|
|
6259
|
-
const cursorRef =
|
|
6260
|
-
const historyStaleRef =
|
|
6261
|
-
const historyLoadedRef =
|
|
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);
|
|
6262
7254
|
const targetChain = targetChainProp === "solana" ? "solana" : getChainId(targetChainProp);
|
|
6263
7255
|
const sourceChain = sourceChainProp ? getChainId(sourceChainProp) : void 0;
|
|
6264
|
-
const service =
|
|
7256
|
+
const service = useMemo9(
|
|
6265
7257
|
() => createDepositService(backendUrl, {
|
|
6266
7258
|
debug,
|
|
6267
7259
|
debugScope: "service:deposit"
|
|
6268
7260
|
}),
|
|
6269
7261
|
[backendUrl, debug]
|
|
6270
7262
|
);
|
|
6271
|
-
const store =
|
|
7263
|
+
const store = useMemo9(
|
|
6272
7264
|
() => createDepositStore({ targetChain, targetToken }),
|
|
6273
7265
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6274
7266
|
[]
|
|
6275
7267
|
);
|
|
6276
|
-
|
|
7268
|
+
useEffect11(() => {
|
|
6277
7269
|
store.dispatch({ type: "target/changed", targetChain, targetToken });
|
|
6278
7270
|
}, [store, targetChain, targetToken]);
|
|
6279
|
-
|
|
7271
|
+
useEffect11(() => {
|
|
6280
7272
|
if (isOpen && modalRef.current) {
|
|
6281
7273
|
applyTheme(modalRef.current, theme);
|
|
6282
7274
|
}
|
|
6283
7275
|
}, [isOpen, theme]);
|
|
6284
|
-
|
|
7276
|
+
useEffect11(() => {
|
|
6285
7277
|
configureSolanaRpcUrl(solanaRpcUrl);
|
|
6286
7278
|
}, [solanaRpcUrl]);
|
|
6287
|
-
|
|
7279
|
+
useEffect11(() => {
|
|
6288
7280
|
if (isOpen) {
|
|
6289
7281
|
onReadyRef.current?.();
|
|
6290
7282
|
}
|
|
6291
7283
|
}, [isOpen, onReadyRef]);
|
|
6292
|
-
const handleStepChange =
|
|
7284
|
+
const handleStepChange = useCallback9(
|
|
6293
7285
|
(onBack, screen) => {
|
|
6294
7286
|
setBackHandler(() => onBack);
|
|
6295
7287
|
if (screen) setCurrentScreen(screen);
|
|
6296
7288
|
},
|
|
6297
7289
|
[]
|
|
6298
7290
|
);
|
|
6299
|
-
const fetchHistory =
|
|
7291
|
+
const fetchHistory = useCallback9(
|
|
6300
7292
|
async (mode = "initial") => {
|
|
6301
7293
|
if (!recipient) return;
|
|
6302
7294
|
const isInitial = mode === "initial";
|
|
@@ -6344,26 +7336,26 @@ function DepositModalInner({
|
|
|
6344
7336
|
},
|
|
6345
7337
|
[recipient, service]
|
|
6346
7338
|
);
|
|
6347
|
-
const handleHistoryOpen =
|
|
7339
|
+
const handleHistoryOpen = useCallback9(() => {
|
|
6348
7340
|
setHistoryOpen(true);
|
|
6349
7341
|
if (!historyLoadedRef.current || historyStaleRef.current) {
|
|
6350
7342
|
fetchHistory("initial");
|
|
6351
7343
|
}
|
|
6352
7344
|
}, [fetchHistory]);
|
|
6353
|
-
const handleHistoryClose =
|
|
7345
|
+
const handleHistoryClose = useCallback9(() => {
|
|
6354
7346
|
setHistoryOpen(false);
|
|
6355
7347
|
}, []);
|
|
6356
|
-
const handleHistoryLoadMore =
|
|
7348
|
+
const handleHistoryLoadMore = useCallback9(() => {
|
|
6357
7349
|
fetchHistory("more");
|
|
6358
7350
|
}, [fetchHistory]);
|
|
6359
|
-
const markHistoryStale =
|
|
7351
|
+
const markHistoryStale = useCallback9(() => {
|
|
6360
7352
|
historyStaleRef.current = true;
|
|
6361
7353
|
if (historyOpen) {
|
|
6362
7354
|
fetchHistory("initial");
|
|
6363
7355
|
}
|
|
6364
7356
|
}, [historyOpen, fetchHistory]);
|
|
6365
7357
|
const onLifecycleRef = useLatestRef(onLifecycle);
|
|
6366
|
-
const handleLifecycle =
|
|
7358
|
+
const handleLifecycle = useCallback9(
|
|
6367
7359
|
(event) => {
|
|
6368
7360
|
onLifecycleRef.current?.(event);
|
|
6369
7361
|
if (event.type === "smart-account-changed" && !event.evm && !event.solana) {
|
|
@@ -6375,7 +7367,7 @@ function DepositModalInner({
|
|
|
6375
7367
|
},
|
|
6376
7368
|
[onLifecycleRef, showHistoryButton, markHistoryStale]
|
|
6377
7369
|
);
|
|
6378
|
-
|
|
7370
|
+
useEffect11(() => {
|
|
6379
7371
|
if (!isOpen) {
|
|
6380
7372
|
setHistoryOpen(false);
|
|
6381
7373
|
setHistoryDeposits([]);
|
|
@@ -6386,14 +7378,14 @@ function DepositModalInner({
|
|
|
6386
7378
|
historyLoadedRef.current = false;
|
|
6387
7379
|
}
|
|
6388
7380
|
}, [isOpen]);
|
|
6389
|
-
|
|
7381
|
+
useEffect11(() => {
|
|
6390
7382
|
if (!isOpen) {
|
|
6391
7383
|
store.dispatch({ type: "flow/reset" });
|
|
6392
7384
|
}
|
|
6393
7385
|
}, [isOpen, store]);
|
|
6394
7386
|
const showBackButton = uiConfig?.showBackButton ?? true;
|
|
6395
7387
|
const canGoBack = backHandler !== void 0;
|
|
6396
|
-
return /* @__PURE__ */
|
|
7388
|
+
return /* @__PURE__ */ jsx19(DepositStoreProvider, { store, children: /* @__PURE__ */ jsx19(
|
|
6397
7389
|
Modal,
|
|
6398
7390
|
{
|
|
6399
7391
|
isOpen,
|
|
@@ -6401,20 +7393,20 @@ function DepositModalInner({
|
|
|
6401
7393
|
className,
|
|
6402
7394
|
inline,
|
|
6403
7395
|
closeOnOverlayClick,
|
|
6404
|
-
children: /* @__PURE__ */
|
|
6405
|
-
/* @__PURE__ */
|
|
6406
|
-
/* @__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(
|
|
6407
7399
|
"button",
|
|
6408
7400
|
{
|
|
6409
7401
|
type: "button",
|
|
6410
7402
|
className: "rs-modal-header-back",
|
|
6411
7403
|
"aria-label": "Go back",
|
|
6412
7404
|
onClick: backHandler,
|
|
6413
|
-
children: /* @__PURE__ */
|
|
7405
|
+
children: /* @__PURE__ */ jsx19(ChevronLeftIcon, {})
|
|
6414
7406
|
}
|
|
6415
7407
|
) }),
|
|
6416
|
-
/* @__PURE__ */
|
|
6417
|
-
historyButtonVisible && /* @__PURE__ */
|
|
7408
|
+
/* @__PURE__ */ jsxs17("div", { className: "rs-modal-header-nav-right", children: [
|
|
7409
|
+
historyButtonVisible && /* @__PURE__ */ jsx19(
|
|
6418
7410
|
"button",
|
|
6419
7411
|
{
|
|
6420
7412
|
type: "button",
|
|
@@ -6422,22 +7414,22 @@ function DepositModalInner({
|
|
|
6422
7414
|
"aria-label": "Deposit history",
|
|
6423
7415
|
onClick: handleHistoryOpen,
|
|
6424
7416
|
disabled: !recipient,
|
|
6425
|
-
children: /* @__PURE__ */
|
|
7417
|
+
children: /* @__PURE__ */ jsx19(HistoryIcon, {})
|
|
6426
7418
|
}
|
|
6427
7419
|
),
|
|
6428
|
-
/* @__PURE__ */
|
|
7420
|
+
/* @__PURE__ */ jsx19(
|
|
6429
7421
|
"button",
|
|
6430
7422
|
{
|
|
6431
7423
|
type: "button",
|
|
6432
7424
|
onClick: onClose,
|
|
6433
7425
|
className: "rs-modal-close",
|
|
6434
7426
|
"aria-label": "Close",
|
|
6435
|
-
children: /* @__PURE__ */
|
|
7427
|
+
children: /* @__PURE__ */ jsx19(CloseIcon, {})
|
|
6436
7428
|
}
|
|
6437
7429
|
)
|
|
6438
7430
|
] })
|
|
6439
7431
|
] }),
|
|
6440
|
-
/* @__PURE__ */
|
|
7432
|
+
/* @__PURE__ */ jsx19(
|
|
6441
7433
|
DepositFlow,
|
|
6442
7434
|
{
|
|
6443
7435
|
dappWalletClient,
|
|
@@ -6460,6 +7452,10 @@ function DepositModalInner({
|
|
|
6460
7452
|
forceRegister,
|
|
6461
7453
|
enableSolana,
|
|
6462
7454
|
dappImports,
|
|
7455
|
+
enableFiatOnramp,
|
|
7456
|
+
enableQrTransfer,
|
|
7457
|
+
fiatOnrampMethods,
|
|
7458
|
+
enableExchangeConnect,
|
|
6463
7459
|
reownWallet,
|
|
6464
7460
|
onConnect,
|
|
6465
7461
|
onDisconnect,
|
|
@@ -6474,7 +7470,7 @@ function DepositModalInner({
|
|
|
6474
7470
|
debug
|
|
6475
7471
|
}
|
|
6476
7472
|
),
|
|
6477
|
-
showHistoryButton && historyOpen && /* @__PURE__ */
|
|
7473
|
+
showHistoryButton && historyOpen && /* @__PURE__ */ jsx19(
|
|
6478
7474
|
DepositHistoryPanel,
|
|
6479
7475
|
{
|
|
6480
7476
|
deposits: historyDeposits,
|