@rhinestone/deposit-modal 0.3.0-alpha.1 → 0.3.0-alpha.2

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.
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
- var _chunkC6JK3IO6cjs = require('./chunk-C6JK3IO6.cjs');
3
+ var _chunkBLAGBBMPcjs = require('./chunk-BLAGBBMP.cjs');
4
4
 
5
5
 
6
6
 
7
7
  var _chunkYQFH2WSWcjs = require('./chunk-YQFH2WSW.cjs');
8
- require('./chunk-DCAANLEP.cjs');
8
+ require('./chunk-FTMCKJM4.cjs');
9
9
  require('./chunk-IVTXEYB2.cjs');
10
10
 
11
11
  // src/DepositModalReown.tsx
@@ -32,7 +32,7 @@ function DepositModalWithReown(props) {
32
32
  reown.disconnect();
33
33
  }, [reown.disconnect]);
34
34
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
35
- _chunkC6JK3IO6cjs.DepositModalInner,
35
+ _chunkBLAGBBMPcjs.DepositModalInner,
36
36
  {
37
37
  ...props,
38
38
  reownWallet: reownWithSolana,
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  DepositModalInner
3
- } from "./chunk-SLLI7SB6.mjs";
3
+ } from "./chunk-AHSVY7AE.mjs";
4
4
  import {
5
5
  ReownWalletProvider,
6
6
  useReownWallet
7
7
  } from "./chunk-5YXAQB6A.mjs";
8
- import "./chunk-FY76DWPD.mjs";
8
+ import "./chunk-XKDZEIB7.mjs";
9
9
  import "./chunk-VA3ANS7D.mjs";
10
10
 
11
11
  // src/DepositModalReown.tsx
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  WithdrawModalInner
3
- } from "./chunk-D5YCALVX.mjs";
3
+ } from "./chunk-TWA3SXVV.mjs";
4
4
  import {
5
5
  ReownWalletProvider,
6
6
  useReownWallet
7
7
  } from "./chunk-5YXAQB6A.mjs";
8
- import "./chunk-FY76DWPD.mjs";
8
+ import "./chunk-XKDZEIB7.mjs";
9
9
  import "./chunk-VA3ANS7D.mjs";
10
10
 
11
11
  // src/WithdrawModalReown.tsx
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkK7MNFNR7cjs = require('./chunk-K7MNFNR7.cjs');
3
+ var _chunkZMNFBFIRcjs = require('./chunk-ZMNFBFIR.cjs');
4
4
 
5
5
 
6
6
 
7
7
  var _chunkYQFH2WSWcjs = require('./chunk-YQFH2WSW.cjs');
8
- require('./chunk-DCAANLEP.cjs');
8
+ require('./chunk-FTMCKJM4.cjs');
9
9
  require('./chunk-IVTXEYB2.cjs');
10
10
 
11
11
  // src/WithdrawModalReown.tsx
@@ -20,7 +20,7 @@ function WithdrawModalWithReown(props) {
20
20
  reown.disconnect();
21
21
  }, [reown.disconnect]);
