@rhinestone/deposit-modal 0.14.0 → 0.15.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 (69) hide show
  1. package/README.md +12 -12
  2. package/bridge-transcript.json +14 -0
  3. package/dist/ClaimModal-GFDBVCN5.cjs +11 -0
  4. package/dist/ClaimModal-VQS3AKEL.mjs +11 -0
  5. package/dist/{DepositModalReown-Q2JMLT47.mjs → DepositModalReown-KOJ7VEY7.mjs} +30 -29
  6. package/dist/{DepositModalReown-46LPVFB6.cjs → DepositModalReown-R37SSHUF.cjs} +79 -78
  7. package/dist/WithdrawModal-QVXHMH43.mjs +12 -0
  8. package/dist/WithdrawModal-RY2NMFLE.cjs +12 -0
  9. package/dist/{caip-D8aRWdEY.d.cts → caip-BMi-9t09.d.cts} +27 -3
  10. package/dist/{caip-D8aRWdEY.d.ts → caip-BMi-9t09.d.ts} +27 -3
  11. package/dist/{chunk-V2OBGLJD.cjs → chunk-3OOY67VJ.cjs} +1103 -253
  12. package/dist/{chunk-6KG642KH.cjs → chunk-5P2PVLS4.cjs} +1 -1
  13. package/dist/{chunk-IN77XSWO.mjs → chunk-5VONFVQN.mjs} +976 -126
  14. package/dist/chunk-6HUHVXCY.cjs +704 -0
  15. package/dist/{chunk-PKML3XVS.mjs → chunk-7UQ6OUEE.mjs} +166 -45
  16. package/dist/{chunk-K4H6TGBE.mjs → chunk-CXBMIZUF.mjs} +1 -1
  17. package/dist/{chunk-MTFJSE52.cjs → chunk-DTVZUBHI.cjs} +236 -115
  18. package/dist/{chunk-VUATPOWJ.mjs → chunk-EAGMY3QE.mjs} +74 -17
  19. package/dist/{chunk-RN5VKWI6.mjs → chunk-FTWKAJGN.mjs} +1 -1
  20. package/dist/{chunk-KTUVSKR4.mjs → chunk-IKUYZA7A.mjs} +265 -523
  21. package/dist/{chunk-DW2EQA2U.cjs → chunk-LVCD6RHF.cjs} +2 -2
  22. package/dist/{chunk-4KCSH4T3.cjs → chunk-OY5N3E6L.cjs} +86 -29
  23. package/dist/chunk-QJ7RCCU7.mjs +704 -0
  24. package/dist/chunk-UCBUCX2W.mjs +3169 -0
  25. package/dist/{chunk-YCQZJQO6.cjs → chunk-VPDCGD2D.cjs} +622 -880
  26. package/dist/{chunk-7ICSHJFE.cjs → chunk-X4D52IZK.cjs} +1501 -176
  27. package/dist/claim.cjs +5 -7
  28. package/dist/claim.d.cts +3 -3
  29. package/dist/claim.d.ts +3 -3
  30. package/dist/claim.mjs +4 -6
  31. package/dist/{constants-DBrWhJWE.d.cts → constants-BT4ctuHo.d.cts} +7 -6
  32. package/dist/{constants-DBrWhJWE.d.ts → constants-D21ZdNOP.d.ts} +7 -6
  33. package/dist/constants.cjs +3 -3
  34. package/dist/constants.d.cts +3 -3
  35. package/dist/constants.d.ts +3 -3
  36. package/dist/constants.mjs +2 -2
  37. package/dist/deposit.cjs +7 -8
  38. package/dist/deposit.d.cts +3 -3
  39. package/dist/deposit.d.ts +3 -3
  40. package/dist/deposit.mjs +6 -7
  41. package/dist/embed.cjs +135 -44
  42. package/dist/embed.d.cts +2 -2
  43. package/dist/embed.d.ts +2 -2
  44. package/dist/embed.mjs +116 -25
  45. package/dist/index.cjs +13 -11
  46. package/dist/index.d.cts +3 -3
  47. package/dist/index.d.ts +3 -3
  48. package/dist/index.mjs +12 -10
  49. package/dist/polymarket.cjs +6 -6
  50. package/dist/polymarket.mjs +2 -2
  51. package/dist/styles.css +132 -100
  52. package/dist/{types-Bho4OA03.d.ts → types-CQ0NHqCy.d.ts} +146 -11
  53. package/dist/{types-DP_3KwlD.d.cts → types-CxiLX5sv.d.cts} +146 -11
  54. package/dist/withdraw.cjs +6 -6
  55. package/dist/withdraw.d.cts +4 -4
  56. package/dist/withdraw.d.ts +4 -4
  57. package/dist/withdraw.mjs +5 -5
  58. package/package.json +7 -6
  59. package/dist/ClaimModal-IKTJU43Y.cjs +0 -13
  60. package/dist/ClaimModal-SEKNWRMA.mjs +0 -13
  61. package/dist/WithdrawModal-5ICGD4HJ.mjs +0 -12
  62. package/dist/WithdrawModal-VP6PMIRO.cjs +0 -12
  63. package/dist/chunk-7SR7ENVJ.mjs +0 -1844
  64. package/dist/chunk-CFKC77SV.mjs +0 -1062
  65. package/dist/chunk-LZFRL2AL.cjs +0 -81
  66. package/dist/chunk-WUJIKCFU.mjs +0 -81
  67. package/dist/chunk-X2IPAPXU.cjs +0 -163
  68. package/dist/chunk-YWMWI7PZ.cjs +0 -1062
  69. package/dist/chunk-ZEO6ADM3.mjs +0 -163
