@rhinestone/deposit-modal 0.12.2 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +30 -16
  2. package/dist/ClaimModal-CREZO27I.mjs +11 -0
  3. package/dist/ClaimModal-JRIA32U2.cjs +11 -0
  4. package/dist/{DepositModalReown-TEC3MEZ4.mjs → DepositModalReown-3H75G3XQ.mjs} +44 -22
  5. package/dist/{DepositModalReown-VG66OTIU.cjs → DepositModalReown-YNNHLAV2.cjs} +57 -35
  6. package/dist/{QRCode-WUC652SH.mjs → QRCode-5RGIZZHL.mjs} +1 -1
  7. package/dist/{QRCode-5DXFNKI2.cjs → QRCode-JKXG4RHN.cjs} +2 -2
  8. package/dist/WithdrawModal-NVRX44IZ.mjs +10 -0
  9. package/dist/WithdrawModal-YYSBPCJJ.cjs +10 -0
  10. package/dist/{chunk-OIN4CXCP.cjs → chunk-2G2EIN4A.cjs} +1510 -896
  11. package/dist/{chunk-O7BCVQ6L.cjs → chunk-4KCSH4T3.cjs} +157 -199
  12. package/dist/{chunk-TM7VGHAG.cjs → chunk-5NUIKYSF.cjs} +83 -209
  13. package/dist/{chunk-UQIJU6HV.cjs → chunk-7N77GIP4.cjs} +102 -88
  14. package/dist/{chunk-J46WDSRD.mjs → chunk-COCBCQQC.mjs} +121 -86
  15. package/dist/chunk-CVGNCUVU.cjs +154 -0
  16. package/dist/{chunk-SDSKIJC7.mjs → chunk-DSIZNRWA.mjs} +1540 -926
  17. package/dist/{chunk-75DVGSAX.cjs → chunk-DW2EQA2U.cjs} +6 -3
  18. package/dist/{chunk-FXXUIK4E.mjs → chunk-EOMT5LKX.mjs} +374 -151
  19. package/dist/chunk-FZ5FZFIG.mjs +31 -0
  20. package/dist/chunk-GACIGCSN.cjs +31 -0
  21. package/dist/{chunk-HL5NUKZW.cjs → chunk-HOGZKHHY.cjs} +3 -3
  22. package/dist/{chunk-FLVLYO64.mjs → chunk-LTMMETAB.mjs} +29 -15
  23. package/dist/{chunk-2TPSF77V.mjs → chunk-OLCD75JK.mjs} +20 -146
  24. package/dist/{chunk-PWLEBV5V.cjs → chunk-RAADLTSW.cjs} +240 -205
  25. package/dist/{chunk-4ZXQPFNU.mjs → chunk-RN5VKWI6.mjs} +4 -1
  26. package/dist/{chunk-3STTWRAN.mjs → chunk-VUATPOWJ.mjs} +147 -189
  27. package/dist/{chunk-JE4R5VA3.mjs → chunk-XYJFEN5D.mjs} +1 -1
  28. package/dist/chunk-YREVFB64.mjs +154 -0
  29. package/dist/{chunk-BRYNGLDM.cjs → chunk-ZMT4ATHR.cjs} +437 -214
  30. package/dist/claim.cjs +7 -6
  31. package/dist/claim.d.cts +11 -3
  32. package/dist/claim.d.ts +11 -3
  33. package/dist/claim.mjs +6 -5
  34. package/dist/{constants-FuzG3h4m.d.cts → constants-DBrWhJWE.d.cts} +12 -7
  35. package/dist/{constants-FuzG3h4m.d.ts → constants-DBrWhJWE.d.ts} +12 -7
  36. package/dist/constants.cjs +3 -9
  37. package/dist/constants.d.cts +2 -3
  38. package/dist/constants.d.ts +2 -3
  39. package/dist/constants.mjs +4 -10
  40. package/dist/deposit.cjs +8 -8
  41. package/dist/deposit.d.cts +2 -2
  42. package/dist/deposit.d.ts +2 -2
  43. package/dist/deposit.mjs +7 -7
  44. package/dist/embed.cjs +1268 -0
  45. package/dist/embed.d.cts +177 -0
  46. package/dist/embed.d.ts +177 -0
  47. package/dist/embed.mjs +1268 -0
  48. package/dist/index.cjs +11 -16
  49. package/dist/index.d.cts +3 -3
  50. package/dist/index.d.ts +3 -3
  51. package/dist/index.mjs +14 -19
  52. package/dist/modal-ui-state-OD1RmKkK.d.cts +30 -0
  53. package/dist/modal-ui-state-OD1RmKkK.d.ts +30 -0
  54. package/dist/polymarket.cjs +17 -7
  55. package/dist/polymarket.mjs +13 -3
  56. package/dist/styles.css +124 -98
  57. package/dist/{types-oFblf65g.d.ts → types-B89I8_8H.d.ts} +27 -1
  58. package/dist/{types-BO4iP6fG.d.cts → types-nnDR4tqA.d.cts} +27 -1
  59. package/dist/withdraw.cjs +6 -6
  60. package/dist/withdraw.d.cts +11 -3
  61. package/dist/withdraw.d.ts +11 -3
  62. package/dist/withdraw.mjs +5 -5
  63. package/package.json +33 -1
  64. package/dist/chunk-IAGFDSNC.mjs +0 -11
  65. package/dist/chunk-L32UI7LA.cjs +0 -11
