@rhinestone/deposit-modal 0.14.1 → 0.16.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 (70) hide show
  1. package/README.md +26 -24
  2. package/bridge-transcript.json +14 -0
  3. package/dist/{DepositModalReown-GAD45GIC.cjs → DepositModalReown-IFN6YLZJ.cjs} +20 -22
  4. package/dist/{DepositModalReown-2EVV64OA.mjs → DepositModalReown-R7UROJPJ.mjs} +5 -7
  5. package/dist/WithdrawModal-SZEAI473.cjs +11 -0
  6. package/dist/WithdrawModal-XKSSHVEJ.mjs +11 -0
  7. package/dist/{caip-D8aRWdEY.d.cts → caip-BMi-9t09.d.cts} +27 -3
  8. package/dist/{caip-D8aRWdEY.d.ts → caip-BMi-9t09.d.ts} +27 -3
  9. package/dist/{chunk-A6JPBMYY.cjs → chunk-24N4KMJX.cjs} +234 -115
  10. package/dist/{chunk-LMG46EP2.mjs → chunk-3HCCR54R.mjs} +1 -1
  11. package/dist/{chunk-AQVJUXSG.cjs → chunk-5CM3ZQ5U.cjs} +1 -1
  12. package/dist/chunk-EA5CE2UZ.mjs +7599 -0
  13. package/dist/{chunk-VUATPOWJ.mjs → chunk-EAGMY3QE.mjs} +74 -17
  14. package/dist/{chunk-5Q5CSVKF.mjs → chunk-F6ROQ6RJ.mjs} +215 -517
  15. package/dist/{chunk-RN5VKWI6.mjs → chunk-FTWKAJGN.mjs} +1 -1
  16. package/dist/chunk-H4O22O7Y.cjs +7599 -0
  17. package/dist/{chunk-GZ4GQ5MC.mjs → chunk-HMB2XQGD.mjs} +172 -53
  18. package/dist/{chunk-DW2EQA2U.cjs → chunk-LVCD6RHF.cjs} +2 -2
  19. package/dist/{chunk-4KCSH4T3.cjs → chunk-OY5N3E6L.cjs} +86 -29
  20. package/dist/{chunk-NQMC5VKQ.cjs → chunk-V466XQSG.cjs} +551 -853
  21. package/dist/{constants-DBrWhJWE.d.cts → constants-BT4ctuHo.d.cts} +7 -6
  22. package/dist/{constants-DBrWhJWE.d.ts → constants-D21ZdNOP.d.ts} +7 -6
  23. package/dist/constants.cjs +3 -3
  24. package/dist/constants.d.cts +3 -3
  25. package/dist/constants.d.ts +3 -3
  26. package/dist/constants.mjs +2 -2
  27. package/dist/deposit.cjs +6 -8
  28. package/dist/deposit.d.cts +3 -3
  29. package/dist/deposit.d.ts +3 -3
  30. package/dist/deposit.mjs +5 -7
  31. package/dist/embed.cjs +130 -80
  32. package/dist/embed.d.cts +3 -9
  33. package/dist/embed.d.ts +3 -9
  34. package/dist/embed.mjs +112 -62
  35. package/dist/index.cjs +8 -11
  36. package/dist/index.d.cts +3 -5
  37. package/dist/index.d.ts +3 -5
  38. package/dist/index.mjs +10 -13
  39. package/dist/polymarket.cjs +6 -6
  40. package/dist/polymarket.mjs +2 -2
  41. package/dist/server.d.cts +2 -2
  42. package/dist/server.d.ts +2 -2
  43. package/dist/styles.css +147 -100
  44. package/dist/{types-DP_3KwlD.d.cts → types-B9SbZQIG.d.ts} +145 -108
  45. package/dist/{types-Bho4OA03.d.ts → types-SwGGf0eH.d.cts} +145 -108
  46. package/dist/withdraw.cjs +5 -6
  47. package/dist/withdraw.d.cts +33 -5
  48. package/dist/withdraw.d.ts +33 -5
  49. package/dist/withdraw.mjs +4 -5
  50. package/package.json +6 -37
  51. package/dist/ClaimModal-GDFENSLV.mjs +0 -13
  52. package/dist/ClaimModal-L3FUBI5U.cjs +0 -13
  53. package/dist/WithdrawModal-FAQH35NG.cjs +0 -12
  54. package/dist/WithdrawModal-IKUHF5CF.mjs +0 -12
  55. package/dist/chunk-4J5ADVIN.cjs +0 -1848
  56. package/dist/chunk-62UCV2LG.cjs +0 -81
  57. package/dist/chunk-7AZFT2MV.cjs +0 -163
  58. package/dist/chunk-HAQOFI3D.cjs +0 -3699
  59. package/dist/chunk-QACOOLOE.mjs +0 -1062
  60. package/dist/chunk-R5UQ3TN4.mjs +0 -81
  61. package/dist/chunk-UX35GYLM.mjs +0 -3699
  62. package/dist/chunk-VALXN5IO.mjs +0 -163
  63. package/dist/chunk-XCTRKCNM.mjs +0 -1848
  64. package/dist/chunk-YP7QVKQ6.cjs +0 -1062
  65. package/dist/claim.cjs +0 -11
  66. package/dist/claim.d.cts +0 -17
  67. package/dist/claim.d.ts +0 -17
  68. package/dist/claim.mjs +0 -11
  69. package/dist/modal-ui-state-OD1RmKkK.d.cts +0 -30
  70. package/dist/modal-ui-state-OD1RmKkK.d.ts +0 -30
@@ -1,33 +1,6 @@
1
1
  import {
2
- ProcessingStep,
3
- SetupError,
4
- Tooltip,
5
- analyticsTargetProperties,
6
- computeCacheKey,
7
- computeIsCacheable,
8
- computeRequestKey,
9
- failureMessageForEvent,
10
- fetchTokenPriceUsd,
11
- getEventSourceDetails,
12
- getEventTxHash,
13
- getExchangeLogo,
14
- getExchangeLogoSrc,
15
- isDepositEvent,
16
- isFailedEvent,
17
- isSubmissionUncertain,
18
- readDedupedAccountSetupResult,
19
- runAccountSetupDeduped,
20
- txRefsMatch,
21
- warnRemovedProps
22
- } from "./chunk-XCTRKCNM.mjs";
23
- import {
24
- ListRow
25
- } from "./chunk-R5UQ3TN4.mjs";
26
- import {
27
- AlertTriangleIcon,
28
2
  AnalyticsSession,
29
3
  AppleIcon,
30
- ArrowUpRightIcon,
31
4
  BankIcon,
32
5
  BodyHeader,
33
6
  Button,
@@ -42,53 +15,78 @@ import {
42
15
  CopyIcon,
43
16
  ExternalLinkIcon,
44
17
  HandCoinsIcon,
45
- HistoryIcon,
18
+ HistoryEntryButton,
19
+ HistoryOverlay,
46
20
  InfoIcon,
21
+ ListRow,
47
22
  MigrateAssetsIcon,
48
23
  Modal,
49
24
  PermitDepositSubmitError,
50
25
  PoweredBy,
26
+ ProcessingStep,
51
27
  RpcUrlsProvider,
52
28
  SUPPORTED_CONNECT_EXCHANGE_COUNT,
29
+ SetupError,
53
30
  Spinner,
54
31
  SwappedConnectFeeChangedError,
55
32
  TokenIcon,
33
+ Tooltip,
56
34
  TransferCryptoIcon,
57
35
  UnplugIcon,
58
36
  WalletIcon,
37
+ analyticsTargetProperties,
59
38
  applyTheme,
60
39
  catalogKeyForChain,
61
40
  chainIdsByValue,
62
41
  checkBackendUrl,
42
+ computeCacheKey,
43
+ computeIsCacheable,
44
+ computeRequestKey,
63
45
  createDepositService,
46
+ createHistoryAnalytics,
64
47
  currencyFormatter,
65
48
  debugError,
66
49
  debugLog,
50
+ failureMessageForEvent,
51
+ fetchTokenPriceUsd,
67
52
  formatQuotedReceive,
68
53
  formatReceiveEstimate,
69
54
  formatTokenAmount,
70
55
  formatUserError,
71
56
  getAssetId,
57
+ getEventSourceDetails,
58
+ getEventTxHash,
59
+ getExchangeLogo,
60
+ getExchangeLogoSrc,
72
61
  getPublicClient,
62
+ isDepositEvent,
73
63
  isDisplayStablecoinSymbol,
64
+ isFailedEvent,
65
+ isHistoryEntryVisible,
74
66
  isNativeAsset,
75
67
  isRecognizedToken,
68
+ isSubmissionUncertain,
76
69
  portfolioToAssets,
77
70
  quoteFeeRow,
71
+ readDedupedAccountSetupResult,
78
72
  resolveAppFeeBps,
79
73
  rpcUrlFor,
74
+ runAccountSetupDeduped,
80
75
  tokenFormatter,
76
+ txRefsMatch,
81
77
  useCatalogChain,
82
78
  useChainCatalog,
83
79
  useChainName,
84
80
  useDepositAnalyticsEmitter,
85
81
  useDepositChainIds,
86
82
  useExplorerTxUrl,
83
+ useHistoryPanel,
87
84
  useIsDepositChain,
88
85
  useLatestRef,
89
86
  useRpcUrls,
90
- useStableRpcUrls
91
- } from "./chunk-UX35GYLM.mjs";
87
+ useStableRpcUrls,
88
+ warnRemovedProps
89
+ } from "./chunk-EA5CE2UZ.mjs";
92
90
  import {
93
91
  MULTICALL3_ADDRESS,
94
92
  POLYMARKET_COLLATERAL_OFFRAMP_ADDRESS,
@@ -100,7 +98,7 @@ import {
100
98
  executePolymarketSafeTransfer,
101
99
  fetchPolymarketProxyWallet,
102
100
  readPolymarketBalances
103
- } from "./chunk-RN5VKWI6.mjs";
101
+ } from "./chunk-FTWKAJGN.mjs";
104
102
  import {
105
103
  HYPERCORE_CHAIN_ID,
106
104
  HYPERCORE_MIN_DEPOSIT_USD,
@@ -119,19 +117,15 @@ import {
119
117
  getSupportedChainIds,
120
118
  getTargetTokenSymbol,
121
119
  getTargetTokenSymbolsForChain,
122
- getTokenDecimalsByAddress,
123
- getTokenSymbol,
124
- isHyperCoreCaip2,
125
120
  isHyperCoreDestination,
126
121
  isNativeSol,
127
- isSolanaCaip2,
128
122
  isStablecoinSymbol,
129
123
  isVirtualDestination,
130
124
  parseEvmChainId,
131
125
  publishShortlistTokens,
132
126
  targetChainToChainId,
133
127
  toEvmCaip2
134
- } from "./chunk-VUATPOWJ.mjs";
128
+ } from "./chunk-EAGMY3QE.mjs";
135
129
 
