@rhinestone/deposit-modal 0.6.1 → 0.7.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 (30) hide show
  1. package/dist/{DepositModalReown-ICBGUVAA.cjs → DepositModalReown-CHVDFNEX.cjs} +9 -9
  2. package/dist/{DepositModalReown-IVRDXQAA.mjs → DepositModalReown-T4RRW5FM.mjs} +6 -6
  3. package/dist/{WithdrawModalReown-O7PR343Z.mjs → WithdrawModalReown-Q6MUMZTX.mjs} +5 -5
  4. package/dist/{WithdrawModalReown-6XWURPFZ.cjs → WithdrawModalReown-YZMZTN6E.cjs} +8 -8
  5. package/dist/{chunk-FJWLC4AM.mjs → chunk-4JLYWRQA.mjs} +1 -1
  6. package/dist/{chunk-VVKJRGX3.cjs → chunk-6P3WNDED.cjs} +10 -8
  7. package/dist/{chunk-N73D3WN4.mjs → chunk-CLUR2J72.mjs} +4 -4
  8. package/dist/{chunk-WJX3TJFK.mjs → chunk-CPMHRMPH.mjs} +36 -7
  9. package/dist/{chunk-ABVRVW3P.cjs → chunk-HH46H6ZI.cjs} +37 -8
  10. package/dist/{chunk-7Q26RR6J.mjs → chunk-J52W34Y7.mjs} +6 -4
  11. package/dist/{chunk-F7P4MV72.mjs → chunk-K6J3RDDK.mjs} +1 -1
  12. package/dist/{chunk-SITLCMTI.cjs → chunk-KUURQOTT.cjs} +100 -100
  13. package/dist/{chunk-GBOCV2LQ.mjs → chunk-OYPFPEIT.mjs} +221 -45
  14. package/dist/{chunk-IZPUHIIN.cjs → chunk-QSMPJQTX.cjs} +687 -528
  15. package/dist/{chunk-UEKPBRBY.cjs → chunk-RLMXWLF4.cjs} +3 -3
  16. package/dist/{chunk-VPWWFWZT.cjs → chunk-UN6MEOOA.cjs} +283 -107
  17. package/dist/{chunk-TCLBFO3S.mjs → chunk-UZENNYHS.mjs} +230 -71
  18. package/dist/{chunk-NRNJAQUA.cjs → chunk-XOBLFIGV.cjs} +4 -4
  19. package/dist/constants.cjs +2 -2
  20. package/dist/constants.mjs +1 -1
  21. package/dist/deposit.cjs +6 -6
  22. package/dist/deposit.mjs +5 -5
  23. package/dist/index.cjs +7 -7
  24. package/dist/index.mjs +6 -6
  25. package/dist/polymarket.cjs +6 -6
  26. package/dist/polymarket.mjs +3 -3
  27. package/dist/styles.css +86 -12
  28. package/dist/withdraw.cjs +5 -5
  29. package/dist/withdraw.mjs +4 -4
  30. package/package.json +1 -1