@@ -1,4 +1,6 @@
1
1
  import {
2
+ HistoryEntryButton,
3
+ HistoryOverlay,
2
4
  ProcessingStep,
3
5
  SetupError,
4
6
  Tooltip,
@@ -6,6 +8,7 @@ import {
6
8
  computeCacheKey,
7
9
  computeIsCacheable,
8
10
  computeRequestKey,
11
+ createHistoryAnalytics,
9
12
  failureMessageForEvent,
10
13
  fetchTokenPriceUsd,
11
14
  getEventSourceDetails,
@@ -14,20 +17,17 @@ import {
14
17
  getExchangeLogoSrc,
15
18
  isDepositEvent,
16
19
  isFailedEvent,
20
+ isHistoryEntryVisible,
17
21
  isSubmissionUncertain,
18
22
  readDedupedAccountSetupResult,
19
23
  runAccountSetupDeduped,
20
24
  txRefsMatch,
25
+ useHistoryPanel,
21
26
  warnRemovedProps
22
- } from "./chunk-7SR7ENVJ.mjs";
27
+ } from "./chunk-UCBUCX2W.mjs";
23
28
  import {
24
- ListRow
25
- } from "./chunk-WUJIKCFU.mjs";
26
- import {
27
- AlertTriangleIcon,
28
29
  AnalyticsSession,
29
30
  AppleIcon,
30
- ArrowUpRightIcon,
31
31
  BankIcon,
32
32
  BodyHeader,
33
33
  Button,
@@ -42,8 +42,8 @@ import {
42
42
  CopyIcon,
43
43
  ExternalLinkIcon,
44
44
  HandCoinsIcon,
45
- HistoryIcon,
46
45
  InfoIcon,
46
+ ListRow,
47
47
  MigrateAssetsIcon,
48
48
  Modal,
49
49
  PermitDepositSubmitError,
@@ -88,7 +88,7 @@ import {
88
88
  useLatestRef,
89
89
  useRpcUrls,
90
90
  useStableRpcUrls
91
- } from "./chunk-IN77XSWO.mjs";
91
+ } from "./chunk-5VONFVQN.mjs";
92
92
  import {
93
93
  MULTICALL3_ADDRESS,
94
94
  POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS,
@@ -100,7 +100,7 @@ import {
100
100
  executePolymarketSafeTransfer,
101
101
  fetchPolymarketProxyWallet,
102
102
  readPolymarketBalances
103
- } from "./chunk-RN5VKWI6.mjs";
103
+ } from "./chunk-FTWKAJGN.mjs";
104
104
  import {
105
105
  HYPERCORE_CHAIN_ID,
106
106
  HYPERCORE_MIN_DEPOSIT_USD,
@@ -119,27 +119,51 @@ import {
119
119
  getSupportedChainIds,
120
120
  getTargetTokenSymbol,
121
121
  getTargetTokenSymbolsForChain,
122
- getTokenDecimalsByAddress,
123
- getTokenSymbol,
124
- isHyperCoreCaip2,
125
122
  isHyperCoreDestination,
126
123
  isNativeSol,
127
- isSolanaCaip2,
128
124
  isStablecoinSymbol,
129
125
  isVirtualDestination,
130
126
  parseEvmChainId,
131
127
  publishShortlistTokens,
132
128
  targetChainToChainId,
133
129
  toEvmCaip2
134
- } from "./chunk-VUATPOWJ.mjs";
130
+ } from "./chunk-EAGMY3QE.mjs";
131
+
132
+ // src/core/reown-dependencies.ts
133
+ var dependencies;
134
+ var dependenciesPromise;
135
+ function loadReownDependencies() {
136
+ dependenciesPromise ?? (dependenciesPromise = Promise.all([
137
+ import("@reown/appkit/react"),
138
+ import("@reown/appkit/networks"),
139
+ import("@reown/appkit-adapter-wagmi"),
140
+ import("@reown/appkit-adapter-solana"),
141
+ import("@reown/appkit-adapter-solana/react")
142
+ ]).then((modules) => dependencies = modules).catch((cause) => {
143
+ const error = new Error(
144
+ "[rhinestone] reownAppId requires @reown/appkit, @reown/appkit-adapter-wagmi, @reown/appkit-adapter-solana, @solana/web3.js, and @solana/spl-token."
145
+ );
146
+ error.cause = cause;
147
+ throw error;
148
+ }));
149
+ return dependenciesPromise;
150
+ }
151
+ function getReownDependencies() {
152
+ if (!dependencies) {
153
+ throw new Error(
154
+ "[rhinestone] Reown dependencies were accessed before initialization."
155
+ );
156
+ }
157
+ return dependencies;
158
+ }
135
159
 
136
160
  // src/DepositModal.tsx
137
161
  import {
138
- useMemo as useMemo10,
139
- useEffect as useEffect13,
140
- useRef as useRef9,
141
- useState as useState15,
142
- useCallback as useCallback9,
162
+ useMemo as useMemo9,
163
+ useEffect as useEffect14,
164
+ useRef as useRef10,
165
+ useState as useState14,
166
+ useCallback as useCallback8,
143
167
  lazy as lazy2,
144
168
  Suspense as Suspense2
145
169
  } from "react";
@@ -149,9 +173,9 @@ import {
149
173
  useState as useState13,
150
174
  useCallback as useCallback7,
151
175
  useMemo as useMemo8,
152
- useEffect as useEffect12,
176
+ useEffect as useEffect13,
153
177
  useLayoutEffect as useLayoutEffect2,
154
- useRef as useRef8
178
+ useRef as useRef9
155
179
  } from "react";
156
180
 
157
181
  // src/components/steps/ConnectStep.tsx
@@ -4676,44 +4700,45 @@ function SolanaAmountStep({
4676
4700
  }
4677
4701
 
4678
4702
  // src/components/steps/SolanaConfirmStep.tsx
4679
- import { useState as useState12 } from "react";
4703
+ import { useEffect as useEffect12, useRef as useRef8, useState as useState12 } from "react";
4680
4704
  import { parseUnits as parseUnits5 } from "viem";
4681
4705
 
4682
4706
  // src/core/solana.ts
4683
- import {
4684
- Connection,
4685
- PublicKey,
4686
- SystemProgram,
4687
- Transaction
4688
- } from "@solana/web3.js";
4689
- import {
4690
- getAssociatedTokenAddress,
4691
- createAssociatedTokenAccountInstruction,
4692
- createTransferInstruction
4693
- } from "@solana/spl-token";
4694
4707
  var DEFAULT_SOLANA_RPC_URL = "https://api.mainnet.solana.com";
4695
4708
  var cachedConnections = /* @__PURE__ */ new Map();
4709
+ var dependenciesPromise2;
4710
+ function loadSolanaDependencies() {
4711
+ dependenciesPromise2 ?? (dependenciesPromise2 = Promise.all([
4712
+ import("@solana/web3.js"),
4713
+ import("@solana/spl-token")
4714
+ ]));
4715
+ return dependenciesPromise2;
4716
+ }
4696
4717
  function getSolanaRpcUrl(rpcUrls) {
4697
4718
  return rpcUrlFor(rpcUrls, "solana") ?? DEFAULT_SOLANA_RPC_URL;
4698
4719
  }
4699
4720
  function hasConfiguredSolanaRpcUrl(rpcUrls) {
4700
4721
  return rpcUrlFor(rpcUrls, "solana") !== void 0;
4701
4722
  }
4702
- function getSolanaConnection(rpcUrls) {
4723
+ async function getSolanaConnection(rpcUrls) {
4703
4724
  const rpcUrl = getSolanaRpcUrl(rpcUrls);
4704
4725
  const cached = cachedConnections.get(rpcUrl);
4705
4726
  if (cached) {
4706
4727
  return cached;
4707
4728
  }
4708
- const next = new Connection(rpcUrl, "confirmed");
4729
+ const [web3] = await loadSolanaDependencies();
4730
+ const initialized = cachedConnections.get(rpcUrl);
4731
+ if (initialized) return initialized;
4732
+ const next = new web3.Connection(rpcUrl, "confirmed");
4709
4733
  cachedConnections.set(rpcUrl, next);
4710
4734
  return next;
4711
4735
  }
4712
4736
  async function buildSolTransferTransaction(connection, from, to, lamports) {
4713
- const fromPubkey = new PublicKey(from);
4714
- const toPubkey = new PublicKey(to);
4715
- const tx = new Transaction().add(
4716
- SystemProgram.transfer({
4737
+ const [web3] = await loadSolanaDependencies();
4738
+ const fromPubkey = new web3.PublicKey(from);
4739
+ const toPubkey = new web3.PublicKey(to);
4740
+ const tx = new web3.Transaction().add(
4741
+ web3.SystemProgram.transfer({
4717
4742
  fromPubkey,
4718
4743
  toPubkey,
4719
4744
  lamports
@@ -4726,16 +4751,24 @@ async function buildSolTransferTransaction(connection, from, to, lamports) {
4726
4751
  return tx;
4727
4752
  }
4728
4753
  async function buildSplTransferTransaction(connection, from, to, mint, amount) {
4729
- const fromPubkey = new PublicKey(from);
4730
- const toPubkey = new PublicKey(to);
4731
- const mintPubkey = new PublicKey(mint);
4732
- const fromAta = await getAssociatedTokenAddress(mintPubkey, fromPubkey);
4733
- const toAta = await getAssociatedTokenAddress(mintPubkey, toPubkey, true);
4734
- const tx = new Transaction();
4754
+ const [web3, splToken] = await loadSolanaDependencies();
4755
+ const fromPubkey = new web3.PublicKey(from);
4756
+ const toPubkey = new web3.PublicKey(to);
4757
+ const mintPubkey = new web3.PublicKey(mint);
4758
+ const fromAta = await splToken.getAssociatedTokenAddress(
4759
+ mintPubkey,
4760
+ fromPubkey
4761
+ );
4762
+ const toAta = await splToken.getAssociatedTokenAddress(
4763
+ mintPubkey,
4764
+ toPubkey,
4765
+ true
4766
+ );
4767
+ const tx = new web3.Transaction();
4735
4768
  const toAtaInfo = await connection.getAccountInfo(toAta);
4736
4769
  if (!toAtaInfo) {
4737
4770
  tx.add(
4738
- createAssociatedTokenAccountInstruction(
4771
+ splToken.createAssociatedTokenAccountInstruction(
4739
4772
  fromPubkey,
4740
4773
  toAta,
4741
4774
  toPubkey,
@@ -4743,7 +4776,9 @@ async function buildSplTransferTransaction(connection, from, to, mint, amount) {
4743
4776
  )
4744
4777
  );
4745
4778
  }
4746
- tx.add(createTransferInstruction(fromAta, toAta, fromPubkey, amount));
4779
+ tx.add(
4780
+ splToken.createTransferInstruction(fromAta, toAta, fromPubkey, amount)
4781
+ );
4747
4782
  const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash();
4748
4783
  tx.recentBlockhash = blockhash;
4749
4784
  tx.lastValidBlockHeight = lastValidBlockHeight;
@@ -4797,11 +4832,18 @@ function SolanaConfirmStep({
4797
4832
  estimatedTime = "< 1 min",
4798
4833
  onConfirm,
4799
4834
  onError,
4835
+ onSubmittingChange,
4800
4836
  debug
4801
4837
  }) {
4802
4838
  const rpcUrls = useRpcUrls();
4803
4839
  const [isSubmitting, setIsSubmitting] = useState12(false);
4804
4840
  const [error, setError] = useState12(null);
4841
+ const onSubmittingChangeRef = useRef8(onSubmittingChange);
4842
+ onSubmittingChangeRef.current = onSubmittingChange;
4843
+ useEffect12(() => {
4844
+ onSubmittingChangeRef.current?.(isSubmitting);
4845
+ return () => onSubmittingChangeRef.current?.(false);
4846
+ }, [isSubmitting]);
4805
4847
  const targetChainId = targetChainToChainId(targetChain);
4806
4848
  const targetSymbol = getTargetTokenSymbol(targetToken, targetChainId);
4807
4849
  const sourceChainName = getChainName("solana");
@@ -4867,7 +4909,7 @@ function SolanaConfirmStep({
4867
4909
  "Deposit account is not registered yet. Please restart setup and try again."
4868
4910
  );
4869
4911
  }
4870
- const connection = hasConfiguredSolanaRpcUrl(rpcUrls) ? getSolanaConnection(rpcUrls) : solanaConnection ?? getSolanaConnection(rpcUrls);
4912
+ const connection = await (hasConfiguredSolanaRpcUrl(rpcUrls) ? getSolanaConnection(rpcUrls) : solanaConnection ?? getSolanaConnection(rpcUrls));
4871
4913
  const amountUnits = parseUnits5(sourceAmount, token.decimals);
4872
4914
  debugLog(debug, "solana-confirm", "tx:build:start", {
4873
4915
  token: token.symbol,
@@ -5871,6 +5913,10 @@ function createDepositAnalyticsController(emit) {
5871
5913
  dedupe.add(key);
5872
5914
  emit(...args);
5873
5915
  };
5916
+ const sendHistory = (type, detail) => {
5917
+ controller.openSession();
5918
+ emit(...[{ type, ...detail }, method]);
5919
+ };
5874
5920
  const controller = {
5875
5921
  emit,
5876
5922
  openSession() {
@@ -5878,6 +5924,21 @@ function createDepositAnalyticsController(emit) {
5878
5924
  opened = true;
5879
5925
  emit({ type: "deposit_modal_open" }, null);
5880
5926
  },
5927
+ historyOpened(detail) {
5928
+ sendHistory("deposit_modal_history_open", detail);
5929
+ },
5930
+ historyRowViewed(detail) {
5931
+ sendHistory("deposit_modal_history_row_view", detail);
5932
+ },
5933
+ historyLoadMore(detail) {
5934
+ sendHistory("deposit_modal_history_load_more", detail);
5935
+ },
5936
+ historyFallbackOpened(detail) {
5937
+ sendHistory("deposit_modal_history_fallback_open", detail);
5938
+ },
5939
+ historyRecoveryStarted(detail) {
5940
+ sendHistory("deposit_modal_history_recovery_start", detail);
5941
+ },
5881
5942
  selectMethod(...args) {
5882
5943
  const [nextMethod, entrySource, identifiers] = args;
5883
5944
  controller.openSession();
@@ -7355,6 +7416,7 @@ function DepositFlow({
7355
7416
  onSwappedImmersiveChange,
7356
7417
  openExternally,
7357
7418
  onSubmittingChange,
7419
+ onProcessingSettledChange,
7358
7420
  onClose,
7359
7421
  onLifecycle,
7360
7422
  onError,
@@ -7377,8 +7439,8 @@ function DepositFlow({
7377
7439
  const isConnectSelectionConfirmed = flowSlice.isConnectSelectionConfirmed;
7378
7440
  const selectedWalletId = useDepositStore(selectedWalletIdSelector);
7379
7441
  const [totalBalanceUsd, setTotalBalanceUsd] = useState13(0);
7380
- const stableWalletSignerRef = useRef8(null);
7381
- const stableWalletSelectionKeyRef = useRef8(null);
7442
+ const stableWalletSignerRef = useRef9(null);
7443
+ const stableWalletSelectionKeyRef = useRef9(null);
7382
7444
  const logFlow = useCallback7(
7383
7445
  (message, data) => {
7384
7446
  debugLog(debug, "deposit-flow", message, data);
@@ -7392,7 +7454,7 @@ function DepositFlow({
7392
7454
  [debug]
7393
7455
  );
7394
7456
  const enableSwappedPreconnect = enableFiatOnramp || enableExchangeConnect;
7395
- useEffect12(() => {
7457
+ useEffect13(() => {
7396
7458
  if (!enableSwappedPreconnect) return;
7397
7459
  if (typeof document === "undefined") return;
7398
7460
  const links = [];
@@ -7512,8 +7574,8 @@ function DepositFlow({
7512
7574
  const targetChainId = targetChainToChainId(targetChain);
7513
7575
  const targetSymbol = getTargetTokenSymbol(targetToken, targetChainId);
7514
7576
  const isTargetStablecoin = isStablecoinSymbol(targetSymbol);
7515
- const targetMarketPriceRef = useRef8(null);
7516
- useEffect12(() => {
7577
+ const targetMarketPriceRef = useRef9(null);
7578
+ useEffect13(() => {
7517
7579
  targetMarketPriceRef.current = null;
7518
7580
  if (isTargetStablecoin || targetSymbol === "Token") {
7519
7581
  return;
@@ -7591,7 +7653,7 @@ function DepositFlow({
7591
7653
  setupChainId,
7592
7654
  rpcUrls
7593
7655
  ]);
7594
- useEffect12(() => {
7656
+ useEffect13(() => {
7595
7657
  if (flowMode !== "wallet" && flowMode !== "dapp-import") {
7596
7658
  stableWalletSelectionKeyRef.current = null;
7597
7659
  stableWalletSignerRef.current = null;
@@ -7663,8 +7725,8 @@ function DepositFlow({
7663
7725
  ]
7664
7726
  );
7665
7727
  const activeEntry = setupSlice;
7666
- const lastSmartAccountLifecycleKeyRef = useRef8(null);
7667
- useEffect12(() => {
7728
+ const lastSmartAccountLifecycleKeyRef = useRef9(null);
7729
+ useEffect13(() => {
7668
7730
  if (activeEntry.status !== "ready" || !activeEntry.smartAccount) return;
7669
7731
  const lifecycleKey = [
7670
7732
  activeEntry.smartAccount.toLowerCase(),
@@ -7683,8 +7745,8 @@ function DepositFlow({
7683
7745
  activeEntry.solanaDepositAddress,
7684
7746
  onLifecycleRef
7685
7747
  ]);
7686
- const lastConnectedLifecycleKeyRef = useRef8(null);
7687
- useEffect12(() => {
7748
+ const lastConnectedLifecycleKeyRef = useRef9(null);
7749
+ useEffect13(() => {
7688
7750
  if (!flowMode || !isConnectSelectionConfirmed) {
7689
7751
  lastConnectedLifecycleKeyRef.current = null;
7690
7752
  return;
@@ -7782,7 +7844,7 @@ function DepositFlow({
7782
7844
  const qrSourceAsset = effectiveStep.type === "qr-amount" ? effectiveStep.asset : null;
7783
7845
  const qrSourceKey = qrSourceAsset ? `${qrSourceAsset.chainId}:${qrSourceAsset.token}` : null;
7784
7846
  const [qrSourcePrice, setQrSourcePrice] = useState13({ resolved: false, usd: null });
7785
- useEffect12(() => {
7847
+ useEffect13(() => {
7786
7848
  setQrSourcePrice({ resolved: false, usd: null });
7787
7849
  if (!qrSourceAsset) return;
7788
7850
  let cancelled = false;
@@ -7808,12 +7870,12 @@ function DepositFlow({
7808
7870
  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;
7809
7871
  const currentBackHandler = canGoBackFromHere ? handleBack : void 0;
7810
7872
  const currentScreen = showConnectStep ? "connect" : effectiveStep.type;
7811
- useEffect12(() => {
7873
+ useEffect13(() => {
7812
7874
  onStepChangeRef.current?.(currentBackHandler, currentScreen);
7813
7875
  }, [currentBackHandler, currentScreen, onStepChangeRef]);
7814
- const lastModalHeightRef = useRef8(0);
7815
- const modalContentElRef = useRef8(null);
7816
- useEffect12(() => {
7876
+ const lastModalHeightRef = useRef9(0);
7877
+ const modalContentElRef = useRef9(null);
7878
+ useEffect13(() => {
7817
7879
  const mc = document.querySelector(".rs-modal-content");
7818
7880
  if (!mc) return;
7819
7881
  modalContentElRef.current = mc;
@@ -7830,7 +7892,7 @@ function DepositFlow({
7830
7892
  };
7831
7893
  }, []);
7832
7894
  const stepPinKey = `${flowMode ?? "none"}:${step.type}`;
7833
- const prevStepPinKeyRef = useRef8(stepPinKey);
7895
+ const prevStepPinKeyRef = useRef9(stepPinKey);
7834
7896
  useLayoutEffect2(() => {
7835
7897
  if (prevStepPinKeyRef.current === stepPinKey) return;
7836
7898
  prevStepPinKeyRef.current = stepPinKey;
@@ -7852,18 +7914,18 @@ function DepositFlow({
7852
7914
  analyticsMethod,
7853
7915
  showConnectStep ? "connect" : effectiveStep.type
7854
7916
  );
7855
- useEffect12(() => {
7917
+ useEffect13(() => {
7856
7918
  analytics.openSession();
7857
7919
  analytics.openStep(analyticsStep);
7858
7920
  }, [analytics, analyticsStep]);
7859
- useEffect12(() => {
7921
+ useEffect13(() => {
7860
7922
  if (setupSlice.status === "loading") {
7861
7923
  analytics.friction("account_setup_pending", "account_setup");
7862
7924
  } else if (setupSlice.status === "error") {
7863
7925
  analytics.failure("account_setup_failed", true, "account_setup");
7864
7926
  }
7865
7927
  }, [analytics, setupSlice.status]);
7866
- useEffect12(() => {
7928
+ useEffect13(() => {
7867
7929
  logFlow("state:changed", {
7868
7930
  step: effectiveStep.type,
7869
7931
  flowMode,
@@ -7879,7 +7941,7 @@ function DepositFlow({
7879
7941
  targetChain,
7880
7942
  targetToken
7881
7943
  ]);
7882
- useEffect12(() => {
7944
+ useEffect13(() => {
7883
7945
  onLifecycleRef.current?.({
7884
7946
  type: "balance-changed",
7885
7947
  totalUsd: totalBalanceUsd
@@ -7956,7 +8018,7 @@ function DepositFlow({
7956
8018
  const dappImportAttemptNonce = useDepositStore(
7957
8019
  (s) => s.dappImport.attemptNonce
7958
8020
  );
7959
- useEffect12(() => {
8021
+ useEffect13(() => {
7960
8022
  if (!dappImportOwner || enabledDappImportProviders.length === 0) {
7961
8023
  storeApi.dispatch({ type: "dapp-import/availability-cleared" });
7962
8024
  return;
@@ -8089,7 +8151,7 @@ function DepositFlow({
8089
8151
  ]);
8090
8152
  const isBootResolving = isDappImportMode && flowSlice.step === "dapp-import-resolving";
8091
8153
  const [hasResolveDeadlinePassed, setHasResolveDeadlinePassed] = useState13(false);
8092
- useEffect12(() => {
8154
+ useEffect13(() => {
8093
8155
  setHasResolveDeadlinePassed(false);
8094
8156
  if (!isBootResolving || dappImportBootError) return;
8095
8157
  const timeout = window.setTimeout(() => {
@@ -8097,7 +8159,7 @@ function DepositFlow({
8097
8159
  }, DAPP_IMPORT_RESOLVE_TIMEOUT_MS);
8098
8160
  return () => window.clearTimeout(timeout);
8099
8161
  }, [isBootResolving, dappImportBootError]);
8100
- useEffect12(() => {
8162
+ useEffect13(() => {
8101
8163
  if (!isBootResolving || dappImportBootError) return;
8102
8164
  const providerId = activeDappImportProviderId;
8103
8165
  if (!providerId) return;
@@ -8202,7 +8264,7 @@ function DepositFlow({
8202
8264
  analytics.selectMethod("exchange_connect", "user");
8203
8265
  storeApi.dispatch({ type: "connect/exchange-selected" });
8204
8266
  }, [analytics, storeApi]);
8205
- const swappedAnalyticsCorrelatorRef = useRef8(null);
8267
+ const swappedAnalyticsCorrelatorRef = useRef9(null);
8206
8268
  const handleSwappedAttemptConsumed = useCallback7((externalCustomerId) => {
8207
8269
  swappedAnalyticsCorrelatorRef.current = externalCustomerId;
8208
8270
  }, []);
@@ -8222,8 +8284,8 @@ function DepositFlow({
8222
8284
  );
8223
8285
  swappedAnalyticsCorrelatorRef.current = null;
8224
8286
  }, [analytics, flowMode]);
8225
- const swappedConnectUrlRef = useRef8(/* @__PURE__ */ new Map());
8226
- const acknowledgedConnectFeeRef = useRef8(/* @__PURE__ */ new Map());
8287
+ const swappedConnectUrlRef = useRef9(/* @__PURE__ */ new Map());
8288
+ const acknowledgedConnectFeeRef = useRef9(/* @__PURE__ */ new Map());
8227
8289
  const handleSelectExchangeConnection = useCallback7(
8228
8290
  async (connection, disclosedFeeBps) => {
8229
8291
  if (setupSlice.status !== "ready" || !setupSlice.smartAccount) {
@@ -8299,7 +8361,7 @@ function DepositFlow({
8299
8361
  },
8300
8362
  [service]
8301
8363
  );
8302
- const swappedUrlPrefetchRef = useRef8(/* @__PURE__ */ new Map());
8364
+ const swappedUrlPrefetchRef = useRef9(/* @__PURE__ */ new Map());
8303
8365
  const prefetchSwappedWidgetUrl = useCallback7(
8304
8366
  (smartAccount, method, methodSelectionSource) => {
8305
8367
  const cache = swappedUrlPrefetchRef.current;
@@ -8351,7 +8413,7 @@ function DepositFlow({
8351
8413
  prefetchSwappedWidgetUrl
8352
8414
  ]
8353
8415
  );
8354
- useEffect12(() => {
8416
+ useEffect13(() => {
8355
8417
  swappedUrlPrefetchRef.current.clear();
8356
8418
  swappedConnectUrlRef.current.clear();
8357
8419
  acknowledgedConnectFeeRef.current.clear();
@@ -8363,7 +8425,7 @@ function DepositFlow({
8363
8425
  methods: [],
8364
8426
  recommendedMethod: null
8365
8427
  });
8366
- useEffect12(() => {
8428
+ useEffect13(() => {
8367
8429
  if (!fiatEnabled || hasConfiguredFiatMethods) return;
8368
8430
  let cancelled = false;
8369
8431
  setRegionalMethods({
@@ -8421,7 +8483,7 @@ function DepositFlow({
8421
8483
  offeredFiatMethods,
8422
8484
  regionalMethods
8423
8485
  ]);
8424
- useEffect12(() => {
8486
+ useEffect13(() => {
8425
8487
  if (cashDisplay.kind === "hidden" && fiatEnabled) {
8426
8488
  analytics.friction(
8427
8489
  "regional_methods_empty",
@@ -8485,7 +8547,7 @@ function DepositFlow({
8485
8547
  );
8486
8548
  const desiredSetupRequestKey = computeRequestKey(setupInput);
8487
8549
  const setupReady = setupSlice.status === "ready" && setupSlice.requestKey === desiredSetupRequestKey;
8488
- useEffect12(() => {
8550
+ useEffect13(() => {
8489
8551
  void (async () => {
8490
8552
  const requestKey = computeRequestKey(setupInput);
8491
8553
  const cacheKey = computeCacheKey(setupInput);
@@ -8556,7 +8618,7 @@ function DepositFlow({
8556
8618
  // eslint-disable-next-line react-hooks/exhaustive-deps -- keyed on the stable id-join, not the walletOptions array identity
8557
8619
  [walletOptionsKey]
8558
8620
  );
8559
- useEffect12(() => {
8621
+ useEffect13(() => {
8560
8622
  storeApi.dispatch({
8561
8623
  type: "portfolio/reconciled",
8562
8624
  wallets: desiredPortfolios
@@ -8903,7 +8965,7 @@ function DepositFlow({
8903
8965
  const handleTotalBalanceComputed = useCallback7((total) => {
8904
8966
  setTotalBalanceUsd(total);
8905
8967
  }, []);
8906
- useEffect12(() => {
8968
+ useEffect13(() => {
8907
8969
  if (storeApi.getState().flow.mode) {
8908
8970
  return;
8909
8971
  }
@@ -8913,7 +8975,7 @@ function DepositFlow({
8913
8975
  storeApi.dispatch({ type: "flow/step-set", step: "connect" });
8914
8976
  }
8915
8977
  }, [walletOptionsKey]);
8916
- useEffect12(() => {
8978
+ useEffect13(() => {
8917
8979
  if (!showConnectStep && isConnectSelectionConfirmed && (flowMode === "wallet" || flowMode === "dapp-import") && flowSlice.step !== "dapp-import-resolving" && flowSlice.step !== "dapp-import-select" && !signerContext) {
8918
8980
  storeApi.dispatch({ type: "wallet/cleared" });
8919
8981
  }
@@ -9168,7 +9230,8 @@ function DepositFlow({
9168
9230
  onDepositComplete: handleDepositComplete,
9169
9231
  onDepositFailed: handleDepositFailed,
9170
9232
  onError: handleError,
9171
- debug
9233
+ debug,
9234
+ onSettledChange: onProcessingSettledChange
9172
9235
  }
9173
9236
  )
9174
9237
  ]
@@ -9247,7 +9310,8 @@ function DepositFlow({
9247
9310
  onDepositComplete: handleDepositComplete,
9248
9311
  onDepositFailed: handleDepositFailed,
9249
9312
  onError: handleError,
9250
- debug
9313
+ debug,
9314
+ onSettledChange: onProcessingSettledChange
9251
9315
  }
9252
9316
  )
9253
9317
  ]
@@ -9311,7 +9375,8 @@ function DepositFlow({
9311
9375
  uiConfig,
9312
9376
  onConfirm: handleSolanaConfirmed,
9313
9377
  onError: handleError,
9314
- debug
9378
+ debug,
9379
+ onSubmittingChange
9315
9380
  }
9316
9381
  ) : effectiveStep.type === "solana-confirm" ? /* @__PURE__ */ jsxs23("div", { className: "rs-step", children: [
9317
9382
  /* @__PURE__ */ jsxs23("div", { className: "rs-loading-state", children: [
@@ -9371,7 +9436,8 @@ function DepositFlow({
9371
9436
  onDepositComplete: handleDepositComplete,
9372
9437
  onDepositFailed: handleDepositFailed,
9373
9438
  onError: handleError,
9374
- debug
9439
+ debug,
9440
+ onSettledChange: onProcessingSettledChange
9375
9441
  }
9376
9442
  )
9377
9443
  ] });
@@ -9568,306 +9634,20 @@ function DepositFlow({
9568
9634
  onDepositComplete: handleDepositComplete,
9569
9635
  onDepositFailed: handleDepositFailed,
9570
9636
  onError: handleError,
9571
- debug
9637
+ debug,
9638
+ onSettledChange: onProcessingSettledChange
9572
9639
  }
9573
9640
  )
9574
9641
  ] });
9575
9642
  }
9576
9643
 
9577
- // src/components/history/DepositHistoryPanel.tsx
9578
- import { useCallback as useCallback8, useMemo as useMemo9, useState as useState14 } from "react";
9579
- import { jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
9580
- function shortenHash(hash) {
9581
- if (hash.length <= 14) return hash;
9582
- return `${hash.slice(0, 6)}\u2026${hash.slice(-4)}`;
9583
- }
9584
- function formatDate(iso) {
9585
- try {
9586
- const date = new Date(iso);
9587
- if (Number.isNaN(date.getTime())) return iso;
9588
- return date.toLocaleDateString("en-US", {
9589
- day: "numeric",
9590
- month: "short",
9591
- year: "numeric"
9592
- });
9593
- } catch {
9594
- return iso;
9595
- }
9596
- }
9597
- function resolveChainId(value) {
9598
- if (value === void 0 || value === null) return null;
9599
- if (typeof value === "number") return value;
9600
- if (isSolanaCaip2(value) || value === "solana") return "solana";
9601
- if (isHyperCoreCaip2(value) || value === "hypercore") return "hypercore";
9602
- const parsed = parseEvmChainId(value);
9603
- if (parsed !== null) return parsed;
9604
- const num = Number(value);
9605
- return Number.isFinite(num) ? num : null;
9606
- }
9607
- function resolveTokenSymbol(token, chainId) {
9608
- if (!token) return "";
9609
- if (chainId === "solana") {
9610
- const normalized = token.toLowerCase();
9611
- const matched = SOLANA_TOKENS.find(
9612
- (entry) => entry.mint.toLowerCase() === normalized
9613
- );
9614
- if (matched) return matched.symbol;
9615
- if (normalized === "native" || normalized === "11111111111111111111111111111111" || normalized === "so11111111111111111111111111111111111111112") {
9616
- return "SOL";
9617
- }
9618
- }
9619
- if (chainId !== null && chainId !== void 0 && chainId !== "solana" && /^0x[a-fA-F0-9]{40}$/.test(token)) {
9620
- const evmChainId = chainId === "hypercore" ? HYPERCORE_CHAIN_ID : chainId;
9621
- const sym = getTokenSymbol(token, evmChainId);
9622
- if (sym !== "Token") return sym;
9623
- }
9624
- return shortenHash(token);
9625
- }
9626
- function formatAmount(rawAmount, token, chainId) {
9627
- if (!rawAmount) return "";
9628
- let decimals = 18;
9629
- if (token && chainId !== null && chainId !== void 0) {
9630
- if (chainId === "solana") {
9631
- const normalized = token.toLowerCase();
9632
- const matched = SOLANA_TOKENS.find(
9633
- (entry) => entry.mint.toLowerCase() === normalized
9634
- );
9635
- if (matched) {
9636
- decimals = matched.decimals;
9637
- } else if (normalized === "native" || normalized === "11111111111111111111111111111111" || normalized === "so11111111111111111111111111111111111111112") {
9638
- decimals = 9;
9639
- }
9640
- } else if (/^0x[a-fA-F0-9]{40}$/.test(token)) {
9641
- const evmChainId = chainId === "hypercore" ? HYPERCORE_CHAIN_ID : chainId;
9642
- decimals = getTokenDecimalsByAddress(token, evmChainId);
9643
- }
9644
- }
9645
- try {
9646
- const raw = BigInt(rawAmount);
9647
- const divisor = 10n ** BigInt(decimals);
9648
- const whole = raw / divisor;
9649
- const remainder = raw % divisor;
9650
- const fracStr = remainder.toString().padStart(decimals, "0");
9651
- let frac = fracStr.slice(0, 5).replace(/0+$/, "");
9652
- if (frac.length < 2) frac = frac.padEnd(2, "0");
9653
- return `${whole}.${frac}`;
9654
- } catch {
9655
- return rawAmount;
9656
- }
9657
- }
9658
- function normalizeStatus(raw, isSpam) {
9659
- const lower = raw.toLowerCase();
9660
- if (lower === "completed" || lower === "complete" || lower === "bridge-complete" || lower === "processed")
9661
- return "completed";
9662
- if (lower === "failed" || lower === "error" || lower === "bridge-failed") {
9663
- return isSpam ? "spam" : "failed";
9664
- }
9665
- if (lower === "processing" || lower === "submitted" || lower === "bridging")
9666
- return "processing";
9667
- return "pending";
9668
- }
9669
- var STATUS_LABEL = {
9670
- pending: "Pending",
9671
- processing: "Processing",
9672
- completed: "Completed",
9673
- failed: "Failed",
9674
- spam: "Spam token"
9675
- };
9676
- function DepositHistoryPanel({
9677
- deposits,
9678
- isLoading,
9679
- error,
9680
- hasMore,
9681
- isLoadingMore,
9682
- onLoadMore,
9683
- onClose,
9684
- onCloseModal
9685
- }) {
9686
- const handleKeyDown = useCallback8(
9687
- (e) => {
9688
- if (e.key === "Escape") {
9689
- e.stopPropagation();
9690
- onClose();
9691
- }
9692
- },
9693
- [onClose]
9694
- );
9695
- const visibleDeposits = useMemo9(() => {
9696
- const sourceHashes = new Set(
9697
- deposits.map((d) => d.sourceTxHash?.toLowerCase()).filter((h) => Boolean(h))
9698
- );
9699
- return deposits.filter(
9700
- (d) => !(d.txHash && sourceHashes.has(d.txHash.toLowerCase()))
9701
- );
9702
- }, [deposits]);
9703
- return /* @__PURE__ */ jsxs24(
9704
- "div",
9705
- {
9706
- className: "rs-history-panel",
9707
- role: "dialog",
9708
- "aria-label": "Deposit history",
9709
- onKeyDown: handleKeyDown,
9710
- children: [
9711
- /* @__PURE__ */ jsxs24("div", { className: "rs-modal-header--redesigned", children: [
9712
- /* @__PURE__ */ jsx29("div", { className: "rs-modal-header-nav-left", children: /* @__PURE__ */ jsx29(
9713
- "button",
9714
- {
9715
- type: "button",
9716
- className: "rs-modal-header-back",
9717
- "aria-label": "Back",
9718
- onClick: onClose,
9719
- children: /* @__PURE__ */ jsx29(ChevronLeftIcon, {})
9720
- }
9721
- ) }),
9722
- /* @__PURE__ */ jsx29("div", { className: "rs-modal-header-nav-right", children: onCloseModal && /* @__PURE__ */ jsx29(
9723
- "button",
9724
- {
9725
- type: "button",
9726
- className: "rs-modal-close",
9727
- "aria-label": "Close",
9728
- onClick: onCloseModal,
9729
- children: /* @__PURE__ */ jsx29(CloseIcon, {})
9730
- }
9731
- ) })
9732
- ] }),
9733
- /* @__PURE__ */ jsxs24("div", { className: "rs-history-screen", children: [
9734
- /* @__PURE__ */ jsxs24("div", { className: "rs-history-screen-body", children: [
9735
- /* @__PURE__ */ jsx29(BodyHeader, { icon: /* @__PURE__ */ jsx29(HistoryIcon, {}), title: "History" }),
9736
- isLoading && deposits.length === 0 && /* @__PURE__ */ jsxs24("div", { className: "rs-history-empty", children: [
9737
- /* @__PURE__ */ jsx29("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx29(HistoryIcon, {}) }),
9738
- /* @__PURE__ */ jsxs24("div", { className: "rs-history-empty-text", children: [
9739
- /* @__PURE__ */ jsx29(Spinner, { className: "rs-spinner--sm" }),
9740
- /* @__PURE__ */ jsx29("span", { className: "rs-history-empty-hint", children: "Loading history\u2026" })
9741
- ] })
9742
- ] }),
9743
- error && !isLoading && /* @__PURE__ */ jsxs24("div", { className: "rs-history-empty", children: [
9744
- /* @__PURE__ */ jsx29("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx29(AlertTriangleIcon, {}) }),
9745
- /* @__PURE__ */ jsxs24("div", { className: "rs-history-empty-text", children: [
9746
- /* @__PURE__ */ jsx29("span", { className: "rs-history-empty-title", children: "Couldn't load history" }),
9747
- /* @__PURE__ */ jsx29("span", { className: "rs-history-empty-hint", children: error })
9748
- ] })
9749
- ] }),
9750
- !isLoading && !error && visibleDeposits.length === 0 && /* @__PURE__ */ jsxs24("div", { className: "rs-history-empty", children: [
9751
- /* @__PURE__ */ jsx29("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx29(HistoryIcon, {}) }),
9752
- /* @__PURE__ */ jsxs24("div", { className: "rs-history-empty-text", children: [
9753
- /* @__PURE__ */ jsx29("span", { className: "rs-history-empty-title", children: "No deposits yet" }),
9754
- /* @__PURE__ */ jsx29("span", { className: "rs-history-empty-hint", children: "Your deposit history will appear here" })
9755
- ] })
9756
- ] }),
9757
- visibleDeposits.length > 0 && /* @__PURE__ */ jsxs24("div", { className: "rs-history-list", children: [
9758
- visibleDeposits.map((deposit, i) => /* @__PURE__ */ jsx29(HistoryCard, { deposit }, deposit.txHash || i)),
9759
- hasMore && /* @__PURE__ */ jsx29(
9760
- "button",
9761
- {
9762
- type: "button",
9763
- className: "rs-history-load-more",
9764
- onClick: onLoadMore,
9765
- disabled: isLoadingMore,
9766
- children: isLoadingMore ? "Loading\u2026" : "Load more"
9767
- }
9768
- )
9769
- ] })
9770
- ] }),
9771
- /* @__PURE__ */ jsx29(PoweredBy, {})
9772
- ] })
9773
- ]
9774
- }
9775
- );
9776
- }
9777
- function HistoryCard({ deposit }) {
9778
- const explorerTxUrl = useExplorerTxUrl();
9779
- const [expanded, setExpanded] = useState14(false);
9780
- const status = normalizeStatus(deposit.status, deposit.isSpam);
9781
- const sourceChainId = resolveChainId(deposit.chain);
9782
- const targetChainId = resolveChainId(deposit.targetChain);
9783
- const sourceChainName = sourceChainId ? getChainName(sourceChainId) : null;
9784
- const targetChainName = targetChainId ? getChainName(targetChainId) : null;
9785
- const sourceChainIcon = sourceChainId ? getChainIcon(sourceChainId) : void 0;
9786
- const targetChainIcon = targetChainId ? getChainIcon(targetChainId) : void 0;
9787
- const sourceSymbol = resolveTokenSymbol(deposit.token, sourceChainId);
9788
- const rawAmount = deposit.sourceAmount && deposit.sourceAmount !== "0" ? deposit.sourceAmount : deposit.amount;
9789
- const formattedAmount = rawAmount ? formatAmount(rawAmount, deposit.token, sourceChainId) : null;
9790
- const displayAmount = formattedAmount ? sourceSymbol && /^USD/.test(sourceSymbol) ? `$${Number(formattedAmount).toLocaleString("en-US", {
9791
- minimumFractionDigits: 2,
9792
- maximumFractionDigits: 2
9793
- })}` : `${formattedAmount} ${sourceSymbol}` : "\u2014";
9794
- const date = deposit.createdAt ? formatDate(deposit.createdAt) : null;
9795
- const txTypeLabel = `Deposit${sourceSymbol ? ` ${sourceSymbol}` : ""}`;
9796
- const srcTxHash = sourceChainId === "hypercore" ? deposit.txHash : deposit.sourceTxHash;
9797
- const srcTxUrl = srcTxHash && sourceChainId ? explorerTxUrl(sourceChainId, srcTxHash) : null;
9798
- return /* @__PURE__ */ jsxs24(
9799
- "button",
9800
- {
9801
- type: "button",
9802
- className: `rs-history-card ${expanded ? "rs-history-card--expanded" : ""}`,
9803
- onClick: () => setExpanded((v) => !v),
9804
- "aria-expanded": expanded,
9805
- children: [
9806
- /* @__PURE__ */ jsxs24("div", { className: "rs-history-card-row", children: [
9807
- /* @__PURE__ */ jsxs24("div", { className: "rs-history-card-icons", children: [
9808
- /* @__PURE__ */ jsx29("span", { className: "rs-history-card-token", children: /* @__PURE__ */ jsx29(TokenIcon, { symbol: sourceSymbol, fallback: sourceSymbol.slice(0, 2) }) }),
9809
- sourceChainIcon && /* @__PURE__ */ jsx29("span", { className: "rs-history-card-chain", children: /* @__PURE__ */ jsx29(CdnIcon, { src: sourceChainIcon }) })
9810
- ] }),
9811
- /* @__PURE__ */ jsxs24("div", { className: "rs-history-card-text", children: [
9812
- /* @__PURE__ */ jsx29("span", { className: "rs-history-card-title", children: txTypeLabel }),
9813
- date && /* @__PURE__ */ jsx29("span", { className: "rs-history-card-date", children: date })
9814
- ] }),
9815
- /* @__PURE__ */ jsxs24("div", { className: "rs-history-card-side", children: [
9816
- /* @__PURE__ */ jsx29("span", { className: "rs-history-card-amount", children: displayAmount }),
9817
- /* @__PURE__ */ jsx29("span", { className: `rs-history-badge rs-history-badge--${status}`, children: STATUS_LABEL[status] })
9818
- ] })
9819
- ] }),
9820
- /* @__PURE__ */ jsx29("div", { className: "rs-history-card-panel", children: /* @__PURE__ */ jsx29("div", { className: "rs-history-card-panel-inner", children: /* @__PURE__ */ jsxs24("div", { className: "rs-history-card-details", children: [
9821
- sourceChainName && /* @__PURE__ */ jsxs24("div", { className: "rs-amount-detail-row", children: [
9822
- /* @__PURE__ */ jsx29("span", { children: "Source chain" }),
9823
- /* @__PURE__ */ jsxs24("span", { className: "rs-amount-detail-value", children: [
9824
- /* @__PURE__ */ jsx29("span", { children: sourceChainName }),
9825
- sourceChainIcon && /* @__PURE__ */ jsx29("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx29(CdnIcon, { src: sourceChainIcon }) })
9826
- ] })
9827
- ] }),
9828
- targetChainName && /* @__PURE__ */ jsxs24("div", { className: "rs-amount-detail-row", children: [
9829
- /* @__PURE__ */ jsx29("span", { children: "Destination chain" }),
9830
- /* @__PURE__ */ jsxs24("span", { className: "rs-amount-detail-value", children: [
9831
- /* @__PURE__ */ jsx29("span", { children: targetChainName }),
9832
- targetChainIcon && /* @__PURE__ */ jsx29("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx29(CdnIcon, { src: targetChainIcon }) })
9833
- ] })
9834
- ] }),
9835
- srcTxUrl && srcTxHash && /* @__PURE__ */ jsxs24("div", { className: "rs-amount-detail-row", children: [
9836
- /* @__PURE__ */ jsx29("span", { children: "Transaction details" }),
9837
- /* @__PURE__ */ jsxs24(
9838
- "a",
9839
- {
9840
- href: srcTxUrl,
9841
- target: "_blank",
9842
- rel: "noopener noreferrer",
9843
- className: "rs-history-card-link",
9844
- onClick: (e) => e.stopPropagation(),
9845
- children: [
9846
- /* @__PURE__ */ jsx29("span", { children: shortenHash(srcTxHash) }),
9847
- /* @__PURE__ */ jsx29(ArrowUpRightIcon, {})
9848
- ]
9849
- }
9850
- )
9851
- ] })
9852
- ] }) }) })
9853
- ]
9854
- }
9855
- );
9856
- }
9857
- DepositHistoryPanel.displayName = "DepositHistoryPanel";
9858
-
9859
9644
  // src/DepositModal.tsx
9860
- import { jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
9861
- var ReownDepositInner = lazy2(
9862
- () => import("./DepositModalReown-Q2JMLT47.mjs").then((m) => ({ default: m.DepositModalReown }))
9863
- );
9864
- function sortByCreatedAtDesc(items) {
9865
- return [...items].sort((a, b) => {
9866
- const at = a.createdAt ? Date.parse(a.createdAt) : 0;
9867
- const bt = b.createdAt ? Date.parse(b.createdAt) : 0;
9868
- return bt - at;
9869
- });
9870
- }
9645
+ import { jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
9646
+ var ReownDepositInner = lazy2(async () => {
9647
+ await loadReownDependencies();
9648
+ const module = await import("./DepositModalReown-KOJ7VEY7.mjs");
9649
+ return { default: module.DepositModalReown };
9650
+ });
9871
9651
  function buildDepositAnalyticsSessionProperties({
9872
9652
  enableWallet = true,
9873
9653
  enableFiatOnramp = false,
@@ -9927,7 +9707,7 @@ function DepositModal(props) {
9927
9707
  const needsReown = !!props.reownAppId;
9928
9708
  const hasWalletClientProp = hasSuppliedWalletClient(props);
9929
9709
  if (needsReown) {
9930
- return /* @__PURE__ */ jsx30(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx30(
9710
+ return /* @__PURE__ */ jsx29(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx29(
9931
9711
  ReownDepositInner,
9932
9712
  {
9933
9713
  ...props,
@@ -9935,7 +9715,7 @@ function DepositModal(props) {
9935
9715
  }
9936
9716
  ) });
9937
9717
  }
9938
- return /* @__PURE__ */ jsx30(
9718
+ return /* @__PURE__ */ jsx29(
9939
9719
  DepositModalInner,
9940
9720
  {
9941
9721
  ...props,
@@ -9988,43 +9768,61 @@ function DepositModalInner({
9988
9768
  onUiState,
9989
9769
  openExternally,
9990
9770
  walletIntegration: walletIntegrationProp,
9771
+ signRecovery,
9991
9772
  debug
9992
9773
  }) {
9993
- const modalRef = useRef9(null);
9994
- const analyticsControllerRef = useRef9(null);
9995
- const previousOpenRef = useRef9(isOpen);
9774
+ const modalRef = useRef10(null);
9775
+ const analyticsControllerRef = useRef10(null);
9776
+ const analyticsSessionIdRef = useRef10(null);
9777
+ const previousOpenRef = useRef10(isOpen);
9996
9778
  const onReadyRef = useLatestRef(onReady);
9997
9779
  const onUiStateRef = useLatestRef(onUiState);
9998
- const [currentScreen, setCurrentScreen] = useState15("connect");
9999
- const [swappedImmersive, setSwappedImmersive] = useState15(false);
10000
- const [submitting, setSubmitting] = useState15(false);
10001
- const [backHandler, setBackHandler] = useState15(
9780
+ const [currentScreen, setCurrentScreen] = useState14("connect");
9781
+ const [swappedImmersive, setSwappedImmersive] = useState14(false);
9782
+ const [submitting, setSubmitting] = useState14(false);
9783
+ const [backHandler, setBackHandler] = useState14(
10002
9784
  void 0
10003
9785
  );
10004
- const historyButtonVisible = currentScreen === "connect";
10005
- const [historyOpen, setHistoryOpen] = useState15(false);
10006
- const [historyDeposits, setHistoryDeposits] = useState15([]);
10007
- const [hasMoreHistory, setHasMoreHistory] = useState15(false);
10008
- const [historyLoading, setHistoryLoading] = useState15(false);
10009
- const [historyLoadingMore, setHistoryLoadingMore] = useState15(false);
10010
- const [historyError, setHistoryError] = useState15(null);
10011
- const cursorRef = useRef9(null);
10012
- const historyStaleRef = useRef9(false);
10013
- const historyLoadedRef = useRef9(false);
10014
- const targetChain = targetChainProp === "solana" || targetChainProp === HYPERCORE_SPOT_CAIP2 ? targetChainProp : getChainId(targetChainProp);
9786
+ const [processingSettled, setProcessingSettled] = useState14(false);
9787
+ const historyButtonVisible = isHistoryEntryVisible({
9788
+ screen: currentScreen,
9789
+ submitting,
9790
+ settled: processingSettled
9791
+ });
9792
+ const targetChain = typeof targetChainProp === "string" ? targetChainProp : getChainId(targetChainProp);
10015
9793
  const sourceChain = sourceChainProp ? getChainId(sourceChainProp) : void 0;
10016
9794
  const rpcUrls = useStableRpcUrls(rpcUrlsProp);
10017
- const service = useMemo10(
9795
+ const service = useMemo9(
10018
9796
  () => createDepositService(backendUrl, {
10019
9797
  debug,
10020
9798
  debugScope: "service:deposit"
10021
9799
  }),
10022
9800
  [backendUrl, debug]
10023
9801
  );
10024
- const [clientSetup, setClientSetup] = useState15(
9802
+ const historyAnalytics = useMemo9(
9803
+ () => createHistoryAnalytics({
9804
+ modal: "deposit",
9805
+ controllerRef: analyticsControllerRef,
9806
+ sessionIdRef: analyticsSessionIdRef
9807
+ }),
9808
+ []
9809
+ );
9810
+ const history = useHistoryPanel({
9811
+ isOpen,
9812
+ recipient,
9813
+ service,
9814
+ canRecover: Boolean(signRecovery),
9815
+ analytics: historyAnalytics
9816
+ });
9817
+ const {
9818
+ markStale: markHistoryStale,
9819
+ invalidate: invalidateHistory,
9820
+ recoverySubmitting
9821
+ } = history;
9822
+ const [clientSetup, setClientSetup] = useState14(
10025
9823
  null
10026
9824
  );
10027
- useEffect13(() => {
9825
+ useEffect14(() => {
10028
9826
  if (!isOpen) return;
10029
9827
  let active = true;
10030
9828
  service.getSetup().then((config) => {
@@ -10034,131 +9832,74 @@ function DepositModalInner({
10034
9832
  active = false;
10035
9833
  };
10036
9834
  }, [isOpen, service]);
10037
- useEffect13(() => {
9835
+ useEffect14(() => {
10038
9836
  if (debug && clientSetup) {
10039
9837
  console.debug("[deposit] client setup config (not shown yet)", clientSetup);
10040
9838
  }
10041
9839
  }, [debug, clientSetup]);
10042
- const store = useMemo10(
9840
+ const store = useMemo9(
10043
9841
  () => createDepositStore({ targetChain, targetToken }),
10044
9842
  // eslint-disable-next-line react-hooks/exhaustive-deps
10045
9843
  []
10046
9844
  );
10047
- useEffect13(() => {
9845
+ useEffect14(() => {
10048
9846
  store.dispatch({ type: "target/changed", targetChain, targetToken });
10049
9847
  }, [store, targetChain, targetToken]);
10050
- useEffect13(() => {
9848
+ useEffect14(() => {
10051
9849
  if (!isOpen || !modalRef.current) return;
10052
9850
  return applyTheme(modalRef.current, theme);
10053
9851
  }, [isOpen, theme]);
10054
- useEffect13(() => {
9852
+ useEffect14(() => {
10055
9853
  if (isOpen) {
10056
9854
  onReadyRef.current?.();
10057
9855
  }
10058
9856
  }, [isOpen, onReadyRef]);
10059
- useEffect13(() => {
9857
+ useEffect14(() => {
10060
9858
  onUiStateRef.current?.({
10061
9859
  screen: currentScreen,
10062
9860
  back: backHandler,
10063
- submitting
9861
+ // A recovery in flight is a submission whose outcome is unknown, so a
9862
+ // native host's dismissal lock has to hold through it too.
9863
+ submitting: submitting || recoverySubmitting
10064
9864
  });
10065
- }, [currentScreen, backHandler, submitting, onUiStateRef]);
10066
- const handleStepChange = useCallback9(
9865
+ }, [
9866
+ currentScreen,
9867
+ backHandler,
9868
+ submitting,
9869
+ recoverySubmitting,
9870
+ onUiStateRef
9871
+ ]);
9872
+ const handleStepChange = useCallback8(
10067
9873
  (onBack, screen) => {
10068
9874
  setBackHandler(() => onBack);
10069
9875
  if (screen) setCurrentScreen(screen);
10070
9876
  },
10071
9877
  []
10072
9878
  );
10073
- const fetchHistory = useCallback9(
10074
- async (mode = "initial") => {
10075
- if (!recipient) return;
10076
- const isInitial = mode === "initial";
10077
- if (isInitial) {
10078
- setHistoryLoading(true);
10079
- } else {
10080
- setHistoryLoadingMore(true);
10081
- }
10082
- setHistoryError(null);
10083
- try {
10084
- const cursor = isInitial ? null : cursorRef.current;
10085
- if (!isInitial && !cursor) {
10086
- setHasMoreHistory(false);
10087
- return;
10088
- }
10089
- const result = await service.fetchDepositHistory({
10090
- recipient,
10091
- limit: 20,
10092
- cursor: cursor ?? void 0
10093
- });
10094
- const incoming = result.deposits;
10095
- const nextCursor = result.nextCursor ?? null;
10096
- if (isInitial) {
10097
- setHistoryDeposits(sortByCreatedAtDesc(incoming));
10098
- } else {
10099
- setHistoryDeposits(
10100
- (prev) => sortByCreatedAtDesc([...prev, ...incoming])
10101
- );
10102
- }
10103
- cursorRef.current = nextCursor;
10104
- setHasMoreHistory(Boolean(nextCursor));
10105
- historyStaleRef.current = false;
10106
- historyLoadedRef.current = true;
10107
- } catch (err) {
10108
- setHistoryError(
10109
- err instanceof Error ? err.message : "Failed to load history"
10110
- );
10111
- } finally {
10112
- if (isInitial) {
10113
- setHistoryLoading(false);
10114
- } else {
10115
- setHistoryLoadingMore(false);
10116
- }
10117
- }
10118
- },
10119
- [recipient, service]
10120
- );
10121
- const handleHistoryOpen = useCallback9(() => {
10122
- setHistoryOpen(true);
10123
- if (!historyLoadedRef.current || historyStaleRef.current) {
10124
- fetchHistory("initial");
10125
- }
10126
- }, [fetchHistory]);
10127
- const handleHistoryClose = useCallback9(() => {
10128
- setHistoryOpen(false);
10129
- }, []);
10130
- const handleHistoryLoadMore = useCallback9(() => {
10131
- fetchHistory("more");
10132
- }, [fetchHistory]);
10133
- const markHistoryStale = useCallback9(() => {
10134
- historyStaleRef.current = true;
10135
- if (historyOpen) {
10136
- fetchHistory("initial");
10137
- }
10138
- }, [historyOpen, fetchHistory]);
10139
9879
  const onLifecycleRef = useLatestRef(onLifecycle);
10140
- const handleLifecycle = useCallback9(
9880
+ const handleLifecycle = useCallback8(
10141
9881
  (event) => {
10142
9882
  onLifecycleRef.current?.(event);
10143
9883
  if (event.type === "smart-account-changed" && !event.evm && !event.solana) {
10144
- historyStaleRef.current = true;
9884
+ invalidateHistory();
10145
9885
  }
10146
9886
  if (event.type === "submitted" || event.type === "complete" || event.type === "failed") {
10147
9887
  markHistoryStale();
10148
9888
  }
10149
9889
  },
10150
- [onLifecycleRef, markHistoryStale]
9890
+ [onLifecycleRef, markHistoryStale, invalidateHistory]
10151
9891
  );
10152
- const closeWithSource = useCallback9(
9892
+ const closeWithSource = useCallback8(
10153
9893
  (source) => {
9894
+ if (recoverySubmitting) return;
10154
9895
  const analytics = analyticsControllerRef.current;
10155
9896
  analytics?.abandon(source === "provider_back" ? "provider_back" : "modal_close");
10156
9897
  analytics?.close(source);
10157
9898
  onClose();
10158
9899
  },
10159
- [onClose]
9900
+ [onClose, recoverySubmitting]
10160
9901
  );
10161
- const handleModalDismiss = useCallback9(
9902
+ const handleModalDismiss = useCallback8(
10162
9903
  (reason) => {
10163
9904
  closeWithSource(
10164
9905
  reason === "escape" ? "escape" : reason === "overlay" ? "overlay" : "header_button"
@@ -10166,7 +9907,7 @@ function DepositModalInner({
10166
9907
  },
10167
9908
  [closeWithSource]
10168
9909
  );
10169
- useEffect13(() => {
9910
+ useEffect14(() => {
10170
9911
  if (previousOpenRef.current && !isOpen) {
10171
9912
  const analytics = analyticsControllerRef.current;
10172
9913
  analytics?.abandon("modal_close");
@@ -10174,22 +9915,16 @@ function DepositModalInner({
10174
9915
  }
10175
9916
  previousOpenRef.current = isOpen;
10176
9917
  }, [isOpen]);
10177
- useEffect13(() => {
9918
+ useEffect14(() => {
10178
9919
  if (!isOpen) {
10179
- setHistoryOpen(false);
10180
- setHistoryDeposits([]);
10181
- setHasMoreHistory(false);
10182
- setHistoryError(null);
10183
- cursorRef.current = null;
10184
- historyStaleRef.current = false;
10185
- historyLoadedRef.current = false;
10186
9920
  setCurrentScreen("connect");
10187
9921
  setBackHandler(void 0);
10188
9922
  setSwappedImmersive(false);
10189
9923
  setSubmitting(false);
9924
+ setProcessingSettled(false);
10190
9925
  }
10191
9926
  }, [isOpen]);
10192
- useEffect13(() => {
9927
+ useEffect14(() => {
10193
9928
  if (!isOpen) {
10194
9929
  store.dispatch({ type: "flow/reset" });
10195
9930
  }
@@ -10217,7 +9952,7 @@ function DepositModalInner({
10217
9952
  const canGoBack = backHandler !== void 0;
10218
9953
  const hideHeaderChrome = swappedImmersive;
10219
9954
  const modalClassName = `rs-modal${hideHeaderChrome ? " rs-modal--swapped-iframe" : ""}`;
10220
- return /* @__PURE__ */ jsx30(RpcUrlsProvider, { value: rpcUrls, children: /* @__PURE__ */ jsx30(ChainCatalogProvider, { service, rpcUrls, children: /* @__PURE__ */ jsx30(DepositStoreProvider, { store, children: /* @__PURE__ */ jsx30(
9955
+ return /* @__PURE__ */ jsx29(RpcUrlsProvider, { value: rpcUrls, children: /* @__PURE__ */ jsx29(ChainCatalogProvider, { service, rpcUrls, children: /* @__PURE__ */ jsx29(DepositStoreProvider, { store, children: /* @__PURE__ */ jsx29(
10221
9956
  Modal,
10222
9957
  {
10223
9958
  isOpen,
@@ -10225,7 +9960,8 @@ function DepositModalInner({
10225
9960
  className,
10226
9961
  inline,
10227
9962
  closeOnOverlayClick,
10228
- children: /* @__PURE__ */ jsx30(
9963
+ ariaLabel: "Deposit",
9964
+ children: /* @__PURE__ */ jsx29(
10229
9965
  AnalyticsSession,
10230
9966
  {
10231
9967
  modal: "deposit",
@@ -10234,47 +9970,45 @@ function DepositModalInner({
10234
9970
  backendUrl,
10235
9971
  enableIngest: enableAnalyticsIngest,
10236
9972
  ingestUrl: analyticsIngestUrl,
10237
- children: /* @__PURE__ */ jsx30(
9973
+ sessionIdRef: analyticsSessionIdRef,
9974
+ children: /* @__PURE__ */ jsx29(
10238
9975
  DepositAnalyticsControllerProvider,
10239
9976
  {
10240
9977
  controllerRef: analyticsControllerRef,
10241
- children: /* @__PURE__ */ jsxs25("div", { ref: modalRef, className: modalClassName, children: [
10242
- !hideHeaderChrome && /* @__PURE__ */ jsxs25("div", { className: "rs-modal-header--redesigned", children: [
10243
- /* @__PURE__ */ jsx30("div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && backHandler && /* @__PURE__ */ jsx30(
9978
+ children: /* @__PURE__ */ jsxs24("div", { ref: modalRef, className: modalClassName, children: [
9979
+ !hideHeaderChrome && /* @__PURE__ */ jsxs24("div", { className: "rs-modal-header--redesigned", children: [
9980
+ /* @__PURE__ */ jsx29("div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && backHandler && /* @__PURE__ */ jsx29(
10244
9981
  "button",
10245
9982
  {
10246
9983
  type: "button",
10247
9984
  className: "rs-modal-header-back",
10248
9985
  "aria-label": "Go back",
10249
9986
  onClick: backHandler,
10250
- children: /* @__PURE__ */ jsx30(ChevronLeftIcon, {})
9987
+ children: /* @__PURE__ */ jsx29(ChevronLeftIcon, {})
10251
9988
  }
10252
9989
  ) }),
10253
- /* @__PURE__ */ jsxs25("div", { className: "rs-modal-header-nav-right", children: [
10254
- historyButtonVisible && /* @__PURE__ */ jsx30(
10255
- "button",
9990
+ /* @__PURE__ */ jsxs24("div", { className: "rs-modal-header-nav-right", children: [
9991
+ historyButtonVisible && /* @__PURE__ */ jsx29(
9992
+ HistoryEntryButton,
10256
9993
  {
10257
- type: "button",
10258
- className: "rs-modal-header-history",
10259
- "aria-label": "Deposit history",
10260
- onClick: handleHistoryOpen,
10261
- disabled: !recipient,
10262
- children: /* @__PURE__ */ jsx30(HistoryIcon, {})
9994
+ badge: history.badge,
9995
+ onClick: history.openPanel,
9996
+ disabled: !recipient
10263
9997
  }
10264
9998
  ),
10265
- /* @__PURE__ */ jsx30(
9999
+ /* @__PURE__ */ jsx29(
10266
10000
  "button",
10267
10001
  {
10268
10002
  type: "button",
10269
10003
  onClick: () => closeWithSource("header_button"),
10270
10004
  className: "rs-modal-close",
10271
10005
  "aria-label": "Close",
10272
- children: /* @__PURE__ */ jsx30(CloseIcon, {})
10006
+ children: /* @__PURE__ */ jsx29(CloseIcon, {})
10273
10007
  }
10274
10008
  )
10275
10009
  ] })
10276
10010
  ] }),
10277
- /* @__PURE__ */ jsx30(
10011
+ /* @__PURE__ */ jsx29(
10278
10012
  DepositFlow,
10279
10013
  {
10280
10014
  walletClientProp,
@@ -10311,23 +10045,30 @@ function DepositModalInner({
10311
10045
  onSwappedImmersiveChange: setSwappedImmersive,
10312
10046
  openExternally,
10313
10047
  onSubmittingChange: setSubmitting,
10048
+ onProcessingSettledChange: setProcessingSettled,
10314
10049
  onClose: (source) => closeWithSource(source ?? "header_button"),
10315
10050
  onLifecycle: handleLifecycle,
10316
10051
  onError,
10317
10052
  debug
10318
10053
  }
10319
10054
  ),
10320
- historyOpen && /* @__PURE__ */ jsx30(
10321
- DepositHistoryPanel,
10055
+ history.isPanelOpen && /* @__PURE__ */ jsx29(
10056
+ HistoryOverlay,
10322
10057
  {
10323
- deposits: historyDeposits,
10324
- isLoading: historyLoading,
10325
- error: historyError,
10326
- hasMore: hasMoreHistory,
10327
- isLoadingMore: historyLoadingMore,
10328
- onLoadMore: handleHistoryLoadMore,
10329
- onClose: handleHistoryClose,
10330
- onCloseModal: () => closeWithSource("header_button")
10058
+ controller: history,
10059
+ backLabel: "Deposit",
10060
+ recipient,
10061
+ backendUrl,
10062
+ service,
10063
+ signRecovery,
10064
+ debug,
10065
+ onCloseModal: () => closeWithSource("header_button"),
10066
+ analytics: historyAnalytics,
10067
+ inline,
10068
+ closeOnOverlayClick,
10069
+ enableAnalyticsIngest,
10070
+ analyticsIngestUrl,
10071
+ onEvent
10331
10072
  }
10332
10073
  )
10333
10074
  ] })
@@ -10340,6 +10081,7 @@ function DepositModalInner({
10340
10081
  }
10341
10082
 
10342
10083
  export {
10084
+ getReownDependencies,
10343
10085
  DepositModal,
10344
10086
  DepositModalInner
10345
10087
  };