@rhinestone/deposit-modal 0.1.65 → 0.1.67

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 (34) hide show
  1. package/dist/{DepositModalReown-Y4M3RA73.mjs → DepositModalReown-EYIV6APK.mjs} +3 -3
  2. package/dist/{DepositModalReown-6ZMLUWWD.cjs → DepositModalReown-UPYZN2XA.cjs} +4 -4
  3. package/dist/{WithdrawModalReown-HVBMAUPM.mjs → WithdrawModalReown-6VYKKKJN.mjs} +3 -3
  4. package/dist/{WithdrawModalReown-WJ5SHBV4.cjs → WithdrawModalReown-WHPQDJJJ.cjs} +4 -4
  5. package/dist/{chunk-RKRF7ANK.mjs → chunk-5FDIQNJJ.mjs} +22 -19
  6. package/dist/{chunk-4CZ7W3RS.cjs → chunk-FLVSQDP4.cjs} +181 -132
  7. package/dist/{chunk-GAHX5RAT.mjs → chunk-IUW3SJQT.mjs} +103 -54
  8. package/dist/{chunk-MGV75YLV.cjs → chunk-LTLFJPHO.cjs} +106 -103
  9. package/dist/{chunk-R6U6BHCV.cjs → chunk-MUWVDVY4.cjs} +13 -1
  10. package/dist/{chunk-IYZGLNY6.mjs → chunk-NFE5ZLD3.mjs} +1171 -374
  11. package/dist/{chunk-CIXHTOO3.mjs → chunk-SDZKKUCJ.mjs} +13 -1
  12. package/dist/{chunk-OWV4KVBM.cjs → chunk-UDKZWFCM.cjs} +1251 -454
  13. package/dist/constants.cjs +2 -2
  14. package/dist/constants.mjs +1 -1
  15. package/dist/deposit.cjs +4 -4
  16. package/dist/deposit.d.cts +2 -2
  17. package/dist/deposit.d.ts +2 -2
  18. package/dist/deposit.mjs +3 -3
  19. package/dist/index.cjs +5 -5
  20. package/dist/index.d.cts +1 -1
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.mjs +4 -4
  23. package/dist/reown.cjs +5 -5
  24. package/dist/reown.d.cts +1 -1
  25. package/dist/reown.d.ts +1 -1
  26. package/dist/reown.mjs +4 -4
  27. package/dist/styles.css +696 -34
  28. package/dist/{types-BLIqLF0c.d.ts → types-DGQzvl6v.d.ts} +12 -1
  29. package/dist/{types-7IoN8k-P.d.cts → types-DJ1fzNC7.d.cts} +12 -1
  30. package/dist/withdraw.cjs +4 -4
  31. package/dist/withdraw.d.cts +2 -2
  32. package/dist/withdraw.d.ts +2 -2
  33. package/dist/withdraw.mjs +3 -3
  34. package/package.json +5 -5
@@ -8,7 +8,7 @@ import {
8
8
  getTokenDecimalsByAddress,
9
9
  getTokenIcon,
10
10
  getTokenSymbol
11
- } from "./chunk-CIXHTOO3.mjs";
11
+ } from "./chunk-SDZKKUCJ.mjs";
12
12
 
13
13
  // src/components/ui/Modal.tsx
14
14
  import {
@@ -595,6 +595,46 @@ function createDepositService(baseUrl, options) {
595
595
  txHash: result?.txHash ? shortRef(result.txHash) : void 0
596
596
  });
597
597
  return result;
598
+ },
599
+ async fetchDepositHistory(params) {
600
+ const searchParams = new URLSearchParams({ account: params.account });
601
+ searchParams.set("limit", String(params.limit ?? 20));
602
+ if (params.cursor) {
603
+ searchParams.set("cursor", params.cursor);
604
+ }
605
+ const url = apiUrl(`/deposits?${searchParams.toString()}`);
606
+ debugLog(debug, scope, "fetchDepositHistory:request", {
607
+ url,
608
+ account: shortRef(params.account),
609
+ cursor: params.cursor
610
+ });
611
+ const response = await fetch(url, {
612
+ method: "GET",
613
+ headers: { "Content-Type": "application/json" },
614
+ cache: "no-store"
615
+ });
616
+ if (!response.ok) {
617
+ const error = await response.json().catch(() => ({ error: "Unknown error" }));
618
+ debugError(
619
+ debug,
620
+ scope,
621
+ "fetchDepositHistory:failed",
622
+ error,
623
+ { status: response.status, account: shortRef(params.account) }
624
+ );
625
+ throw new Error(
626
+ error.error || `Deposit history fetch failed: ${response.status}`
627
+ );
628
+ }
629
+ const data = await response.json();
630
+ const deposits = Array.isArray(data?.deposits) ? data.deposits : [];
631
+ const nextCursor = data?.nextCursor ?? data?.next_cursor ?? null;
632
+ debugLog(debug, scope, "fetchDepositHistory:success", {
633
+ account: shortRef(params.account),
634
+ count: deposits.length,
635
+ hasMore: Boolean(nextCursor)
636
+ });
637
+ return { deposits, nextCursor };
598
638
  }