@@ -7,7 +7,7 @@ import {
7
7
  executePolymarketSafeTransfer,
8
8
  fetchPolymarketProxyWallet,
9
9
  readPolymarketBalances
10
- } from "./chunk-FJWLC4AM.mjs";
10
+ } from "./chunk-4JLYWRQA.mjs";
11
11
  import {
12
12
  AlertTriangleIcon,
13
13
  ArrowUpRightIcon,
@@ -68,10 +68,10 @@ import {
68
68
  useLatestRef,
69
69
  useRpcUrls,
70
70
  useStableRpcUrls
71
- } from "./chunk-GBOCV2LQ.mjs";
71
+ } from "./chunk-OYPFPEIT.mjs";
72
72
  import {
73
73
  SAFE_ABI
74
- } from "./chunk-F7P4MV72.mjs";
74
+ } from "./chunk-K6J3RDDK.mjs";
75
75
  import {
76
76
  DEFAULT_BACKEND_URL,
77
77
  DEFAULT_SIGNER_ADDRESS,
@@ -87,6 +87,7 @@ import {
87
87
  getChainName,
88
88
  getExplorerTxUrl,
89
89
  getExplorerUrl,
90
+ getNativeSymbol,
90
91
  getSupportedChainIds,
91
92
  getTargetTokenSymbol,
92
93
  getTargetTokenSymbolsForChain,
@@ -98,10 +99,11 @@ import {
98
99
  isNativeSol,
99
100
  isSolanaCaip2,
100
101
  isStablecoinSymbol,
102
+ isSupportedTokenAddressForChain,
101
103
  isVirtualDestination,
102
104
  parseEvmChainId,
103
105
  targetChainToCaip2
104
- } from "./chunk-WJX3TJFK.mjs";
106
+ } from "./chunk-CPMHRMPH.mjs";
105
107
 
106
108
  // src/DepositModal.tsx
107
109
  import {
@@ -204,12 +206,6 @@ function AssetSelectStep({
204
206
  active = false;
205
207
  };
206
208
  }, [address, publicClient, service, onTotalBalanceComputedRef]);
207
- useEffect(() => {
208
- if (!defaultAssetId || selectedAssetId) return;
209
- if (assets.some((asset) => asset.id === defaultAssetId)) {
210
- setSelectedAssetId(defaultAssetId);
211
- }
212
- }, [assets, defaultAssetId, selectedAssetId]);
213
209
  const allowedChainSet = useMemo(
214
210
  () => allowedRoutes?.sourceChains ? new Set(allowedRoutes.sourceChains) : null,
215
211
  [allowedRoutes?.sourceChains]
@@ -226,7 +222,12 @@ function AssetSelectStep({
226
222
  return false;
227
223
  }
228
224
  if (allowedChainSet && !allowedChainSet.has(a.chainId)) return false;
229
- if (allowedTokenSet && !allowedTokenSet.has(a.symbol.toUpperCase()))
225
+ if (allowedTokenSet) {
226
+ if (!allowedTokenSet.has(a.symbol.toUpperCase())) return false;
227
+ if (!isSupportedTokenAddressForChain(a.token, a.chainId)) return false;
228
+ }
229
+ const isNativeToken = a.token.toLowerCase() === NATIVE_TOKEN_ADDRESS;
230
+ if (!isNativeToken && !(typeof a.balanceUsd === "number" && a.balanceUsd >= 0.01))
230
231
  return false;
231
232
  return true;
232
233
  }).sort((a, b) => {
@@ -240,7 +241,13 @@ function AssetSelectStep({
240
241
  return 0;
241
242
  });
242
243
  }, [assets, allowedChainSet, allowedTokenSet]);
243
- const selectedAsset = selectedAssetId && assets.find((asset) => asset.id === selectedAssetId);
244
+ useEffect(() => {
245
+ if (!defaultAssetId || selectedAssetId) return;
246
+ if (rows.some((asset) => asset.id === defaultAssetId)) {
247
+ setSelectedAssetId(defaultAssetId);
248
+ }
249
+ }, [rows, defaultAssetId, selectedAssetId]);
250
+ const selectedAsset = selectedAssetId && rows.find((asset) => asset.id === selectedAssetId);
244
251
  const formatBalance = (asset) => {
245
252
  if (!asset.balance) return "--";
246
253
  try {
@@ -366,13 +373,14 @@ async function fetchNativeAssets(address, publicClient, existing) {
366
373
  if (existingIds.has(id)) return [];
367
374
  try {
368
375
  const balance = await publicClient.getBalance({ address });
376
+ const nativeSymbol = getNativeSymbol(connectedChainId);
369
377
  return [
370
378
  {
371
379
  id,
372
380
  chainId: connectedChainId,
373
381
  token: NATIVE_TOKEN_ADDRESS,
374
- symbol: "ETH",
375
- name: "Ethereum",
382
+ symbol: nativeSymbol,
383
+ name: nativeSymbol,
376
384
  decimals: 18,
377
385
  balance: balance.toString()
378
386
  }
@@ -1008,7 +1016,13 @@ function ConfirmStep({
1008
1016
  });
1009
1017
  }
1010
1018
  onDepositSubmitted?.(hash, asset.chainId, amountUnits.toString());
1011
- onConfirm(hash, asset.chainId, amountUnits.toString(), resolvedSourceToken);
1019
+ onConfirm(
1020
+ hash,
1021
+ asset.chainId,
1022
+ amountUnits.toString(),
1023
+ resolvedSourceToken,
1024
+ quote?.fees?.breakdown
1025
+ );
1012
1026
  } catch (err) {
1013
1027
  const raw = err instanceof Error ? err.message : "Transfer failed";
1014
1028
  const message = formatUserError(raw);
@@ -1502,14 +1516,26 @@ function getDepositEventDetails(event) {
1502
1516
  function isSameRoute(sourceChain, sourceToken, targetChain, targetToken) {
1503
1517
  return sourceChain === targetChain && sourceToken.toLowerCase() === targetToken.toLowerCase();
1504
1518
  }
1505
- function computeTokensForChain(chainId, allowedTokenSet) {
1506
- const all = chainId === "solana" ? SOLANA_TOKENS.map((t) => t.symbol) : getTargetTokenSymbolsForChain(chainId);
1519
+ function chainLabel(chainId) {
1520
+ return getChainName(chainId).replace(/\s+(One|Mainnet|Smart Chain)$/i, "");
1521
+ }
1522
+ function computeTokensForChain(chainId, allowedTokenSet, topTokens) {
1523
+ const fromBackend = topTokens?.[String(chainId)]?.map((t) => t.symbol);
1524
+ const all = fromBackend ?? (chainId === "solana" ? SOLANA_TOKENS.map((t) => t.symbol) : getTargetTokenSymbolsForChain(chainId));
1507
1525
  return allowedTokenSet ? all.filter((s) => allowedTokenSet.has(s.toUpperCase())) : all;
1508
1526
  }
1527
+ function resolveSourceTokenAddress(symbol, chainId, topTokens) {
1528
+ const top = topTokens?.[String(chainId)]?.find((t) => t.symbol === symbol);
1529
+ return top?.address ?? getTokenAddress(symbol, chainId);
1530
+ }
1531
+ function TokenGlyph({ symbol }) {
1532
+ const icon = getTokenIcon(symbol);
1533
+ return icon ? /* @__PURE__ */ jsx6("img", { src: icon, alt: "", className: "rs-deposit-address-dropdown-icon" }) : /* @__PURE__ */ jsx6("span", { className: "rs-deposit-address-dropdown-icon rs-deposit-address-dropdown-icon--fallback", children: symbol.slice(0, 3) });
1534
+ }
1509
1535
  function pickFallbackToken(tokens, current) {
1510
1536
  if (tokens.includes(current)) return current;
1511
1537
  if (tokens.includes("USDC")) return "USDC";
1512
- return tokens[0] ?? "USDC";
1538
+ return tokens[0] ?? "";
1513
1539
  }
1514
1540
  function DepositAddressStep({
1515
1541
  smartAccount,
@@ -1545,15 +1571,33 @@ function DepositAddressStep({
1545
1571
  return options;
1546
1572
  }, [evmChainIds, hasSolana]);
1547
1573
  const BASE_CHAIN_ID2 = 8453;
1548
- const defaultChainId = evmChainIds.includes(BASE_CHAIN_ID2) ? BASE_CHAIN_ID2 : evmChainIds[0];
1574
+ const chainHasAllowedToken = (id) => !allowedTokenSet || getTargetTokenSymbolsForChain(id).some(
1575
+ (s) => allowedTokenSet.has(s.toUpperCase())
1576
+ );
1577
+ const defaultChainId = evmChainIds.includes(BASE_CHAIN_ID2) && chainHasAllowedToken(BASE_CHAIN_ID2) ? BASE_CHAIN_ID2 : evmChainIds.find(chainHasAllowedToken) ?? evmChainIds[0];
1549
1578
  const [sourceChainId, setSourceChainId] = useState5(defaultChainId);
1550
1579
  const isSolana = sourceChainId === "solana";
1580
+ const [topTokens, setTopTokens] = useState5(null);
1581
+ useEffect5(() => {
1582
+ let active = true;
1583
+ service.getTopTokens().then((t) => {
1584
+ if (active) setTopTokens(t);
1585
+ });
1586
+ return () => {
1587
+ active = false;
1588
+ };
1589
+ }, [service]);
1551
1590
  const tokensForChain = useMemo3(
1552
- () => computeTokensForChain(sourceChainId, allowedTokenSet),
1553
- [sourceChainId, allowedTokenSet]
1591
+ () => computeTokensForChain(sourceChainId, allowedTokenSet, topTokens),
1592
+ [sourceChainId, allowedTokenSet, topTokens]
1554
1593
  );
1555
1594
  const defaultToken = pickFallbackToken(tokensForChain, "USDC");
1556
1595
  const [sourceTokenSymbol, setSourceTokenSymbol] = useState5(defaultToken);
1596
+ useEffect5(() => {
1597
+ if (!tokensForChain.includes(sourceTokenSymbol)) {
1598
+ setSourceTokenSymbol(pickFallbackToken(tokensForChain, sourceTokenSymbol));
1599
+ }
1600
+ }, [tokensForChain, sourceTokenSymbol]);
1557
1601
  const [copied, setCopied] = useState5(false);
1558
1602
  const [pollingError, setPollingError] = useState5(null);
1559
1603
  const [chainDropdownOpen, setChainDropdownOpen] = useState5(false);
@@ -1573,9 +1617,10 @@ function DepositAddressStep({
1573
1617
  setLiquidityHelper({ kind: "idle" });
1574
1618
  return;
1575
1619
  }
1576
- const sourceTokenAddress = getTokenAddress(
1620
+ const sourceTokenAddress = resolveSourceTokenAddress(
1577
1621
  sourceTokenSymbol,
1578
- sourceChainId
1622
+ sourceChainId,
1623
+ topTokens
1579
1624
  );
1580
1625
  if (!sourceTokenAddress) {
1581
1626
  setLiquidityHelper({ kind: "idle" });
@@ -1616,7 +1661,8 @@ function DepositAddressStep({
1616
1661
  sourceTokenSymbol,
1617
1662
  targetChain,
1618
1663
  targetToken,
1619
- service
1664
+ service,
1665
+ topTokens
1620
1666
  ]);
1621
1667
  const displayAddress = isSolana && solanaDepositAddress ? solanaDepositAddress : smartAccount;
1622
1668
  useEffect5(() => {
@@ -1658,14 +1704,18 @@ function DepositAddressStep({
1658
1704
  }, [displayAddress, onCopyAddress]);
1659
1705
  const handleSelectChain = useCallback2(
1660
1706
  (nextChain) => {
1661
- const nextTokens = computeTokensForChain(nextChain, allowedTokenSet);
1707
+ const nextTokens = computeTokensForChain(
1708
+ nextChain,
1709
+ allowedTokenSet,
1710
+ topTokens
1711
+ );
1662
1712
  setSourceChainId(nextChain);
1663
1713
  setSourceTokenSymbol(pickFallbackToken(nextTokens, sourceTokenSymbol));
1664
1714
  setChainDropdownOpen(false);
1665
1715
  setTokenDropdownOpen(false);
1666
1716
  setCopied(false);
1667
1717
  },
1668
- [allowedTokenSet, sourceTokenSymbol]
1718
+ [allowedTokenSet, sourceTokenSymbol, topTokens]
1669
1719
  );
1670
1720
  const onDepositSubmittedRef = useRef5(onDepositSubmitted);
1671
1721
  onDepositSubmittedRef.current = onDepositSubmitted;
@@ -1820,7 +1870,7 @@ function DepositAddressStep({
1820
1870
  className: "rs-deposit-address-dropdown-icon"
1821
1871
  }
1822
1872
  ),
1823
- /* @__PURE__ */ jsx6("span", { children: getChainName(sourceChainId) }),
1873
+ /* @__PURE__ */ jsx6("span", { children: chainLabel(sourceChainId) }),
1824
1874
  /* @__PURE__ */ jsx6(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
1825
1875
  ]
1826
1876
  }
@@ -1840,7 +1890,7 @@ function DepositAddressStep({
1840
1890
  className: "rs-deposit-address-dropdown-icon"
1841
1891
  }
1842
1892
  ),
1843
- /* @__PURE__ */ jsx6("span", { children: getChainName(chainId) })
1893
+ /* @__PURE__ */ jsx6("span", { children: chainLabel(chainId) })
1844
1894
  ]
1845
1895
  },
1846
1896
  String(chainId)
@@ -1872,14 +1922,7 @@ function DepositAddressStep({
1872
1922
  setChainDropdownOpen(false);
1873
1923
  },
1874
1924
  children: [
1875
- getTokenIcon(sourceTokenSymbol) && /* @__PURE__ */ jsx6(
1876
- "img",
1877
- {
1878
- src: getTokenIcon(sourceTokenSymbol),
1879
- alt: "",
1880
- className: "rs-deposit-address-dropdown-icon"
1881
- }
1882
- ),
1925
+ /* @__PURE__ */ jsx6(TokenGlyph, { symbol: sourceTokenSymbol }),
1883
1926
  /* @__PURE__ */ jsx6("span", { children: sourceTokenSymbol }),
1884
1927
  /* @__PURE__ */ jsx6(ChevronDownIcon, { className: "rs-deposit-address-dropdown-chevron" })
1885
1928
  ]
@@ -1895,14 +1938,7 @@ function DepositAddressStep({
1895
1938
  setTokenDropdownOpen(false);
1896
1939
  },
1897
1940
  children: [
1898
- getTokenIcon(symbol) && /* @__PURE__ */ jsx6(
1899
- "img",
1900
- {
1901
- src: getTokenIcon(symbol),
1902
- alt: "",
1903
- className: "rs-deposit-address-dropdown-icon"
1904
- }
1905
- ),
1941
+ /* @__PURE__ */ jsx6(TokenGlyph, { symbol }),
1906
1942
  /* @__PURE__ */ jsx6("span", { children: symbol })
1907
1943
  ]
1908
1944
  },
@@ -2176,6 +2212,7 @@ var DEPOSIT_POLL_INTERVAL_MS = 2e3;
2176
2212
  var DEPOSIT_POLL_FAST_INITIAL_DELAY_MS = 1e3;
2177
2213
  var DEPOSIT_POLL_FAST_INTERVAL_MS = 500;
2178
2214
  var IFRAME_LOAD_TIMEOUT_MS = 15e3;
2215
+ var SWAPPED_SUCCESS_HANDOFF_DELAY_MS = 1400;
2179
2216
  var SWAPPED_IFRAME_ORIGINS = new Set(SWAPPED_ORIGINS);
2180
2217
  var SWAPPED_TERMINAL_STATUSES = /* @__PURE__ */ new Set([
2181
2218
  "order_completed",
@@ -2244,7 +2281,8 @@ function SwappedIframeStep({
2244
2281
  onSwappedFailed,
2245
2282
  onClose,
2246
2283
  onGoBack,
2247
- onError
2284
+ onError,
2285
+ onImmersiveChange
2248
2286
  }) {
2249
2287
  const [widgetUrl, setWidgetUrl] = useState6(null);
2250
2288
  const [loadError, setLoadError] = useState6(null);
@@ -2256,6 +2294,7 @@ function SwappedIframeStep({
2256
2294
  const iframeRef = useRef6(null);
2257
2295
  const completeFiredRef = useRef6(false);
2258
2296
  const failedFiredRef = useRef6(false);
2297
+ const completeTimeoutRef = useRef6(null);
2259
2298
  const expectedOrderUuidRef = useRef6(null);
2260
2299
  const expectedExternalCustomerIdRef = useRef6(null);
2261
2300
  const baselineDepositTxHashRef = useRef6(void 0);
@@ -2272,6 +2311,8 @@ function SwappedIframeStep({
2272
2311
  onErrorRef.current = onError;
2273
2312
  const onGoBackRef = useRef6(onGoBack);
2274
2313
  onGoBackRef.current = onGoBack;
2314
+ const onImmersiveChangeRef = useRef6(onImmersiveChange);
2315
+ onImmersiveChangeRef.current = onImmersiveChange;
2275
2316
  const loadUrlRef = useRef6(loadUrl);
2276
2317
  loadUrlRef.current = loadUrl;
2277
2318
  useEffect6(() => {
@@ -2282,6 +2323,10 @@ function SwappedIframeStep({
2282
2323
  setOrderState(null);
2283
2324
  setLatestEvent(null);
2284
2325
  setPhase("iframe");
2326
+ if (completeTimeoutRef.current !== null) {
2327
+ clearTimeout(completeTimeoutRef.current);
2328
+ completeTimeoutRef.current = null;
2329
+ }
2285
2330
  expectedOrderUuidRef.current = null;
2286
2331
  expectedExternalCustomerIdRef.current = null;
2287
2332
  completeFiredRef.current = false;
@@ -2303,6 +2348,10 @@ function SwappedIframeStep({
2303
2348
  });
2304
2349
  return () => {
2305
2350
  cancelled = true;
2351
+ if (completeTimeoutRef.current !== null) {
2352
+ clearTimeout(completeTimeoutRef.current);
2353
+ completeTimeoutRef.current = null;
2354
+ }
2306
2355
  };
2307
2356
  }, [service, smartAccount, retryToken, loadErrorCode, loadErrorFallback]);
2308
2357
  useEffect6(() => {
@@ -2412,10 +2461,11 @@ function SwappedIframeStep({
2412
2461
  return () => window.removeEventListener("message", onMessage);
2413
2462
  }, []);
2414
2463
  useEffect6(() => {
2415
- if (phase === "iframe" && (orderState !== null || latestEvent !== null)) {
2464
+ const swappedProvesLive = orderState !== null && !(variant === "fiat" && orderState.status === "payment_pending");
2465
+ if (phase === "iframe" && (swappedProvesLive || latestEvent !== null)) {
2416
2466
  setPhase("tracker");
2417
2467
  }
2418
- }, [phase, orderState, latestEvent]);
2468
+ }, [phase, orderState, latestEvent, variant]);
2419
2469
  const stepStates = useMemo4(
2420
2470
  () => deriveStepStates(orderState?.status ?? null, latestEvent),
2421
2471
  [orderState, latestEvent]
@@ -2441,15 +2491,21 @@ function SwappedIframeStep({
2441
2491
  const txHash = currentDepositTxHashRef.current;
2442
2492
  if (!txHash) return;
2443
2493
  completeFiredRef.current = true;
2444
- onSwappedCompleteRef.current({
2494
+ const info = {
2495
+ smartAccount,
2445
2496
  txHash,
2446
2497
  orderCrypto: orderState?.orderCrypto ?? null,
2447
2498
  // Base-unit source amount from the deposit row/event, consistent with the
2448
2499
  // wallet/QR path. ProcessingStep + onLifecycle expect base units.
2449
2500
  amount: getEventSourceDetails(latestEvent ?? void 0).amount ?? null,
2501
+ expectedOrderUuid: expectedOrderUuidRef.current,
2450
2502
  initialEvent: latestEvent ?? void 0
2451
- });
2452
- }, [latestEvent, orderState]);
2503
+ };
2504
+ completeTimeoutRef.current = setTimeout(() => {
2505
+ completeTimeoutRef.current = null;
2506
+ onSwappedCompleteRef.current(info);
2507
+ }, SWAPPED_SUCCESS_HANDOFF_DELAY_MS);
2508
+ }, [latestEvent, orderState, smartAccount]);
2453
2509
  useEffect6(() => {
2454
2510
  if (failedFiredRef.current || completeFiredRef.current) return;
2455
2511
  if (!isFailedEvent(latestEvent ?? void 0)) return;
@@ -2462,6 +2518,11 @@ function SwappedIframeStep({
2462
2518
  failureMessageForEvent(latestEvent ?? void 0)
2463
2519
  );
2464
2520
  }, [latestEvent]);
2521
+ const immersive = variant === "fiat" && phase === "iframe" && !loadError;
2522
+ useEffect6(() => {
2523
+ onImmersiveChangeRef.current?.(immersive);
2524
+ }, [immersive]);
2525
+ useEffect6(() => () => onImmersiveChangeRef.current?.(false), []);
2465
2526
  if (phase === "tracker") {
2466
2527
  const paymentReceived = stepStates[0] === "complete";
2467
2528
  if (variant === "connect" && !terminalState && paymentReceived) {
@@ -2508,7 +2569,7 @@ function SwappedIframeStep({
2508
2569
  retryToken
2509
2570
  )
2510
2571
  ] }) }),
2511
- /* @__PURE__ */ jsx9(PoweredBy, {})
2572
+ loadError && /* @__PURE__ */ jsx9(PoweredBy, {})
2512
2573
  ] });
2513
2574
  }
2514
2575
  function deriveStepStates(swappedStatus, latestEvent) {
@@ -2519,10 +2580,10 @@ function deriveStepStates(swappedStatus, latestEvent) {
2519
2580
  return ["failed", "pending", "pending", "pending"];
2520
2581
  }
2521
2582
  const step1Complete = swappedStatus === "order_completed" || swappedStatus === "order_broadcasted";
2522
- const step2Complete = latestEvent !== null;
2583
+ const step2Complete = latestEvent !== null || swappedStatus === "order_broadcasted";
2523
2584
  const step3Complete = latestEvent?.type === "bridge-complete";
2524
2585
  if (step3Complete) {
2525
- return ["complete", "complete", "complete", "pending"];
2586
+ return ["complete", "complete", "complete", "complete"];
2526
2587
  }
2527
2588
  if (step2Complete) {
2528
2589
  return ["complete", "complete", "active", "pending"];
@@ -2571,7 +2632,8 @@ function FiatOnrampStep({
2571
2632
  onSwappedFailed,
2572
2633
  onClose,
2573
2634
  onGoBack,
2574
- onError
2635
+ onError,
2636
+ onImmersiveChange
2575
2637
  }) {
2576
2638
  const loadUrl = useCallback3(async () => {
2577
2639
  const prefetched = consumePrefetchedUrl?.(smartAccount, paymentMethod);
@@ -2602,7 +2664,8 @@ function FiatOnrampStep({
2602
2664
  onSwappedFailed,
2603
2665
  onClose,
2604
2666
  onGoBack,
2605
- onError
2667
+ onError,
2668
+ onImmersiveChange
2606
2669
  }
2607
2670
  );
2608
2671
  }
@@ -2648,7 +2711,8 @@ function ExchangeConnectStep({
2648
2711
  onSwappedFailed,
2649
2712
  onClose,
2650
2713
  onGoBack,
2651
- onError
2714
+ onError,
2715
+ onImmersiveChange
2652
2716
  }) {
2653
2717
  const loadUrl = useCallback4(async () => {
2654
2718
  const res = await service.getSwappedConnectUrl({
@@ -2672,7 +2736,8 @@ function ExchangeConnectStep({
2672
2736
  onSwappedFailed,
2673
2737
  onClose,
2674
2738
  onGoBack,
2675
- onError
2739
+ onError,
2740
+ onImmersiveChange
2676
2741
  }
2677
2742
  );
2678
2743
  }
@@ -4182,7 +4247,8 @@ function createInitialState(overrides) {
4182
4247
  txHash: null,
4183
4248
  directTransfer: false,
4184
4249
  swappedContext: null,
4185
- initialEvent: null
4250
+ initialEvent: null,
4251
+ quoteFeeBreakdown: null
4186
4252
  },
4187
4253
  dappImport: {
4188
4254
  activeProviderId: null,
@@ -4792,10 +4858,22 @@ function applyAction(state, action) {
4792
4858
  txHash: action.txHash,
4793
4859
  directTransfer: action.directTransfer ?? false,
4794
4860
  swappedContext: action.swappedContext ?? null,
4795
- initialEvent: action.initialEvent ?? null
4861
+ initialEvent: action.initialEvent ?? null,
4862
+ quoteFeeBreakdown: action.quoteFeeBreakdown ?? null
4796
4863
  },
4797
4864
  flow: { ...state.flow, step: "processing" }
4798
4865
  };
4866
+ case "processing/quote-fee-breakdown-loaded":
4867
+ if (state.flow.step !== "processing" || state.processing.txHash?.toLowerCase() !== action.txHash.toLowerCase()) {
4868
+ return state;
4869
+ }
4870
+ return {
4871
+ ...state,
4872
+ processing: {
4873
+ ...state.processing,
4874
+ quoteFeeBreakdown: action.quoteFeeBreakdown
4875
+ }
4876
+ };
4799
4877
  case "dapp-import/availability-loading":
4800
4878
  return {
4801
4879
  ...state,
@@ -4963,7 +5041,8 @@ function applyAction(state, action) {
4963
5041
  txHash: null,
4964
5042
  directTransfer: false,
4965
5043
  swappedContext: null,
4966
- initialEvent: null
5044
+ initialEvent: null,
5045
+ quoteFeeBreakdown: null
4967
5046
  },
4968
5047
  // Drop fetched availability wholesale. The fetch effect refetches
4969
5048
  // unconditionally on remount (so keeping the map saves nothing),
@@ -5320,6 +5399,33 @@ function isSameRoute2(sourceChain, sourceToken, targetChain, targetToken) {
5320
5399
  var SWAPPED_SOURCE_CHAIN = 8453;
5321
5400
  var SWAPPED_SOURCE_TOKEN = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
5322
5401
  var SWAPPED_SOURCE_DECIMALS = 6;
5402
+ var SWAPPED_QUOTE_FEE_TIMEOUT_MS = 2500;
5403
+ async function fetchQuoteFeeBreakdown(params) {
5404
+ try {
5405
+ if (BigInt(params.amount) <= 0n) return void 0;
5406
+ } catch {
5407
+ return void 0;
5408
+ }
5409
+ let timeoutId;
5410
+ try {
5411
+ const quote = await Promise.race([
5412
+ params.service.getQuotePreview({
5413
+ account: params.account,
5414
+ sourceChainId: params.sourceChainId,
5415
+ sourceToken: params.sourceToken,
5416
+ amount: params.amount
5417
+ }),
5418
+ new Promise((resolve) => {
5419
+ timeoutId = setTimeout(resolve, SWAPPED_QUOTE_FEE_TIMEOUT_MS, null);
5420
+ })
5421
+ ]);
5422
+ return quote?.fees?.breakdown;
5423
+ } catch {
5424
+ return void 0;
5425
+ } finally {
5426
+ if (timeoutId !== void 0) clearTimeout(timeoutId);
5427
+ }
5428
+ }
5323
5429
  var DEFAULT_FIAT_ONRAMP_METHODS = [
5324
5430
  {
5325
5431
  method: "creditcard",
@@ -5460,7 +5566,8 @@ function deriveStep(flow, d, p, activeEntry, fiat, exchange) {
5460
5566
  inputAmountUsd: d.inputAmountUsd ?? void 0,
5461
5567
  directTransfer: p.directTransfer,
5462
5568
  swappedContext: p.swappedContext ?? void 0,
5463
- initialEvent: p.initialEvent ?? void 0
5569
+ initialEvent: p.initialEvent ?? void 0,
5570
+ quoteFeeBreakdown: p.quoteFeeBreakdown ?? void 0
5464
5571
  };
5465
5572
  }
5466
5573
  }
@@ -5511,6 +5618,7 @@ function DepositFlow({
5511
5618
  uiConfig,
5512
5619
  allowedRoutes,
5513
5620
  onStepChange,
5621
+ onSwappedImmersiveChange,
5514
5622
  onClose,
5515
5623
  onLifecycle,
5516
5624
  onEvent,
@@ -6636,7 +6744,7 @@ function DepositFlow({
6636
6744
  [targetToken, targetChain, storeApi, activeOwner]
6637
6745
  );
6638
6746
  const handleDepositSubmitted = useCallback7(
6639
- (txHash, chainId, amount, token) => {
6747
+ (txHash, chainId, amount, token, quoteFeeBreakdown) => {
6640
6748
  logFlow("evm:submitted", {
6641
6749
  txHash,
6642
6750
  sourceChain: chainId,
@@ -6655,7 +6763,8 @@ function DepositFlow({
6655
6763
  sourceSymbol: asset?.symbol,
6656
6764
  sourceDecimals: asset?.decimals,
6657
6765
  inputAmountUsd: depositAtSubmit.inputAmountUsd ?? void 0,
6658
- directTransfer: !dappImport && isSameRoute2(chainId, token, targetChain, targetToken)
6766
+ directTransfer: !dappImport && isSameRoute2(chainId, token, targetChain, targetToken),
6767
+ quoteFeeBreakdown
6659
6768
  });
6660
6769
  },
6661
6770
  [logFlow, storeApi, targetChain, targetToken]
@@ -6670,10 +6779,12 @@ function DepositFlow({
6670
6779
  const stateAtComplete = storeApi.getState();
6671
6780
  const swappedContext = stateAtComplete.flow.mode === "exchange-connect" ? {
6672
6781
  variant: "connect",
6673
- method: stateAtComplete.exchange.selectedConnection
6782
+ method: stateAtComplete.exchange.selectedConnection,
6783
+ expectedOrderUuid: info.expectedOrderUuid
6674
6784
  } : stateAtComplete.flow.mode === "fiat-onramp" ? {
6675
6785
  variant: "fiat",
6676
- method: stateAtComplete.fiat.selectedMethod
6786
+ method: stateAtComplete.fiat.selectedMethod,
6787
+ expectedOrderUuid: info.expectedOrderUuid
6677
6788
  } : void 0;
6678
6789
  storeApi.dispatch({
6679
6790
  type: "deposit/submitted",
@@ -6693,8 +6804,23 @@ function DepositFlow({
6693
6804
  amount,
6694
6805
  sourceDecimals: SWAPPED_SOURCE_DECIMALS
6695
6806
  });
6807
+ void (async () => {
6808
+ const quoteFeeBreakdown = await fetchQuoteFeeBreakdown({
6809
+ service,
6810
+ account: info.smartAccount,
6811
+ sourceChainId: SWAPPED_SOURCE_CHAIN,
6812
+ sourceToken: SWAPPED_SOURCE_TOKEN,
6813
+ amount
6814
+ });
6815
+ if (!quoteFeeBreakdown) return;
6816
+ storeApi.dispatch({
6817
+ type: "processing/quote-fee-breakdown-loaded",
6818
+ txHash: info.txHash,
6819
+ quoteFeeBreakdown
6820
+ });
6821
+ })();
6696
6822
  },
6697
- [logFlow, storeApi, onLifecycleRef]
6823
+ [logFlow, onLifecycleRef, service, storeApi]
6698
6824
  );
6699
6825
  const handleDepositSubmittedCallback = useCallback7(
6700
6826
  (txHash, sourceChain, amount) => {
@@ -6936,7 +7062,8 @@ function DepositFlow({
6936
7062
  onClose: onClose ?? (() => {
6937
7063
  }),
6938
7064
  onGoBack: handleBack,
6939
- onError: handleError
7065
+ onError: handleError,
7066
+ onImmersiveChange: onSwappedImmersiveChange
6940
7067
  }
6941
7068
  ),
6942
7069
  step.type === "processing" && /* @__PURE__ */ jsx19(
@@ -6954,10 +7081,12 @@ function DepositFlow({
6954
7081
  sourceDecimals: step.sourceDecimals,
6955
7082
  amountUsd: step.inputAmountUsd,
6956
7083
  swappedContext: step.swappedContext,
7084
+ quoteFeeBreakdown: step.quoteFeeBreakdown,
6957
7085
  service,
6958
7086
  directTransfer: step.directTransfer,
6959
7087
  initialEvent: step.initialEvent,
6960
7088
  isSwappedOrder: true,
7089
+ uiConfig,
6961
7090
  onClose,
6962
7091
  onNewDeposit: handleNewDeposit,
6963
7092
  onDepositComplete: handleDepositComplete,
@@ -7005,7 +7134,8 @@ function DepositFlow({
7005
7134
  onClose: onClose ?? (() => {
7006
7135
  }),
7007
7136
  onGoBack: handleBack,
7008
- onError: handleError
7137
+ onError: handleError,
7138
+ onImmersiveChange: onSwappedImmersiveChange
7009
7139
  }
7010
7140
  ),
7011
7141
  step.type === "processing" && /* @__PURE__ */ jsx19(
@@ -7023,10 +7153,12 @@ function DepositFlow({
7023
7153
  sourceDecimals: step.sourceDecimals,
7024
7154
  amountUsd: step.inputAmountUsd,
7025
7155
  swappedContext: step.swappedContext,
7156
+ quoteFeeBreakdown: step.quoteFeeBreakdown,
7026
7157
  service,
7027
7158
  directTransfer: step.directTransfer,
7028
7159
  initialEvent: step.initialEvent,
7029
7160
  isSwappedOrder: true,
7161
+ uiConfig,
7030
7162
  onClose,
7031
7163
  onNewDeposit: handleNewDeposit,
7032
7164
  onDepositComplete: handleDepositComplete,
@@ -7156,6 +7288,7 @@ function DepositFlow({
7156
7288
  service,
7157
7289
  directTransfer: effectiveStep.directTransfer,
7158
7290
  initialEvent: effectiveStep.initialEvent,
7291
+ quoteFeeBreakdown: effectiveStep.quoteFeeBreakdown,
7159
7292
  onClose,
7160
7293
  onNewDeposit: handleNewDeposit,
7161
7294
  onDepositComplete: handleDepositComplete,
@@ -7318,6 +7451,7 @@ function DepositFlow({
7318
7451
  service,
7319
7452
  directTransfer: effectiveStep.directTransfer,
7320
7453
  initialEvent: effectiveStep.initialEvent,
7454
+ quoteFeeBreakdown: effectiveStep.quoteFeeBreakdown,
7321
7455
  uiConfig,
7322
7456
  onClose,
7323
7457
  onNewDeposit: handleNewDeposit,
@@ -7618,7 +7752,7 @@ DepositHistoryPanel.displayName = "DepositHistoryPanel";
7618
7752
  // src/DepositModal.tsx
7619
7753
  import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
7620
7754
  var ReownDepositInner = lazy2(
7621
- () => import("./DepositModalReown-IVRDXQAA.mjs").then((m) => ({ default: m.DepositModalReown }))
7755
+ () => import("./DepositModalReown-T4RRW5FM.mjs").then((m) => ({ default: m.DepositModalReown }))
7622
7756
  );
7623
7757
  function sortByCreatedAtDesc(items) {
7624
7758
  return [...items].sort((a, b) => {
@@ -7698,6 +7832,7 @@ function DepositModalInner({
7698
7832
  const modalRef = useRef9(null);
7699
7833
  const onReadyRef = useLatestRef(onReady);
7700
7834
  const [currentScreen, setCurrentScreen] = useState13("connect");
7835
+ const [swappedImmersive, setSwappedImmersive] = useState13(false);
7701
7836
  const [backHandler, setBackHandler] = useState13(
7702
7837
  void 0
7703
7838
  );
@@ -7747,6 +7882,24 @@ function DepositModalInner({
7747
7882
  }),
7748
7883
  [backendUrl, debug]
7749
7884
  );
7885
+ const [clientSetup, setClientSetup] = useState13(
7886
+ null
7887
+ );
7888
+ useEffect11(() => {
7889
+ if (!isOpen) return;
7890
+ let active = true;
7891
+ service.getSetup().then((config) => {
7892
+ if (active) setClientSetup(config);
7893
+ });
7894
+ return () => {
7895
+ active = false;
7896
+ };
7897
+ }, [isOpen, service]);
7898
+ useEffect11(() => {
7899
+ if (debug && clientSetup) {
7900
+ console.debug("[deposit] client setup config (not shown yet)", clientSetup);
7901
+ }
7902
+ }, [debug, clientSetup]);
7750
7903
  const store = useMemo9(
7751
7904
  () => createDepositStore({ targetChain, targetToken }),
7752
7905
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -7860,6 +8013,9 @@ function DepositModalInner({
7860
8013
  cursorRef.current = null;
7861
8014
  historyStaleRef.current = false;
7862
8015
  historyLoadedRef.current = false;
8016
+ setCurrentScreen("connect");
8017
+ setBackHandler(void 0);
8018
+ setSwappedImmersive(false);
7863
8019
  }
7864
8020
  }, [isOpen]);
7865
8021
  useEffect11(() => {
@@ -7869,6 +8025,8 @@ function DepositModalInner({
7869
8025
  }, [isOpen, store]);
7870
8026
  const showBackButton = uiConfig?.showBackButton ?? true;
7871
8027
  const canGoBack = backHandler !== void 0;
8028
+ const hideHeaderChrome = swappedImmersive;
8029
+ const modalClassName = `rs-modal${hideHeaderChrome ? " rs-modal--swapped-iframe" : ""}`;
7872
8030
  return /* @__PURE__ */ jsx21(RpcUrlsProvider, { value: rpcUrls, children: /* @__PURE__ */ jsx21(DepositStoreProvider, { store, children: /* @__PURE__ */ jsx21(
7873
8031
  Modal,
7874
8032
  {
@@ -7877,8 +8035,8 @@ function DepositModalInner({
7877
8035
  className,
7878
8036
  inline,
7879
8037
  closeOnOverlayClick,
7880
- children: /* @__PURE__ */ jsxs19("div", { ref: modalRef, className: "rs-modal", children: [
7881
- /* @__PURE__ */ jsxs19("div", { className: "rs-modal-header--redesigned", children: [
8038
+ children: /* @__PURE__ */ jsxs19("div", { ref: modalRef, className: modalClassName, children: [
8039
+ !hideHeaderChrome && /* @__PURE__ */ jsxs19("div", { className: "rs-modal-header--redesigned", children: [
7882
8040
  /* @__PURE__ */ jsx21("div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && backHandler && /* @__PURE__ */ jsx21(
7883
8041
  "button",
7884
8042
  {
@@ -7947,6 +8105,7 @@ function DepositModalInner({
7947
8105
  uiConfig,
7948
8106
  allowedRoutes,
7949
8107
  onStepChange: handleStepChange,
8108
+ onSwappedImmersiveChange: setSwappedImmersive,
7950
8109
  onClose,
7951
8110
  onLifecycle: handleLifecycle,
7952
8111
  onEvent,