22
22
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
23
- _chunkK7MNFNR7cjs.WithdrawModalInner,
23
+ _chunkZMNFBFIRcjs.WithdrawModalInner,
24
24
  {
25
25
  ...props,
26
26
  reownWallet: reown,
@@ -45,7 +45,7 @@ import {
45
45
  tokenFormatter,
46
46
  txRefsMatch,
47
47
  useLatestRef
48
- } from "./chunk-FY76DWPD.mjs";
48
+ } from "./chunk-XKDZEIB7.mjs";
49
49
  import {
50
50
  DEFAULT_BACKEND_URL,
51
51
  DEFAULT_SIGNER_ADDRESS,
@@ -4679,7 +4679,7 @@ DepositHistoryPanel.displayName = "DepositHistoryPanel";
4679
4679
  // src/DepositModal.tsx
4680
4680
  import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
4681
4681
  var ReownDepositInner = lazy2(
4682
- () => import("./DepositModalReown-EESTTLN4.mjs").then((m) => ({ default: m.DepositModalReown }))
4682
+ () => import("./DepositModalReown-VFTXYG2B.mjs").then((m) => ({ default: m.DepositModalReown }))
4683
4683
  );
4684
4684
  function sortByCreatedAtDesc(items) {
4685
4685
  return [...items].sort((a, b) => {
@@ -4758,19 +4758,14 @@ function DepositModalInner({
4758
4758
  void 0
4759
4759
  );
4760
4760
  const showHistoryButton = uiConfig?.showHistoryButton ?? false;
4761
- const historyButtonVisible = showHistoryButton && (currentScreen === "connect" || currentScreen === "select-asset" || currentScreen === "deposit-address");
4762
- const [activeEvmAccount, setActiveEvmAccount] = useState12(null);
4763
- const [activeSolanaAccount, setActiveSolanaAccount] = useState12(
4764
- null
4765
- );
4761
+ const historyButtonVisible = showHistoryButton && (currentScreen === "select-asset" || currentScreen === "deposit-address");
4766
4762
  const [historyOpen, setHistoryOpen] = useState12(false);
4767
4763
  const [historyDeposits, setHistoryDeposits] = useState12([]);
4768
4764
  const [hasMoreHistory, setHasMoreHistory] = useState12(false);
4769
4765
  const [historyLoading, setHistoryLoading] = useState12(false);
4770
4766
  const [historyLoadingMore, setHistoryLoadingMore] = useState12(false);
4771
4767
  const [historyError, setHistoryError] = useState12(null);
4772
- const evmCursorRef = useRef7(null);
4773
- const solanaCursorRef = useRef7(null);
4768
+ const cursorRef = useRef7(null);
4774
4769
  const historyStaleRef = useRef7(false);
4775
4770
  const historyLoadedRef = useRef7(false);
4776
4771
  const targetChain = getChainId(targetChainProp);
@@ -4812,7 +4807,7 @@ function DepositModalInner({
4812
4807
  );
4813
4808
  const fetchHistory = useCallback6(
4814
4809
  async (mode = "initial") => {
4815
- if (!activeEvmAccount && !activeSolanaAccount) return;
4810
+ if (!recipient) return;
4816
4811
  const isInitial = mode === "initial";
4817
4812
  if (isInitial) {
4818
4813
  setHistoryLoading(true);
@@ -4821,44 +4816,18 @@ function DepositModalInner({
4821
4816
  }
4822
4817
  setHistoryError(null);
4823
4818
  try {
4824
- const evmCursor = isInitial ? null : evmCursorRef.current;
4825
- const solanaCursor = isInitial ? null : solanaCursorRef.current;
4826
- const requests = [];
4827
- if (activeEvmAccount && (isInitial || evmCursor)) {
4828
- requests.push(
4829
- service.fetchDepositHistory({
4830
- account: activeEvmAccount,
4831
- limit: 20,
4832
- cursor: evmCursor ?? void 0
4833
- }).then((r) => ({
4834
- deposits: r.deposits,
4835
- nextCursor: r.nextCursor ?? null,
4836
- source: "evm"
4837
- }))
4838
- );
4839
- }
4840
- if (activeSolanaAccount && (isInitial || solanaCursor)) {
4841
- requests.push(
4842
- service.fetchDepositHistory({
4843
- account: activeSolanaAccount,
4844
- limit: 20,
4845
- cursor: solanaCursor ?? void 0
4846
- }).then((r) => ({
4847
- deposits: r.deposits,
4848
- nextCursor: r.nextCursor ?? null,
4849
- source: "solana"
4850
- }))
4851
- );
4852
- }
4853
- const results = await Promise.all(requests);
4854
- let nextEvm = isInitial ? null : evmCursor;
4855
- let nextSolana = isInitial ? null : solanaCursor;
4856
- const incoming = [];
4857
- for (const r of results) {
4858
- incoming.push(...r.deposits);
4859
- if (r.source === "evm") nextEvm = r.nextCursor;
4860
- else nextSolana = r.nextCursor;
4819
+ const cursor = isInitial ? null : cursorRef.current;
4820
+ if (!isInitial && !cursor) {
4821
+ setHasMoreHistory(false);
4822
+ return;
4861
4823
  }
4824
+ const result = await service.fetchDepositHistory({
4825
+ recipient,
4826
+ limit: 20,
4827
+ cursor: cursor ?? void 0
4828
+ });
4829
+ const incoming = result.deposits;
4830
+ const nextCursor = result.nextCursor ?? null;
4862
4831
  if (isInitial) {
4863
4832
  setHistoryDeposits(sortByCreatedAtDesc(incoming));
4864
4833
  } else {
@@ -4866,9 +4835,8 @@ function DepositModalInner({
4866
4835
  (prev) => sortByCreatedAtDesc([...prev, ...incoming])
4867
4836
  );
4868
4837
  }
4869
- evmCursorRef.current = nextEvm;
4870
- solanaCursorRef.current = nextSolana;
4871
- setHasMoreHistory(Boolean(nextEvm || nextSolana));
4838
+ cursorRef.current = nextCursor;
4839
+ setHasMoreHistory(Boolean(nextCursor));
4872
4840
  historyStaleRef.current = false;
4873
4841
  historyLoadedRef.current = true;
4874
4842
  } catch (err) {
@@ -4883,7 +4851,7 @@ function DepositModalInner({
4883
4851
  }
4884
4852
  }
4885
4853
  },
4886
- [activeEvmAccount, activeSolanaAccount, service]
4854
+ [recipient, service]
4887
4855
  );
4888
4856
  const handleHistoryOpen = useCallback6(() => {
4889
4857
  setHistoryOpen(true);
@@ -4907,12 +4875,8 @@ function DepositModalInner({
4907
4875
  const handleLifecycle = useCallback6(
4908
4876
  (event) => {
4909
4877
  onLifecycleRef.current?.(event);
4910
- if (event.type === "smart-account-changed") {
4911
- setActiveEvmAccount(event.evm);
4912
- setActiveSolanaAccount(event.solana);
4913
- if (!event.evm && !event.solana) {
4914
- historyStaleRef.current = true;
4915
- }
4878
+ if (event.type === "smart-account-changed" && !event.evm && !event.solana) {
4879
+ historyStaleRef.current = true;
4916
4880
  }
4917
4881
  if (showHistoryButton && (event.type === "submitted" || event.type === "complete" || event.type === "failed")) {
4918
4882
  markHistoryStale();
@@ -4926,10 +4890,7 @@ function DepositModalInner({
4926
4890
  setHistoryDeposits([]);
4927
4891
  setHasMoreHistory(false);
4928
4892
  setHistoryError(null);
4929
- setActiveEvmAccount(null);
4930
- setActiveSolanaAccount(null);
4931
- evmCursorRef.current = null;
4932
- solanaCursorRef.current = null;
4893
+ cursorRef.current = null;
4933
4894
  historyStaleRef.current = false;
4934
4895
  historyLoadedRef.current = false;
4935
4896
  }
@@ -4969,7 +4930,7 @@ function DepositModalInner({
4969
4930
  className: "rs-modal-header-history",
4970
4931
  "aria-label": "Deposit history",
4971
4932
  onClick: handleHistoryOpen,
4972
- disabled: !activeEvmAccount && !activeSolanaAccount,
4933
+ disabled: !recipient,
4973
4934
  children: /* @__PURE__ */ jsx12(HistoryIcon, {})
4974
4935
  }
4975
4936
  ),