@rhinestone/deposit-modal 0.1.61 → 0.1.63
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-BKMRNZNX.cjs → DepositModalReown-3KQE4YU6.cjs} +3 -3
- package/dist/{DepositModalReown-727JVH7Q.mjs → DepositModalReown-XOLZ62BQ.mjs} +2 -2
- package/dist/{WithdrawModalReown-OHTYDGI5.mjs → WithdrawModalReown-2BW5CM3A.mjs} +2 -2
- package/dist/{WithdrawModalReown-ZNQPXAS6.cjs → WithdrawModalReown-RCQFBPOF.cjs} +3 -3
- package/dist/{chunk-RRYC5EZF.mjs → chunk-2IFX6ZEE.mjs} +30 -16
- package/dist/{chunk-TQ6IIGRS.cjs → chunk-5SR5N75I.cjs} +104 -33
- package/dist/{chunk-TBUOMWKJ.cjs → chunk-N3BZTUSJ.cjs} +143 -117
- package/dist/{chunk-C5TWF4ZE.cjs → chunk-OFGBTU45.cjs} +80 -66
- package/dist/{chunk-7TTEHQBD.mjs → chunk-TDTBAZNO.mjs} +92 -21
- package/dist/{chunk-IKTHUMGZ.mjs → chunk-XVCPUB6K.mjs} +39 -13
- package/dist/deposit.cjs +3 -3
- package/dist/deposit.mjs +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.mjs +3 -3
- package/dist/reown.cjs +4 -4
- package/dist/reown.mjs +3 -3
- package/dist/withdraw.cjs +3 -3
- package/dist/withdraw.mjs +2 -2
- package/package.json +1 -1
|
@@ -809,6 +809,16 @@ function formatUserError(raw) {
|
|
|
809
809
|
return cleaned;
|
|
810
810
|
}
|
|
811
811
|
|
|
812
|
+
// src/core/useLatestRef.ts
|
|
813
|
+
import { useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
814
|
+
function useLatestRef(value) {
|
|
815
|
+
const ref = useRef2(value);
|
|
816
|
+
useEffect2(() => {
|
|
817
|
+
ref.current = value;
|
|
818
|
+
}, [value]);
|
|
819
|
+
return ref;
|
|
820
|
+
}
|
|
821
|
+
|
|
812
822
|
// src/core/theme.ts
|
|
813
823
|
var RADIUS_SCALE = {
|
|
814
824
|
none: { sm: "0", md: "0", lg: "0" },
|
|
@@ -1262,7 +1272,7 @@ function accountFromPrivateKey(privateKey) {
|
|
|
1262
1272
|
}
|
|
1263
1273
|
|
|
1264
1274
|
// src/components/steps/ProcessingStep.tsx
|
|
1265
|
-
import { useEffect as
|
|
1275
|
+
import { useEffect as useEffect3, useRef as useRef3, useState } from "react";
|
|
1266
1276
|
import { formatUnits } from "viem";
|
|
1267
1277
|
|
|
1268
1278
|
// src/components/ui/PoweredBy.tsx
|
|
@@ -1348,6 +1358,10 @@ function getEventTxHash(event) {
|
|
|
1348
1358
|
const source = isRecord(event.data?.source) ? event.data.source : void 0;
|
|
1349
1359
|
return asString(deposit?.transactionHash) ?? asString(source?.transactionHash);
|
|
1350
1360
|
}
|
|
1361
|
+
if (event.type === "post-bridge-swap-complete" || event.type === "post-bridge-swap-failed") {
|
|
1362
|
+
const deposit = isRecord(event.data?.deposit) ? event.data.deposit : void 0;
|
|
1363
|
+
return asString(deposit?.transactionHash);
|
|
1364
|
+
}
|
|
1351
1365
|
return void 0;
|
|
1352
1366
|
}
|
|
1353
1367
|
function getEventSourceDetails(event) {
|
|
@@ -1361,7 +1375,7 @@ function getEventSourceDetails(event) {
|
|
|
1361
1375
|
}
|
|
1362
1376
|
const source = isRecord(event.data.source) ? event.data.source : void 0;
|
|
1363
1377
|
const deposit = isRecord(event.data.deposit) ? event.data.deposit : void 0;
|
|
1364
|
-
if (event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "bridge-failed" || event.type === "error") {
|
|
1378
|
+
if (event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "bridge-failed" || event.type === "error" || event.type === "post-bridge-swap-complete" || event.type === "post-bridge-swap-failed") {
|
|
1365
1379
|
return {
|
|
1366
1380
|
chainId: asNumber(source?.chain) ?? asNumber(deposit?.chain),
|
|
1367
1381
|
amount: asAmount(source?.amount) ?? asAmount(deposit?.amount),
|
|
@@ -1371,7 +1385,7 @@ function getEventSourceDetails(event) {
|
|
|
1371
1385
|
return {};
|
|
1372
1386
|
}
|
|
1373
1387
|
function isDepositEvent(event) {
|
|
1374
|
-
return event?.type === "deposit-received" || event?.type === "bridge-started" || event?.type === "bridge-complete" || event?.type === "bridge-failed" || event?.type === "error";
|
|
1388
|
+
return event?.type === "deposit-received" || event?.type === "bridge-started" || event?.type === "bridge-complete" || event?.type === "bridge-failed" || event?.type === "post-bridge-swap-complete" || event?.type === "post-bridge-swap-failed" || event?.type === "error";
|
|
1375
1389
|
}
|
|
1376
1390
|
function isHexString(value) {
|
|
1377
1391
|
return value.startsWith("0x") || value.startsWith("0X");
|
|
@@ -1465,9 +1479,9 @@ function parseWebhookTimestamp(event) {
|
|
|
1465
1479
|
function syncPhaseTimings(previous, event) {
|
|
1466
1480
|
if (!event?.type) return previous;
|
|
1467
1481
|
const timestamp = parseWebhookTimestamp(event) ?? Date.now();
|
|
1468
|
-
const setReceived = (event.type === "deposit-received" || event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "bridge-failed" || event.type === "error") && previous.receivedAt === void 0;
|
|
1469
|
-
const setBridging = (event.type === "bridge-started" || event.type === "bridge-complete") && previous.bridgingAt === void 0;
|
|
1470
|
-
const setCompleted = event.type === "bridge-complete" && previous.completedAt === void 0;
|
|
1482
|
+
const setReceived = (event.type === "deposit-received" || event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "bridge-failed" || event.type === "post-bridge-swap-complete" || event.type === "post-bridge-swap-failed" || event.type === "error") && previous.receivedAt === void 0;
|
|
1483
|
+
const setBridging = (event.type === "bridge-started" || event.type === "bridge-complete" || event.type === "post-bridge-swap-complete") && previous.bridgingAt === void 0;
|
|
1484
|
+
const setCompleted = (event.type === "bridge-complete" || event.type === "post-bridge-swap-complete") && previous.completedAt === void 0;
|
|
1471
1485
|
if (!setReceived && !setBridging && !setCompleted) return previous;
|
|
1472
1486
|
return {
|
|
1473
1487
|
...previous,
|
|
@@ -1504,7 +1518,8 @@ function getCurrentPhaseId(state, phaseTimings, isEarlyComplete) {
|
|
|
1504
1518
|
if (state.type === "complete") {
|
|
1505
1519
|
return void 0;
|
|
1506
1520
|
}
|
|
1507
|
-
if (state.lastEvent?.type === "bridge-started"
|
|
1521
|
+
if (state.lastEvent?.type === "bridge-started" || state.lastEvent?.type === "bridge-complete")
|
|
1522
|
+
return "bridging";
|
|
1508
1523
|
if (state.lastEvent?.type === "deposit-received") return "received";
|
|
1509
1524
|
return "confirming";
|
|
1510
1525
|
}
|
|
@@ -1518,6 +1533,7 @@ function ProcessingStep({
|
|
|
1518
1533
|
sourceSymbol: providedSourceSymbol,
|
|
1519
1534
|
sourceDecimals: providedSourceDecimals,
|
|
1520
1535
|
waitForFinalTx,
|
|
1536
|
+
hasPostBridgeActions,
|
|
1521
1537
|
service,
|
|
1522
1538
|
directTransfer,
|
|
1523
1539
|
flowLabel = "deposit",
|
|
@@ -1529,10 +1545,10 @@ function ProcessingStep({
|
|
|
1529
1545
|
onDepositFailed,
|
|
1530
1546
|
onError
|
|
1531
1547
|
}) {
|
|
1532
|
-
const startTimeRef =
|
|
1533
|
-
const pollIntervalRef =
|
|
1534
|
-
const pollTimeoutRef =
|
|
1535
|
-
const escalatedDelayRef =
|
|
1548
|
+
const startTimeRef = useRef3(Date.now());
|
|
1549
|
+
const pollIntervalRef = useRef3(INITIAL_POLL_INTERVAL);
|
|
1550
|
+
const pollTimeoutRef = useRef3(null);
|
|
1551
|
+
const escalatedDelayRef = useRef3(false);
|
|
1536
1552
|
const [state, setState] = useState(
|
|
1537
1553
|
directTransfer ? { type: "complete" } : { type: "processing" }
|
|
1538
1554
|
);
|
|
@@ -1546,7 +1562,7 @@ function ProcessingStep({
|
|
|
1546
1562
|
return { startedAt: startTimeRef.current };
|
|
1547
1563
|
});
|
|
1548
1564
|
const [hasEscalatedDelay, setHasEscalatedDelay] = useState(false);
|
|
1549
|
-
|
|
1565
|
+
useEffect3(() => {
|
|
1550
1566
|
if (!directTransfer) return;
|
|
1551
1567
|
const completedAt = Date.now();
|
|
1552
1568
|
setPhaseTimings({
|
|
@@ -1577,7 +1593,7 @@ function ProcessingStep({
|
|
|
1577
1593
|
targetToken,
|
|
1578
1594
|
txHash
|
|
1579
1595
|
]);
|
|
1580
|
-
|
|
1596
|
+
useEffect3(() => {
|
|
1581
1597
|
if (directTransfer || state.type !== "processing") return;
|
|
1582
1598
|
const updateElapsed = () => {
|
|
1583
1599
|
setElapsedSeconds(
|
|
@@ -1588,7 +1604,7 @@ function ProcessingStep({
|
|
|
1588
1604
|
const intervalId = setInterval(updateElapsed, 1e3);
|
|
1589
1605
|
return () => clearInterval(intervalId);
|
|
1590
1606
|
}, [directTransfer, state.type]);
|
|
1591
|
-
|
|
1607
|
+
useEffect3(() => {
|
|
1592
1608
|
if (state.type === "processing") return;
|
|
1593
1609
|
const endedAt = state.type === "complete" ? phaseTimings.completedAt ?? Date.now() : Date.now();
|
|
1594
1610
|
setElapsedSeconds(Math.floor((endedAt - startTimeRef.current) / 1e3));
|
|
@@ -1596,14 +1612,14 @@ function ProcessingStep({
|
|
|
1596
1612
|
(previous) => previous.endedAt !== void 0 ? previous : { ...previous, endedAt }
|
|
1597
1613
|
);
|
|
1598
1614
|
}, [phaseTimings.completedAt, state.type]);
|
|
1599
|
-
|
|
1615
|
+
useEffect3(() => {
|
|
1600
1616
|
if (!state.lastEvent) return;
|
|
1601
1617
|
setPhaseTimings((previous) => syncPhaseTimings(previous, state.lastEvent));
|
|
1602
1618
|
}, [state.lastEvent?.time, state.lastEvent?.type]);
|
|
1603
|
-
|
|
1619
|
+
useEffect3(() => {
|
|
1604
1620
|
savePhaseTimings(txHash, phaseTimings);
|
|
1605
1621
|
}, [txHash, phaseTimings]);
|
|
1606
|
-
|
|
1622
|
+
useEffect3(() => {
|
|
1607
1623
|
if (directTransfer) return;
|
|
1608
1624
|
if (state.type !== "processing") {
|
|
1609
1625
|
pollIntervalRef.current = INITIAL_POLL_INTERVAL;
|
|
@@ -1630,7 +1646,40 @@ function ProcessingStep({
|
|
|
1630
1646
|
});
|
|
1631
1647
|
}
|
|
1632
1648
|
if (!isMounted) return;
|
|
1633
|
-
|
|
1649
|
+
const awaitingPostBridgeSwap = waitForFinalTx && hasPostBridgeActions;
|
|
1650
|
+
if (eventForCurrentTx?.type === "post-bridge-swap-complete") {
|
|
1651
|
+
setState({ type: "complete", lastEvent: eventForCurrentTx });
|
|
1652
|
+
const swapTxHash = eventForCurrentTx.data?.swap?.transactionHash;
|
|
1653
|
+
debugLog(debug, "processing", "state:complete", {
|
|
1654
|
+
txHash,
|
|
1655
|
+
destinationTxHash: swapTxHash,
|
|
1656
|
+
event: eventForCurrentTx.type
|
|
1657
|
+
});
|
|
1658
|
+
onDepositComplete?.(txHash, swapTxHash, {
|
|
1659
|
+
amount,
|
|
1660
|
+
sourceChain,
|
|
1661
|
+
sourceToken,
|
|
1662
|
+
targetChain,
|
|
1663
|
+
targetToken
|
|
1664
|
+
});
|
|
1665
|
+
return;
|
|
1666
|
+
}
|
|
1667
|
+
if (eventForCurrentTx?.type === "post-bridge-swap-failed") {
|
|
1668
|
+
const formatted = formatBridgeFailedMessage(eventForCurrentTx);
|
|
1669
|
+
setState({
|
|
1670
|
+
type: "failed",
|
|
1671
|
+
message: formatted.message,
|
|
1672
|
+
lastEvent: eventForCurrentTx
|
|
1673
|
+
});
|
|
1674
|
+
debugLog(debug, "processing", "state:failed", {
|
|
1675
|
+
txHash,
|
|
1676
|
+
message: formatted.message,
|
|
1677
|
+
code: formatted.code
|
|
1678
|
+
});
|
|
1679
|
+
onDepositFailed?.(txHash, formatted.message);
|
|
1680
|
+
return;
|
|
1681
|
+
}
|
|
1682
|
+
if (eventForCurrentTx?.type === "bridge-complete" && !awaitingPostBridgeSwap) {
|
|
1634
1683
|
setState({ type: "complete", lastEvent: eventForCurrentTx });
|
|
1635
1684
|
const destinationTxHash2 = eventForCurrentTx.data?.destination?.transactionHash;
|
|
1636
1685
|
debugLog(debug, "processing", "state:complete", {
|
|
@@ -1729,6 +1778,7 @@ function ProcessingStep({
|
|
|
1729
1778
|
amount,
|
|
1730
1779
|
debug,
|
|
1731
1780
|
directTransfer,
|
|
1781
|
+
hasPostBridgeActions,
|
|
1732
1782
|
onDepositComplete,
|
|
1733
1783
|
onDepositFailed,
|
|
1734
1784
|
service,
|
|
@@ -1741,7 +1791,7 @@ function ProcessingStep({
|
|
|
1741
1791
|
txHash,
|
|
1742
1792
|
waitForFinalTx
|
|
1743
1793
|
]);
|
|
1744
|
-
|
|
1794
|
+
useEffect3(() => {
|
|
1745
1795
|
if (directTransfer || state.type !== "processing") return;
|
|
1746
1796
|
const timeoutId = setTimeout(() => {
|
|
1747
1797
|
if (escalatedDelayRef.current) return;
|
|
@@ -1765,12 +1815,15 @@ function ProcessingStep({
|
|
|
1765
1815
|
const timelineNowMs = phaseTimings.endedAt ?? Date.now();
|
|
1766
1816
|
const flowNoun = flowLabel === "withdraw" ? "withdrawal" : "deposit";
|
|
1767
1817
|
const flowCapitalized = flowLabel === "withdraw" ? "Withdrawal" : "Deposit";
|
|
1768
|
-
const
|
|
1818
|
+
const isPostBridgeSwapEvent = lastEvent?.type === "post-bridge-swap-complete" || lastEvent?.type === "post-bridge-swap-failed";
|
|
1819
|
+
const destinationTxHash = isPostBridgeSwapEvent ? lastEvent?.data?.swap?.transactionHash || null : lastEvent?.data?.destination?.transactionHash || null;
|
|
1820
|
+
const bridgeTxHash = isPostBridgeSwapEvent ? lastEvent?.data?.bridge?.transactionHash || null : null;
|
|
1769
1821
|
const sourceDetails = getEventSourceDetails(lastEvent);
|
|
1770
1822
|
const displaySourceChain = sourceDetails.chainId ?? sourceChain;
|
|
1771
1823
|
const displaySourceToken = sourceDetails.token ?? sourceToken;
|
|
1772
1824
|
const displayAmount = sourceDetails.amount ?? amount;
|
|
1773
1825
|
const sourceExplorerUrl = getExplorerTxUrl(displaySourceChain, txHash);
|
|
1826
|
+
const bridgeExplorerUrl = bridgeTxHash ? getExplorerTxUrl(targetChain, bridgeTxHash) : null;
|
|
1774
1827
|
const destExplorerUrl = destinationTxHash ? getExplorerTxUrl(targetChain, destinationTxHash) : null;
|
|
1775
1828
|
const isEvmSourceToken = /^0x[a-fA-F0-9]{40}$/.test(displaySourceToken);
|
|
1776
1829
|
const sourceSymbol = displaySourceChain === "solana" ? providedSourceSymbol ?? "SOL" : isEvmSourceToken ? getTokenSymbol(displaySourceToken, displaySourceChain) : providedSourceSymbol ?? "Token";
|
|
@@ -2001,8 +2054,25 @@ function ProcessingStep({
|
|
|
2001
2054
|
}
|
|
2002
2055
|
) : /* @__PURE__ */ jsx7("span", { style: { fontFamily: "ui-monospace, SFMono-Regular, monospace", fontSize: 12 }, children: truncateHash(txHash) }) })
|
|
2003
2056
|
] }),
|
|
2057
|
+
bridgeTxHash && /* @__PURE__ */ jsxs6("div", { className: "rs-card-row", children: [
|
|
2058
|
+
/* @__PURE__ */ jsx7("span", { className: "rs-card-label", children: "Bridge tx" }),
|
|
2059
|
+
/* @__PURE__ */ jsx7("span", { className: "rs-card-value", children: bridgeExplorerUrl ? /* @__PURE__ */ jsxs6(
|
|
2060
|
+
"a",
|
|
2061
|
+
{
|
|
2062
|
+
href: bridgeExplorerUrl,
|
|
2063
|
+
target: "_blank",
|
|
2064
|
+
rel: "noopener noreferrer",
|
|
2065
|
+
className: "rs-card-external-link",
|
|
2066
|
+
style: { gap: 4, fontFamily: "ui-monospace, SFMono-Regular, monospace", fontSize: 12 },
|
|
2067
|
+
children: [
|
|
2068
|
+
truncateHash(bridgeTxHash),
|
|
2069
|
+
txLinkIcon
|
|
2070
|
+
]
|
|
2071
|
+
}
|
|
2072
|
+
) : /* @__PURE__ */ jsx7("span", { style: { fontFamily: "ui-monospace, SFMono-Regular, monospace", fontSize: 12 }, children: truncateHash(bridgeTxHash) }) })
|
|
2073
|
+
] }),
|
|
2004
2074
|
destinationTxHash && /* @__PURE__ */ jsxs6("div", { className: "rs-card-row", children: [
|
|
2005
|
-
/* @__PURE__ */ jsx7("span", { className: "rs-card-label", children: "Destination tx" }),
|
|
2075
|
+
/* @__PURE__ */ jsx7("span", { className: "rs-card-label", children: bridgeTxHash ? "Swap tx" : "Destination tx" }),
|
|
2006
2076
|
/* @__PURE__ */ jsx7("span", { className: "rs-card-value", children: destExplorerUrl ? /* @__PURE__ */ jsxs6(
|
|
2007
2077
|
"a",
|
|
2008
2078
|
{
|
|
@@ -2094,5 +2164,6 @@ export {
|
|
|
2094
2164
|
txRefsMatch,
|
|
2095
2165
|
ProcessingStep,
|
|
2096
2166
|
getPublicClient,
|
|
2167
|
+
useLatestRef,
|
|
2097
2168
|
applyTheme
|
|
2098
2169
|
};
|
|
@@ -24,8 +24,9 @@ import {
|
|
|
24
24
|
saveSessionOwnerToStorage,
|
|
25
25
|
toEvmCaip2,
|
|
26
26
|
tokenFormatter,
|
|
27
|
-
txRefsMatch
|
|
28
|
-
|
|
27
|
+
txRefsMatch,
|
|
28
|
+
useLatestRef
|
|
29
|
+
} from "./chunk-TDTBAZNO.mjs";
|
|
29
30
|
import {
|
|
30
31
|
DEFAULT_BACKEND_URL,
|
|
31
32
|
DEFAULT_SIGNER_ADDRESS,
|
|
@@ -2592,6 +2593,9 @@ function DepositFlow({
|
|
|
2592
2593
|
onError,
|
|
2593
2594
|
debug
|
|
2594
2595
|
}) {
|
|
2596
|
+
const onStepChangeRef = useLatestRef(onStepChange);
|
|
2597
|
+
const onTotalBalanceChangeRef = useLatestRef(onTotalBalanceChange);
|
|
2598
|
+
const onEventRef = useLatestRef(onEvent);
|
|
2595
2599
|
const hasInitialReownSession = Boolean(
|
|
2596
2600
|
enableSolana ? reownWallet?.isConnected || reownWallet?.address : reownWallet?.address
|
|
2597
2601
|
);
|
|
@@ -2916,12 +2920,22 @@ function DepositFlow({
|
|
|
2916
2920
|
const stepIndex = step.type === "setup" ? 0 : step.type === "deposit-address" ? 1 : step.type === "select-asset" ? 1 : step.type === "solana-token-select" ? 1 : step.type === "solana-amount" ? 2 : step.type === "amount" ? 2 : step.type === "confirm" ? 3 : step.type === "solana-confirm" ? 3 : 4;
|
|
2917
2921
|
const currentBackHandler = step.type === "deposit-address" ? handleBackFromDepositAddress : step.type === "select-asset" && signerContext && !canAutoLock ? handleBackFromSelectAsset : step.type === "solana-token-select" ? handleBackFromSolanaTokenSelect : step.type === "solana-amount" ? handleBackFromSolanaAmount : step.type === "solana-confirm" ? handleBackFromSolanaConfirm : step.type === "amount" ? handleBackFromAmount : step.type === "confirm" ? handleBackFromConfirm : void 0;
|
|
2918
2922
|
useEffect9(() => {
|
|
2919
|
-
|
|
2920
|
-
}, [stepIndex, currentBackHandler,
|
|
2923
|
+
onStepChangeRef.current?.(stepIndex, currentBackHandler);
|
|
2924
|
+
}, [stepIndex, currentBackHandler, onStepChangeRef]);
|
|
2921
2925
|
const stepSendToken = step.type === "amount" ? step.asset.symbol : null;
|
|
2926
|
+
const stepOpenEventKey = step.type === "select-asset" ? "select-asset" : step.type === "deposit-address" ? "deposit-address" : step.type === "amount" && stepSendToken ? `amount:${stepSendToken.toLowerCase()}` : null;
|
|
2927
|
+
const lastStepOpenEventKeyRef = useRef5(null);
|
|
2922
2928
|
useEffect9(() => {
|
|
2929
|
+
if (!stepOpenEventKey) {
|
|
2930
|
+
lastStepOpenEventKeyRef.current = null;
|
|
2931
|
+
return;
|
|
2932
|
+
}
|
|
2933
|
+
if (lastStepOpenEventKeyRef.current === stepOpenEventKey) {
|
|
2934
|
+
return;
|
|
2935
|
+
}
|
|
2936
|
+
lastStepOpenEventKeyRef.current = stepOpenEventKey;
|
|
2923
2937
|
if (step.type === "select-asset") {
|
|
2924
|
-
|
|
2938
|
+
onEventRef.current?.({
|
|
2925
2939
|
type: "deposit_modal_connected_wallet_select_source_open",
|
|
2926
2940
|
total_balance_in_external_wallet: totalBalanceUsd,
|
|
2927
2941
|
pred_balance: totalBalanceUsd
|
|
@@ -2929,7 +2943,7 @@ function DepositFlow({
|
|
|
2929
2943
|
} else if (step.type === "deposit-address") {
|
|
2930
2944
|
const chainName = getChainName(targetChain);
|
|
2931
2945
|
const tokenSymbol = getTokenSymbol(targetToken, targetChain);
|
|
2932
|
-
|
|
2946
|
+
onEventRef.current?.({
|
|
2933
2947
|
type: "deposit_modal_transfer_crypto_open",
|
|
2934
2948
|
default_chain: chainName,
|
|
2935
2949
|
default_token: tokenSymbol,
|
|
@@ -2937,14 +2951,22 @@ function DepositFlow({
|
|
|
2937
2951
|
});
|
|
2938
2952
|
} else if (step.type === "amount" && stepSendToken) {
|
|
2939
2953
|
const receiveSymbol = getTokenSymbol(targetToken, targetChain);
|
|
2940
|
-
|
|
2954
|
+
onEventRef.current?.({
|
|
2941
2955
|
type: "deposit_modal_connected_wallet_enter_value_open",
|
|
2942
2956
|
send_token: stepSendToken,
|
|
2943
2957
|
receive_token: receiveSymbol,
|
|
2944
2958
|
pred_balance: totalBalanceUsd
|
|
2945
2959
|
});
|
|
2946
2960
|
}
|
|
2947
|
-
}, [
|
|
2961
|
+
}, [
|
|
2962
|
+
step.type,
|
|
2963
|
+
stepOpenEventKey,
|
|
2964
|
+
stepSendToken,
|
|
2965
|
+
targetChain,
|
|
2966
|
+
targetToken,
|
|
2967
|
+
totalBalanceUsd,
|
|
2968
|
+
onEventRef
|
|
2969
|
+
]);
|
|
2948
2970
|
useEffect9(() => {
|
|
2949
2971
|
logFlow("state:changed", {
|
|
2950
2972
|
step: step.type,
|
|
@@ -2962,8 +2984,8 @@ function DepositFlow({
|
|
|
2962
2984
|
targetToken
|
|
2963
2985
|
]);
|
|
2964
2986
|
useEffect9(() => {
|
|
2965
|
-
|
|
2966
|
-
}, [totalBalanceUsd,
|
|
2987
|
+
onTotalBalanceChangeRef.current?.(totalBalanceUsd);
|
|
2988
|
+
}, [totalBalanceUsd, onTotalBalanceChangeRef]);
|
|
2967
2989
|
const isDepositAddressMode = flowMode === "deposit-address";
|
|
2968
2990
|
const isSolanaWalletMode = flowMode === "solana-wallet";
|
|
2969
2991
|
const handleSelectProvider = useCallback3(() => {
|
|
@@ -3386,6 +3408,7 @@ function DepositFlow({
|
|
|
3386
3408
|
sourceSymbol: step.sourceSymbol,
|
|
3387
3409
|
sourceDecimals: step.sourceDecimals,
|
|
3388
3410
|
waitForFinalTx,
|
|
3411
|
+
hasPostBridgeActions: Boolean(postBridgeActions?.length),
|
|
3389
3412
|
service,
|
|
3390
3413
|
directTransfer: step.directTransfer,
|
|
3391
3414
|
onClose,
|
|
@@ -3509,6 +3532,7 @@ function DepositFlow({
|
|
|
3509
3532
|
sourceSymbol: step.sourceSymbol,
|
|
3510
3533
|
sourceDecimals: step.sourceDecimals,
|
|
3511
3534
|
waitForFinalTx,
|
|
3535
|
+
hasPostBridgeActions: Boolean(postBridgeActions?.length),
|
|
3512
3536
|
service,
|
|
3513
3537
|
directTransfer: step.directTransfer,
|
|
3514
3538
|
onClose,
|
|
@@ -3624,6 +3648,7 @@ function DepositFlow({
|
|
|
3624
3648
|
sourceSymbol: step.sourceSymbol,
|
|
3625
3649
|
sourceDecimals: step.sourceDecimals,
|
|
3626
3650
|
waitForFinalTx,
|
|
3651
|
+
hasPostBridgeActions: Boolean(postBridgeActions?.length),
|
|
3627
3652
|
service,
|
|
3628
3653
|
directTransfer: step.directTransfer,
|
|
3629
3654
|
onClose,
|
|
@@ -3640,7 +3665,7 @@ function DepositFlow({
|
|
|
3640
3665
|
// src/DepositModal.tsx
|
|
3641
3666
|
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3642
3667
|
var ReownDepositInner = lazy(
|
|
3643
|
-
() => import("./DepositModalReown-
|
|
3668
|
+
() => import("./DepositModalReown-XOLZ62BQ.mjs").then((m) => ({ default: m.DepositModalReown }))
|
|
3644
3669
|
);
|
|
3645
3670
|
function DepositModal(props) {
|
|
3646
3671
|
const needsReown = !!props.reownAppId;
|
|
@@ -3709,6 +3734,7 @@ function DepositModalInner({
|
|
|
3709
3734
|
debug
|
|
3710
3735
|
}) {
|
|
3711
3736
|
const modalRef = useRef6(null);
|
|
3737
|
+
const onReadyRef = useLatestRef(onReady);
|
|
3712
3738
|
const [currentStepIndex, setCurrentStepIndex] = useState11(0);
|
|
3713
3739
|
const [totalBalanceUsd, setTotalBalanceUsd] = useState11(null);
|
|
3714
3740
|
const backHandlerRef = useRef6(void 0);
|
|
@@ -3733,9 +3759,9 @@ function DepositModalInner({
|
|
|
3733
3759
|
useEffect10(() => {
|
|
3734
3760
|
if (isOpen && !hasCalledReady.current) {
|
|
3735
3761
|
hasCalledReady.current = true;
|
|
3736
|
-
|
|
3762
|
+
onReadyRef.current?.();
|
|
3737
3763
|
}
|
|
3738
|
-
}, [isOpen,
|
|
3764
|
+
}, [isOpen, onReadyRef]);
|
|
3739
3765
|
useEffect10(() => {
|
|
3740
3766
|
if (!isOpen) {
|
|
3741
3767
|
setCurrentStepIndex(0);
|
package/dist/deposit.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var _chunkN3BZTUSJcjs = require('./chunk-N3BZTUSJ.cjs');
|
|
4
|
+
require('./chunk-5SR5N75I.cjs');
|
|
5
5
|
require('./chunk-R6U6BHCV.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
exports.DepositModal =
|
|
8
|
+
exports.DepositModal = _chunkN3BZTUSJcjs.DepositModal;
|
package/dist/deposit.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkN3BZTUSJcjs = require('./chunk-N3BZTUSJ.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
7
|
-
require('./chunk-
|
|
6
|
+
var _chunkOFGBTU45cjs = require('./chunk-OFGBTU45.cjs');
|
|
7
|
+
require('./chunk-5SR5N75I.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -66,4 +66,4 @@ var _chunkR6U6BHCVcjs = require('./chunk-R6U6BHCV.cjs');
|
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
exports.CHAIN_BY_ID = _chunkR6U6BHCVcjs.CHAIN_BY_ID; exports.DEFAULT_BACKEND_URL = _chunkR6U6BHCVcjs.DEFAULT_BACKEND_URL; exports.DEFAULT_SIGNER_ADDRESS = _chunkR6U6BHCVcjs.DEFAULT_SIGNER_ADDRESS; exports.DepositModal =
|
|
69
|
+
exports.CHAIN_BY_ID = _chunkR6U6BHCVcjs.CHAIN_BY_ID; exports.DEFAULT_BACKEND_URL = _chunkR6U6BHCVcjs.DEFAULT_BACKEND_URL; exports.DEFAULT_SIGNER_ADDRESS = _chunkR6U6BHCVcjs.DEFAULT_SIGNER_ADDRESS; exports.DepositModal = _chunkN3BZTUSJcjs.DepositModal; exports.NATIVE_TOKEN_ADDRESS = _chunkR6U6BHCVcjs.NATIVE_TOKEN_ADDRESS; exports.SOURCE_CHAINS = _chunkR6U6BHCVcjs.SOURCE_CHAINS; exports.SUPPORTED_CHAINS = _chunkR6U6BHCVcjs.SUPPORTED_CHAINS; exports.WithdrawModal = _chunkOFGBTU45cjs.WithdrawModal; exports.chainRegistry = _chunkR6U6BHCVcjs.chainRegistry; exports.findChainIdForToken = _chunkR6U6BHCVcjs.findChainIdForToken; exports.getChainBadge = _chunkR6U6BHCVcjs.getChainBadge; exports.getChainIcon = _chunkR6U6BHCVcjs.getChainIcon; exports.getChainId = _chunkR6U6BHCVcjs.getChainId; exports.getChainName = _chunkR6U6BHCVcjs.getChainName; exports.getChainObject = _chunkR6U6BHCVcjs.getChainObject; exports.getExplorerName = _chunkR6U6BHCVcjs.getExplorerName; exports.getExplorerTxUrl = _chunkR6U6BHCVcjs.getExplorerTxUrl; exports.getExplorerUrl = _chunkR6U6BHCVcjs.getExplorerUrl; exports.getSupportedChainIds = _chunkR6U6BHCVcjs.getSupportedChainIds; exports.getSupportedTargetTokens = _chunkR6U6BHCVcjs.getSupportedTargetTokens; exports.getSupportedTokenSymbolsForChain = _chunkR6U6BHCVcjs.getSupportedTokenSymbolsForChain; exports.getTargetTokenSymbolsForChain = _chunkR6U6BHCVcjs.getTargetTokenSymbolsForChain; exports.getTokenAddress = _chunkR6U6BHCVcjs.getTokenAddress; exports.getTokenDecimals = _chunkR6U6BHCVcjs.getTokenDecimals; exports.getTokenDecimalsByAddress = _chunkR6U6BHCVcjs.getTokenDecimalsByAddress; exports.getTokenIcon = _chunkR6U6BHCVcjs.getTokenIcon; exports.getTokenSymbol = _chunkR6U6BHCVcjs.getTokenSymbol; exports.getUsdcAddress = _chunkR6U6BHCVcjs.getUsdcAddress; exports.getUsdcDecimals = _chunkR6U6BHCVcjs.getUsdcDecimals; exports.isSupportedTokenAddressForChain = _chunkR6U6BHCVcjs.isSupportedTokenAddressForChain;
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DepositModal
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XVCPUB6K.mjs";
|
|
4
4
|
import {
|
|
5
5
|
WithdrawModal
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-2IFX6ZEE.mjs";
|
|
7
|
+
import "./chunk-TDTBAZNO.mjs";
|
|
8
8
|
import {
|
|
9
9
|
CHAIN_BY_ID,
|
|
10
10
|
DEFAULT_BACKEND_URL,
|
package/dist/reown.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkN3BZTUSJcjs = require('./chunk-N3BZTUSJ.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
7
|
-
require('./chunk-
|
|
6
|
+
var _chunkOFGBTU45cjs = require('./chunk-OFGBTU45.cjs');
|
|
7
|
+
require('./chunk-5SR5N75I.cjs');
|
|
8
8
|
require('./chunk-R6U6BHCV.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.DepositModal =
|
|
12
|
+
exports.DepositModal = _chunkN3BZTUSJcjs.DepositModal; exports.WithdrawModal = _chunkOFGBTU45cjs.WithdrawModal;
|
package/dist/reown.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DepositModal
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XVCPUB6K.mjs";
|
|
4
4
|
import {
|
|
5
5
|
WithdrawModal
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-2IFX6ZEE.mjs";
|
|
7
|
+
import "./chunk-TDTBAZNO.mjs";
|
|
8
8
|
import "./chunk-CIXHTOO3.mjs";
|
|
9
9
|
export {
|
|
10
10
|
DepositModal,
|
package/dist/withdraw.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var _chunkOFGBTU45cjs = require('./chunk-OFGBTU45.cjs');
|
|
4
|
+
require('./chunk-5SR5N75I.cjs');
|
|
5
5
|
require('./chunk-R6U6BHCV.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
exports.WithdrawModal =
|
|
8
|
+
exports.WithdrawModal = _chunkOFGBTU45cjs.WithdrawModal;
|
package/dist/withdraw.mjs
CHANGED