@@ -13,14 +13,15 @@ import {
13
13
  getExchangeLogoSrc,
14
14
  isDepositEvent,
15
15
  isFailedEvent,
16
+ isSubmissionUncertain,
16
17
  readDedupedAccountSetupResult,
17
18
  runAccountSetupDeduped,
18
19
  txRefsMatch,
19
20
  warnRemovedProps
20
- } from "./chunk-J46WDSRD.mjs";
21
+ } from "./chunk-COCBCQQC.mjs";
21
22
  import {
22
23
  ListRow
23
- } from "./chunk-JE4R5VA3.mjs";
24
+ } from "./chunk-XYJFEN5D.mjs";
24
25
  import {
25
26
  AlertTriangleIcon,
26
27
  AppleIcon,
@@ -35,7 +36,6 @@ import {
35
36
  CheckIcon,
36
37
  ChevronDownIcon,
37
38
  ChevronLeftIcon,
38
- ClockIcon,
39
39
  CloseIcon,
40
40
  CopyIcon,
41
41
  ExternalLinkIcon,
@@ -44,8 +44,7 @@ import {
44
44
  InfoIcon,
45
45
  MigrateAssetsIcon,
46
46
  Modal,
47
- PercentIcon,
48
- PlusCircleIcon,
47
+ PermitDepositSubmitError,
49
48
  PoweredBy,
50
49
  RpcUrlsProvider,
51
50
  SUPPORTED_CONNECT_EXCHANGE_COUNT,
@@ -86,8 +85,9 @@ import {
86
85
  useLatestRef,
87
86
  useRpcUrls,
88
87
  useStableRpcUrls
89
- } from "./chunk-FXXUIK4E.mjs";
88
+ } from "./chunk-EOMT5LKX.mjs";
90
89
  import {
90
+ MULTICALL3_ADDRESS,
91
91
  POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS,
92
92
  POLYMARKET_ICON_URL,
93
93
  POLYMARKET_POLYGON_CHAIN_ID,
@@ -97,26 +97,24 @@ import {
97
97
  executePolymarketSafeTransfer,
98
98
  fetchPolymarketProxyWallet,
99
99
  readPolymarketBalances
100
- } from "./chunk-4ZXQPFNU.mjs";
100
+ } from "./chunk-RN5VKWI6.mjs";
101
101
  import {
102
- CHAIN_BY_ID,
103
102
  HYPERCORE_CHAIN_ID,
104
103
  HYPERCORE_MIN_DEPOSIT_USD,
105
104
  HYPERCORE_SPOT_CAIP2,
106
105
  NATIVE_TOKEN_ADDRESS,
107
106
  SOLANA_TOKENS,
107
+ SUPPORTED_CHAIN_IDS,
108
108
  cdnIconUrl,
109
109
  findTokenDecimals,
110
110
  getChainBadge,
111
111
  getChainIcon,
112
112
  getChainId,
113
113
  getChainName,
114
- getExplorerUrl,
115
114
  getNativeSymbol,
116
115
  getSupportedChainIds,
117
116
  getTargetTokenSymbol,
118
117
  getTargetTokenSymbolsForChain,
119
- getTokenAddress,
120
118
  getTokenDecimalsByAddress,
121
119
  getTokenSymbol,
122
120
  isHyperCoreCaip2,
@@ -127,16 +125,15 @@ import {
127
125
  isVirtualDestination,
128
126
  parseEvmChainId,
129
127
  publishShortlistTokens,
130
- targetChainToCaip2,
131
128
  targetChainToChainId
132
- } from "./chunk-3STTWRAN.mjs";
129
+ } from "./chunk-VUATPOWJ.mjs";
133
130
 
134
131
  // src/DepositModal.tsx
135
132
  import {
136
133
  useMemo as useMemo9,
137
- useEffect as useEffect12,
134
+ useEffect as useEffect13,
138
135
  useRef as useRef9,
139
- useState as useState14,
136
+ useState as useState15,
140
137
  useCallback as useCallback9,
141
138
  lazy as lazy2,
142
139
  Suspense as Suspense2
@@ -144,10 +141,10 @@ import {
144
141
 
145
142
  // src/DepositFlow.tsx
146
143
  import {
147
- useState as useState12,
144
+ useState as useState13,
148
145
  useCallback as useCallback7,
149
146
  useMemo as useMemo7,
150
- useEffect as useEffect11,
147
+ useEffect as useEffect12,
151
148
  useLayoutEffect as useLayoutEffect2,
152
149
  useRef as useRef8
153
150
  } from "react";
@@ -495,7 +492,7 @@ function ConnectStep({
495
492
  }) {
496
493
  const rows = walletRows ?? [];
497
494
  const handleConnect = onConnect ?? onRequestConnect;
498
- const hasReownWallet = rows.some(
495
+ const hasSessionWallet = rows.some(
499
496
  (row) => row.kind === "external" || row.kind === "solana"
500
497
  );
501
498
  const defaultSubtitle = onSelectTransferCrypto ? "Add money to your balance" : "Choose a wallet to continue";
@@ -538,7 +535,7 @@ function ConnectStep({
538
535
  )
539
536
  );
540
537
  }
541
- if (!hasReownWallet && handleConnect) {
538
+ if (!hasSessionWallet && handleConnect) {
542
539
  cryptoRows.push(
543
540
  /* @__PURE__ */ jsx5(
544
541
  ListRow,
@@ -665,7 +662,7 @@ function ConnectStep({
665
662
  }
666
663
  )
667
664
  ] }),
668
- onDisconnect && hasReownWallet && /* @__PURE__ */ jsx5("div", { className: "rs-screen-tight-row", children: /* @__PURE__ */ jsx5(
665
+ onDisconnect && hasSessionWallet && /* @__PURE__ */ jsx5("div", { className: "rs-screen-tight-row", children: /* @__PURE__ */ jsx5(
669
666
  "button",
670
667
  {
671
668
  type: "button",
@@ -1076,7 +1073,9 @@ function AmountStep({
1076
1073
  targetToken,
1077
1074
  uiConfig,
1078
1075
  tokenPriceUsdOverride,
1076
+ sourcePriceUnavailable = false,
1079
1077
  appBalanceUsd,
1078
+ title = "Wallet deposit",
1080
1079
  onContinue,
1081
1080
  onCtaClick,
1082
1081
  service
@@ -1093,7 +1092,7 @@ function AmountStep({
1093
1092
  const targetChainId = targetChainToChainId(targetChain);
1094
1093
  const targetSymbol = getTargetTokenSymbol(targetToken, targetChainId);
1095
1094
  const isSourceStablecoin = isStablecoinSymbol(asset.symbol);
1096
- const tokenPriceUsd = useMemo2(() => {
1095
+ const derivedPriceUsd = useMemo2(() => {
1097
1096
  if (tokenPriceUsdOverride !== void 0 && tokenPriceUsdOverride > 0)
1098
1097
  return tokenPriceUsdOverride;
1099
1098
  if (asset.balanceUsd === void 0 || !asset.balanceUsd || !asset.balance)
@@ -1109,6 +1108,7 @@ function AmountStep({
1109
1108
  return null;
1110
1109
  }
1111
1110
  }, [tokenPriceUsdOverride, asset.balanceUsd, asset.balance, asset.decimals]);
1111
+ const tokenPriceUsd = derivedPriceUsd;
1112
1112
  const hasPricing = tokenPriceUsd !== null;
1113
1113
  useEffect3(() => {
1114
1114
  let active = true;
@@ -1278,13 +1278,16 @@ function AmountStep({
1278
1278
  );
1279
1279
  };
1280
1280
  const continueLabel = exceedsBalance ? "Insufficient balance" : isAboveMax ? "Continue with max allowed deposit" : isBelowMin ? "Continue with minimum deposit" : "Continue";
1281
- const continueDisabled = chainMismatch || exceedsBalance || numericAmount === 0 && !isBelowMin || balance === null;
1281
+ const knowsBalance = address !== void 0;
1282
+ const needsPricing = !knowsBalance && !isSourceStablecoin;
1283
+ const blockedOnPricing = needsPricing && !hasPricing;
1284
+ const continueDisabled = chainMismatch || exceedsBalance || blockedOnPricing || numericAmount === 0 && !isBelowMin || knowsBalance && balance === null;
1282
1285
  const chainName = useChainName();
1283
1286
  const sourceChainName = chainName(asset.chainId);
1284
1287
  const targetChainName = chainName(targetChainId);
1285
1288
  return /* @__PURE__ */ jsxs6("div", { className: "rs-screen", children: [
1286
1289
  /* @__PURE__ */ jsxs6("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
1287
- /* @__PURE__ */ jsx8(BodyHeader, { icon: /* @__PURE__ */ jsx8(WalletIcon, {}), title: "Wallet deposit" }),
1290
+ /* @__PURE__ */ jsx8(BodyHeader, { icon: /* @__PURE__ */ jsx8(WalletIcon, {}), title }),
1288
1291
  /* @__PURE__ */ jsxs6("div", { className: "rs-amount-section", children: [
1289
1292
  /* @__PURE__ */ jsxs6("div", { className: "rs-amount-display", children: [
1290
1293
  /* @__PURE__ */ jsx8(
@@ -1297,7 +1300,7 @@ function AmountStep({
1297
1300
  }
1298
1301
  ),
1299
1302
  /* @__PURE__ */ jsxs6("div", { className: "rs-amount-meta", children: [
1300
- /* @__PURE__ */ jsxs6("span", { className: "rs-amount-meta-balance", children: [
1303
+ knowsBalance && /* @__PURE__ */ jsxs6("span", { className: "rs-amount-meta-balance", children: [
1301
1304
  formattedBalance,
1302
1305
  " ",
1303
1306
  asset.symbol,
@@ -1314,7 +1317,7 @@ function AmountStep({
1314
1317
  ] })
1315
1318
  ] })
1316
1319
  ] }),
1317
- /* @__PURE__ */ jsx8("div", { className: "rs-amount-presets", children: PRESETS.map((preset) => /* @__PURE__ */ jsx8(
1320
+ knowsBalance && /* @__PURE__ */ jsx8("div", { className: "rs-amount-presets", children: PRESETS.map((preset) => /* @__PURE__ */ jsx8(
1318
1321
  "button",
1319
1322
  {
1320
1323
  type: "button",
@@ -1354,6 +1357,10 @@ function AmountStep({
1354
1357
  /* @__PURE__ */ jsx8("span", { className: "rs-amount-detail-value", children: currencyFormatter.format(balanceAfterUsd) })
1355
1358
  ] })
1356
1359
  ] }),
1360
+ blockedOnPricing && sourcePriceUnavailable && /* @__PURE__ */ jsxs6(Callout, { variant: "error", children: [
1361
+ asset.symbol,
1362
+ " can't be priced right now, so this deposit can't be estimated. You can still send any amount to the deposit address."
1363
+ ] }),
1357
1364
  error && /* @__PURE__ */ jsx8(Callout, { variant: "error", children: error }),
1358
1365
  /* @__PURE__ */ jsx8(
1359
1366
  Button,
@@ -1373,13 +1380,213 @@ function AmountStep({
1373
1380
  import { useEffect as useEffect4, useRef as useRef3, useState as useState4 } from "react";
1374
1381
  import { erc20Abi as erc20Abi2, parseUnits as parseUnits2 } from "viem";
1375
1382
 
1383
+ // src/components/ui/ReviewDetails.tsx
1384
+ import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1385
+ function ReviewDetails({
1386
+ sourceChainName,
1387
+ sourceChainIcon,
1388
+ targetChainName,
1389
+ targetChainIcon,
1390
+ estimatedTime,
1391
+ sendAmount,
1392
+ sendSymbol,
1393
+ receiveDisplay,
1394
+ receiveSymbol,
1395
+ fee
1396
+ }) {
1397
+ return /* @__PURE__ */ jsxs7("div", { className: "rs-review-details", children: [
1398
+ /* @__PURE__ */ jsxs7("div", { className: "rs-review-detail-row", children: [
1399
+ /* @__PURE__ */ jsx9("span", { children: "Source chain" }),
1400
+ /* @__PURE__ */ jsxs7("span", { className: "rs-review-detail-value", children: [
1401
+ /* @__PURE__ */ jsx9("span", { children: sourceChainName }),
1402
+ sourceChainIcon && /* @__PURE__ */ jsx9("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx9(CdnIcon, { src: sourceChainIcon }) })
1403
+ ] })
1404
+ ] }),
1405
+ /* @__PURE__ */ jsxs7("div", { className: "rs-review-detail-row", children: [
1406
+ /* @__PURE__ */ jsx9("span", { children: "Destination chain" }),
1407
+ /* @__PURE__ */ jsxs7("span", { className: "rs-review-detail-value", children: [
1408
+ /* @__PURE__ */ jsx9("span", { children: targetChainName }),
1409
+ targetChainIcon && /* @__PURE__ */ jsx9("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx9(CdnIcon, { src: targetChainIcon }) })
1410
+ ] })
1411
+ ] }),
1412
+ /* @__PURE__ */ jsxs7("div", { className: "rs-review-detail-row", children: [
1413
+ /* @__PURE__ */ jsx9("span", { children: "Estimated time" }),
1414
+ /* @__PURE__ */ jsx9("span", { className: "rs-review-detail-value", children: estimatedTime })
1415
+ ] }),
1416
+ /* @__PURE__ */ jsxs7("div", { className: "rs-review-detail-row", children: [
1417
+ /* @__PURE__ */ jsx9("span", { children: "You send" }),
1418
+ /* @__PURE__ */ jsxs7("span", { className: "rs-review-detail-value", children: [
1419
+ /* @__PURE__ */ jsxs7("span", { children: [
1420
+ sendAmount,
1421
+ " ",
1422
+ sendSymbol
1423
+ ] }),
1424
+ /* @__PURE__ */ jsx9("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx9(TokenIcon, { symbol: sendSymbol }) })
1425
+ ] })
1426
+ ] }),
1427
+ /* @__PURE__ */ jsxs7("div", { className: "rs-review-detail-row", children: [
1428
+ /* @__PURE__ */ jsx9("span", { children: "Receive" }),
1429
+ /* @__PURE__ */ jsxs7("span", { className: "rs-review-detail-value", children: [
1430
+ /* @__PURE__ */ jsx9("span", { children: receiveDisplay }),
1431
+ /* @__PURE__ */ jsx9("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx9(TokenIcon, { symbol: receiveSymbol }) })
1432
+ ] })
1433
+ ] }),
1434
+ /* @__PURE__ */ jsxs7("div", { className: "rs-review-detail-row", children: [
1435
+ /* @__PURE__ */ jsx9("span", { children: "Fees" }),
1436
+ /* @__PURE__ */ jsxs7("span", { className: "rs-review-detail-value", children: [
1437
+ fee.display === null ? /* @__PURE__ */ jsx9("span", { className: "rs-skeleton rs-skeleton-fee", "aria-hidden": "true" }) : /* @__PURE__ */ jsx9("span", { style: fee.struck ? { textDecoration: "line-through" } : void 0, children: fee.display }),
1438
+ fee.tooltip !== void 0 && /* @__PURE__ */ jsx9(Tooltip, { content: fee.tooltip, children: /* @__PURE__ */ jsx9("span", { className: "rs-review-detail-info", "aria-label": "Fee info", children: /* @__PURE__ */ jsx9(InfoIcon, {}) }) })
1439
+ ] })
1440
+ ] })
1441
+ ] });
1442
+ }
1443
+ ReviewDetails.displayName = "ReviewDetails";
1444
+
1445
+ // src/core/permit2.ts
1446
+ var PERMIT2_ADDRESS = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
1447
+ function sameAddress(a, b) {
1448
+ return typeof a === "string" && a.toLowerCase() === b.toLowerCase();
1449
+ }
1450
+ function toBigInt(value) {
1451
+ if (typeof value === "bigint") return value;
1452
+ if (typeof value === "number" && Number.isSafeInteger(value)) {
1453
+ return BigInt(value);
1454
+ }
1455
+ if (typeof value === "string" && value.length > 0) {
1456
+ try {
1457
+ return BigInt(value);
1458
+ } catch {
1459
+ return null;
1460
+ }
1461
+ }
1462
+ return null;
1463
+ }
1464
+ function validatePermitTypedData(typedData, expected) {
1465
+ if (typedData.primaryType !== "PermitTransferFrom") {
1466
+ return {
1467
+ ok: false,
1468
+ reason: `unexpected primaryType "${typedData.primaryType}"`
1469
+ };
1470
+ }
1471
+ const { domain, message } = typedData;
1472
+ if (!sameAddress(domain?.verifyingContract, PERMIT2_ADDRESS)) {
1473
+ return {
1474
+ ok: false,
1475
+ reason: `verifyingContract ${String(
1476
+ domain?.verifyingContract
1477
+ )} is not the canonical Permit2`
1478
+ };
1479
+ }
1480
+ const domainChainId = toBigInt(domain?.chainId);
1481
+ if (domainChainId === null || domainChainId !== BigInt(expected.chainId)) {
1482
+ return {
1483
+ ok: false,
1484
+ reason: `domain.chainId ${String(
1485
+ domain?.chainId
1486
+ )} does not match source chain ${expected.chainId}`
1487
+ };
1488
+ }
1489
+ if (!sameAddress(message?.spender, expected.spender)) {
1490
+ return {
1491
+ ok: false,
1492
+ reason: `spender ${String(message?.spender)} is not the deposit account`
1493
+ };
1494
+ }
1495
+ const permitted = message?.permitted;
1496
+ if (!sameAddress(permitted?.token, expected.token)) {
1497
+ return {
1498
+ ok: false,
1499
+ reason: `permitted.token ${String(
1500
+ permitted?.token
1501
+ )} is not the confirmed token`
1502
+ };
1503
+ }
1504
+ const permittedAmount = toBigInt(permitted?.amount);
1505
+ const expectedAmount = toBigInt(expected.amount);
1506
+ if (permittedAmount === null || expectedAmount === null || permittedAmount !== expectedAmount) {
1507
+ return {
1508
+ ok: false,
1509
+ reason: `permitted.amount ${String(
1510
+ permitted?.amount
1511
+ )} does not match the confirmed amount ${expected.amount}`
1512
+ };
1513
+ }
1514
+ return { ok: true };
1515
+ }
1516
+ function sameInteger(a, b) {
1517
+ const left = toBigInt(a);
1518
+ const right = toBigInt(b);
1519
+ return left !== null && right !== null && left === right;
1520
+ }
1521
+ function validatePreparedAuthorization(authorization, expected) {
1522
+ const { typedData } = authorization;
1523
+ const { domain, message } = typedData;
1524
+ const domainChainId = toBigInt(domain?.chainId);
1525
+ if (domainChainId === null || domainChainId !== BigInt(expected.chainId)) {
1526
+ return {
1527
+ ok: false,
1528
+ reason: `domain.chainId ${String(
1529
+ domain?.chainId
1530
+ )} does not match source chain ${expected.chainId}`
1531
+ };
1532
+ }
1533
+ if (authorization.kind === "permit2") {
1534
+ const verdict = validatePermitTypedData(typedData, expected);
1535
+ if (!verdict.ok) return verdict;
1536
+ if (!sameInteger(message?.nonce, authorization.nonce) || !sameInteger(message?.deadline, authorization.deadline)) {
1537
+ return { ok: false, reason: "Permit2 nonce or deadline mismatch" };
1538
+ }
1539
+ return { ok: true };
1540
+ }
1541
+ if (!sameAddress(domain?.verifyingContract, expected.token)) {
1542
+ return {
1543
+ ok: false,
1544
+ reason: "token-native authorization verifies against the wrong token"
1545
+ };
1546
+ }
1547
+ if (authorization.kind === "erc3009") {
1548
+ if (typedData.primaryType !== "ReceiveWithAuthorization") {
1549
+ return { ok: false, reason: "unexpected ERC-3009 primaryType" };
1550
+ }
1551
+ if (!sameAddress(message?.from, expected.owner) || !sameAddress(message?.to, expected.spender) || !sameInteger(message?.value, expected.amount)) {
1552
+ return { ok: false, reason: "ERC-3009 transfer terms do not match" };
1553
+ }
1554
+ if (typeof message?.nonce !== "string" || message.nonce.toLowerCase() !== authorization.nonce.toLowerCase() || !sameInteger(message?.validAfter, authorization.validAfter) || !sameInteger(message?.validBefore, authorization.validBefore)) {
1555
+ return {
1556
+ ok: false,
1557
+ reason: "ERC-3009 nonce or validity window mismatch"
1558
+ };
1559
+ }
1560
+ return { ok: true };
1561
+ }
1562
+ if (typedData.primaryType !== "Permit") {
1563
+ return { ok: false, reason: "unexpected ERC-2612 primaryType" };
1564
+ }
1565
+ if (!sameAddress(message?.owner, expected.owner) || !sameAddress(message?.spender, expected.spender) || !sameInteger(message?.value, expected.amount)) {
1566
+ return { ok: false, reason: "ERC-2612 permit terms do not match" };
1567
+ }
1568
+ if (!sameInteger(message?.nonce, authorization.nonce) || !sameInteger(message?.deadline, authorization.deadline)) {
1569
+ return { ok: false, reason: "ERC-2612 nonce or deadline mismatch" };
1570
+ }
1571
+ return { ok: true };
1572
+ }
1573
+ async function signTokenAuthorization(walletClient, ownerAddress, typedData) {
1574
+ return walletClient.signTypedData({
1575
+ account: walletClient.account ?? ownerAddress,
1576
+ domain: typedData.domain,
1577
+ types: typedData.types,
1578
+ primaryType: typedData.primaryType,
1579
+ message: typedData.message
1580
+ });
1581
+ }
1582
+
1376
1583
  // src/core/dapp-imports/types.ts
1377
1584
  function isDappImportAsset(asset) {
1378
1585
  return typeof asset.source === "string" && typeof asset.sourceLabel === "string" && "providerMetadata" in asset;
1379
1586
  }
1380
1587
 
1381
1588
  // src/components/steps/ConfirmStep.tsx
1382
- import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1589
+ import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
1383
1590
  function ConfirmStep({
1384
1591
  walletClient,
1385
1592
  address,
@@ -1402,15 +1609,27 @@ function ConfirmStep({
1402
1609
  service,
1403
1610
  setupRequestKey = "standalone",
1404
1611
  setupReady = true,
1612
+ enableGaslessDeposit = false,
1405
1613
  onConfirm,
1406
1614
  onError,
1407
1615
  onDepositSubmitted,
1616
+ onSubmittingChange,
1408
1617
  executeTransfer
1409
1618
  }) {
1410
1619
  const [isSubmitting, setIsSubmitting] = useState4(false);
1411
1620
  const [error, setError] = useState4(null);
1412
1621
  const [quoteResult, setQuoteResult] = useState4(null);
1622
+ const [permitResult, setPermitResult] = useState4(null);
1623
+ const [permitUnavailable, setPermitUnavailable] = useState4(null);
1624
+ const [permitDisabled, setPermitDisabled] = useState4(false);
1625
+ const [submissionUncertain, setSubmissionUncertain] = useState4(false);
1413
1626
  const hasAttemptedSwitch = useRef3(false);
1627
+ const onSubmittingChangeRef = useRef3(onSubmittingChange);
1628
+ onSubmittingChangeRef.current = onSubmittingChange;
1629
+ useEffect4(() => {
1630
+ onSubmittingChangeRef.current?.(isSubmitting);
1631
+ return () => onSubmittingChangeRef.current?.(false);
1632
+ }, [isSubmitting]);
1414
1633
  const chainMismatch = Boolean(
1415
1634
  walletClient?.chain?.id && walletClient.chain.id !== asset.chainId
1416
1635
  );
@@ -1444,6 +1663,16 @@ function ConfirmStep({
1444
1663
  quote?.fees
1445
1664
  );
1446
1665
  const directTransfer = sameRoute && !mustHaveQuote && !executeTransfer;
1666
+ const permitEligible = enableGaslessDeposit && !isNativeAsset(asset) && !isDappImportAsset(asset) && !executeTransfer && !directTransfer && asset.chainId !== HYPERCORE_CHAIN_ID;
1667
+ const permitRequestKey = JSON.stringify([
1668
+ smartAccount.toLowerCase(),
1669
+ asset.chainId,
1670
+ asset.token.toLowerCase(),
1671
+ asset.decimals,
1672
+ amount,
1673
+ address.toLowerCase()
1674
+ ]);
1675
+ const permit = permitEligible && !permitDisabled && permitResult?.requestKey === permitRequestKey ? permitResult.prepared : null;
1447
1676
  const receiveDisplay = (() => {
1448
1677
  if (directTransfer) return `${formattedSendAmount} ${asset.symbol}`;
1449
1678
  if (quote) {
@@ -1517,12 +1746,72 @@ function ConfirmStep({
1517
1746
  quoteSource.chainId,
1518
1747
  quoteSource.token
1519
1748
  ]);
1749
+ useEffect4(() => {
1750
+ setPermitResult(null);
1751
+ setPermitUnavailable(null);
1752
+ if (!permitEligible || permitDisabled) return;
1753
+ let cancelled = false;
1754
+ let units;
1755
+ try {
1756
+ units = parseUnits2(amount, asset.decimals);
1757
+ } catch {
1758
+ return;
1759
+ }
1760
+ if (units <= 0n) return;
1761
+ service.preparePermitDeposit({
1762
+ account: smartAccount,
1763
+ sourceChain: `eip155:${asset.chainId}`,
1764
+ token: asset.token,
1765
+ amount: units.toString(),
1766
+ owner: address
1767
+ }).then((prepared) => {
1768
+ if (cancelled || prepared === null) return;
1769
+ if (!prepared.available) {
1770
+ setPermitUnavailable(prepared.reason);
1771
+ return;
1772
+ }
1773
+ const authorization = prepared.authorization;
1774
+ const verdict = validatePreparedAuthorization(authorization, {
1775
+ chainId: asset.chainId,
1776
+ token: asset.token,
1777
+ amount: units.toString(),
1778
+ spender: smartAccount,
1779
+ owner: address
1780
+ });
1781
+ if (!verdict.ok) {
1782
+ console.warn(
1783
+ `[deposit-modal] refusing gasless permit payload: ${verdict.reason}`
1784
+ );
1785
+ return;
1786
+ }
1787
+ setPermitUnavailable(null);
1788
+ setPermitResult({
1789
+ requestKey: permitRequestKey,
1790
+ prepared: authorization
1791
+ });
1792
+ }).catch(() => {
1793
+ });
1794
+ return () => {
1795
+ cancelled = true;
1796
+ };
1797
+ }, [
1798
+ service,
1799
+ permitEligible,
1800
+ permitDisabled,
1801
+ permitRequestKey,
1802
+ smartAccount,
1803
+ address,
1804
+ asset.chainId,
1805
+ asset.token,
1806
+ asset.decimals,
1807
+ amount
1808
+ ]);
1520
1809
  const handleConfirm = async () => {
1521
1810
  if (!address || !walletClient) {
1522
1811
  setError("Wallet not connected");
1523
1812
  return;
1524
1813
  }
1525
- if (chainMismatch) {
1814
+ if (chainMismatch && !permit) {
1526
1815
  setError(`Switch to ${sourceChainName} to sign`);
1527
1816
  return;
1528
1817
  }
@@ -1548,6 +1837,66 @@ function ConfirmStep({
1548
1837
  }
1549
1838
  setError(null);
1550
1839
  setIsSubmitting(true);
1840
+ if (permit) {
1841
+ let submitStarted = false;
1842
+ try {
1843
+ const signature = await signTokenAuthorization(
1844
+ walletClient,
1845
+ address,
1846
+ permit.typedData
1847
+ );
1848
+ submitStarted = true;
1849
+ const commonSubmit = {
1850
+ account: smartAccount,
1851
+ sourceChain: `eip155:${asset.chainId}`,
1852
+ token: asset.token,
1853
+ amount: amountUnits.toString(),
1854
+ owner: address
1855
+ };
1856
+ const submitted = await service.submitPermitDeposit(
1857
+ permit.kind === "erc3009" ? {
1858
+ ...commonSubmit,
1859
+ kind: permit.kind,
1860
+ nonce: permit.nonce,
1861
+ validAfter: permit.validAfter,
1862
+ validBefore: permit.validBefore,
1863
+ signature
1864
+ } : {
1865
+ ...commonSubmit,
1866
+ kind: permit.kind,
1867
+ nonce: permit.nonce,
1868
+ deadline: permit.deadline,
1869
+ signature
1870
+ }
1871
+ );
1872
+ onConfirm(
1873
+ submitted.txHash,
1874
+ asset.chainId,
1875
+ amountUnits.toString(),
1876
+ asset.token,
1877
+ // A permit deposit always routes through the smart account, so the
1878
+ // previewed quote (when one resolved) describes the path taken.
1879
+ quote ?? void 0,
1880
+ {
1881
+ smartAccount,
1882
+ targetChain,
1883
+ targetToken,
1884
+ directTransfer: false,
1885
+ sourceTxHashPending: true
1886
+ }
1887
+ );
1888
+ } catch (err) {
1889
+ const raw = err instanceof Error ? err.message : "Signing failed";
1890
+ const safeToTransfer = !submitStarted || err instanceof PermitDepositSubmitError && err.safeToTransfer;
1891
+ if (safeToTransfer) setPermitDisabled(true);
1892
+ const message = safeToTransfer ? formatUserError(raw) : "Deposit submission status is uncertain. Check your activity before trying a transfer.";
1893
+ setError(message);
1894
+ onError?.(message, "PERMIT_ERROR", raw);
1895
+ } finally {
1896
+ setIsSubmitting(false);
1897
+ }
1898
+ return;
1899
+ }
1551
1900
  try {
1552
1901
  const account = walletClient.account;
1553
1902
  const chain = walletClient.chain;
@@ -1592,104 +1941,173 @@ function ConfirmStep({
1592
1941
  );
1593
1942
  } catch (err) {
1594
1943
  const raw = err instanceof Error ? err.message : "Transfer failed";
1595
- const message = formatUserError(raw);
1944
+ const uncertain = isSubmissionUncertain(err);
1945
+ const message = uncertain ? "Deposit submission status is uncertain. Check your activity before trying again." : formatUserError(raw);
1946
+ if (uncertain) setSubmissionUncertain(true);
1596
1947
  setError(message);
1597
1948
  onError?.(message, "TRANSFER_ERROR", raw);
1598
1949
  } finally {
1599
1950
  setIsSubmitting(false);
1600
1951
  }
1601
1952
  };
1602
- return /* @__PURE__ */ jsxs7("div", { className: "rs-screen", children: [
1603
- /* @__PURE__ */ jsxs7("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
1604
- /* @__PURE__ */ jsx9(BodyHeader, { icon: /* @__PURE__ */ jsx9(WalletIcon, {}), title: "Review deposit" }),
1605
- /* @__PURE__ */ jsxs7("div", { className: "rs-review-details", children: [
1606
- /* @__PURE__ */ jsxs7("div", { className: "rs-review-detail-row", children: [
1607
- /* @__PURE__ */ jsx9("span", { children: "Source chain" }),
1608
- /* @__PURE__ */ jsxs7("span", { className: "rs-review-detail-value", children: [
1609
- /* @__PURE__ */ jsx9("span", { children: sourceChainName }),
1610
- sourceChainIcon && /* @__PURE__ */ jsx9("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx9(CdnIcon, { src: sourceChainIcon }) })
1611
- ] })
1612
- ] }),
1613
- /* @__PURE__ */ jsxs7("div", { className: "rs-review-detail-row", children: [
1614
- /* @__PURE__ */ jsx9("span", { children: "Destination chain" }),
1615
- /* @__PURE__ */ jsxs7("span", { className: "rs-review-detail-value", children: [
1616
- /* @__PURE__ */ jsx9("span", { children: targetChainName }),
1617
- targetChainIcon && /* @__PURE__ */ jsx9("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx9(CdnIcon, { src: targetChainIcon }) })
1618
- ] })
1619
- ] }),
1620
- /* @__PURE__ */ jsxs7("div", { className: "rs-review-detail-row", children: [
1621
- /* @__PURE__ */ jsx9("span", { children: "Estimated time" }),
1622
- /* @__PURE__ */ jsx9("span", { className: "rs-review-detail-value", children: estimatedTimeDisplay })
1623
- ] }),
1624
- /* @__PURE__ */ jsxs7("div", { className: "rs-review-detail-row", children: [
1625
- /* @__PURE__ */ jsx9("span", { children: "You send" }),
1626
- /* @__PURE__ */ jsxs7("span", { className: "rs-review-detail-value", children: [
1627
- /* @__PURE__ */ jsxs7("span", { children: [
1628
- formattedSendAmount,
1629
- " ",
1630
- asset.symbol
1631
- ] }),
1632
- /* @__PURE__ */ jsx9("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx9(TokenIcon, { symbol: asset.symbol }) })
1633
- ] })
1634
- ] }),
1635
- /* @__PURE__ */ jsxs7("div", { className: "rs-review-detail-row", children: [
1636
- /* @__PURE__ */ jsx9("span", { children: "Receive" }),
1637
- /* @__PURE__ */ jsxs7("span", { className: "rs-review-detail-value", children: [
1638
- /* @__PURE__ */ jsx9("span", { children: receiveDisplay }),
1639
- /* @__PURE__ */ jsx9("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx9(TokenIcon, { symbol: targetSymbol }) })
1640
- ] })
1641
- ] }),
1642
- /* @__PURE__ */ jsxs7("div", { className: "rs-review-detail-row", children: [
1643
- /* @__PURE__ */ jsx9("span", { children: "Fees" }),
1644
- /* @__PURE__ */ jsx9("span", { className: "rs-review-detail-value", children: feeDisplay === null ? /* @__PURE__ */ jsx9(
1645
- "span",
1646
- {
1647
- className: "rs-skeleton rs-skeleton-fee",
1648
- "aria-hidden": "true"
1649
- }
1650
- ) : /* @__PURE__ */ jsx9(
1651
- "span",
1652
- {
1653
- style: feesFullySponsored ? { textDecoration: "line-through" } : void 0,
1654
- children: feeDisplay
1655
- }
1656
- ) })
1657
- ] })
1658
- ] }),
1659
- error && /* @__PURE__ */ jsx9(Callout, { variant: "error", children: error }),
1660
- /* @__PURE__ */ jsx9(
1953
+ return /* @__PURE__ */ jsxs8("div", { className: "rs-screen", children: [
1954
+ /* @__PURE__ */ jsxs8("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
1955
+ /* @__PURE__ */ jsx10(BodyHeader, { icon: /* @__PURE__ */ jsx10(WalletIcon, {}), title: "Review deposit" }),
1956
+ /* @__PURE__ */ jsx10(
1957
+ ReviewDetails,
1958
+ {
1959
+ sourceChainName,
1960
+ sourceChainIcon,
1961
+ targetChainName,
1962
+ targetChainIcon,
1963
+ estimatedTime: estimatedTimeDisplay,
1964
+ sendAmount: formattedSendAmount,
1965
+ sendSymbol: asset.symbol,
1966
+ receiveDisplay,
1967
+ receiveSymbol: targetSymbol,
1968
+ fee: { display: feeDisplay, struck: feesFullySponsored }
1969
+ }
1970
+ ),
1971
+ error && /* @__PURE__ */ jsx10(Callout, { variant: "error", children: error }),
1972
+ /* @__PURE__ */ jsx10(
1661
1973
  Button,
1662
1974
  {
1663
1975
  onClick: handleConfirm,
1664
1976
  loading: isSubmitting,
1665
- loadingText: "Submitting transaction...",
1666
- disabled: chainMismatch || !amount || Number(amount) <= 0 || // Fee-charging route: block until the authoritative quote resolves
1667
- // (covers both loading and an unavailable preview). Fee-free routes
1668
- // are unaffected — `mustHaveQuote` is false for them.
1669
- quote === null && mustHaveQuote,
1977
+ loadingText: permit ? "Waiting for signature..." : "Submitting transaction...",
1978
+ disabled: (
1979
+ // An earlier send whose outcome is unknown. Never re-offered.
1980
+ submissionUncertain || // Signing is off-chain, so a chain mismatch only blocks the
1981
+ // transfer path.
1982
+ chainMismatch && !permit || !amount || Number(amount) <= 0 || // Fee-charging route: block until the authoritative quote resolves
1983
+ // (covers both loading and an unavailable preview). Fee-free routes
1984
+ // are unaffected — `mustHaveQuote` is false for them.
1985
+ quote === null && mustHaveQuote
1986
+ ),
1670
1987
  fullWidth: true,
1671
- children: "Continue"
1988
+ children: permit ? "Sign to deposit" : "Continue"
1672
1989
  }
1673
- )
1990
+ ),
1991
+ permit && /* @__PURE__ */ jsxs8("p", { className: "rs-gasless-note", children: [
1992
+ "Gasless via",
1993
+ " ",
1994
+ permit.kind === "permit2" ? "Permit2" : permit.kind === "erc3009" ? "ERC-3009" : "ERC-2612",
1995
+ " ",
1996
+ "\u2014 sign, no transaction"
1997
+ ] }),
1998
+ !permit && permitEligible && permitUnavailable && /* @__PURE__ */ jsx10("p", { className: "rs-gasless-note", children: permitUnavailable === "permit2-approval-required" ? "Gasless unavailable until Permit2 is approved; Continue sends a token transaction." : "This wallet/token cannot use gasless authorization; Continue sends a token transaction." })
1999
+ ] }),
2000
+ /* @__PURE__ */ jsx10(PoweredBy, {})
2001
+ ] });
2002
+ }
2003
+
2004
+ // src/components/steps/QrReviewStep.tsx
2005
+ import { useEffect as useEffect5, useState as useState5 } from "react";
2006
+ import { parseUnits as parseUnits3 } from "viem";
2007
+ import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
2008
+ function QrReviewStep({
2009
+ smartAccount,
2010
+ asset,
2011
+ amount,
2012
+ targetAmount,
2013
+ targetTokenPriceUsd,
2014
+ targetChain,
2015
+ targetToken,
2016
+ service,
2017
+ onClose
2018
+ }) {
2019
+ const [quote, setQuote] = useState5({ state: "loading", value: null });
2020
+ const targetChainId = targetChainToChainId(targetChain);
2021
+ const targetSymbol = getTargetTokenSymbol(targetToken, targetChainId);
2022
+ useEffect5(() => {
2023
+ let cancelled = false;
2024
+ let units;
2025
+ try {
2026
+ units = parseUnits3(amount, asset.decimals);
2027
+ } catch {
2028
+ setQuote({ state: "unavailable", value: null });
2029
+ return;
2030
+ }
2031
+ if (units <= 0n) {
2032
+ setQuote({ state: "unavailable", value: null });
2033
+ return;
2034
+ }
2035
+ setQuote({ state: "loading", value: null });
2036
+ service.getQuotePreview({
2037
+ account: smartAccount,
2038
+ sourceChainId: asset.chainId,
2039
+ sourceToken: asset.token,
2040
+ amount: units.toString()
2041
+ }).then((result) => {
2042
+ if (cancelled) return;
2043
+ setQuote(
2044
+ result ? { state: "ready", value: result } : { state: "unavailable", value: null }
2045
+ );
2046
+ }).catch(() => {
2047
+ if (!cancelled) setQuote({ state: "unavailable", value: null });
2048
+ });
2049
+ return () => {
2050
+ cancelled = true;
2051
+ };
2052
+ }, [service, smartAccount, asset, amount]);
2053
+ const formattedSendAmount = formatTokenAmount(Number(amount), asset.symbol) ?? amount;
2054
+ const receiveDisplay = (() => {
2055
+ if (quote.value) {
2056
+ const quoted = formatQuotedReceive(quote.value.output, targetSymbol);
2057
+ if (quoted !== void 0) return quoted;
2058
+ }
2059
+ const usdValue = Number(targetAmount);
2060
+ const estimate = formatReceiveEstimate({
2061
+ sourceAmount: Number.isFinite(Number(amount)) ? Number(amount) : void 0,
2062
+ sourceSymbol: asset.symbol,
2063
+ targetSymbol,
2064
+ sourceAmountUsd: Number.isFinite(usdValue) && usdValue > 0 ? usdValue : void 0,
2065
+ sourceTrusted: isRecognizedToken(asset.token, asset.chainId),
2066
+ prices: targetTokenPriceUsd !== null && targetTokenPriceUsd > 0 ? { [targetSymbol.toUpperCase()]: targetTokenPriceUsd } : isDisplayStablecoinSymbol(targetSymbol) ? { [targetSymbol.toUpperCase()]: 1 } : {}
2067
+ });
2068
+ return estimate ?? targetSymbol;
2069
+ })();
2070
+ const estimatedTime = quote.value && Number.isFinite(quote.value.estimatedFillTimeSeconds) ? quote.value.estimatedFillTimeSeconds < 60 ? "< 1 min" : `~${Math.round(quote.value.estimatedFillTimeSeconds / 60)} min` : quote.state === "loading" ? "\u2026" : "\u2014";
2071
+ const { display: quotedFee, struck } = quoteFeeRow(quote.value?.fees);
2072
+ const feeDisplay = quote.state === "unavailable" ? "\u2014" : quotedFee;
2073
+ return /* @__PURE__ */ jsxs9("div", { className: "rs-screen", children: [
2074
+ /* @__PURE__ */ jsxs9("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
2075
+ /* @__PURE__ */ jsx11(BodyHeader, { icon: /* @__PURE__ */ jsx11(TransferCryptoIcon, {}), title: "Fee estimate" }),
2076
+ /* @__PURE__ */ jsx11(
2077
+ ReviewDetails,
2078
+ {
2079
+ sourceChainName: getChainName(asset.chainId),
2080
+ sourceChainIcon: getChainIcon(asset.chainId),
2081
+ targetChainName: getChainName(targetChainId),
2082
+ targetChainIcon: getChainIcon(targetChainId),
2083
+ estimatedTime,
2084
+ sendAmount: formattedSendAmount,
2085
+ sendSymbol: asset.symbol,
2086
+ receiveDisplay,
2087
+ receiveSymbol: targetSymbol,
2088
+ fee: { display: feeDisplay, struck }
2089
+ }
2090
+ ),
2091
+ /* @__PURE__ */ jsx11(Button, { onClick: onClose, fullWidth: true, children: "Close" })
1674
2092
  ] }),
1675
- /* @__PURE__ */ jsx9(PoweredBy, {})
2093
+ /* @__PURE__ */ jsx11(PoweredBy, {})
1676
2094
  ] });
1677
2095
  }
2096
+ QrReviewStep.displayName = "QrReviewStep";
1678
2097
 
1679
2098
  // src/components/steps/DepositAddressStep.tsx
1680
2099
  import {
1681
- useState as useState6,
1682
- useEffect as useEffect6,
2100
+ useState as useState7,
2101
+ useEffect as useEffect7,
1683
2102
  useCallback as useCallback2,
1684
2103
  useRef as useRef5,
1685
2104
  useMemo as useMemo3,
1686
2105
  lazy,
1687
2106
  Suspense
1688
2107
  } from "react";
1689
- import { formatUnits as formatUnits3 } from "viem";
1690
2108
 
1691
2109
  // src/components/steps/DepositAddressSkeleton.tsx
1692
- import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
2110
+ import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
1693
2111
  var BASE_CHAIN_ID = 8453;
1694
2112
  function DepositAddressSkeleton({
1695
2113
  uiConfig
@@ -1700,32 +2118,32 @@ function DepositAddressSkeleton({
1700
2118
  const defaultToken = tokensForChain.includes("USDC") ? "USDC" : tokensForChain[0] ?? "USDC";
1701
2119
  const chainName = getChainName(defaultChainId);
1702
2120
  const chainIcon = getChainIcon(defaultChainId);
1703
- return /* @__PURE__ */ jsxs8("div", { className: "rs-screen", "aria-busy": "true", children: [
1704
- /* @__PURE__ */ jsx10("span", { className: "rs-sr-only", role: "status", children: "Preparing deposit details\u2026" }),
1705
- /* @__PURE__ */ jsxs8("div", { className: "rs-screen-body", children: [
1706
- /* @__PURE__ */ jsx10(BodyHeader, { icon: /* @__PURE__ */ jsx10(TransferCryptoIcon, {}), title: "Transfer crypto" }),
1707
- /* @__PURE__ */ jsxs8("div", { className: "rs-deposit-address-selectors", "aria-hidden": "true", children: [
1708
- /* @__PURE__ */ jsxs8("div", { className: "rs-deposit-address-dropdown", children: [
1709
- /* @__PURE__ */ jsx10("div", { className: "rs-deposit-address-dropdown-label", children: "Supported chain" }),
1710
- /* @__PURE__ */ jsxs8("div", { className: "rs-deposit-address-dropdown-trigger", children: [
1711
- /* @__PURE__ */ jsx10(
2121
+ return /* @__PURE__ */ jsxs10("div", { className: "rs-screen", "aria-busy": "true", children: [
2122
+ /* @__PURE__ */ jsx12("span", { className: "rs-sr-only", role: "status", children: "Preparing deposit details\u2026" }),
2123
+ /* @__PURE__ */ jsxs10("div", { className: "rs-screen-body", children: [
2124
+ /* @__PURE__ */ jsx12(BodyHeader, { icon: /* @__PURE__ */ jsx12(TransferCryptoIcon, {}), title: "Transfer crypto" }),
2125
+ /* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-selectors", "aria-hidden": "true", children: [
2126
+ /* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown", children: [
2127
+ /* @__PURE__ */ jsx12("div", { className: "rs-deposit-address-dropdown-label", children: "Supported chain" }),
2128
+ /* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown-trigger", children: [
2129
+ /* @__PURE__ */ jsx12(
1712
2130
  CdnIcon,
1713
2131
  {
1714
2132
  src: chainIcon,
1715
2133
  className: "rs-deposit-address-dropdown-icon"
1716
2134
  }
1717
2135
  ),
1718
- /* @__PURE__ */ jsx10("span", { children: chainName }),
1719
- /* @__PURE__ */ jsx10(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
2136
+ /* @__PURE__ */ jsx12("span", { children: chainName }),
2137
+ /* @__PURE__ */ jsx12(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
1720
2138
  ] })
1721
2139
  ] }),
1722
- /* @__PURE__ */ jsxs8("div", { className: "rs-deposit-address-dropdown", children: [
1723
- /* @__PURE__ */ jsxs8("div", { className: "rs-deposit-address-dropdown-label rs-deposit-address-dropdown-label--with-min", children: [
1724
- /* @__PURE__ */ jsx10("span", { children: "Supported token" }),
1725
- /* @__PURE__ */ jsxs8("span", { className: "rs-deposit-address-min", children: [
2140
+ /* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown", children: [
2141
+ /* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown-label rs-deposit-address-dropdown-label--with-min", children: [
2142
+ /* @__PURE__ */ jsx12("span", { children: "Supported token" }),
2143
+ /* @__PURE__ */ jsxs10("span", { className: "rs-deposit-address-min", children: [
1726
2144
  "Min.$",
1727
2145
  (uiConfig?.minDepositUsd ?? 0.1).toFixed(2),
1728
- /* @__PURE__ */ jsx10(Tooltip, { content: "Minimum deposit amount required for the selected chain.", children: /* @__PURE__ */ jsx10(
2146
+ /* @__PURE__ */ jsx12(Tooltip, { content: "Minimum deposit amount required for the selected chain.", children: /* @__PURE__ */ jsx12(
1729
2147
  InfoIcon,
1730
2148
  {
1731
2149
  className: "rs-deposit-address-min-icon",
@@ -1734,74 +2152,55 @@ function DepositAddressSkeleton({
1734
2152
  ) })
1735
2153
  ] })
1736
2154
  ] }),
1737
- /* @__PURE__ */ jsxs8("div", { className: "rs-deposit-address-dropdown-trigger", children: [
1738
- /* @__PURE__ */ jsx10(
2155
+ /* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown-trigger", children: [
2156
+ /* @__PURE__ */ jsx12(
1739
2157
  TokenIcon,
1740
2158
  {
1741
2159
  symbol: defaultToken,
1742
2160
  className: "rs-deposit-address-dropdown-icon"
1743
2161
  }
1744
2162
  ),
1745
- /* @__PURE__ */ jsx10("span", { children: defaultToken }),
1746
- /* @__PURE__ */ jsx10(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
2163
+ /* @__PURE__ */ jsx12("span", { children: defaultToken }),
2164
+ /* @__PURE__ */ jsx12(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
1747
2165
  ] })
1748
2166
  ] })
1749
2167
  ] }),
1750
- /* @__PURE__ */ jsxs8(
2168
+ /* @__PURE__ */ jsxs10(
1751
2169
  "div",
1752
2170
  {
1753
2171
  style: { display: "flex", flexDirection: "column", gap: 4, width: "100%" },
1754
2172
  children: [
1755
- /* @__PURE__ */ jsxs8("div", { className: "rs-deposit-address-well", children: [
1756
- /* @__PURE__ */ jsx10("div", { className: "rs-deposit-address-qr", children: /* @__PURE__ */ jsx10("div", { className: "rs-skeleton rs-skeleton-qr", "aria-hidden": "true" }) }),
1757
- /* @__PURE__ */ jsx10("div", { className: "rs-skeleton rs-skeleton-address", "aria-hidden": "true" })
2173
+ /* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-well", children: [
2174
+ /* @__PURE__ */ jsx12("div", { className: "rs-deposit-address-qr", children: /* @__PURE__ */ jsx12("div", { className: "rs-skeleton rs-skeleton-qr", "aria-hidden": "true" }) }),
2175
+ /* @__PURE__ */ jsx12("div", { className: "rs-skeleton rs-skeleton-address", "aria-hidden": "true" })
1758
2176
  ] }),
1759
- /* @__PURE__ */ jsxs8(
1760
- "button",
1761
- {
1762
- type: "button",
1763
- className: "rs-deposit-address-copy",
1764
- disabled: true,
1765
- "aria-hidden": "true",
1766
- children: [
1767
- /* @__PURE__ */ jsx10(CopyIcon, {}),
1768
- "Copy address"
1769
- ]
1770
- }
1771
- )
2177
+ /* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-actions", "aria-hidden": "true", children: [
2178
+ /* @__PURE__ */ jsxs10("button", { type: "button", className: "rs-deposit-address-copy", disabled: true, children: [
2179
+ /* @__PURE__ */ jsx12(CopyIcon, {}),
2180
+ "Copy address"
2181
+ ] }),
2182
+ /* @__PURE__ */ jsx12(
2183
+ "button",
2184
+ {
2185
+ type: "button",
2186
+ className: "rs-deposit-address-copy rs-deposit-address-review",
2187
+ disabled: true,
2188
+ children: "Estimate fees"
2189
+ }
2190
+ )
2191
+ ] })
1772
2192
  ]
1773
2193
  }
1774
- ),
1775
- /* @__PURE__ */ jsx10("div", { className: "rs-price-impact", "aria-hidden": "true", children: /* @__PURE__ */ jsxs8("div", { className: "rs-price-impact-header", children: [
1776
- /* @__PURE__ */ jsxs8("span", { className: "rs-price-impact-header-left", children: [
1777
- /* @__PURE__ */ jsx10("span", { className: "rs-price-impact-label", children: "Price impact" }),
1778
- /* @__PURE__ */ jsx10("span", { className: "rs-price-impact-label", children: /* @__PURE__ */ jsx10("strong", { children: "0.00%" }) }),
1779
- /* @__PURE__ */ jsx10(
1780
- Tooltip,
1781
- {
1782
- className: "rs-price-impact-info",
1783
- content: "Price impact is the difference between expected and execution price, due to trade size and liquidity.",
1784
- children: /* @__PURE__ */ jsx10(InfoIcon, { "aria-hidden": "true" })
1785
- }
1786
- )
1787
- ] }),
1788
- /* @__PURE__ */ jsx10(
1789
- ChevronDownIcon,
1790
- {
1791
- className: "rs-price-impact-chevron",
1792
- "aria-hidden": "true"
1793
- }
1794
- )
1795
- ] }) })
2194
+ )
1796
2195
  ] }),
1797
- /* @__PURE__ */ jsx10(PoweredBy, {})
2196
+ /* @__PURE__ */ jsx12(PoweredBy, {})
1798
2197
  ] });
1799
2198
  }
1800
2199
  DepositAddressSkeleton.displayName = "DepositAddressSkeleton";
1801
2200
 
1802
2201
  // src/components/ui/DepositNotification.tsx
1803
- import { useState as useState5, useEffect as useEffect5, useRef as useRef4, useCallback } from "react";
1804
- import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
2202
+ import { useState as useState6, useEffect as useEffect6, useRef as useRef4, useCallback } from "react";
2203
+ import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
1805
2204
  var INITIAL_POLL_INTERVAL = 3e3;
1806
2205
  var MAX_POLL_INTERVAL = 3e4;
1807
2206
  var BACKOFF_MULTIPLIER = 1.5;
@@ -1858,7 +2257,7 @@ function formatBridgeFailedMessage(event) {
1858
2257
  }
1859
2258
  return "Bridge failed";
1860
2259
  }
1861
- var txLinkIcon = /* @__PURE__ */ jsx11(ExternalLinkIcon, { className: "rs-deposit-notification-link-icon" });
2260
+ var txLinkIcon = /* @__PURE__ */ jsx13(ExternalLinkIcon, { className: "rs-deposit-notification-link-icon" });
1862
2261
  function DepositNotification({
1863
2262
  deposit,
1864
2263
  smartAccount,
@@ -1879,14 +2278,14 @@ function DepositNotification({
1879
2278
  detectedAt,
1880
2279
  directTransfer
1881
2280
  } = deposit;
1882
- const [status, setStatus] = useState5(
2281
+ const [status, setStatus] = useState6(
1883
2282
  directTransfer ? "complete" : "processing"
1884
2283
  );
1885
- const [expanded, setExpanded] = useState5(false);
1886
- const [completedAt, setCompletedAt] = useState5(
2284
+ const [expanded, setExpanded] = useState6(false);
2285
+ const [completedAt, setCompletedAt] = useState6(
1887
2286
  directTransfer ? detectedAt : null
1888
2287
  );
1889
- const [destinationTxHash, setDestinationTxHash] = useState5(
2288
+ const [destinationTxHash, setDestinationTxHash] = useState6(
1890
2289
  null
1891
2290
  );
1892
2291
  const pollIntervalRef = useRef4(INITIAL_POLL_INTERVAL);
@@ -1930,7 +2329,7 @@ function DepositNotification({
1930
2329
  },
1931
2330
  [onFailedRef, txHash]
1932
2331
  );
1933
- useEffect5(() => {
2332
+ useEffect6(() => {
1934
2333
  if (directTransfer) {
1935
2334
  handleComplete(void 0);
1936
2335
  return;
@@ -1997,7 +2396,7 @@ function DepositNotification({
1997
2396
  const destExplorerUrl = destinationTxHash ? explorerTxUrl(targetChainToChainId(targetChain), destinationTxHash) : null;
1998
2397
  const title = status === "complete" ? "Deposit completed" : status === "failed" ? "Deposit failed" : "Deposit received and processing\u2026";
1999
2398
  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.";
2000
- const statusIcon = status === "complete" ? /* @__PURE__ */ jsx11("div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--complete", children: /* @__PURE__ */ jsx11(CheckIcon, {}) }) : status === "failed" ? /* @__PURE__ */ jsx11("div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--failed", children: /* @__PURE__ */ jsx11(CloseIcon, {}) }) : /* @__PURE__ */ jsx11("div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--processing", children: /* @__PURE__ */ jsxs9(
2399
+ const statusIcon = status === "complete" ? /* @__PURE__ */ jsx13("div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--complete", children: /* @__PURE__ */ jsx13(CheckIcon, {}) }) : status === "failed" ? /* @__PURE__ */ jsx13("div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--failed", children: /* @__PURE__ */ jsx13(CloseIcon, {}) }) : /* @__PURE__ */ jsx13("div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--processing", children: /* @__PURE__ */ jsxs11(
2001
2400
  "svg",
2002
2401
  {
2003
2402
  className: "rs-deposit-notification-spinner",
@@ -2006,7 +2405,7 @@ function DepositNotification({
2006
2405
  xmlns: "http://www.w3.org/2000/svg",
2007
2406
  "aria-hidden": "true",
2008
2407
  children: [
2009
- /* @__PURE__ */ jsx11(
2408
+ /* @__PURE__ */ jsx13(
2010
2409
  "path",
2011
2410
  {
2012
2411
  className: "rs-deposit-notification-spinner-track",
@@ -2016,7 +2415,7 @@ function DepositNotification({
2016
2415
  strokeLinecap: "round"
2017
2416
  }
2018
2417
  ),
2019
- /* @__PURE__ */ jsx11(
2418
+ /* @__PURE__ */ jsx13(
2020
2419
  "path",
2021
2420
  {
2022
2421
  className: "rs-deposit-notification-spinner-head",
@@ -2030,31 +2429,31 @@ function DepositNotification({
2030
2429
  }
2031
2430
  ) });
2032
2431
  const showClose = status !== "processing";
2033
- return /* @__PURE__ */ jsxs9(
2432
+ return /* @__PURE__ */ jsxs11(
2034
2433
  "div",
2035
2434
  {
2036
2435
  className: `rs-deposit-notification rs-deposit-notification--${status} ${expanded ? "rs-deposit-notification--expanded" : ""}`,
2037
2436
  children: [
2038
- /* @__PURE__ */ jsxs9("div", { className: "rs-deposit-notification-header", children: [
2039
- /* @__PURE__ */ jsx11("div", { className: "rs-deposit-notification-icon", children: statusIcon }),
2040
- /* @__PURE__ */ jsxs9("div", { className: "rs-deposit-notification-content", children: [
2041
- /* @__PURE__ */ jsxs9("div", { className: "rs-deposit-notification-title-row", children: [
2042
- /* @__PURE__ */ jsx11("span", { className: "rs-deposit-notification-title", children: title }),
2043
- showClose && /* @__PURE__ */ jsx11(
2437
+ /* @__PURE__ */ jsxs11("div", { className: "rs-deposit-notification-header", children: [
2438
+ /* @__PURE__ */ jsx13("div", { className: "rs-deposit-notification-icon", children: statusIcon }),
2439
+ /* @__PURE__ */ jsxs11("div", { className: "rs-deposit-notification-content", children: [
2440
+ /* @__PURE__ */ jsxs11("div", { className: "rs-deposit-notification-title-row", children: [
2441
+ /* @__PURE__ */ jsx13("span", { className: "rs-deposit-notification-title", children: title }),
2442
+ showClose && /* @__PURE__ */ jsx13(
2044
2443
  "button",
2045
2444
  {
2046
2445
  type: "button",
2047
2446
  className: "rs-deposit-notification-close",
2048
2447
  onClick: () => onDismiss(deposit.id),
2049
2448
  "aria-label": "Dismiss",
2050
- children: /* @__PURE__ */ jsx11(CloseIcon, {})
2449
+ children: /* @__PURE__ */ jsx13(CloseIcon, {})
2051
2450
  }
2052
2451
  )
2053
2452
  ] }),
2054
- /* @__PURE__ */ jsx11("div", { className: "rs-deposit-notification-subtitle", children: subtitle })
2453
+ /* @__PURE__ */ jsx13("div", { className: "rs-deposit-notification-subtitle", children: subtitle })
2055
2454
  ] })
2056
2455
  ] }),
2057
- /* @__PURE__ */ jsxs9(
2456
+ /* @__PURE__ */ jsxs11(
2058
2457
  "button",
2059
2458
  {
2060
2459
  type: "button",
@@ -2062,15 +2461,15 @@ function DepositNotification({
2062
2461
  onClick: () => setExpanded(!expanded),
2063
2462
  "aria-expanded": expanded,
2064
2463
  children: [
2065
- /* @__PURE__ */ jsx11("span", { children: expanded ? "See less details" : "See more details" }),
2066
- /* @__PURE__ */ jsx11(ChevronDownIcon, { className: "rs-deposit-notification-toggle-chevron" })
2464
+ /* @__PURE__ */ jsx13("span", { children: expanded ? "See less details" : "See more details" }),
2465
+ /* @__PURE__ */ jsx13(ChevronDownIcon, { className: "rs-deposit-notification-toggle-chevron" })
2067
2466
  ]
2068
2467
  }
2069
2468
  ),
2070
- expanded && /* @__PURE__ */ jsxs9("div", { className: "rs-deposit-notification-details", children: [
2071
- /* @__PURE__ */ jsxs9("div", { className: "rs-deposit-notification-row", children: [
2072
- /* @__PURE__ */ jsx11("span", { className: "rs-deposit-notification-label", children: "Deposit tx" }),
2073
- /* @__PURE__ */ jsx11("span", { className: "rs-deposit-notification-value", children: sourceExplorerUrl ? /* @__PURE__ */ jsxs9(
2469
+ expanded && /* @__PURE__ */ jsxs11("div", { className: "rs-deposit-notification-details", children: [
2470
+ /* @__PURE__ */ jsxs11("div", { className: "rs-deposit-notification-row", children: [
2471
+ /* @__PURE__ */ jsx13("span", { className: "rs-deposit-notification-label", children: "Deposit tx" }),
2472
+ /* @__PURE__ */ jsx13("span", { className: "rs-deposit-notification-value", children: sourceExplorerUrl ? /* @__PURE__ */ jsxs11(
2074
2473
  "a",
2075
2474
  {
2076
2475
  href: sourceExplorerUrl,
@@ -2084,9 +2483,9 @@ function DepositNotification({
2084
2483
  }
2085
2484
  ) : truncateHash(txHash) })
2086
2485
  ] }),
2087
- destinationTxHash && /* @__PURE__ */ jsxs9("div", { className: "rs-deposit-notification-row", children: [
2088
- /* @__PURE__ */ jsx11("span", { className: "rs-deposit-notification-label", children: "Completion tx" }),
2089
- /* @__PURE__ */ jsx11("span", { className: "rs-deposit-notification-value", children: destExplorerUrl ? /* @__PURE__ */ jsxs9(
2486
+ destinationTxHash && /* @__PURE__ */ jsxs11("div", { className: "rs-deposit-notification-row", children: [
2487
+ /* @__PURE__ */ jsx13("span", { className: "rs-deposit-notification-label", children: "Completion tx" }),
2488
+ /* @__PURE__ */ jsx13("span", { className: "rs-deposit-notification-value", children: destExplorerUrl ? /* @__PURE__ */ jsxs11(
2090
2489
  "a",
2091
2490
  {
2092
2491
  href: destExplorerUrl,
@@ -2100,13 +2499,13 @@ function DepositNotification({
2100
2499
  }
2101
2500
  ) : truncateHash(destinationTxHash) })
2102
2501
  ] }),
2103
- /* @__PURE__ */ jsxs9("div", { className: "rs-deposit-notification-row", children: [
2104
- /* @__PURE__ */ jsx11("span", { className: "rs-deposit-notification-label", children: "Order submitted" }),
2105
- /* @__PURE__ */ jsx11("span", { className: "rs-deposit-notification-value", children: formatTimestamp(detectedAt) })
2502
+ /* @__PURE__ */ jsxs11("div", { className: "rs-deposit-notification-row", children: [
2503
+ /* @__PURE__ */ jsx13("span", { className: "rs-deposit-notification-label", children: "Order submitted" }),
2504
+ /* @__PURE__ */ jsx13("span", { className: "rs-deposit-notification-value", children: formatTimestamp(detectedAt) })
2106
2505
  ] }),
2107
- completedAt && /* @__PURE__ */ jsxs9("div", { className: "rs-deposit-notification-row", children: [
2108
- /* @__PURE__ */ jsx11("span", { className: "rs-deposit-notification-label", children: "Order filled" }),
2109
- /* @__PURE__ */ jsx11("span", { className: "rs-deposit-notification-value", children: formatTimestamp(completedAt) })
2506
+ completedAt && /* @__PURE__ */ jsxs11("div", { className: "rs-deposit-notification-row", children: [
2507
+ /* @__PURE__ */ jsx13("span", { className: "rs-deposit-notification-label", children: "Order filled" }),
2508
+ /* @__PURE__ */ jsx13("span", { className: "rs-deposit-notification-value", children: formatTimestamp(completedAt) })
2110
2509
  ] })
2111
2510
  ] })
2112
2511
  ]
@@ -2115,9 +2514,9 @@ function DepositNotification({
2115
2514
  }
2116
2515
 
2117
2516
  // src/components/steps/DepositAddressStep.tsx
2118
- import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
2517
+ import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
2119
2518
  var QRCode = lazy(
2120
- () => import("./QRCode-WUC652SH.mjs").then((m) => ({ default: m.QRCode }))
2519
+ () => import("./QRCode-5RGIZZHL.mjs").then((m) => ({ default: m.QRCode }))
2121
2520
  );
2122
2521
  var POLL_INTERVAL_MS = 4e3;
2123
2522
  function isRecord(value) {
@@ -2204,20 +2603,31 @@ function computeTokensForChain(chainId, topTokens, catalogChain) {
2204
2603
  if (fromBackend) return fromBackend;
2205
2604
  return Array.isArray(catalogChain?.supportedTokens) ? catalogChain.supportedTokens.map((t) => t.symbol) : [];
2206
2605
  }
2207
- function resolveSourceTokenAddress(symbol, chainId, topTokens, catalogChain) {
2208
- const top = topTokens?.[String(chainId)]?.find((t) => t.symbol === symbol);
2209
- if (top?.address) return top.address;
2210
- const fromRegistry = getTokenAddress(symbol, chainId);
2211
- if (fromRegistry) return fromRegistry;
2212
- return Array.isArray(catalogChain?.supportedTokens) ? catalogChain.supportedTokens.find((t) => t.symbol === symbol)?.address : void 0;
2606
+ function selectionAsAsset(chainId, symbol, topTokens, catalogChain) {
2607
+ if (typeof chainId !== "number" || !symbol) return void 0;
2608
+ const fromShortlist = topTokens?.[String(chainId)]?.find(
2609
+ (t) => t.symbol === symbol
2610
+ );
2611
+ const fromCatalog = Array.isArray(catalogChain?.supportedTokens) ? catalogChain.supportedTokens.find((t) => t.symbol === symbol) : void 0;
2612
+ const address = fromShortlist?.address ?? fromCatalog?.address;
2613
+ const decimals = fromShortlist?.decimals ?? fromCatalog?.decimals;
2614
+ if (!address || decimals === void 0) return void 0;
2615
+ return {
2616
+ id: `qr-${chainId}-${symbol}`,
2617
+ chainId,
2618
+ token: address,
2619
+ symbol,
2620
+ name: symbol,
2621
+ decimals
2622
+ };
2213
2623
  }
2214
2624
  function TokenGlyph({ symbol }) {
2215
- return /* @__PURE__ */ jsx12(
2625
+ return /* @__PURE__ */ jsx14(
2216
2626
  TokenIcon,
2217
2627
  {
2218
2628
  symbol,
2219
2629
  className: "rs-deposit-address-dropdown-icon",
2220
- fallback: /* @__PURE__ */ jsx12("span", { className: "rs-deposit-address-dropdown-icon rs-deposit-address-dropdown-icon--fallback", children: symbol.slice(0, 3) })
2630
+ fallback: /* @__PURE__ */ jsx14("span", { className: "rs-deposit-address-dropdown-icon rs-deposit-address-dropdown-icon--fallback", children: symbol.slice(0, 3) })
2221
2631
  }
2222
2632
  );
2223
2633
  }
@@ -2233,15 +2643,17 @@ function DepositAddressStep({
2233
2643
  targetChain,
2234
2644
  targetToken,
2235
2645
  uiConfig,
2646
+ initialSource,
2236
2647
  onDepositSubmitted,
2237
2648
  onDepositComplete,
2238
2649
  onDepositFailed,
2239
2650
  onCopyAddress,
2651
+ onReviewDeposit,
2240
2652
  onError
2241
2653
  }) {
2242
2654
  const hasSolana = Boolean(solanaDepositAddress);
2243
- const [topTokens, setTopTokens] = useState6(null);
2244
- useEffect6(() => {
2655
+ const [topTokens, setTopTokens] = useState7(null);
2656
+ useEffect7(() => {
2245
2657
  let active = true;
2246
2658
  setTopTokens(null);
2247
2659
  service.getTopTokens().then((t) => {
@@ -2276,96 +2688,63 @@ function DepositAddressStep({
2276
2688
  );
2277
2689
  }, [evmChainIds, hasSolana, topTokens, catalogFor]);
2278
2690
  const preferredChainId = (options) => options.includes(BASE_CHAIN_ID2) ? BASE_CHAIN_ID2 : options[0] ?? BASE_CHAIN_ID2;
2279
- const [sourceChainId, setSourceChainId] = useState6(() => preferredChainId(chainOptions));
2280
- const chainChosenByUser = useRef5(false);
2281
- useEffect6(() => {
2691
+ const [sourceChainId, setSourceChainId] = useState7(() => initialSource?.chainId ?? preferredChainId(chainOptions));
2692
+ const chainChosenByUser = useRef5(initialSource !== void 0);
2693
+ const pendingChainRef = useRef5(initialSource?.chainId);
2694
+ useEffect7(() => {
2282
2695
  if (chainOptions.length === 0) return;
2696
+ const pendingChain = pendingChainRef.current;
2697
+ if (pendingChain !== void 0) {
2698
+ if (chainOptions.includes(pendingChain)) {
2699
+ pendingChainRef.current = void 0;
2700
+ setSourceChainId(pendingChain);
2701
+ return;
2702
+ }
2703
+ if (catalogLoading || topTokens === null) return;
2704
+ pendingChainRef.current = void 0;
2705
+ }
2283
2706
  const stale = chainChosenByUser.current ? !chainOptions.includes(sourceChainId) : sourceChainId !== preferredChainId(chainOptions);
2284
2707
  if (stale) setSourceChainId(preferredChainId(chainOptions));
2285
- }, [chainOptions, sourceChainId]);
2708
+ }, [chainOptions, sourceChainId, catalogLoading, topTokens]);
2286
2709
  const isSolana = sourceChainId === "solana";
2287
2710
  const isHyperCore = sourceChainId === "hypercore";
2288
2711
  const tokensForChain = useMemo3(
2289
2712
  () => computeTokensForChain(sourceChainId, topTokens, catalogFor(sourceChainId)),
2290
2713
  [sourceChainId, topTokens, catalogFor]
2291
2714
  );
2292
- const defaultToken = pickFallbackToken(tokensForChain, "USDC");
2293
- const [sourceTokenSymbol, setSourceTokenSymbol] = useState6(defaultToken);
2294
- useEffect6(() => {
2295
- if (!tokensForChain.includes(sourceTokenSymbol)) {
2296
- setSourceTokenSymbol(pickFallbackToken(tokensForChain, sourceTokenSymbol));
2715
+ const defaultToken = pickFallbackToken(
2716
+ tokensForChain,
2717
+ initialSource?.symbol ?? "USDC"
2718
+ );
2719
+ const [sourceTokenSymbol, setSourceTokenSymbol] = useState7(defaultToken);
2720
+ const pendingTokenRef = useRef5(initialSource?.symbol);
2721
+ useEffect7(() => {
2722
+ if (tokensForChain.includes(sourceTokenSymbol)) {
2723
+ pendingTokenRef.current = void 0;
2724
+ return;
2725
+ }
2726
+ const pending = pendingTokenRef.current;
2727
+ if (pending && tokensForChain.includes(pending)) {
2728
+ pendingTokenRef.current = void 0;
2729
+ setSourceTokenSymbol(pending);
2730
+ return;
2297
2731
  }
2732
+ const next = pickFallbackToken(tokensForChain, sourceTokenSymbol);
2733
+ if (next) pendingTokenRef.current = void 0;
2734
+ setSourceTokenSymbol(next);
2298
2735
  }, [tokensForChain, sourceTokenSymbol]);
2299
- const [copied, setCopied] = useState6(false);
2300
- const [pollingError, setPollingError] = useState6(null);
2301
- const [chainDropdownOpen, setChainDropdownOpen] = useState6(false);
2302
- const [tokenDropdownOpen, setTokenDropdownOpen] = useState6(false);
2303
- const [priceImpactExpanded, setPriceImpactExpanded] = useState6(false);
2736
+ const [copied, setCopied] = useState7(false);
2737
+ const [pollingError, setPollingError] = useState7(null);
2738
+ const [chainDropdownOpen, setChainDropdownOpen] = useState7(false);
2739
+ const [tokenDropdownOpen, setTokenDropdownOpen] = useState7(false);
2304
2740
  const chainDropdownRef = useRef5(null);
2305
2741
  const tokenDropdownRef = useRef5(null);
2306
- const [notifications, setNotifications] = useState6([]);
2742
+ const [notifications, setNotifications] = useState7([]);
2307
2743
  const isTrackingRef = useRef5(false);
2308
2744
  const baselineTxHashRef = useRef5(void 0);
2309
2745
  const notificationIdRef = useRef5(0);
2310
- const [liquidityHelper, setLiquidityHelper] = useState6({
2311
- kind: "idle"
2312
- });
2313
- useEffect6(() => {
2314
- if (isSolana || isHyperCore) {
2315
- setLiquidityHelper({ kind: "idle" });
2316
- return;
2317
- }
2318
- const sourceTokenAddress = resolveSourceTokenAddress(
2319
- sourceTokenSymbol,
2320
- sourceChainId,
2321
- topTokens,
2322
- catalogFor(sourceChainId)
2323
- );
2324
- if (!sourceTokenAddress) {
2325
- setLiquidityHelper({ kind: "idle" });
2326
- return;
2327
- }
2328
- let cancelled = false;
2329
- setLiquidityHelper({ kind: "loading" });
2330
- service.checkLiquidity({
2331
- sourceChainId,
2332
- sourceToken: sourceTokenAddress,
2333
- destinationChainId: targetChainToCaip2(targetChain),
2334
- destinationToken: targetToken,
2335
- amount: "1"
2336
- }).then((result) => {
2337
- if (cancelled) return;
2338
- if (result.unlimited) {
2339
- setLiquidityHelper({ kind: "unlimited" });
2340
- } else if (result.maxAmount === null) {
2341
- setLiquidityHelper({ kind: "unavailable" });
2342
- } else {
2343
- setLiquidityHelper({
2344
- kind: "max",
2345
- maxAmount: result.maxAmount,
2346
- decimals: result.decimals,
2347
- symbol: result.symbol || sourceTokenSymbol
2348
- });
2349
- }
2350
- }).catch(() => {
2351
- if (cancelled) return;
2352
- setLiquidityHelper({ kind: "error" });
2353
- });
2354
- return () => {
2355
- cancelled = true;
2356
- };
2357
- }, [
2358
- isSolana,
2359
- isHyperCore,
2360
- sourceChainId,
2361
- sourceTokenSymbol,
2362
- targetChain,
2363
- targetToken,
2364
- service,
2365
- topTokens
2366
- ]);
2367
2746
  const displayAddress = isSolana && solanaDepositAddress ? solanaDepositAddress : smartAccount;
2368
- useEffect6(() => {
2747
+ useEffect7(() => {
2369
2748
  if (!chainDropdownOpen && !tokenDropdownOpen) return;
2370
2749
  function handlePointerDown(event) {
2371
2750
  const target = event.target;
@@ -2430,7 +2809,7 @@ function DepositAddressStep({
2430
2809
  targetChainRef.current = targetChain;
2431
2810
  const targetTokenRef = useRef5(targetToken);
2432
2811
  targetTokenRef.current = targetToken;
2433
- useEffect6(() => {
2812
+ useEffect7(() => {
2434
2813
  baselineTxHashRef.current = void 0;
2435
2814
  isTrackingRef.current = false;
2436
2815
  let timeoutId;
@@ -2546,20 +2925,26 @@ function DepositAddressStep({
2546
2925
  setNotifications((prev) => prev.filter((n) => n.id !== id));
2547
2926
  }, []);
2548
2927
  const qrIconSrc = catalogFor(sourceChainId)?.iconUrl ?? getChainIcon(sourceChainId);
2928
+ const reviewAsset = selectionAsAsset(
2929
+ sourceChainId,
2930
+ sourceTokenSymbol,
2931
+ topTokens,
2932
+ catalogFor(sourceChainId)
2933
+ );
2549
2934
  if (chainOptions.length === 0) {
2550
- if (catalogLoading) return /* @__PURE__ */ jsx12(DepositAddressSkeleton, { uiConfig });
2551
- return /* @__PURE__ */ jsx12("div", { className: "rs-screen", children: /* @__PURE__ */ jsxs10("div", { className: "rs-screen-body", children: [
2552
- /* @__PURE__ */ jsx12(BodyHeader, { icon: /* @__PURE__ */ jsx12(TransferCryptoIcon, {}), title: "Transfer crypto" }),
2553
- /* @__PURE__ */ jsx12(Callout, { variant: "error", children: "Supported chains are unavailable right now, so there is no deposit address to show. Close and try again in a moment." })
2935
+ if (catalogLoading) return /* @__PURE__ */ jsx14(DepositAddressSkeleton, { uiConfig });
2936
+ return /* @__PURE__ */ jsx14("div", { className: "rs-screen", children: /* @__PURE__ */ jsxs12("div", { className: "rs-screen-body", children: [
2937
+ /* @__PURE__ */ jsx14(BodyHeader, { icon: /* @__PURE__ */ jsx14(TransferCryptoIcon, {}), title: "Transfer crypto" }),
2938
+ /* @__PURE__ */ jsx14(Callout, { variant: "error", children: "Supported chains are unavailable right now, so there is no deposit address to show. Close and try again in a moment." })
2554
2939
  ] }) });
2555
2940
  }
2556
- return /* @__PURE__ */ jsxs10("div", { className: "rs-screen rs-step--with-notifications", children: [
2557
- /* @__PURE__ */ jsxs10("div", { className: "rs-screen-body", children: [
2558
- /* @__PURE__ */ jsx12(BodyHeader, { icon: /* @__PURE__ */ jsx12(TransferCryptoIcon, {}), title: "Transfer crypto" }),
2559
- /* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-selectors", children: [
2560
- /* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown", ref: chainDropdownRef, children: [
2561
- /* @__PURE__ */ jsx12("div", { className: "rs-deposit-address-dropdown-label", children: "Supported chain" }),
2562
- /* @__PURE__ */ jsxs10(
2941
+ return /* @__PURE__ */ jsxs12("div", { className: "rs-screen rs-step--with-notifications", children: [
2942
+ /* @__PURE__ */ jsxs12("div", { className: "rs-screen-body", children: [
2943
+ /* @__PURE__ */ jsx14(BodyHeader, { icon: /* @__PURE__ */ jsx14(TransferCryptoIcon, {}), title: "Transfer crypto" }),
2944
+ /* @__PURE__ */ jsxs12("div", { className: "rs-deposit-address-selectors", children: [
2945
+ /* @__PURE__ */ jsxs12("div", { className: "rs-deposit-address-dropdown", ref: chainDropdownRef, children: [
2946
+ /* @__PURE__ */ jsx14("div", { className: "rs-deposit-address-dropdown-label", children: "Supported chain" }),
2947
+ /* @__PURE__ */ jsxs12(
2563
2948
  "button",
2564
2949
  {
2565
2950
  type: "button",
@@ -2570,45 +2955,45 @@ function DepositAddressStep({
2570
2955
  setTokenDropdownOpen(false);
2571
2956
  },
2572
2957
  children: [
2573
- /* @__PURE__ */ jsx12(
2958
+ /* @__PURE__ */ jsx14(
2574
2959
  CdnIcon,
2575
2960
  {
2576
2961
  src: catalogFor(sourceChainId)?.iconUrl ?? getChainIcon(sourceChainId),
2577
2962
  className: "rs-deposit-address-dropdown-icon"
2578
2963
  }
2579
2964
  ),
2580
- /* @__PURE__ */ jsx12("span", { children: chainLabel(sourceChainId, catalogFor(sourceChainId)) }),
2581
- /* @__PURE__ */ jsx12(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
2965
+ /* @__PURE__ */ jsx14("span", { children: chainLabel(sourceChainId, catalogFor(sourceChainId)) }),
2966
+ /* @__PURE__ */ jsx14(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
2582
2967
  ]
2583
2968
  }
2584
2969
  ),
2585
- chainDropdownOpen && /* @__PURE__ */ jsx12("div", { className: "rs-deposit-address-dropdown-menu", children: chainOptions.map((chainId) => /* @__PURE__ */ jsxs10(
2970
+ chainDropdownOpen && /* @__PURE__ */ jsx14("div", { className: "rs-deposit-address-dropdown-menu", children: chainOptions.map((chainId) => /* @__PURE__ */ jsxs12(
2586
2971
  "button",
2587
2972
  {
2588
2973
  type: "button",
2589
2974
  className: `rs-deposit-address-dropdown-item ${chainId === sourceChainId ? "rs-deposit-address-dropdown-item--active" : ""}`,
2590
2975
  onClick: () => handleSelectChain(chainId),
2591
2976
  children: [
2592
- /* @__PURE__ */ jsx12(
2977
+ /* @__PURE__ */ jsx14(
2593
2978
  CdnIcon,
2594
2979
  {
2595
2980
  src: catalogFor(chainId)?.iconUrl ?? getChainIcon(chainId),
2596
2981
  className: "rs-deposit-address-dropdown-icon"
2597
2982
  }
2598
2983
  ),
2599
- /* @__PURE__ */ jsx12("span", { children: chainLabel(chainId, catalogFor(chainId)) })
2984
+ /* @__PURE__ */ jsx14("span", { children: chainLabel(chainId, catalogFor(chainId)) })
2600
2985
  ]
2601
2986
  },
2602
2987
  String(chainId)
2603
2988
  )) })
2604
2989
  ] }),
2605
- /* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown", ref: tokenDropdownRef, children: [
2606
- /* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-dropdown-label rs-deposit-address-dropdown-label--with-min", children: [
2607
- /* @__PURE__ */ jsx12("span", { children: "Supported token" }),
2608
- /* @__PURE__ */ jsxs10("span", { className: "rs-deposit-address-min", children: [
2990
+ /* @__PURE__ */ jsxs12("div", { className: "rs-deposit-address-dropdown", ref: tokenDropdownRef, children: [
2991
+ /* @__PURE__ */ jsxs12("div", { className: "rs-deposit-address-dropdown-label rs-deposit-address-dropdown-label--with-min", children: [
2992
+ /* @__PURE__ */ jsx14("span", { children: "Supported token" }),
2993
+ /* @__PURE__ */ jsxs12("span", { className: "rs-deposit-address-min", children: [
2609
2994
  "Min.$",
2610
2995
  (isHyperCoreDestination(targetChain) || isHyperCore ? Math.max(HYPERCORE_MIN_DEPOSIT_USD, uiConfig?.minDepositUsd ?? 0) : uiConfig?.minDepositUsd ?? 0.1).toFixed(2),
2611
- /* @__PURE__ */ jsx12(Tooltip, { content: "Minimum deposit amount required for the selected chain.", children: /* @__PURE__ */ jsx12(
2996
+ /* @__PURE__ */ jsx14(Tooltip, { content: "Minimum deposit amount required for the selected chain.", children: /* @__PURE__ */ jsx14(
2612
2997
  InfoIcon,
2613
2998
  {
2614
2999
  className: "rs-deposit-address-min-icon",
@@ -2617,7 +3002,7 @@ function DepositAddressStep({
2617
3002
  ) })
2618
3003
  ] })
2619
3004
  ] }),
2620
- /* @__PURE__ */ jsxs10(
3005
+ /* @__PURE__ */ jsxs12(
2621
3006
  "button",
2622
3007
  {
2623
3008
  type: "button",
@@ -2628,13 +3013,13 @@ function DepositAddressStep({
2628
3013
  setChainDropdownOpen(false);
2629
3014
  },
2630
3015
  children: [
2631
- /* @__PURE__ */ jsx12(TokenGlyph, { symbol: sourceTokenSymbol }),
2632
- /* @__PURE__ */ jsx12("span", { children: sourceTokenSymbol }),
2633
- /* @__PURE__ */ jsx12(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
3016
+ /* @__PURE__ */ jsx14(TokenGlyph, { symbol: sourceTokenSymbol }),
3017
+ /* @__PURE__ */ jsx14("span", { children: sourceTokenSymbol }),
3018
+ /* @__PURE__ */ jsx14(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
2634
3019
  ]
2635
3020
  }
2636
3021
  ),
2637
- tokenDropdownOpen && /* @__PURE__ */ jsx12("div", { className: "rs-deposit-address-dropdown-menu", children: tokensForChain.map((symbol) => /* @__PURE__ */ jsxs10(
3022
+ tokenDropdownOpen && /* @__PURE__ */ jsx14("div", { className: "rs-deposit-address-dropdown-menu", children: tokensForChain.map((symbol) => /* @__PURE__ */ jsxs12(
2638
3023
  "button",
2639
3024
  {
2640
3025
  type: "button",
@@ -2644,120 +3029,58 @@ function DepositAddressStep({
2644
3029
  setTokenDropdownOpen(false);
2645
3030
  },
2646
3031
  children: [
2647
- /* @__PURE__ */ jsx12(TokenGlyph, { symbol }),
2648
- /* @__PURE__ */ jsx12("span", { children: symbol })
3032
+ /* @__PURE__ */ jsx14(TokenGlyph, { symbol }),
3033
+ /* @__PURE__ */ jsx14("span", { children: symbol })
2649
3034
  ]
2650
3035
  },
2651
3036
  symbol
2652
3037
  )) })
2653
3038
  ] })
2654
3039
  ] }),
2655
- /* @__PURE__ */ jsxs10(
3040
+ /* @__PURE__ */ jsxs12(
2656
3041
  "div",
2657
3042
  {
2658
3043
  style: { display: "flex", flexDirection: "column", gap: 4, width: "100%" },
2659
3044
  children: [
2660
- /* @__PURE__ */ jsxs10("div", { className: "rs-deposit-address-well", children: [
2661
- /* @__PURE__ */ jsx12("div", { className: "rs-deposit-address-qr", children: /* @__PURE__ */ jsx12(
3045
+ /* @__PURE__ */ jsxs12("div", { className: "rs-deposit-address-well", children: [
3046
+ /* @__PURE__ */ jsx14("div", { className: "rs-deposit-address-qr", children: /* @__PURE__ */ jsx14(
2662
3047
  Suspense,
2663
3048
  {
2664
- fallback: /* @__PURE__ */ jsx12("div", { className: "rs-skeleton rs-skeleton-qr", "aria-hidden": "true" }),
2665
- children: /* @__PURE__ */ jsx12(QRCode, { value: displayAddress, size: 190, iconSrc: qrIconSrc })
3049
+ fallback: /* @__PURE__ */ jsx14("div", { className: "rs-skeleton rs-skeleton-qr", "aria-hidden": "true" }),
3050
+ children: /* @__PURE__ */ jsx14(QRCode, { value: displayAddress, size: 190, iconSrc: qrIconSrc })
2666
3051
  }
2667
3052
  ) }),
2668
- /* @__PURE__ */ jsx12("div", { className: "rs-deposit-address-value", children: displayAddress })
3053
+ /* @__PURE__ */ jsx14("div", { className: "rs-deposit-address-value", children: displayAddress })
2669
3054
  ] }),
2670
- /* @__PURE__ */ jsxs10(
2671
- "button",
2672
- {
2673
- type: "button",
2674
- className: "rs-deposit-address-copy",
2675
- onClick: handleCopy,
2676
- children: [
2677
- copied ? /* @__PURE__ */ jsx12(CheckIcon, {}) : /* @__PURE__ */ jsx12(CopyIcon, {}),
2678
- copied ? "Copied!" : "Copy address"
2679
- ]
2680
- }
2681
- )
2682
- ]
2683
- }
2684
- ),
2685
- /* @__PURE__ */ jsxs10(
2686
- "div",
2687
- {
2688
- className: `rs-price-impact ${priceImpactExpanded ? "rs-price-impact--open" : ""}`,
2689
- children: [
2690
- /* @__PURE__ */ jsxs10(
2691
- "button",
2692
- {
2693
- type: "button",
2694
- className: "rs-price-impact-header",
2695
- onClick: () => setPriceImpactExpanded((v) => !v),
2696
- "aria-expanded": priceImpactExpanded,
2697
- children: [
2698
- /* @__PURE__ */ jsxs10("span", { className: "rs-price-impact-header-left", children: [
2699
- /* @__PURE__ */ jsx12("span", { className: "rs-price-impact-label", children: "Price impact" }),
2700
- /* @__PURE__ */ jsx12("span", { className: "rs-price-impact-label", children: /* @__PURE__ */ jsx12("strong", { children: "0.00%" }) }),
2701
- /* @__PURE__ */ jsx12(
2702
- Tooltip,
2703
- {
2704
- className: "rs-price-impact-info",
2705
- content: "Price impact is the difference between expected and execution price, due to trade size and liquidity.",
2706
- children: /* @__PURE__ */ jsx12(InfoIcon, { "aria-hidden": "true" })
2707
- }
2708
- )
2709
- ] }),
2710
- /* @__PURE__ */ jsx12(
2711
- ChevronDownIcon,
2712
- {
2713
- className: "rs-price-impact-chevron",
2714
- "aria-hidden": "true"
2715
- }
2716
- )
2717
- ]
2718
- }
2719
- ),
2720
- /* @__PURE__ */ jsx12("div", { className: "rs-price-impact-panel", children: /* @__PURE__ */ jsxs10("div", { className: "rs-price-impact-panel-inner", children: [
2721
- /* @__PURE__ */ jsxs10("div", { className: "rs-price-impact-row", children: [
2722
- /* @__PURE__ */ jsx12("span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx12(PercentIcon, {}) }),
2723
- /* @__PURE__ */ jsxs10("span", { className: "rs-price-impact-label", children: [
2724
- "Max slippage: ",
2725
- /* @__PURE__ */ jsx12("strong", { children: "0.2%" })
2726
- ] }),
2727
- /* @__PURE__ */ jsx12(
2728
- Tooltip,
2729
- {
2730
- className: "rs-price-impact-info",
2731
- content: "Slippage accounts for price changes during execution. Slippage is adjusted per pair to ensure reliable execution.",
2732
- children: /* @__PURE__ */ jsx12(InfoIcon, { "aria-hidden": "true" })
2733
- }
2734
- )
2735
- ] }),
2736
- /* @__PURE__ */ jsxs10("div", { className: "rs-price-impact-row", children: [
2737
- /* @__PURE__ */ jsx12("span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx12(ClockIcon, {}) }),
2738
- /* @__PURE__ */ jsxs10("span", { className: "rs-price-impact-label", children: [
2739
- "Processing time: ",
2740
- /* @__PURE__ */ jsx12("strong", { children: "< 1 min" })
2741
- ] })
2742
- ] }),
2743
- liquidityHelper.kind !== "idle" && /* @__PURE__ */ jsxs10("div", { className: "rs-price-impact-row", children: [
2744
- /* @__PURE__ */ jsx12("span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx12(PlusCircleIcon, {}) }),
2745
- /* @__PURE__ */ jsxs10("span", { className: "rs-price-impact-label", children: [
2746
- "Max deposit:",
2747
- " ",
2748
- /* @__PURE__ */ jsx12("strong", { children: liquidityHelper.kind === "max" ? `${formatUnits3(
2749
- BigInt(liquidityHelper.maxAmount),
2750
- liquidityHelper.decimals
2751
- )} ${liquidityHelper.symbol}` : liquidityHelper.kind === "unlimited" ? "Unlimited" : liquidityHelper.kind === "unavailable" ? "Unavailable" : liquidityHelper.kind === "error" ? "\u2014" : "\u2026" })
2752
- ] })
2753
- ] })
2754
- ] }) })
3055
+ /* @__PURE__ */ jsxs12("div", { className: "rs-deposit-address-actions", children: [
3056
+ /* @__PURE__ */ jsxs12(
3057
+ "button",
3058
+ {
3059
+ type: "button",
3060
+ className: "rs-deposit-address-copy",
3061
+ onClick: handleCopy,
3062
+ children: [
3063
+ copied ? /* @__PURE__ */ jsx14(CheckIcon, {}) : /* @__PURE__ */ jsx14(CopyIcon, {}),
3064
+ copied ? "Copied!" : "Copy address"
3065
+ ]
3066
+ }
3067
+ ),
3068
+ onReviewDeposit && reviewAsset && /* @__PURE__ */ jsx14(
3069
+ "button",
3070
+ {
3071
+ type: "button",
3072
+ className: "rs-deposit-address-copy rs-deposit-address-review",
3073
+ onClick: () => onReviewDeposit(reviewAsset),
3074
+ children: "Estimate fees"
3075
+ }
3076
+ )
3077
+ ] })
2755
3078
  ]
2756
3079
  }
2757
3080
  ),
2758
- pollingError && /* @__PURE__ */ jsx12("div", { className: "rs-deposit-address-error", children: pollingError })
3081
+ pollingError && /* @__PURE__ */ jsx14("div", { className: "rs-deposit-address-error", children: pollingError })
2759
3082
  ] }),
2760
- notifications.length > 0 && /* @__PURE__ */ jsx12("div", { className: "rs-deposit-notifications", children: notifications.map((deposit) => /* @__PURE__ */ jsx12(
3083
+ notifications.length > 0 && /* @__PURE__ */ jsx14("div", { className: "rs-deposit-notifications", children: notifications.map((deposit) => /* @__PURE__ */ jsx14(
2761
3084
  DepositNotification,
2762
3085
  {
2763
3086
  deposit,
@@ -2772,7 +3095,7 @@ function DepositAddressStep({
2772
3095
  },
2773
3096
  deposit.id
2774
3097
  )) }),
2775
- /* @__PURE__ */ jsx12(PoweredBy, {})
3098
+ /* @__PURE__ */ jsx14(PoweredBy, {})
2776
3099
  ] });
2777
3100
  }
2778
3101
  DepositAddressStep.displayName = "DepositAddressStep";
@@ -2786,6 +3109,15 @@ var SWAPPED_ORIGINS = [
2786
3109
  "https://sandbox.swapped.com",
2787
3110
  "https://widget.swapped.com"
2788
3111
  ];
3112
+ function isTrustedSwappedWidgetUrl(url) {
3113
+ let parsed;
3114
+ try {
3115
+ parsed = new URL(url);
3116
+ } catch {
3117
+ return false;
3118
+ }
3119
+ return SWAPPED_ORIGINS.includes(parsed.origin);
3120
+ }
2789
3121
  var WIDGET_URL_EXPIRY_BUFFER_MS = 1e4;
2790
3122
  function isSwappedWidgetUrlFresh(res, now = Date.now()) {
2791
3123
  if (!res.expiresAt) return false;
@@ -2794,15 +3126,15 @@ function isSwappedWidgetUrlFresh(res, now = Date.now()) {
2794
3126
  return expiry - now > WIDGET_URL_EXPIRY_BUFFER_MS;
2795
3127
  }
2796
3128
 
2797
- // src/components/steps/SwappedIframeStep.tsx
2798
- import { useState as useState7, useEffect as useEffect7, useRef as useRef6, useMemo as useMemo4 } from "react";
3129
+ // src/components/steps/SwappedProviderStep.tsx
3130
+ import { useState as useState8, useEffect as useEffect8, useRef as useRef6, useMemo as useMemo4 } from "react";
2799
3131
 
2800
3132
  // src/components/steps/FinalisingDepositStep.tsx
2801
- import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
3133
+ import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
2802
3134
  function FinalisingDepositStep() {
2803
- return /* @__PURE__ */ jsxs11("div", { className: "rs-screen rs-finalising", children: [
2804
- /* @__PURE__ */ jsxs11("div", { className: "rs-screen-body rs-finalising-body", children: [
2805
- /* @__PURE__ */ jsxs11(
3135
+ return /* @__PURE__ */ jsxs13("div", { className: "rs-screen rs-finalising", children: [
3136
+ /* @__PURE__ */ jsxs13("div", { className: "rs-screen-body rs-finalising-body", children: [
3137
+ /* @__PURE__ */ jsxs13(
2806
3138
  "svg",
2807
3139
  {
2808
3140
  className: "rs-finalising-spinner",
@@ -2810,23 +3142,23 @@ function FinalisingDepositStep() {
2810
3142
  fill: "none",
2811
3143
  "aria-hidden": "true",
2812
3144
  children: [
2813
- /* @__PURE__ */ jsx13("circle", { className: "rs-finalising-spinner-track", cx: "40", cy: "40", r: "34" }),
2814
- /* @__PURE__ */ jsx13("circle", { className: "rs-finalising-spinner-head", cx: "40", cy: "40", r: "34" })
3145
+ /* @__PURE__ */ jsx15("circle", { className: "rs-finalising-spinner-track", cx: "40", cy: "40", r: "34" }),
3146
+ /* @__PURE__ */ jsx15("circle", { className: "rs-finalising-spinner-head", cx: "40", cy: "40", r: "34" })
2815
3147
  ]
2816
3148
  }
2817
3149
  ),
2818
- /* @__PURE__ */ jsxs11("div", { className: "rs-finalising-text", children: [
2819
- /* @__PURE__ */ jsx13("h2", { className: "rs-finalising-title", children: "Finalising deposit" }),
2820
- /* @__PURE__ */ jsx13("p", { className: "rs-finalising-subtitle", children: "We are depositing your funds to the application." })
3150
+ /* @__PURE__ */ jsxs13("div", { className: "rs-finalising-text", children: [
3151
+ /* @__PURE__ */ jsx15("h2", { className: "rs-finalising-title", children: "Finalising deposit" }),
3152
+ /* @__PURE__ */ jsx15("p", { className: "rs-finalising-subtitle", children: "We are depositing your funds to the application." })
2821
3153
  ] })
2822
3154
  ] }),
2823
- /* @__PURE__ */ jsx13(PoweredBy, {})
3155
+ /* @__PURE__ */ jsx15(PoweredBy, {})
2824
3156
  ] });
2825
3157
  }
2826
3158
  FinalisingDepositStep.displayName = "FinalisingDepositStep";
2827
3159
 
2828
3160
  // src/components/steps/SwappedOrderTracker.tsx
2829
- import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
3161
+ import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
2830
3162
  var STEP_LABELS = [
2831
3163
  "Payment received",
2832
3164
  null,
@@ -2848,29 +3180,29 @@ function SwappedOrderTracker({
2848
3180
  STEP_LABELS[2],
2849
3181
  STEP_LABELS[3]
2850
3182
  ];
2851
- return /* @__PURE__ */ jsxs12("div", { className: "rs-screen rs-swapped-tracker", children: [
2852
- /* @__PURE__ */ jsxs12("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
2853
- /* @__PURE__ */ jsx14(BodyHeader, { icon: /* @__PURE__ */ jsx14(HandCoinsIcon, {}), title }),
2854
- /* @__PURE__ */ jsx14("ol", { className: "rs-swapped-tracker-steps", children: labels.map((label, idx) => {
3183
+ return /* @__PURE__ */ jsxs14("div", { className: "rs-screen rs-swapped-tracker", children: [
3184
+ /* @__PURE__ */ jsxs14("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
3185
+ /* @__PURE__ */ jsx16(BodyHeader, { icon: /* @__PURE__ */ jsx16(HandCoinsIcon, {}), title }),
3186
+ /* @__PURE__ */ jsx16("ol", { className: "rs-swapped-tracker-steps", children: labels.map((label, idx) => {
2855
3187
  const status = stepStates[idx];
2856
- return /* @__PURE__ */ jsxs12(
3188
+ return /* @__PURE__ */ jsxs14(
2857
3189
  "li",
2858
3190
  {
2859
3191
  className: `rs-swapped-tracker-step rs-swapped-tracker-step--${status}`,
2860
3192
  children: [
2861
- /* @__PURE__ */ jsx14("span", { className: "rs-swapped-tracker-step-label", children: label }),
2862
- /* @__PURE__ */ jsx14(
3193
+ /* @__PURE__ */ jsx16("span", { className: "rs-swapped-tracker-step-label", children: label }),
3194
+ /* @__PURE__ */ jsx16(
2863
3195
  "span",
2864
3196
  {
2865
3197
  className: "rs-swapped-tracker-step-marker",
2866
3198
  "aria-hidden": "true",
2867
- children: status === "complete" ? /* @__PURE__ */ jsx14(CheckIcon, {}) : status === "failed" ? /* @__PURE__ */ jsx14(CloseIcon, {}) : status === "active" ? /* @__PURE__ */ jsx14(Spinner, {}) : /* @__PURE__ */ jsx14(
3199
+ children: status === "complete" ? /* @__PURE__ */ jsx16(CheckIcon, {}) : status === "failed" ? /* @__PURE__ */ jsx16(CloseIcon, {}) : status === "active" ? /* @__PURE__ */ jsx16(Spinner, {}) : /* @__PURE__ */ jsx16(
2868
3200
  "svg",
2869
3201
  {
2870
3202
  className: "rs-swapped-tracker-step-ring",
2871
3203
  viewBox: "0 0 16 16",
2872
3204
  "aria-hidden": "true",
2873
- children: /* @__PURE__ */ jsx14("circle", { cx: "8", cy: "8", r: "7" })
3205
+ children: /* @__PURE__ */ jsx16("circle", { cx: "8", cy: "8", r: "7" })
2874
3206
  }
2875
3207
  )
2876
3208
  }
@@ -2880,13 +3212,13 @@ function SwappedOrderTracker({
2880
3212
  label
2881
3213
  );
2882
3214
  }) }),
2883
- terminal && /* @__PURE__ */ jsxs12(
3215
+ terminal && /* @__PURE__ */ jsxs14(
2884
3216
  "div",
2885
3217
  {
2886
3218
  className: `rs-swapped-tracker-terminal rs-swapped-tracker-terminal--${terminal.kind}`,
2887
3219
  children: [
2888
- /* @__PURE__ */ jsx14("p", { className: "rs-swapped-tracker-terminal-message", children: terminal.message }),
2889
- terminal.kind === "cancelled" && onRetry && /* @__PURE__ */ jsx14(
3220
+ /* @__PURE__ */ jsx16("p", { className: "rs-swapped-tracker-terminal-message", children: terminal.message }),
3221
+ terminal.kind === "cancelled" && onRetry && /* @__PURE__ */ jsx16(
2890
3222
  "button",
2891
3223
  {
2892
3224
  type: "button",
@@ -2899,7 +3231,7 @@ function SwappedOrderTracker({
2899
3231
  }
2900
3232
  )
2901
3233
  ] }),
2902
- /* @__PURE__ */ jsx14(PoweredBy, {})
3234
+ /* @__PURE__ */ jsx16(PoweredBy, {})
2903
3235
  ] });
2904
3236
  }
2905
3237
  function formatTrackerAmount(amount) {
@@ -2910,8 +3242,8 @@ function formatTrackerAmount(amount) {
2910
3242
  }
2911
3243
  SwappedOrderTracker.displayName = "SwappedOrderTracker";
2912
3244
 
2913
- // src/components/steps/SwappedIframeStep.tsx
2914
- import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
3245
+ // src/components/steps/SwappedProviderStep.tsx
3246
+ import { Fragment as Fragment4, jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
2915
3247
  var STATUS_POLL_INTERVAL_MS = 2e3;
2916
3248
  var DEPOSIT_POLL_INTERVAL_MS = 2e3;
2917
3249
  var DEPOSIT_POLL_FAST_INITIAL_DELAY_MS = 1e3;
@@ -2930,6 +3262,16 @@ var SWAPPED_STATUS_VALUES = /* @__PURE__ */ new Set([
2930
3262
  "order_cancelled"
2931
3263
  ]);
2932
3264
  var SWAPPED_GO_BACK_KEY = "SWAPPED_GO_BACK";
3265
+ var OPEN_FAILED_MESSAGE = "We could not open your browser.";
3266
+ var OPEN_FAILED_CODE = "SWAPPED_BROWSER_UNAVAILABLE";
3267
+ function hostnameOf(url) {
3268
+ if (!url) return "the payment provider";
3269
+ try {
3270
+ return new URL(url).hostname;
3271
+ } catch {
3272
+ return "the payment provider";
3273
+ }
3274
+ }
2933
3275
  function parseMaybeJsonString(raw) {
2934
3276
  try {
2935
3277
  return JSON.parse(raw);
@@ -2973,7 +3315,7 @@ function parseSwappedIframeMessage(raw) {
2973
3315
  transactionId: asString2(inner.transaction_id) ?? asString2(obj.transactionId)
2974
3316
  };
2975
3317
  }
2976
- function SwappedIframeStep({
3318
+ function SwappedProviderStep({
2977
3319
  smartAccount,
2978
3320
  service,
2979
3321
  variant,
@@ -2987,17 +3329,21 @@ function SwappedIframeStep({
2987
3329
  onClose,
2988
3330
  onGoBack,
2989
3331
  onError,
2990
- onImmersiveChange
3332
+ onImmersiveChange,
3333
+ openExternally
2991
3334
  }) {
2992
- const [widgetUrl, setWidgetUrl] = useState7(null);
2993
- const [iframeSrc, setIframeSrc] = useState7(null);
2994
- const [loadError, setLoadError] = useState7(null);
2995
- const [iframeLoaded, setIframeLoaded] = useState7(false);
2996
- const [retryToken, setRetryToken] = useState7(0);
2997
- const [orderState, setOrderState] = useState7(null);
2998
- const [latestEvent, setLatestEvent] = useState7(null);
2999
- const [phase, setPhase] = useState7("iframe");
3335
+ const [widgetUrl, setWidgetUrl] = useState8(null);
3336
+ const [iframeSrc, setIframeSrc] = useState8(null);
3337
+ const [loadError, setLoadError] = useState8(null);
3338
+ const [iframeLoaded, setIframeLoaded] = useState8(false);
3339
+ const [retryToken, setRetryToken] = useState8(0);
3340
+ const [orderState, setOrderState] = useState8(null);
3341
+ const [latestEvent, setLatestEvent] = useState8(null);
3342
+ const [phase, setPhase] = useState8("provider");
3343
+ const [handoffOpened, setHandoffOpened] = useState8(false);
3344
+ const [opening, setOpening] = useState8(false);
3000
3345
  const iframeRef = useRef6(null);
3346
+ const openedUrlRef = useRef6(null);
3001
3347
  const completeFiredRef = useRef6(false);
3002
3348
  const failedFiredRef = useRef6(false);
3003
3349
  const completeTimeoutRef = useRef6(null);
@@ -3009,6 +3355,9 @@ function SwappedIframeStep({
3009
3355
  const rescheduleDepositPollRef = useRef6(
3010
3356
  null
3011
3357
  );
3358
+ const rescheduleStatusPollRef = useRef6(
3359
+ null
3360
+ );
3012
3361
  const onSwappedCompleteRef = useRef6(onSwappedComplete);
3013
3362
  onSwappedCompleteRef.current = onSwappedComplete;
3014
3363
  const onSwappedFailedRef = useRef6(onSwappedFailed);
@@ -3021,7 +3370,7 @@ function SwappedIframeStep({
3021
3370
  onImmersiveChangeRef.current = onImmersiveChange;
3022
3371
  const loadUrlRef = useRef6(loadUrl);
3023
3372
  loadUrlRef.current = loadUrl;
3024
- useEffect7(() => {
3373
+ useEffect8(() => {
3025
3374
  let cancelled = false;
3026
3375
  setLoadError(null);
3027
3376
  setIframeLoaded(false);
@@ -3029,7 +3378,10 @@ function SwappedIframeStep({
3029
3378
  setIframeSrc(null);
3030
3379
  setOrderState(null);
3031
3380
  setLatestEvent(null);
3032
- setPhase("iframe");
3381
+ setPhase("provider");
3382
+ setHandoffOpened(false);
3383
+ setOpening(false);
3384
+ openedUrlRef.current = null;
3033
3385
  if (completeTimeoutRef.current !== null) {
3034
3386
  clearTimeout(completeTimeoutRef.current);
3035
3387
  completeTimeoutRef.current = null;
@@ -3043,6 +3395,11 @@ function SwappedIframeStep({
3043
3395
  fastDepositPollEnabledRef.current = false;
3044
3396
  loadUrlRef.current().then((res) => {
3045
3397
  if (cancelled) return;
3398
+ if (!isTrustedSwappedWidgetUrl(res.url)) {
3399
+ setLoadError(loadErrorFallback);
3400
+ onErrorRef.current?.(loadErrorFallback, loadErrorCode);
3401
+ return;
3402
+ }
3046
3403
  setWidgetUrl(res.url);
3047
3404
  expectedExternalCustomerIdRef.current = res.externalCustomerId;
3048
3405
  const sep = res.externalCustomerId.indexOf(":");
@@ -3061,17 +3418,41 @@ function SwappedIframeStep({
3061
3418
  }
3062
3419
  };
3063
3420
  }, [service, smartAccount, retryToken, loadErrorCode, loadErrorFallback]);
3064
- useEffect7(() => {
3065
- if (!widgetUrl || iframeLoaded || loadError) return;
3421
+ useEffect8(() => {
3422
+ if (openExternally || !widgetUrl || iframeLoaded || loadError) return;
3066
3423
  const timer = setTimeout(() => {
3067
3424
  setLoadError("Iframe took too long to load.");
3068
3425
  }, IFRAME_LOAD_TIMEOUT_MS);
3069
3426
  return () => clearTimeout(timer);
3070
- }, [widgetUrl, iframeLoaded, loadError]);
3071
- useEffect7(() => {
3427
+ }, [openExternally, widgetUrl, iframeLoaded, loadError]);
3428
+ useEffect8(() => {
3429
+ if (openExternally) return;
3072
3430
  setIframeSrc(widgetUrl && !loadError ? widgetUrl : null);
3073
- }, [widgetUrl, loadError, retryToken]);
3074
- useEffect7(() => {
3431
+ }, [openExternally, widgetUrl, loadError, retryToken]);
3432
+ const openPaymentPage = async (url) => {
3433
+ if (!openExternally) return;
3434
+ openedUrlRef.current = url;
3435
+ setOpening(true);
3436
+ try {
3437
+ await openExternally(url);
3438
+ setHandoffOpened(true);
3439
+ } catch (error) {
3440
+ openedUrlRef.current = null;
3441
+ setLoadError(OPEN_FAILED_MESSAGE);
3442
+ onErrorRef.current?.(
3443
+ error instanceof Error && error.message ? error.message : OPEN_FAILED_MESSAGE,
3444
+ OPEN_FAILED_CODE
3445
+ );
3446
+ } finally {
3447
+ setOpening(false);
3448
+ }
3449
+ };
3450
+ useEffect8(() => {
3451
+ if (!openExternally || !widgetUrl || loadError) return;
3452
+ if (openedUrlRef.current === widgetUrl) return;
3453
+ void openPaymentPage(widgetUrl);
3454
+ }, [openExternally, widgetUrl, loadError]);
3455
+ useEffect8(() => {
3075
3456
  let cancelled = false;
3076
3457
  let timeoutId;
3077
3458
  async function poll() {
@@ -3089,13 +3470,30 @@ function SwappedIframeStep({
3089
3470
  timeoutId = setTimeout(poll, STATUS_POLL_INTERVAL_MS);
3090
3471
  }
3091
3472
  }
3473
+ rescheduleStatusPollRef.current = (delayMs) => {
3474
+ if (cancelled) return;
3475
+ clearTimeout(timeoutId);
3476
+ timeoutId = setTimeout(poll, delayMs);
3477
+ };
3092
3478
  poll();
3093
3479
  return () => {
3094
3480
  cancelled = true;
3095
3481
  clearTimeout(timeoutId);
3482
+ rescheduleStatusPollRef.current = null;
3096
3483
  };
3097
3484
  }, [service, smartAccount]);
3098
- useEffect7(() => {
3485
+ useEffect8(() => {
3486
+ if (!openExternally) return;
3487
+ const doc = globalThis.document;
3488
+ const onVisible = () => {
3489
+ if (doc.visibilityState !== "visible") return;
3490
+ rescheduleStatusPollRef.current?.(0);
3491
+ rescheduleDepositPollRef.current?.(0);
3492
+ };
3493
+ doc.addEventListener("visibilitychange", onVisible);
3494
+ return () => doc.removeEventListener("visibilitychange", onVisible);
3495
+ }, [openExternally]);
3496
+ useEffect8(() => {
3099
3497
  let cancelled = false;
3100
3498
  let timeoutId;
3101
3499
  async function pollDeposit() {
@@ -3130,14 +3528,15 @@ function SwappedIframeStep({
3130
3528
  rescheduleDepositPollRef.current = null;
3131
3529
  };
3132
3530
  }, [service, smartAccount]);
3133
- useEffect7(() => {
3531
+ useEffect8(() => {
3134
3532
  if (fastDepositPollEnabledRef.current) return;
3135
3533
  const status = orderState?.status;
3136
3534
  if (!status || !SWAPPED_TERMINAL_STATUSES.has(status)) return;
3137
3535
  fastDepositPollEnabledRef.current = true;
3138
3536
  rescheduleDepositPollRef.current?.(DEPOSIT_POLL_FAST_INITIAL_DELAY_MS);
3139
3537
  }, [orderState]);
3140
- useEffect7(() => {
3538
+ useEffect8(() => {
3539
+ if (openExternally) return;
3141
3540
  function onMessage(e) {
3142
3541
  if (!SWAPPED_IFRAME_ORIGINS.has(e.origin)) return;
3143
3542
  if (e.source !== iframeRef.current?.contentWindow) return;
@@ -3169,10 +3568,10 @@ function SwappedIframeStep({
3169
3568
  }
3170
3569
  window.addEventListener("message", onMessage);
3171
3570
  return () => window.removeEventListener("message", onMessage);
3172
- }, []);
3173
- useEffect7(() => {
3571
+ }, [openExternally]);
3572
+ useEffect8(() => {
3174
3573
  const swappedProvesLive = orderState !== null && !(variant === "fiat" && orderState.status === "payment_pending");
3175
- if (phase === "iframe" && (swappedProvesLive || latestEvent !== null)) {
3574
+ if (phase === "provider" && (swappedProvesLive || latestEvent !== null)) {
3176
3575
  setPhase("tracker");
3177
3576
  }
3178
3577
  }, [phase, orderState, latestEvent, variant]);
@@ -3193,7 +3592,7 @@ function SwappedIframeStep({
3193
3592
  }
3194
3593
  return null;
3195
3594
  }, [latestEvent, orderState, bannerForStatus]);
3196
- useEffect7(() => {
3595
+ useEffect8(() => {
3197
3596
  if (completeFiredRef.current || failedFiredRef.current) return;
3198
3597
  const t = latestEvent?.type;
3199
3598
  const isSuccess = t === "bridge-complete";
@@ -3216,7 +3615,7 @@ function SwappedIframeStep({
3216
3615
  onSwappedCompleteRef.current(info);
3217
3616
  }, SWAPPED_SUCCESS_HANDOFF_DELAY_MS);
3218
3617
  }, [latestEvent, orderState, smartAccount]);
3219
- useEffect7(() => {
3618
+ useEffect8(() => {
3220
3619
  if (failedFiredRef.current || completeFiredRef.current) return;
3221
3620
  if (!isFailedEvent(latestEvent ?? void 0)) return;
3222
3621
  const txHash = currentDepositTxHashRef.current;
@@ -3228,24 +3627,27 @@ function SwappedIframeStep({
3228
3627
  failureMessageForEvent(latestEvent ?? void 0)
3229
3628
  );
3230
3629
  }, [latestEvent]);
3231
- const immersive = variant === "fiat" && phase === "iframe" && !loadError;
3232
- useEffect7(() => {
3630
+ const immersive = !openExternally && variant === "fiat" && phase === "provider" && !loadError;
3631
+ useEffect8(() => {
3233
3632
  onImmersiveChangeRef.current?.(immersive);
3234
3633
  }, [immersive]);
3235
- useEffect7(() => () => onImmersiveChangeRef.current?.(false), []);
3634
+ useEffect8(() => () => onImmersiveChangeRef.current?.(false), []);
3236
3635
  const handleRetry = () => {
3237
3636
  setIframeSrc(null);
3238
3637
  setWidgetUrl(null);
3239
3638
  setIframeLoaded(false);
3240
3639
  setLoadError(null);
3640
+ openedUrlRef.current = null;
3641
+ setHandoffOpened(false);
3241
3642
  setRetryToken((n) => n + 1);
3242
3643
  };
3644
+ const providerDomain = hostnameOf(widgetUrl);
3243
3645
  if (phase === "tracker") {
3244
3646
  const paymentReceived = stepStates[0] === "complete";
3245
3647
  if (variant === "connect" && !terminalState && paymentReceived) {
3246
- return /* @__PURE__ */ jsx15(FinalisingDepositStep, {});
3648
+ return /* @__PURE__ */ jsx17(FinalisingDepositStep, {});
3247
3649
  }
3248
- return /* @__PURE__ */ jsx15(
3650
+ return /* @__PURE__ */ jsx17(
3249
3651
  SwappedOrderTracker,
3250
3652
  {
3251
3653
  amount: orderState?.orderCryptoAmount ?? null,
@@ -3257,11 +3659,52 @@ function SwappedIframeStep({
3257
3659
  }
3258
3660
  );
3259
3661
  }
3260
- return /* @__PURE__ */ jsxs13("div", { className: "rs-screen rs-fiat-onramp", "data-variant": variant, children: [
3261
- /* @__PURE__ */ jsx15("div", { className: "rs-screen-body rs-fiat-onramp-body", children: /* @__PURE__ */ jsxs13("div", { className: "rs-fiat-onramp-iframe-wrap", children: [
3262
- loadError && /* @__PURE__ */ jsxs13("div", { className: "rs-fiat-onramp-error", children: [
3263
- /* @__PURE__ */ jsx15("div", { children: loadError }),
3264
- /* @__PURE__ */ jsx15(
3662
+ if (openExternally) {
3663
+ return /* @__PURE__ */ jsxs15("div", { className: "rs-screen rs-swapped-handoff", "data-variant": variant, children: [
3664
+ /* @__PURE__ */ jsx17("div", { className: "rs-screen-body rs-swapped-handoff-body", children: loadError ? /* @__PURE__ */ jsxs15(Fragment4, { children: [
3665
+ /* @__PURE__ */ jsx17("p", { className: "rs-swapped-handoff-title", children: loadError }),
3666
+ /* @__PURE__ */ jsx17(
3667
+ "button",
3668
+ {
3669
+ type: "button",
3670
+ className: "rs-fiat-onramp-retry",
3671
+ onClick: handleRetry,
3672
+ children: "Retry"
3673
+ }
3674
+ )
3675
+ ] }) : /* @__PURE__ */ jsxs15(Fragment4, { children: [
3676
+ /* @__PURE__ */ jsx17(Spinner, {}),
3677
+ /* @__PURE__ */ jsxs15("div", { className: "rs-swapped-handoff-text", children: [
3678
+ /* @__PURE__ */ jsx17("h2", { className: "rs-swapped-handoff-title", children: handoffOpened ? variant === "fiat" ? "Finish paying in your browser" : "Approve the transfer in your browser" : "Opening your browser\u2026" }),
3679
+ /* @__PURE__ */ jsx17("p", { className: "rs-swapped-handoff-subtitle", children: handoffOpened ? (
3680
+ // The domain is the point of the hand-off, not decoration:
3681
+ // the payment page is worth more when the user can see
3682
+ // whose it is. Safe to render — the URL cleared the
3683
+ // provider allow-list before it was handed over.
3684
+ `We opened ${providerDomain} outside the app. Come back here when you are done \u2014 this screen keeps up on its own.`
3685
+ ) : "This payment opens outside the app, where your card details go straight to the provider." })
3686
+ ] }),
3687
+ handoffOpened && /* @__PURE__ */ jsx17(
3688
+ "button",
3689
+ {
3690
+ type: "button",
3691
+ className: "rs-swapped-handoff-reopen",
3692
+ disabled: opening || !widgetUrl,
3693
+ onClick: () => {
3694
+ if (widgetUrl) void openPaymentPage(widgetUrl);
3695
+ },
3696
+ children: "Open the payment page again"
3697
+ }
3698
+ )
3699
+ ] }) }),
3700
+ /* @__PURE__ */ jsx17(PoweredBy, {})
3701
+ ] });
3702
+ }
3703
+ return /* @__PURE__ */ jsxs15("div", { className: "rs-screen rs-fiat-onramp", "data-variant": variant, children: [
3704
+ /* @__PURE__ */ jsx17("div", { className: "rs-screen-body rs-fiat-onramp-body", children: /* @__PURE__ */ jsxs15("div", { className: "rs-fiat-onramp-iframe-wrap", children: [
3705
+ loadError && /* @__PURE__ */ jsxs15("div", { className: "rs-fiat-onramp-error", children: [
3706
+ /* @__PURE__ */ jsx17("div", { children: loadError }),
3707
+ /* @__PURE__ */ jsx17(
3265
3708
  "button",
3266
3709
  {
3267
3710
  type: "button",
@@ -3271,15 +3714,15 @@ function SwappedIframeStep({
3271
3714
  }
3272
3715
  )
3273
3716
  ] }),
3274
- !loadError && !iframeLoaded && /* @__PURE__ */ jsx15("div", { className: "rs-fiat-onramp-loading", children: /* @__PURE__ */ jsx15(Spinner, {}) }),
3275
- widgetUrl && !loadError && /* @__PURE__ */ jsx15(
3717
+ !loadError && !iframeLoaded && /* @__PURE__ */ jsx17("div", { className: "rs-fiat-onramp-loading", children: /* @__PURE__ */ jsx17(Spinner, {}) }),
3718
+ widgetUrl && !loadError && /* @__PURE__ */ jsx17(
3276
3719
  "iframe",
3277
3720
  {
3278
3721
  ref: iframeRef,
3279
3722
  src: iframeSrc ?? void 0,
3280
3723
  title: iframeTitle,
3281
3724
  className: "rs-fiat-onramp-iframe",
3282
- sandbox: "allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation",
3725
+ sandbox: "allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox",
3283
3726
  allow: "payment; camera; microphone; clipboard-write; geolocation",
3284
3727
  onLoad: () => {
3285
3728
  try {
@@ -3294,7 +3737,7 @@ function SwappedIframeStep({
3294
3737
  retryToken
3295
3738
  )
3296
3739
  ] }) }),
3297
- loadError && /* @__PURE__ */ jsx15(PoweredBy, {})
3740
+ loadError && /* @__PURE__ */ jsx17(PoweredBy, {})
3298
3741
  ] });
3299
3742
  }
3300
3743
  function deriveStepStates(swappedStatus, latestEvent) {
@@ -3318,10 +3761,10 @@ function deriveStepStates(swappedStatus, latestEvent) {
3318
3761
  }
3319
3762
  return ["active", "pending", "pending", "pending"];
3320
3763
  }
3321
- SwappedIframeStep.displayName = "SwappedIframeStep";
3764
+ SwappedProviderStep.displayName = "SwappedProviderStep";
3322
3765
 
3323
3766
  // src/components/steps/FiatOnrampStep.tsx
3324
- import { jsx as jsx16 } from "react/jsx-runtime";
3767
+ import { jsx as jsx18 } from "react/jsx-runtime";
3325
3768
  function fiatBannerForStatus(status, context) {
3326
3769
  if (context.currencyMismatch) {
3327
3770
  return {
@@ -3359,7 +3802,8 @@ function FiatOnrampStep({
3359
3802
  onClose,
3360
3803
  onGoBack,
3361
3804
  onError,
3362
- onImmersiveChange
3805
+ onImmersiveChange,
3806
+ openExternally
3363
3807
  }) {
3364
3808
  const loadUrl = useCallback3(async () => {
3365
3809
  const prefetched = consumePrefetchedUrl?.(
@@ -3386,8 +3830,8 @@ function FiatOnrampStep({
3386
3830
  methodSelectionSource,
3387
3831
  consumePrefetchedUrl
3388
3832
  ]);
3389
- return /* @__PURE__ */ jsx16(
3390
- SwappedIframeStep,
3833
+ return /* @__PURE__ */ jsx18(
3834
+ SwappedProviderStep,
3391
3835
  {
3392
3836
  smartAccount,
3393
3837
  service,
@@ -3402,7 +3846,8 @@ function FiatOnrampStep({
3402
3846
  onClose,
3403
3847
  onGoBack,
3404
3848
  onError,
3405
- onImmersiveChange
3849
+ onImmersiveChange,
3850
+ openExternally
3406
3851
  }
3407
3852
  );
3408
3853
  }
@@ -3410,7 +3855,7 @@ FiatOnrampStep.displayName = "FiatOnrampStep";
3410
3855
 
3411
3856
  // src/components/steps/ExchangeConnectStep.tsx
3412
3857
  import { useCallback as useCallback4 } from "react";
3413
- import { jsx as jsx17 } from "react/jsx-runtime";
3858
+ import { jsx as jsx19 } from "react/jsx-runtime";
3414
3859
  function connectBannerForStatus(status, context) {
3415
3860
  if (context.currencyMismatch) {
3416
3861
  return {
@@ -3450,7 +3895,8 @@ function ExchangeConnectStep({
3450
3895
  onClose,
3451
3896
  onGoBack,
3452
3897
  onError,
3453
- onImmersiveChange
3898
+ onImmersiveChange,
3899
+ openExternally
3454
3900
  }) {
3455
3901
  const loadUrl = useCallback4(async () => {
3456
3902
  if (loadPreparedUrl) return loadPreparedUrl();
@@ -3460,8 +3906,8 @@ function ExchangeConnectStep({
3460
3906
  });
3461
3907
  return res;
3462
3908
  }, [loadPreparedUrl, service, smartAccount, connection]);
3463
- return /* @__PURE__ */ jsx17(
3464
- SwappedIframeStep,
3909
+ return /* @__PURE__ */ jsx19(
3910
+ SwappedProviderStep,
3465
3911
  {
3466
3912
  smartAccount,
3467
3913
  service,
@@ -3476,21 +3922,22 @@ function ExchangeConnectStep({
3476
3922
  onClose,
3477
3923
  onGoBack,
3478
3924
  onError,
3479
- onImmersiveChange
3925
+ onImmersiveChange,
3926
+ openExternally
3480
3927
  }
3481
3928
  );
3482
3929
  }
3483
3930
  ExchangeConnectStep.displayName = "ExchangeConnectStep";
3484
3931
 
3485
3932
  // src/components/steps/ExchangeSelectStep.tsx
3486
- import { useCallback as useCallback5, useEffect as useEffect8, useState as useState8 } from "react";
3487
- import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
3933
+ import { useCallback as useCallback5, useEffect as useEffect9, useState as useState9 } from "react";
3934
+ import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
3488
3935
  function ExchangeLogo({ exchange }) {
3489
- const [failed, setFailed] = useState8(false);
3936
+ const [failed, setFailed] = useState9(false);
3490
3937
  if (!exchange.logoUrl || failed) {
3491
- return /* @__PURE__ */ jsx18(BankIcon, {});
3938
+ return /* @__PURE__ */ jsx20(BankIcon, {});
3492
3939
  }
3493
- return /* @__PURE__ */ jsx18(
3940
+ return /* @__PURE__ */ jsx20(
3494
3941
  "img",
3495
3942
  {
3496
3943
  src: exchange.logoUrl,
@@ -3507,19 +3954,19 @@ function ExchangeSelectStep({
3507
3954
  onSelectExchange,
3508
3955
  onError
3509
3956
  }) {
3510
- const [exchanges, setExchanges] = useState8([]);
3511
- const [loading, setLoading] = useState8(true);
3512
- const [error, setError] = useState8(null);
3513
- const [retryToken, setRetryToken] = useState8(0);
3514
- const [exchangeFeeBps, setExchangeFeeBps] = useState8(0);
3515
- const [selectingConnection, setSelectingConnection] = useState8(
3957
+ const [exchanges, setExchanges] = useState9([]);
3958
+ const [loading, setLoading] = useState9(true);
3959
+ const [error, setError] = useState9(null);
3960
+ const [retryToken, setRetryToken] = useState9(0);
3961
+ const [exchangeFeeBps, setExchangeFeeBps] = useState9(0);
3962
+ const [selectingConnection, setSelectingConnection] = useState9(
3516
3963
  null
3517
3964
  );
3518
- const [selectionNotice, setSelectionNotice] = useState8(null);
3965
+ const [selectionNotice, setSelectionNotice] = useState9(null);
3519
3966
  const retry = useCallback5(() => {
3520
3967
  setRetryToken((n) => n + 1);
3521
3968
  }, []);
3522
- useEffect8(() => {
3969
+ useEffect9(() => {
3523
3970
  let cancelled = false;
3524
3971
  setLoading(true);
3525
3972
  setError(null);
@@ -3566,20 +4013,20 @@ function ExchangeSelectStep({
3566
4013
  },
3567
4014
  [exchangeFeeBps, onError, onSelectExchange]
3568
4015
  );
3569
- return /* @__PURE__ */ jsxs14("div", { className: "rs-screen rs-exchange-select", children: [
3570
- /* @__PURE__ */ jsxs14("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
3571
- /* @__PURE__ */ jsx18(
4016
+ return /* @__PURE__ */ jsxs16("div", { className: "rs-screen rs-exchange-select", children: [
4017
+ /* @__PURE__ */ jsxs16("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
4018
+ /* @__PURE__ */ jsx20(
3572
4019
  BodyHeader,
3573
4020
  {
3574
- icon: /* @__PURE__ */ jsx18(UnplugIcon, {}),
4021
+ icon: /* @__PURE__ */ jsx20(UnplugIcon, {}),
3575
4022
  title: "Connect exchange",
3576
4023
  subtitle: "Select an exchange to connect"
3577
4024
  }
3578
4025
  ),
3579
- loading && /* @__PURE__ */ jsx18("div", { className: "rs-exchange-select-state", "aria-live": "polite", children: /* @__PURE__ */ jsx18(Spinner, {}) }),
3580
- !loading && error && /* @__PURE__ */ jsxs14("div", { className: "rs-exchange-select-state", "aria-live": "polite", children: [
3581
- /* @__PURE__ */ jsx18("div", { className: "rs-exchange-select-state-title", children: "Couldn\u2019t load exchanges" }),
3582
- /* @__PURE__ */ jsx18(
4026
+ loading && /* @__PURE__ */ jsx20("div", { className: "rs-exchange-select-state", "aria-live": "polite", children: /* @__PURE__ */ jsx20(Spinner, {}) }),
4027
+ !loading && error && /* @__PURE__ */ jsxs16("div", { className: "rs-exchange-select-state", "aria-live": "polite", children: [
4028
+ /* @__PURE__ */ jsx20("div", { className: "rs-exchange-select-state-title", children: "Couldn\u2019t load exchanges" }),
4029
+ /* @__PURE__ */ jsx20(
3583
4030
  "button",
3584
4031
  {
3585
4032
  type: "button",
@@ -3589,9 +4036,9 @@ function ExchangeSelectStep({
3589
4036
  }
3590
4037
  )
3591
4038
  ] }),
3592
- !loading && !error && exchanges.length === 0 && /* @__PURE__ */ jsxs14("div", { className: "rs-exchange-select-state", "aria-live": "polite", children: [
3593
- /* @__PURE__ */ jsx18("div", { className: "rs-exchange-select-state-title", children: "No exchanges available" }),
3594
- /* @__PURE__ */ jsx18(
4039
+ !loading && !error && exchanges.length === 0 && /* @__PURE__ */ jsxs16("div", { className: "rs-exchange-select-state", "aria-live": "polite", children: [
4040
+ /* @__PURE__ */ jsx20("div", { className: "rs-exchange-select-state-title", children: "No exchanges available" }),
4041
+ /* @__PURE__ */ jsx20(
3595
4042
  "button",
3596
4043
  {
3597
4044
  type: "button",
@@ -3601,9 +4048,9 @@ function ExchangeSelectStep({
3601
4048
  }
3602
4049
  )
3603
4050
  ] }),
3604
- !loading && !error && exchanges.length > 0 && /* @__PURE__ */ jsx18("div", { className: "rs-exchange-grid", children: exchanges.map((exchange) => {
4051
+ !loading && !error && exchanges.length > 0 && /* @__PURE__ */ jsx20("div", { className: "rs-exchange-grid", children: exchanges.map((exchange) => {
3605
4052
  const brand = getExchangeLogo(exchange.name, exchange.connection);
3606
- return /* @__PURE__ */ jsxs14(
4053
+ return /* @__PURE__ */ jsxs16(
3607
4054
  "button",
3608
4055
  {
3609
4056
  type: "button",
@@ -3613,35 +4060,35 @@ function ExchangeSelectStep({
3613
4060
  "aria-busy": selectingConnection === exchange.connection,
3614
4061
  "aria-label": `Select ${exchange.name}`,
3615
4062
  children: [
3616
- /* @__PURE__ */ jsx18(
4063
+ /* @__PURE__ */ jsx20(
3617
4064
  "span",
3618
4065
  {
3619
4066
  className: `rs-exchange-card-logo${brand ? " rs-exchange-card-logo--brand" : ""}`,
3620
- children: brand ?? /* @__PURE__ */ jsx18(ExchangeLogo, { exchange })
4067
+ children: brand ?? /* @__PURE__ */ jsx20(ExchangeLogo, { exchange })
3621
4068
  }
3622
4069
  ),
3623
- /* @__PURE__ */ jsx18("span", { className: "rs-exchange-card-name", children: exchange.name })
4070
+ /* @__PURE__ */ jsx20("span", { className: "rs-exchange-card-name", children: exchange.name })
3624
4071
  ]
3625
4072
  },
3626
4073
  exchange.connection
3627
4074
  );
3628
4075
  }) })
3629
4076
  ] }),
3630
- /* @__PURE__ */ jsx18(PoweredBy, {}),
3631
- exchangeFeeBps > 0 && /* @__PURE__ */ jsxs14("p", { className: "rs-exchange-select-fee-note", children: [
4077
+ /* @__PURE__ */ jsx20(PoweredBy, {}),
4078
+ exchangeFeeBps > 0 && /* @__PURE__ */ jsxs16("p", { className: "rs-exchange-select-fee-note", children: [
3632
4079
  "A ",
3633
4080
  formatFeeRate(exchangeFeeBps),
3634
4081
  " Exchange Fee applies to your deposit."
3635
4082
  ] }),
3636
- selectionNotice && /* @__PURE__ */ jsx18("p", { className: "rs-exchange-select-fee-note", role: "status", children: selectionNotice })
4083
+ selectionNotice && /* @__PURE__ */ jsx20("p", { className: "rs-exchange-select-fee-note", role: "status", children: selectionNotice })
3637
4084
  ] });
3638
4085
  }
3639
4086
  ExchangeSelectStep.displayName = "ExchangeSelectStep";
3640
4087
 
3641
4088
  // src/components/steps/SolanaTokenSelectStep.tsx
3642
- import { useState as useState9, useEffect as useEffect9, useMemo as useMemo5 } from "react";
3643
- import { formatUnits as formatUnits4 } from "viem";
3644
- import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
4089
+ import { useState as useState10, useEffect as useEffect10, useMemo as useMemo5 } from "react";
4090
+ import { formatUnits as formatUnits3 } from "viem";
4091
+ import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
3645
4092
  function SolanaTokenSelectStep({
3646
4093
  solanaAddress,
3647
4094
  service,
@@ -3650,11 +4097,11 @@ function SolanaTokenSelectStep({
3650
4097
  onDisconnect,
3651
4098
  debug
3652
4099
  }) {
3653
- const [tokenBalances, setTokenBalances] = useState9([]);
3654
- const [selectedSymbol, setSelectedSymbol] = useState9(null);
3655
- const [loading, setLoading] = useState9(true);
3656
- const [error, setError] = useState9(null);
3657
- useEffect9(() => {
4100
+ const [tokenBalances, setTokenBalances] = useState10([]);
4101
+ const [selectedSymbol, setSelectedSymbol] = useState10(null);
4102
+ const [loading, setLoading] = useState10(true);
4103
+ const [error, setError] = useState10(null);
4104
+ useEffect10(() => {
3658
4105
  let active = true;
3659
4106
  async function loadBalances() {
3660
4107
  if (!solanaAddress) {
@@ -3737,7 +4184,7 @@ function SolanaTokenSelectStep({
3737
4184
  const selectedEntry = selectedSymbol ? rows.find((r) => r.token.symbol === selectedSymbol) : null;
3738
4185
  const formatBalance = (entry) => {
3739
4186
  try {
3740
- const raw = formatUnits4(entry.balance, entry.token.decimals);
4187
+ const raw = formatUnits3(entry.balance, entry.token.decimals);
3741
4188
  const numeric = Number(raw);
3742
4189
  if (!Number.isFinite(numeric)) return raw;
3743
4190
  return tokenFormatter.format(numeric);
@@ -3747,30 +4194,30 @@ function SolanaTokenSelectStep({
3747
4194
  };
3748
4195
  const chainIcon = getChainIcon("solana");
3749
4196
  const chainName = getChainName("solana");
3750
- return /* @__PURE__ */ jsxs15("div", { className: "rs-screen", children: [
3751
- /* @__PURE__ */ jsxs15("div", { className: "rs-screen-body", children: [
3752
- /* @__PURE__ */ jsx19(
4197
+ return /* @__PURE__ */ jsxs17("div", { className: "rs-screen", children: [
4198
+ /* @__PURE__ */ jsxs17("div", { className: "rs-screen-body", children: [
4199
+ /* @__PURE__ */ jsx21(
3753
4200
  BodyHeader,
3754
4201
  {
3755
- icon: /* @__PURE__ */ jsx19(WalletIcon, {}),
4202
+ icon: /* @__PURE__ */ jsx21(WalletIcon, {}),
3756
4203
  title: "Your assets",
3757
4204
  subtitle: "Select source assets to transfer"
3758
4205
  }
3759
4206
  ),
3760
- loading && /* @__PURE__ */ jsxs15("div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
3761
- /* @__PURE__ */ jsx19(Spinner, { className: "rs-text-tertiary" }),
3762
- /* @__PURE__ */ jsx19("span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
4207
+ loading && /* @__PURE__ */ jsxs17("div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
4208
+ /* @__PURE__ */ jsx21(Spinner, { className: "rs-text-tertiary" }),
4209
+ /* @__PURE__ */ jsx21("span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
3763
4210
  ] }),
3764
- error && /* @__PURE__ */ jsx19(Callout, { variant: "error", children: error }),
3765
- !loading && !error && rows.length === 0 && /* @__PURE__ */ jsxs15("div", { className: "rs-empty-state", children: [
3766
- /* @__PURE__ */ jsx19(WalletIcon, { className: "rs-empty-icon" }),
3767
- /* @__PURE__ */ jsx19("div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
3768
- /* @__PURE__ */ jsxs15("div", { className: "rs-empty-address", children: [
4211
+ error && /* @__PURE__ */ jsx21(Callout, { variant: "error", children: error }),
4212
+ !loading && !error && rows.length === 0 && /* @__PURE__ */ jsxs17("div", { className: "rs-empty-state", children: [
4213
+ /* @__PURE__ */ jsx21(WalletIcon, { className: "rs-empty-icon" }),
4214
+ /* @__PURE__ */ jsx21("div", { className: "rs-empty-text", children: "No funds in connected wallet" }),
4215
+ /* @__PURE__ */ jsxs17("div", { className: "rs-empty-address", children: [
3769
4216
  solanaAddress.slice(0, 6),
3770
4217
  "...",
3771
4218
  solanaAddress.slice(-4)
3772
4219
  ] }),
3773
- onDisconnect && /* @__PURE__ */ jsx19(
4220
+ onDisconnect && /* @__PURE__ */ jsx21(
3774
4221
  "button",
3775
4222
  {
3776
4223
  type: "button",
@@ -3780,10 +4227,10 @@ function SolanaTokenSelectStep({
3780
4227
  }
3781
4228
  )
3782
4229
  ] }),
3783
- !loading && !error && rows.length > 0 && /* @__PURE__ */ jsx19("div", { className: "rs-asset-list", children: rows.map((entry) => {
4230
+ !loading && !error && rows.length > 0 && /* @__PURE__ */ jsx21("div", { className: "rs-asset-list", children: rows.map((entry) => {
3784
4231
  const isSelected = selectedSymbol === entry.token.symbol;
3785
4232
  const tokenAmount = formatBalance(entry);
3786
- return /* @__PURE__ */ jsxs15(
4233
+ return /* @__PURE__ */ jsxs17(
3787
4234
  "button",
3788
4235
  {
3789
4236
  type: "button",
@@ -3791,39 +4238,39 @@ function SolanaTokenSelectStep({
3791
4238
  className: `rs-asset-row ${isSelected ? "rs-asset-row--selected" : ""}`,
3792
4239
  "aria-pressed": isSelected,
3793
4240
  children: [
3794
- /* @__PURE__ */ jsxs15("div", { className: "rs-asset-info", children: [
3795
- /* @__PURE__ */ jsxs15("div", { className: "rs-asset-icon-wrapper", children: [
3796
- /* @__PURE__ */ jsx19("span", { className: "rs-asset-icon", children: /* @__PURE__ */ jsx19(
4241
+ /* @__PURE__ */ jsxs17("div", { className: "rs-asset-info", children: [
4242
+ /* @__PURE__ */ jsxs17("div", { className: "rs-asset-icon-wrapper", children: [
4243
+ /* @__PURE__ */ jsx21("span", { className: "rs-asset-icon", children: /* @__PURE__ */ jsx21(
3797
4244
  TokenIcon,
3798
4245
  {
3799
4246
  symbol: entry.token.symbol,
3800
4247
  fallback: entry.token.symbol.slice(0, 4)
3801
4248
  }
3802
4249
  ) }),
3803
- chainIcon && /* @__PURE__ */ jsx19("span", { className: "rs-asset-chain-badge", children: /* @__PURE__ */ jsx19(CdnIcon, { src: chainIcon, alt: chainName }) })
4250
+ chainIcon && /* @__PURE__ */ jsx21("span", { className: "rs-asset-chain-badge", children: /* @__PURE__ */ jsx21(CdnIcon, { src: chainIcon, alt: chainName }) })
3804
4251
  ] }),
3805
- /* @__PURE__ */ jsxs15("div", { className: "rs-asset-text", children: [
3806
- /* @__PURE__ */ jsxs15("div", { className: "rs-asset-name-row", children: [
3807
- /* @__PURE__ */ jsx19("span", { className: "rs-asset-name", children: entry.token.symbol }),
3808
- /* @__PURE__ */ jsxs15("span", { className: "rs-asset-chain", children: [
4252
+ /* @__PURE__ */ jsxs17("div", { className: "rs-asset-text", children: [
4253
+ /* @__PURE__ */ jsxs17("div", { className: "rs-asset-name-row", children: [
4254
+ /* @__PURE__ */ jsx21("span", { className: "rs-asset-name", children: entry.token.symbol }),
4255
+ /* @__PURE__ */ jsxs17("span", { className: "rs-asset-chain", children: [
3809
4256
  "on ",
3810
4257
  chainName
3811
4258
  ] })
3812
4259
  ] }),
3813
- /* @__PURE__ */ jsxs15("div", { className: "rs-asset-balance-small", children: [
4260
+ /* @__PURE__ */ jsxs17("div", { className: "rs-asset-balance-small", children: [
3814
4261
  tokenAmount,
3815
4262
  " ",
3816
4263
  entry.token.symbol
3817
4264
  ] })
3818
4265
  ] })
3819
4266
  ] }),
3820
- /* @__PURE__ */ jsx19("div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ? currencyFormatter.format(entry.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${entry.token.symbol}` : "--" })
4267
+ /* @__PURE__ */ jsx21("div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ? currencyFormatter.format(entry.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${entry.token.symbol}` : "--" })
3821
4268
  ]
3822
4269
  },
3823
4270
  entry.token.symbol
3824
4271
  );
3825
4272
  }) }),
3826
- /* @__PURE__ */ jsx19(
4273
+ /* @__PURE__ */ jsx21(
3827
4274
  Button,
3828
4275
  {
3829
4276
  onClick: () => selectedEntry && onContinue(
@@ -3837,14 +4284,14 @@ function SolanaTokenSelectStep({
3837
4284
  }
3838
4285
  )
3839
4286
  ] }),
3840
- /* @__PURE__ */ jsx19(PoweredBy, {})
4287
+ /* @__PURE__ */ jsx21(PoweredBy, {})
3841
4288
  ] });
3842
4289
  }
3843
4290
 
3844
4291
  // src/components/steps/SolanaAmountStep.tsx
3845
- import { useCallback as useCallback6, useEffect as useEffect10, useMemo as useMemo6, useRef as useRef7, useState as useState10 } from "react";
3846
- import { formatUnits as formatUnits5, parseUnits as parseUnits3 } from "viem";
3847
- import { Fragment as Fragment4, jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
4292
+ import { useCallback as useCallback6, useEffect as useEffect11, useMemo as useMemo6, useRef as useRef7, useState as useState11 } from "react";
4293
+ import { formatUnits as formatUnits4, parseUnits as parseUnits4 } from "viem";
4294
+ import { Fragment as Fragment5, jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
3848
4295
  var SOL_FEE_RESERVE_LAMPORTS = 1000000n;
3849
4296
  var PRESETS2 = [
3850
4297
  { value: 25, label: "25%" },
@@ -3865,15 +4312,15 @@ function SolanaAmountStep({
3865
4312
  onContinue,
3866
4313
  debug
3867
4314
  }) {
3868
- const [amount, setAmount] = useState10("");
3869
- const [error, setError] = useState10(null);
4315
+ const [amount, setAmount] = useState11("");
4316
+ const [error, setError] = useState11(null);
3870
4317
  const hasAppliedDefaultRef = useRef7(false);
3871
4318
  const isSourceStablecoin = isStablecoinSymbol(token.symbol);
3872
4319
  const isMaxDefault = defaultAmount?.trim().toLowerCase() === "max";
3873
4320
  const tokenPriceUsd = useMemo6(() => {
3874
4321
  if (isSourceStablecoin) return 1;
3875
4322
  try {
3876
- const balanceUnits = Number(formatUnits5(balance, token.decimals));
4323
+ const balanceUnits = Number(formatUnits4(balance, token.decimals));
3877
4324
  if (!Number.isFinite(balanceUnits) || balanceUnits <= 0 || balanceUsd <= 0) {
3878
4325
  return null;
3879
4326
  }
@@ -3886,7 +4333,7 @@ function SolanaAmountStep({
3886
4333
  const hasPricing = tokenPriceUsd !== null;
3887
4334
  const formattedBalance = useMemo6(() => {
3888
4335
  try {
3889
- const raw = formatUnits5(balance, token.decimals);
4336
+ const raw = formatUnits4(balance, token.decimals);
3890
4337
  const numeric = Number(raw);
3891
4338
  if (!Number.isFinite(numeric)) return raw;
3892
4339
  return tokenFormatter.format(numeric);
@@ -3896,7 +4343,7 @@ function SolanaAmountStep({
3896
4343
  }, [balance, token.decimals]);
3897
4344
  const computedBalanceUsd = useMemo6(() => {
3898
4345
  try {
3899
- const balanceUnits = Number(formatUnits5(balance, token.decimals));
4346
+ const balanceUnits = Number(formatUnits4(balance, token.decimals));
3900
4347
  if (!Number.isFinite(balanceUnits) || balanceUnits < 0) return null;
3901
4348
  if (tokenPriceUsd !== null) return balanceUnits * tokenPriceUsd;
3902
4349
  if (Number.isFinite(balanceUsd) && balanceUsd > 0) return balanceUsd;
@@ -3911,7 +4358,7 @@ function SolanaAmountStep({
3911
4358
  }, [balance, token]);
3912
4359
  const spendableBalanceUsd = useMemo6(() => {
3913
4360
  try {
3914
- const spendableUnits = Number(formatUnits5(spendableBalance, token.decimals));
4361
+ const spendableUnits = Number(formatUnits4(spendableBalance, token.decimals));
3915
4362
  if (!Number.isFinite(spendableUnits) || spendableUnits < 0) return null;
3916
4363
  if (tokenPriceUsd !== null) return spendableUnits * tokenPriceUsd;
3917
4364
  return null;
@@ -3923,7 +4370,7 @@ function SolanaAmountStep({
3923
4370
  (percentage) => {
3924
4371
  try {
3925
4372
  const spendableUnits = Number(
3926
- formatUnits5(spendableBalance, token.decimals)
4373
+ formatUnits4(spendableBalance, token.decimals)
3927
4374
  );
3928
4375
  if (!Number.isFinite(spendableUnits) || spendableUnits <= 0) return "";
3929
4376
  const value = isSourceStablecoin || !hasPricing ? spendableUnits * percentage / 100 : (spendableBalanceUsd ?? 0) * percentage / 100;
@@ -3942,7 +4389,7 @@ function SolanaAmountStep({
3942
4389
  spendableBalanceUsd
3943
4390
  ]
3944
4391
  );
3945
- useEffect10(() => {
4392
+ useEffect11(() => {
3946
4393
  if (hasAppliedDefaultRef.current || !defaultAmount) return;
3947
4394
  if (isMaxDefault) {
3948
4395
  const next = computePresetAmount(100);
@@ -3966,7 +4413,7 @@ function SolanaAmountStep({
3966
4413
  if (numericAmount <= 0) return null;
3967
4414
  const raw = isSourceStablecoin || !hasPricing ? numericAmount : numericAmount / (tokenPriceUsd ?? 1);
3968
4415
  try {
3969
- return parseUnits3(raw.toString(), token.decimals);
4416
+ return parseUnits4(raw.toString(), token.decimals);
3970
4417
  } catch {
3971
4418
  return null;
3972
4419
  }
@@ -4015,7 +4462,7 @@ function SolanaAmountStep({
4015
4462
  const sourceAmountStr = sourceAmount.toString();
4016
4463
  let amountInUnits;
4017
4464
  try {
4018
- amountInUnits = parseUnits3(sourceAmountStr, token.decimals);
4465
+ amountInUnits = parseUnits4(sourceAmountStr, token.decimals);
4019
4466
  } catch {
4020
4467
  debugLog(debug, "solana-amount", "amount:invalid", {
4021
4468
  amount,
@@ -4043,12 +4490,12 @@ function SolanaAmountStep({
4043
4490
  };
4044
4491
  const continueLabel = exceedsBalance ? "Insufficient balance" : isAboveMax ? "Continue with max allowed deposit" : isBelowMin ? "Continue with minimum deposit" : "Continue";
4045
4492
  const continueDisabled = exceedsBalance || numericAmount === 0 && !isBelowMin;
4046
- return /* @__PURE__ */ jsxs16("div", { className: "rs-screen", children: [
4047
- /* @__PURE__ */ jsxs16("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
4048
- /* @__PURE__ */ jsx20(BodyHeader, { icon: /* @__PURE__ */ jsx20(WalletIcon, {}), title: "Wallet deposit" }),
4049
- /* @__PURE__ */ jsxs16("div", { className: "rs-amount-section", children: [
4050
- /* @__PURE__ */ jsxs16("div", { className: "rs-amount-display", children: [
4051
- /* @__PURE__ */ jsx20(
4493
+ return /* @__PURE__ */ jsxs18("div", { className: "rs-screen", children: [
4494
+ /* @__PURE__ */ jsxs18("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
4495
+ /* @__PURE__ */ jsx22(BodyHeader, { icon: /* @__PURE__ */ jsx22(WalletIcon, {}), title: "Wallet deposit" }),
4496
+ /* @__PURE__ */ jsxs18("div", { className: "rs-amount-section", children: [
4497
+ /* @__PURE__ */ jsxs18("div", { className: "rs-amount-display", children: [
4498
+ /* @__PURE__ */ jsx22(
4052
4499
  AnimatedAmountInput,
4053
4500
  {
4054
4501
  value: amount,
@@ -4057,25 +4504,25 @@ function SolanaAmountStep({
4057
4504
  autoFocus: true
4058
4505
  }
4059
4506
  ),
4060
- /* @__PURE__ */ jsxs16("div", { className: "rs-amount-meta", children: [
4061
- /* @__PURE__ */ jsxs16("span", { className: "rs-amount-meta-balance", children: [
4507
+ /* @__PURE__ */ jsxs18("div", { className: "rs-amount-meta", children: [
4508
+ /* @__PURE__ */ jsxs18("span", { className: "rs-amount-meta-balance", children: [
4062
4509
  formattedBalance,
4063
4510
  " ",
4064
4511
  token.symbol,
4065
4512
  " available",
4066
- computedBalanceUsd !== null && /* @__PURE__ */ jsxs16(Fragment4, { children: [
4513
+ computedBalanceUsd !== null && /* @__PURE__ */ jsxs18(Fragment5, { children: [
4067
4514
  " (~",
4068
4515
  currencyFormatter.format(computedBalanceUsd),
4069
4516
  ")"
4070
4517
  ] })
4071
4518
  ] }),
4072
- minDepositUsd !== null && /* @__PURE__ */ jsxs16("span", { className: "rs-amount-meta-minimum", children: [
4519
+ minDepositUsd !== null && /* @__PURE__ */ jsxs18("span", { className: "rs-amount-meta-minimum", children: [
4073
4520
  "Min. deposit ",
4074
4521
  currencyFormatter.format(minDepositUsd)
4075
4522
  ] })
4076
4523
  ] })
4077
4524
  ] }),
4078
- /* @__PURE__ */ jsx20("div", { className: "rs-amount-presets", children: PRESETS2.map((preset) => /* @__PURE__ */ jsx20(
4525
+ /* @__PURE__ */ jsx22("div", { className: "rs-amount-presets", children: PRESETS2.map((preset) => /* @__PURE__ */ jsx22(
4079
4526
  "button",
4080
4527
  {
4081
4528
  type: "button",
@@ -4086,35 +4533,35 @@ function SolanaAmountStep({
4086
4533
  preset.value
4087
4534
  )) })
4088
4535
  ] }),
4089
- /* @__PURE__ */ jsxs16("div", { className: "rs-amount-details", children: [
4090
- /* @__PURE__ */ jsxs16("div", { className: "rs-amount-detail-row", children: [
4091
- /* @__PURE__ */ jsx20("span", { children: "You send" }),
4092
- /* @__PURE__ */ jsxs16("span", { className: "rs-amount-detail-value", children: [
4093
- /* @__PURE__ */ jsxs16("span", { children: [
4536
+ /* @__PURE__ */ jsxs18("div", { className: "rs-amount-details", children: [
4537
+ /* @__PURE__ */ jsxs18("div", { className: "rs-amount-detail-row", children: [
4538
+ /* @__PURE__ */ jsx22("span", { children: "You send" }),
4539
+ /* @__PURE__ */ jsxs18("span", { className: "rs-amount-detail-value", children: [
4540
+ /* @__PURE__ */ jsxs18("span", { children: [
4094
4541
  "Solana ",
4095
4542
  token.symbol
4096
4543
  ] }),
4097
- /* @__PURE__ */ jsx20("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx20(TokenIcon, { symbol: token.symbol }) })
4544
+ /* @__PURE__ */ jsx22("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx22(TokenIcon, { symbol: token.symbol }) })
4098
4545
  ] })
4099
4546
  ] }),
4100
- targetChainName && targetTokenSymbol && /* @__PURE__ */ jsxs16("div", { className: "rs-amount-detail-row", children: [
4101
- /* @__PURE__ */ jsx20("span", { children: "Receive" }),
4102
- /* @__PURE__ */ jsxs16("span", { className: "rs-amount-detail-value", children: [
4103
- /* @__PURE__ */ jsxs16("span", { children: [
4547
+ targetChainName && targetTokenSymbol && /* @__PURE__ */ jsxs18("div", { className: "rs-amount-detail-row", children: [
4548
+ /* @__PURE__ */ jsx22("span", { children: "Receive" }),
4549
+ /* @__PURE__ */ jsxs18("span", { className: "rs-amount-detail-value", children: [
4550
+ /* @__PURE__ */ jsxs18("span", { children: [
4104
4551
  targetChainName,
4105
4552
  " ",
4106
4553
  targetTokenSymbol
4107
4554
  ] }),
4108
- /* @__PURE__ */ jsx20("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx20(TokenIcon, { symbol: targetTokenSymbol }) })
4555
+ /* @__PURE__ */ jsx22("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx22(TokenIcon, { symbol: targetTokenSymbol }) })
4109
4556
  ] })
4110
4557
  ] }),
4111
- balanceAfterUsd !== null && /* @__PURE__ */ jsxs16("div", { className: "rs-amount-detail-row", children: [
4112
- /* @__PURE__ */ jsx20("span", { children: "Balance after deposit" }),
4113
- /* @__PURE__ */ jsx20("span", { className: "rs-amount-detail-value", children: currencyFormatter.format(balanceAfterUsd) })
4558
+ balanceAfterUsd !== null && /* @__PURE__ */ jsxs18("div", { className: "rs-amount-detail-row", children: [
4559
+ /* @__PURE__ */ jsx22("span", { children: "Balance after deposit" }),
4560
+ /* @__PURE__ */ jsx22("span", { className: "rs-amount-detail-value", children: currencyFormatter.format(balanceAfterUsd) })
4114
4561
  ] })
4115
4562
  ] }),
4116
- error && /* @__PURE__ */ jsx20(Callout, { variant: "error", children: error }),
4117
- /* @__PURE__ */ jsx20(
4563
+ error && /* @__PURE__ */ jsx22(Callout, { variant: "error", children: error }),
4564
+ /* @__PURE__ */ jsx22(
4118
4565
  Button,
4119
4566
  {
4120
4567
  onClick: handleContinue,
@@ -4124,13 +4571,13 @@ function SolanaAmountStep({
4124
4571
  }
4125
4572
  )
4126
4573
  ] }),
4127
- /* @__PURE__ */ jsx20(PoweredBy, {})
4574
+ /* @__PURE__ */ jsx22(PoweredBy, {})
4128
4575
  ] });
4129
4576
  }
4130
4577
 
4131
4578
  // src/components/steps/SolanaConfirmStep.tsx
4132
- import { useState as useState11 } from "react";
4133
- import { parseUnits as parseUnits4 } from "viem";
4579
+ import { useState as useState12 } from "react";
4580
+ import { parseUnits as parseUnits5 } from "viem";
4134
4581
 
4135
4582
  // src/core/solana.ts
4136
4583
  import {
@@ -4231,7 +4678,7 @@ async function sendSolanaTransaction(provider, _connection, transaction) {
4231
4678
  }
4232
4679
 
4233
4680
  // src/components/steps/SolanaConfirmStep.tsx
4234
- import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
4681
+ import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
4235
4682
  function SolanaConfirmStep({
4236
4683
  smartAccount,
4237
4684
  solanaAddress,
@@ -4253,8 +4700,8 @@ function SolanaConfirmStep({
4253
4700
  debug
4254
4701
  }) {
4255
4702
  const rpcUrls = useRpcUrls();
4256
- const [isSubmitting, setIsSubmitting] = useState11(false);
4257
- const [error, setError] = useState11(null);
4703
+ const [isSubmitting, setIsSubmitting] = useState12(false);
4704
+ const [error, setError] = useState12(null);
4258
4705
  const targetChainId = targetChainToChainId(targetChain);
4259
4706
  const targetSymbol = getTargetTokenSymbol(targetToken, targetChainId);
4260
4707
  const sourceChainName = getChainName("solana");
@@ -4321,7 +4768,7 @@ function SolanaConfirmStep({
4321
4768
  );
4322
4769
  }
4323
4770
  const connection = hasConfiguredSolanaRpcUrl(rpcUrls) ? getSolanaConnection(rpcUrls) : solanaConnection ?? getSolanaConnection(rpcUrls);
4324
- const amountUnits = parseUnits4(sourceAmount, token.decimals);
4771
+ const amountUnits = parseUnits5(sourceAmount, token.decimals);
4325
4772
  debugLog(debug, "solana-confirm", "tx:build:start", {
4326
4773
  token: token.symbol,
4327
4774
  sourceAmount,
@@ -4374,62 +4821,26 @@ function SolanaConfirmStep({
4374
4821
  setIsSubmitting(false);
4375
4822
  }
4376
4823
  };
4377
- return /* @__PURE__ */ jsxs17("div", { className: "rs-screen", children: [
4378
- /* @__PURE__ */ jsxs17("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
4379
- /* @__PURE__ */ jsx21(BodyHeader, { icon: /* @__PURE__ */ jsx21(WalletIcon, {}), title: "Review deposit" }),
4380
- /* @__PURE__ */ jsxs17("div", { className: "rs-review-details", children: [
4381
- /* @__PURE__ */ jsxs17("div", { className: "rs-review-detail-row", children: [
4382
- /* @__PURE__ */ jsx21("span", { children: "Source chain" }),
4383
- /* @__PURE__ */ jsxs17("span", { className: "rs-review-detail-value", children: [
4384
- /* @__PURE__ */ jsx21("span", { children: sourceChainName }),
4385
- sourceChainIcon && /* @__PURE__ */ jsx21("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx21(CdnIcon, { src: sourceChainIcon }) })
4386
- ] })
4387
- ] }),
4388
- /* @__PURE__ */ jsxs17("div", { className: "rs-review-detail-row", children: [
4389
- /* @__PURE__ */ jsx21("span", { children: "Destination chain" }),
4390
- /* @__PURE__ */ jsxs17("span", { className: "rs-review-detail-value", children: [
4391
- /* @__PURE__ */ jsx21("span", { children: targetChainName }),
4392
- targetChainIcon && /* @__PURE__ */ jsx21("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx21(CdnIcon, { src: targetChainIcon }) })
4393
- ] })
4394
- ] }),
4395
- /* @__PURE__ */ jsxs17("div", { className: "rs-review-detail-row", children: [
4396
- /* @__PURE__ */ jsx21("span", { children: "Estimated time" }),
4397
- /* @__PURE__ */ jsx21("span", { className: "rs-review-detail-value", children: estimatedTime })
4398
- ] }),
4399
- /* @__PURE__ */ jsxs17("div", { className: "rs-review-detail-row", children: [
4400
- /* @__PURE__ */ jsx21("span", { children: "You send" }),
4401
- /* @__PURE__ */ jsxs17("span", { className: "rs-review-detail-value", children: [
4402
- /* @__PURE__ */ jsxs17("span", { children: [
4403
- formattedAmount,
4404
- " ",
4405
- token.symbol
4406
- ] }),
4407
- /* @__PURE__ */ jsx21("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx21(TokenIcon, { symbol: token.symbol }) })
4408
- ] })
4409
- ] }),
4410
- /* @__PURE__ */ jsxs17("div", { className: "rs-review-detail-row", children: [
4411
- /* @__PURE__ */ jsx21("span", { children: "Receive" }),
4412
- /* @__PURE__ */ jsxs17("span", { className: "rs-review-detail-value", children: [
4413
- /* @__PURE__ */ jsx21("span", { children: receiveDisplay }),
4414
- /* @__PURE__ */ jsx21("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx21(TokenIcon, { symbol: targetSymbol }) })
4415
- ] })
4416
- ] }),
4417
- /* @__PURE__ */ jsxs17("div", { className: "rs-review-detail-row", children: [
4418
- /* @__PURE__ */ jsx21("span", { children: "Fees" }),
4419
- /* @__PURE__ */ jsxs17("span", { className: "rs-review-detail-value", children: [
4420
- /* @__PURE__ */ jsx21(
4421
- "span",
4422
- {
4423
- style: feeSponsored ? { textDecoration: "line-through" } : void 0,
4424
- children: "$0.04"
4425
- }
4426
- ),
4427
- /* @__PURE__ */ jsx21(Tooltip, { content: feeTooltip, children: /* @__PURE__ */ jsx21("span", { className: "rs-review-detail-info", "aria-label": "Fee info", children: /* @__PURE__ */ jsx21(InfoIcon, {}) }) })
4428
- ] })
4429
- ] })
4430
- ] }),
4431
- error && /* @__PURE__ */ jsx21(Callout, { variant: "error", children: error }),
4432
- /* @__PURE__ */ jsx21(
4824
+ return /* @__PURE__ */ jsxs19("div", { className: "rs-screen", children: [
4825
+ /* @__PURE__ */ jsxs19("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
4826
+ /* @__PURE__ */ jsx23(BodyHeader, { icon: /* @__PURE__ */ jsx23(WalletIcon, {}), title: "Review deposit" }),
4827
+ /* @__PURE__ */ jsx23(
4828
+ ReviewDetails,
4829
+ {
4830
+ sourceChainName,
4831
+ sourceChainIcon,
4832
+ targetChainName,
4833
+ targetChainIcon,
4834
+ estimatedTime,
4835
+ sendAmount: formattedAmount,
4836
+ sendSymbol: token.symbol,
4837
+ receiveDisplay,
4838
+ receiveSymbol: targetSymbol,
4839
+ fee: { display: "$0.04", struck: feeSponsored, tooltip: feeTooltip }
4840
+ }
4841
+ ),
4842
+ error && /* @__PURE__ */ jsx23(Callout, { variant: "error", children: error }),
4843
+ /* @__PURE__ */ jsx23(
4433
4844
  Button,
4434
4845
  {
4435
4846
  onClick: handleConfirm,
@@ -4441,30 +4852,30 @@ function SolanaConfirmStep({
4441
4852
  }
4442
4853
  )
4443
4854
  ] }),
4444
- /* @__PURE__ */ jsx21(PoweredBy, {})
4855
+ /* @__PURE__ */ jsx23(PoweredBy, {})
4445
4856
  ] });
4446
4857
  }
4447
4858
 
4448
4859
  // src/components/steps/DappImportAssetSelectStep.tsx
4449
- import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
4860
+ import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
4450
4861
  function DappImportAssetSelectStep({
4451
4862
  sourceLabel,
4452
4863
  assets,
4453
4864
  incompleteSummary,
4454
4865
  onSelect
4455
4866
  }) {
4456
- return /* @__PURE__ */ jsxs18("div", { className: "rs-screen", children: [
4457
- /* @__PURE__ */ jsxs18("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
4458
- /* @__PURE__ */ jsx22(
4867
+ return /* @__PURE__ */ jsxs20("div", { className: "rs-screen", children: [
4868
+ /* @__PURE__ */ jsxs20("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
4869
+ /* @__PURE__ */ jsx24(
4459
4870
  BodyHeader,
4460
4871
  {
4461
- icon: /* @__PURE__ */ jsx22(WalletIcon, {}),
4872
+ icon: /* @__PURE__ */ jsx24(WalletIcon, {}),
4462
4873
  title: `Transfer from ${sourceLabel}`,
4463
4874
  subtitle: "Pick the balance to import"
4464
4875
  }
4465
4876
  ),
4466
- incompleteSummary && /* @__PURE__ */ jsx22("div", { className: "rs-asset-notice", role: "status", children: incompleteSummary }),
4467
- /* @__PURE__ */ jsx22("div", { className: "rs-asset-list", children: assets.map((asset) => {
4877
+ incompleteSummary && /* @__PURE__ */ jsx24("div", { className: "rs-asset-notice", role: "status", children: incompleteSummary }),
4878
+ /* @__PURE__ */ jsx24("div", { className: "rs-asset-list", children: assets.map((asset) => {
4468
4879
  const tokenAmount = asset.balance ? tokenFormatter.format(
4469
4880
  Number(asset.balance) / 10 ** asset.decimals
4470
4881
  ) : "0";
@@ -4472,23 +4883,23 @@ function DappImportAssetSelectStep({
4472
4883
  const assetIcon = asset.icon;
4473
4884
  const chainIcon = getChainIcon(asset.chainId);
4474
4885
  const badge = getChainBadge(asset.chainId);
4475
- return /* @__PURE__ */ jsxs18(
4886
+ return /* @__PURE__ */ jsxs20(
4476
4887
  "button",
4477
4888
  {
4478
4889
  type: "button",
4479
4890
  className: "rs-asset-row",
4480
4891
  onClick: () => onSelect(asset),
4481
4892
  children: [
4482
- /* @__PURE__ */ jsxs18("div", { className: "rs-asset-info", children: [
4483
- /* @__PURE__ */ jsxs18("div", { className: "rs-asset-icon-wrapper", children: [
4484
- /* @__PURE__ */ jsx22("span", { className: "rs-asset-icon", children: assetIcon ? /* @__PURE__ */ jsx22(CdnIcon, { src: assetIcon, alt: asset.symbol }) : /* @__PURE__ */ jsx22(
4893
+ /* @__PURE__ */ jsxs20("div", { className: "rs-asset-info", children: [
4894
+ /* @__PURE__ */ jsxs20("div", { className: "rs-asset-icon-wrapper", children: [
4895
+ /* @__PURE__ */ jsx24("span", { className: "rs-asset-icon", children: assetIcon ? /* @__PURE__ */ jsx24(CdnIcon, { src: assetIcon, alt: asset.symbol }) : /* @__PURE__ */ jsx24(
4485
4896
  TokenIcon,
4486
4897
  {
4487
4898
  symbol: asset.symbol,
4488
4899
  fallback: asset.symbol.slice(0, 4)
4489
4900
  }
4490
4901
  ) }),
4491
- chainIcon ? /* @__PURE__ */ jsx22("span", { className: "rs-asset-chain-badge", children: /* @__PURE__ */ jsx22(CdnIcon, { src: chainIcon, alt: getChainName(asset.chainId) }) }) : /* @__PURE__ */ jsx22(
4902
+ chainIcon ? /* @__PURE__ */ jsx24("span", { className: "rs-asset-chain-badge", children: /* @__PURE__ */ jsx24(CdnIcon, { src: chainIcon, alt: getChainName(asset.chainId) }) }) : /* @__PURE__ */ jsx24(
4492
4903
  "span",
4493
4904
  {
4494
4905
  className: "rs-asset-chain-badge",
@@ -4497,36 +4908,36 @@ function DappImportAssetSelectStep({
4497
4908
  }
4498
4909
  )
4499
4910
  ] }),
4500
- /* @__PURE__ */ jsxs18("div", { className: "rs-asset-text", children: [
4501
- /* @__PURE__ */ jsxs18("div", { className: "rs-asset-name-row", children: [
4502
- /* @__PURE__ */ jsx22("span", { className: "rs-asset-name", children: asset.symbol }),
4503
- /* @__PURE__ */ jsxs18("span", { className: "rs-asset-chain", children: [
4911
+ /* @__PURE__ */ jsxs20("div", { className: "rs-asset-text", children: [
4912
+ /* @__PURE__ */ jsxs20("div", { className: "rs-asset-name-row", children: [
4913
+ /* @__PURE__ */ jsx24("span", { className: "rs-asset-name", children: asset.symbol }),
4914
+ /* @__PURE__ */ jsxs20("span", { className: "rs-asset-chain", children: [
4504
4915
  "on ",
4505
4916
  asset.sourceLabel,
4506
4917
  asset.qualifier ? ` \xB7 ${asset.qualifier}` : ""
4507
4918
  ] })
4508
4919
  ] }),
4509
- /* @__PURE__ */ jsxs18("div", { className: "rs-asset-balance-small", children: [
4920
+ /* @__PURE__ */ jsxs20("div", { className: "rs-asset-balance-small", children: [
4510
4921
  tokenAmount,
4511
4922
  " ",
4512
4923
  asset.symbol
4513
4924
  ] })
4514
4925
  ] })
4515
4926
  ] }),
4516
- /* @__PURE__ */ jsx22("div", { className: "rs-asset-balance", children: balanceUsd })
4927
+ /* @__PURE__ */ jsx24("div", { className: "rs-asset-balance", children: balanceUsd })
4517
4928
  ]
4518
4929
  },
4519
4930
  asset.id
4520
4931
  );
4521
4932
  }) })
4522
4933
  ] }),
4523
- /* @__PURE__ */ jsx22(PoweredBy, {})
4934
+ /* @__PURE__ */ jsx24(PoweredBy, {})
4524
4935
  ] });
4525
4936
  }
4526
4937
  DappImportAssetSelectStep.displayName = "DappImportAssetSelectStep";
4527
4938
 
4528
4939
  // src/components/steps/DappImportSelectStep.tsx
4529
- import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
4940
+ import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
4530
4941
  function describeRow(status, comingSoon) {
4531
4942
  if (comingSoon) {
4532
4943
  return { subtitle: "Coming soon", disabled: true, busy: false };
@@ -4562,30 +4973,30 @@ function DappImportSelectStep({
4562
4973
  const byId = new Map(rows.map((row) => [row.id, row.status]));
4563
4974
  const enabled = new Set(enabledIds);
4564
4975
  const brands = DAPP_IMPORT_CATALOG.filter((brand) => enabled.has(brand.id));
4565
- return /* @__PURE__ */ jsxs19("div", { className: "rs-screen", children: [
4566
- /* @__PURE__ */ jsxs19("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
4567
- /* @__PURE__ */ jsx23(
4976
+ return /* @__PURE__ */ jsxs21("div", { className: "rs-screen", children: [
4977
+ /* @__PURE__ */ jsxs21("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
4978
+ /* @__PURE__ */ jsx25(
4568
4979
  BodyHeader,
4569
4980
  {
4570
- icon: /* @__PURE__ */ jsx23(MigrateAssetsIcon, {}),
4981
+ icon: /* @__PURE__ */ jsx25(MigrateAssetsIcon, {}),
4571
4982
  title: "Migrate assets",
4572
4983
  subtitle: "Select a position to migrate"
4573
4984
  }
4574
4985
  ),
4575
- /* @__PURE__ */ jsx23("div", { className: "rs-list", children: brands.map((brand) => {
4986
+ /* @__PURE__ */ jsx25("div", { className: "rs-list", children: brands.map((brand) => {
4576
4987
  const status = byId.get(brand.id);
4577
4988
  const { subtitle, disabled, busy } = describeRow(
4578
4989
  status,
4579
4990
  Boolean(brand.comingSoon)
4580
4991
  );
4581
- return /* @__PURE__ */ jsx23(
4992
+ return /* @__PURE__ */ jsx25(
4582
4993
  ListRow,
4583
4994
  {
4584
4995
  leadingMedia: brand.iconUrl,
4585
4996
  title: brand.label,
4586
4997
  subtitle,
4587
4998
  disabled,
4588
- trailing: busy ? /* @__PURE__ */ jsx23(Spinner, { className: "rs-spinner--sm" }) : void 0,
4999
+ trailing: busy ? /* @__PURE__ */ jsx25(Spinner, { className: "rs-spinner--sm" }) : void 0,
4589
5000
  onClick: () => {
4590
5001
  if (status === "needs-connect") {
4591
5002
  onRequestConnect?.();
@@ -4598,64 +5009,64 @@ function DappImportSelectStep({
4598
5009
  );
4599
5010
  }) })
4600
5011
  ] }),
4601
- /* @__PURE__ */ jsx23(PoweredBy, {})
5012
+ /* @__PURE__ */ jsx25(PoweredBy, {})
4602
5013
  ] });
4603
5014
  }
4604
5015
  DappImportSelectStep.displayName = "DappImportSelectStep";
4605
5016
 
4606
5017
  // src/components/steps/DappImportAssetSelectSkeleton.tsx
4607
- import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
5018
+ import { jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
4608
5019
  function DappImportAssetSelectSkeleton({
4609
5020
  sourceLabel,
4610
5021
  rowCount = 3,
4611
5022
  error = false,
4612
5023
  onRetry
4613
5024
  }) {
4614
- return /* @__PURE__ */ jsxs20("div", { className: "rs-screen", "aria-busy": error ? "false" : "true", children: [
4615
- /* @__PURE__ */ jsx24("span", { className: "rs-sr-only", role: "status", children: error ? "Couldn't load balances" : "Loading balances\u2026" }),
4616
- /* @__PURE__ */ jsxs20("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
4617
- /* @__PURE__ */ jsx24(
5025
+ return /* @__PURE__ */ jsxs22("div", { className: "rs-screen", "aria-busy": error ? "false" : "true", children: [
5026
+ /* @__PURE__ */ jsx26("span", { className: "rs-sr-only", role: "status", children: error ? "Couldn't load balances" : "Loading balances\u2026" }),
5027
+ /* @__PURE__ */ jsxs22("div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
5028
+ /* @__PURE__ */ jsx26(
4618
5029
  BodyHeader,
4619
5030
  {
4620
- icon: /* @__PURE__ */ jsx24(WalletIcon, {}),
5031
+ icon: /* @__PURE__ */ jsx26(WalletIcon, {}),
4621
5032
  title: `Transfer from ${sourceLabel}`,
4622
5033
  subtitle: "Pick the balance to import"
4623
5034
  }
4624
5035
  ),
4625
- error ? /* @__PURE__ */ jsx24("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsxs20("div", { className: "rs-loading-text", children: [
4626
- /* @__PURE__ */ jsx24("div", { className: "rs-loading-title rs-text-error", children: "Couldn\u2019t load your balances" }),
4627
- /* @__PURE__ */ jsx24("div", { className: "rs-loading-subtitle", children: "Check your connection and try again." })
4628
- ] }) }) : /* @__PURE__ */ jsx24("div", { className: "rs-asset-list", "aria-hidden": "true", children: Array.from({ length: rowCount }, (_, index) => /* @__PURE__ */ jsxs20(
5036
+ error ? /* @__PURE__ */ jsx26("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsxs22("div", { className: "rs-loading-text", children: [
5037
+ /* @__PURE__ */ jsx26("div", { className: "rs-loading-title rs-text-error", children: "Couldn\u2019t load your balances" }),
5038
+ /* @__PURE__ */ jsx26("div", { className: "rs-loading-subtitle", children: "Check your connection and try again." })
5039
+ ] }) }) : /* @__PURE__ */ jsx26("div", { className: "rs-asset-list", "aria-hidden": "true", children: Array.from({ length: rowCount }, (_, index) => /* @__PURE__ */ jsxs22(
4629
5040
  "div",
4630
5041
  {
4631
5042
  className: "rs-asset-row rs-asset-row--skeleton",
4632
5043
  children: [
4633
- /* @__PURE__ */ jsxs20("div", { className: "rs-asset-info", children: [
4634
- /* @__PURE__ */ jsxs20("div", { className: "rs-asset-icon-wrapper", children: [
4635
- /* @__PURE__ */ jsx24("span", { className: "rs-asset-icon", children: /* @__PURE__ */ jsx24("span", { className: "rs-skeleton rs-skeleton-fill" }) }),
4636
- /* @__PURE__ */ jsx24("span", { className: "rs-asset-chain-badge", children: /* @__PURE__ */ jsx24("span", { className: "rs-skeleton rs-skeleton-fill" }) })
5044
+ /* @__PURE__ */ jsxs22("div", { className: "rs-asset-info", children: [
5045
+ /* @__PURE__ */ jsxs22("div", { className: "rs-asset-icon-wrapper", children: [
5046
+ /* @__PURE__ */ jsx26("span", { className: "rs-asset-icon", children: /* @__PURE__ */ jsx26("span", { className: "rs-skeleton rs-skeleton-fill" }) }),
5047
+ /* @__PURE__ */ jsx26("span", { className: "rs-asset-chain-badge", children: /* @__PURE__ */ jsx26("span", { className: "rs-skeleton rs-skeleton-fill" }) })
4637
5048
  ] }),
4638
- /* @__PURE__ */ jsxs20("div", { className: "rs-asset-text", children: [
4639
- /* @__PURE__ */ jsx24("div", { className: "rs-asset-name-row", children: /* @__PURE__ */ jsx24("span", { className: "rs-skeleton rs-skeleton-text rs-skeleton-text--name" }) }),
4640
- /* @__PURE__ */ jsx24("div", { className: "rs-asset-balance-small", children: /* @__PURE__ */ jsx24("span", { className: "rs-skeleton rs-skeleton-text rs-skeleton-text--balance" }) })
5049
+ /* @__PURE__ */ jsxs22("div", { className: "rs-asset-text", children: [
5050
+ /* @__PURE__ */ jsx26("div", { className: "rs-asset-name-row", children: /* @__PURE__ */ jsx26("span", { className: "rs-skeleton rs-skeleton-text rs-skeleton-text--name" }) }),
5051
+ /* @__PURE__ */ jsx26("div", { className: "rs-asset-balance-small", children: /* @__PURE__ */ jsx26("span", { className: "rs-skeleton rs-skeleton-text rs-skeleton-text--balance" }) })
4641
5052
  ] })
4642
5053
  ] }),
4643
- /* @__PURE__ */ jsx24("div", { className: "rs-asset-balance", children: /* @__PURE__ */ jsx24("span", { className: "rs-skeleton rs-skeleton-text rs-skeleton-text--usd" }) })
5054
+ /* @__PURE__ */ jsx26("div", { className: "rs-asset-balance", children: /* @__PURE__ */ jsx26("span", { className: "rs-skeleton rs-skeleton-text rs-skeleton-text--usd" }) })
4644
5055
  ]
4645
5056
  },
4646
5057
  index
4647
5058
  )) })
4648
5059
  ] }),
4649
- error && onRetry && /* @__PURE__ */ jsx24("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx24(
5060
+ error && onRetry && /* @__PURE__ */ jsx26("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx26(
4650
5061
  "button",
4651
5062
  {
4652
5063
  type: "button",
4653
5064
  className: "rs-button rs-button--default rs-button--full-width",
4654
5065
  onClick: onRetry,
4655
- children: /* @__PURE__ */ jsx24("span", { children: "Try again" })
5066
+ children: /* @__PURE__ */ jsx26("span", { children: "Try again" })
4656
5067
  }
4657
5068
  ) }),
4658
- /* @__PURE__ */ jsx24(PoweredBy, {})
5069
+ /* @__PURE__ */ jsx26(PoweredBy, {})
4659
5070
  ] });
4660
5071
  }
4661
5072
  DappImportAssetSelectSkeleton.displayName = "DappImportAssetSelectSkeleton";
@@ -4833,7 +5244,7 @@ function toImportableAssets(positions) {
4833
5244
  for (const position of positions) {
4834
5245
  const chainId = parseEvmChainId(position.chain);
4835
5246
  if (chainId === null) continue;
4836
- if (!CHAIN_BY_ID[chainId]) continue;
5247
+ if (!SUPPORTED_CHAIN_IDS.includes(chainId)) continue;
4837
5248
  if (BigInt(position.maxWithdrawable) <= 0n) continue;
4838
5249
  if (position.constraints.some((c) => POLICY_REFUSED.includes(c))) continue;
4839
5250
  assets.push(buildAsset(position, chainId));
@@ -4900,7 +5311,7 @@ function withdrawableUsd(position) {
4900
5311
  }
4901
5312
 
4902
5313
  // src/core/dapp-imports/polymarket/index.ts
4903
- import { formatUnits as formatUnits6 } from "viem";
5314
+ import { formatUnits as formatUnits5 } from "viem";
4904
5315
 
4905
5316
  // src/core/dapp-imports/polymarket/deposit-wallet.ts
4906
5317
  import {
@@ -4947,6 +5358,7 @@ async function detectPolymarketWalletKind(params) {
4947
5358
  const { publicClient, proxyWallet, eoa } = params;
4948
5359
  const results = await publicClient.multicall({
4949
5360
  allowFailure: true,
5361
+ multicallAddress: MULTICALL3_ADDRESS,
4950
5362
  contracts: [
4951
5363
  {
4952
5364
  address: proxyWallet,
@@ -5158,7 +5570,7 @@ function buildAsset2(params) {
5158
5570
  const isPusd = tokenKind === "pusd";
5159
5571
  const tokenAddress = isPusd ? POLYMARKET_PUSD_ADDRESS : POLYMARKET_USDCE_ADDRESS;
5160
5572
  const symbol = isPusd ? "pUSD" : "USDC.e";
5161
- const balanceUsd = Number(formatUnits6(balance, 6));
5573
+ const balanceUsd = Number(formatUnits5(balance, 6));
5162
5574
  const metadata = { proxyWallet, tokenKind, walletKind };
5163
5575
  return {
5164
5576
  id: `polymarket:${tokenKind}`,
@@ -5247,9 +5659,6 @@ function bootRetryPlan(params) {
5247
5659
  };
5248
5660
  }
5249
5661
 
5250
- // src/DepositFlow.tsx
5251
- import { base } from "viem/chains";
5252
-
5253
5662
  // src/store/index.ts
5254
5663
  import { createContext, createElement, useContext } from "react";
5255
5664
  import { useStore } from "zustand";
@@ -5289,6 +5698,7 @@ function createInitialState(overrides) {
5289
5698
  sourceSymbol: null,
5290
5699
  sourceDecimals: null,
5291
5700
  selectedAsset: null,
5701
+ qrSource: null,
5292
5702
  selectedSolanaToken: null,
5293
5703
  amount: null,
5294
5704
  targetAmount: null,
@@ -5304,6 +5714,7 @@ function createInitialState(overrides) {
5304
5714
  targetChain: null,
5305
5715
  targetToken: null,
5306
5716
  directTransfer: false,
5717
+ sourceTxHashPending: false,
5307
5718
  swappedContext: null,
5308
5719
  initialEvent: null,
5309
5720
  quote: null
@@ -5340,6 +5751,7 @@ function unreachable(action) {
5340
5751
  }
5341
5752
  var RESET_DEPOSIT_FIELDS = {
5342
5753
  selectedAsset: null,
5754
+ qrSource: null,
5343
5755
  selectedSolanaToken: null,
5344
5756
  amount: null,
5345
5757
  targetAmount: null,
@@ -5391,6 +5803,34 @@ function applyBack(state, hasWalletOptions) {
5391
5803
  },
5392
5804
  flow: { ...state.flow, step: "amount", hasNavigatedBack: true }
5393
5805
  };
5806
+ // The QR detour unwinds to where it started, not into the wallet flow's
5807
+ // asset picker — there is no connected wallet behind it to pick from.
5808
+ case "qr-amount":
5809
+ return {
5810
+ ...state,
5811
+ deposit: {
5812
+ ...state.deposit,
5813
+ amount: null,
5814
+ targetAmount: null,
5815
+ targetTokenPriceUsd: null,
5816
+ inputAmountUsd: null
5817
+ },
5818
+ flow: {
5819
+ ...state.flow,
5820
+ step: "deposit-address",
5821
+ hasNavigatedBack: true
5822
+ }
5823
+ };
5824
+ case "qr-review":
5825
+ return {
5826
+ ...state,
5827
+ deposit: {
5828
+ ...state.deposit,
5829
+ targetAmount: null,
5830
+ targetTokenPriceUsd: null
5831
+ },
5832
+ flow: { ...state.flow, step: "qr-amount", hasNavigatedBack: true }
5833
+ };
5394
5834
  case "solana-amount":
5395
5835
  return {
5396
5836
  ...state,
@@ -5827,6 +6267,51 @@ function applyAction(state, action) {
5827
6267
  },
5828
6268
  flow: { ...state.flow, step: "confirm" }
5829
6269
  };
6270
+ case "qr/review-requested":
6271
+ return {
6272
+ ...state,
6273
+ deposit: {
6274
+ ...state.deposit,
6275
+ selectedAsset: action.asset,
6276
+ qrSource: {
6277
+ chainId: action.asset.chainId,
6278
+ symbol: action.asset.symbol
6279
+ },
6280
+ amount: null,
6281
+ targetAmount: null,
6282
+ targetTokenPriceUsd: null,
6283
+ // No wallet, so no balance to read. Explicitly cleared rather than
6284
+ // carried: a stale figure from an earlier wallet flow would gate the
6285
+ // amount input against a balance this source has nothing to do with.
6286
+ balance: null,
6287
+ inputAmountUsd: null
6288
+ },
6289
+ flow: { ...state.flow, step: "qr-amount" }
6290
+ };
6291
+ case "qr/amount-entered":
6292
+ return {
6293
+ ...state,
6294
+ deposit: {
6295
+ ...state.deposit,
6296
+ amount: action.amount,
6297
+ targetAmount: action.targetAmount,
6298
+ targetTokenPriceUsd: action.targetTokenPriceUsd,
6299
+ inputAmountUsd: action.targetAmount
6300
+ },
6301
+ flow: { ...state.flow, step: "qr-review" }
6302
+ };
6303
+ case "qr/review-closed":
6304
+ return {
6305
+ ...state,
6306
+ deposit: {
6307
+ ...state.deposit,
6308
+ amount: null,
6309
+ targetAmount: null,
6310
+ targetTokenPriceUsd: null,
6311
+ inputAmountUsd: null
6312
+ },
6313
+ flow: { ...state.flow, step: "deposit-address" }
6314
+ };
5830
6315
  case "solana/token-selected":
5831
6316
  return {
5832
6317
  ...state,
@@ -5885,6 +6370,7 @@ function applyAction(state, action) {
5885
6370
  targetChain: action.targetChain ?? state.processing.targetChain ?? state.deposit.targetChain,
5886
6371
  targetToken: action.targetToken ?? state.processing.targetToken ?? state.deposit.targetToken,
5887
6372
  directTransfer: action.directTransfer ?? false,
6373
+ sourceTxHashPending: action.sourceTxHashPending ?? false,
5888
6374
  swappedContext: action.swappedContext ?? null,
5889
6375
  initialEvent: action.initialEvent ?? null,
5890
6376
  quote: action.quote ?? null
@@ -6091,6 +6577,7 @@ function applyAction(state, action) {
6091
6577
  targetChain: null,
6092
6578
  targetToken: null,
6093
6579
  directTransfer: false,
6580
+ sourceTxHashPending: false,
6094
6581
  swappedContext: null,
6095
6582
  initialEvent: null,
6096
6583
  quote: null
@@ -6132,7 +6619,7 @@ function applyAction(state, action) {
6132
6619
  }
6133
6620
  };
6134
6621
  }
6135
- const nextStep = state.flow.step === "confirm" ? "amount" : state.flow.step;
6622
+ const nextStep = state.flow.step === "confirm" ? "amount" : state.flow.step === "qr-review" ? "qr-amount" : state.flow.step;
6136
6623
  return {
6137
6624
  ...state,
6138
6625
  deposit: {
@@ -6193,7 +6680,7 @@ function useDepositStore(selector) {
6193
6680
  }
6194
6681
 
6195
6682
  // src/DepositFlow.tsx
6196
- import { Fragment as Fragment5, jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
6683
+ import { Fragment as Fragment6, jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
6197
6684
  function swappedWidgetPrefetchKey(method, methodSelectionSource) {
6198
6685
  return JSON.stringify([methodSelectionSource ?? null, method ?? null]);
6199
6686
  }
@@ -6201,23 +6688,24 @@ function AccountPreparingSkeleton({
6201
6688
  errorMessage,
6202
6689
  onRetry
6203
6690
  }) {
6204
- return /* @__PURE__ */ jsxs21("div", { className: "rs-step", children: [
6205
- /* @__PURE__ */ jsx25("div", { className: "rs-step-body", style: { paddingTop: 0 }, children: /* @__PURE__ */ jsx25("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsx25("div", { className: "rs-loading-text", children: errorMessage ? /* @__PURE__ */ jsxs21(Fragment5, { children: [
6206
- /* @__PURE__ */ jsx25("div", { className: "rs-loading-title rs-text-error", children: "Couldn\u2019t prepare account" }),
6207
- /* @__PURE__ */ jsx25("div", { className: "rs-loading-subtitle", children: errorMessage })
6208
- ] }) : /* @__PURE__ */ jsx25("div", { className: "rs-loading-title", children: "Preparing\u2026" }) }) }) }),
6209
- errorMessage && onRetry && /* @__PURE__ */ jsx25("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx25(
6691
+ return /* @__PURE__ */ jsxs23("div", { className: "rs-step", children: [
6692
+ /* @__PURE__ */ jsx27("div", { className: "rs-step-body", style: { paddingTop: 0 }, children: /* @__PURE__ */ jsx27("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsx27("div", { className: "rs-loading-text", children: errorMessage ? /* @__PURE__ */ jsxs23(Fragment6, { children: [
6693
+ /* @__PURE__ */ jsx27("div", { className: "rs-loading-title rs-text-error", children: "Couldn\u2019t prepare account" }),
6694
+ /* @__PURE__ */ jsx27("div", { className: "rs-loading-subtitle", children: errorMessage })
6695
+ ] }) : /* @__PURE__ */ jsx27("div", { className: "rs-loading-title", children: "Preparing\u2026" }) }) }) }),
6696
+ errorMessage && onRetry && /* @__PURE__ */ jsx27("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx27(
6210
6697
  "button",
6211
6698
  {
6212
6699
  type: "button",
6213
6700
  className: "rs-button rs-button--default rs-button--full-width",
6214
6701
  onClick: onRetry,
6215
- children: /* @__PURE__ */ jsx25("span", { children: "Try again" })
6702
+ children: /* @__PURE__ */ jsx27("span", { children: "Try again" })
6216
6703
  }
6217
6704
  ) })
6218
6705
  ] });
6219
6706
  }
6220
6707
  var DAPP_IMPORT_RESOLVE_TIMEOUT_MS = 1e4;
6708
+ var DEFAULT_SETUP_CHAIN_ID = 8453;
6221
6709
  var SWAPPED_SOURCE_CHAIN = 8453;
6222
6710
  var SWAPPED_SOURCE_TOKEN = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
6223
6711
  var SWAPPED_SOURCE_DECIMALS = 6;
@@ -6286,7 +6774,8 @@ function deriveStep(flow, d, p, activeEntry, fiat, exchange) {
6286
6774
  return {
6287
6775
  type: "deposit-address",
6288
6776
  smartAccount,
6289
- solanaDepositAddress: solanaDepositAddress ?? void 0
6777
+ solanaDepositAddress: solanaDepositAddress ?? void 0,
6778
+ qrSource: d.qrSource ?? void 0
6290
6779
  };
6291
6780
  case "fiat-onramp":
6292
6781
  if (!committedAccount) return { type: "setup" };
@@ -6332,6 +6821,26 @@ function deriveStep(flow, d, p, activeEntry, fiat, exchange) {
6332
6821
  targetTokenPriceUsd: d.targetTokenPriceUsd,
6333
6822
  balance: d.balance ?? void 0
6334
6823
  };
6824
+ case "qr-amount":
6825
+ if (!smartAccount || !d.selectedAsset) return { type: "setup" };
6826
+ return {
6827
+ type: "qr-amount",
6828
+ smartAccount,
6829
+ asset: d.selectedAsset,
6830
+ inputAmountUsd: d.inputAmountUsd ?? void 0
6831
+ };
6832
+ case "qr-review":
6833
+ if (!smartAccount || !d.selectedAsset || !d.amount || !d.targetAmount) {
6834
+ return { type: "setup" };
6835
+ }
6836
+ return {
6837
+ type: "qr-review",
6838
+ smartAccount,
6839
+ asset: d.selectedAsset,
6840
+ amount: d.amount,
6841
+ targetAmount: d.targetAmount,
6842
+ targetTokenPriceUsd: d.targetTokenPriceUsd
6843
+ };
6335
6844
  case "solana-token-select":
6336
6845
  if (!smartAccount || !solanaDepositAddress) return { type: "setup" };
6337
6846
  return {
@@ -6398,6 +6907,7 @@ function deriveStep(flow, d, p, activeEntry, fiat, exchange) {
6398
6907
  sourceDecimals: d.sourceDecimals ?? void 0,
6399
6908
  inputAmountUsd: d.inputAmountUsd ?? void 0,
6400
6909
  directTransfer: p.directTransfer,
6910
+ sourceTxHashPending: p.sourceTxHashPending,
6401
6911
  swappedContext: p.swappedContext ?? void 0,
6402
6912
  initialEvent: p.initialEvent ?? void 0,
6403
6913
  quote: p.quote ?? void 0
@@ -6441,9 +6951,10 @@ function DepositFlow({
6441
6951
  enableWallet = true,
6442
6952
  enableFiatOnramp = false,
6443
6953
  enableQrTransfer = true,
6954
+ enableGaslessDeposit = false,
6444
6955
  fiatMethods,
6445
6956
  enableExchangeConnect = false,
6446
- reownWallet,
6957
+ walletSession,
6447
6958
  onConnect,
6448
6959
  onDisconnect,
6449
6960
  onRequestConnect,
@@ -6452,6 +6963,8 @@ function DepositFlow({
6452
6963
  appFeesResolved,
6453
6964
  onStepChange,
6454
6965
  onSwappedImmersiveChange,
6966
+ openExternally,
6967
+ onSubmittingChange,
6455
6968
  onClose,
6456
6969
  onLifecycle,
6457
6970
  onEvent,
@@ -6474,7 +6987,7 @@ function DepositFlow({
6474
6987
  const flowMode = flowSlice.mode;
6475
6988
  const isConnectSelectionConfirmed = flowSlice.isConnectSelectionConfirmed;
6476
6989
  const selectedWalletId = useDepositStore(selectedWalletIdSelector);
6477
- const [totalBalanceUsd, setTotalBalanceUsd] = useState12(0);
6990
+ const [totalBalanceUsd, setTotalBalanceUsd] = useState13(0);
6478
6991
  const stableWalletSignerRef = useRef8(null);
6479
6992
  const stableWalletSelectionKeyRef = useRef8(null);
6480
6993
  const logFlow = useCallback7(
@@ -6490,7 +7003,7 @@ function DepositFlow({
6490
7003
  [debug]
6491
7004
  );
6492
7005
  const enableSwappedPreconnect = enableFiatOnramp || enableExchangeConnect;
6493
- useEffect11(() => {
7006
+ useEffect12(() => {
6494
7007
  if (!enableSwappedPreconnect) return;
6495
7008
  if (typeof document === "undefined") return;
6496
7009
  const links = [];
@@ -6528,27 +7041,27 @@ function DepositFlow({
6528
7041
  });
6529
7042
  seen.add(id);
6530
7043
  }
6531
- if (reownWallet?.isConnected && reownWallet.isSolana && reownWallet.solanaAddress) {
6532
- const id = reownWallet.caipAddress ?? `solana:${reownWallet.solanaAddress}`;
7044
+ if (walletSession?.isConnected && walletSession.isSolana && walletSession.solanaAddress) {
7045
+ const id = walletSession.caipAddress ?? `solana:${walletSession.solanaAddress}`;
6533
7046
  if (!seen.has(id)) {
6534
7047
  options.push({
6535
7048
  id,
6536
- solanaAddress: reownWallet.solanaAddress,
7049
+ solanaAddress: walletSession.solanaAddress,
6537
7050
  label: "Solana Wallet",
6538
7051
  kind: "solana",
6539
- icon: reownWallet.icon
7052
+ icon: walletSession.icon
6540
7053
  });
6541
7054
  seen.add(id);
6542
7055
  }
6543
- } else if (reownWallet?.address && reownWallet.isConnected && reownWallet.walletClient && reownWallet.publicClient && !seen.has(`evm:${reownWallet.address.toLowerCase()}`)) {
6544
- const id = `evm:${reownWallet.address.toLowerCase()}`;
7056
+ } else if (walletSession?.address && walletSession.isConnected && walletSession.canSignEvm && !seen.has(`evm:${walletSession.address.toLowerCase()}`)) {
7057
+ const id = `evm:${walletSession.address.toLowerCase()}`;
6545
7058
  if (!seen.has(id)) {
6546
7059
  options.push({
6547
7060
  id,
6548
- address: reownWallet.address,
7061
+ address: walletSession.address,
6549
7062
  label: "External Wallet",
6550
7063
  kind: "external",
6551
- icon: reownWallet.icon
7064
+ icon: walletSession.icon
6552
7065
  });
6553
7066
  seen.add(id);
6554
7067
  }
@@ -6556,14 +7069,13 @@ function DepositFlow({
6556
7069
  return options;
6557
7070
  }, [
6558
7071
  connectedWalletAddress,
6559
- reownWallet?.address,
6560
- reownWallet?.isConnected,
6561
- reownWallet?.walletClient,
6562
- reownWallet?.publicClient,
6563
- reownWallet?.icon,
6564
- reownWallet?.isSolana,
6565
- reownWallet?.solanaAddress,
6566
- reownWallet?.caipAddress
7072
+ walletSession?.address,
7073
+ walletSession?.isConnected,
7074
+ walletSession?.canSignEvm,
7075
+ walletSession?.icon,
7076
+ walletSession?.isSolana,
7077
+ walletSession?.solanaAddress,
7078
+ walletSession?.caipAddress
6567
7079
  ]);
6568
7080
  const offeredFiatMethods = useMemo7(
6569
7081
  () => fiatMethods ? FIAT_ONRAMP_METHODS.filter((m) => fiatMethods[m.method]) : FIAT_ONRAMP_METHODS,
@@ -6583,14 +7095,14 @@ function DepositFlow({
6583
7095
  hasEnabledAssetMigration
6584
7096
  ].filter(Boolean).length;
6585
7097
  const canAutoLock = Boolean(
6586
- enableWallet && walletClientProp?.account && !reownWallet && enabledFeatureCount === 1
7098
+ enableWallet && walletClientProp?.account && !walletSession && enabledFeatureCount === 1
6587
7099
  );
6588
7100
  const hasWalletOptions = enableWallet && walletOptions.length > 0;
6589
7101
  const hasReownSession = Boolean(
6590
- reownWallet?.isConnected || reownWallet?.address
7102
+ walletSession?.isConnected || walletSession?.address
6591
7103
  );
6592
7104
  const isDappImportWalletHydrating = Boolean(
6593
- hasWalletClientProp && walletClientProp === void 0 || reownWallet && !hasReownSession && !reownWallet.isReady
7105
+ hasWalletClientProp && walletClientProp === void 0 || walletSession && !hasReownSession && !walletSession.isReady
6594
7106
  );
6595
7107
  const showConnectStep = flowMode === null && !isConnectSelectionConfirmed;
6596
7108
  const walletSelectionKey = useMemo7(() => {
@@ -6607,12 +7119,12 @@ function DepositFlow({
6607
7119
  isConnectSelectionConfirmed,
6608
7120
  selectedWalletId
6609
7121
  ]);
6610
- const setupChainId = typeof targetChain === "number" && !isVirtualDestination(targetChain) ? targetChain : typeof defaultSourceChain === "number" ? defaultSourceChain : base.id;
7122
+ const setupChainId = typeof targetChain === "number" && !isVirtualDestination(targetChain) ? targetChain : typeof defaultSourceChain === "number" ? defaultSourceChain : DEFAULT_SETUP_CHAIN_ID;
6611
7123
  const targetChainId = targetChainToChainId(targetChain);
6612
7124
  const targetSymbol = getTargetTokenSymbol(targetToken, targetChainId);
6613
7125
  const isTargetStablecoin = isStablecoinSymbol(targetSymbol);
6614
7126
  const targetMarketPriceRef = useRef8(null);
6615
- useEffect11(() => {
7127
+ useEffect12(() => {
6616
7128
  targetMarketPriceRef.current = null;
6617
7129
  if (isTargetStablecoin || targetSymbol === "Token") {
6618
7130
  return;
@@ -6660,12 +7172,12 @@ function DepositFlow({
6660
7172
  switchChain: dappSwitchChain
6661
7173
  };
6662
7174
  }
6663
- if (selectedOption.kind === "external" && reownWallet?.address && selectedOption.address && reownWallet.address.toLowerCase() === selectedOption.address.toLowerCase()) {
7175
+ if (selectedOption.kind === "external" && walletSession?.address && selectedOption.address && walletSession.address.toLowerCase() === selectedOption.address.toLowerCase()) {
6664
7176
  return {
6665
- ownerAddress: reownWallet.address,
6666
- walletClient: reownWallet.walletClient,
6667
- publicClient: reownWallet.publicClient ?? getPublicClient(setupChainId, rpcUrls),
6668
- switchChain: reownWallet.switchChain
7177
+ ownerAddress: walletSession.address,
7178
+ walletClient: walletSession.walletClient,
7179
+ publicClient: walletSession.publicClient ?? getPublicClient(setupChainId, rpcUrls),
7180
+ switchChain: walletSession.switchChain
6669
7181
  };
6670
7182
  }
6671
7183
  return null;
@@ -6677,11 +7189,20 @@ function DepositFlow({
6677
7189
  walletClientProp,
6678
7190
  publicClientProp,
6679
7191
  dappSwitchChain,
6680
- reownWallet,
7192
+ walletSession,
7193
+ // A viem client is bound to its account and chain at construction, so a new
7194
+ // one IS the signal that the signing target moved — which is why this
7195
+ // stays, even though the picker no longer reads the client's presence as
7196
+ // the capability. A session with a stable identity (the bridged one keeps
7197
+ // one deliberately, and exposes the client through a getter) changes
7198
+ // nothing else here when the host switches chain, and the context would go
7199
+ // on holding a client bound to the old one: `chainMismatch` never clears
7200
+ // and the CTA stays disabled with nothing beside it.
7201
+ walletSession?.walletClient,
6681
7202
  setupChainId,
6682
7203
  rpcUrls
6683
7204
  ]);
6684
- useEffect11(() => {
7205
+ useEffect12(() => {
6685
7206
  if (flowMode !== "wallet" && flowMode !== "dapp-import") {
6686
7207
  stableWalletSelectionKeyRef.current = null;
6687
7208
  stableWalletSignerRef.current = null;
@@ -6727,15 +7248,15 @@ function DepositFlow({
6727
7248
  }, [selectedWalletId, walletOptions]);
6728
7249
  const dappImportOwner = useMemo7(() => {
6729
7250
  if (selectedEvmWalletOwner) return selectedEvmWalletOwner;
6730
- if (reownWallet?.address && reownWallet.isConnected) {
6731
- return reownWallet.address;
7251
+ if (walletSession?.address && walletSession.isConnected) {
7252
+ return walletSession.address;
6732
7253
  }
6733
7254
  if (connectedWalletAddress) return connectedWalletAddress;
6734
7255
  return null;
6735
7256
  }, [
6736
7257
  selectedEvmWalletOwner,
6737
- reownWallet?.address,
6738
- reownWallet?.isConnected,
7258
+ walletSession?.address,
7259
+ walletSession?.isConnected,
6739
7260
  connectedWalletAddress
6740
7261
  ]);
6741
7262
  const activeOwner = useMemo7(
@@ -6754,7 +7275,7 @@ function DepositFlow({
6754
7275
  );
6755
7276
  const activeEntry = setupSlice;
6756
7277
  const lastSmartAccountLifecycleKeyRef = useRef8(null);
6757
- useEffect11(() => {
7278
+ useEffect12(() => {
6758
7279
  if (activeEntry.status !== "ready" || !activeEntry.smartAccount) return;
6759
7280
  const lifecycleKey = [
6760
7281
  activeEntry.smartAccount.toLowerCase(),
@@ -6774,7 +7295,7 @@ function DepositFlow({
6774
7295
  onLifecycleRef
6775
7296
  ]);
6776
7297
  const lastConnectedLifecycleKeyRef = useRef8(null);
6777
- useEffect11(() => {
7298
+ useEffect12(() => {
6778
7299
  if (!flowMode || !isConnectSelectionConfirmed) {
6779
7300
  lastConnectedLifecycleKeyRef.current = null;
6780
7301
  return;
@@ -6825,21 +7346,44 @@ function DepositFlow({
6825
7346
  const handleBack = useCallback7(() => {
6826
7347
  storeApi.dispatch({
6827
7348
  type: "back/requested",
6828
- hasWalletOptions: hasWalletOptions || Boolean(reownWallet)
7349
+ hasWalletOptions: hasWalletOptions || Boolean(walletSession)
6829
7350
  });
6830
- }, [storeApi, hasWalletOptions, reownWallet]);
6831
- const canGoBackFromHere = effectiveStep.type === "deposit-address" || effectiveStep.type === "solana-token-select" || effectiveStep.type === "solana-amount" || effectiveStep.type === "solana-confirm" || effectiveStep.type === "amount" || effectiveStep.type === "confirm" || // Escape hatch from a slow or stuck pre-routed resolve. Mode-gated so
7351
+ }, [storeApi, hasWalletOptions, walletSession]);
7352
+ const qrSourceAsset = effectiveStep.type === "qr-amount" ? effectiveStep.asset : null;
7353
+ const qrSourceKey = qrSourceAsset ? `${qrSourceAsset.chainId}:${qrSourceAsset.token}` : null;
7354
+ const [qrSourcePrice, setQrSourcePrice] = useState13({ resolved: false, usd: null });
7355
+ useEffect12(() => {
7356
+ setQrSourcePrice({ resolved: false, usd: null });
7357
+ if (!qrSourceAsset) return;
7358
+ let cancelled = false;
7359
+ fetchTokenPriceUsd(service, {
7360
+ chainId: qrSourceAsset.chainId,
7361
+ address: qrSourceAsset.token,
7362
+ symbol: qrSourceAsset.symbol
7363
+ }).then((usd) => {
7364
+ if (!cancelled) setQrSourcePrice({ resolved: true, usd });
7365
+ }).catch(() => {
7366
+ if (!cancelled) setQrSourcePrice({ resolved: true, usd: null });
7367
+ });
7368
+ return () => {
7369
+ cancelled = true;
7370
+ };
7371
+ }, [service, qrSourceKey]);
7372
+ const canGoBackFromHere = effectiveStep.type === "deposit-address" || effectiveStep.type === "solana-token-select" || effectiveStep.type === "solana-amount" || effectiveStep.type === "solana-confirm" || effectiveStep.type === "amount" || effectiveStep.type === "confirm" || // Without these the QR detour has no exit but the modal's close button,
7373
+ // which drops the user out of the deposit entirely rather than back to
7374
+ // the address they came from.
7375
+ effectiveStep.type === "qr-amount" || effectiveStep.type === "qr-review" || // Escape hatch from a slow or stuck pre-routed resolve. Mode-gated so
6832
7376
  // the chevron doesn't linger if a disconnect cleared the mode out from
6833
7377
  // under the step.
6834
7378
  effectiveStep.type === "dapp-import-resolving" && flowMode === "dapp-import" || effectiveStep.type === "dapp-import-select" || effectiveStep.type === "dapp-import-asset-select" || effectiveStep.type === "fiat-onramp" || effectiveStep.type === "exchange-select" || effectiveStep.type === "exchange-connect" || effectiveStep.type === "select-asset" && signerContext && !canAutoLock;
6835
7379
  const currentBackHandler = canGoBackFromHere ? handleBack : void 0;
6836
7380
  const currentScreen = showConnectStep ? "connect" : effectiveStep.type;
6837
- useEffect11(() => {
7381
+ useEffect12(() => {
6838
7382
  onStepChangeRef.current?.(currentBackHandler, currentScreen);
6839
7383
  }, [currentBackHandler, currentScreen, onStepChangeRef]);
6840
7384
  const lastModalHeightRef = useRef8(0);
6841
7385
  const modalContentElRef = useRef8(null);
6842
- useEffect11(() => {
7386
+ useEffect12(() => {
6843
7387
  const mc = document.querySelector(".rs-modal-content");
6844
7388
  if (!mc) return;
6845
7389
  modalContentElRef.current = mc;
@@ -6876,7 +7420,7 @@ function DepositFlow({
6876
7420
  const stepSendToken = effectiveStep.type === "amount" ? effectiveStep.asset.symbol : null;
6877
7421
  const stepOpenEventKey = effectiveStep.type === "select-asset" ? "select-asset" : effectiveStep.type === "deposit-address" ? "deposit-address" : effectiveStep.type === "amount" && stepSendToken ? `amount:${stepSendToken.toLowerCase()}` : null;
6878
7422
  const lastStepOpenEventKeyRef = useRef8(null);
6879
- useEffect11(() => {
7423
+ useEffect12(() => {
6880
7424
  if (!stepOpenEventKey) {
6881
7425
  lastStepOpenEventKeyRef.current = null;
6882
7426
  return;
@@ -6918,7 +7462,7 @@ function DepositFlow({
6918
7462
  totalBalanceUsd,
6919
7463
  onEventRef
6920
7464
  ]);
6921
- useEffect11(() => {
7465
+ useEffect12(() => {
6922
7466
  logFlow("state:changed", {
6923
7467
  step: effectiveStep.type,
6924
7468
  flowMode,
@@ -6934,7 +7478,7 @@ function DepositFlow({
6934
7478
  targetChain,
6935
7479
  targetToken
6936
7480
  ]);
6937
- useEffect11(() => {
7481
+ useEffect12(() => {
6938
7482
  onLifecycleRef.current?.({
6939
7483
  type: "balance-changed",
6940
7484
  totalUsd: totalBalanceUsd
@@ -6961,7 +7505,7 @@ function DepositFlow({
6961
7505
  [walletOptions, storeApi]
6962
7506
  );
6963
7507
  const isSolanaWalletConnected = Boolean(
6964
- reownWallet?.isConnected && reownWallet?.isSolana
7508
+ walletSession?.isConnected && walletSession?.isSolana
6965
7509
  );
6966
7510
  const assetMigrationsKey = assetMigrations ? Object.keys(assetMigrations).filter((k) => assetMigrations[k]).sort().join(",") : "";
6967
7511
  const enabledDappImportProviders = useMemo7(
@@ -7003,7 +7547,7 @@ function DepositFlow({
7003
7547
  const dappImportAttemptNonce = useDepositStore(
7004
7548
  (s) => s.dappImport.attemptNonce
7005
7549
  );
7006
- useEffect11(() => {
7550
+ useEffect12(() => {
7007
7551
  if (!dappImportOwner || enabledDappImportProviders.length === 0) {
7008
7552
  storeApi.dispatch({ type: "dapp-import/availability-cleared" });
7009
7553
  return;
@@ -7125,8 +7669,8 @@ function DepositFlow({
7125
7669
  dappImportOwner
7126
7670
  ]);
7127
7671
  const isBootResolving = isDappImportMode && flowSlice.step === "dapp-import-resolving";
7128
- const [hasResolveDeadlinePassed, setHasResolveDeadlinePassed] = useState12(false);
7129
- useEffect11(() => {
7672
+ const [hasResolveDeadlinePassed, setHasResolveDeadlinePassed] = useState13(false);
7673
+ useEffect12(() => {
7130
7674
  setHasResolveDeadlinePassed(false);
7131
7675
  if (!isBootResolving || dappImportBootError) return;
7132
7676
  const timeout = window.setTimeout(() => {
@@ -7134,7 +7678,7 @@ function DepositFlow({
7134
7678
  }, DAPP_IMPORT_RESOLVE_TIMEOUT_MS);
7135
7679
  return () => window.clearTimeout(timeout);
7136
7680
  }, [isBootResolving, dappImportBootError]);
7137
- useEffect11(() => {
7681
+ useEffect12(() => {
7138
7682
  if (!isBootResolving || dappImportBootError) return;
7139
7683
  const providerId = activeDappImportProviderId;
7140
7684
  if (!providerId) return;
@@ -7350,19 +7894,19 @@ function DepositFlow({
7350
7894
  prefetchSwappedWidgetUrl
7351
7895
  ]
7352
7896
  );
7353
- useEffect11(() => {
7897
+ useEffect12(() => {
7354
7898
  swappedUrlPrefetchRef.current.clear();
7355
7899
  swappedConnectUrlRef.current.clear();
7356
7900
  acknowledgedConnectFeeRef.current.clear();
7357
7901
  }, [setupSlice.smartAccount]);
7358
7902
  const hasConfiguredFiatMethods = fiatMethods !== void 0;
7359
- const [regionalMethods, setRegionalMethods] = useState12({
7903
+ const [regionalMethods, setRegionalMethods] = useState13({
7360
7904
  status: "loading",
7361
7905
  country: null,
7362
7906
  methods: [],
7363
7907
  recommendedMethod: null
7364
7908
  });
7365
- useEffect11(() => {
7909
+ useEffect12(() => {
7366
7910
  if (!fiatEnabled || hasConfiguredFiatMethods) return;
7367
7911
  let cancelled = false;
7368
7912
  setRegionalMethods({
@@ -7417,7 +7961,7 @@ function DepositFlow({
7417
7961
  regionalMethods
7418
7962
  ]);
7419
7963
  const lastFiatMethodsRenderedEventRef = useRef8(null);
7420
- useEffect11(() => {
7964
+ useEffect12(() => {
7421
7965
  if (cashDisplay.kind !== "list") return;
7422
7966
  const emit = onEventRef.current;
7423
7967
  if (!emit) return;
@@ -7497,7 +8041,7 @@ function DepositFlow({
7497
8041
  );
7498
8042
  const desiredSetupRequestKey = computeRequestKey(setupInput);
7499
8043
  const setupReady = setupSlice.status === "ready" && setupSlice.requestKey === desiredSetupRequestKey;
7500
- useEffect11(() => {
8044
+ useEffect12(() => {
7501
8045
  void (async () => {
7502
8046
  const requestKey = computeRequestKey(setupInput);
7503
8047
  const cacheKey = computeCacheKey(setupInput);
@@ -7568,7 +8112,7 @@ function DepositFlow({
7568
8112
  // eslint-disable-next-line react-hooks/exhaustive-deps -- keyed on the stable id-join, not the walletOptions array identity
7569
8113
  [walletOptionsKey]
7570
8114
  );
7571
- useEffect11(() => {
8115
+ useEffect12(() => {
7572
8116
  storeApi.dispatch({
7573
8117
  type: "portfolio/reconciled",
7574
8118
  wallets: desiredPortfolios
@@ -7725,6 +8269,25 @@ function DepositFlow({
7725
8269
  },
7726
8270
  [targetToken, targetChain, storeApi, activeOwner]
7727
8271
  );
8272
+ const handleQrReviewRequested = useCallback7(
8273
+ (asset) => {
8274
+ storeApi.dispatch({ type: "qr/review-requested", asset });
8275
+ },
8276
+ [storeApi]
8277
+ );
8278
+ const handleQrAmountContinue = useCallback7(
8279
+ (amount, targetAmount) => {
8280
+ const targetSym = getTargetTokenSymbol(targetToken, targetChainId);
8281
+ const targetTokenPriceUsd = isStablecoinSymbol(targetSym) ? 1 : targetMarketPriceRef.current;
8282
+ storeApi.dispatch({
8283
+ type: "qr/amount-entered",
8284
+ amount,
8285
+ targetAmount,
8286
+ targetTokenPriceUsd
8287
+ });
8288
+ },
8289
+ [targetToken, targetChainId, storeApi]
8290
+ );
7728
8291
  const handleDepositSubmitted = useCallback7(
7729
8292
  (txHash, chainId, amount, token, quote, routed) => {
7730
8293
  logFlow("evm:submitted", {
@@ -7750,6 +8313,7 @@ function DepositFlow({
7750
8313
  sourceDecimals: asset?.decimals,
7751
8314
  inputAmountUsd: depositAtSubmit.inputAmountUsd ?? void 0,
7752
8315
  directTransfer: routed.directTransfer,
8316
+ sourceTxHashPending: routed.sourceTxHashPending,
7753
8317
  quote
7754
8318
  });
7755
8319
  },
@@ -7855,7 +8419,7 @@ function DepositFlow({
7855
8419
  const handleTotalBalanceComputed = useCallback7((total) => {
7856
8420
  setTotalBalanceUsd(total);
7857
8421
  }, []);
7858
- useEffect11(() => {
8422
+ useEffect12(() => {
7859
8423
  if (storeApi.getState().flow.mode) {
7860
8424
  return;
7861
8425
  }
@@ -7865,7 +8429,7 @@ function DepositFlow({
7865
8429
  storeApi.dispatch({ type: "flow/step-set", step: "connect" });
7866
8430
  }
7867
8431
  }, [walletOptionsKey]);
7868
- useEffect11(() => {
8432
+ useEffect12(() => {
7869
8433
  if (!showConnectStep && isConnectSelectionConfirmed && (flowMode === "wallet" || flowMode === "dapp-import") && flowSlice.step !== "dapp-import-resolving" && flowSlice.step !== "dapp-import-select" && !signerContext) {
7870
8434
  storeApi.dispatch({ type: "wallet/cleared" });
7871
8435
  }
@@ -7909,7 +8473,7 @@ function DepositFlow({
7909
8473
  storeApi.dispatch({ type: "setup/retry-requested" });
7910
8474
  }, [storeApi]);
7911
8475
  if (showConnectStep) {
7912
- return /* @__PURE__ */ jsx25("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx25(
8476
+ return /* @__PURE__ */ jsx27("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx27(
7913
8477
  ConnectStep,
7914
8478
  {
7915
8479
  walletRows,
@@ -7962,20 +8526,20 @@ function DepositFlow({
7962
8526
  ) });
7963
8527
  }
7964
8528
  if (isDepositAddressMode) {
7965
- return /* @__PURE__ */ jsxs21("div", { className: "rs-modal-body", children: [
7966
- effectiveStep.type === "setup" && (activeEntry.status === "error" ? /* @__PURE__ */ jsx25(
8529
+ return /* @__PURE__ */ jsxs23("div", { className: "rs-modal-body", children: [
8530
+ effectiveStep.type === "setup" && (activeEntry.status === "error" ? /* @__PURE__ */ jsx27(
7967
8531
  AccountPreparingSkeleton,
7968
8532
  {
7969
8533
  errorMessage: activeEntry.message ?? void 0,
7970
8534
  onRetry: () => handleRetrySetup()
7971
8535
  }
7972
- ) : /* @__PURE__ */ jsx25(
8536
+ ) : /* @__PURE__ */ jsx27(
7973
8537
  DepositAddressSkeleton,
7974
8538
  {
7975
8539
  uiConfig
7976
8540
  }
7977
8541
  )),
7978
- effectiveStep.type === "deposit-address" && /* @__PURE__ */ jsx25(
8542
+ effectiveStep.type === "deposit-address" && /* @__PURE__ */ jsx27(
7979
8543
  DepositAddressStep,
7980
8544
  {
7981
8545
  smartAccount: effectiveStep.smartAccount,
@@ -7984,6 +8548,7 @@ function DepositFlow({
7984
8548
  targetChain,
7985
8549
  targetToken,
7986
8550
  uiConfig,
8551
+ initialSource: effectiveStep.qrSource,
7987
8552
  onDepositSubmitted: handleDepositAddressSubmitted,
7988
8553
  onDepositComplete: handleDepositComplete,
7989
8554
  onDepositFailed: handleDepositFailed,
@@ -7998,28 +8563,59 @@ function DepositFlow({
7998
8563
  cta_name: "copy"
7999
8564
  });
8000
8565
  },
8566
+ onReviewDeposit: handleQrReviewRequested,
8001
8567
  onError: handleError,
8002
8568
  debug
8003
8569
  }
8570
+ ),
8571
+ effectiveStep.type === "qr-amount" && /* @__PURE__ */ jsx27(
8572
+ AmountStep,
8573
+ {
8574
+ asset: effectiveStep.asset,
8575
+ defaultAmount: effectiveStep.inputAmountUsd ?? defaultAmount,
8576
+ targetChain,
8577
+ targetToken,
8578
+ uiConfig,
8579
+ appBalanceUsd,
8580
+ service,
8581
+ tokenPriceUsdOverride: qrSourcePrice.usd ?? void 0,
8582
+ sourcePriceUnavailable: qrSourcePrice.resolved && qrSourcePrice.usd === null,
8583
+ title: "Amount to send",
8584
+ onContinue: handleQrAmountContinue
8585
+ }
8586
+ ),
8587
+ effectiveStep.type === "qr-review" && /* @__PURE__ */ jsx27(
8588
+ QrReviewStep,
8589
+ {
8590
+ smartAccount: effectiveStep.smartAccount,
8591
+ asset: effectiveStep.asset,
8592
+ amount: effectiveStep.amount,
8593
+ targetAmount: effectiveStep.targetAmount,
8594
+ targetTokenPriceUsd: effectiveStep.targetTokenPriceUsd,
8595
+ targetChain,
8596
+ targetToken,
8597
+ service,
8598
+ onClose: () => storeApi.dispatch({ type: "qr/review-closed" })
8599
+ }
8004
8600
  )
8005
8601
  ] });
8006
8602
  }
8007
8603
  if (isFiatOnrampMode) {
8008
- return /* @__PURE__ */ jsxs21(
8604
+ return /* @__PURE__ */ jsxs23(
8009
8605
  "div",
8010
8606
  {
8011
8607
  className: "rs-modal-body",
8012
8608
  "data-flow-mode": "fiat-onramp",
8013
8609
  "data-step-type": step.type,
8014
8610
  children: [
8015
- step.type === "setup" && /* @__PURE__ */ jsx25(
8611
+ step.type === "setup" && /* @__PURE__ */ jsx27(
8016
8612
  AccountPreparingSkeleton,
8017
8613
  {
8018
8614
  errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
8019
8615
  onRetry: activeEntry.status === "error" ? () => handleRetrySetup() : void 0
8020
8616
  }
8021
8617
  ),
8022
- step.type === "fiat-onramp" && /* @__PURE__ */ jsx25(
8618
+ step.type === "fiat-onramp" && /* @__PURE__ */ jsx27(
8023
8619
  FiatOnrampStep,
8024
8620
  {
8025
8621
  smartAccount: step.smartAccount,
@@ -8033,10 +8629,11 @@ function DepositFlow({
8033
8629
  }),
8034
8630
  onGoBack: handleBack,
8035
8631
  onError: handleError,
8036
- onImmersiveChange: onSwappedImmersiveChange
8632
+ onImmersiveChange: onSwappedImmersiveChange,
8633
+ openExternally
8037
8634
  }
8038
8635
  ),
8039
- step.type === "processing" && /* @__PURE__ */ jsx25(
8636
+ step.type === "processing" && /* @__PURE__ */ jsx27(
8040
8637
  ProcessingStep,
8041
8638
  {
8042
8639
  smartAccount: step.smartAccount,
@@ -8054,6 +8651,7 @@ function DepositFlow({
8054
8651
  quote: step.quote,
8055
8652
  service,
8056
8653
  directTransfer: step.directTransfer,
8654
+ sourceTxHashPending: step.sourceTxHashPending,
8057
8655
  initialEvent: step.initialEvent,
8058
8656
  isSwappedOrder: true,
8059
8657
  uiConfig,
@@ -8070,21 +8668,21 @@ function DepositFlow({
8070
8668
  );
8071
8669
  }
8072
8670
  if (isExchangeConnectMode) {
8073
- return /* @__PURE__ */ jsxs21(
8671
+ return /* @__PURE__ */ jsxs23(
8074
8672
  "div",
8075
8673
  {
8076
8674
  className: "rs-modal-body",
8077
8675
  "data-flow-mode": "exchange-connect",
8078
8676
  "data-step-type": step.type,
8079
8677
  children: [
8080
- step.type === "setup" && /* @__PURE__ */ jsx25(
8678
+ step.type === "setup" && /* @__PURE__ */ jsx27(
8081
8679
  AccountPreparingSkeleton,
8082
8680
  {
8083
8681
  errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
8084
8682
  onRetry: activeEntry.status === "error" ? () => handleRetrySetup() : void 0
8085
8683
  }
8086
8684
  ),
8087
- step.type === "exchange-select" && /* @__PURE__ */ jsx25(
8685
+ step.type === "exchange-select" && /* @__PURE__ */ jsx27(
8088
8686
  ExchangeSelectStep,
8089
8687
  {
8090
8688
  service,
@@ -8092,7 +8690,7 @@ function DepositFlow({
8092
8690
  onError: handleError
8093
8691
  }
8094
8692
  ),
8095
- step.type === "exchange-connect" && /* @__PURE__ */ jsx25(
8693
+ step.type === "exchange-connect" && /* @__PURE__ */ jsx27(
8096
8694
  ExchangeConnectStep,
8097
8695
  {
8098
8696
  smartAccount: step.smartAccount,
@@ -8105,10 +8703,11 @@ function DepositFlow({
8105
8703
  }),
8106
8704
  onGoBack: handleBack,
8107
8705
  onError: handleError,
8108
- onImmersiveChange: onSwappedImmersiveChange
8706
+ onImmersiveChange: onSwappedImmersiveChange,
8707
+ openExternally
8109
8708
  }
8110
8709
  ),
8111
- step.type === "processing" && /* @__PURE__ */ jsx25(
8710
+ step.type === "processing" && /* @__PURE__ */ jsx27(
8112
8711
  ProcessingStep,
8113
8712
  {
8114
8713
  smartAccount: step.smartAccount,
@@ -8126,6 +8725,7 @@ function DepositFlow({
8126
8725
  quote: step.quote,
8127
8726
  service,
8128
8727
  directTransfer: step.directTransfer,
8728
+ sourceTxHashPending: step.sourceTxHashPending,
8129
8729
  initialEvent: step.initialEvent,
8130
8730
  isSwappedOrder: true,
8131
8731
  uiConfig,
@@ -8142,17 +8742,17 @@ function DepositFlow({
8142
8742
  );
8143
8743
  }
8144
8744
  if (isSolanaWalletMode) {
8145
- const solanaAddr = reownWallet?.solanaAddress;
8146
- const solanaProvider = reownWallet?.solanaProvider;
8147
- return /* @__PURE__ */ jsxs21("div", { className: "rs-modal-body", children: [
8148
- effectiveStep.type === "setup" && /* @__PURE__ */ jsx25(
8745
+ const solanaAddr = walletSession?.solanaAddress;
8746
+ const solanaProvider = walletSession?.solanaProvider;
8747
+ return /* @__PURE__ */ jsxs23("div", { className: "rs-modal-body", children: [
8748
+ effectiveStep.type === "setup" && /* @__PURE__ */ jsx27(
8149
8749
  AccountPreparingSkeleton,
8150
8750
  {
8151
8751
  errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
8152
8752
  onRetry: activeEntry.status === "error" ? () => handleRetrySetup() : void 0
8153
8753
  }
8154
8754
  ),
8155
- effectiveStep.type === "solana-token-select" && solanaAddr && /* @__PURE__ */ jsx25(
8755
+ effectiveStep.type === "solana-token-select" && solanaAddr && /* @__PURE__ */ jsx27(
8156
8756
  SolanaTokenSelectStep,
8157
8757
  {
8158
8758
  solanaAddress: solanaAddr,
@@ -8166,7 +8766,7 @@ function DepositFlow({
8166
8766
  debug
8167
8767
  }
8168
8768
  ),
8169
- effectiveStep.type === "solana-amount" && /* @__PURE__ */ jsx25(
8769
+ effectiveStep.type === "solana-amount" && /* @__PURE__ */ jsx27(
8170
8770
  SolanaAmountStep,
8171
8771
  {
8172
8772
  token: effectiveStep.token,
@@ -8182,7 +8782,7 @@ function DepositFlow({
8182
8782
  debug
8183
8783
  }
8184
8784
  ),
8185
- effectiveStep.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */ jsx25(
8785
+ effectiveStep.type === "solana-confirm" && solanaAddr && solanaProvider ? /* @__PURE__ */ jsx27(
8186
8786
  SolanaConfirmStep,
8187
8787
  {
8188
8788
  smartAccount: effectiveStep.smartAccount,
@@ -8197,22 +8797,22 @@ function DepositFlow({
8197
8797
  targetToken,
8198
8798
  service,
8199
8799
  solanaProvider,
8200
- solanaConnection: reownWallet?.solanaConnection,
8800
+ solanaConnection: walletSession?.solanaConnection,
8201
8801
  uiConfig,
8202
8802
  onConfirm: handleSolanaConfirmed,
8203
8803
  onError: handleError,
8204
8804
  debug
8205
8805
  }
8206
- ) : effectiveStep.type === "solana-confirm" ? /* @__PURE__ */ jsxs21("div", { className: "rs-step", children: [
8207
- /* @__PURE__ */ jsxs21("div", { className: "rs-loading-state", children: [
8208
- /* @__PURE__ */ jsx25("div", { className: "rs-step-icon rs-step-icon--error", children: /* @__PURE__ */ jsx25(
8806
+ ) : effectiveStep.type === "solana-confirm" ? /* @__PURE__ */ jsxs23("div", { className: "rs-step", children: [
8807
+ /* @__PURE__ */ jsxs23("div", { className: "rs-loading-state", children: [
8808
+ /* @__PURE__ */ jsx27("div", { className: "rs-step-icon rs-step-icon--error", children: /* @__PURE__ */ jsx27(
8209
8809
  "svg",
8210
8810
  {
8211
8811
  viewBox: "0 0 24 24",
8212
8812
  fill: "none",
8213
8813
  stroke: "currentColor",
8214
8814
  strokeWidth: "2",
8215
- children: /* @__PURE__ */ jsx25(
8815
+ children: /* @__PURE__ */ jsx27(
8216
8816
  "path",
8217
8817
  {
8218
8818
  strokeLinecap: "round",
@@ -8222,22 +8822,22 @@ function DepositFlow({
8222
8822
  )
8223
8823
  }
8224
8824
  ) }),
8225
- /* @__PURE__ */ jsxs21("div", { className: "rs-loading-text", children: [
8226
- /* @__PURE__ */ jsx25("div", { className: "rs-loading-title rs-text-error", children: "Wallet disconnected" }),
8227
- /* @__PURE__ */ jsx25("div", { className: "rs-loading-subtitle", children: "Please reconnect your Solana wallet to continue." })
8825
+ /* @__PURE__ */ jsxs23("div", { className: "rs-loading-text", children: [
8826
+ /* @__PURE__ */ jsx27("div", { className: "rs-loading-title rs-text-error", children: "Wallet disconnected" }),
8827
+ /* @__PURE__ */ jsx27("div", { className: "rs-loading-subtitle", children: "Please reconnect your Solana wallet to continue." })
8228
8828
  ] })
8229
8829
  ] }),
8230
- /* @__PURE__ */ jsx25("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx25(
8830
+ /* @__PURE__ */ jsx27("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx27(
8231
8831
  "button",
8232
8832
  {
8233
8833
  type: "button",
8234
8834
  className: "rs-button rs-button--default rs-button--full-width",
8235
8835
  onClick: handleBack,
8236
- children: /* @__PURE__ */ jsx25("span", { children: "Go Back" })
8836
+ children: /* @__PURE__ */ jsx27("span", { children: "Go Back" })
8237
8837
  }
8238
8838
  ) })
8239
8839
  ] }) : null,
8240
- effectiveStep.type === "processing" && /* @__PURE__ */ jsx25(
8840
+ effectiveStep.type === "processing" && /* @__PURE__ */ jsx27(
8241
8841
  ProcessingStep,
8242
8842
  {
8243
8843
  smartAccount: effectiveStep.smartAccount,
@@ -8253,6 +8853,7 @@ function DepositFlow({
8253
8853
  amountUsd: effectiveStep.inputAmountUsd,
8254
8854
  service,
8255
8855
  directTransfer: effectiveStep.directTransfer,
8856
+ sourceTxHashPending: effectiveStep.sourceTxHashPending,
8256
8857
  initialEvent: effectiveStep.initialEvent,
8257
8858
  quote: effectiveStep.quote,
8258
8859
  onClose,
@@ -8266,13 +8867,13 @@ function DepositFlow({
8266
8867
  ] });
8267
8868
  }
8268
8869
  if (isDappImportMode && effectiveStep.type === "dapp-import-resolving") {
8269
- return /* @__PURE__ */ jsx25(
8870
+ return /* @__PURE__ */ jsx27(
8270
8871
  "div",
8271
8872
  {
8272
8873
  className: "rs-modal-body",
8273
8874
  "data-flow-mode": "dapp-import",
8274
8875
  "data-step-type": effectiveStep.type,
8275
- children: /* @__PURE__ */ jsx25(
8876
+ children: /* @__PURE__ */ jsx27(
8276
8877
  DappImportAssetSelectSkeleton,
8277
8878
  {
8278
8879
  sourceLabel: activeDappImportProvider?.sourceLabel ?? "",
@@ -8284,13 +8885,13 @@ function DepositFlow({
8284
8885
  );
8285
8886
  }
8286
8887
  if (effectiveStep.type === "dapp-import-select") {
8287
- return /* @__PURE__ */ jsx25(
8888
+ return /* @__PURE__ */ jsx27(
8288
8889
  "div",
8289
8890
  {
8290
8891
  className: "rs-modal-body",
8291
8892
  "data-flow-mode": "dapp-import",
8292
8893
  "data-step-type": effectiveStep.type,
8293
- children: /* @__PURE__ */ jsx25(
8894
+ children: /* @__PURE__ */ jsx27(
8294
8895
  DappImportSelectStep,
8295
8896
  {
8296
8897
  enabledIds: enabledAssetMigrationIds,
@@ -8317,7 +8918,7 @@ function DepositFlow({
8317
8918
  );
8318
8919
  }
8319
8920
  if (!signerContext?.walletClient || !signerContext?.publicClient) {
8320
- return /* @__PURE__ */ jsx25("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx25("div", { className: "rs-step", children: /* @__PURE__ */ jsx25("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsx25("div", { className: "rs-loading-text", children: /* @__PURE__ */ jsx25("div", { className: "rs-loading-title", children: "Connecting wallet\u2026" }) }) }) }) });
8921
+ return /* @__PURE__ */ jsx27("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx27("div", { className: "rs-step", children: /* @__PURE__ */ jsx27("div", { className: "rs-loading-state", children: /* @__PURE__ */ jsx27("div", { className: "rs-loading-text", children: /* @__PURE__ */ jsx27("div", { className: "rs-loading-title", children: "Connecting wallet\u2026" }) }) }) }) });
8321
8922
  }
8322
8923
  const ownerAddress = signerContext.ownerAddress;
8323
8924
  const ownerChainId = signerContext.walletClient?.chain?.id ?? signerContext.publicClient.chain?.id ?? setupChainId;
@@ -8327,15 +8928,15 @@ function DepositFlow({
8327
8928
  }
8328
8929
  return getPublicClient(chainId, rpcUrls);
8329
8930
  };
8330
- return /* @__PURE__ */ jsxs21("div", { className: "rs-modal-body", children: [
8331
- effectiveStep.type === "setup" && /* @__PURE__ */ jsx25(
8931
+ return /* @__PURE__ */ jsxs23("div", { className: "rs-modal-body", children: [
8932
+ effectiveStep.type === "setup" && /* @__PURE__ */ jsx27(
8332
8933
  AccountPreparingSkeleton,
8333
8934
  {
8334
8935
  errorMessage: activeEntry.status === "error" ? activeEntry.message ?? void 0 : void 0,
8335
8936
  onRetry: activeEntry.status === "error" ? () => handleRetrySetup() : void 0
8336
8937
  }
8337
8938
  ),
8338
- effectiveStep.type === "select-asset" && /* @__PURE__ */ jsx25(
8939
+ effectiveStep.type === "select-asset" && /* @__PURE__ */ jsx27(
8339
8940
  AssetSelectStep,
8340
8941
  {
8341
8942
  address: ownerAddress,
@@ -8351,7 +8952,7 @@ function DepositFlow({
8351
8952
  } : void 0
8352
8953
  }
8353
8954
  ),
8354
- effectiveStep.type === "dapp-import-asset-select" && activeDappImportProvider && activeDappImportAvailability && /* @__PURE__ */ jsx25(
8955
+ effectiveStep.type === "dapp-import-asset-select" && activeDappImportProvider && activeDappImportAvailability && /* @__PURE__ */ jsx27(
8355
8956
  DappImportAssetSelectStep,
8356
8957
  {
8357
8958
  sourceLabel: activeDappImportAvailability.assets[0]?.sourceLabel ?? activeDappImportProvider.sourceLabel,
@@ -8360,7 +8961,7 @@ function DepositFlow({
8360
8961
  onSelect: handleDappImportAssetSelected
8361
8962
  }
8362
8963
  ),
8363
- effectiveStep.type === "amount" && /* @__PURE__ */ jsx25(
8964
+ effectiveStep.type === "amount" && /* @__PURE__ */ jsx27(
8364
8965
  AmountStep,
8365
8966
  {
8366
8967
  walletClient: signerContext.walletClient,
@@ -8388,7 +8989,7 @@ function DepositFlow({
8388
8989
  }
8389
8990
  }
8390
8991
  ),
8391
- effectiveStep.type === "confirm" && /* @__PURE__ */ jsx25(
8992
+ effectiveStep.type === "confirm" && /* @__PURE__ */ jsx27(
8392
8993
  ConfirmStep,
8393
8994
  {
8394
8995
  walletClient: signerContext.walletClient,
@@ -8409,6 +9010,7 @@ function DepositFlow({
8409
9010
  service,
8410
9011
  setupRequestKey: desiredSetupRequestKey,
8411
9012
  setupReady,
9013
+ enableGaslessDeposit,
8412
9014
  executeTransfer: isDappImportMode && activeDappImportProvider && isDappImportAsset(effectiveStep.asset) ? async (amountUnits) => {
8413
9015
  const result = await activeDappImportProvider.executeTransfer(
8414
9016
  {
@@ -8432,10 +9034,11 @@ function DepositFlow({
8432
9034
  } : void 0,
8433
9035
  onConfirm: handleDepositSubmitted,
8434
9036
  onDepositSubmitted: handleDepositSubmittedCallback,
9037
+ onSubmittingChange,
8435
9038
  onError: handleError
8436
9039
  }
8437
9040
  ),
8438
- effectiveStep.type === "processing" && /* @__PURE__ */ jsx25(
9041
+ effectiveStep.type === "processing" && /* @__PURE__ */ jsx27(
8439
9042
  ProcessingStep,
8440
9043
  {
8441
9044
  smartAccount: effectiveStep.smartAccount,
@@ -8451,6 +9054,7 @@ function DepositFlow({
8451
9054
  amountUsd: effectiveStep.inputAmountUsd,
8452
9055
  service,
8453
9056
  directTransfer: effectiveStep.directTransfer,
9057
+ sourceTxHashPending: effectiveStep.sourceTxHashPending,
8454
9058
  initialEvent: effectiveStep.initialEvent,
8455
9059
  quote: effectiveStep.quote,
8456
9060
  uiConfig,
@@ -8467,8 +9071,8 @@ function DepositFlow({
8467
9071
  }
8468
9072
 
8469
9073
  // src/components/history/DepositHistoryPanel.tsx
8470
- import { useCallback as useCallback8, useMemo as useMemo8, useState as useState13 } from "react";
8471
- import { jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
9074
+ import { useCallback as useCallback8, useMemo as useMemo8, useState as useState14 } from "react";
9075
+ import { jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
8472
9076
  function shortenHash(hash) {
8473
9077
  if (hash.length <= 14) return hash;
8474
9078
  return `${hash.slice(0, 6)}\u2026${hash.slice(-4)}`;
@@ -8547,12 +9151,6 @@ function formatAmount(rawAmount, token, chainId) {
8547
9151
  return rawAmount;
8548
9152
  }
8549
9153
  }
8550
- function getTxExplorerUrl(txHash, chainId) {
8551
- if (!chainId) return null;
8552
- const base2 = getExplorerUrl(chainId);
8553
- if (!base2) return null;
8554
- return `${base2}/tx/${txHash}`;
8555
- }
8556
9154
  function normalizeStatus(raw, isSpam) {
8557
9155
  const lower = raw.toLowerCase();
8558
9156
  if (lower === "completed" || lower === "complete" || lower === "bridge-complete" || lower === "processed")
@@ -8598,7 +9196,7 @@ function DepositHistoryPanel({
8598
9196
  (d) => !(d.txHash && sourceHashes.has(d.txHash.toLowerCase()))
8599
9197
  );
8600
9198
  }, [deposits]);
8601
- return /* @__PURE__ */ jsxs22(
9199
+ return /* @__PURE__ */ jsxs24(
8602
9200
  "div",
8603
9201
  {
8604
9202
  className: "rs-history-panel",
@@ -8606,55 +9204,55 @@ function DepositHistoryPanel({
8606
9204
  "aria-label": "Deposit history",
8607
9205
  onKeyDown: handleKeyDown,
8608
9206
  children: [
8609
- /* @__PURE__ */ jsxs22("div", { className: "rs-modal-header--redesigned", children: [
8610
- /* @__PURE__ */ jsx26("div", { className: "rs-modal-header-nav-left", children: /* @__PURE__ */ jsx26(
9207
+ /* @__PURE__ */ jsxs24("div", { className: "rs-modal-header--redesigned", children: [
9208
+ /* @__PURE__ */ jsx28("div", { className: "rs-modal-header-nav-left", children: /* @__PURE__ */ jsx28(
8611
9209
  "button",
8612
9210
  {
8613
9211
  type: "button",
8614
9212
  className: "rs-modal-header-back",
8615
9213
  "aria-label": "Back",
8616
9214
  onClick: onClose,
8617
- children: /* @__PURE__ */ jsx26(ChevronLeftIcon, {})
9215
+ children: /* @__PURE__ */ jsx28(ChevronLeftIcon, {})
8618
9216
  }
8619
9217
  ) }),
8620
- /* @__PURE__ */ jsx26("div", { className: "rs-modal-header-nav-right", children: onCloseModal && /* @__PURE__ */ jsx26(
9218
+ /* @__PURE__ */ jsx28("div", { className: "rs-modal-header-nav-right", children: onCloseModal && /* @__PURE__ */ jsx28(
8621
9219
  "button",
8622
9220
  {
8623
9221
  type: "button",
8624
9222
  className: "rs-modal-close",
8625
9223
  "aria-label": "Close",
8626
9224
  onClick: onCloseModal,
8627
- children: /* @__PURE__ */ jsx26(CloseIcon, {})
9225
+ children: /* @__PURE__ */ jsx28(CloseIcon, {})
8628
9226
  }
8629
9227
  ) })
8630
9228
  ] }),
8631
- /* @__PURE__ */ jsxs22("div", { className: "rs-history-screen", children: [
8632
- /* @__PURE__ */ jsxs22("div", { className: "rs-history-screen-body", children: [
8633
- /* @__PURE__ */ jsx26(BodyHeader, { icon: /* @__PURE__ */ jsx26(HistoryIcon, {}), title: "History" }),
8634
- isLoading && deposits.length === 0 && /* @__PURE__ */ jsxs22("div", { className: "rs-history-empty", children: [
8635
- /* @__PURE__ */ jsx26("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx26(HistoryIcon, {}) }),
8636
- /* @__PURE__ */ jsxs22("div", { className: "rs-history-empty-text", children: [
8637
- /* @__PURE__ */ jsx26(Spinner, { className: "rs-spinner--sm" }),
8638
- /* @__PURE__ */ jsx26("span", { className: "rs-history-empty-hint", children: "Loading history\u2026" })
9229
+ /* @__PURE__ */ jsxs24("div", { className: "rs-history-screen", children: [
9230
+ /* @__PURE__ */ jsxs24("div", { className: "rs-history-screen-body", children: [
9231
+ /* @__PURE__ */ jsx28(BodyHeader, { icon: /* @__PURE__ */ jsx28(HistoryIcon, {}), title: "History" }),
9232
+ isLoading && deposits.length === 0 && /* @__PURE__ */ jsxs24("div", { className: "rs-history-empty", children: [
9233
+ /* @__PURE__ */ jsx28("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx28(HistoryIcon, {}) }),
9234
+ /* @__PURE__ */ jsxs24("div", { className: "rs-history-empty-text", children: [
9235
+ /* @__PURE__ */ jsx28(Spinner, { className: "rs-spinner--sm" }),
9236
+ /* @__PURE__ */ jsx28("span", { className: "rs-history-empty-hint", children: "Loading history\u2026" })
8639
9237
  ] })
8640
9238
  ] }),
8641
- error && !isLoading && /* @__PURE__ */ jsxs22("div", { className: "rs-history-empty", children: [
8642
- /* @__PURE__ */ jsx26("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx26(AlertTriangleIcon, {}) }),
8643
- /* @__PURE__ */ jsxs22("div", { className: "rs-history-empty-text", children: [
8644
- /* @__PURE__ */ jsx26("span", { className: "rs-history-empty-title", children: "Couldn't load history" }),
8645
- /* @__PURE__ */ jsx26("span", { className: "rs-history-empty-hint", children: error })
9239
+ error && !isLoading && /* @__PURE__ */ jsxs24("div", { className: "rs-history-empty", children: [
9240
+ /* @__PURE__ */ jsx28("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx28(AlertTriangleIcon, {}) }),
9241
+ /* @__PURE__ */ jsxs24("div", { className: "rs-history-empty-text", children: [
9242
+ /* @__PURE__ */ jsx28("span", { className: "rs-history-empty-title", children: "Couldn't load history" }),
9243
+ /* @__PURE__ */ jsx28("span", { className: "rs-history-empty-hint", children: error })
8646
9244
  ] })
8647
9245
  ] }),
8648
- !isLoading && !error && visibleDeposits.length === 0 && /* @__PURE__ */ jsxs22("div", { className: "rs-history-empty", children: [
8649
- /* @__PURE__ */ jsx26("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx26(HistoryIcon, {}) }),
8650
- /* @__PURE__ */ jsxs22("div", { className: "rs-history-empty-text", children: [
8651
- /* @__PURE__ */ jsx26("span", { className: "rs-history-empty-title", children: "No deposits yet" }),
8652
- /* @__PURE__ */ jsx26("span", { className: "rs-history-empty-hint", children: "Your deposit history will appear here" })
9246
+ !isLoading && !error && visibleDeposits.length === 0 && /* @__PURE__ */ jsxs24("div", { className: "rs-history-empty", children: [
9247
+ /* @__PURE__ */ jsx28("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx28(HistoryIcon, {}) }),
9248
+ /* @__PURE__ */ jsxs24("div", { className: "rs-history-empty-text", children: [
9249
+ /* @__PURE__ */ jsx28("span", { className: "rs-history-empty-title", children: "No deposits yet" }),
9250
+ /* @__PURE__ */ jsx28("span", { className: "rs-history-empty-hint", children: "Your deposit history will appear here" })
8653
9251
  ] })
8654
9252
  ] }),
8655
- visibleDeposits.length > 0 && /* @__PURE__ */ jsxs22("div", { className: "rs-history-list", children: [
8656
- visibleDeposits.map((deposit, i) => /* @__PURE__ */ jsx26(HistoryCard, { deposit }, deposit.txHash || i)),
8657
- hasMore && /* @__PURE__ */ jsx26(
9253
+ visibleDeposits.length > 0 && /* @__PURE__ */ jsxs24("div", { className: "rs-history-list", children: [
9254
+ visibleDeposits.map((deposit, i) => /* @__PURE__ */ jsx28(HistoryCard, { deposit }, deposit.txHash || i)),
9255
+ hasMore && /* @__PURE__ */ jsx28(
8658
9256
  "button",
8659
9257
  {
8660
9258
  type: "button",
@@ -8666,14 +9264,15 @@ function DepositHistoryPanel({
8666
9264
  )
8667
9265
  ] })
8668
9266
  ] }),
8669
- /* @__PURE__ */ jsx26(PoweredBy, {})
9267
+ /* @__PURE__ */ jsx28(PoweredBy, {})
8670
9268
  ] })
8671
9269
  ]
8672
9270
  }
8673
9271
  );
8674
9272
  }
8675
9273
  function HistoryCard({ deposit }) {
8676
- const [expanded, setExpanded] = useState13(false);
9274
+ const explorerTxUrl = useExplorerTxUrl();
9275
+ const [expanded, setExpanded] = useState14(false);
8677
9276
  const status = normalizeStatus(deposit.status, deposit.isSpam);
8678
9277
  const sourceChainId = resolveChainId(deposit.chain);
8679
9278
  const targetChainId = resolveChainId(deposit.targetChain);
@@ -8691,8 +9290,8 @@ function HistoryCard({ deposit }) {
8691
9290
  const date = deposit.createdAt ? formatDate(deposit.createdAt) : null;
8692
9291
  const txTypeLabel = `Deposit${sourceSymbol ? ` ${sourceSymbol}` : ""}`;
8693
9292
  const srcTxHash = sourceChainId === "hypercore" ? deposit.txHash : deposit.sourceTxHash;
8694
- const srcTxUrl = srcTxHash ? getTxExplorerUrl(srcTxHash, sourceChainId) : null;
8695
- return /* @__PURE__ */ jsxs22(
9293
+ const srcTxUrl = srcTxHash && sourceChainId ? explorerTxUrl(sourceChainId, srcTxHash) : null;
9294
+ return /* @__PURE__ */ jsxs24(
8696
9295
  "button",
8697
9296
  {
8698
9297
  type: "button",
@@ -8700,38 +9299,38 @@ function HistoryCard({ deposit }) {
8700
9299
  onClick: () => setExpanded((v) => !v),
8701
9300
  "aria-expanded": expanded,
8702
9301
  children: [
8703
- /* @__PURE__ */ jsxs22("div", { className: "rs-history-card-row", children: [
8704
- /* @__PURE__ */ jsxs22("div", { className: "rs-history-card-icons", children: [
8705
- /* @__PURE__ */ jsx26("span", { className: "rs-history-card-token", children: /* @__PURE__ */ jsx26(TokenIcon, { symbol: sourceSymbol, fallback: sourceSymbol.slice(0, 2) }) }),
8706
- sourceChainIcon && /* @__PURE__ */ jsx26("span", { className: "rs-history-card-chain", children: /* @__PURE__ */ jsx26(CdnIcon, { src: sourceChainIcon }) })
9302
+ /* @__PURE__ */ jsxs24("div", { className: "rs-history-card-row", children: [
9303
+ /* @__PURE__ */ jsxs24("div", { className: "rs-history-card-icons", children: [
9304
+ /* @__PURE__ */ jsx28("span", { className: "rs-history-card-token", children: /* @__PURE__ */ jsx28(TokenIcon, { symbol: sourceSymbol, fallback: sourceSymbol.slice(0, 2) }) }),
9305
+ sourceChainIcon && /* @__PURE__ */ jsx28("span", { className: "rs-history-card-chain", children: /* @__PURE__ */ jsx28(CdnIcon, { src: sourceChainIcon }) })
8707
9306
  ] }),
8708
- /* @__PURE__ */ jsxs22("div", { className: "rs-history-card-text", children: [
8709
- /* @__PURE__ */ jsx26("span", { className: "rs-history-card-title", children: txTypeLabel }),
8710
- date && /* @__PURE__ */ jsx26("span", { className: "rs-history-card-date", children: date })
9307
+ /* @__PURE__ */ jsxs24("div", { className: "rs-history-card-text", children: [
9308
+ /* @__PURE__ */ jsx28("span", { className: "rs-history-card-title", children: txTypeLabel }),
9309
+ date && /* @__PURE__ */ jsx28("span", { className: "rs-history-card-date", children: date })
8711
9310
  ] }),
8712
- /* @__PURE__ */ jsxs22("div", { className: "rs-history-card-side", children: [
8713
- /* @__PURE__ */ jsx26("span", { className: "rs-history-card-amount", children: displayAmount }),
8714
- /* @__PURE__ */ jsx26("span", { className: `rs-history-badge rs-history-badge--${status}`, children: STATUS_LABEL[status] })
9311
+ /* @__PURE__ */ jsxs24("div", { className: "rs-history-card-side", children: [
9312
+ /* @__PURE__ */ jsx28("span", { className: "rs-history-card-amount", children: displayAmount }),
9313
+ /* @__PURE__ */ jsx28("span", { className: `rs-history-badge rs-history-badge--${status}`, children: STATUS_LABEL[status] })
8715
9314
  ] })
8716
9315
  ] }),
8717
- /* @__PURE__ */ jsx26("div", { className: "rs-history-card-panel", children: /* @__PURE__ */ jsx26("div", { className: "rs-history-card-panel-inner", children: /* @__PURE__ */ jsxs22("div", { className: "rs-history-card-details", children: [
8718
- sourceChainName && /* @__PURE__ */ jsxs22("div", { className: "rs-amount-detail-row", children: [
8719
- /* @__PURE__ */ jsx26("span", { children: "Source chain" }),
8720
- /* @__PURE__ */ jsxs22("span", { className: "rs-amount-detail-value", children: [
8721
- /* @__PURE__ */ jsx26("span", { children: sourceChainName }),
8722
- sourceChainIcon && /* @__PURE__ */ jsx26("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx26(CdnIcon, { src: sourceChainIcon }) })
9316
+ /* @__PURE__ */ jsx28("div", { className: "rs-history-card-panel", children: /* @__PURE__ */ jsx28("div", { className: "rs-history-card-panel-inner", children: /* @__PURE__ */ jsxs24("div", { className: "rs-history-card-details", children: [
9317
+ sourceChainName && /* @__PURE__ */ jsxs24("div", { className: "rs-amount-detail-row", children: [
9318
+ /* @__PURE__ */ jsx28("span", { children: "Source chain" }),
9319
+ /* @__PURE__ */ jsxs24("span", { className: "rs-amount-detail-value", children: [
9320
+ /* @__PURE__ */ jsx28("span", { children: sourceChainName }),
9321
+ sourceChainIcon && /* @__PURE__ */ jsx28("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx28(CdnIcon, { src: sourceChainIcon }) })
8723
9322
  ] })
8724
9323
  ] }),
8725
- targetChainName && /* @__PURE__ */ jsxs22("div", { className: "rs-amount-detail-row", children: [
8726
- /* @__PURE__ */ jsx26("span", { children: "Destination chain" }),
8727
- /* @__PURE__ */ jsxs22("span", { className: "rs-amount-detail-value", children: [
8728
- /* @__PURE__ */ jsx26("span", { children: targetChainName }),
8729
- targetChainIcon && /* @__PURE__ */ jsx26("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx26(CdnIcon, { src: targetChainIcon }) })
9324
+ targetChainName && /* @__PURE__ */ jsxs24("div", { className: "rs-amount-detail-row", children: [
9325
+ /* @__PURE__ */ jsx28("span", { children: "Destination chain" }),
9326
+ /* @__PURE__ */ jsxs24("span", { className: "rs-amount-detail-value", children: [
9327
+ /* @__PURE__ */ jsx28("span", { children: targetChainName }),
9328
+ targetChainIcon && /* @__PURE__ */ jsx28("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx28(CdnIcon, { src: targetChainIcon }) })
8730
9329
  ] })
8731
9330
  ] }),
8732
- srcTxUrl && srcTxHash && /* @__PURE__ */ jsxs22("div", { className: "rs-amount-detail-row", children: [
8733
- /* @__PURE__ */ jsx26("span", { children: "Transaction details" }),
8734
- /* @__PURE__ */ jsxs22(
9331
+ srcTxUrl && srcTxHash && /* @__PURE__ */ jsxs24("div", { className: "rs-amount-detail-row", children: [
9332
+ /* @__PURE__ */ jsx28("span", { children: "Transaction details" }),
9333
+ /* @__PURE__ */ jsxs24(
8735
9334
  "a",
8736
9335
  {
8737
9336
  href: srcTxUrl,
@@ -8740,8 +9339,8 @@ function HistoryCard({ deposit }) {
8740
9339
  className: "rs-history-card-link",
8741
9340
  onClick: (e) => e.stopPropagation(),
8742
9341
  children: [
8743
- /* @__PURE__ */ jsx26("span", { children: shortenHash(srcTxHash) }),
8744
- /* @__PURE__ */ jsx26(ArrowUpRightIcon, {})
9342
+ /* @__PURE__ */ jsx28("span", { children: shortenHash(srcTxHash) }),
9343
+ /* @__PURE__ */ jsx28(ArrowUpRightIcon, {})
8745
9344
  ]
8746
9345
  }
8747
9346
  )
@@ -8754,9 +9353,9 @@ function HistoryCard({ deposit }) {
8754
9353
  DepositHistoryPanel.displayName = "DepositHistoryPanel";
8755
9354
 
8756
9355
  // src/DepositModal.tsx
8757
- import { jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
9356
+ import { jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
8758
9357
  var ReownDepositInner = lazy2(
8759
- () => import("./DepositModalReown-TEC3MEZ4.mjs").then((m) => ({ default: m.DepositModalReown }))
9358
+ () => import("./DepositModalReown-3H75G3XQ.mjs").then((m) => ({ default: m.DepositModalReown }))
8760
9359
  );
8761
9360
  function sortByCreatedAtDesc(items) {
8762
9361
  return [...items].sort((a, b) => {
@@ -8775,7 +9374,7 @@ function DepositModal(props) {
8775
9374
  const needsReown = !!props.reownAppId;
8776
9375
  const hasWalletClientProp = hasSuppliedWalletClient(props);
8777
9376
  if (needsReown) {
8778
- return /* @__PURE__ */ jsx27(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx27(
9377
+ return /* @__PURE__ */ jsx29(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx29(
8779
9378
  ReownDepositInner,
8780
9379
  {
8781
9380
  ...props,
@@ -8783,7 +9382,7 @@ function DepositModal(props) {
8783
9382
  }
8784
9383
  ) });
8785
9384
  }
8786
- return /* @__PURE__ */ jsx27(
9385
+ return /* @__PURE__ */ jsx29(
8787
9386
  DepositModalInner,
8788
9387
  {
8789
9388
  ...props,
@@ -8814,12 +9413,13 @@ function DepositModalInner({
8814
9413
  initialAssetMigration,
8815
9414
  enableFiatOnramp = false,
8816
9415
  enableQrTransfer = true,
9416
+ enableGaslessDeposit = false,
8817
9417
  fiatMethods,
8818
9418
  enableWallet,
8819
9419
  enableExchangeConnect = false,
8820
9420
  outputTokenRules,
8821
9421
  rejectUnmapped,
8822
- reownWallet,
9422
+ walletSession,
8823
9423
  onConnect,
8824
9424
  onDisconnect,
8825
9425
  onRequestConnect,
@@ -8830,22 +9430,26 @@ function DepositModalInner({
8830
9430
  onLifecycle,
8831
9431
  onEvent,
8832
9432
  onError,
9433
+ onUiState,
9434
+ openExternally,
8833
9435
  debug
8834
9436
  }) {
8835
9437
  const modalRef = useRef9(null);
8836
9438
  const onReadyRef = useLatestRef(onReady);
8837
- const [currentScreen, setCurrentScreen] = useState14("connect");
8838
- const [swappedImmersive, setSwappedImmersive] = useState14(false);
8839
- const [backHandler, setBackHandler] = useState14(
9439
+ const onUiStateRef = useLatestRef(onUiState);
9440
+ const [currentScreen, setCurrentScreen] = useState15("connect");
9441
+ const [swappedImmersive, setSwappedImmersive] = useState15(false);
9442
+ const [submitting, setSubmitting] = useState15(false);
9443
+ const [backHandler, setBackHandler] = useState15(
8840
9444
  void 0
8841
9445
  );
8842
9446
  const historyButtonVisible = currentScreen === "connect";
8843
- const [historyOpen, setHistoryOpen] = useState14(false);
8844
- const [historyDeposits, setHistoryDeposits] = useState14([]);
8845
- const [hasMoreHistory, setHasMoreHistory] = useState14(false);
8846
- const [historyLoading, setHistoryLoading] = useState14(false);
8847
- const [historyLoadingMore, setHistoryLoadingMore] = useState14(false);
8848
- const [historyError, setHistoryError] = useState14(null);
9447
+ const [historyOpen, setHistoryOpen] = useState15(false);
9448
+ const [historyDeposits, setHistoryDeposits] = useState15([]);
9449
+ const [hasMoreHistory, setHasMoreHistory] = useState15(false);
9450
+ const [historyLoading, setHistoryLoading] = useState15(false);
9451
+ const [historyLoadingMore, setHistoryLoadingMore] = useState15(false);
9452
+ const [historyError, setHistoryError] = useState15(null);
8849
9453
  const cursorRef = useRef9(null);
8850
9454
  const historyStaleRef = useRef9(false);
8851
9455
  const historyLoadedRef = useRef9(false);
@@ -8859,10 +9463,10 @@ function DepositModalInner({
8859
9463
  }),
8860
9464
  [backendUrl, debug]
8861
9465
  );
8862
- const [clientSetup, setClientSetup] = useState14(
9466
+ const [clientSetup, setClientSetup] = useState15(
8863
9467
  null
8864
9468
  );
8865
- useEffect12(() => {
9469
+ useEffect13(() => {
8866
9470
  if (!isOpen) return;
8867
9471
  let active = true;
8868
9472
  service.getSetup().then((config) => {
@@ -8872,7 +9476,7 @@ function DepositModalInner({
8872
9476
  active = false;
8873
9477
  };
8874
9478
  }, [isOpen, service]);
8875
- useEffect12(() => {
9479
+ useEffect13(() => {
8876
9480
  if (debug && clientSetup) {
8877
9481
  console.debug("[deposit] client setup config (not shown yet)", clientSetup);
8878
9482
  }
@@ -8882,19 +9486,25 @@ function DepositModalInner({
8882
9486
  // eslint-disable-next-line react-hooks/exhaustive-deps
8883
9487
  []
8884
9488
  );
8885
- useEffect12(() => {
9489
+ useEffect13(() => {
8886
9490
  store.dispatch({ type: "target/changed", targetChain, targetToken });
8887
9491
  }, [store, targetChain, targetToken]);
8888
- useEffect12(() => {
8889
- if (isOpen && modalRef.current) {
8890
- applyTheme(modalRef.current, theme);
8891
- }
9492
+ useEffect13(() => {
9493
+ if (!isOpen || !modalRef.current) return;
9494
+ return applyTheme(modalRef.current, theme);
8892
9495
  }, [isOpen, theme]);
8893
- useEffect12(() => {
9496
+ useEffect13(() => {
8894
9497
  if (isOpen) {
8895
9498
  onReadyRef.current?.();
8896
9499
  }
8897
9500
  }, [isOpen, onReadyRef]);
9501
+ useEffect13(() => {
9502
+ onUiStateRef.current?.({
9503
+ screen: currentScreen,
9504
+ back: backHandler,
9505
+ submitting
9506
+ });
9507
+ }, [currentScreen, backHandler, submitting, onUiStateRef]);
8898
9508
  const handleStepChange = useCallback9(
8899
9509
  (onBack, screen) => {
8900
9510
  setBackHandler(() => onBack);
@@ -8981,7 +9591,7 @@ function DepositModalInner({
8981
9591
  },
8982
9592
  [onLifecycleRef, markHistoryStale]
8983
9593
  );
8984
- useEffect12(() => {
9594
+ useEffect13(() => {
8985
9595
  if (!isOpen) {
8986
9596
  setHistoryOpen(false);
8987
9597
  setHistoryDeposits([]);
@@ -8993,9 +9603,10 @@ function DepositModalInner({
8993
9603
  setCurrentScreen("connect");
8994
9604
  setBackHandler(void 0);
8995
9605
  setSwappedImmersive(false);
9606
+ setSubmitting(false);
8996
9607
  }
8997
9608
  }, [isOpen]);
8998
- useEffect12(() => {
9609
+ useEffect13(() => {
8999
9610
  if (!isOpen) {
9000
9611
  store.dispatch({ type: "flow/reset" });
9001
9612
  }
@@ -9004,7 +9615,7 @@ function DepositModalInner({
9004
9615
  const canGoBack = backHandler !== void 0;
9005
9616
  const hideHeaderChrome = swappedImmersive;
9006
9617
  const modalClassName = `rs-modal${hideHeaderChrome ? " rs-modal--swapped-iframe" : ""}`;
9007
- return /* @__PURE__ */ jsx27(RpcUrlsProvider, { value: rpcUrls, children: /* @__PURE__ */ jsx27(ChainCatalogProvider, { service, rpcUrls, children: /* @__PURE__ */ jsx27(DepositStoreProvider, { store, children: /* @__PURE__ */ jsx27(
9618
+ return /* @__PURE__ */ jsx29(RpcUrlsProvider, { value: rpcUrls, children: /* @__PURE__ */ jsx29(ChainCatalogProvider, { service, rpcUrls, children: /* @__PURE__ */ jsx29(DepositStoreProvider, { store, children: /* @__PURE__ */ jsx29(
9008
9619
  Modal,
9009
9620
  {
9010
9621
  isOpen,
@@ -9012,20 +9623,20 @@ function DepositModalInner({
9012
9623
  className,
9013
9624
  inline,
9014
9625
  closeOnOverlayClick,
9015
- children: /* @__PURE__ */ jsxs23("div", { ref: modalRef, className: modalClassName, children: [
9016
- !hideHeaderChrome && /* @__PURE__ */ jsxs23("div", { className: "rs-modal-header--redesigned", children: [
9017
- /* @__PURE__ */ jsx27("div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && backHandler && /* @__PURE__ */ jsx27(
9626
+ children: /* @__PURE__ */ jsxs25("div", { ref: modalRef, className: modalClassName, children: [
9627
+ !hideHeaderChrome && /* @__PURE__ */ jsxs25("div", { className: "rs-modal-header--redesigned", children: [
9628
+ /* @__PURE__ */ jsx29("div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && backHandler && /* @__PURE__ */ jsx29(
9018
9629
  "button",
9019
9630
  {
9020
9631
  type: "button",
9021
9632
  className: "rs-modal-header-back",
9022
9633
  "aria-label": "Go back",
9023
9634
  onClick: backHandler,
9024
- children: /* @__PURE__ */ jsx27(ChevronLeftIcon, {})
9635
+ children: /* @__PURE__ */ jsx29(ChevronLeftIcon, {})
9025
9636
  }
9026
9637
  ) }),
9027
- /* @__PURE__ */ jsxs23("div", { className: "rs-modal-header-nav-right", children: [
9028
- historyButtonVisible && /* @__PURE__ */ jsx27(
9638
+ /* @__PURE__ */ jsxs25("div", { className: "rs-modal-header-nav-right", children: [
9639
+ historyButtonVisible && /* @__PURE__ */ jsx29(
9029
9640
  "button",
9030
9641
  {
9031
9642
  type: "button",
@@ -9033,22 +9644,22 @@ function DepositModalInner({
9033
9644
  "aria-label": "Deposit history",
9034
9645
  onClick: handleHistoryOpen,
9035
9646
  disabled: !recipient,
9036
- children: /* @__PURE__ */ jsx27(HistoryIcon, {})
9647
+ children: /* @__PURE__ */ jsx29(HistoryIcon, {})
9037
9648
  }
9038
9649
  ),
9039
- /* @__PURE__ */ jsx27(
9650
+ /* @__PURE__ */ jsx29(
9040
9651
  "button",
9041
9652
  {
9042
9653
  type: "button",
9043
9654
  onClick: onClose,
9044
9655
  className: "rs-modal-close",
9045
9656
  "aria-label": "Close",
9046
- children: /* @__PURE__ */ jsx27(CloseIcon, {})
9657
+ children: /* @__PURE__ */ jsx29(CloseIcon, {})
9047
9658
  }
9048
9659
  )
9049
9660
  ] })
9050
9661
  ] }),
9051
- /* @__PURE__ */ jsx27(
9662
+ /* @__PURE__ */ jsx29(
9052
9663
  DepositFlow,
9053
9664
  {
9054
9665
  walletClientProp,
@@ -9069,10 +9680,11 @@ function DepositModalInner({
9069
9680
  initialAssetMigration,
9070
9681
  enableFiatOnramp,
9071
9682
  enableQrTransfer,
9683
+ enableGaslessDeposit,
9072
9684
  fiatMethods,
9073
9685
  enableWallet,
9074
9686
  enableExchangeConnect,
9075
- reownWallet,
9687
+ walletSession,
9076
9688
  onConnect,
9077
9689
  onDisconnect,
9078
9690
  onRequestConnect,
@@ -9081,6 +9693,8 @@ function DepositModalInner({
9081
9693
  appFeesResolved: clientSetup !== null,
9082
9694
  onStepChange: handleStepChange,
9083
9695
  onSwappedImmersiveChange: setSwappedImmersive,
9696
+ openExternally,
9697
+ onSubmittingChange: setSubmitting,
9084
9698
  onClose,
9085
9699
  onLifecycle: handleLifecycle,
9086
9700
  onEvent,
@@ -9088,7 +9702,7 @@ function DepositModalInner({
9088
9702
  debug
9089
9703
  }
9090
9704
  ),
9091
- historyOpen && /* @__PURE__ */ jsx27(
9705
+ historyOpen && /* @__PURE__ */ jsx29(
9092
9706
  DepositHistoryPanel,
9093
9707
  {
9094
9708
  deposits: historyDeposits,