@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.
- package/dist/{DepositModalReown-Y4M3RA73.mjs → DepositModalReown-EYIV6APK.mjs} +3 -3
- package/dist/{DepositModalReown-6ZMLUWWD.cjs → DepositModalReown-UPYZN2XA.cjs} +4 -4
- package/dist/{WithdrawModalReown-HVBMAUPM.mjs → WithdrawModalReown-6VYKKKJN.mjs} +3 -3
- package/dist/{WithdrawModalReown-WJ5SHBV4.cjs → WithdrawModalReown-WHPQDJJJ.cjs} +4 -4
- package/dist/{chunk-RKRF7ANK.mjs → chunk-5FDIQNJJ.mjs} +22 -19
- package/dist/{chunk-4CZ7W3RS.cjs → chunk-FLVSQDP4.cjs} +181 -132
- package/dist/{chunk-GAHX5RAT.mjs → chunk-IUW3SJQT.mjs} +103 -54
- package/dist/{chunk-MGV75YLV.cjs → chunk-LTLFJPHO.cjs} +106 -103
- package/dist/{chunk-R6U6BHCV.cjs → chunk-MUWVDVY4.cjs} +13 -1
- package/dist/{chunk-IYZGLNY6.mjs → chunk-NFE5ZLD3.mjs} +1171 -374
- package/dist/{chunk-CIXHTOO3.mjs → chunk-SDZKKUCJ.mjs} +13 -1
- package/dist/{chunk-OWV4KVBM.cjs → chunk-UDKZWFCM.cjs} +1251 -454
- package/dist/constants.cjs +2 -2
- package/dist/constants.mjs +1 -1
- package/dist/deposit.cjs +4 -4
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +3 -3
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +4 -4
- package/dist/reown.cjs +5 -5
- package/dist/reown.d.cts +1 -1
- package/dist/reown.d.ts +1 -1
- package/dist/reown.mjs +4 -4
- package/dist/styles.css +696 -34
- package/dist/{types-BLIqLF0c.d.ts → types-DGQzvl6v.d.ts} +12 -1
- package/dist/{types-7IoN8k-P.d.cts → types-DJ1fzNC7.d.cts} +12 -1
- package/dist/withdraw.cjs +4 -4
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +2 -2
- package/dist/withdraw.mjs +3 -3
- package/package.json +5 -5
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
getTokenDecimalsByAddress,
|
|
9
9
|
getTokenIcon,
|
|
10
10
|
getTokenSymbol
|
|
11
|
-
} from "./chunk-
|
|
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
|
|
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
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
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:
|
|
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
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
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
|
-
|
|
1592
|
-
|
|
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
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
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
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1835
|
+
onDepositCompleteRef,
|
|
1836
|
+
onDepositFailedRef,
|
|
1837
|
+
processingContextRef,
|
|
1786
1838
|
service,
|
|
1787
1839
|
smartAccount,
|
|
1788
|
-
sourceChain,
|
|
1789
|
-
sourceToken,
|
|
1790
1840
|
state.type,
|
|
1791
|
-
|
|
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
|
-
|
|
1854
|
+
onErrorRef.current?.(message, "PROCESS_TIMEOUT");
|
|
1808
1855
|
}, ESCALATED_DELAY_MS);
|
|
1809
1856
|
return () => clearTimeout(timeoutId);
|
|
1810
|
-
}, [debug, directTransfer,
|
|
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
|
};
|