136
130
  // src/core/reown-dependencies.ts
137
131
  var dependencies;
@@ -163,11 +157,11 @@ function getReownDependencies() {
163
157
 
164
158
  // src/DepositModal.tsx
165
159
  import {
166
- useMemo as useMemo10,
167
- useEffect as useEffect13,
168
- useRef as useRef9,
169
- useState as useState15,
170
- useCallback as useCallback9,
160
+ useMemo as useMemo9,
161
+ useEffect as useEffect14,
162
+ useRef as useRef10,
163
+ useState as useState14,
164
+ useCallback as useCallback8,
171
165
  lazy as lazy2,
172
166
  Suspense as Suspense2
173
167
  } from "react";
@@ -177,9 +171,9 @@ import {
177
171
  useState as useState13,
178
172
  useCallback as useCallback7,
179
173
  useMemo as useMemo8,
180
- useEffect as useEffect12,
174
+ useEffect as useEffect13,
181
175
  useLayoutEffect as useLayoutEffect2,
182
- useRef as useRef8
176
+ useRef as useRef9
183
177
  } from "react";
184
178
 
185
179
  // src/components/steps/ConnectStep.tsx
@@ -4704,7 +4698,7 @@ function SolanaAmountStep({
4704
4698
  }
4705
4699
 
4706
4700
  // src/components/steps/SolanaConfirmStep.tsx
4707
- import { useState as useState12 } from "react";
4701
+ import { useEffect as useEffect12, useRef as useRef8, useState as useState12 } from "react";
4708
4702
  import { parseUnits as parseUnits5 } from "viem";
4709
4703
 
4710
4704
  // src/core/solana.ts
@@ -4836,11 +4830,18 @@ function SolanaConfirmStep({
4836
4830
  estimatedTime = "< 1 min",
4837
4831
  onConfirm,
4838
4832
  onError,
4833
+ onSubmittingChange,
4839
4834
  debug
4840
4835
  }) {
4841
4836
  const rpcUrls = useRpcUrls();
4842
4837
  const [isSubmitting, setIsSubmitting] = useState12(false);
4843
4838
  const [error, setError] = useState12(null);
4839
+ const onSubmittingChangeRef = useRef8(onSubmittingChange);
4840
+ onSubmittingChangeRef.current = onSubmittingChange;
4841
+ useEffect12(() => {
4842
+ onSubmittingChangeRef.current?.(isSubmitting);
4843
+ return () => onSubmittingChangeRef.current?.(false);
4844
+ }, [isSubmitting]);
4844
4845
  const targetChainId = targetChainToChainId(targetChain);
4845
4846
  const targetSymbol = getTargetTokenSymbol(targetToken, targetChainId);
4846
4847
  const sourceChainName = getChainName("solana");
@@ -5910,6 +5911,10 @@ function createDepositAnalyticsController(emit) {
5910
5911
  dedupe.add(key);
5911
5912
  emit(...args);
5912
5913
  };
5914
+ const sendHistory = (type, detail) => {
5915
+ controller.openSession();
5916
+ emit(...[{ type, ...detail }, method]);
5917
+ };
5913
5918
  const controller = {
5914
5919
  emit,
5915
5920
  openSession() {
@@ -5917,6 +5922,21 @@ function createDepositAnalyticsController(emit) {
5917
5922
  opened = true;
5918
5923
  emit({ type: "deposit_modal_open" }, null);
5919
5924
  },
5925
+ historyOpened(detail) {
5926
+ sendHistory("deposit_modal_history_open", detail);
5927
+ },
5928
+ historyRowViewed(detail) {
5929
+ sendHistory("deposit_modal_history_row_view", detail);
5930
+ },
5931
+ historyLoadMore(detail) {
5932
+ sendHistory("deposit_modal_history_load_more", detail);
5933
+ },
5934
+ historyFallbackOpened(detail) {
5935
+ sendHistory("deposit_modal_history_fallback_open", detail);
5936
+ },
5937
+ historyRecoveryStarted(detail) {
5938
+ sendHistory("deposit_modal_history_recovery_start", detail);
5939
+ },
5920
5940
  selectMethod(...args) {
5921
5941
  const [nextMethod, entrySource, identifiers] = args;
5922
5942
  controller.openSession();
@@ -7394,6 +7414,7 @@ function DepositFlow({
7394
7414
  onSwappedImmersiveChange,
7395
7415
  openExternally,
7396
7416
  onSubmittingChange,
7417
+ onProcessingSettledChange,
7397
7418
  onClose,
7398
7419
  onLifecycle,
7399
7420
  onError,
@@ -7416,8 +7437,8 @@ function DepositFlow({
7416
7437
  const isConnectSelectionConfirmed = flowSlice.isConnectSelectionConfirmed;
7417
7438
  const selectedWalletId = useDepositStore(selectedWalletIdSelector);
7418
7439
  const [totalBalanceUsd, setTotalBalanceUsd] = useState13(0);
7419
- const stableWalletSignerRef = useRef8(null);
7420
- const stableWalletSelectionKeyRef = useRef8(null);
7440
+ const stableWalletSignerRef = useRef9(null);
7441
+ const stableWalletSelectionKeyRef = useRef9(null);
7421
7442
  const logFlow = useCallback7(
7422
7443
  (message, data) => {
7423
7444
  debugLog(debug, "deposit-flow", message, data);
@@ -7431,7 +7452,7 @@ function DepositFlow({
7431
7452
  [debug]
7432
7453
  );
7433
7454
  const enableSwappedPreconnect = enableFiatOnramp || enableExchangeConnect;
7434
- useEffect12(() => {
7455
+ useEffect13(() => {
7435
7456
  if (!enableSwappedPreconnect) return;
7436
7457
  if (typeof document === "undefined") return;
7437
7458
  const links = [];
@@ -7551,8 +7572,8 @@ function DepositFlow({
7551
7572
  const targetChainId = targetChainToChainId(targetChain);
7552
7573
  const targetSymbol = getTargetTokenSymbol(targetToken, targetChainId);
7553
7574
  const isTargetStablecoin = isStablecoinSymbol(targetSymbol);
7554
- const targetMarketPriceRef = useRef8(null);
7555
- useEffect12(() => {
7575
+ const targetMarketPriceRef = useRef9(null);
7576
+ useEffect13(() => {
7556
7577
  targetMarketPriceRef.current = null;
7557
7578
  if (isTargetStablecoin || targetSymbol === "Token") {
7558
7579
  return;
@@ -7630,7 +7651,7 @@ function DepositFlow({
7630
7651
  setupChainId,
7631
7652
  rpcUrls
7632
7653
  ]);
7633
- useEffect12(() => {
7654
+ useEffect13(() => {
7634
7655
  if (flowMode !== "wallet" && flowMode !== "dapp-import") {
7635
7656
  stableWalletSelectionKeyRef.current = null;
7636
7657
  stableWalletSignerRef.current = null;
@@ -7702,8 +7723,8 @@ function DepositFlow({
7702
7723
  ]
7703
7724
  );
7704
7725
  const activeEntry = setupSlice;
7705
- const lastSmartAccountLifecycleKeyRef = useRef8(null);
7706
- useEffect12(() => {
7726
+ const lastSmartAccountLifecycleKeyRef = useRef9(null);
7727
+ useEffect13(() => {
7707
7728
  if (activeEntry.status !== "ready" || !activeEntry.smartAccount) return;
7708
7729
  const lifecycleKey = [
7709
7730
  activeEntry.smartAccount.toLowerCase(),
@@ -7722,8 +7743,8 @@ function DepositFlow({
7722
7743
  activeEntry.solanaDepositAddress,
7723
7744
  onLifecycleRef
7724
7745
  ]);
7725
- const lastConnectedLifecycleKeyRef = useRef8(null);
7726
- useEffect12(() => {
7746
+ const lastConnectedLifecycleKeyRef = useRef9(null);
7747
+ useEffect13(() => {
7727
7748
  if (!flowMode || !isConnectSelectionConfirmed) {
7728
7749
  lastConnectedLifecycleKeyRef.current = null;
7729
7750
  return;
@@ -7821,7 +7842,7 @@ function DepositFlow({
7821
7842
  const qrSourceAsset = effectiveStep.type === "qr-amount" ? effectiveStep.asset : null;
7822
7843
  const qrSourceKey = qrSourceAsset ? `${qrSourceAsset.chainId}:${qrSourceAsset.token}` : null;
7823
7844
  const [qrSourcePrice, setQrSourcePrice] = useState13({ resolved: false, usd: null });
7824
- useEffect12(() => {
7845
+ useEffect13(() => {
7825
7846
  setQrSourcePrice({ resolved: false, usd: null });
7826
7847
  if (!qrSourceAsset) return;
7827
7848
  let cancelled = false;
@@ -7847,12 +7868,12 @@ function DepositFlow({
7847
7868
  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;
7848
7869
  const currentBackHandler = canGoBackFromHere ? handleBack : void 0;
7849
7870
  const currentScreen = showConnectStep ? "connect" : effectiveStep.type;
7850
- useEffect12(() => {
7871
+ useEffect13(() => {
7851
7872
  onStepChangeRef.current?.(currentBackHandler, currentScreen);
7852
7873
  }, [currentBackHandler, currentScreen, onStepChangeRef]);
7853
- const lastModalHeightRef = useRef8(0);
7854
- const modalContentElRef = useRef8(null);
7855
- useEffect12(() => {
7874
+ const lastModalHeightRef = useRef9(0);
7875
+ const modalContentElRef = useRef9(null);
7876
+ useEffect13(() => {
7856
7877
  const mc = document.querySelector(".rs-modal-content");
7857
7878
  if (!mc) return;
7858
7879
  modalContentElRef.current = mc;
@@ -7869,7 +7890,7 @@ function DepositFlow({
7869
7890
  };
7870
7891
  }, []);
7871
7892
  const stepPinKey = `${flowMode ?? "none"}:${step.type}`;
7872
- const prevStepPinKeyRef = useRef8(stepPinKey);
7893
+ const prevStepPinKeyRef = useRef9(stepPinKey);
7873
7894
  useLayoutEffect2(() => {
7874
7895
  if (prevStepPinKeyRef.current === stepPinKey) return;
7875
7896
  prevStepPinKeyRef.current = stepPinKey;
@@ -7891,18 +7912,18 @@ function DepositFlow({
7891
7912
  analyticsMethod,
7892
7913
  showConnectStep ? "connect" : effectiveStep.type
7893
7914
  );
7894
- useEffect12(() => {
7915
+ useEffect13(() => {
7895
7916
  analytics.openSession();
7896
7917
  analytics.openStep(analyticsStep);
7897
7918
  }, [analytics, analyticsStep]);
7898
- useEffect12(() => {
7919
+ useEffect13(() => {
7899
7920
  if (setupSlice.status === "loading") {
7900
7921
  analytics.friction("account_setup_pending", "account_setup");
7901
7922
  } else if (setupSlice.status === "error") {
7902
7923
  analytics.failure("account_setup_failed", true, "account_setup");
7903
7924
  }
7904
7925
  }, [analytics, setupSlice.status]);
7905
- useEffect12(() => {
7926
+ useEffect13(() => {
7906
7927
  logFlow("state:changed", {
7907
7928
  step: effectiveStep.type,
7908
7929
  flowMode,
@@ -7918,7 +7939,7 @@ function DepositFlow({
7918
7939
  targetChain,
7919
7940
  targetToken
7920
7941
  ]);
7921
- useEffect12(() => {
7942
+ useEffect13(() => {
7922
7943
  onLifecycleRef.current?.({
7923
7944
  type: "balance-changed",
7924
7945
  totalUsd: totalBalanceUsd
@@ -7995,7 +8016,7 @@ function DepositFlow({
7995
8016
  const dappImportAttemptNonce = useDepositStore(
7996
8017
  (s) => s.dappImport.attemptNonce
7997
8018
  );
7998
- useEffect12(() => {
8019
+ useEffect13(() => {
7999
8020
  if (!dappImportOwner || enabledDappImportProviders.length === 0) {
8000
8021
  storeApi.dispatch({ type: "dapp-import/availability-cleared" });
8001
8022
  return;
@@ -8128,7 +8149,7 @@ function DepositFlow({
8128
8149
  ]);
8129
8150
  const isBootResolving = isDappImportMode && flowSlice.step === "dapp-import-resolving";
8130
8151
  const [hasResolveDeadlinePassed, setHasResolveDeadlinePassed] = useState13(false);
8131
- useEffect12(() => {
8152
+ useEffect13(() => {
8132
8153
  setHasResolveDeadlinePassed(false);
8133
8154
  if (!isBootResolving || dappImportBootError) return;
8134
8155
  const timeout = window.setTimeout(() => {
@@ -8136,7 +8157,7 @@ function DepositFlow({
8136
8157
  }, DAPP_IMPORT_RESOLVE_TIMEOUT_MS);
8137
8158
  return () => window.clearTimeout(timeout);
8138
8159
  }, [isBootResolving, dappImportBootError]);
8139
- useEffect12(() => {
8160
+ useEffect13(() => {
8140
8161
  if (!isBootResolving || dappImportBootError) return;
8141
8162
  const providerId = activeDappImportProviderId;
8142
8163
  if (!providerId) return;
@@ -8241,7 +8262,7 @@ function DepositFlow({
8241
8262
  analytics.selectMethod("exchange_connect", "user");
8242
8263
  storeApi.dispatch({ type: "connect/exchange-selected" });
8243
8264
  }, [analytics, storeApi]);
8244
- const swappedAnalyticsCorrelatorRef = useRef8(null);
8265
+ const swappedAnalyticsCorrelatorRef = useRef9(null);
8245
8266
  const handleSwappedAttemptConsumed = useCallback7((externalCustomerId) => {
8246
8267
  swappedAnalyticsCorrelatorRef.current = externalCustomerId;
8247
8268
  }, []);
@@ -8261,8 +8282,8 @@ function DepositFlow({
8261
8282
  );
8262
8283
  swappedAnalyticsCorrelatorRef.current = null;
8263
8284
  }, [analytics, flowMode]);
8264
- const swappedConnectUrlRef = useRef8(/* @__PURE__ */ new Map());
8265
- const acknowledgedConnectFeeRef = useRef8(/* @__PURE__ */ new Map());
8285
+ const swappedConnectUrlRef = useRef9(/* @__PURE__ */ new Map());
8286
+ const acknowledgedConnectFeeRef = useRef9(/* @__PURE__ */ new Map());
8266
8287
  const handleSelectExchangeConnection = useCallback7(
8267
8288
  async (connection, disclosedFeeBps) => {
8268
8289
  if (setupSlice.status !== "ready" || !setupSlice.smartAccount) {
@@ -8338,7 +8359,7 @@ function DepositFlow({
8338
8359
  },
8339
8360
  [service]
8340
8361
  );
8341
- const swappedUrlPrefetchRef = useRef8(/* @__PURE__ */ new Map());
8362
+ const swappedUrlPrefetchRef = useRef9(/* @__PURE__ */ new Map());
8342
8363
  const prefetchSwappedWidgetUrl = useCallback7(
8343
8364
  (smartAccount, method, methodSelectionSource) => {
8344
8365
  const cache = swappedUrlPrefetchRef.current;
@@ -8390,7 +8411,7 @@ function DepositFlow({
8390
8411
  prefetchSwappedWidgetUrl
8391
8412
  ]
8392
8413
  );
8393
- useEffect12(() => {
8414
+ useEffect13(() => {
8394
8415
  swappedUrlPrefetchRef.current.clear();
8395
8416
  swappedConnectUrlRef.current.clear();
8396
8417
  acknowledgedConnectFeeRef.current.clear();
@@ -8402,7 +8423,7 @@ function DepositFlow({
8402
8423
  methods: [],
8403
8424
  recommendedMethod: null
8404
8425
  });
8405
- useEffect12(() => {
8426
+ useEffect13(() => {
8406
8427
  if (!fiatEnabled || hasConfiguredFiatMethods) return;
8407
8428
  let cancelled = false;
8408
8429
  setRegionalMethods({
@@ -8460,7 +8481,7 @@ function DepositFlow({
8460
8481
  offeredFiatMethods,
8461
8482
  regionalMethods
8462
8483
  ]);
8463
- useEffect12(() => {
8484
+ useEffect13(() => {
8464
8485
  if (cashDisplay.kind === "hidden" && fiatEnabled) {
8465
8486
  analytics.friction(
8466
8487
  "regional_methods_empty",
@@ -8524,7 +8545,7 @@ function DepositFlow({
8524
8545
  );
8525
8546
  const desiredSetupRequestKey = computeRequestKey(setupInput);
8526
8547
  const setupReady = setupSlice.status === "ready" && setupSlice.requestKey === desiredSetupRequestKey;
8527
- useEffect12(() => {
8548
+ useEffect13(() => {
8528
8549
  void (async () => {
8529
8550
  const requestKey = computeRequestKey(setupInput);
8530
8551
  const cacheKey = computeCacheKey(setupInput);
@@ -8595,7 +8616,7 @@ function DepositFlow({
8595
8616
  // eslint-disable-next-line react-hooks/exhaustive-deps -- keyed on the stable id-join, not the walletOptions array identity
8596
8617
  [walletOptionsKey]
8597
8618
  );
8598
- useEffect12(() => {
8619
+ useEffect13(() => {
8599
8620
  storeApi.dispatch({
8600
8621
  type: "portfolio/reconciled",
8601
8622
  wallets: desiredPortfolios
@@ -8942,7 +8963,7 @@ function DepositFlow({
8942
8963
  const handleTotalBalanceComputed = useCallback7((total) => {
8943
8964
  setTotalBalanceUsd(total);
8944
8965
  }, []);
8945
- useEffect12(() => {
8966
+ useEffect13(() => {
8946
8967
  if (storeApi.getState().flow.mode) {
8947
8968
  return;
8948
8969
  }
@@ -8952,7 +8973,7 @@ function DepositFlow({
8952
8973
  storeApi.dispatch({ type: "flow/step-set", step: "connect" });
8953
8974
  }
8954
8975
  }, [walletOptionsKey]);
8955
- useEffect12(() => {
8976
+ useEffect13(() => {
8956
8977
  if (!showConnectStep && isConnectSelectionConfirmed && (flowMode === "wallet" || flowMode === "dapp-import") && flowSlice.step !== "dapp-import-resolving" && flowSlice.step !== "dapp-import-select" && !signerContext) {
8957
8978
  storeApi.dispatch({ type: "wallet/cleared" });
8958
8979
  }
@@ -9207,7 +9228,8 @@ function DepositFlow({
9207
9228
  onDepositComplete: handleDepositComplete,
9208
9229
  onDepositFailed: handleDepositFailed,
9209
9230
  onError: handleError,
9210
- debug
9231
+ debug,
9232
+ onSettledChange: onProcessingSettledChange
9211
9233
  }
9212
9234
  )
9213
9235
  ]
@@ -9286,7 +9308,8 @@ function DepositFlow({
9286
9308
  onDepositComplete: handleDepositComplete,
9287
9309
  onDepositFailed: handleDepositFailed,
9288
9310
  onError: handleError,
9289
- debug
9311
+ debug,
9312
+ onSettledChange: onProcessingSettledChange
9290
9313
  }
9291
9314
  )
9292
9315
  ]
@@ -9350,7 +9373,8 @@ function DepositFlow({
9350
9373
  uiConfig,
9351
9374
  onConfirm: handleSolanaConfirmed,
9352
9375
  onError: handleError,
9353
- debug
9376
+ debug,
9377
+ onSubmittingChange
9354
9378
  }
9355
9379
  ) : effectiveStep.type === "solana-confirm" ? /* @__PURE__ */ jsxs23("div", { className: "rs-step", children: [
9356
9380
  /* @__PURE__ */ jsxs23("div", { className: "rs-loading-state", children: [
@@ -9410,7 +9434,8 @@ function DepositFlow({
9410
9434
  onDepositComplete: handleDepositComplete,
9411
9435
  onDepositFailed: handleDepositFailed,
9412
9436
  onError: handleError,
9413
- debug
9437
+ debug,
9438
+ onSettledChange: onProcessingSettledChange
9414
9439
  }
9415
9440
  )
9416
9441
  ] });
@@ -9607,308 +9632,20 @@ function DepositFlow({
9607
9632
  onDepositComplete: handleDepositComplete,
9608
9633
  onDepositFailed: handleDepositFailed,
9609
9634
  onError: handleError,
9610
- debug
9635
+ debug,
9636
+ onSettledChange: onProcessingSettledChange
9611
9637
  }
9612
9638
  )
9613
9639
  ] });
9614
9640
  }
9615
9641
 
9616
- // src/components/history/DepositHistoryPanel.tsx
9617
- import { useCallback as useCallback8, useMemo as useMemo9, useState as useState14 } from "react";
9618
- import { jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
9619
- function shortenHash(hash) {
9620
- if (hash.length <= 14) return hash;
9621
- return `${hash.slice(0, 6)}\u2026${hash.slice(-4)}`;
9622
- }
9623
- function formatDate(iso) {
9624
- try {
9625
- const date = new Date(iso);
9626
- if (Number.isNaN(date.getTime())) return iso;
9627
- return date.toLocaleDateString("en-US", {
9628
- day: "numeric",
9629
- month: "short",
9630
- year: "numeric"
9631
- });
9632
- } catch {
9633
- return iso;
9634
- }
9635
- }
9636
- function resolveChainId(value) {
9637
- if (value === void 0 || value === null) return null;
9638
- if (typeof value === "number") return value;
9639
- if (isSolanaCaip2(value) || value === "solana") return "solana";
9640
- if (isHyperCoreCaip2(value) || value === "hypercore") return "hypercore";
9641
- const parsed = parseEvmChainId(value);
9642
- if (parsed !== null) return parsed;
9643
- const num = Number(value);
9644
- return Number.isFinite(num) ? num : null;
9645
- }
9646
- function resolveTokenSymbol(token, chainId) {
9647
- if (!token) return "";
9648
- if (chainId === "solana") {
9649
- const normalized = token.toLowerCase();
9650
- const matched = SOLANA_TOKENS.find(
9651
- (entry) => entry.mint.toLowerCase() === normalized
9652
- );
9653
- if (matched) return matched.symbol;
9654
- if (normalized === "native" || normalized === "11111111111111111111111111111111" || normalized === "so11111111111111111111111111111111111111112") {
9655
- return "SOL";
9656
- }
9657
- }
9658
- if (chainId !== null && chainId !== void 0 && chainId !== "solana" && /^0x[a-fA-F0-9]{40}$/.test(token)) {
9659
- const evmChainId = chainId === "hypercore" ? HYPERCORE_CHAIN_ID : chainId;
9660
- const sym = getTokenSymbol(token, evmChainId);
9661
- if (sym !== "Token") return sym;
9662
- }
9663
- return shortenHash(token);
9664
- }
9665
- function formatAmount(rawAmount, token, chainId) {
9666
- if (!rawAmount) return "";
9667
- let decimals = 18;
9668
- if (token && chainId !== null && chainId !== void 0) {
9669
- if (chainId === "solana") {
9670
- const normalized = token.toLowerCase();
9671
- const matched = SOLANA_TOKENS.find(
9672
- (entry) => entry.mint.toLowerCase() === normalized
9673
- );
9674
- if (matched) {
9675
- decimals = matched.decimals;
9676
- } else if (normalized === "native" || normalized === "11111111111111111111111111111111" || normalized === "so11111111111111111111111111111111111111112") {
9677
- decimals = 9;
9678
- }
9679
- } else if (/^0x[a-fA-F0-9]{40}$/.test(token)) {
9680
- const evmChainId = chainId === "hypercore" ? HYPERCORE_CHAIN_ID : chainId;
9681
- decimals = getTokenDecimalsByAddress(token, evmChainId);
9682
- }
9683
- }
9684
- try {
9685
- const raw = BigInt(rawAmount);
9686
- const divisor = 10n ** BigInt(decimals);
9687
- const whole = raw / divisor;
9688
- const remainder = raw % divisor;
9689
- const fracStr = remainder.toString().padStart(decimals, "0");
9690
- let frac = fracStr.slice(0, 5).replace(/0+$/, "");
9691
- if (frac.length < 2) frac = frac.padEnd(2, "0");
9692
- return `${whole}.${frac}`;
9693
- } catch {
9694
- return rawAmount;
9695
- }
9696
- }
9697
- function normalizeStatus(raw, isSpam) {
9698
- const lower = raw.toLowerCase();
9699
- if (lower === "completed" || lower === "complete" || lower === "bridge-complete" || lower === "processed")
9700
- return "completed";
9701
- if (lower === "failed" || lower === "error" || lower === "bridge-failed") {
9702
- return isSpam ? "spam" : "failed";
9703
- }
9704
- if (lower === "processing" || lower === "submitted" || lower === "bridging")
9705
- return "processing";
9706
- return "pending";
9707
- }
9708
- var STATUS_LABEL = {
9709
- pending: "Pending",
9710
- processing: "Processing",
9711
- completed: "Completed",
9712
- failed: "Failed",
9713
- spam: "Spam token"
9714
- };
9715
- function DepositHistoryPanel({
9716
- deposits,
9717
- isLoading,
9718
- error,
9719
- hasMore,
9720
- isLoadingMore,
9721
- onLoadMore,
9722
- onClose,
9723
- onCloseModal
9724
- }) {
9725
- const handleKeyDown = useCallback8(
9726
- (e) => {
9727
- if (e.key === "Escape") {
9728
- e.stopPropagation();
9729
- onClose();
9730
- }
9731
- },
9732
- [onClose]
9733
- );
9734
- const visibleDeposits = useMemo9(() => {
9735
- const sourceHashes = new Set(
9736
- deposits.map((d) => d.sourceTxHash?.toLowerCase()).filter((h) => Boolean(h))
9737
- );
9738
- return deposits.filter(
9739
- (d) => !(d.txHash && sourceHashes.has(d.txHash.toLowerCase()))
9740
- );
9741
- }, [deposits]);
9742
- return /* @__PURE__ */ jsxs24(
9743
- "div",
9744
- {
9745
- className: "rs-history-panel",
9746
- role: "dialog",
9747
- "aria-label": "Deposit history",
9748
- onKeyDown: handleKeyDown,
9749
- children: [
9750
- /* @__PURE__ */ jsxs24("div", { className: "rs-modal-header--redesigned", children: [
9751
- /* @__PURE__ */ jsx29("div", { className: "rs-modal-header-nav-left", children: /* @__PURE__ */ jsx29(
9752
- "button",
9753
- {
9754
- type: "button",
9755
- className: "rs-modal-header-back",
9756
- "aria-label": "Back",
9757
- onClick: onClose,
9758
- children: /* @__PURE__ */ jsx29(ChevronLeftIcon, {})
9759
- }
9760
- ) }),
9761
- /* @__PURE__ */ jsx29("div", { className: "rs-modal-header-nav-right", children: onCloseModal && /* @__PURE__ */ jsx29(
9762
- "button",
9763
- {
9764
- type: "button",
9765
- className: "rs-modal-close",
9766
- "aria-label": "Close",
9767
- onClick: onCloseModal,
9768
- children: /* @__PURE__ */ jsx29(CloseIcon, {})
9769
- }
9770
- ) })
9771
- ] }),
9772
- /* @__PURE__ */ jsxs24("div", { className: "rs-history-screen", children: [
9773
- /* @__PURE__ */ jsxs24("div", { className: "rs-history-screen-body", children: [
9774
- /* @__PURE__ */ jsx29(BodyHeader, { icon: /* @__PURE__ */ jsx29(HistoryIcon, {}), title: "History" }),
9775
- isLoading && deposits.length === 0 && /* @__PURE__ */ jsxs24("div", { className: "rs-history-empty", children: [
9776
- /* @__PURE__ */ jsx29("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx29(HistoryIcon, {}) }),
9777
- /* @__PURE__ */ jsxs24("div", { className: "rs-history-empty-text", children: [
9778
- /* @__PURE__ */ jsx29(Spinner, { className: "rs-spinner--sm" }),
9779
- /* @__PURE__ */ jsx29("span", { className: "rs-history-empty-hint", children: "Loading history\u2026" })
9780
- ] })
9781
- ] }),
9782
- error && !isLoading && /* @__PURE__ */ jsxs24("div", { className: "rs-history-empty", children: [
9783
- /* @__PURE__ */ jsx29("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx29(AlertTriangleIcon, {}) }),
9784
- /* @__PURE__ */ jsxs24("div", { className: "rs-history-empty-text", children: [
9785
- /* @__PURE__ */ jsx29("span", { className: "rs-history-empty-title", children: "Couldn't load history" }),
9786
- /* @__PURE__ */ jsx29("span", { className: "rs-history-empty-hint", children: error })
9787
- ] })
9788
- ] }),
9789
- !isLoading && !error && visibleDeposits.length === 0 && /* @__PURE__ */ jsxs24("div", { className: "rs-history-empty", children: [
9790
- /* @__PURE__ */ jsx29("span", { className: "rs-history-empty-glyph", "aria-hidden": "true", children: /* @__PURE__ */ jsx29(HistoryIcon, {}) }),
9791
- /* @__PURE__ */ jsxs24("div", { className: "rs-history-empty-text", children: [
9792
- /* @__PURE__ */ jsx29("span", { className: "rs-history-empty-title", children: "No deposits yet" }),
9793
- /* @__PURE__ */ jsx29("span", { className: "rs-history-empty-hint", children: "Your deposit history will appear here" })
9794
- ] })
9795
- ] }),
9796
- visibleDeposits.length > 0 && /* @__PURE__ */ jsxs24("div", { className: "rs-history-list", children: [
9797
- visibleDeposits.map((deposit, i) => /* @__PURE__ */ jsx29(HistoryCard, { deposit }, deposit.txHash || i)),
9798
- hasMore && /* @__PURE__ */ jsx29(
9799
- "button",
9800
- {
9801
- type: "button",
9802
- className: "rs-history-load-more",
9803
- onClick: onLoadMore,
9804
- disabled: isLoadingMore,
9805
- children: isLoadingMore ? "Loading\u2026" : "Load more"
9806
- }
9807
- )
9808
- ] })
9809
- ] }),
9810
- /* @__PURE__ */ jsx29(PoweredBy, {})
9811
- ] })
9812
- ]
9813
- }
9814
- );
9815
- }
9816
- function HistoryCard({ deposit }) {
9817
- const explorerTxUrl = useExplorerTxUrl();
9818
- const [expanded, setExpanded] = useState14(false);
9819
- const status = normalizeStatus(deposit.status, deposit.isSpam);
9820
- const sourceChainId = resolveChainId(deposit.chain);
9821
- const targetChainId = resolveChainId(deposit.targetChain);
9822
- const sourceChainName = sourceChainId ? getChainName(sourceChainId) : null;
9823
- const targetChainName = targetChainId ? getChainName(targetChainId) : null;
9824
- const sourceChainIcon = sourceChainId ? getChainIcon(sourceChainId) : void 0;
9825
- const targetChainIcon = targetChainId ? getChainIcon(targetChainId) : void 0;
9826
- const sourceSymbol = resolveTokenSymbol(deposit.token, sourceChainId);
9827
- const rawAmount = deposit.sourceAmount && deposit.sourceAmount !== "0" ? deposit.sourceAmount : deposit.amount;
9828
- const formattedAmount = rawAmount ? formatAmount(rawAmount, deposit.token, sourceChainId) : null;
9829
- const displayAmount = formattedAmount ? sourceSymbol && /^USD/.test(sourceSymbol) ? `$${Number(formattedAmount).toLocaleString("en-US", {
9830
- minimumFractionDigits: 2,
9831
- maximumFractionDigits: 2
9832
- })}` : `${formattedAmount} ${sourceSymbol}` : "\u2014";
9833
- const date = deposit.createdAt ? formatDate(deposit.createdAt) : null;
9834
- const txTypeLabel = `Deposit${sourceSymbol ? ` ${sourceSymbol}` : ""}`;
9835
- const srcTxHash = sourceChainId === "hypercore" ? deposit.txHash : deposit.sourceTxHash;
9836
- const srcTxUrl = srcTxHash && sourceChainId ? explorerTxUrl(sourceChainId, srcTxHash) : null;
9837
- return /* @__PURE__ */ jsxs24(
9838
- "button",
9839
- {
9840
- type: "button",
9841
- className: `rs-history-card ${expanded ? "rs-history-card--expanded" : ""}`,
9842
- onClick: () => setExpanded((v) => !v),
9843
- "aria-expanded": expanded,
9844
- children: [
9845
- /* @__PURE__ */ jsxs24("div", { className: "rs-history-card-row", children: [
9846
- /* @__PURE__ */ jsxs24("div", { className: "rs-history-card-icons", children: [
9847
- /* @__PURE__ */ jsx29("span", { className: "rs-history-card-token", children: /* @__PURE__ */ jsx29(TokenIcon, { symbol: sourceSymbol, fallback: sourceSymbol.slice(0, 2) }) }),
9848
- sourceChainIcon && /* @__PURE__ */ jsx29("span", { className: "rs-history-card-chain", children: /* @__PURE__ */ jsx29(CdnIcon, { src: sourceChainIcon }) })
9849
- ] }),
9850
- /* @__PURE__ */ jsxs24("div", { className: "rs-history-card-text", children: [
9851
- /* @__PURE__ */ jsx29("span", { className: "rs-history-card-title", children: txTypeLabel }),
9852
- date && /* @__PURE__ */ jsx29("span", { className: "rs-history-card-date", children: date })
9853
- ] }),
9854
- /* @__PURE__ */ jsxs24("div", { className: "rs-history-card-side", children: [
9855
- /* @__PURE__ */ jsx29("span", { className: "rs-history-card-amount", children: displayAmount }),
9856
- /* @__PURE__ */ jsx29("span", { className: `rs-history-badge rs-history-badge--${status}`, children: STATUS_LABEL[status] })
9857
- ] })
9858
- ] }),
9859
- /* @__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: [
9860
- sourceChainName && /* @__PURE__ */ jsxs24("div", { className: "rs-amount-detail-row", children: [
9861
- /* @__PURE__ */ jsx29("span", { children: "Source chain" }),
9862
- /* @__PURE__ */ jsxs24("span", { className: "rs-amount-detail-value", children: [
9863
- /* @__PURE__ */ jsx29("span", { children: sourceChainName }),
9864
- sourceChainIcon && /* @__PURE__ */ jsx29("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx29(CdnIcon, { src: sourceChainIcon }) })
9865
- ] })
9866
- ] }),
9867
- targetChainName && /* @__PURE__ */ jsxs24("div", { className: "rs-amount-detail-row", children: [
9868
- /* @__PURE__ */ jsx29("span", { children: "Destination chain" }),
9869
- /* @__PURE__ */ jsxs24("span", { className: "rs-amount-detail-value", children: [
9870
- /* @__PURE__ */ jsx29("span", { children: targetChainName }),
9871
- targetChainIcon && /* @__PURE__ */ jsx29("span", { className: "rs-amount-detail-icon", children: /* @__PURE__ */ jsx29(CdnIcon, { src: targetChainIcon }) })
9872
- ] })
9873
- ] }),
9874
- srcTxUrl && srcTxHash && /* @__PURE__ */ jsxs24("div", { className: "rs-amount-detail-row", children: [
9875
- /* @__PURE__ */ jsx29("span", { children: "Transaction details" }),
9876
- /* @__PURE__ */ jsxs24(
9877
- "a",
9878
- {
9879
- href: srcTxUrl,
9880
- target: "_blank",
9881
- rel: "noopener noreferrer",
9882
- className: "rs-history-card-link",
9883
- onClick: (e) => e.stopPropagation(),
9884
- children: [
9885
- /* @__PURE__ */ jsx29("span", { children: shortenHash(srcTxHash) }),
9886
- /* @__PURE__ */ jsx29(ArrowUpRightIcon, {})
9887
- ]
9888
- }
9889
- )
9890
- ] })
9891
- ] }) }) })
9892
- ]
9893
- }
9894
- );
9895
- }
9896
- DepositHistoryPanel.displayName = "DepositHistoryPanel";
9897
-
9898
9642
  // src/DepositModal.tsx
9899
- import { jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
9643
+ import { jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
9900
9644
  var ReownDepositInner = lazy2(async () => {
9901
9645
  await loadReownDependencies();
9902
- const module = await import("./DepositModalReown-2EVV64OA.mjs");
9646
+ const module = await import("./DepositModalReown-R7UROJPJ.mjs");
9903
9647
  return { default: module.DepositModalReown };
9904
9648
  });
9905
- function sortByCreatedAtDesc(items) {
9906
- return [...items].sort((a, b) => {
9907
- const at = a.createdAt ? Date.parse(a.createdAt) : 0;
9908
- const bt = b.createdAt ? Date.parse(b.createdAt) : 0;
9909
- return bt - at;
9910
- });
9911
- }
9912
9649
  function buildDepositAnalyticsSessionProperties({
9913
9650
  enableWallet = true,
9914
9651
  enableFiatOnramp = false,
@@ -9968,7 +9705,7 @@ function DepositModal(props) {
9968
9705
  const needsReown = !!props.reownAppId;
9969
9706
  const hasWalletClientProp = hasSuppliedWalletClient(props);
9970
9707
  if (needsReown) {
9971
- return /* @__PURE__ */ jsx30(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx30(
9708
+ return /* @__PURE__ */ jsx29(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx29(
9972
9709
  ReownDepositInner,
9973
9710
  {
9974
9711
  ...props,
@@ -9976,7 +9713,7 @@ function DepositModal(props) {
9976
9713
  }
9977
9714
  ) });
9978
9715
  }
9979
- return /* @__PURE__ */ jsx30(
9716
+ return /* @__PURE__ */ jsx29(
9980
9717
  DepositModalInner,
9981
9718
  {
9982
9719
  ...props,
@@ -10029,43 +9766,61 @@ function DepositModalInner({
10029
9766
  onUiState,
10030
9767
  openExternally,
10031
9768
  walletIntegration: walletIntegrationProp,
9769
+ signRecovery,
10032
9770
  debug
10033
9771
  }) {
10034
- const modalRef = useRef9(null);
10035
- const analyticsControllerRef = useRef9(null);
10036
- const previousOpenRef = useRef9(isOpen);
9772
+ const modalRef = useRef10(null);
9773
+ const analyticsControllerRef = useRef10(null);
9774
+ const analyticsSessionIdRef = useRef10(null);
9775
+ const previousOpenRef = useRef10(isOpen);
10037
9776
  const onReadyRef = useLatestRef(onReady);
10038
9777
  const onUiStateRef = useLatestRef(onUiState);
10039
- const [currentScreen, setCurrentScreen] = useState15("connect");
10040
- const [swappedImmersive, setSwappedImmersive] = useState15(false);
10041
- const [submitting, setSubmitting] = useState15(false);
10042
- const [backHandler, setBackHandler] = useState15(
9778
+ const [currentScreen, setCurrentScreen] = useState14("connect");
9779
+ const [swappedImmersive, setSwappedImmersive] = useState14(false);
9780
+ const [submitting, setSubmitting] = useState14(false);
9781
+ const [backHandler, setBackHandler] = useState14(
10043
9782
  void 0
10044
9783
  );
10045
- const historyButtonVisible = currentScreen === "connect";
10046
- const [historyOpen, setHistoryOpen] = useState15(false);
10047
- const [historyDeposits, setHistoryDeposits] = useState15([]);
10048
- const [hasMoreHistory, setHasMoreHistory] = useState15(false);
10049
- const [historyLoading, setHistoryLoading] = useState15(false);
10050
- const [historyLoadingMore, setHistoryLoadingMore] = useState15(false);
10051
- const [historyError, setHistoryError] = useState15(null);
10052
- const cursorRef = useRef9(null);
10053
- const historyStaleRef = useRef9(false);
10054
- const historyLoadedRef = useRef9(false);
10055
- const targetChain = targetChainProp === "solana" || targetChainProp === HYPERCORE_SPOT_CAIP2 ? targetChainProp : getChainId(targetChainProp);
9784
+ const [processingSettled, setProcessingSettled] = useState14(false);
9785
+ const historyButtonVisible = isHistoryEntryVisible({
9786
+ screen: currentScreen,
9787
+ submitting,
9788
+ settled: processingSettled
9789
+ });
9790
+ const targetChain = typeof targetChainProp === "string" ? targetChainProp : getChainId(targetChainProp);
10056
9791
  const sourceChain = sourceChainProp ? getChainId(sourceChainProp) : void 0;
10057
9792
  const rpcUrls = useStableRpcUrls(rpcUrlsProp);
10058
- const service = useMemo10(
9793
+ const service = useMemo9(
10059
9794
  () => createDepositService(backendUrl, {
10060
9795
  debug,
10061
9796
  debugScope: "service:deposit"
10062
9797
  }),
10063
9798
  [backendUrl, debug]
10064
9799
  );
10065
- const [clientSetup, setClientSetup] = useState15(
9800
+ const historyAnalytics = useMemo9(
9801
+ () => createHistoryAnalytics({
9802
+ modal: "deposit",
9803
+ controllerRef: analyticsControllerRef,
9804
+ sessionIdRef: analyticsSessionIdRef
9805
+ }),
9806
+ []
9807
+ );
9808
+ const history = useHistoryPanel({
9809
+ isOpen,
9810
+ recipient,
9811
+ service,
9812
+ canRecover: Boolean(signRecovery),
9813
+ analytics: historyAnalytics
9814
+ });
9815
+ const {
9816
+ markStale: markHistoryStale,
9817
+ invalidate: invalidateHistory,
9818
+ recoverySubmitting
9819
+ } = history;
9820
+ const [clientSetup, setClientSetup] = useState14(
10066
9821
  null
10067
9822
  );
10068
- useEffect13(() => {
9823
+ useEffect14(() => {
10069
9824
  if (!isOpen) return;
10070
9825
  let active = true;
10071
9826
  service.getSetup().then((config) => {
@@ -10075,131 +9830,74 @@ function DepositModalInner({
10075
9830
  active = false;
10076
9831
  };
10077
9832
  }, [isOpen, service]);
10078
- useEffect13(() => {
9833
+ useEffect14(() => {
10079
9834
  if (debug && clientSetup) {
10080
9835
  console.debug("[deposit] client setup config (not shown yet)", clientSetup);
10081
9836
  }
10082
9837
  }, [debug, clientSetup]);
10083
- const store = useMemo10(
9838
+ const store = useMemo9(
10084
9839
  () => createDepositStore({ targetChain, targetToken }),
10085
9840
  // eslint-disable-next-line react-hooks/exhaustive-deps
10086
9841
  []
10087
9842
  );
10088
- useEffect13(() => {
9843
+ useEffect14(() => {
10089
9844
  store.dispatch({ type: "target/changed", targetChain, targetToken });
10090
9845
  }, [store, targetChain, targetToken]);
10091
- useEffect13(() => {
9846
+ useEffect14(() => {
10092
9847
  if (!isOpen || !modalRef.current) return;
10093
9848
  return applyTheme(modalRef.current, theme);
10094
9849
  }, [isOpen, theme]);
10095
- useEffect13(() => {
9850
+ useEffect14(() => {
10096
9851
  if (isOpen) {
10097
9852
  onReadyRef.current?.();
10098
9853
  }
10099
9854
  }, [isOpen, onReadyRef]);
10100
- useEffect13(() => {
9855
+ useEffect14(() => {
10101
9856
  onUiStateRef.current?.({
10102
9857
  screen: currentScreen,
10103
9858
  back: backHandler,
10104
- submitting
9859
+ // A recovery in flight is a submission whose outcome is unknown, so a
9860
+ // native host's dismissal lock has to hold through it too.
9861
+ submitting: submitting || recoverySubmitting
10105
9862
  });
10106
- }, [currentScreen, backHandler, submitting, onUiStateRef]);
10107
- const handleStepChange = useCallback9(
9863
+ }, [
9864
+ currentScreen,
9865
+ backHandler,
9866
+ submitting,
9867
+ recoverySubmitting,
9868
+ onUiStateRef
9869
+ ]);
9870
+ const handleStepChange = useCallback8(
10108
9871
  (onBack, screen) => {
10109
9872
  setBackHandler(() => onBack);
10110
9873
  if (screen) setCurrentScreen(screen);
10111
9874
  },
10112
9875
  []
10113
9876
  );
10114
- const fetchHistory = useCallback9(
10115
- async (mode = "initial") => {
10116
- if (!recipient) return;
10117
- const isInitial = mode === "initial";
10118
- if (isInitial) {
10119
- setHistoryLoading(true);
10120
- } else {
10121
- setHistoryLoadingMore(true);
10122
- }
10123
- setHistoryError(null);
10124
- try {
10125
- const cursor = isInitial ? null : cursorRef.current;
10126
- if (!isInitial && !cursor) {
10127
- setHasMoreHistory(false);
10128
- return;
10129
- }
10130
- const result = await service.fetchDepositHistory({
10131
- recipient,
10132
- limit: 20,
10133
- cursor: cursor ?? void 0
10134
- });
10135
- const incoming = result.deposits;
10136
- const nextCursor = result.nextCursor ?? null;
10137
- if (isInitial) {
10138
- setHistoryDeposits(sortByCreatedAtDesc(incoming));
10139
- } else {
10140
- setHistoryDeposits(
10141
- (prev) => sortByCreatedAtDesc([...prev, ...incoming])
10142
- );
10143
- }
10144
- cursorRef.current = nextCursor;
10145
- setHasMoreHistory(Boolean(nextCursor));
10146
- historyStaleRef.current = false;
10147
- historyLoadedRef.current = true;
10148
- } catch (err) {
10149
- setHistoryError(
10150
- err instanceof Error ? err.message : "Failed to load history"
10151
- );
10152
- } finally {
10153
- if (isInitial) {
10154
- setHistoryLoading(false);
10155
- } else {
10156
- setHistoryLoadingMore(false);
10157
- }
10158
- }
10159
- },
10160
- [recipient, service]
10161
- );
10162
- const handleHistoryOpen = useCallback9(() => {
10163
- setHistoryOpen(true);
10164
- if (!historyLoadedRef.current || historyStaleRef.current) {
10165
- fetchHistory("initial");
10166
- }
10167
- }, [fetchHistory]);
10168
- const handleHistoryClose = useCallback9(() => {
10169
- setHistoryOpen(false);
10170
- }, []);
10171
- const handleHistoryLoadMore = useCallback9(() => {
10172
- fetchHistory("more");
10173
- }, [fetchHistory]);
10174
- const markHistoryStale = useCallback9(() => {
10175
- historyStaleRef.current = true;
10176
- if (historyOpen) {
10177
- fetchHistory("initial");
10178
- }
10179
- }, [historyOpen, fetchHistory]);
10180
9877
  const onLifecycleRef = useLatestRef(onLifecycle);
10181
- const handleLifecycle = useCallback9(
9878
+ const handleLifecycle = useCallback8(
10182
9879
  (event) => {
10183
9880
  onLifecycleRef.current?.(event);
10184
9881
  if (event.type === "smart-account-changed" && !event.evm && !event.solana) {
10185
- historyStaleRef.current = true;
9882
+ invalidateHistory();
10186
9883
  }
10187
9884
  if (event.type === "submitted" || event.type === "complete" || event.type === "failed") {
10188
9885
  markHistoryStale();
10189
9886
  }
10190
9887
  },
10191
- [onLifecycleRef, markHistoryStale]
9888
+ [onLifecycleRef, markHistoryStale, invalidateHistory]
10192
9889
  );
10193
- const closeWithSource = useCallback9(
9890
+ const closeWithSource = useCallback8(
10194
9891
  (source) => {
9892
+ if (recoverySubmitting) return;
10195
9893
  const analytics = analyticsControllerRef.current;
10196
9894
  analytics?.abandon(source === "provider_back" ? "provider_back" : "modal_close");
10197
9895
  analytics?.close(source);
10198
9896
  onClose();
10199
9897
  },
10200
- [onClose]
9898
+ [onClose, recoverySubmitting]
10201
9899
  );
10202
- const handleModalDismiss = useCallback9(
9900
+ const handleModalDismiss = useCallback8(
10203
9901
  (reason) => {
10204
9902
  closeWithSource(
10205
9903
  reason === "escape" ? "escape" : reason === "overlay" ? "overlay" : "header_button"
@@ -10207,7 +9905,7 @@ function DepositModalInner({
10207
9905
  },
10208
9906
  [closeWithSource]
10209
9907
  );
10210
- useEffect13(() => {
9908
+ useEffect14(() => {
10211
9909
  if (previousOpenRef.current && !isOpen) {
10212
9910
  const analytics = analyticsControllerRef.current;
10213
9911
  analytics?.abandon("modal_close");
@@ -10215,22 +9913,16 @@ function DepositModalInner({
10215
9913
  }
10216
9914
  previousOpenRef.current = isOpen;
10217
9915
  }, [isOpen]);
10218
- useEffect13(() => {
9916
+ useEffect14(() => {
10219
9917
  if (!isOpen) {
10220
- setHistoryOpen(false);
10221
- setHistoryDeposits([]);
10222
- setHasMoreHistory(false);
10223
- setHistoryError(null);
10224
- cursorRef.current = null;
10225
- historyStaleRef.current = false;
10226
- historyLoadedRef.current = false;
10227
9918
  setCurrentScreen("connect");
10228
9919
  setBackHandler(void 0);
10229
9920
  setSwappedImmersive(false);
10230
9921
  setSubmitting(false);
9922
+ setProcessingSettled(false);
10231
9923
  }
10232
9924
  }, [isOpen]);
10233
- useEffect13(() => {
9925
+ useEffect14(() => {
10234
9926
  if (!isOpen) {
10235
9927
  store.dispatch({ type: "flow/reset" });
10236
9928
  }
@@ -10258,7 +9950,7 @@ function DepositModalInner({
10258
9950
  const canGoBack = backHandler !== void 0;
10259
9951
  const hideHeaderChrome = swappedImmersive;
10260
9952
  const modalClassName = `rs-modal${hideHeaderChrome ? " rs-modal--swapped-iframe" : ""}`;
10261
- return /* @__PURE__ */ jsx30(RpcUrlsProvider, { value: rpcUrls, children: /* @__PURE__ */ jsx30(ChainCatalogProvider, { service, rpcUrls, children: /* @__PURE__ */ jsx30(DepositStoreProvider, { store, children: /* @__PURE__ */ jsx30(
9953
+ return /* @__PURE__ */ jsx29(RpcUrlsProvider, { value: rpcUrls, children: /* @__PURE__ */ jsx29(ChainCatalogProvider, { service, rpcUrls, children: /* @__PURE__ */ jsx29(DepositStoreProvider, { store, children: /* @__PURE__ */ jsx29(
10262
9954
  Modal,
10263
9955
  {
10264
9956
  isOpen,
@@ -10266,7 +9958,8 @@ function DepositModalInner({
10266
9958
  className,
10267
9959
  inline,
10268
9960
  closeOnOverlayClick,
10269
- children: /* @__PURE__ */ jsx30(
9961
+ ariaLabel: "Deposit",
9962
+ children: /* @__PURE__ */ jsx29(
10270
9963
  AnalyticsSession,
10271
9964
  {
10272
9965
  modal: "deposit",
@@ -10275,47 +9968,45 @@ function DepositModalInner({
10275
9968
  backendUrl,
10276
9969
  enableIngest: enableAnalyticsIngest,
10277
9970
  ingestUrl: analyticsIngestUrl,
10278
- children: /* @__PURE__ */ jsx30(
9971
+ sessionIdRef: analyticsSessionIdRef,
9972
+ children: /* @__PURE__ */ jsx29(
10279
9973
  DepositAnalyticsControllerProvider,
10280
9974
  {
10281
9975
  controllerRef: analyticsControllerRef,
10282
- children: /* @__PURE__ */ jsxs25("div", { ref: modalRef, className: modalClassName, children: [
10283
- !hideHeaderChrome && /* @__PURE__ */ jsxs25("div", { className: "rs-modal-header--redesigned", children: [
10284
- /* @__PURE__ */ jsx30("div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && backHandler && /* @__PURE__ */ jsx30(
9976
+ children: /* @__PURE__ */ jsxs24("div", { ref: modalRef, className: modalClassName, children: [
9977
+ !hideHeaderChrome && /* @__PURE__ */ jsxs24("div", { className: "rs-modal-header--redesigned", children: [
9978
+ /* @__PURE__ */ jsx29("div", { className: "rs-modal-header-nav-left", children: showBackButton && canGoBack && backHandler && /* @__PURE__ */ jsx29(
10285
9979
  "button",
10286
9980
  {
10287
9981
  type: "button",
10288
9982
  className: "rs-modal-header-back",
10289
9983
  "aria-label": "Go back",
10290
9984
  onClick: backHandler,
10291
- children: /* @__PURE__ */ jsx30(ChevronLeftIcon, {})
9985
+ children: /* @__PURE__ */ jsx29(ChevronLeftIcon, {})
10292
9986
  }
10293
9987
  ) }),
10294
- /* @__PURE__ */ jsxs25("div", { className: "rs-modal-header-nav-right", children: [
10295
- historyButtonVisible && /* @__PURE__ */ jsx30(
10296
- "button",
9988
+ /* @__PURE__ */ jsxs24("div", { className: "rs-modal-header-nav-right", children: [
9989
+ historyButtonVisible && /* @__PURE__ */ jsx29(
9990
+ HistoryEntryButton,
10297
9991
  {
10298
- type: "button",
10299
- className: "rs-modal-header-history",
10300
- "aria-label": "Deposit history",
10301
- onClick: handleHistoryOpen,
10302
- disabled: !recipient,
10303
- children: /* @__PURE__ */ jsx30(HistoryIcon, {})
9992
+ badge: history.badge,
9993
+ onClick: history.openPanel,
9994
+ disabled: !recipient
10304
9995
  }
10305
9996
  ),
10306
- /* @__PURE__ */ jsx30(
9997
+ /* @__PURE__ */ jsx29(
10307
9998
  "button",
10308
9999
  {
10309
10000
  type: "button",
10310
10001
  onClick: () => closeWithSource("header_button"),
10311
10002
  className: "rs-modal-close",
10312
10003
  "aria-label": "Close",
10313
- children: /* @__PURE__ */ jsx30(CloseIcon, {})
10004
+ children: /* @__PURE__ */ jsx29(CloseIcon, {})
10314
10005
  }
10315
10006
  )
10316
10007
  ] })
10317
10008
  ] }),
10318
- /* @__PURE__ */ jsx30(
10009
+ /* @__PURE__ */ jsx29(
10319
10010
  DepositFlow,
10320
10011
  {
10321
10012
  walletClientProp,
@@ -10352,23 +10043,30 @@ function DepositModalInner({
10352
10043
  onSwappedImmersiveChange: setSwappedImmersive,
10353
10044
  openExternally,
10354
10045
  onSubmittingChange: setSubmitting,
10046
+ onProcessingSettledChange: setProcessingSettled,
10355
10047
  onClose: (source) => closeWithSource(source ?? "header_button"),
10356
10048
  onLifecycle: handleLifecycle,
10357
10049
  onError,
10358
10050
  debug
10359
10051
  }
10360
10052
  ),
10361
- historyOpen && /* @__PURE__ */ jsx30(
10362
- DepositHistoryPanel,
10053
+ history.isPanelOpen && /* @__PURE__ */ jsx29(
10054
+ HistoryOverlay,
10363
10055
  {
10364
- deposits: historyDeposits,
10365
- isLoading: historyLoading,
10366
- error: historyError,
10367
- hasMore: hasMoreHistory,
10368
- isLoadingMore: historyLoadingMore,
10369
- onLoadMore: handleHistoryLoadMore,
10370
- onClose: handleHistoryClose,
10371
- onCloseModal: () => closeWithSource("header_button")
10056
+ controller: history,
10057
+ backLabel: "Deposit",
10058
+ recipient,
10059
+ backendUrl,
10060
+ service,
10061
+ signRecovery,
10062
+ debug,
10063
+ onCloseModal: () => closeWithSource("header_button"),
10064
+ analytics: historyAnalytics,
10065
+ inline,
10066
+ closeOnOverlayClick,
10067
+ enableAnalyticsIngest,
10068
+ analyticsIngestUrl,
10069
+ onEvent
10372
10070
  }
10373
10071
  )
10374
10072
  ] })