@rhinestone/deposit-modal 0.1.66 → 0.1.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DepositModalReown-RXIVPSEE.mjs → DepositModalReown-EYIV6APK.mjs} +3 -3
- package/dist/{DepositModalReown-WFXQKZDH.cjs → DepositModalReown-UPYZN2XA.cjs} +4 -4
- package/dist/{WithdrawModalReown-MME7VSKX.mjs → WithdrawModalReown-6VYKKKJN.mjs} +3 -3
- package/dist/{WithdrawModalReown-PXS44GZO.cjs → WithdrawModalReown-WHPQDJJJ.cjs} +4 -4
- package/dist/{chunk-CULXRW6U.mjs → chunk-5FDIQNJJ.mjs} +22 -19
- package/dist/{chunk-JZWCK7C3.cjs → chunk-FLVSQDP4.cjs} +98 -91
- package/dist/{chunk-FWGLRTWF.mjs → chunk-IUW3SJQT.mjs} +61 -54
- package/dist/{chunk-75LRORPO.cjs → chunk-LTLFJPHO.cjs} +106 -103
- package/dist/{chunk-R6U6BHCV.cjs → chunk-MUWVDVY4.cjs} +13 -1
- package/dist/{chunk-JDO7QPPH.mjs → chunk-NFE5ZLD3.mjs} +786 -392
- package/dist/{chunk-CIXHTOO3.mjs → chunk-SDZKKUCJ.mjs} +13 -1
- package/dist/{chunk-5GN4QU67.cjs → chunk-UDKZWFCM.cjs} +842 -448
- package/dist/constants.cjs +2 -2
- package/dist/constants.mjs +1 -1
- package/dist/deposit.cjs +4 -4
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +3 -3
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +4 -4
- package/dist/reown.cjs +5 -5
- package/dist/reown.d.cts +1 -1
- package/dist/reown.d.ts +1 -1
- package/dist/reown.mjs +4 -4
- package/dist/styles.css +264 -33
- package/dist/{types-ymKENnUK.d.ts → types-DGQzvl6v.d.ts} +11 -1
- package/dist/{types-DjaZ9sa8.d.cts → types-DJ1fzNC7.d.cts} +11 -1
- package/dist/withdraw.cjs +4 -4
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +2 -2
- package/dist/withdraw.mjs +3 -3
- package/package.json +5 -5
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
tokenFormatter,
|
|
29
29
|
txRefsMatch,
|
|
30
30
|
useLatestRef
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-IUW3SJQT.mjs";
|
|
32
32
|
import {
|
|
33
33
|
DEFAULT_BACKEND_URL,
|
|
34
34
|
DEFAULT_SIGNER_ADDRESS,
|
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
getChainIcon,
|
|
39
39
|
getChainId,
|
|
40
40
|
getChainName,
|
|
41
|
+
getExplorerTxUrl,
|
|
41
42
|
getExplorerUrl,
|
|
42
43
|
getSupportedChainIds,
|
|
43
44
|
getTargetTokenSymbolsForChain,
|
|
@@ -46,21 +47,22 @@ import {
|
|
|
46
47
|
getTokenIcon,
|
|
47
48
|
getTokenSymbol,
|
|
48
49
|
isStablecoinSymbol
|
|
49
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-SDZKKUCJ.mjs";
|
|
50
51
|
|
|
51
52
|
// src/DepositModal.tsx
|
|
52
53
|
import {
|
|
53
|
-
useMemo as
|
|
54
|
+
useMemo as useMemo7,
|
|
54
55
|
useEffect as useEffect10,
|
|
55
|
-
useRef as
|
|
56
|
+
useRef as useRef7,
|
|
56
57
|
useState as useState11,
|
|
57
|
-
useCallback as
|
|
58
|
+
useCallback as useCallback6,
|
|
58
59
|
lazy,
|
|
59
60
|
Suspense
|
|
60
61
|
} from "react";
|
|
61
62
|
|
|
62
63
|
// src/DepositFlow.tsx
|
|
63
|
-
import { useState as useState10, useCallback as
|
|
64
|
+
import { useState as useState10, useCallback as useCallback4, useMemo as useMemo6, useEffect as useEffect9, useRef as useRef6 } from "react";
|
|
65
|
+
import { formatUnits as formatUnits5 } from "viem";
|
|
64
66
|
|
|
65
67
|
// src/components/steps/SetupStep.tsx
|
|
66
68
|
import { useState, useEffect, useRef, useCallback } from "react";
|
|
@@ -89,6 +91,8 @@ function SetupStep({
|
|
|
89
91
|
sessionChainIds,
|
|
90
92
|
recipient,
|
|
91
93
|
postBridgeActions,
|
|
94
|
+
outputTokenRules,
|
|
95
|
+
rejectUnmapped,
|
|
92
96
|
forceRegister,
|
|
93
97
|
enableSolana = true,
|
|
94
98
|
service,
|
|
@@ -158,7 +162,9 @@ function SetupStep({
|
|
|
158
162
|
chain: toEvmCaip2(targetChain),
|
|
159
163
|
token: targetToken,
|
|
160
164
|
...recipient && { recipient },
|
|
161
|
-
...postBridgeActions?.length && { postBridgeActions }
|
|
165
|
+
...postBridgeActions?.length && { postBridgeActions },
|
|
166
|
+
...outputTokenRules?.length && { outputTokenRules },
|
|
167
|
+
...rejectUnmapped != null && { rejectUnmapped }
|
|
162
168
|
}
|
|
163
169
|
});
|
|
164
170
|
setState({ type: "ready", smartAccount });
|
|
@@ -274,7 +280,8 @@ function AssetSelectStep({
|
|
|
274
280
|
service,
|
|
275
281
|
onContinue,
|
|
276
282
|
onTotalBalanceComputed,
|
|
277
|
-
onAssetsLoaded
|
|
283
|
+
onAssetsLoaded,
|
|
284
|
+
onDisconnect
|
|
278
285
|
}) {
|
|
279
286
|
const [assets, setAssets] = useState2([]);
|
|
280
287
|
const [selectedAssetId, setSelectedAssetId] = useState2(null);
|
|
@@ -422,7 +429,16 @@ function AssetSelectStep({
|
|
|
422
429
|
address.slice(0, 6),
|
|
423
430
|
"...",
|
|
424
431
|
address.slice(-4)
|
|
425
|
-
] })
|
|
432
|
+
] }),
|
|
433
|
+
onDisconnect && /* @__PURE__ */ jsx2(
|
|
434
|
+
"button",
|
|
435
|
+
{
|
|
436
|
+
type: "button",
|
|
437
|
+
className: "rs-empty-disconnect",
|
|
438
|
+
onClick: onDisconnect,
|
|
439
|
+
children: "Disconnect wallet"
|
|
440
|
+
}
|
|
441
|
+
)
|
|
426
442
|
] }),
|
|
427
443
|
!loading && !error && rows.length > 0 && /* @__PURE__ */ jsx2("div", { className: "rs-asset-list", children: rows.map((asset) => {
|
|
428
444
|
const isSelected = selectedAssetId === asset.id;
|
|
@@ -1182,96 +1198,378 @@ function ConfirmStep({
|
|
|
1182
1198
|
}
|
|
1183
1199
|
|
|
1184
1200
|
// src/components/steps/DepositAddressStep.tsx
|
|
1185
|
-
import { useState as useState6, useEffect as useEffect6, useCallback as
|
|
1201
|
+
import { useState as useState6, useEffect as useEffect6, useCallback as useCallback3, useRef as useRef5, useMemo as useMemo3 } from "react";
|
|
1186
1202
|
|
|
1187
1203
|
// src/components/ui/QRCode.tsx
|
|
1188
|
-
import {
|
|
1189
|
-
import {
|
|
1204
|
+
import { QRCode as QRCodeCanvas } from "react-qrcode-logo";
|
|
1205
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1190
1206
|
function QRCode({ value, size = 200, iconSrc, className }) {
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1207
|
+
return /* @__PURE__ */ jsx5("div", { className, role: "img", "aria-label": "QR Code", children: /* @__PURE__ */ jsx5(
|
|
1208
|
+
QRCodeCanvas,
|
|
1209
|
+
{
|
|
1210
|
+
value,
|
|
1211
|
+
size,
|
|
1212
|
+
qrStyle: "dots",
|
|
1213
|
+
eyeRadius: [10, 10, 10],
|
|
1214
|
+
ecLevel: "H",
|
|
1215
|
+
logoImage: iconSrc,
|
|
1216
|
+
logoWidth: size * 0.22,
|
|
1217
|
+
logoHeight: size * 0.22,
|
|
1218
|
+
logoPaddingStyle: "circle",
|
|
1219
|
+
logoPadding: 5,
|
|
1220
|
+
removeQrCodeBehindLogo: true,
|
|
1221
|
+
quietZone: 10,
|
|
1222
|
+
bgColor: "#ffffff",
|
|
1223
|
+
fgColor: "#000000"
|
|
1224
|
+
}
|
|
1225
|
+
) });
|
|
1226
|
+
}
|
|
1227
|
+
QRCode.displayName = "QRCode";
|
|
1228
|
+
|
|
1229
|
+
// src/components/ui/DepositNotification.tsx
|
|
1230
|
+
import { useState as useState5, useEffect as useEffect5, useRef as useRef4, useCallback as useCallback2 } from "react";
|
|
1231
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1232
|
+
var INITIAL_POLL_INTERVAL = 3e3;
|
|
1233
|
+
var MAX_POLL_INTERVAL = 3e4;
|
|
1234
|
+
var BACKOFF_MULTIPLIER = 1.5;
|
|
1235
|
+
function isEventForTx(event, txHash) {
|
|
1236
|
+
const eventTxHash = getEventTxHash(event);
|
|
1237
|
+
if (!eventTxHash) return false;
|
|
1238
|
+
return txRefsMatch(eventTxHash, txHash);
|
|
1239
|
+
}
|
|
1240
|
+
function truncateHash(hash) {
|
|
1241
|
+
return `${hash.slice(0, 4)}\u2026${hash.slice(-4)}`;
|
|
1242
|
+
}
|
|
1243
|
+
function formatTimestamp(ms) {
|
|
1244
|
+
const date = new Date(ms);
|
|
1245
|
+
const months = [
|
|
1246
|
+
"Jan",
|
|
1247
|
+
"Feb",
|
|
1248
|
+
"Mar",
|
|
1249
|
+
"Apr",
|
|
1250
|
+
"May",
|
|
1251
|
+
"Jun",
|
|
1252
|
+
"Jul",
|
|
1253
|
+
"Aug",
|
|
1254
|
+
"Sep",
|
|
1255
|
+
"Oct",
|
|
1256
|
+
"Nov",
|
|
1257
|
+
"Dec"
|
|
1258
|
+
];
|
|
1259
|
+
const month = months[date.getMonth()];
|
|
1260
|
+
const day = date.getDate();
|
|
1261
|
+
const suffix = day % 10 === 1 && day !== 11 ? "st" : day % 10 === 2 && day !== 12 ? "nd" : day % 10 === 3 && day !== 13 ? "rd" : "th";
|
|
1262
|
+
const hours = String(date.getHours()).padStart(2, "0");
|
|
1263
|
+
const minutes = String(date.getMinutes()).padStart(2, "0");
|
|
1264
|
+
const seconds = String(date.getSeconds()).padStart(2, "0");
|
|
1265
|
+
return `${month} ${day}${suffix} \xB7 ${hours}:${minutes}:${seconds}`;
|
|
1266
|
+
}
|
|
1267
|
+
function formatBridgeFailedMessage(event) {
|
|
1268
|
+
const eventData = event?.data ?? {};
|
|
1269
|
+
const backendMessage = typeof eventData.message === "string" ? eventData.message.trim() : "";
|
|
1270
|
+
if (backendMessage.length > 0) {
|
|
1271
|
+
const lower = backendMessage.toLowerCase();
|
|
1272
|
+
if (lower.includes("insufficient funds")) {
|
|
1273
|
+
return "Deposit was received, but processing could not continue due to insufficient funds.";
|
|
1274
|
+
}
|
|
1275
|
+
if (lower.includes("no valid quote available")) {
|
|
1276
|
+
return "No bridge route is currently available for this transfer.";
|
|
1277
|
+
}
|
|
1278
|
+
if (lower.includes("simulation failed")) {
|
|
1279
|
+
return "Transfer processing failed during simulation.";
|
|
1280
|
+
}
|
|
1281
|
+
if (backendMessage.length > 220) {
|
|
1282
|
+
return "Transfer processing failed.";
|
|
1283
|
+
}
|
|
1284
|
+
return backendMessage;
|
|
1285
|
+
}
|
|
1286
|
+
return "Bridge failed";
|
|
1287
|
+
}
|
|
1288
|
+
var txLinkIcon = /* @__PURE__ */ jsx6(
|
|
1289
|
+
"svg",
|
|
1290
|
+
{
|
|
1291
|
+
viewBox: "0 0 24 24",
|
|
1292
|
+
fill: "none",
|
|
1293
|
+
stroke: "currentColor",
|
|
1294
|
+
strokeWidth: "2.5",
|
|
1295
|
+
className: "rs-deposit-notification-link-icon",
|
|
1296
|
+
children: /* @__PURE__ */ jsx6(
|
|
1297
|
+
"path",
|
|
1298
|
+
{
|
|
1299
|
+
strokeLinecap: "round",
|
|
1300
|
+
strokeLinejoin: "round",
|
|
1301
|
+
d: "M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"
|
|
1197
1302
|
}
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1303
|
+
)
|
|
1304
|
+
}
|
|
1305
|
+
);
|
|
1306
|
+
function DepositNotification({
|
|
1307
|
+
deposit,
|
|
1308
|
+
smartAccount,
|
|
1309
|
+
targetChain,
|
|
1310
|
+
targetToken,
|
|
1311
|
+
waitForFinalTx,
|
|
1312
|
+
hasPostBridgeActions,
|
|
1313
|
+
service,
|
|
1314
|
+
onComplete,
|
|
1315
|
+
onFailed,
|
|
1316
|
+
onDismiss
|
|
1317
|
+
}) {
|
|
1318
|
+
const { txHash, sourceChain, amount, token, detectedAt, directTransfer } = deposit;
|
|
1319
|
+
const [status, setStatus] = useState5(
|
|
1320
|
+
directTransfer ? "complete" : "processing"
|
|
1321
|
+
);
|
|
1322
|
+
const [expanded, setExpanded] = useState5(false);
|
|
1323
|
+
const [completedAt, setCompletedAt] = useState5(
|
|
1324
|
+
directTransfer ? detectedAt : null
|
|
1325
|
+
);
|
|
1326
|
+
const [destinationTxHash, setDestinationTxHash] = useState5(
|
|
1327
|
+
null
|
|
1328
|
+
);
|
|
1329
|
+
const pollIntervalRef = useRef4(INITIAL_POLL_INTERVAL);
|
|
1330
|
+
const pollTimeoutRef = useRef4(null);
|
|
1331
|
+
const completedRef = useRef4(directTransfer ?? false);
|
|
1332
|
+
const depositContextRef = useLatestRef({
|
|
1333
|
+
amount,
|
|
1334
|
+
sourceChain,
|
|
1335
|
+
sourceToken: token,
|
|
1336
|
+
targetChain,
|
|
1337
|
+
targetToken,
|
|
1338
|
+
waitForFinalTx,
|
|
1339
|
+
hasPostBridgeActions
|
|
1340
|
+
});
|
|
1341
|
+
const onCompleteRef = useLatestRef(onComplete);
|
|
1342
|
+
const onFailedRef = useLatestRef(onFailed);
|
|
1343
|
+
const handleComplete = useCallback2(
|
|
1344
|
+
(destTxHash) => {
|
|
1345
|
+
if (completedRef.current) return;
|
|
1346
|
+
completedRef.current = true;
|
|
1347
|
+
setDestinationTxHash(destTxHash ?? null);
|
|
1348
|
+
setCompletedAt(Date.now());
|
|
1349
|
+
setStatus("complete");
|
|
1350
|
+
const context = depositContextRef.current;
|
|
1351
|
+
onCompleteRef.current?.(txHash, destTxHash, {
|
|
1352
|
+
amount: context.amount,
|
|
1353
|
+
sourceChain: context.sourceChain,
|
|
1354
|
+
sourceToken: context.sourceToken,
|
|
1355
|
+
targetChain: context.targetChain,
|
|
1356
|
+
targetToken: context.targetToken
|
|
1357
|
+
});
|
|
1358
|
+
},
|
|
1359
|
+
[depositContextRef, onCompleteRef, txHash]
|
|
1360
|
+
);
|
|
1361
|
+
const handleFailed = useCallback2(
|
|
1362
|
+
(error) => {
|
|
1363
|
+
if (completedRef.current) return;
|
|
1364
|
+
completedRef.current = true;
|
|
1365
|
+
setStatus("failed");
|
|
1366
|
+
onFailedRef.current?.(txHash, error);
|
|
1367
|
+
},
|
|
1368
|
+
[onFailedRef, txHash]
|
|
1369
|
+
);
|
|
1370
|
+
useEffect5(() => {
|
|
1371
|
+
if (directTransfer) {
|
|
1372
|
+
handleComplete(void 0);
|
|
1373
|
+
return;
|
|
1374
|
+
}
|
|
1375
|
+
if (status !== "processing") return;
|
|
1376
|
+
let isMounted = true;
|
|
1377
|
+
async function pollStatus() {
|
|
1378
|
+
try {
|
|
1379
|
+
const data = await service.fetchStatus(smartAccount, txHash);
|
|
1380
|
+
if (!isMounted) return;
|
|
1381
|
+
const lastEvent = data.lastEvent;
|
|
1382
|
+
const eventForTx = isEventForTx(lastEvent, txHash) ? lastEvent : void 0;
|
|
1383
|
+
const awaitingPostBridgeSwap = depositContextRef.current.waitForFinalTx && depositContextRef.current.hasPostBridgeActions;
|
|
1384
|
+
if (eventForTx?.type === "post-bridge-swap-complete") {
|
|
1385
|
+
const swapTxHash = eventForTx.data?.swap?.transactionHash;
|
|
1386
|
+
handleComplete(swapTxHash);
|
|
1387
|
+
return;
|
|
1388
|
+
}
|
|
1389
|
+
if (eventForTx?.type === "post-bridge-swap-failed") {
|
|
1390
|
+
handleFailed(formatBridgeFailedMessage(eventForTx));
|
|
1391
|
+
return;
|
|
1392
|
+
}
|
|
1393
|
+
if (eventForTx?.type === "bridge-complete" && !awaitingPostBridgeSwap) {
|
|
1394
|
+
const destTx = eventForTx.data?.destination?.transactionHash;
|
|
1395
|
+
handleComplete(destTx);
|
|
1396
|
+
return;
|
|
1397
|
+
}
|
|
1398
|
+
if (!waitForFinalTx && eventForTx?.type === "bridge-started") {
|
|
1399
|
+
handleComplete(void 0);
|
|
1400
|
+
return;
|
|
1401
|
+
}
|
|
1402
|
+
if (eventForTx?.type === "bridge-failed") {
|
|
1403
|
+
handleFailed(formatBridgeFailedMessage(eventForTx));
|
|
1404
|
+
return;
|
|
1405
|
+
}
|
|
1406
|
+
if (eventForTx?.type === "error") {
|
|
1407
|
+
const errorMessage = eventForTx.data?.message ?? "Unknown error";
|
|
1408
|
+
handleFailed(errorMessage);
|
|
1409
|
+
return;
|
|
1410
|
+
}
|
|
1411
|
+
scheduleNextPoll();
|
|
1412
|
+
} catch {
|
|
1413
|
+
scheduleNextPoll();
|
|
1201
1414
|
}
|
|
1202
|
-
}
|
|
1415
|
+
}
|
|
1416
|
+
function scheduleNextPoll() {
|
|
1417
|
+
if (!isMounted) return;
|
|
1418
|
+
pollTimeoutRef.current = setTimeout(() => {
|
|
1419
|
+
pollIntervalRef.current = Math.min(
|
|
1420
|
+
pollIntervalRef.current * BACKOFF_MULTIPLIER,
|
|
1421
|
+
MAX_POLL_INTERVAL
|
|
1422
|
+
);
|
|
1423
|
+
pollStatus();
|
|
1424
|
+
}, pollIntervalRef.current);
|
|
1425
|
+
}
|
|
1426
|
+
pollStatus();
|
|
1203
1427
|
return () => {
|
|
1204
|
-
|
|
1428
|
+
isMounted = false;
|
|
1429
|
+
if (pollTimeoutRef.current) {
|
|
1430
|
+
clearTimeout(pollTimeoutRef.current);
|
|
1431
|
+
}
|
|
1205
1432
|
};
|
|
1206
|
-
}, [
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1433
|
+
}, [
|
|
1434
|
+
directTransfer,
|
|
1435
|
+
depositContextRef,
|
|
1436
|
+
handleComplete,
|
|
1437
|
+
handleFailed,
|
|
1438
|
+
service,
|
|
1439
|
+
smartAccount,
|
|
1440
|
+
status,
|
|
1441
|
+
txHash
|
|
1442
|
+
]);
|
|
1443
|
+
const sourceExplorerUrl = getExplorerTxUrl(sourceChain, txHash);
|
|
1444
|
+
const destExplorerUrl = destinationTxHash ? getExplorerTxUrl(targetChain, destinationTxHash) : null;
|
|
1445
|
+
const title = status === "complete" ? "Deposit completed" : status === "failed" ? "Deposit failed" : "Deposit received and processing\u2026";
|
|
1446
|
+
const subtitle = status === "complete" ? "Your deposit has been credited to your account." : status === "failed" ? "Your deposit could not be processed." : "Your deposit will be credited to your account shortly.";
|
|
1447
|
+
const statusIcon = status === "complete" ? /* @__PURE__ */ jsx6("div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--complete", children: /* @__PURE__ */ jsx6(
|
|
1448
|
+
"svg",
|
|
1449
|
+
{
|
|
1450
|
+
viewBox: "0 0 24 24",
|
|
1451
|
+
fill: "none",
|
|
1452
|
+
stroke: "currentColor",
|
|
1453
|
+
strokeWidth: "3",
|
|
1454
|
+
children: /* @__PURE__ */ jsx6(
|
|
1455
|
+
"path",
|
|
1456
|
+
{
|
|
1457
|
+
strokeLinecap: "round",
|
|
1458
|
+
strokeLinejoin: "round",
|
|
1459
|
+
d: "M5 12l5 5L20 7"
|
|
1460
|
+
}
|
|
1461
|
+
)
|
|
1210
1462
|
}
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
continue;
|
|
1463
|
+
) }) : status === "failed" ? /* @__PURE__ */ jsx6("div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--failed", children: /* @__PURE__ */ jsx6(
|
|
1464
|
+
"svg",
|
|
1465
|
+
{
|
|
1466
|
+
viewBox: "0 0 24 24",
|
|
1467
|
+
fill: "none",
|
|
1468
|
+
stroke: "currentColor",
|
|
1469
|
+
strokeWidth: "3",
|
|
1470
|
+
children: /* @__PURE__ */ jsx6(
|
|
1471
|
+
"path",
|
|
1472
|
+
{
|
|
1473
|
+
strokeLinecap: "round",
|
|
1474
|
+
strokeLinejoin: "round",
|
|
1475
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
1225
1476
|
}
|
|
1226
|
-
|
|
1227
|
-
const y = row * cellSize;
|
|
1228
|
-
paths.push(`M${x},${y}h${cellSize}v${cellSize}h${-cellSize}z`);
|
|
1229
|
-
}
|
|
1477
|
+
)
|
|
1230
1478
|
}
|
|
1231
|
-
|
|
1232
|
-
}, [createQrCode, value, size, iconSrc]);
|
|
1233
|
-
const iconSize = size * 0.22;
|
|
1234
|
-
const iconOffset = (size - iconSize) / 2;
|
|
1479
|
+
) }) : /* @__PURE__ */ jsx6("div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--processing", children: /* @__PURE__ */ jsx6(Spinner, {}) });
|
|
1235
1480
|
return /* @__PURE__ */ jsxs5(
|
|
1236
|
-
"
|
|
1481
|
+
"div",
|
|
1237
1482
|
{
|
|
1238
|
-
|
|
1239
|
-
width: size,
|
|
1240
|
-
height: size,
|
|
1241
|
-
className,
|
|
1242
|
-
role: "img",
|
|
1243
|
-
"aria-label": "QR Code",
|
|
1483
|
+
className: `rs-deposit-notification rs-deposit-notification--${status}`,
|
|
1244
1484
|
children: [
|
|
1245
|
-
/* @__PURE__ */
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
"
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
width: iconSize + 8,
|
|
1254
|
-
height: iconSize + 8,
|
|
1255
|
-
fill: "white",
|
|
1256
|
-
rx: 8
|
|
1257
|
-
}
|
|
1258
|
-
),
|
|
1259
|
-
/* @__PURE__ */ jsx5(
|
|
1260
|
-
"image",
|
|
1485
|
+
/* @__PURE__ */ jsxs5("div", { className: "rs-deposit-notification-header", children: [
|
|
1486
|
+
/* @__PURE__ */ jsx6("div", { className: "rs-deposit-notification-icon", children: statusIcon }),
|
|
1487
|
+
/* @__PURE__ */ jsxs5("div", { className: "rs-deposit-notification-content", children: [
|
|
1488
|
+
/* @__PURE__ */ jsx6("div", { className: "rs-deposit-notification-title", children: title }),
|
|
1489
|
+
/* @__PURE__ */ jsx6("div", { className: "rs-deposit-notification-subtitle", children: subtitle })
|
|
1490
|
+
] }),
|
|
1491
|
+
/* @__PURE__ */ jsx6(
|
|
1492
|
+
"button",
|
|
1261
1493
|
{
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1494
|
+
type: "button",
|
|
1495
|
+
className: "rs-deposit-notification-close",
|
|
1496
|
+
onClick: () => onDismiss(deposit.id),
|
|
1497
|
+
"aria-label": "Dismiss",
|
|
1498
|
+
children: /* @__PURE__ */ jsx6(
|
|
1499
|
+
"svg",
|
|
1500
|
+
{
|
|
1501
|
+
viewBox: "0 0 24 24",
|
|
1502
|
+
fill: "none",
|
|
1503
|
+
stroke: "currentColor",
|
|
1504
|
+
strokeWidth: "2",
|
|
1505
|
+
children: /* @__PURE__ */ jsx6(
|
|
1506
|
+
"path",
|
|
1507
|
+
{
|
|
1508
|
+
strokeLinecap: "round",
|
|
1509
|
+
strokeLinejoin: "round",
|
|
1510
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
1511
|
+
}
|
|
1512
|
+
)
|
|
1513
|
+
}
|
|
1514
|
+
)
|
|
1267
1515
|
}
|
|
1268
1516
|
)
|
|
1269
|
-
] })
|
|
1517
|
+
] }),
|
|
1518
|
+
expanded && /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-notification-details", children: [
|
|
1519
|
+
/* @__PURE__ */ jsxs5("div", { className: "rs-deposit-notification-row", children: [
|
|
1520
|
+
/* @__PURE__ */ jsx6("span", { className: "rs-deposit-notification-label", children: "Deposit tx" }),
|
|
1521
|
+
/* @__PURE__ */ jsx6("span", { className: "rs-deposit-notification-value", children: sourceExplorerUrl ? /* @__PURE__ */ jsxs5(
|
|
1522
|
+
"a",
|
|
1523
|
+
{
|
|
1524
|
+
href: sourceExplorerUrl,
|
|
1525
|
+
target: "_blank",
|
|
1526
|
+
rel: "noopener noreferrer",
|
|
1527
|
+
className: "rs-deposit-notification-link",
|
|
1528
|
+
children: [
|
|
1529
|
+
truncateHash(txHash),
|
|
1530
|
+
txLinkIcon
|
|
1531
|
+
]
|
|
1532
|
+
}
|
|
1533
|
+
) : truncateHash(txHash) })
|
|
1534
|
+
] }),
|
|
1535
|
+
destinationTxHash && /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-notification-row", children: [
|
|
1536
|
+
/* @__PURE__ */ jsx6("span", { className: "rs-deposit-notification-label", children: "Completion tx" }),
|
|
1537
|
+
/* @__PURE__ */ jsx6("span", { className: "rs-deposit-notification-value", children: destExplorerUrl ? /* @__PURE__ */ jsxs5(
|
|
1538
|
+
"a",
|
|
1539
|
+
{
|
|
1540
|
+
href: destExplorerUrl,
|
|
1541
|
+
target: "_blank",
|
|
1542
|
+
rel: "noopener noreferrer",
|
|
1543
|
+
className: "rs-deposit-notification-link",
|
|
1544
|
+
children: [
|
|
1545
|
+
truncateHash(destinationTxHash),
|
|
1546
|
+
txLinkIcon
|
|
1547
|
+
]
|
|
1548
|
+
}
|
|
1549
|
+
) : truncateHash(destinationTxHash) })
|
|
1550
|
+
] }),
|
|
1551
|
+
/* @__PURE__ */ jsxs5("div", { className: "rs-deposit-notification-row", children: [
|
|
1552
|
+
/* @__PURE__ */ jsx6("span", { className: "rs-deposit-notification-label", children: "Order submitted" }),
|
|
1553
|
+
/* @__PURE__ */ jsx6("span", { className: "rs-deposit-notification-value", children: formatTimestamp(detectedAt) })
|
|
1554
|
+
] }),
|
|
1555
|
+
completedAt && /* @__PURE__ */ jsxs5("div", { className: "rs-deposit-notification-row", children: [
|
|
1556
|
+
/* @__PURE__ */ jsx6("span", { className: "rs-deposit-notification-label", children: "Order filled" }),
|
|
1557
|
+
/* @__PURE__ */ jsx6("span", { className: "rs-deposit-notification-value", children: formatTimestamp(completedAt) })
|
|
1558
|
+
] })
|
|
1559
|
+
] }),
|
|
1560
|
+
/* @__PURE__ */ jsx6(
|
|
1561
|
+
"button",
|
|
1562
|
+
{
|
|
1563
|
+
type: "button",
|
|
1564
|
+
className: "rs-deposit-notification-toggle",
|
|
1565
|
+
onClick: () => setExpanded(!expanded),
|
|
1566
|
+
children: expanded ? "See less" : "See more"
|
|
1567
|
+
}
|
|
1568
|
+
)
|
|
1270
1569
|
]
|
|
1271
1570
|
}
|
|
1272
1571
|
);
|
|
1273
1572
|
}
|
|
1274
|
-
QRCode.displayName = "QRCode";
|
|
1275
1573
|
|
|
1276
1574
|
// src/core/solana.ts
|
|
1277
1575
|
import {
|
|
@@ -1391,7 +1689,7 @@ async function sendSolanaTransaction(provider, _connection, transaction) {
|
|
|
1391
1689
|
}
|
|
1392
1690
|
|
|
1393
1691
|
// src/components/steps/DepositAddressStep.tsx
|
|
1394
|
-
import { jsx as
|
|
1692
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1395
1693
|
var POLL_INTERVAL_MS = 4e3;
|
|
1396
1694
|
function isRecord(value) {
|
|
1397
1695
|
return typeof value === "object" && value !== null;
|
|
@@ -1463,37 +1761,48 @@ function getDepositEventDetails(event) {
|
|
|
1463
1761
|
}
|
|
1464
1762
|
return {};
|
|
1465
1763
|
}
|
|
1764
|
+
function isSameRoute(sourceChain, sourceToken, targetChain, targetToken) {
|
|
1765
|
+
return sourceChain === targetChain && sourceToken.toLowerCase() === targetToken.toLowerCase();
|
|
1766
|
+
}
|
|
1466
1767
|
function DepositAddressStep({
|
|
1467
1768
|
smartAccount,
|
|
1468
1769
|
solanaDepositAddress,
|
|
1469
1770
|
service,
|
|
1470
1771
|
allowedRoutes,
|
|
1471
|
-
|
|
1772
|
+
targetChain,
|
|
1773
|
+
targetToken,
|
|
1774
|
+
waitForFinalTx,
|
|
1775
|
+
hasPostBridgeActions,
|
|
1776
|
+
onDepositSubmitted,
|
|
1777
|
+
onDepositComplete,
|
|
1778
|
+
onDepositFailed,
|
|
1472
1779
|
onCopyAddress,
|
|
1473
1780
|
onError
|
|
1474
1781
|
}) {
|
|
1475
1782
|
const hasSolana = Boolean(solanaDepositAddress);
|
|
1476
|
-
const allowedChainSet =
|
|
1783
|
+
const allowedChainSet = useMemo3(
|
|
1477
1784
|
() => allowedRoutes?.sourceChains ? new Set(allowedRoutes.sourceChains) : null,
|
|
1478
1785
|
[allowedRoutes?.sourceChains]
|
|
1479
1786
|
);
|
|
1480
|
-
const allowedTokenSet =
|
|
1787
|
+
const allowedTokenSet = useMemo3(
|
|
1481
1788
|
() => allowedRoutes?.sourceTokens ? new Set(allowedRoutes.sourceTokens.map((s) => s.toUpperCase())) : null,
|
|
1482
1789
|
[allowedRoutes?.sourceTokens]
|
|
1483
1790
|
);
|
|
1484
|
-
const evmChainIds =
|
|
1791
|
+
const evmChainIds = useMemo3(() => {
|
|
1485
1792
|
const all = getSupportedChainIds();
|
|
1486
1793
|
return allowedChainSet ? all.filter((id) => allowedChainSet.has(id)) : all;
|
|
1487
1794
|
}, [allowedChainSet]);
|
|
1488
|
-
const chainOptions =
|
|
1489
|
-
()
|
|
1490
|
-
[evmChainIds
|
|
1491
|
-
|
|
1795
|
+
const chainOptions = useMemo3(() => {
|
|
1796
|
+
if (!hasSolana) return evmChainIds;
|
|
1797
|
+
const options = [...evmChainIds];
|
|
1798
|
+
options.splice(1, 0, "solana");
|
|
1799
|
+
return options;
|
|
1800
|
+
}, [evmChainIds, hasSolana]);
|
|
1492
1801
|
const BASE_CHAIN_ID = 8453;
|
|
1493
1802
|
const defaultChainId = evmChainIds.includes(BASE_CHAIN_ID) ? BASE_CHAIN_ID : evmChainIds[0];
|
|
1494
1803
|
const [sourceChainId, setSourceChainId] = useState6(defaultChainId);
|
|
1495
1804
|
const isSolana = sourceChainId === "solana";
|
|
1496
|
-
const tokensForChain =
|
|
1805
|
+
const tokensForChain = useMemo3(() => {
|
|
1497
1806
|
const all = isSolana ? SOLANA_TOKENS.map((t) => t.symbol) : getTargetTokenSymbolsForChain(sourceChainId);
|
|
1498
1807
|
return allowedTokenSet ? all.filter((s) => allowedTokenSet.has(s.toUpperCase())) : all;
|
|
1499
1808
|
}, [sourceChainId, isSolana, allowedTokenSet]);
|
|
@@ -1509,10 +1818,13 @@ function DepositAddressStep({
|
|
|
1509
1818
|
const [pollingError, setPollingError] = useState6(null);
|
|
1510
1819
|
const [chainDropdownOpen, setChainDropdownOpen] = useState6(false);
|
|
1511
1820
|
const [tokenDropdownOpen, setTokenDropdownOpen] = useState6(false);
|
|
1512
|
-
const chainDropdownRef =
|
|
1513
|
-
const tokenDropdownRef =
|
|
1514
|
-
const
|
|
1515
|
-
const
|
|
1821
|
+
const chainDropdownRef = useRef5(null);
|
|
1822
|
+
const tokenDropdownRef = useRef5(null);
|
|
1823
|
+
const [notifications, setNotifications] = useState6([]);
|
|
1824
|
+
const isTrackingRef = useRef5(false);
|
|
1825
|
+
const baselineTxHashRef = useRef5(void 0);
|
|
1826
|
+
const notificationIdRef = useRef5(0);
|
|
1827
|
+
const sourceSelectionRef = useRef5({
|
|
1516
1828
|
chainId: defaultChainId,
|
|
1517
1829
|
token: typeof defaultChainId === "number" ? getTokenAddress(defaultToken, defaultChainId) : void 0,
|
|
1518
1830
|
sourceSymbol: defaultToken
|
|
@@ -1553,7 +1865,7 @@ function DepositAddressStep({
|
|
|
1553
1865
|
document.removeEventListener("touchstart", handlePointerDown);
|
|
1554
1866
|
};
|
|
1555
1867
|
}, [chainDropdownOpen, tokenDropdownOpen]);
|
|
1556
|
-
const handleCopy =
|
|
1868
|
+
const handleCopy = useCallback3(async () => {
|
|
1557
1869
|
onCopyAddress?.();
|
|
1558
1870
|
try {
|
|
1559
1871
|
await navigator.clipboard.writeText(displayAddress);
|
|
@@ -1577,22 +1889,46 @@ function DepositAddressStep({
|
|
|
1577
1889
|
setChainDropdownOpen(false);
|
|
1578
1890
|
setTokenDropdownOpen(false);
|
|
1579
1891
|
}, [sourceChainId]);
|
|
1892
|
+
const onDepositSubmittedRef = useRef5(onDepositSubmitted);
|
|
1893
|
+
onDepositSubmittedRef.current = onDepositSubmitted;
|
|
1894
|
+
const onDepositCompleteRef = useRef5(onDepositComplete);
|
|
1895
|
+
onDepositCompleteRef.current = onDepositComplete;
|
|
1896
|
+
const onDepositFailedRef = useRef5(onDepositFailed);
|
|
1897
|
+
onDepositFailedRef.current = onDepositFailed;
|
|
1898
|
+
const onErrorRef = useRef5(onError);
|
|
1899
|
+
onErrorRef.current = onError;
|
|
1900
|
+
const targetChainRef = useRef5(targetChain);
|
|
1901
|
+
targetChainRef.current = targetChain;
|
|
1902
|
+
const targetTokenRef = useRef5(targetToken);
|
|
1903
|
+
targetTokenRef.current = targetToken;
|
|
1580
1904
|
useEffect6(() => {
|
|
1581
|
-
|
|
1905
|
+
baselineTxHashRef.current = void 0;
|
|
1906
|
+
isTrackingRef.current = false;
|
|
1582
1907
|
setPollingError(null);
|
|
1583
1908
|
let timeoutId;
|
|
1584
1909
|
let cancelled = false;
|
|
1585
|
-
let baselineTxHash = void 0;
|
|
1586
1910
|
async function poll() {
|
|
1587
|
-
if (cancelled
|
|
1911
|
+
if (cancelled) return;
|
|
1912
|
+
if (isTrackingRef.current) {
|
|
1913
|
+
if (!cancelled) {
|
|
1914
|
+
timeoutId = setTimeout(poll, POLL_INTERVAL_MS);
|
|
1915
|
+
}
|
|
1916
|
+
return;
|
|
1917
|
+
}
|
|
1588
1918
|
try {
|
|
1589
1919
|
const status = await service.fetchLatestStatus(smartAccount);
|
|
1590
|
-
if (cancelled
|
|
1920
|
+
if (cancelled) return;
|
|
1921
|
+
if (isTrackingRef.current) {
|
|
1922
|
+
if (!cancelled) {
|
|
1923
|
+
timeoutId = setTimeout(poll, POLL_INTERVAL_MS);
|
|
1924
|
+
}
|
|
1925
|
+
return;
|
|
1926
|
+
}
|
|
1591
1927
|
const event = status.lastEvent;
|
|
1592
1928
|
const eventTxHash = isDepositEvent(event) ? getEventTxHash(event) ?? null : null;
|
|
1593
|
-
if (
|
|
1594
|
-
|
|
1595
|
-
} else if (eventTxHash && (!
|
|
1929
|
+
if (baselineTxHashRef.current === void 0) {
|
|
1930
|
+
baselineTxHashRef.current = eventTxHash;
|
|
1931
|
+
} else if (eventTxHash && (!baselineTxHashRef.current || !txRefsMatch(eventTxHash, baselineTxHashRef.current))) {
|
|
1596
1932
|
const details = getDepositEventDetails(event);
|
|
1597
1933
|
const fallback = sourceSelectionRef.current;
|
|
1598
1934
|
const chainId = details.chainId ?? fallback.chainId;
|
|
@@ -1601,16 +1937,33 @@ function DepositAddressStep({
|
|
|
1601
1937
|
const sourceSymbol = details.sourceSymbol ?? fallback.sourceSymbol;
|
|
1602
1938
|
const sourceDecimals = details.sourceDecimals ?? fallback.sourceDecimals;
|
|
1603
1939
|
if (token) {
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1940
|
+
baselineTxHashRef.current = eventTxHash;
|
|
1941
|
+
isTrackingRef.current = true;
|
|
1942
|
+
const isEvmToken = /^0x[a-fA-F0-9]{40}$/.test(token);
|
|
1943
|
+
const directTransfer = typeof chainId === "number" && isEvmToken && isSameRoute(
|
|
1607
1944
|
chainId,
|
|
1945
|
+
token,
|
|
1946
|
+
targetChainRef.current,
|
|
1947
|
+
targetTokenRef.current
|
|
1948
|
+
);
|
|
1949
|
+
const id = String(++notificationIdRef.current);
|
|
1950
|
+
const notification = {
|
|
1951
|
+
id,
|
|
1952
|
+
txHash: eventTxHash,
|
|
1953
|
+
sourceChain: chainId,
|
|
1608
1954
|
amount,
|
|
1609
1955
|
token,
|
|
1610
1956
|
sourceSymbol,
|
|
1611
|
-
sourceDecimals
|
|
1612
|
-
|
|
1613
|
-
|
|
1957
|
+
sourceDecimals,
|
|
1958
|
+
detectedAt: Date.now(),
|
|
1959
|
+
directTransfer
|
|
1960
|
+
};
|
|
1961
|
+
setNotifications((prev) => [notification, ...prev]);
|
|
1962
|
+
onDepositSubmittedRef.current?.({
|
|
1963
|
+
txHash: eventTxHash,
|
|
1964
|
+
sourceChain: chainId,
|
|
1965
|
+
amount
|
|
1966
|
+
});
|
|
1614
1967
|
}
|
|
1615
1968
|
}
|
|
1616
1969
|
setPollingError(null);
|
|
@@ -1618,10 +1971,10 @@ function DepositAddressStep({
|
|
|
1618
1971
|
if (!cancelled) {
|
|
1619
1972
|
const msg = err instanceof Error ? err.message : "Failed to check status";
|
|
1620
1973
|
setPollingError(msg);
|
|
1621
|
-
|
|
1974
|
+
onErrorRef.current?.(msg, "STATUS_POLL_ERROR");
|
|
1622
1975
|
}
|
|
1623
1976
|
}
|
|
1624
|
-
if (!cancelled
|
|
1977
|
+
if (!cancelled) {
|
|
1625
1978
|
timeoutId = setTimeout(poll, POLL_INTERVAL_MS);
|
|
1626
1979
|
}
|
|
1627
1980
|
}
|
|
@@ -1630,13 +1983,30 @@ function DepositAddressStep({
|
|
|
1630
1983
|
cancelled = true;
|
|
1631
1984
|
clearTimeout(timeoutId);
|
|
1632
1985
|
};
|
|
1633
|
-
}, [smartAccount, service
|
|
1986
|
+
}, [smartAccount, service]);
|
|
1987
|
+
const handleNotificationComplete = useCallback3(
|
|
1988
|
+
(txHash, destinationTxHash, context) => {
|
|
1989
|
+
isTrackingRef.current = false;
|
|
1990
|
+
onDepositCompleteRef.current?.(txHash, destinationTxHash, context);
|
|
1991
|
+
},
|
|
1992
|
+
[]
|
|
1993
|
+
);
|
|
1994
|
+
const handleNotificationFailed = useCallback3(
|
|
1995
|
+
(txHash, error) => {
|
|
1996
|
+
isTrackingRef.current = false;
|
|
1997
|
+
onDepositFailedRef.current?.(txHash, error);
|
|
1998
|
+
},
|
|
1999
|
+
[]
|
|
2000
|
+
);
|
|
2001
|
+
const handleNotificationDismiss = useCallback3((id) => {
|
|
2002
|
+
setNotifications((prev) => prev.filter((n) => n.id !== id));
|
|
2003
|
+
}, []);
|
|
1634
2004
|
const qrIconSrc = getChainIcon(sourceChainId);
|
|
1635
|
-
return /* @__PURE__ */ jsxs6("div", { className: "rs-step", children: [
|
|
1636
|
-
/* @__PURE__ */
|
|
2005
|
+
return /* @__PURE__ */ jsxs6("div", { className: "rs-step rs-step--with-notifications", children: [
|
|
2006
|
+
/* @__PURE__ */ jsx7("div", { className: "rs-step-body", children: /* @__PURE__ */ jsxs6("div", { className: "rs-deposit-address", children: [
|
|
1637
2007
|
/* @__PURE__ */ jsxs6("div", { className: "rs-deposit-address-selectors", children: [
|
|
1638
2008
|
/* @__PURE__ */ jsxs6("div", { className: "rs-deposit-address-dropdown", ref: chainDropdownRef, children: [
|
|
1639
|
-
/* @__PURE__ */
|
|
2009
|
+
/* @__PURE__ */ jsx7("div", { className: "rs-deposit-address-dropdown-label", children: "Supported chain" }),
|
|
1640
2010
|
/* @__PURE__ */ jsxs6(
|
|
1641
2011
|
"button",
|
|
1642
2012
|
{
|
|
@@ -1647,7 +2017,7 @@ function DepositAddressStep({
|
|
|
1647
2017
|
setTokenDropdownOpen(false);
|
|
1648
2018
|
},
|
|
1649
2019
|
children: [
|
|
1650
|
-
getChainIcon(sourceChainId) && /* @__PURE__ */
|
|
2020
|
+
getChainIcon(sourceChainId) && /* @__PURE__ */ jsx7(
|
|
1651
2021
|
"img",
|
|
1652
2022
|
{
|
|
1653
2023
|
src: getChainIcon(sourceChainId),
|
|
@@ -1655,8 +2025,8 @@ function DepositAddressStep({
|
|
|
1655
2025
|
className: "rs-deposit-address-dropdown-icon"
|
|
1656
2026
|
}
|
|
1657
2027
|
),
|
|
1658
|
-
/* @__PURE__ */
|
|
1659
|
-
/* @__PURE__ */
|
|
2028
|
+
/* @__PURE__ */ jsx7("span", { children: getChainName(sourceChainId) }),
|
|
2029
|
+
/* @__PURE__ */ jsx7(
|
|
1660
2030
|
"svg",
|
|
1661
2031
|
{
|
|
1662
2032
|
className: "rs-deposit-address-dropdown-chevron",
|
|
@@ -1664,7 +2034,7 @@ function DepositAddressStep({
|
|
|
1664
2034
|
fill: "none",
|
|
1665
2035
|
stroke: "currentColor",
|
|
1666
2036
|
strokeWidth: "2",
|
|
1667
|
-
children: /* @__PURE__ */
|
|
2037
|
+
children: /* @__PURE__ */ jsx7(
|
|
1668
2038
|
"path",
|
|
1669
2039
|
{
|
|
1670
2040
|
strokeLinecap: "round",
|
|
@@ -1677,7 +2047,7 @@ function DepositAddressStep({
|
|
|
1677
2047
|
]
|
|
1678
2048
|
}
|
|
1679
2049
|
),
|
|
1680
|
-
chainDropdownOpen && /* @__PURE__ */
|
|
2050
|
+
chainDropdownOpen && /* @__PURE__ */ jsx7("div", { className: "rs-deposit-address-dropdown-menu", children: chainOptions.map((chainId) => /* @__PURE__ */ jsxs6(
|
|
1681
2051
|
"button",
|
|
1682
2052
|
{
|
|
1683
2053
|
type: "button",
|
|
@@ -1687,7 +2057,7 @@ function DepositAddressStep({
|
|
|
1687
2057
|
setChainDropdownOpen(false);
|
|
1688
2058
|
},
|
|
1689
2059
|
children: [
|
|
1690
|
-
getChainIcon(chainId) && /* @__PURE__ */
|
|
2060
|
+
getChainIcon(chainId) && /* @__PURE__ */ jsx7(
|
|
1691
2061
|
"img",
|
|
1692
2062
|
{
|
|
1693
2063
|
src: getChainIcon(chainId),
|
|
@@ -1695,14 +2065,14 @@ function DepositAddressStep({
|
|
|
1695
2065
|
className: "rs-deposit-address-dropdown-icon"
|
|
1696
2066
|
}
|
|
1697
2067
|
),
|
|
1698
|
-
/* @__PURE__ */
|
|
2068
|
+
/* @__PURE__ */ jsx7("span", { children: getChainName(chainId) })
|
|
1699
2069
|
]
|
|
1700
2070
|
},
|
|
1701
2071
|
String(chainId)
|
|
1702
2072
|
)) })
|
|
1703
2073
|
] }),
|
|
1704
2074
|
/* @__PURE__ */ jsxs6("div", { className: "rs-deposit-address-dropdown", ref: tokenDropdownRef, children: [
|
|
1705
|
-
/* @__PURE__ */
|
|
2075
|
+
/* @__PURE__ */ jsx7("div", { className: "rs-deposit-address-dropdown-label", children: "Supported token" }),
|
|
1706
2076
|
/* @__PURE__ */ jsxs6(
|
|
1707
2077
|
"button",
|
|
1708
2078
|
{
|
|
@@ -1713,7 +2083,7 @@ function DepositAddressStep({
|
|
|
1713
2083
|
setChainDropdownOpen(false);
|
|
1714
2084
|
},
|
|
1715
2085
|
children: [
|
|
1716
|
-
getTokenIcon(sourceTokenSymbol) && /* @__PURE__ */
|
|
2086
|
+
getTokenIcon(sourceTokenSymbol) && /* @__PURE__ */ jsx7(
|
|
1717
2087
|
"img",
|
|
1718
2088
|
{
|
|
1719
2089
|
src: getTokenIcon(sourceTokenSymbol),
|
|
@@ -1721,8 +2091,8 @@ function DepositAddressStep({
|
|
|
1721
2091
|
className: "rs-deposit-address-dropdown-icon"
|
|
1722
2092
|
}
|
|
1723
2093
|
),
|
|
1724
|
-
/* @__PURE__ */
|
|
1725
|
-
/* @__PURE__ */
|
|
2094
|
+
/* @__PURE__ */ jsx7("span", { children: sourceTokenSymbol }),
|
|
2095
|
+
/* @__PURE__ */ jsx7(
|
|
1726
2096
|
"svg",
|
|
1727
2097
|
{
|
|
1728
2098
|
className: "rs-deposit-address-dropdown-chevron",
|
|
@@ -1730,7 +2100,7 @@ function DepositAddressStep({
|
|
|
1730
2100
|
fill: "none",
|
|
1731
2101
|
stroke: "currentColor",
|
|
1732
2102
|
strokeWidth: "2",
|
|
1733
|
-
children: /* @__PURE__ */
|
|
2103
|
+
children: /* @__PURE__ */ jsx7(
|
|
1734
2104
|
"path",
|
|
1735
2105
|
{
|
|
1736
2106
|
strokeLinecap: "round",
|
|
@@ -1743,7 +2113,7 @@ function DepositAddressStep({
|
|
|
1743
2113
|
]
|
|
1744
2114
|
}
|
|
1745
2115
|
),
|
|
1746
|
-
tokenDropdownOpen && /* @__PURE__ */
|
|
2116
|
+
tokenDropdownOpen && /* @__PURE__ */ jsx7("div", { className: "rs-deposit-address-dropdown-menu", children: tokensForChain.map((symbol) => /* @__PURE__ */ jsxs6(
|
|
1747
2117
|
"button",
|
|
1748
2118
|
{
|
|
1749
2119
|
type: "button",
|
|
@@ -1753,7 +2123,7 @@ function DepositAddressStep({
|
|
|
1753
2123
|
setTokenDropdownOpen(false);
|
|
1754
2124
|
},
|
|
1755
2125
|
children: [
|
|
1756
|
-
getTokenIcon(symbol) && /* @__PURE__ */
|
|
2126
|
+
getTokenIcon(symbol) && /* @__PURE__ */ jsx7(
|
|
1757
2127
|
"img",
|
|
1758
2128
|
{
|
|
1759
2129
|
src: getTokenIcon(symbol),
|
|
@@ -1761,21 +2131,21 @@ function DepositAddressStep({
|
|
|
1761
2131
|
className: "rs-deposit-address-dropdown-icon"
|
|
1762
2132
|
}
|
|
1763
2133
|
),
|
|
1764
|
-
/* @__PURE__ */
|
|
2134
|
+
/* @__PURE__ */ jsx7("span", { children: symbol })
|
|
1765
2135
|
]
|
|
1766
2136
|
},
|
|
1767
2137
|
symbol
|
|
1768
2138
|
)) })
|
|
1769
2139
|
] })
|
|
1770
2140
|
] }),
|
|
1771
|
-
/* @__PURE__ */
|
|
2141
|
+
/* @__PURE__ */ jsx7("div", { className: "rs-deposit-address-qr", children: /* @__PURE__ */ jsx7(QRCode, { value: displayAddress, size: 150, iconSrc: qrIconSrc }) }),
|
|
1772
2142
|
/* @__PURE__ */ jsxs6("div", { className: "rs-deposit-address-info", children: [
|
|
1773
2143
|
/* @__PURE__ */ jsxs6("div", { className: "rs-deposit-address-label", children: [
|
|
1774
2144
|
"Your ",
|
|
1775
2145
|
isSolana ? "Solana" : "EVM",
|
|
1776
2146
|
" deposit address"
|
|
1777
2147
|
] }),
|
|
1778
|
-
/* @__PURE__ */
|
|
2148
|
+
/* @__PURE__ */ jsx7("div", { className: "rs-deposit-address-value", children: displayAddress }),
|
|
1779
2149
|
/* @__PURE__ */ jsxs6(
|
|
1780
2150
|
"button",
|
|
1781
2151
|
{
|
|
@@ -1783,7 +2153,7 @@ function DepositAddressStep({
|
|
|
1783
2153
|
className: "rs-deposit-address-copy",
|
|
1784
2154
|
onClick: handleCopy,
|
|
1785
2155
|
children: [
|
|
1786
|
-
/* @__PURE__ */
|
|
2156
|
+
/* @__PURE__ */ jsx7(
|
|
1787
2157
|
"svg",
|
|
1788
2158
|
{
|
|
1789
2159
|
viewBox: "0 0 24 24",
|
|
@@ -1791,14 +2161,14 @@ function DepositAddressStep({
|
|
|
1791
2161
|
stroke: "currentColor",
|
|
1792
2162
|
strokeWidth: "2",
|
|
1793
2163
|
style: { width: 14, height: 14 },
|
|
1794
|
-
children: copied ? /* @__PURE__ */
|
|
2164
|
+
children: copied ? /* @__PURE__ */ jsx7(
|
|
1795
2165
|
"path",
|
|
1796
2166
|
{
|
|
1797
2167
|
strokeLinecap: "round",
|
|
1798
2168
|
strokeLinejoin: "round",
|
|
1799
2169
|
d: "M5 12l5 5L20 7"
|
|
1800
2170
|
}
|
|
1801
|
-
) : /* @__PURE__ */
|
|
2171
|
+
) : /* @__PURE__ */ jsx7(
|
|
1802
2172
|
"path",
|
|
1803
2173
|
{
|
|
1804
2174
|
strokeLinecap: "round",
|
|
@@ -1813,17 +2183,33 @@ function DepositAddressStep({
|
|
|
1813
2183
|
}
|
|
1814
2184
|
)
|
|
1815
2185
|
] }),
|
|
1816
|
-
pollingError && /* @__PURE__ */
|
|
2186
|
+
pollingError && /* @__PURE__ */ jsx7("div", { className: "rs-deposit-address-error", children: pollingError })
|
|
1817
2187
|
] }) }),
|
|
1818
|
-
/* @__PURE__ */
|
|
2188
|
+
notifications.length > 0 && /* @__PURE__ */ jsx7("div", { className: "rs-deposit-notifications", children: notifications.map((deposit) => /* @__PURE__ */ jsx7(
|
|
2189
|
+
DepositNotification,
|
|
2190
|
+
{
|
|
2191
|
+
deposit,
|
|
2192
|
+
smartAccount,
|
|
2193
|
+
targetChain,
|
|
2194
|
+
targetToken,
|
|
2195
|
+
waitForFinalTx,
|
|
2196
|
+
hasPostBridgeActions,
|
|
2197
|
+
service,
|
|
2198
|
+
onComplete: handleNotificationComplete,
|
|
2199
|
+
onFailed: handleNotificationFailed,
|
|
2200
|
+
onDismiss: handleNotificationDismiss
|
|
2201
|
+
},
|
|
2202
|
+
deposit.id
|
|
2203
|
+
)) }),
|
|
2204
|
+
/* @__PURE__ */ jsx7(PoweredBy, {})
|
|
1819
2205
|
] });
|
|
1820
2206
|
}
|
|
1821
2207
|
DepositAddressStep.displayName = "DepositAddressStep";
|
|
1822
2208
|
|
|
1823
2209
|
// src/components/steps/SolanaTokenSelectStep.tsx
|
|
1824
|
-
import { useState as useState7, useEffect as useEffect7, useMemo as
|
|
2210
|
+
import { useState as useState7, useEffect as useEffect7, useMemo as useMemo4 } from "react";
|
|
1825
2211
|
import { formatUnits as formatUnits3 } from "viem";
|
|
1826
|
-
import { jsx as
|
|
2212
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1827
2213
|
function SolanaTokenSelectStep({
|
|
1828
2214
|
solanaAddress,
|
|
1829
2215
|
service,
|
|
@@ -1906,7 +2292,7 @@ function SolanaTokenSelectStep({
|
|
|
1906
2292
|
active = false;
|
|
1907
2293
|
};
|
|
1908
2294
|
}, [debug, solanaAddress, service, onTotalBalanceComputed]);
|
|
1909
|
-
const rows =
|
|
2295
|
+
const rows = useMemo4(
|
|
1910
2296
|
() => [...tokenBalances].sort((a, b) => {
|
|
1911
2297
|
if (a.balanceUsd !== b.balanceUsd) return b.balanceUsd - a.balanceUsd;
|
|
1912
2298
|
if (b.balance > a.balance) return 1;
|
|
@@ -1917,10 +2303,10 @@ function SolanaTokenSelectStep({
|
|
|
1917
2303
|
);
|
|
1918
2304
|
const selectedEntry = selectedSymbol ? rows.find((r) => r.token.symbol === selectedSymbol) : null;
|
|
1919
2305
|
if (error) {
|
|
1920
|
-
return /* @__PURE__ */
|
|
2306
|
+
return /* @__PURE__ */ jsx8("div", { className: "rs-step", children: /* @__PURE__ */ jsx8("div", { className: "rs-step-body", children: /* @__PURE__ */ jsx8("div", { className: "rs-alert rs-alert--error", children: /* @__PURE__ */ jsx8("span", { className: "rs-alert-text", children: error }) }) }) });
|
|
1921
2307
|
}
|
|
1922
2308
|
return /* @__PURE__ */ jsxs7("div", { className: "rs-step", children: [
|
|
1923
|
-
/* @__PURE__ */
|
|
2309
|
+
/* @__PURE__ */ jsx8("div", { style: { padding: "12px 12px 4px" }, children: /* @__PURE__ */ jsx8("div", { className: "rs-step-title", children: "Select source asset" }) }),
|
|
1924
2310
|
/* @__PURE__ */ jsxs7(
|
|
1925
2311
|
"div",
|
|
1926
2312
|
{
|
|
@@ -1928,11 +2314,11 @@ function SolanaTokenSelectStep({
|
|
|
1928
2314
|
style: { paddingTop: 4, overflow: "auto", maxHeight: 340 },
|
|
1929
2315
|
children: [
|
|
1930
2316
|
loading && /* @__PURE__ */ jsxs7("div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
1931
|
-
/* @__PURE__ */
|
|
1932
|
-
/* @__PURE__ */
|
|
2317
|
+
/* @__PURE__ */ jsx8(Spinner, { className: "rs-text-tertiary" }),
|
|
2318
|
+
/* @__PURE__ */ jsx8("span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
1933
2319
|
] }),
|
|
1934
2320
|
!loading && rows.length === 0 && /* @__PURE__ */ jsxs7("div", { className: "rs-empty-state", children: [
|
|
1935
|
-
/* @__PURE__ */
|
|
2321
|
+
/* @__PURE__ */ jsx8(
|
|
1936
2322
|
"svg",
|
|
1937
2323
|
{
|
|
1938
2324
|
className: "rs-empty-icon",
|
|
@@ -1940,7 +2326,7 @@ function SolanaTokenSelectStep({
|
|
|
1940
2326
|
fill: "none",
|
|
1941
2327
|
stroke: "currentColor",
|
|
1942
2328
|
strokeWidth: "1.5",
|
|
1943
|
-
children: /* @__PURE__ */
|
|
2329
|
+
children: /* @__PURE__ */ jsx8(
|
|
1944
2330
|
"path",
|
|
1945
2331
|
{
|
|
1946
2332
|
strokeLinecap: "round",
|
|
@@ -1950,14 +2336,14 @@ function SolanaTokenSelectStep({
|
|
|
1950
2336
|
)
|
|
1951
2337
|
}
|
|
1952
2338
|
),
|
|
1953
|
-
/* @__PURE__ */
|
|
2339
|
+
/* @__PURE__ */ jsx8("div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
|
|
1954
2340
|
/* @__PURE__ */ jsxs7("div", { className: "rs-empty-address", children: [
|
|
1955
2341
|
solanaAddress.slice(0, 6),
|
|
1956
2342
|
"...",
|
|
1957
2343
|
solanaAddress.slice(-4)
|
|
1958
2344
|
] })
|
|
1959
2345
|
] }),
|
|
1960
|
-
!loading && rows.length > 0 && /* @__PURE__ */
|
|
2346
|
+
!loading && rows.length > 0 && /* @__PURE__ */ jsx8("div", { className: "rs-asset-list", children: rows.map((entry) => {
|
|
1961
2347
|
const isSelected = selectedSymbol === entry.token.symbol;
|
|
1962
2348
|
const tokenIcon = getTokenIcon(entry.token.symbol);
|
|
1963
2349
|
const chainIcon = getChainIcon("solana");
|
|
@@ -1979,7 +2365,7 @@ function SolanaTokenSelectStep({
|
|
|
1979
2365
|
children: [
|
|
1980
2366
|
/* @__PURE__ */ jsxs7("div", { className: "rs-asset-info", children: [
|
|
1981
2367
|
/* @__PURE__ */ jsxs7("div", { className: "rs-asset-icon-wrapper", children: [
|
|
1982
|
-
tokenIcon ? /* @__PURE__ */
|
|
2368
|
+
tokenIcon ? /* @__PURE__ */ jsx8(
|
|
1983
2369
|
"img",
|
|
1984
2370
|
{
|
|
1985
2371
|
src: tokenIcon,
|
|
@@ -1987,8 +2373,8 @@ function SolanaTokenSelectStep({
|
|
|
1987
2373
|
className: "rs-asset-icon",
|
|
1988
2374
|
style: { background: "transparent" }
|
|
1989
2375
|
}
|
|
1990
|
-
) : /* @__PURE__ */
|
|
1991
|
-
chainIcon && /* @__PURE__ */
|
|
2376
|
+
) : /* @__PURE__ */ jsx8("div", { className: "rs-asset-icon", children: entry.token.symbol.slice(0, 4) }),
|
|
2377
|
+
chainIcon && /* @__PURE__ */ jsx8(
|
|
1992
2378
|
"img",
|
|
1993
2379
|
{
|
|
1994
2380
|
src: chainIcon,
|
|
@@ -2000,7 +2386,7 @@ function SolanaTokenSelectStep({
|
|
|
2000
2386
|
/* @__PURE__ */ jsxs7("div", { children: [
|
|
2001
2387
|
/* @__PURE__ */ jsxs7("div", { className: "rs-asset-name", children: [
|
|
2002
2388
|
entry.token.symbol,
|
|
2003
|
-
/* @__PURE__ */
|
|
2389
|
+
/* @__PURE__ */ jsx8("span", { className: "rs-asset-chain", children: " on Solana" })
|
|
2004
2390
|
] }),
|
|
2005
2391
|
/* @__PURE__ */ jsxs7("div", { className: "rs-asset-balance-small", children: [
|
|
2006
2392
|
formattedBalance,
|
|
@@ -2009,7 +2395,7 @@ function SolanaTokenSelectStep({
|
|
|
2009
2395
|
] })
|
|
2010
2396
|
] })
|
|
2011
2397
|
] }),
|
|
2012
|
-
/* @__PURE__ */
|
|
2398
|
+
/* @__PURE__ */ jsx8("div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ? currencyFormatter.format(entry.balanceUsd) : `${formattedBalance} ${entry.token.symbol}` })
|
|
2013
2399
|
]
|
|
2014
2400
|
},
|
|
2015
2401
|
entry.token.symbol
|
|
@@ -2018,7 +2404,7 @@ function SolanaTokenSelectStep({
|
|
|
2018
2404
|
]
|
|
2019
2405
|
}
|
|
2020
2406
|
),
|
|
2021
|
-
/* @__PURE__ */
|
|
2407
|
+
/* @__PURE__ */ jsx8("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx8(
|
|
2022
2408
|
Button,
|
|
2023
2409
|
{
|
|
2024
2410
|
onClick: () => selectedEntry && onContinue(
|
|
@@ -2031,14 +2417,14 @@ function SolanaTokenSelectStep({
|
|
|
2031
2417
|
children: "Continue"
|
|
2032
2418
|
}
|
|
2033
2419
|
) }),
|
|
2034
|
-
/* @__PURE__ */
|
|
2420
|
+
/* @__PURE__ */ jsx8(PoweredBy, {})
|
|
2035
2421
|
] });
|
|
2036
2422
|
}
|
|
2037
2423
|
|
|
2038
2424
|
// src/components/steps/SolanaAmountStep.tsx
|
|
2039
|
-
import { useEffect as useEffect8, useMemo as
|
|
2425
|
+
import { useEffect as useEffect8, useMemo as useMemo5, useState as useState8 } from "react";
|
|
2040
2426
|
import { formatUnits as formatUnits4, parseUnits as parseUnits3 } from "viem";
|
|
2041
|
-
import { jsx as
|
|
2427
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2042
2428
|
var SOL_FEE_RESERVE_LAMPORTS = 1000000n;
|
|
2043
2429
|
function SolanaAmountStep({
|
|
2044
2430
|
token,
|
|
@@ -2052,7 +2438,7 @@ function SolanaAmountStep({
|
|
|
2052
2438
|
const [amount, setAmount] = useState8("");
|
|
2053
2439
|
const [error, setError] = useState8(null);
|
|
2054
2440
|
const isSourceStablecoin = isStablecoinSymbol(token.symbol);
|
|
2055
|
-
const tokenPriceUsd =
|
|
2441
|
+
const tokenPriceUsd = useMemo5(() => {
|
|
2056
2442
|
if (isSourceStablecoin) return 1;
|
|
2057
2443
|
try {
|
|
2058
2444
|
const balanceUnits = Number(formatUnits4(balance, token.decimals));
|
|
@@ -2074,7 +2460,7 @@ function SolanaAmountStep({
|
|
|
2074
2460
|
}
|
|
2075
2461
|
}
|
|
2076
2462
|
}, [defaultAmount, amount]);
|
|
2077
|
-
const formattedBalance =
|
|
2463
|
+
const formattedBalance = useMemo5(() => {
|
|
2078
2464
|
try {
|
|
2079
2465
|
const raw = formatUnits4(balance, token.decimals);
|
|
2080
2466
|
const numeric = Number(raw);
|
|
@@ -2084,7 +2470,7 @@ function SolanaAmountStep({
|
|
|
2084
2470
|
return "...";
|
|
2085
2471
|
}
|
|
2086
2472
|
}, [balance, token.decimals]);
|
|
2087
|
-
const computedBalanceUsd =
|
|
2473
|
+
const computedBalanceUsd = useMemo5(() => {
|
|
2088
2474
|
try {
|
|
2089
2475
|
const balanceUnits = Number(formatUnits4(balance, token.decimals));
|
|
2090
2476
|
if (!Number.isFinite(balanceUnits) || balanceUnits < 0) return null;
|
|
@@ -2095,15 +2481,15 @@ function SolanaAmountStep({
|
|
|
2095
2481
|
return null;
|
|
2096
2482
|
}
|
|
2097
2483
|
}, [balance, token.decimals, tokenPriceUsd, balanceUsd]);
|
|
2098
|
-
const formattedBalanceUsd =
|
|
2484
|
+
const formattedBalanceUsd = useMemo5(() => {
|
|
2099
2485
|
if (computedBalanceUsd === null || computedBalanceUsd <= 0) return null;
|
|
2100
2486
|
return currencyFormatter.format(computedBalanceUsd);
|
|
2101
2487
|
}, [computedBalanceUsd]);
|
|
2102
|
-
const spendableBalance =
|
|
2488
|
+
const spendableBalance = useMemo5(() => {
|
|
2103
2489
|
if (!isNativeSol(token)) return balance;
|
|
2104
2490
|
return balance > SOL_FEE_RESERVE_LAMPORTS ? balance - SOL_FEE_RESERVE_LAMPORTS : 0n;
|
|
2105
2491
|
}, [balance, token]);
|
|
2106
|
-
const spendableBalanceUsd =
|
|
2492
|
+
const spendableBalanceUsd = useMemo5(() => {
|
|
2107
2493
|
try {
|
|
2108
2494
|
const spendableUnits = Number(formatUnits4(spendableBalance, token.decimals));
|
|
2109
2495
|
if (!Number.isFinite(spendableUnits) || spendableUnits < 0) return null;
|
|
@@ -2195,10 +2581,10 @@ function SolanaAmountStep({
|
|
|
2195
2581
|
onContinue(token, sourceAmountStr, amount);
|
|
2196
2582
|
};
|
|
2197
2583
|
return /* @__PURE__ */ jsxs8("div", { className: "rs-step", children: [
|
|
2198
|
-
/* @__PURE__ */
|
|
2584
|
+
/* @__PURE__ */ jsx9("div", { style: { padding: "12px 12px 4px" }, children: /* @__PURE__ */ jsx9("div", { className: "rs-step-title", children: "Enter amount" }) }),
|
|
2199
2585
|
/* @__PURE__ */ jsxs8("div", { className: "rs-step-body", style: { paddingTop: 0 }, children: [
|
|
2200
2586
|
/* @__PURE__ */ jsxs8("div", { className: "rs-amount-display", children: [
|
|
2201
|
-
/* @__PURE__ */
|
|
2587
|
+
/* @__PURE__ */ jsx9("div", { className: "rs-amount-input-wrapper", children: /* @__PURE__ */ jsx9(
|
|
2202
2588
|
"input",
|
|
2203
2589
|
{
|
|
2204
2590
|
type: "text",
|
|
@@ -2216,7 +2602,7 @@ function SolanaAmountStep({
|
|
|
2216
2602
|
autoFocus: true
|
|
2217
2603
|
}
|
|
2218
2604
|
) }),
|
|
2219
|
-
!isSourceStablecoin && /* @__PURE__ */
|
|
2605
|
+
!isSourceStablecoin && /* @__PURE__ */ jsx9("div", { className: "rs-amount-available", children: /* @__PURE__ */ jsxs8("span", { className: "rs-amount-available-value", children: [
|
|
2220
2606
|
formattedBalance,
|
|
2221
2607
|
" ",
|
|
2222
2608
|
token.symbol,
|
|
@@ -2243,7 +2629,7 @@ function SolanaAmountStep({
|
|
|
2243
2629
|
},
|
|
2244
2630
|
pct
|
|
2245
2631
|
)),
|
|
2246
|
-
/* @__PURE__ */
|
|
2632
|
+
/* @__PURE__ */ jsx9(
|
|
2247
2633
|
"button",
|
|
2248
2634
|
{
|
|
2249
2635
|
type: "button",
|
|
@@ -2258,7 +2644,7 @@ function SolanaAmountStep({
|
|
|
2258
2644
|
" minimum deposit"
|
|
2259
2645
|
] }),
|
|
2260
2646
|
error && /* @__PURE__ */ jsxs8("div", { className: "rs-amount-error", children: [
|
|
2261
|
-
/* @__PURE__ */
|
|
2647
|
+
/* @__PURE__ */ jsx9(
|
|
2262
2648
|
"svg",
|
|
2263
2649
|
{
|
|
2264
2650
|
viewBox: "0 0 24 24",
|
|
@@ -2266,7 +2652,7 @@ function SolanaAmountStep({
|
|
|
2266
2652
|
stroke: "currentColor",
|
|
2267
2653
|
strokeWidth: "2",
|
|
2268
2654
|
style: { width: 16, height: 16, flexShrink: 0 },
|
|
2269
|
-
children: /* @__PURE__ */
|
|
2655
|
+
children: /* @__PURE__ */ jsx9(
|
|
2270
2656
|
"path",
|
|
2271
2657
|
{
|
|
2272
2658
|
strokeLinecap: "round",
|
|
@@ -2276,10 +2662,10 @@ function SolanaAmountStep({
|
|
|
2276
2662
|
)
|
|
2277
2663
|
}
|
|
2278
2664
|
),
|
|
2279
|
-
/* @__PURE__ */
|
|
2665
|
+
/* @__PURE__ */ jsx9("span", { children: error })
|
|
2280
2666
|
] })
|
|
2281
2667
|
] }),
|
|
2282
|
-
/* @__PURE__ */
|
|
2668
|
+
/* @__PURE__ */ jsx9("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx9(
|
|
2283
2669
|
Button,
|
|
2284
2670
|
{
|
|
2285
2671
|
onClick: handleContinue,
|
|
@@ -2288,14 +2674,14 @@ function SolanaAmountStep({
|
|
|
2288
2674
|
children: uiConfig?.minDepositUsd && parseFloat(amount) > 0 && parseFloat(amount) < uiConfig.minDepositUsd ? "Update order" : "Continue"
|
|
2289
2675
|
}
|
|
2290
2676
|
) }),
|
|
2291
|
-
/* @__PURE__ */
|
|
2677
|
+
/* @__PURE__ */ jsx9(PoweredBy, {})
|
|
2292
2678
|
] });
|
|
2293
2679
|
}
|
|
2294
2680
|
|
|
2295
2681
|
// src/components/steps/SolanaConfirmStep.tsx
|
|
2296
2682
|
import { useState as useState9 } from "react";
|
|
2297
2683
|
import { parseUnits as parseUnits4 } from "viem";
|
|
2298
|
-
import { jsx as
|
|
2684
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2299
2685
|
function SolanaConfirmStep({
|
|
2300
2686
|
smartAccount,
|
|
2301
2687
|
solanaAddress,
|
|
@@ -2420,18 +2806,18 @@ function SolanaConfirmStep({
|
|
|
2420
2806
|
}
|
|
2421
2807
|
};
|
|
2422
2808
|
return /* @__PURE__ */ jsxs9("div", { className: "rs-step", children: [
|
|
2423
|
-
/* @__PURE__ */
|
|
2809
|
+
/* @__PURE__ */ jsx10("div", { style: { padding: "12px 12px 10px" }, children: /* @__PURE__ */ jsx10("div", { className: "rs-step-title", children: "Review order" }) }),
|
|
2424
2810
|
/* @__PURE__ */ jsxs9("div", { className: "rs-step-body rs-space-y-3", style: { paddingTop: 0 }, children: [
|
|
2425
2811
|
/* @__PURE__ */ jsxs9("div", { className: "rs-card", children: [
|
|
2426
2812
|
/* @__PURE__ */ jsxs9("div", { className: "rs-card-row", children: [
|
|
2427
|
-
/* @__PURE__ */
|
|
2813
|
+
/* @__PURE__ */ jsx10("span", { className: "rs-card-label", children: "Source" }),
|
|
2428
2814
|
/* @__PURE__ */ jsxs9(
|
|
2429
2815
|
"span",
|
|
2430
2816
|
{
|
|
2431
2817
|
className: "rs-card-value",
|
|
2432
2818
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
2433
2819
|
children: [
|
|
2434
|
-
getChainIcon("solana") && /* @__PURE__ */
|
|
2820
|
+
getChainIcon("solana") && /* @__PURE__ */ jsx10(
|
|
2435
2821
|
"img",
|
|
2436
2822
|
{
|
|
2437
2823
|
src: getChainIcon("solana"),
|
|
@@ -2445,14 +2831,14 @@ function SolanaConfirmStep({
|
|
|
2445
2831
|
)
|
|
2446
2832
|
] }),
|
|
2447
2833
|
/* @__PURE__ */ jsxs9("div", { className: "rs-card-row", children: [
|
|
2448
|
-
/* @__PURE__ */
|
|
2834
|
+
/* @__PURE__ */ jsx10("span", { className: "rs-card-label", children: "Destination" }),
|
|
2449
2835
|
/* @__PURE__ */ jsxs9(
|
|
2450
2836
|
"span",
|
|
2451
2837
|
{
|
|
2452
2838
|
className: "rs-card-value",
|
|
2453
2839
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
2454
2840
|
children: [
|
|
2455
|
-
getChainIcon(targetChain) && /* @__PURE__ */
|
|
2841
|
+
getChainIcon(targetChain) && /* @__PURE__ */ jsx10(
|
|
2456
2842
|
"img",
|
|
2457
2843
|
{
|
|
2458
2844
|
src: getChainIcon(targetChain),
|
|
@@ -2466,20 +2852,20 @@ function SolanaConfirmStep({
|
|
|
2466
2852
|
)
|
|
2467
2853
|
] }),
|
|
2468
2854
|
/* @__PURE__ */ jsxs9("div", { className: "rs-card-row", children: [
|
|
2469
|
-
/* @__PURE__ */
|
|
2470
|
-
/* @__PURE__ */
|
|
2855
|
+
/* @__PURE__ */ jsx10("span", { className: "rs-card-label", children: "Estimated time" }),
|
|
2856
|
+
/* @__PURE__ */ jsx10("span", { className: "rs-card-value", children: "< 1 min" })
|
|
2471
2857
|
] })
|
|
2472
2858
|
] }),
|
|
2473
2859
|
/* @__PURE__ */ jsxs9("div", { className: "rs-card", children: [
|
|
2474
2860
|
/* @__PURE__ */ jsxs9("div", { className: "rs-card-row", children: [
|
|
2475
|
-
/* @__PURE__ */
|
|
2861
|
+
/* @__PURE__ */ jsx10("span", { className: "rs-card-label", children: "You send" }),
|
|
2476
2862
|
/* @__PURE__ */ jsxs9(
|
|
2477
2863
|
"span",
|
|
2478
2864
|
{
|
|
2479
2865
|
className: "rs-card-value",
|
|
2480
2866
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
2481
2867
|
children: [
|
|
2482
|
-
getTokenIcon(token.symbol) && /* @__PURE__ */
|
|
2868
|
+
getTokenIcon(token.symbol) && /* @__PURE__ */ jsx10(
|
|
2483
2869
|
"img",
|
|
2484
2870
|
{
|
|
2485
2871
|
src: getTokenIcon(token.symbol),
|
|
@@ -2495,14 +2881,14 @@ function SolanaConfirmStep({
|
|
|
2495
2881
|
)
|
|
2496
2882
|
] }),
|
|
2497
2883
|
/* @__PURE__ */ jsxs9("div", { className: "rs-card-row", children: [
|
|
2498
|
-
/* @__PURE__ */
|
|
2884
|
+
/* @__PURE__ */ jsx10("span", { className: "rs-card-label", children: "You receive" }),
|
|
2499
2885
|
/* @__PURE__ */ jsxs9(
|
|
2500
2886
|
"span",
|
|
2501
2887
|
{
|
|
2502
2888
|
className: "rs-card-value",
|
|
2503
2889
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
2504
2890
|
children: [
|
|
2505
|
-
getTokenIcon(targetSymbol) && /* @__PURE__ */
|
|
2891
|
+
getTokenIcon(targetSymbol) && /* @__PURE__ */ jsx10(
|
|
2506
2892
|
"img",
|
|
2507
2893
|
{
|
|
2508
2894
|
src: getTokenIcon(targetSymbol),
|
|
@@ -2519,7 +2905,7 @@ function SolanaConfirmStep({
|
|
|
2519
2905
|
] })
|
|
2520
2906
|
] }),
|
|
2521
2907
|
error && /* @__PURE__ */ jsxs9("div", { className: "rs-alert rs-alert--error", children: [
|
|
2522
|
-
/* @__PURE__ */
|
|
2908
|
+
/* @__PURE__ */ jsx10(
|
|
2523
2909
|
"svg",
|
|
2524
2910
|
{
|
|
2525
2911
|
className: "rs-alert-icon",
|
|
@@ -2527,7 +2913,7 @@ function SolanaConfirmStep({
|
|
|
2527
2913
|
fill: "none",
|
|
2528
2914
|
stroke: "currentColor",
|
|
2529
2915
|
strokeWidth: "2",
|
|
2530
|
-
children: /* @__PURE__ */
|
|
2916
|
+
children: /* @__PURE__ */ jsx10(
|
|
2531
2917
|
"path",
|
|
2532
2918
|
{
|
|
2533
2919
|
strokeLinecap: "round",
|
|
@@ -2537,10 +2923,10 @@ function SolanaConfirmStep({
|
|
|
2537
2923
|
)
|
|
2538
2924
|
}
|
|
2539
2925
|
),
|
|
2540
|
-
/* @__PURE__ */
|
|
2926
|
+
/* @__PURE__ */ jsx10("span", { className: "rs-alert-text", children: error })
|
|
2541
2927
|
] })
|
|
2542
2928
|
] }),
|
|
2543
|
-
/* @__PURE__ */
|
|
2929
|
+
/* @__PURE__ */ jsx10("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx10(
|
|
2544
2930
|
Button,
|
|
2545
2931
|
{
|
|
2546
2932
|
onClick: handleConfirm,
|
|
@@ -2550,14 +2936,14 @@ function SolanaConfirmStep({
|
|
|
2550
2936
|
children: "Confirm Order"
|
|
2551
2937
|
}
|
|
2552
2938
|
) }),
|
|
2553
|
-
/* @__PURE__ */
|
|
2939
|
+
/* @__PURE__ */ jsx10(PoweredBy, {})
|
|
2554
2940
|
] });
|
|
2555
2941
|
}
|
|
2556
2942
|
|
|
2557
2943
|
// src/DepositFlow.tsx
|
|
2558
|
-
import { jsx as
|
|
2944
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2559
2945
|
var QR_AUTO_ADVANCE_HYDRATION_GRACE_MS = 1e3;
|
|
2560
|
-
function
|
|
2946
|
+
function isSameRoute2(sourceChain, sourceToken, targetChain, targetToken) {
|
|
2561
2947
|
return sourceChain === targetChain && sourceToken.toLowerCase() === targetToken.toLowerCase();
|
|
2562
2948
|
}
|
|
2563
2949
|
function getAddressKey(address) {
|
|
@@ -2576,6 +2962,8 @@ function DepositFlow({
|
|
|
2576
2962
|
amount: defaultAmount,
|
|
2577
2963
|
recipient,
|
|
2578
2964
|
postBridgeActions,
|
|
2965
|
+
outputTokenRules,
|
|
2966
|
+
rejectUnmapped,
|
|
2579
2967
|
signerAddress = DEFAULT_SIGNER_ADDRESS,
|
|
2580
2968
|
sessionChainIds,
|
|
2581
2969
|
forceRegister = false,
|
|
@@ -2604,6 +2992,10 @@ function DepositFlow({
|
|
|
2604
2992
|
const onTotalBalanceChangeRef = useLatestRef(onTotalBalanceChange);
|
|
2605
2993
|
const onSmartAccountChangeRef = useLatestRef(onSmartAccountChange);
|
|
2606
2994
|
const onEventRef = useLatestRef(onEvent);
|
|
2995
|
+
const onDepositSubmittedRef = useLatestRef(onDepositSubmitted);
|
|
2996
|
+
const onDepositCompleteRef = useLatestRef(onDepositComplete);
|
|
2997
|
+
const onDepositFailedRef = useLatestRef(onDepositFailed);
|
|
2998
|
+
const onErrorRef = useLatestRef(onError);
|
|
2607
2999
|
const hasInitialReownSession = Boolean(
|
|
2608
3000
|
enableSolana ? reownWallet?.isConnected || reownWallet?.address : reownWallet?.address
|
|
2609
3001
|
);
|
|
@@ -2616,32 +3008,34 @@ function DepositFlow({
|
|
|
2616
3008
|
const [isConnectSelectionConfirmed, setIsConnectSelectionConfirmed] = useState10(false);
|
|
2617
3009
|
const [selectedWalletId, setSelectedWalletId] = useState10(null);
|
|
2618
3010
|
const [hasQrAutoAdvanceGraceElapsed, setHasQrAutoAdvanceGraceElapsed] = useState10(() => !hasInitialWalletHydrationPending);
|
|
2619
|
-
const flowModeRef =
|
|
2620
|
-
const portfolioAssetsRef =
|
|
2621
|
-
const stableWalletSignerRef =
|
|
2622
|
-
const stableWalletSelectionKeyRef =
|
|
3011
|
+
const flowModeRef = useRef6(null);
|
|
3012
|
+
const portfolioAssetsRef = useRef6([]);
|
|
3013
|
+
const stableWalletSignerRef = useRef6(null);
|
|
3014
|
+
const stableWalletSelectionKeyRef = useRef6(null);
|
|
2623
3015
|
flowModeRef.current = flowMode;
|
|
2624
|
-
const logFlow =
|
|
3016
|
+
const logFlow = useCallback4(
|
|
2625
3017
|
(message, data) => {
|
|
2626
3018
|
debugLog(debug, "deposit-flow", message, data);
|
|
2627
3019
|
},
|
|
2628
3020
|
[debug]
|
|
2629
3021
|
);
|
|
2630
|
-
const logFlowError =
|
|
3022
|
+
const logFlowError = useCallback4(
|
|
2631
3023
|
(message, error, data) => {
|
|
2632
3024
|
debugError(debug, "deposit-flow", message, error, data);
|
|
2633
3025
|
},
|
|
2634
3026
|
[debug]
|
|
2635
3027
|
);
|
|
2636
|
-
const handleAssetsLoaded =
|
|
3028
|
+
const handleAssetsLoaded = useCallback4((assets) => {
|
|
2637
3029
|
portfolioAssetsRef.current = assets;
|
|
2638
3030
|
}, []);
|
|
2639
|
-
const getTokenPriceUsd =
|
|
3031
|
+
const getTokenPriceUsd = useCallback4((symbol) => {
|
|
2640
3032
|
const sym = symbol.toLowerCase();
|
|
2641
3033
|
for (const asset of portfolioAssetsRef.current) {
|
|
2642
3034
|
if (asset.symbol.toLowerCase() === sym && asset.balanceUsd && asset.balance) {
|
|
2643
3035
|
try {
|
|
2644
|
-
const balanceUnits = Number(
|
|
3036
|
+
const balanceUnits = Number(
|
|
3037
|
+
formatUnits5(BigInt(asset.balance), asset.decimals)
|
|
3038
|
+
);
|
|
2645
3039
|
if (balanceUnits > 0) return asset.balanceUsd / balanceUnits;
|
|
2646
3040
|
} catch {
|
|
2647
3041
|
}
|
|
@@ -2649,14 +3043,14 @@ function DepositFlow({
|
|
|
2649
3043
|
}
|
|
2650
3044
|
return null;
|
|
2651
3045
|
}, []);
|
|
2652
|
-
const dappSwitchChain =
|
|
3046
|
+
const dappSwitchChain = useMemo6(() => {
|
|
2653
3047
|
if (!dappWalletClient?.switchChain) return void 0;
|
|
2654
3048
|
return async (chainId) => {
|
|
2655
3049
|
await dappWalletClient.switchChain?.({ id: chainId });
|
|
2656
3050
|
};
|
|
2657
3051
|
}, [dappWalletClient]);
|
|
2658
3052
|
const connectedWalletAddress = dappWalletClient?.account?.address ?? null;
|
|
2659
|
-
const walletOptions =
|
|
3053
|
+
const walletOptions = useMemo6(() => {
|
|
2660
3054
|
const options = [];
|
|
2661
3055
|
const seen = /* @__PURE__ */ new Set();
|
|
2662
3056
|
if (connectedWalletAddress && dappAddress) {
|
|
@@ -2728,7 +3122,7 @@ function DepositFlow({
|
|
|
2728
3122
|
}, QR_AUTO_ADVANCE_HYDRATION_GRACE_MS);
|
|
2729
3123
|
return () => window.clearTimeout(timeout);
|
|
2730
3124
|
}, [isWalletHydrationPending]);
|
|
2731
|
-
const walletSelectionKey =
|
|
3125
|
+
const walletSelectionKey = useMemo6(() => {
|
|
2732
3126
|
if (flowMode !== "wallet") return null;
|
|
2733
3127
|
if (canAutoLock) {
|
|
2734
3128
|
return getAddressKey(connectedWalletAddress);
|
|
@@ -2742,7 +3136,7 @@ function DepositFlow({
|
|
|
2742
3136
|
isConnectSelectionConfirmed,
|
|
2743
3137
|
selectedWalletId
|
|
2744
3138
|
]);
|
|
2745
|
-
const walletSignerContext =
|
|
3139
|
+
const walletSignerContext = useMemo6(() => {
|
|
2746
3140
|
if (flowMode === "deposit-address") {
|
|
2747
3141
|
return null;
|
|
2748
3142
|
}
|
|
@@ -2823,7 +3217,7 @@ function DepositFlow({
|
|
|
2823
3217
|
stableWalletSignerRef.current = walletSignerContext;
|
|
2824
3218
|
}
|
|
2825
3219
|
}, [flowMode, walletSelectionKey, walletSignerContext]);
|
|
2826
|
-
const signerContext =
|
|
3220
|
+
const signerContext = useMemo6(() => {
|
|
2827
3221
|
if (flowMode === "deposit-address") {
|
|
2828
3222
|
if (!dappAddress) return null;
|
|
2829
3223
|
return {
|
|
@@ -2852,7 +3246,7 @@ function DepositFlow({
|
|
|
2852
3246
|
walletSelectionKey
|
|
2853
3247
|
]);
|
|
2854
3248
|
const sessionKeyAddress = dappAddress ?? signerContext?.ownerAddress ?? null;
|
|
2855
|
-
const lastTargetRef =
|
|
3249
|
+
const lastTargetRef = useRef6(null);
|
|
2856
3250
|
useEffect9(() => {
|
|
2857
3251
|
const prev = lastTargetRef.current;
|
|
2858
3252
|
if (prev && (prev.chain !== targetChain || prev.token.toLowerCase() !== targetToken.toLowerCase())) {
|
|
@@ -2862,20 +3256,20 @@ function DepositFlow({
|
|
|
2862
3256
|
}
|
|
2863
3257
|
lastTargetRef.current = { chain: targetChain, token: targetToken };
|
|
2864
3258
|
}, [targetChain, targetToken, step.type]);
|
|
2865
|
-
const handleBackFromAmount =
|
|
3259
|
+
const handleBackFromAmount = useCallback4(() => {
|
|
2866
3260
|
setStep((prev) => {
|
|
2867
3261
|
if (prev.type !== "amount") return prev;
|
|
2868
3262
|
return { type: "select-asset", smartAccount: prev.smartAccount };
|
|
2869
3263
|
});
|
|
2870
3264
|
}, []);
|
|
2871
|
-
const handleBackFromSelectAsset =
|
|
3265
|
+
const handleBackFromSelectAsset = useCallback4(() => {
|
|
2872
3266
|
if (hasWalletOptions || reownWallet) {
|
|
2873
3267
|
hasNavigatedBackRef.current = true;
|
|
2874
3268
|
setFlowMode(null);
|
|
2875
3269
|
setIsConnectSelectionConfirmed(false);
|
|
2876
3270
|
}
|
|
2877
3271
|
}, [hasWalletOptions, reownWallet]);
|
|
2878
|
-
const handleBackFromDepositAddress =
|
|
3272
|
+
const handleBackFromDepositAddress = useCallback4(() => {
|
|
2879
3273
|
setFlowMode(null);
|
|
2880
3274
|
setStep({ type: "setup" });
|
|
2881
3275
|
if (hasWalletOptions || reownWallet) {
|
|
@@ -2883,7 +3277,7 @@ function DepositFlow({
|
|
|
2883
3277
|
setIsConnectSelectionConfirmed(false);
|
|
2884
3278
|
}
|
|
2885
3279
|
}, [hasWalletOptions, reownWallet]);
|
|
2886
|
-
const handleBackFromSolanaTokenSelect =
|
|
3280
|
+
const handleBackFromSolanaTokenSelect = useCallback4(() => {
|
|
2887
3281
|
setFlowMode(null);
|
|
2888
3282
|
setStep({ type: "setup" });
|
|
2889
3283
|
if (hasWalletOptions || reownWallet) {
|
|
@@ -2891,7 +3285,7 @@ function DepositFlow({
|
|
|
2891
3285
|
setIsConnectSelectionConfirmed(false);
|
|
2892
3286
|
}
|
|
2893
3287
|
}, [hasWalletOptions, reownWallet]);
|
|
2894
|
-
const handleBackFromSolanaAmount =
|
|
3288
|
+
const handleBackFromSolanaAmount = useCallback4(() => {
|
|
2895
3289
|
setStep((prev) => {
|
|
2896
3290
|
if (prev.type !== "solana-amount") return prev;
|
|
2897
3291
|
return {
|
|
@@ -2901,7 +3295,7 @@ function DepositFlow({
|
|
|
2901
3295
|
};
|
|
2902
3296
|
});
|
|
2903
3297
|
}, []);
|
|
2904
|
-
const handleBackFromSolanaConfirm =
|
|
3298
|
+
const handleBackFromSolanaConfirm = useCallback4(() => {
|
|
2905
3299
|
setStep((prev) => {
|
|
2906
3300
|
if (prev.type !== "solana-confirm") return prev;
|
|
2907
3301
|
return {
|
|
@@ -2915,7 +3309,7 @@ function DepositFlow({
|
|
|
2915
3309
|
};
|
|
2916
3310
|
});
|
|
2917
3311
|
}, []);
|
|
2918
|
-
const handleBackFromConfirm =
|
|
3312
|
+
const handleBackFromConfirm = useCallback4(() => {
|
|
2919
3313
|
setStep((prev) => {
|
|
2920
3314
|
if (prev.type !== "confirm") return prev;
|
|
2921
3315
|
return {
|
|
@@ -2932,7 +3326,7 @@ function DepositFlow({
|
|
|
2932
3326
|
}, [stepIndex, currentBackHandler, onStepChangeRef]);
|
|
2933
3327
|
const stepSendToken = step.type === "amount" ? step.asset.symbol : null;
|
|
2934
3328
|
const stepOpenEventKey = step.type === "select-asset" ? "select-asset" : step.type === "deposit-address" ? "deposit-address" : step.type === "amount" && stepSendToken ? `amount:${stepSendToken.toLowerCase()}` : null;
|
|
2935
|
-
const lastStepOpenEventKeyRef =
|
|
3329
|
+
const lastStepOpenEventKeyRef = useRef6(null);
|
|
2936
3330
|
useEffect9(() => {
|
|
2937
3331
|
if (!stepOpenEventKey) {
|
|
2938
3332
|
lastStepOpenEventKeyRef.current = null;
|
|
@@ -2996,17 +3390,17 @@ function DepositFlow({
|
|
|
2996
3390
|
}, [totalBalanceUsd, onTotalBalanceChangeRef]);
|
|
2997
3391
|
const isDepositAddressMode = flowMode === "deposit-address";
|
|
2998
3392
|
const isSolanaWalletMode = flowMode === "solana-wallet";
|
|
2999
|
-
const handleSelectProvider =
|
|
3393
|
+
const handleSelectProvider = useCallback4(() => {
|
|
3000
3394
|
setFlowMode("wallet");
|
|
3001
3395
|
}, []);
|
|
3002
|
-
const handleSelectSolanaWallet =
|
|
3396
|
+
const handleSelectSolanaWallet = useCallback4(() => {
|
|
3003
3397
|
setFlowMode("solana-wallet");
|
|
3004
3398
|
}, []);
|
|
3005
|
-
const handleSelectTransferCrypto =
|
|
3399
|
+
const handleSelectTransferCrypto = useCallback4(() => {
|
|
3006
3400
|
setFlowMode("deposit-address");
|
|
3007
3401
|
setStep({ type: "setup" });
|
|
3008
3402
|
}, []);
|
|
3009
|
-
const handleNewDeposit =
|
|
3403
|
+
const handleNewDeposit = useCallback4(() => {
|
|
3010
3404
|
onSmartAccountChangeRef.current?.(null);
|
|
3011
3405
|
setFlowMode(null);
|
|
3012
3406
|
setStep({ type: "setup" });
|
|
@@ -3014,7 +3408,7 @@ function DepositFlow({
|
|
|
3014
3408
|
setSelectedWalletId(null);
|
|
3015
3409
|
hasNavigatedBackRef.current = false;
|
|
3016
3410
|
}, [onSmartAccountChangeRef]);
|
|
3017
|
-
const handleSetupComplete =
|
|
3411
|
+
const handleSetupComplete = useCallback4(
|
|
3018
3412
|
(smartAccount, solanaDepositAddress) => {
|
|
3019
3413
|
logFlow("setup:complete", {
|
|
3020
3414
|
smartAccount,
|
|
@@ -3047,35 +3441,18 @@ function DepositFlow({
|
|
|
3047
3441
|
},
|
|
3048
3442
|
[isDepositAddressMode, isSolanaWalletMode, logFlow, onSmartAccountChangeRef]
|
|
3049
3443
|
);
|
|
3050
|
-
const
|
|
3051
|
-
(
|
|
3444
|
+
const handleDepositAddressSubmitted = useCallback4(
|
|
3445
|
+
(data) => {
|
|
3052
3446
|
logFlow("deposit-address:detected", {
|
|
3053
|
-
txHash,
|
|
3054
|
-
sourceChain:
|
|
3055
|
-
|
|
3056
|
-
amount
|
|
3057
|
-
});
|
|
3058
|
-
setStep((prev) => {
|
|
3059
|
-
if (prev.type !== "deposit-address") return prev;
|
|
3060
|
-
const isEvmToken = /^0x[a-fA-F0-9]{40}$/.test(token);
|
|
3061
|
-
const directTransfer = typeof chainId === "number" && isEvmToken && isSameRoute(chainId, token, targetChain, targetToken);
|
|
3062
|
-
return {
|
|
3063
|
-
type: "processing",
|
|
3064
|
-
smartAccount: prev.smartAccount,
|
|
3065
|
-
txHash,
|
|
3066
|
-
sourceChain: chainId,
|
|
3067
|
-
sourceToken: token,
|
|
3068
|
-
amount,
|
|
3069
|
-
sourceSymbol,
|
|
3070
|
-
sourceDecimals,
|
|
3071
|
-
directTransfer
|
|
3072
|
-
};
|
|
3447
|
+
txHash: data.txHash,
|
|
3448
|
+
sourceChain: data.sourceChain,
|
|
3449
|
+
amount: data.amount
|
|
3073
3450
|
});
|
|
3074
|
-
|
|
3451
|
+
onDepositSubmittedRef.current?.(data);
|
|
3075
3452
|
},
|
|
3076
|
-
[
|
|
3453
|
+
[logFlow, onDepositSubmittedRef]
|
|
3077
3454
|
);
|
|
3078
|
-
const handleSolanaTokenContinue =
|
|
3455
|
+
const handleSolanaTokenContinue = useCallback4(
|
|
3079
3456
|
(token, balance, balanceUsd) => {
|
|
3080
3457
|
logFlow("solana:token:continue", { token: token.symbol });
|
|
3081
3458
|
setStep((prev) => {
|
|
@@ -3093,7 +3470,7 @@ function DepositFlow({
|
|
|
3093
3470
|
},
|
|
3094
3471
|
[defaultAmount, logFlow]
|
|
3095
3472
|
);
|
|
3096
|
-
const handleSolanaAmountContinue =
|
|
3473
|
+
const handleSolanaAmountContinue = useCallback4(
|
|
3097
3474
|
(token, sourceAmount, inputAmountUsd) => {
|
|
3098
3475
|
const targetSym = getTokenSymbol(targetToken, targetChain);
|
|
3099
3476
|
const isTargetStable = isStablecoinSymbol(targetSym);
|
|
@@ -3123,7 +3500,7 @@ function DepositFlow({
|
|
|
3123
3500
|
},
|
|
3124
3501
|
[targetToken, targetChain, getTokenPriceUsd, logFlow]
|
|
3125
3502
|
);
|
|
3126
|
-
const handleSolanaConfirmed =
|
|
3503
|
+
const handleSolanaConfirmed = useCallback4(
|
|
3127
3504
|
(txHash, amountUnits) => {
|
|
3128
3505
|
setStep((prev) => {
|
|
3129
3506
|
if (prev.type !== "solana-confirm") return prev;
|
|
@@ -3151,13 +3528,13 @@ function DepositFlow({
|
|
|
3151
3528
|
},
|
|
3152
3529
|
[logFlow, onDepositSubmitted]
|
|
3153
3530
|
);
|
|
3154
|
-
const handleConnected =
|
|
3531
|
+
const handleConnected = useCallback4(
|
|
3155
3532
|
(addr, smartAccount) => {
|
|
3156
3533
|
onConnected?.({ address: addr, smartAccount });
|
|
3157
3534
|
},
|
|
3158
3535
|
[onConnected]
|
|
3159
3536
|
);
|
|
3160
|
-
const handleAssetContinue =
|
|
3537
|
+
const handleAssetContinue = useCallback4(
|
|
3161
3538
|
(asset) => {
|
|
3162
3539
|
onEvent?.({
|
|
3163
3540
|
type: "deposit_modal_connected_wallet_select_source_cta_click",
|
|
@@ -3179,7 +3556,7 @@ function DepositFlow({
|
|
|
3179
3556
|
},
|
|
3180
3557
|
[defaultAmount, onEvent, totalBalanceUsd]
|
|
3181
3558
|
);
|
|
3182
|
-
const handleAmountContinue =
|
|
3559
|
+
const handleAmountContinue = useCallback4(
|
|
3183
3560
|
(amount, targetAmount, balance) => {
|
|
3184
3561
|
const targetSym = getTokenSymbol(targetToken, targetChain);
|
|
3185
3562
|
const isTargetStable = isStablecoinSymbol(targetSym);
|
|
@@ -3199,7 +3576,7 @@ function DepositFlow({
|
|
|
3199
3576
|
},
|
|
3200
3577
|
[targetToken, targetChain, getTokenPriceUsd]
|
|
3201
3578
|
);
|
|
3202
|
-
const handleDepositSubmitted =
|
|
3579
|
+
const handleDepositSubmitted = useCallback4(
|
|
3203
3580
|
(txHash, chainId, amount, token) => {
|
|
3204
3581
|
logFlow("evm:submitted", {
|
|
3205
3582
|
txHash,
|
|
@@ -3216,54 +3593,54 @@ function DepositFlow({
|
|
|
3216
3593
|
sourceChain: chainId,
|
|
3217
3594
|
sourceToken: token,
|
|
3218
3595
|
amount,
|
|
3219
|
-
directTransfer:
|
|
3596
|
+
directTransfer: isSameRoute2(chainId, token, targetChain, targetToken)
|
|
3220
3597
|
};
|
|
3221
3598
|
});
|
|
3222
3599
|
},
|
|
3223
3600
|
[targetChain, targetToken]
|
|
3224
3601
|
);
|
|
3225
|
-
const handleDepositSubmittedCallback =
|
|
3602
|
+
const handleDepositSubmittedCallback = useCallback4(
|
|
3226
3603
|
(txHash, sourceChain, amount) => {
|
|
3227
|
-
|
|
3604
|
+
onDepositSubmittedRef.current?.({ txHash, sourceChain, amount });
|
|
3228
3605
|
},
|
|
3229
|
-
[
|
|
3606
|
+
[onDepositSubmittedRef]
|
|
3230
3607
|
);
|
|
3231
|
-
const handleDepositComplete =
|
|
3608
|
+
const handleDepositComplete = useCallback4(
|
|
3232
3609
|
(txHash, destinationTxHash, context) => {
|
|
3233
3610
|
logFlow("deposit:complete", { txHash, destinationTxHash, ...context });
|
|
3234
|
-
|
|
3611
|
+
onDepositCompleteRef.current?.({ txHash, destinationTxHash, ...context });
|
|
3235
3612
|
},
|
|
3236
|
-
[logFlow,
|
|
3613
|
+
[logFlow, onDepositCompleteRef]
|
|
3237
3614
|
);
|
|
3238
|
-
const handleDepositFailed =
|
|
3615
|
+
const handleDepositFailed = useCallback4(
|
|
3239
3616
|
(txHash, error) => {
|
|
3240
3617
|
logFlowError("deposit:failed", error, { txHash });
|
|
3241
|
-
|
|
3618
|
+
onDepositFailedRef.current?.({ txHash, error });
|
|
3242
3619
|
},
|
|
3243
|
-
[logFlowError,
|
|
3620
|
+
[logFlowError, onDepositFailedRef]
|
|
3244
3621
|
);
|
|
3245
|
-
const handleError =
|
|
3622
|
+
const handleError = useCallback4(
|
|
3246
3623
|
(message, code) => {
|
|
3247
3624
|
logFlowError("flow:error", message, { code });
|
|
3248
|
-
|
|
3625
|
+
onErrorRef.current?.({ message, code });
|
|
3249
3626
|
},
|
|
3250
|
-
[logFlowError,
|
|
3627
|
+
[logFlowError, onErrorRef]
|
|
3251
3628
|
);
|
|
3252
|
-
const handleTotalBalanceComputed =
|
|
3629
|
+
const handleTotalBalanceComputed = useCallback4((total) => {
|
|
3253
3630
|
setTotalBalanceUsd(total);
|
|
3254
3631
|
}, []);
|
|
3255
|
-
const selectedWalletIdEffective =
|
|
3632
|
+
const selectedWalletIdEffective = useMemo6(() => {
|
|
3256
3633
|
if (selectedWalletId) return selectedWalletId;
|
|
3257
3634
|
if (walletOptions.length === 1) {
|
|
3258
3635
|
return walletOptions[0].id;
|
|
3259
3636
|
}
|
|
3260
3637
|
return null;
|
|
3261
3638
|
}, [selectedWalletId, walletOptions]);
|
|
3262
|
-
const walletOptionsKey =
|
|
3639
|
+
const walletOptionsKey = useMemo6(
|
|
3263
3640
|
() => walletOptions.map((option) => option.id).join(","),
|
|
3264
3641
|
[walletOptions]
|
|
3265
3642
|
);
|
|
3266
|
-
const hasNavigatedBackRef =
|
|
3643
|
+
const hasNavigatedBackRef = useRef6(false);
|
|
3267
3644
|
useEffect9(() => {
|
|
3268
3645
|
if (flowModeRef.current) {
|
|
3269
3646
|
return;
|
|
@@ -3331,7 +3708,7 @@ function DepositFlow({
|
|
|
3331
3708
|
handleSelectTransferCrypto
|
|
3332
3709
|
]);
|
|
3333
3710
|
if (showConnectStep) {
|
|
3334
|
-
return /* @__PURE__ */
|
|
3711
|
+
return /* @__PURE__ */ jsx11("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx11(
|
|
3335
3712
|
ConnectStep,
|
|
3336
3713
|
{
|
|
3337
3714
|
walletOptions,
|
|
@@ -3365,7 +3742,7 @@ function DepositFlow({
|
|
|
3365
3742
|
if (isDepositAddressMode) {
|
|
3366
3743
|
if (!dappAddress || !sessionKeyAddress) return null;
|
|
3367
3744
|
return /* @__PURE__ */ jsxs10("div", { className: "rs-modal-body", children: [
|
|
3368
|
-
step.type === "setup" && /* @__PURE__ */
|
|
3745
|
+
step.type === "setup" && /* @__PURE__ */ jsx11(
|
|
3369
3746
|
SetupStep,
|
|
3370
3747
|
{
|
|
3371
3748
|
address: sessionKeyAddress,
|
|
@@ -3375,6 +3752,8 @@ function DepositFlow({
|
|
|
3375
3752
|
sessionChainIds,
|
|
3376
3753
|
recipient,
|
|
3377
3754
|
postBridgeActions,
|
|
3755
|
+
outputTokenRules,
|
|
3756
|
+
rejectUnmapped,
|
|
3378
3757
|
forceRegister,
|
|
3379
3758
|
enableSolana,
|
|
3380
3759
|
service,
|
|
@@ -3383,14 +3762,20 @@ function DepositFlow({
|
|
|
3383
3762
|
onError: handleError
|
|
3384
3763
|
}
|
|
3385
3764
|
),
|
|
3386
|
-
step.type === "deposit-address" && /* @__PURE__ */
|
|
3765
|
+
step.type === "deposit-address" && /* @__PURE__ */ jsx11(
|
|
3387
3766
|
DepositAddressStep,
|
|
3388
3767
|
{
|
|
3389
3768
|
smartAccount: step.smartAccount,
|
|
3390
3769
|
solanaDepositAddress: enableSolana ? step.solanaDepositAddress : void 0,
|
|
3391
3770
|
service,
|
|
3392
3771
|
allowedRoutes,
|
|
3393
|
-
|
|
3772
|
+
targetChain,
|
|
3773
|
+
targetToken,
|
|
3774
|
+
waitForFinalTx,
|
|
3775
|
+
hasPostBridgeActions: Boolean(postBridgeActions?.length),
|
|
3776
|
+
onDepositSubmitted: handleDepositAddressSubmitted,
|
|
3777
|
+
onDepositComplete: handleDepositComplete,
|
|
3778
|
+
onDepositFailed: handleDepositFailed,
|
|
3394
3779
|
onCopyAddress: () => {
|
|
3395
3780
|
const chainName = getChainName(targetChain);
|
|
3396
3781
|
const tokenSymbol = getTokenSymbol(targetToken, targetChain);
|
|
@@ -3402,29 +3787,6 @@ function DepositFlow({
|
|
|
3402
3787
|
cta_name: "copy"
|
|
3403
3788
|
});
|
|
3404
3789
|
},
|
|
3405
|
-
onError: handleError
|
|
3406
|
-
}
|
|
3407
|
-
),
|
|
3408
|
-
step.type === "processing" && /* @__PURE__ */ jsx10(
|
|
3409
|
-
ProcessingStep,
|
|
3410
|
-
{
|
|
3411
|
-
smartAccount: step.smartAccount,
|
|
3412
|
-
txHash: step.txHash,
|
|
3413
|
-
sourceChain: step.sourceChain,
|
|
3414
|
-
sourceToken: step.sourceToken,
|
|
3415
|
-
targetChain,
|
|
3416
|
-
targetToken,
|
|
3417
|
-
amount: step.amount,
|
|
3418
|
-
sourceSymbol: step.sourceSymbol,
|
|
3419
|
-
sourceDecimals: step.sourceDecimals,
|
|
3420
|
-
waitForFinalTx,
|
|
3421
|
-
hasPostBridgeActions: Boolean(postBridgeActions?.length),
|
|
3422
|
-
service,
|
|
3423
|
-
directTransfer: step.directTransfer,
|
|
3424
|
-
onClose,
|
|
3425
|
-
onNewDeposit: handleNewDeposit,
|
|
3426
|
-
onDepositComplete: handleDepositComplete,
|
|
3427
|
-
onDepositFailed: handleDepositFailed,
|
|
3428
3790
|
onError: handleError,
|
|
3429
3791
|
debug
|
|
3430
3792
|
}
|
|
@@ -3436,7 +3798,7 @@ function DepositFlow({
|
|
|
3436
3798
|
const solanaAddr = reownWallet?.solanaAddress;
|
|
3437
3799
|
const solanaProvider = reownWallet?.solanaProvider;
|
|
3438
3800
|
return /* @__PURE__ */ jsxs10("div", { className: "rs-modal-body", children: [
|
|
3439
|
-
step.type === "setup" && /* @__PURE__ */
|
|
3801
|
+
step.type === "setup" && /* @__PURE__ */ jsx11(
|
|
3440
3802
|
SetupStep,
|
|
3441
3803
|
{
|
|
3442
3804
|
address: sessionKeyAddress,
|
|
@@ -3446,6 +3808,8 @@ function DepositFlow({
|
|
|
3446
3808
|
sessionChainIds,
|
|
3447
3809
|
recipient,
|
|
3448
3810
|
postBridgeActions,
|
|
3811
|
+
outputTokenRules,
|
|
3812
|
+
rejectUnmapped,
|
|
3449
3813
|
forceRegister,
|
|
3450
3814
|
enableSolana,
|
|
3451
3815
|
service,
|
|
@@ -3454,7 +3818,7 @@ function DepositFlow({
|
|
|
3454
3818
|
onError: handleError
|
|
3455
3819
|
}
|
|
3456
3820
|
),
|
|
3457
|
-
step.type === "solana-token-select" && solanaAddr && /* @__PURE__ */
|
|
3821
|
+
step.type === "solana-token-select" && solanaAddr && /* @__PURE__ */ jsx11(
|
|
3458
3822
|
SolanaTokenSelectStep,
|
|
3459
3823
|
{
|
|
3460
3824
|
solanaAddress: solanaAddr,
|
|
@@ -3464,7 +3828,7 @@ function DepositFlow({
|
|
|
3464
3828
|
debug
|
|
3465
3829
|
}
|
|
3466
3830
|
),
|
|
3467
|
-
step.type === "solana-amount" && /* @__PURE__ */
|
|
3831
|
+
step.type === "solana-amount" && /* @__PURE__ */ jsx11(
|
|
3468
3832
|
SolanaAmountStep,
|
|
3469
3833
|
{
|
|
3470
3834
|
token: step.token,
|
|
@@ -3476,7 +3840,7 @@ function DepositFlow({
|
|
|
3476
3840
|
debug
|
|
3477
3841
|
}
|
|
3478
3842
|
),
|
|
3479
|
-
step.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */
|
|
3843
|
+
step.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */ jsx11(
|
|
3480
3844
|
SolanaConfirmStep,
|
|
3481
3845
|
{
|
|
3482
3846
|
smartAccount: step.smartAccount,
|
|
@@ -3497,14 +3861,14 @@ function DepositFlow({
|
|
|
3497
3861
|
}
|
|
3498
3862
|
) : step.type === "solana-confirm" ? /* @__PURE__ */ jsxs10("div", { className: "rs-step", children: [
|
|
3499
3863
|
/* @__PURE__ */ jsxs10("div", { className: "rs-loading-state", children: [
|
|
3500
|
-
/* @__PURE__ */
|
|
3864
|
+
/* @__PURE__ */ jsx11("div", { className: "rs-step-icon rs-step-icon--error", children: /* @__PURE__ */ jsx11(
|
|
3501
3865
|
"svg",
|
|
3502
3866
|
{
|
|
3503
3867
|
viewBox: "0 0 24 24",
|
|
3504
3868
|
fill: "none",
|
|
3505
3869
|
stroke: "currentColor",
|
|
3506
3870
|
strokeWidth: "2",
|
|
3507
|
-
children: /* @__PURE__ */
|
|
3871
|
+
children: /* @__PURE__ */ jsx11(
|
|
3508
3872
|
"path",
|
|
3509
3873
|
{
|
|
3510
3874
|
strokeLinecap: "round",
|
|
@@ -3515,21 +3879,21 @@ function DepositFlow({
|
|
|
3515
3879
|
}
|
|
3516
3880
|
) }),
|
|
3517
3881
|
/* @__PURE__ */ jsxs10("div", { className: "rs-loading-text", children: [
|
|
3518
|
-
/* @__PURE__ */
|
|
3519
|
-
/* @__PURE__ */
|
|
3882
|
+
/* @__PURE__ */ jsx11("div", { className: "rs-loading-title rs-text-error", children: "Wallet disconnected" }),
|
|
3883
|
+
/* @__PURE__ */ jsx11("div", { className: "rs-loading-subtitle", children: "Please reconnect your Solana wallet to continue." })
|
|
3520
3884
|
] })
|
|
3521
3885
|
] }),
|
|
3522
|
-
/* @__PURE__ */
|
|
3886
|
+
/* @__PURE__ */ jsx11("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx11(
|
|
3523
3887
|
"button",
|
|
3524
3888
|
{
|
|
3525
3889
|
type: "button",
|
|
3526
3890
|
className: "rs-button rs-button--default rs-button--full-width",
|
|
3527
3891
|
onClick: handleBackFromSolanaConfirm,
|
|
3528
|
-
children: /* @__PURE__ */
|
|
3892
|
+
children: /* @__PURE__ */ jsx11("span", { children: "Go Back" })
|
|
3529
3893
|
}
|
|
3530
3894
|
) })
|
|
3531
3895
|
] }) : null,
|
|
3532
|
-
step.type === "processing" && /* @__PURE__ */
|
|
3896
|
+
step.type === "processing" && /* @__PURE__ */ jsx11(
|
|
3533
3897
|
ProcessingStep,
|
|
3534
3898
|
{
|
|
3535
3899
|
smartAccount: step.smartAccount,
|
|
@@ -3556,7 +3920,7 @@ function DepositFlow({
|
|
|
3556
3920
|
] });
|
|
3557
3921
|
}
|
|
3558
3922
|
if (!signerContext?.walletClient || !signerContext?.publicClient) {
|
|
3559
|
-
return /* @__PURE__ */
|
|
3923
|
+
return /* @__PURE__ */ jsx11("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx11("div", { className: "rs-step", children: /* @__PURE__ */ jsx11("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsx11("div", { className: "rs-loading-text", children: /* @__PURE__ */ jsx11("div", { className: "rs-loading-title", children: "Connecting wallet..." }) }) }) }) });
|
|
3560
3924
|
}
|
|
3561
3925
|
const ownerAddress = signerContext.ownerAddress;
|
|
3562
3926
|
const ownerChainId = signerContext.walletClient?.chain?.id ?? signerContext.publicClient.chain?.id ?? targetChain;
|
|
@@ -3567,7 +3931,7 @@ function DepositFlow({
|
|
|
3567
3931
|
return getPublicClient(chainId);
|
|
3568
3932
|
};
|
|
3569
3933
|
return /* @__PURE__ */ jsxs10("div", { className: "rs-modal-body", children: [
|
|
3570
|
-
step.type === "setup" && /* @__PURE__ */
|
|
3934
|
+
step.type === "setup" && /* @__PURE__ */ jsx11(
|
|
3571
3935
|
SetupStep,
|
|
3572
3936
|
{
|
|
3573
3937
|
walletClient: signerContext.walletClient,
|
|
@@ -3578,6 +3942,8 @@ function DepositFlow({
|
|
|
3578
3942
|
sessionChainIds,
|
|
3579
3943
|
recipient,
|
|
3580
3944
|
postBridgeActions,
|
|
3945
|
+
outputTokenRules,
|
|
3946
|
+
rejectUnmapped,
|
|
3581
3947
|
forceRegister,
|
|
3582
3948
|
enableSolana,
|
|
3583
3949
|
service,
|
|
@@ -3586,7 +3952,7 @@ function DepositFlow({
|
|
|
3586
3952
|
onError: handleError
|
|
3587
3953
|
}
|
|
3588
3954
|
),
|
|
3589
|
-
step.type === "select-asset" && /* @__PURE__ */
|
|
3955
|
+
step.type === "select-asset" && /* @__PURE__ */ jsx11(
|
|
3590
3956
|
AssetSelectStep,
|
|
3591
3957
|
{
|
|
3592
3958
|
address: ownerAddress,
|
|
@@ -3597,10 +3963,14 @@ function DepositFlow({
|
|
|
3597
3963
|
service,
|
|
3598
3964
|
onContinue: handleAssetContinue,
|
|
3599
3965
|
onTotalBalanceComputed: handleTotalBalanceComputed,
|
|
3600
|
-
onAssetsLoaded: handleAssetsLoaded
|
|
3966
|
+
onAssetsLoaded: handleAssetsLoaded,
|
|
3967
|
+
onDisconnect: onDisconnect ? () => {
|
|
3968
|
+
onDisconnect();
|
|
3969
|
+
handleBackFromSelectAsset();
|
|
3970
|
+
} : void 0
|
|
3601
3971
|
}
|
|
3602
3972
|
),
|
|
3603
|
-
step.type === "amount" && /* @__PURE__ */
|
|
3973
|
+
step.type === "amount" && /* @__PURE__ */ jsx11(
|
|
3604
3974
|
AmountStep,
|
|
3605
3975
|
{
|
|
3606
3976
|
walletClient: signerContext.walletClient,
|
|
@@ -3625,7 +3995,7 @@ function DepositFlow({
|
|
|
3625
3995
|
}
|
|
3626
3996
|
}
|
|
3627
3997
|
),
|
|
3628
|
-
step.type === "confirm" && /* @__PURE__ */
|
|
3998
|
+
step.type === "confirm" && /* @__PURE__ */ jsx11(
|
|
3629
3999
|
ConfirmStep,
|
|
3630
4000
|
{
|
|
3631
4001
|
walletClient: signerContext.walletClient,
|
|
@@ -3645,7 +4015,7 @@ function DepositFlow({
|
|
|
3645
4015
|
onError: handleError
|
|
3646
4016
|
}
|
|
3647
4017
|
),
|
|
3648
|
-
step.type === "processing" && /* @__PURE__ */
|
|
4018
|
+
step.type === "processing" && /* @__PURE__ */ jsx11(
|
|
3649
4019
|
ProcessingStep,
|
|
3650
4020
|
{
|
|
3651
4021
|
smartAccount: step.smartAccount,
|
|
@@ -3673,13 +4043,13 @@ function DepositFlow({
|
|
|
3673
4043
|
}
|
|
3674
4044
|
|
|
3675
4045
|
// src/components/history/DepositHistoryPanel.tsx
|
|
3676
|
-
import { useCallback as
|
|
3677
|
-
import { Fragment as
|
|
4046
|
+
import { useCallback as useCallback5 } from "react";
|
|
4047
|
+
import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3678
4048
|
function shortenHash(hash) {
|
|
3679
4049
|
if (hash.length <= 14) return hash;
|
|
3680
4050
|
return `${hash.slice(0, 6)}\u2026${hash.slice(-4)}`;
|
|
3681
4051
|
}
|
|
3682
|
-
function
|
|
4052
|
+
function formatTimestamp2(iso) {
|
|
3683
4053
|
try {
|
|
3684
4054
|
const date = new Date(iso);
|
|
3685
4055
|
if (Number.isNaN(date.getTime())) return iso;
|
|
@@ -3711,6 +4081,16 @@ function resolveChainId(value) {
|
|
|
3711
4081
|
}
|
|
3712
4082
|
function resolveTokenSymbol(token, chainId) {
|
|
3713
4083
|
if (!token) return "";
|
|
4084
|
+
if (chainId === "solana") {
|
|
4085
|
+
const normalized = token.toLowerCase();
|
|
4086
|
+
const matched = SOLANA_TOKENS.find(
|
|
4087
|
+
(entry) => entry.mint.toLowerCase() === normalized
|
|
4088
|
+
);
|
|
4089
|
+
if (matched) return matched.symbol;
|
|
4090
|
+
if (normalized === "native" || normalized === "11111111111111111111111111111111" || normalized === "so11111111111111111111111111111111111111112") {
|
|
4091
|
+
return "SOL";
|
|
4092
|
+
}
|
|
4093
|
+
}
|
|
3714
4094
|
if (chainId !== null && chainId !== void 0 && chainId !== "solana" && /^0x[a-fA-F0-9]{40}$/.test(token)) {
|
|
3715
4095
|
const sym = getTokenSymbol(token, chainId);
|
|
3716
4096
|
if (sym !== "Token") return sym;
|
|
@@ -3720,12 +4100,24 @@ function resolveTokenSymbol(token, chainId) {
|
|
|
3720
4100
|
function formatAmount(rawAmount, token, chainId) {
|
|
3721
4101
|
if (!rawAmount) return "";
|
|
3722
4102
|
let decimals = 18;
|
|
3723
|
-
if (token && chainId !== null && chainId !== void 0
|
|
3724
|
-
|
|
4103
|
+
if (token && chainId !== null && chainId !== void 0) {
|
|
4104
|
+
if (chainId === "solana") {
|
|
4105
|
+
const normalized = token.toLowerCase();
|
|
4106
|
+
const matched = SOLANA_TOKENS.find(
|
|
4107
|
+
(entry) => entry.mint.toLowerCase() === normalized
|
|
4108
|
+
);
|
|
4109
|
+
if (matched) {
|
|
4110
|
+
decimals = matched.decimals;
|
|
4111
|
+
} else if (normalized === "native" || normalized === "11111111111111111111111111111111" || normalized === "so11111111111111111111111111111111111111112") {
|
|
4112
|
+
decimals = 9;
|
|
4113
|
+
}
|
|
4114
|
+
} else if (/^0x[a-fA-F0-9]{40}$/.test(token)) {
|
|
4115
|
+
decimals = getTokenDecimalsByAddress(token, chainId);
|
|
4116
|
+
}
|
|
3725
4117
|
}
|
|
3726
4118
|
try {
|
|
3727
4119
|
const raw = BigInt(rawAmount);
|
|
3728
|
-
const divisor =
|
|
4120
|
+
const divisor = 10n ** BigInt(decimals);
|
|
3729
4121
|
const whole = raw / divisor;
|
|
3730
4122
|
const remainder = raw % divisor;
|
|
3731
4123
|
if (remainder === 0n) return whole.toString();
|
|
@@ -3757,7 +4149,7 @@ var STATUS_LABEL = {
|
|
|
3757
4149
|
failed: "Failed"
|
|
3758
4150
|
};
|
|
3759
4151
|
function ExternalLinkIcon() {
|
|
3760
|
-
return /* @__PURE__ */
|
|
4152
|
+
return /* @__PURE__ */ jsx12("svg", { className: "rs-history-ext-icon", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ jsx12("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 1.5H2.25A.75.75 0 0 0 1.5 2.25v7.5c0 .414.336.75.75.75h7.5a.75.75 0 0 0 .75-.75V7.5m-3-6h3m0 0v3m0-3L6 6" }) });
|
|
3761
4153
|
}
|
|
3762
4154
|
function DepositHistoryPanel({
|
|
3763
4155
|
deposits,
|
|
@@ -3768,7 +4160,7 @@ function DepositHistoryPanel({
|
|
|
3768
4160
|
onLoadMore,
|
|
3769
4161
|
onClose
|
|
3770
4162
|
}) {
|
|
3771
|
-
const handleKeyDown =
|
|
4163
|
+
const handleKeyDown = useCallback5(
|
|
3772
4164
|
(e) => {
|
|
3773
4165
|
if (e.key === "Escape") {
|
|
3774
4166
|
e.stopPropagation();
|
|
@@ -3786,39 +4178,39 @@ function DepositHistoryPanel({
|
|
|
3786
4178
|
onKeyDown: handleKeyDown,
|
|
3787
4179
|
children: [
|
|
3788
4180
|
/* @__PURE__ */ jsxs11("div", { className: "rs-history-header", children: [
|
|
3789
|
-
/* @__PURE__ */
|
|
4181
|
+
/* @__PURE__ */ jsx12(
|
|
3790
4182
|
"button",
|
|
3791
4183
|
{
|
|
3792
4184
|
type: "button",
|
|
3793
4185
|
className: "rs-history-back",
|
|
3794
4186
|
"aria-label": "Close history",
|
|
3795
4187
|
onClick: onClose,
|
|
3796
|
-
children: /* @__PURE__ */
|
|
4188
|
+
children: /* @__PURE__ */ jsx12("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx12("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15.75 19.5L8.25 12l7.5-7.5" }) })
|
|
3797
4189
|
}
|
|
3798
4190
|
),
|
|
3799
|
-
/* @__PURE__ */
|
|
3800
|
-
/* @__PURE__ */
|
|
4191
|
+
/* @__PURE__ */ jsx12("span", { className: "rs-history-header-title", children: "History" }),
|
|
4192
|
+
/* @__PURE__ */ jsx12("div", { className: "rs-history-header-spacer" })
|
|
3801
4193
|
] }),
|
|
3802
4194
|
/* @__PURE__ */ jsxs11("div", { className: "rs-history-body", children: [
|
|
3803
4195
|
isLoading && deposits.length === 0 && /* @__PURE__ */ jsxs11("div", { className: "rs-history-state", children: [
|
|
3804
|
-
/* @__PURE__ */
|
|
3805
|
-
/* @__PURE__ */
|
|
4196
|
+
/* @__PURE__ */ jsx12("div", { className: "rs-history-spinner", children: /* @__PURE__ */ jsx12("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx12("path", { d: "M12 2v4m0 12v4m-7.07-3.93l2.83-2.83m8.48-8.48l2.83-2.83M2 12h4m12 0h4M4.93 4.93l2.83 2.83m8.48 8.48l2.83 2.83", strokeLinecap: "round" }) }) }),
|
|
4197
|
+
/* @__PURE__ */ jsx12("span", { className: "rs-history-state-text", children: "Loading history..." })
|
|
3806
4198
|
] }),
|
|
3807
4199
|
error && !isLoading && /* @__PURE__ */ jsxs11("div", { className: "rs-history-state", children: [
|
|
3808
|
-
/* @__PURE__ */
|
|
3809
|
-
/* @__PURE__ */
|
|
3810
|
-
/* @__PURE__ */
|
|
4200
|
+
/* @__PURE__ */ jsx12("div", { className: "rs-history-state-icon rs-history-state-icon--error", children: /* @__PURE__ */ jsxs11("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
4201
|
+
/* @__PURE__ */ jsx12("circle", { cx: "12", cy: "12", r: "10" }),
|
|
4202
|
+
/* @__PURE__ */ jsx12("path", { strokeLinecap: "round", d: "M12 8v4m0 4h.01" })
|
|
3811
4203
|
] }) }),
|
|
3812
|
-
/* @__PURE__ */
|
|
4204
|
+
/* @__PURE__ */ jsx12("span", { className: "rs-history-state-text", children: error })
|
|
3813
4205
|
] }),
|
|
3814
4206
|
!isLoading && !error && deposits.length === 0 && /* @__PURE__ */ jsxs11("div", { className: "rs-history-state", children: [
|
|
3815
|
-
/* @__PURE__ */
|
|
3816
|
-
/* @__PURE__ */
|
|
3817
|
-
/* @__PURE__ */
|
|
4207
|
+
/* @__PURE__ */ jsx12("div", { className: "rs-history-state-icon", children: /* @__PURE__ */ jsx12("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ jsx12("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" }) }) }),
|
|
4208
|
+
/* @__PURE__ */ jsx12("span", { className: "rs-history-state-text", children: "No deposits yet" }),
|
|
4209
|
+
/* @__PURE__ */ jsx12("span", { className: "rs-history-state-hint", children: "Your deposit history will appear here" })
|
|
3818
4210
|
] }),
|
|
3819
4211
|
deposits.length > 0 && /* @__PURE__ */ jsxs11("div", { className: "rs-history-list", children: [
|
|
3820
|
-
deposits.map((deposit, i) => /* @__PURE__ */
|
|
3821
|
-
hasMore && /* @__PURE__ */
|
|
4212
|
+
deposits.map((deposit, i) => /* @__PURE__ */ jsx12(HistoryRow, { deposit }, deposit.txHash || i)),
|
|
4213
|
+
hasMore && /* @__PURE__ */ jsx12(
|
|
3822
4214
|
"button",
|
|
3823
4215
|
{
|
|
3824
4216
|
type: "button",
|
|
@@ -3846,38 +4238,38 @@ function HistoryRow({ deposit }) {
|
|
|
3846
4238
|
const targetSymbol = resolveTokenSymbol(deposit.targetToken, targetChainId);
|
|
3847
4239
|
const rawAmount = deposit.sourceAmount ?? deposit.amount;
|
|
3848
4240
|
const formattedAmount = rawAmount ? formatAmount(rawAmount, deposit.token, sourceChainId) : null;
|
|
3849
|
-
const timestamp = deposit.createdAt ?
|
|
4241
|
+
const timestamp = deposit.createdAt ? formatTimestamp2(deposit.createdAt) : null;
|
|
3850
4242
|
const srcTxUrl = deposit.sourceTxHash ? getTxExplorerUrl(deposit.sourceTxHash, sourceChainId) : null;
|
|
3851
4243
|
const dstTxUrl = deposit.destinationTxHash ? getTxExplorerUrl(deposit.destinationTxHash, targetChainId) : null;
|
|
3852
4244
|
return /* @__PURE__ */ jsxs11("div", { className: "rs-history-row", children: [
|
|
3853
4245
|
/* @__PURE__ */ jsxs11("div", { className: "rs-history-row-primary", children: [
|
|
3854
4246
|
/* @__PURE__ */ jsxs11("div", { className: "rs-history-route", children: [
|
|
3855
4247
|
/* @__PURE__ */ jsxs11("span", { className: "rs-history-chain", children: [
|
|
3856
|
-
sourceChainIcon && /* @__PURE__ */
|
|
3857
|
-
/* @__PURE__ */
|
|
4248
|
+
sourceChainIcon && /* @__PURE__ */ jsx12("img", { src: sourceChainIcon, alt: "", className: "rs-history-chain-icon" }),
|
|
4249
|
+
/* @__PURE__ */ jsx12("span", { className: "rs-history-chain-name", children: sourceChainName ?? "Unknown" })
|
|
3858
4250
|
] }),
|
|
3859
|
-
/* @__PURE__ */
|
|
4251
|
+
/* @__PURE__ */ jsx12("svg", { className: "rs-history-route-arrow", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ jsx12("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M2.5 6h7m0 0L7 3.5M9.5 6 7 8.5" }) }),
|
|
3860
4252
|
/* @__PURE__ */ jsxs11("span", { className: "rs-history-chain", children: [
|
|
3861
|
-
targetChainIcon && /* @__PURE__ */
|
|
3862
|
-
/* @__PURE__ */
|
|
4253
|
+
targetChainIcon && /* @__PURE__ */ jsx12("img", { src: targetChainIcon, alt: "", className: "rs-history-chain-icon" }),
|
|
4254
|
+
/* @__PURE__ */ jsx12("span", { className: "rs-history-chain-name", children: targetChainName ?? "Unknown" })
|
|
3863
4255
|
] })
|
|
3864
4256
|
] }),
|
|
3865
4257
|
/* @__PURE__ */ jsxs11("span", { className: `rs-history-status rs-history-status--${status}`, children: [
|
|
3866
|
-
/* @__PURE__ */
|
|
4258
|
+
/* @__PURE__ */ jsx12("span", { className: `rs-history-dot rs-history-dot--${status}` }),
|
|
3867
4259
|
STATUS_LABEL[status]
|
|
3868
4260
|
] })
|
|
3869
4261
|
] }),
|
|
3870
4262
|
/* @__PURE__ */ jsxs11("div", { className: "rs-history-row-secondary", children: [
|
|
3871
|
-
/* @__PURE__ */
|
|
4263
|
+
/* @__PURE__ */ jsx12("span", { className: "rs-history-amount", children: formattedAmount ? /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
3872
4264
|
formattedAmount,
|
|
3873
4265
|
" ",
|
|
3874
|
-
/* @__PURE__ */
|
|
4266
|
+
/* @__PURE__ */ jsx12("span", { className: "rs-history-token", children: sourceSymbol }),
|
|
3875
4267
|
targetSymbol && sourceSymbol !== targetSymbol && /* @__PURE__ */ jsxs11("span", { className: "rs-history-token-target", children: [
|
|
3876
4268
|
" \u2192 ",
|
|
3877
4269
|
targetSymbol
|
|
3878
4270
|
] })
|
|
3879
|
-
] }) : /* @__PURE__ */
|
|
3880
|
-
timestamp && /* @__PURE__ */
|
|
4271
|
+
] }) : /* @__PURE__ */ jsx12("span", { className: "rs-history-no-amount", children: "\u2014" }) }),
|
|
4272
|
+
timestamp && /* @__PURE__ */ jsx12("span", { className: "rs-history-time", children: timestamp })
|
|
3881
4273
|
] }),
|
|
3882
4274
|
(srcTxUrl || dstTxUrl) && /* @__PURE__ */ jsxs11("div", { className: "rs-history-row-links", children: [
|
|
3883
4275
|
srcTxUrl && deposit.sourceTxHash && /* @__PURE__ */ jsxs11(
|
|
@@ -3889,8 +4281,8 @@ function HistoryRow({ deposit }) {
|
|
|
3889
4281
|
className: "rs-history-tx-link",
|
|
3890
4282
|
title: deposit.sourceTxHash,
|
|
3891
4283
|
children: [
|
|
3892
|
-
/* @__PURE__ */
|
|
3893
|
-
/* @__PURE__ */
|
|
4284
|
+
/* @__PURE__ */ jsx12("span", { className: "rs-history-tx-hash", children: shortenHash(deposit.sourceTxHash) }),
|
|
4285
|
+
/* @__PURE__ */ jsx12(ExternalLinkIcon, {})
|
|
3894
4286
|
]
|
|
3895
4287
|
}
|
|
3896
4288
|
),
|
|
@@ -3903,8 +4295,8 @@ function HistoryRow({ deposit }) {
|
|
|
3903
4295
|
className: "rs-history-tx-link",
|
|
3904
4296
|
title: deposit.destinationTxHash,
|
|
3905
4297
|
children: [
|
|
3906
|
-
/* @__PURE__ */
|
|
3907
|
-
/* @__PURE__ */
|
|
4298
|
+
/* @__PURE__ */ jsx12("span", { className: "rs-history-tx-hash", children: shortenHash(deposit.destinationTxHash) }),
|
|
4299
|
+
/* @__PURE__ */ jsx12(ExternalLinkIcon, {})
|
|
3908
4300
|
]
|
|
3909
4301
|
}
|
|
3910
4302
|
)
|
|
@@ -3914,9 +4306,9 @@ function HistoryRow({ deposit }) {
|
|
|
3914
4306
|
DepositHistoryPanel.displayName = "DepositHistoryPanel";
|
|
3915
4307
|
|
|
3916
4308
|
// src/DepositModal.tsx
|
|
3917
|
-
import { jsx as
|
|
4309
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3918
4310
|
var ReownDepositInner = lazy(
|
|
3919
|
-
() => import("./DepositModalReown-
|
|
4311
|
+
() => import("./DepositModalReown-EYIV6APK.mjs").then((m) => ({ default: m.DepositModalReown }))
|
|
3920
4312
|
);
|
|
3921
4313
|
function DepositModal(props) {
|
|
3922
4314
|
const needsReown = !!props.reownAppId;
|
|
@@ -3925,7 +4317,7 @@ function DepositModal(props) {
|
|
|
3925
4317
|
"dappWalletClient"
|
|
3926
4318
|
);
|
|
3927
4319
|
if (needsReown) {
|
|
3928
|
-
return /* @__PURE__ */
|
|
4320
|
+
return /* @__PURE__ */ jsx13(Suspense, { fallback: null, children: /* @__PURE__ */ jsx13(
|
|
3929
4321
|
ReownDepositInner,
|
|
3930
4322
|
{
|
|
3931
4323
|
...props,
|
|
@@ -3933,7 +4325,7 @@ function DepositModal(props) {
|
|
|
3933
4325
|
}
|
|
3934
4326
|
) });
|
|
3935
4327
|
}
|
|
3936
|
-
return /* @__PURE__ */
|
|
4328
|
+
return /* @__PURE__ */ jsx13(
|
|
3937
4329
|
DepositModalInner,
|
|
3938
4330
|
{
|
|
3939
4331
|
...props,
|
|
@@ -3965,6 +4357,8 @@ function DepositModalInner({
|
|
|
3965
4357
|
waitForFinalTx = true,
|
|
3966
4358
|
enableSolana = true,
|
|
3967
4359
|
postBridgeActions,
|
|
4360
|
+
outputTokenRules,
|
|
4361
|
+
rejectUnmapped,
|
|
3968
4362
|
reownWallet,
|
|
3969
4363
|
onConnect,
|
|
3970
4364
|
onDisconnect,
|
|
@@ -3984,11 +4378,11 @@ function DepositModalInner({
|
|
|
3984
4378
|
onError,
|
|
3985
4379
|
debug
|
|
3986
4380
|
}) {
|
|
3987
|
-
const modalRef =
|
|
4381
|
+
const modalRef = useRef7(null);
|
|
3988
4382
|
const onReadyRef = useLatestRef(onReady);
|
|
3989
4383
|
const [currentStepIndex, setCurrentStepIndex] = useState11(0);
|
|
3990
4384
|
const [totalBalanceUsd, setTotalBalanceUsd] = useState11(null);
|
|
3991
|
-
const backHandlerRef =
|
|
4385
|
+
const backHandlerRef = useRef7(void 0);
|
|
3992
4386
|
const showHistoryButton = uiConfig?.showHistoryButton ?? false;
|
|
3993
4387
|
const [activeSmartAccount, setActiveSmartAccount] = useState11(null);
|
|
3994
4388
|
const [historyOpen, setHistoryOpen] = useState11(false);
|
|
@@ -3997,11 +4391,11 @@ function DepositModalInner({
|
|
|
3997
4391
|
const [historyLoading, setHistoryLoading] = useState11(false);
|
|
3998
4392
|
const [historyLoadingMore, setHistoryLoadingMore] = useState11(false);
|
|
3999
4393
|
const [historyError, setHistoryError] = useState11(null);
|
|
4000
|
-
const historyStaleRef =
|
|
4001
|
-
const historyLoadedRef =
|
|
4394
|
+
const historyStaleRef = useRef7(false);
|
|
4395
|
+
const historyLoadedRef = useRef7(false);
|
|
4002
4396
|
const targetChain = getChainId(targetChainProp);
|
|
4003
4397
|
const sourceChain = sourceChainProp ? getChainId(sourceChainProp) : void 0;
|
|
4004
|
-
const service =
|
|
4398
|
+
const service = useMemo7(
|
|
4005
4399
|
() => createDepositService(backendUrl, {
|
|
4006
4400
|
debug,
|
|
4007
4401
|
debugScope: "service:deposit"
|
|
@@ -4016,10 +4410,8 @@ function DepositModalInner({
|
|
|
4016
4410
|
useEffect10(() => {
|
|
4017
4411
|
configureSolanaRpcUrl(solanaRpcUrl);
|
|
4018
4412
|
}, [solanaRpcUrl]);
|
|
4019
|
-
const hasCalledReady = useRef6(false);
|
|
4020
4413
|
useEffect10(() => {
|
|
4021
|
-
if (isOpen
|
|
4022
|
-
hasCalledReady.current = true;
|
|
4414
|
+
if (isOpen) {
|
|
4023
4415
|
onReadyRef.current?.();
|
|
4024
4416
|
}
|
|
4025
4417
|
}, [isOpen, onReadyRef]);
|
|
@@ -4028,20 +4420,20 @@ function DepositModalInner({
|
|
|
4028
4420
|
setCurrentStepIndex(0);
|
|
4029
4421
|
}
|
|
4030
4422
|
}, [isOpen]);
|
|
4031
|
-
const handleStepChange =
|
|
4423
|
+
const handleStepChange = useCallback6(
|
|
4032
4424
|
(stepIndex, onBack) => {
|
|
4033
4425
|
setCurrentStepIndex(stepIndex);
|
|
4034
4426
|
backHandlerRef.current = onBack;
|
|
4035
4427
|
},
|
|
4036
4428
|
[]
|
|
4037
4429
|
);
|
|
4038
|
-
const handleTotalBalanceChange =
|
|
4430
|
+
const handleTotalBalanceChange = useCallback6((balance2) => {
|
|
4039
4431
|
setTotalBalanceUsd(balance2);
|
|
4040
4432
|
}, []);
|
|
4041
|
-
const handleBack =
|
|
4433
|
+
const handleBack = useCallback6(() => {
|
|
4042
4434
|
backHandlerRef.current?.();
|
|
4043
4435
|
}, []);
|
|
4044
|
-
const handleSmartAccountChange =
|
|
4436
|
+
const handleSmartAccountChange = useCallback6(
|
|
4045
4437
|
(account) => {
|
|
4046
4438
|
setActiveSmartAccount(account);
|
|
4047
4439
|
if (!account) {
|
|
@@ -4050,7 +4442,7 @@ function DepositModalInner({
|
|
|
4050
4442
|
},
|
|
4051
4443
|
[]
|
|
4052
4444
|
);
|
|
4053
|
-
const fetchHistory =
|
|
4445
|
+
const fetchHistory = useCallback6(
|
|
4054
4446
|
async (cursor) => {
|
|
4055
4447
|
if (!activeSmartAccount) return;
|
|
4056
4448
|
const isInitial = !cursor;
|
|
@@ -4088,21 +4480,21 @@ function DepositModalInner({
|
|
|
4088
4480
|
},
|
|
4089
4481
|
[activeSmartAccount, service]
|
|
4090
4482
|
);
|
|
4091
|
-
const handleHistoryOpen =
|
|
4483
|
+
const handleHistoryOpen = useCallback6(() => {
|
|
4092
4484
|
setHistoryOpen(true);
|
|
4093
4485
|
if (!historyLoadedRef.current || historyStaleRef.current) {
|
|
4094
4486
|
fetchHistory();
|
|
4095
4487
|
}
|
|
4096
4488
|
}, [fetchHistory]);
|
|
4097
|
-
const handleHistoryClose =
|
|
4489
|
+
const handleHistoryClose = useCallback6(() => {
|
|
4098
4490
|
setHistoryOpen(false);
|
|
4099
4491
|
}, []);
|
|
4100
|
-
const handleHistoryLoadMore =
|
|
4492
|
+
const handleHistoryLoadMore = useCallback6(() => {
|
|
4101
4493
|
if (historyNextCursor) {
|
|
4102
4494
|
fetchHistory(historyNextCursor);
|
|
4103
4495
|
}
|
|
4104
4496
|
}, [fetchHistory, historyNextCursor]);
|
|
4105
|
-
const markHistoryStale =
|
|
4497
|
+
const markHistoryStale = useCallback6(() => {
|
|
4106
4498
|
historyStaleRef.current = true;
|
|
4107
4499
|
if (historyOpen) {
|
|
4108
4500
|
fetchHistory();
|
|
@@ -4111,21 +4503,21 @@ function DepositModalInner({
|
|
|
4111
4503
|
const onDepositSubmittedRef = useLatestRef(onDepositSubmitted);
|
|
4112
4504
|
const onDepositCompleteRef = useLatestRef(onDepositComplete);
|
|
4113
4505
|
const onDepositFailedRef = useLatestRef(onDepositFailed);
|
|
4114
|
-
const handleDepositSubmitted =
|
|
4506
|
+
const handleDepositSubmitted = useCallback6(
|
|
4115
4507
|
(data) => {
|
|
4116
4508
|
onDepositSubmittedRef.current?.(data);
|
|
4117
4509
|
if (showHistoryButton) markHistoryStale();
|
|
4118
4510
|
},
|
|
4119
4511
|
[onDepositSubmittedRef, showHistoryButton, markHistoryStale]
|
|
4120
4512
|
);
|
|
4121
|
-
const handleDepositComplete =
|
|
4513
|
+
const handleDepositComplete = useCallback6(
|
|
4122
4514
|
(data) => {
|
|
4123
4515
|
onDepositCompleteRef.current?.(data);
|
|
4124
4516
|
if (showHistoryButton) markHistoryStale();
|
|
4125
4517
|
},
|
|
4126
4518
|
[onDepositCompleteRef, showHistoryButton, markHistoryStale]
|
|
4127
4519
|
);
|
|
4128
|
-
const handleDepositFailed =
|
|
4520
|
+
const handleDepositFailed = useCallback6(
|
|
4129
4521
|
(data) => {
|
|
4130
4522
|
onDepositFailedRef.current?.(data);
|
|
4131
4523
|
if (showHistoryButton) markHistoryStale();
|
|
@@ -4150,7 +4542,7 @@ function DepositModalInner({
|
|
|
4150
4542
|
const logoUrl = branding?.logoUrl ?? "https://github.com/rhinestonewtf.png";
|
|
4151
4543
|
const title = branding?.title ?? "Deposit";
|
|
4152
4544
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 4 && backHandlerRef.current !== void 0;
|
|
4153
|
-
return /* @__PURE__ */
|
|
4545
|
+
return /* @__PURE__ */ jsx13(
|
|
4154
4546
|
Modal,
|
|
4155
4547
|
{
|
|
4156
4548
|
isOpen,
|
|
@@ -4160,21 +4552,21 @@ function DepositModalInner({
|
|
|
4160
4552
|
closeOnOverlayClick,
|
|
4161
4553
|
children: /* @__PURE__ */ jsxs12("div", { ref: modalRef, className: "rs-modal", children: [
|
|
4162
4554
|
/* @__PURE__ */ jsxs12("div", { className: "rs-modal-header--redesigned", children: [
|
|
4163
|
-
/* @__PURE__ */
|
|
4555
|
+
/* @__PURE__ */ jsx13("div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && /* @__PURE__ */ jsx13(
|
|
4164
4556
|
"button",
|
|
4165
4557
|
{
|
|
4166
4558
|
type: "button",
|
|
4167
4559
|
className: "rs-modal-header-back",
|
|
4168
4560
|
"aria-label": "Go back",
|
|
4169
4561
|
onClick: handleBack,
|
|
4170
|
-
children: /* @__PURE__ */
|
|
4562
|
+
children: /* @__PURE__ */ jsx13(
|
|
4171
4563
|
"svg",
|
|
4172
4564
|
{
|
|
4173
4565
|
viewBox: "0 0 24 24",
|
|
4174
4566
|
fill: "none",
|
|
4175
4567
|
stroke: "currentColor",
|
|
4176
4568
|
strokeWidth: "2",
|
|
4177
|
-
children: /* @__PURE__ */
|
|
4569
|
+
children: /* @__PURE__ */ jsx13(
|
|
4178
4570
|
"path",
|
|
4179
4571
|
{
|
|
4180
4572
|
strokeLinecap: "round",
|
|
@@ -4188,7 +4580,7 @@ function DepositModalInner({
|
|
|
4188
4580
|
) }),
|
|
4189
4581
|
/* @__PURE__ */ jsxs12("div", { className: "rs-modal-header-nav-center", children: [
|
|
4190
4582
|
/* @__PURE__ */ jsxs12("div", { className: "rs-modal-header-title-row", children: [
|
|
4191
|
-
showLogo && logoUrl && /* @__PURE__ */
|
|
4583
|
+
showLogo && logoUrl && /* @__PURE__ */ jsx13(
|
|
4192
4584
|
"img",
|
|
4193
4585
|
{
|
|
4194
4586
|
src: logoUrl,
|
|
@@ -4199,20 +4591,20 @@ function DepositModalInner({
|
|
|
4199
4591
|
}
|
|
4200
4592
|
}
|
|
4201
4593
|
),
|
|
4202
|
-
/* @__PURE__ */
|
|
4594
|
+
/* @__PURE__ */ jsx13("span", { className: "rs-modal-header-title", children: title }),
|
|
4203
4595
|
showStepper && currentStepIndex >= 2 && /* @__PURE__ */ jsxs12("div", { className: "rs-step-indicator", style: { marginLeft: 8 }, children: [
|
|
4204
|
-
/* @__PURE__ */
|
|
4596
|
+
/* @__PURE__ */ jsx13(
|
|
4205
4597
|
"div",
|
|
4206
4598
|
{
|
|
4207
4599
|
className: `rs-step-indicator-node ${currentStepIndex >= 4 ? "rs-step-indicator-node--complete" : "rs-step-indicator-node--active"}`,
|
|
4208
|
-
children: currentStepIndex >= 4 ? /* @__PURE__ */
|
|
4600
|
+
children: currentStepIndex >= 4 ? /* @__PURE__ */ jsx13(
|
|
4209
4601
|
"svg",
|
|
4210
4602
|
{
|
|
4211
4603
|
viewBox: "0 0 24 24",
|
|
4212
4604
|
fill: "none",
|
|
4213
4605
|
stroke: "currentColor",
|
|
4214
4606
|
strokeWidth: "3",
|
|
4215
|
-
children: /* @__PURE__ */
|
|
4607
|
+
children: /* @__PURE__ */ jsx13(
|
|
4216
4608
|
"path",
|
|
4217
4609
|
{
|
|
4218
4610
|
strokeLinecap: "round",
|
|
@@ -4224,13 +4616,13 @@ function DepositModalInner({
|
|
|
4224
4616
|
) : "1"
|
|
4225
4617
|
}
|
|
4226
4618
|
),
|
|
4227
|
-
/* @__PURE__ */
|
|
4619
|
+
/* @__PURE__ */ jsx13(
|
|
4228
4620
|
"div",
|
|
4229
4621
|
{
|
|
4230
4622
|
className: `rs-step-indicator-line ${currentStepIndex >= 4 ? "rs-step-indicator-line--active" : ""}`
|
|
4231
4623
|
}
|
|
4232
4624
|
),
|
|
4233
|
-
/* @__PURE__ */
|
|
4625
|
+
/* @__PURE__ */ jsx13(
|
|
4234
4626
|
"div",
|
|
4235
4627
|
{
|
|
4236
4628
|
className: `rs-step-indicator-node ${currentStepIndex >= 4 ? "rs-step-indicator-node--active" : "rs-step-indicator-node--inactive"}`,
|
|
@@ -4244,11 +4636,11 @@ function DepositModalInner({
|
|
|
4244
4636
|
balance.title,
|
|
4245
4637
|
":"
|
|
4246
4638
|
] }),
|
|
4247
|
-
/* @__PURE__ */
|
|
4639
|
+
/* @__PURE__ */ jsx13("span", { className: "rs-modal-header-balance-value", children: balance.amount ?? (totalBalanceUsd !== null ? currencyFormatter.format(totalBalanceUsd) : null) })
|
|
4248
4640
|
] })
|
|
4249
4641
|
] }),
|
|
4250
4642
|
/* @__PURE__ */ jsxs12("div", { className: "rs-modal-header-nav-right", children: [
|
|
4251
|
-
showHistoryButton && /* @__PURE__ */
|
|
4643
|
+
showHistoryButton && /* @__PURE__ */ jsx13(
|
|
4252
4644
|
"button",
|
|
4253
4645
|
{
|
|
4254
4646
|
type: "button",
|
|
@@ -4256,14 +4648,14 @@ function DepositModalInner({
|
|
|
4256
4648
|
"aria-label": "Deposit history",
|
|
4257
4649
|
onClick: handleHistoryOpen,
|
|
4258
4650
|
disabled: !activeSmartAccount,
|
|
4259
|
-
children: /* @__PURE__ */
|
|
4651
|
+
children: /* @__PURE__ */ jsx13(
|
|
4260
4652
|
"svg",
|
|
4261
4653
|
{
|
|
4262
4654
|
viewBox: "0 0 24 24",
|
|
4263
4655
|
fill: "none",
|
|
4264
4656
|
stroke: "currentColor",
|
|
4265
4657
|
strokeWidth: "1.75",
|
|
4266
|
-
children: /* @__PURE__ */
|
|
4658
|
+
children: /* @__PURE__ */ jsx13(
|
|
4267
4659
|
"path",
|
|
4268
4660
|
{
|
|
4269
4661
|
strokeLinecap: "round",
|
|
@@ -4275,21 +4667,21 @@ function DepositModalInner({
|
|
|
4275
4667
|
)
|
|
4276
4668
|
}
|
|
4277
4669
|
),
|
|
4278
|
-
/* @__PURE__ */
|
|
4670
|
+
/* @__PURE__ */ jsx13(
|
|
4279
4671
|
"button",
|
|
4280
4672
|
{
|
|
4281
4673
|
type: "button",
|
|
4282
4674
|
onClick: onClose,
|
|
4283
4675
|
className: "rs-modal-close",
|
|
4284
4676
|
"aria-label": "Close",
|
|
4285
|
-
children: /* @__PURE__ */
|
|
4677
|
+
children: /* @__PURE__ */ jsx13(
|
|
4286
4678
|
"svg",
|
|
4287
4679
|
{
|
|
4288
4680
|
viewBox: "0 0 24 24",
|
|
4289
4681
|
fill: "none",
|
|
4290
4682
|
stroke: "currentColor",
|
|
4291
4683
|
strokeWidth: "2",
|
|
4292
|
-
children: /* @__PURE__ */
|
|
4684
|
+
children: /* @__PURE__ */ jsx13(
|
|
4293
4685
|
"path",
|
|
4294
4686
|
{
|
|
4295
4687
|
strokeLinecap: "round",
|
|
@@ -4303,7 +4695,7 @@ function DepositModalInner({
|
|
|
4303
4695
|
)
|
|
4304
4696
|
] })
|
|
4305
4697
|
] }),
|
|
4306
|
-
/* @__PURE__ */
|
|
4698
|
+
/* @__PURE__ */ jsx13(
|
|
4307
4699
|
DepositFlow,
|
|
4308
4700
|
{
|
|
4309
4701
|
dappWalletClient,
|
|
@@ -4318,6 +4710,8 @@ function DepositModalInner({
|
|
|
4318
4710
|
amount: defaultAmount,
|
|
4319
4711
|
recipient,
|
|
4320
4712
|
postBridgeActions,
|
|
4713
|
+
outputTokenRules,
|
|
4714
|
+
rejectUnmapped,
|
|
4321
4715
|
signerAddress,
|
|
4322
4716
|
sessionChainIds,
|
|
4323
4717
|
forceRegister,
|
|
@@ -4343,7 +4737,7 @@ function DepositModalInner({
|
|
|
4343
4737
|
debug
|
|
4344
4738
|
}
|
|
4345
4739
|
),
|
|
4346
|
-
showHistoryButton && historyOpen && /* @__PURE__ */
|
|
4740
|
+
showHistoryButton && historyOpen && /* @__PURE__ */ jsx13(
|
|
4347
4741
|
DepositHistoryPanel,
|
|
4348
4742
|
{
|
|
4349
4743
|
deposits: historyDeposits,
|