599
639
  };
600
640
  }
@@ -983,13 +1023,14 @@ function ExternalLinkIcon() {
983
1023
  ] });
984
1024
  }
985
1025
  function TransferIcon() {
986
- return /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsx4(
1026
+ return /* @__PURE__ */ jsx4("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ jsx4(
987
1027
  "path",
988
1028
  {
989
- fillRule: "evenodd",
990
- clipRule: "evenodd",
991
- d: "M9.99256 0.0706115C10.2112 0.195503 10.3185 0.457071 10.2527 0.704513L8.80705 6.13519H14.0826C14.2993 6.13519 14.4954 6.26695 14.5818 6.47064C14.6682 6.67433 14.6284 6.91113 14.4805 7.07349L6.85913 15.4396C6.68832 15.6271 6.41472 15.6711 6.19607 15.5462C5.97742 15.4213 5.87009 15.1598 5.93595 14.9123L7.38158 9.48164H2.10607C1.8893 9.48164 1.69319 9.34988 1.60679 9.14619C1.5204 8.9425 1.56019 8.7057 1.7081 8.54334L9.32949 0.177204C9.5003 -0.0102968 9.77391 -0.0542802 9.99256 0.0706115Z",
992
- fill: "currentColor"
1029
+ d: "M6.18056 9.99924H10V13.8187M3.13264 9.99924H3.125M6.95208 13.8187H6.94444M10.0076 16.8742H10M16.8826 9.99924H16.875M3.125 13.8187H4.27083M12.6736 9.99924H14.2014M3.125 16.8742H6.94444M10 2.36035V6.94369M14.2778 16.8742H15.6528C16.0806 16.8742 16.2945 16.8742 16.4579 16.791C16.6016 16.7177 16.7185 16.6009 16.7917 16.4572C16.875 16.2937 16.875 16.0798 16.875 15.652V14.277C16.875 13.8492 16.875 13.6353 16.7917 13.4719C16.7185 13.3282 16.6016 13.2113 16.4579 13.1381C16.2945 13.0548 16.0806 13.0548 15.6528 13.0548H14.2778C13.85 13.0548 13.6361 13.0548 13.4726 13.1381C13.3289 13.2113 13.2121 13.3282 13.1388 13.4719C13.0556 13.6353 13.0556 13.8492 13.0556 14.277V15.652C13.0556 16.0798 13.0556 16.2937 13.1388 16.4572C13.2121 16.6009 13.3289 16.7177 13.4726 16.791C13.6361 16.8742 13.85 16.8742 14.2778 16.8742ZM14.2778 6.94369H15.6528C16.0806 6.94369 16.2945 6.94369 16.4579 6.86043C16.6016 6.78719 16.7185 6.67033 16.7917 6.52659C16.875 6.36319 16.875 6.14928 16.875 5.72146V4.34646C16.875 3.91864 16.875 3.70474 16.7917 3.54133C16.7185 3.3976 16.6016 3.28074 16.4579 3.2075C16.2945 3.12424 16.0806 3.12424 15.6528 3.12424H14.2778C13.85 3.12424 13.6361 3.12424 13.4726 3.2075C13.3289 3.28074 13.2121 3.3976 13.1388 3.54133C13.0556 3.70474 13.0556 3.91864 13.0556 4.34646V5.72146C13.0556 6.14928 13.0556 6.36319 13.1388 6.52659C13.2121 6.67033 13.3289 6.78719 13.4726 6.86043C13.6361 6.94369 13.85 6.94369 14.2778 6.94369ZM4.34722 6.94369H5.72222C6.15004 6.94369 6.36395 6.94369 6.52735 6.86043C6.67109 6.78719 6.78795 6.67033 6.86119 6.52659C6.94444 6.36319 6.94444 6.14928 6.94444 5.72146V4.34646C6.94444 3.91864 6.94444 3.70474 6.86119 3.54133C6.78795 3.3976 6.67109 3.28074 6.52735 3.2075C6.36395 3.12424 6.15004 3.12424 5.72222 3.12424H4.34722C3.9194 3.12424 3.7055 3.12424 3.54209 3.2075C3.39836 3.28074 3.2815 3.3976 3.20826 3.54133C3.125 3.70474 3.125 3.91864 3.125 4.34646V5.72146C3.125 6.14928 3.125 6.36319 3.20826 6.52659C3.2815 6.67033 3.39836 6.78719 3.54209 6.86043C3.7055 6.94369 3.9194 6.94369 4.34722 6.94369Z",
1030
+ stroke: "currentColor",
1031
+ strokeWidth: "1.5",
1032
+ strokeLinecap: "round",
1033
+ strokeLinejoin: "round"
993
1034
  }
994
1035
  ) });
995
1036
  }
@@ -1062,7 +1103,7 @@ function ConnectStep({
1062
1103
  {
1063
1104
  src: option.icon,
1064
1105
  alt: option.label,
1065
- style: { width: 18, height: 18, borderRadius: 4 }
1106
+ style: { width: 24, height: 24, borderRadius: 6 }
1066
1107
  }
1067
1108
  ) : rowIcon(option.kind)
1068
1109
  }
@@ -1551,6 +1592,18 @@ function ProcessingStep({
1551
1592
  const pollIntervalRef = useRef3(INITIAL_POLL_INTERVAL);
1552
1593
  const pollTimeoutRef = useRef3(null);
1553
1594
  const escalatedDelayRef = useRef3(false);
1595
+ const processingContextRef = useLatestRef({
1596
+ amount,
1597
+ sourceChain,
1598
+ sourceToken,
1599
+ targetChain,
1600
+ targetToken,
1601
+ waitForFinalTx,
1602
+ hasPostBridgeActions
1603
+ });
1604
+ const onDepositCompleteRef = useLatestRef(onDepositComplete);
1605
+ const onDepositFailedRef = useLatestRef(onDepositFailed);
1606
+ const onErrorRef = useLatestRef(onError);
1554
1607
  const [state, setState] = useState(
1555
1608
  directTransfer ? { type: "complete" } : { type: "processing" }
1556
1609
  );
@@ -1576,23 +1629,20 @@ function ProcessingStep({
1576
1629
  txHash,
1577
1630
  flowLabel
1578
1631
  });
1579
- onDepositComplete?.(txHash, void 0, {
1580
- amount,
1581
- sourceChain,
1582
- sourceToken,
1583
- targetChain,
1584
- targetToken
1632
+ const context = processingContextRef.current;
1633
+ onDepositCompleteRef.current?.(txHash, void 0, {
1634
+ amount: context.amount,
1635
+ sourceChain: context.sourceChain,
1636
+ sourceToken: context.sourceToken,
1637
+ targetChain: context.targetChain,
1638
+ targetToken: context.targetToken
1585
1639
  });
1586
1640
  }, [
1587
- amount,
1588
1641
  debug,
1589
1642
  directTransfer,
1590
1643
  flowLabel,
1591
- onDepositComplete,
1592
- sourceChain,
1593
- sourceToken,
1594
- targetChain,
1595
- targetToken,
1644
+ onDepositCompleteRef,
1645
+ processingContextRef,
1596
1646
  txHash
1597
1647
  ]);
1598
1648
  useEffect3(() => {
@@ -1648,7 +1698,7 @@ function ProcessingStep({
1648
1698
  });
1649
1699
  }
1650
1700
  if (!isMounted) return;
1651
- const awaitingPostBridgeSwap = waitForFinalTx && hasPostBridgeActions;
1701
+ const awaitingPostBridgeSwap = processingContextRef.current.waitForFinalTx && processingContextRef.current.hasPostBridgeActions;
1652
1702
  if (eventForCurrentTx?.type === "post-bridge-swap-complete") {
1653
1703
  setState({ type: "complete", lastEvent: eventForCurrentTx });
1654
1704
  const swapTxHash = eventForCurrentTx.data?.swap?.transactionHash;
@@ -1657,12 +1707,13 @@ function ProcessingStep({
1657
1707
  destinationTxHash: swapTxHash,
1658
1708
  event: eventForCurrentTx.type
1659
1709
  });
1660
- onDepositComplete?.(txHash, swapTxHash, {
1661
- amount,
1662
- sourceChain,
1663
- sourceToken,
1664
- targetChain,
1665
- targetToken
1710
+ const context = processingContextRef.current;
1711
+ onDepositCompleteRef.current?.(txHash, swapTxHash, {
1712
+ amount: context.amount,
1713
+ sourceChain: context.sourceChain,
1714
+ sourceToken: context.sourceToken,
1715
+ targetChain: context.targetChain,
1716
+ targetToken: context.targetToken
1666
1717
  });
1667
1718
  return;
1668
1719
  }
@@ -1678,7 +1729,7 @@ function ProcessingStep({
1678
1729
  message: formatted.message,
1679
1730
  code: formatted.code
1680
1731
  });
1681
- onDepositFailed?.(txHash, formatted.message);
1732
+ onDepositFailedRef.current?.(txHash, formatted.message);
1682
1733
  return;
1683
1734
  }
1684
1735
  if (eventForCurrentTx?.type === "bridge-complete" && !awaitingPostBridgeSwap) {
@@ -1689,12 +1740,13 @@ function ProcessingStep({
1689
1740
  destinationTxHash: destinationTxHash2,
1690
1741
  event: eventForCurrentTx.type
1691
1742
  });
1692
- onDepositComplete?.(txHash, destinationTxHash2, {
1693
- amount,
1694
- sourceChain,
1695
- sourceToken,
1696
- targetChain,
1697
- targetToken
1743
+ const context = processingContextRef.current;
1744
+ onDepositCompleteRef.current?.(txHash, destinationTxHash2, {
1745
+ amount: context.amount,
1746
+ sourceChain: context.sourceChain,
1747
+ sourceToken: context.sourceToken,
1748
+ targetChain: context.targetChain,
1749
+ targetToken: context.targetToken
1698
1750
  });
1699
1751
  return;
1700
1752
  }
@@ -1704,12 +1756,13 @@ function ProcessingStep({
1704
1756
  txHash,
1705
1757
  event: eventForCurrentTx.type
1706
1758
  });
1707
- onDepositComplete?.(txHash, void 0, {
1708
- amount,
1709
- sourceChain,
1710
- sourceToken,
1711
- targetChain,
1712
- targetToken
1759
+ const context = processingContextRef.current;
1760
+ onDepositCompleteRef.current?.(txHash, void 0, {
1761
+ amount: context.amount,
1762
+ sourceChain: context.sourceChain,
1763
+ sourceToken: context.sourceToken,
1764
+ targetChain: context.targetChain,
1765
+ targetToken: context.targetToken
1713
1766
  });
1714
1767
  return;
1715
1768
  }
@@ -1725,7 +1778,7 @@ function ProcessingStep({
1725
1778
  message: formatted.message,
1726
1779
  code: formatted.code
1727
1780
  });
1728
- onDepositFailed?.(txHash, formatted.message);
1781
+ onDepositFailedRef.current?.(txHash, formatted.message);
1729
1782
  return;
1730
1783
  }
1731
1784
  if (eventForCurrentTx?.type === "error") {
@@ -1739,7 +1792,7 @@ function ProcessingStep({
1739
1792
  txHash,
1740
1793
  message: errorMessage
1741
1794
  });
1742
- onDepositFailed?.(txHash, errorMessage);
1795
+ onDepositFailedRef.current?.(txHash, errorMessage);
1743
1796
  return;
1744
1797
  }
1745
1798
  setState((previous) => ({
@@ -1777,21 +1830,15 @@ function ProcessingStep({
1777
1830
  }
1778
1831
  };
1779
1832
  }, [
1780
- amount,
1781
1833
  debug,
1782
1834
  directTransfer,
1783
- hasPostBridgeActions,
1784
- onDepositComplete,
1785
- onDepositFailed,
1835
+ onDepositCompleteRef,
1836
+ onDepositFailedRef,
1837
+ processingContextRef,
1786
1838
  service,
1787
1839
  smartAccount,
1788
- sourceChain,
1789
- sourceToken,
1790
1840
  state.type,
1791
- targetChain,
1792
- targetToken,
1793
- txHash,
1794
- waitForFinalTx
1841
+ txHash
1795
1842
  ]);
1796
1843
  useEffect3(() => {
1797
1844
  if (directTransfer || state.type !== "processing") return;
@@ -1804,10 +1851,10 @@ function ProcessingStep({
1804
1851
  txHash,
1805
1852
  timeoutMs: ESCALATED_DELAY_MS
1806
1853
  });
1807
- onError?.(message, "PROCESS_TIMEOUT");
1854
+ onErrorRef.current?.(message, "PROCESS_TIMEOUT");
1808
1855
  }, ESCALATED_DELAY_MS);
1809
1856
  return () => clearTimeout(timeoutId);
1810
- }, [debug, directTransfer, onError, state.type, txHash]);
1857
+ }, [debug, directTransfer, onErrorRef, state.type, txHash]);
1811
1858
  const isComplete = state.type === "complete";
1812
1859
  const isFailed = state.type === "failed";
1813
1860
  const isProcessing = state.type === "processing";
@@ -2148,6 +2195,8 @@ export {
2148
2195
  debugLog,
2149
2196
  debugError,
2150
2197
  toEvmCaip2,
2198
+ parseEvmChainId,
2199
+ isSolanaCaip2,
2151
2200
  buildSessionDetails,
2152
2201
  createDepositService,
2153
2202
  getAssetId,
@@ -2164,8 +2213,8 @@ export {
2164
2213
  getEventTxHash,
2165
2214
  isDepositEvent,
2166
2215
  txRefsMatch,
2216
+ useLatestRef,
2167
2217
  ProcessingStep,
2168
2218
  getPublicClient,
2169
- useLatestRef,
2170
2219
  applyTheme
2171
2220
  };