@rhinestone/deposit-modal 0.1.32 → 0.1.34
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-SZPCCNPH.mjs → DepositModalReown-25YB4LPZ.mjs} +2 -2
- package/dist/{DepositModalReown-XUAEWIW7.cjs → DepositModalReown-TLKQ7Y4X.cjs} +5 -5
- package/dist/{WithdrawModalReown-YGGV7BL2.mjs → WithdrawModalReown-E3OEW7QZ.mjs} +2 -2
- package/dist/{WithdrawModalReown-53FDOZG2.cjs → WithdrawModalReown-HTPBAGPM.cjs} +5 -5
- package/dist/{chunk-MKKJ7ZE2.mjs → chunk-DL5M5QZZ.mjs} +63 -87
- package/dist/{chunk-SQDXU7ML.cjs → chunk-DQO6MO27.cjs} +43 -68
- package/dist/{chunk-RR25E5DZ.mjs → chunk-EIWNQ2MO.mjs} +23 -48
- package/dist/{chunk-K2JJKFTV.mjs → chunk-SJEIKMVO.mjs} +5 -1
- package/dist/{chunk-52FVEYTL.cjs → chunk-V7I5T4SW.cjs} +5 -1
- package/dist/{chunk-NYEWO4NW.cjs → chunk-YCXVHPGZ.cjs} +62 -86
- package/dist/deposit.cjs +2 -2
- package/dist/deposit.mjs +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +2 -2
- package/dist/reown.cjs +3 -3
- package/dist/reown.mjs +2 -2
- package/dist/withdraw.cjs +2 -2
- package/dist/withdraw.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DepositModalInner
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DL5M5QZZ.mjs";
|
|
4
4
|
import {
|
|
5
5
|
ReownWalletProvider,
|
|
6
6
|
useReownWallet
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-SJEIKMVO.mjs";
|
|
8
8
|
import "./chunk-DLFUXLAM.mjs";
|
|
9
9
|
import "./chunk-C6I5TFSL.mjs";
|
|
10
10
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkYCXVHPGZcjs = require('./chunk-YCXVHPGZ.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkV7I5T4SWcjs = require('./chunk-V7I5T4SW.cjs');
|
|
8
8
|
require('./chunk-YIHOACM3.cjs');
|
|
9
9
|
require('./chunk-S4UBVD3H.cjs');
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ require('./chunk-S4UBVD3H.cjs');
|
|
|
12
12
|
var _react = require('react');
|
|
13
13
|
var _jsxruntime = require('react/jsx-runtime');
|
|
14
14
|
function DepositModalWithReown(props) {
|
|
15
|
-
const reown =
|
|
15
|
+
const reown = _chunkV7I5T4SWcjs.useReownWallet.call(void 0, );
|
|
16
16
|
const handleConnect = _react.useCallback.call(void 0, () => {
|
|
17
17
|
reown.openConnect();
|
|
18
18
|
}, [reown.openConnect]);
|
|
@@ -20,7 +20,7 @@ function DepositModalWithReown(props) {
|
|
|
20
20
|
reown.disconnect();
|
|
21
21
|
}, [reown.disconnect]);
|
|
22
22
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
23
|
-
|
|
23
|
+
_chunkYCXVHPGZcjs.DepositModalInner,
|
|
24
24
|
{
|
|
25
25
|
...props,
|
|
26
26
|
reownWallet: reown,
|
|
@@ -30,7 +30,7 @@ function DepositModalWithReown(props) {
|
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
function DepositModalReown(props) {
|
|
33
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
33
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV7I5T4SWcjs.ReownWalletProvider, { projectId: props.reownAppId, theme: props.theme, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DepositModalWithReown, { ...props }) });
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WithdrawModalInner
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EIWNQ2MO.mjs";
|
|
4
4
|
import {
|
|
5
5
|
ReownWalletProvider,
|
|
6
6
|
useReownWallet
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-SJEIKMVO.mjs";
|
|
8
8
|
import "./chunk-DLFUXLAM.mjs";
|
|
9
9
|
import "./chunk-C6I5TFSL.mjs";
|
|
10
10
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkDQO6MO27cjs = require('./chunk-DQO6MO27.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkV7I5T4SWcjs = require('./chunk-V7I5T4SW.cjs');
|
|
8
8
|
require('./chunk-YIHOACM3.cjs');
|
|
9
9
|
require('./chunk-S4UBVD3H.cjs');
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ require('./chunk-S4UBVD3H.cjs');
|
|
|
12
12
|
var _react = require('react');
|
|
13
13
|
var _jsxruntime = require('react/jsx-runtime');
|
|
14
14
|
function WithdrawModalWithReown(props) {
|
|
15
|
-
const reown =
|
|
15
|
+
const reown = _chunkV7I5T4SWcjs.useReownWallet.call(void 0, );
|
|
16
16
|
const handleConnect = _react.useCallback.call(void 0, () => {
|
|
17
17
|
reown.openConnect();
|
|
18
18
|
}, [reown.openConnect]);
|
|
@@ -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
|
-
|
|
23
|
+
_chunkDQO6MO27cjs.WithdrawModalInner,
|
|
24
24
|
{
|
|
25
25
|
...props,
|
|
26
26
|
reownWallet: reown,
|
|
@@ -30,7 +30,7 @@ function WithdrawModalWithReown(props) {
|
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
function WithdrawModalReown(props) {
|
|
33
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
33
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkV7I5T4SWcjs.ReownWalletProvider, { projectId: props.reownAppId, theme: props.theme, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WithdrawModalWithReown, { ...props }) });
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
|
|
@@ -42,8 +42,8 @@ import {
|
|
|
42
42
|
// src/DepositModal.tsx
|
|
43
43
|
import {
|
|
44
44
|
useMemo as useMemo6,
|
|
45
|
-
useEffect as
|
|
46
|
-
useRef as
|
|
45
|
+
useEffect as useEffect8,
|
|
46
|
+
useRef as useRef6,
|
|
47
47
|
useState as useState8,
|
|
48
48
|
useCallback as useCallback4,
|
|
49
49
|
lazy,
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
} from "react";
|
|
52
52
|
|
|
53
53
|
// src/DepositFlow.tsx
|
|
54
|
-
import { useState as useState7, useCallback as useCallback3, useMemo as useMemo5, useEffect as
|
|
54
|
+
import { useState as useState7, useCallback as useCallback3, useMemo as useMemo5, useEffect as useEffect7, useRef as useRef5 } from "react";
|
|
55
55
|
|
|
56
56
|
// src/components/steps/SetupStep.tsx
|
|
57
57
|
import { useState, useEffect, useRef, useCallback } from "react";
|
|
@@ -510,7 +510,7 @@ function mergeAssets(existing, incoming) {
|
|
|
510
510
|
}
|
|
511
511
|
|
|
512
512
|
// src/components/steps/AmountStep.tsx
|
|
513
|
-
import { useEffect as useEffect3, useMemo as useMemo2,
|
|
513
|
+
import { useEffect as useEffect3, useMemo as useMemo2, useRef as useRef2, useState as useState3 } from "react";
|
|
514
514
|
import { erc20Abi, formatUnits as formatUnits2, parseUnits } from "viem";
|
|
515
515
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
516
516
|
function AmountStep({
|
|
@@ -586,13 +586,16 @@ function AmountStep({
|
|
|
586
586
|
hasAttemptedSwitch.current = true;
|
|
587
587
|
setIsSwitching(true);
|
|
588
588
|
switchChain(asset.chainId).catch((err) => {
|
|
589
|
-
const
|
|
590
|
-
setError(
|
|
589
|
+
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
590
|
+
setError(formatUserError(raw));
|
|
591
591
|
}).finally(() => {
|
|
592
592
|
setIsSwitching(false);
|
|
593
593
|
});
|
|
594
594
|
}
|
|
595
595
|
}, [chainMismatch, switchChain, asset.chainId]);
|
|
596
|
+
useEffect3(() => {
|
|
597
|
+
hasAttemptedSwitch.current = false;
|
|
598
|
+
}, [asset.chainId]);
|
|
596
599
|
useEffect3(() => {
|
|
597
600
|
if (defaultAmount && !amount) {
|
|
598
601
|
const parsed = Number(defaultAmount);
|
|
@@ -688,18 +691,6 @@ function AmountStep({
|
|
|
688
691
|
setError(null);
|
|
689
692
|
onContinue(tokenAmountStr, amount, balance ?? void 0);
|
|
690
693
|
};
|
|
691
|
-
const handleSwitch = async () => {
|
|
692
|
-
if (!asset.chainId || !switchChain) return;
|
|
693
|
-
setIsSwitching(true);
|
|
694
|
-
try {
|
|
695
|
-
await switchChain(asset.chainId);
|
|
696
|
-
} catch (err) {
|
|
697
|
-
const message = err instanceof Error ? err.message : "Failed to switch chain";
|
|
698
|
-
setError(message);
|
|
699
|
-
} finally {
|
|
700
|
-
setIsSwitching(false);
|
|
701
|
-
}
|
|
702
|
-
};
|
|
703
694
|
return /* @__PURE__ */ jsxs3("div", { className: "rs-step", children: [
|
|
704
695
|
/* @__PURE__ */ jsxs3("div", { className: "rs-step-body", style: { paddingTop: 0 }, children: [
|
|
705
696
|
/* @__PURE__ */ jsxs3("div", { className: "rs-amount-display", children: [
|
|
@@ -865,14 +856,7 @@ function AmountStep({
|
|
|
865
856
|
}
|
|
866
857
|
)
|
|
867
858
|
] }),
|
|
868
|
-
chainMismatch &&
|
|
869
|
-
/* @__PURE__ */ jsxs3("div", { className: "rs-chain-switch-text", children: [
|
|
870
|
-
"Switch your wallet to ",
|
|
871
|
-
getChainName(asset.chainId),
|
|
872
|
-
" to continue."
|
|
873
|
-
] }),
|
|
874
|
-
switchChain && /* @__PURE__ */ jsx3(Button, { variant: "outline", size: "small", onClick: handleSwitch, children: "Switch" })
|
|
875
|
-
] }),
|
|
859
|
+
chainMismatch && /* @__PURE__ */ jsx3("div", { className: "rs-chain-switch", style: { marginTop: 16 }, children: /* @__PURE__ */ jsx3("div", { className: "rs-chain-switch-text", children: isSwitching ? `Switching to ${getChainName(asset.chainId)}...` : `Switch your wallet to ${getChainName(asset.chainId)} to continue.` }) }),
|
|
876
860
|
error && /* @__PURE__ */ jsxs3("div", { className: "rs-amount-error", children: [
|
|
877
861
|
/* @__PURE__ */ jsx3(
|
|
878
862
|
"svg",
|
|
@@ -909,7 +893,7 @@ function AmountStep({
|
|
|
909
893
|
}
|
|
910
894
|
|
|
911
895
|
// src/components/steps/ConfirmStep.tsx
|
|
912
|
-
import { useState as useState4 } from "react";
|
|
896
|
+
import { useEffect as useEffect4, useRef as useRef3, useState as useState4 } from "react";
|
|
913
897
|
import { erc20Abi as erc20Abi2, parseUnits as parseUnits2 } from "viem";
|
|
914
898
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
915
899
|
function ConfirmStep({
|
|
@@ -932,6 +916,7 @@ function ConfirmStep({
|
|
|
932
916
|
const [isSubmitting, setIsSubmitting] = useState4(false);
|
|
933
917
|
const [error, setError] = useState4(null);
|
|
934
918
|
const [isSwitching, setIsSwitching] = useState4(false);
|
|
919
|
+
const hasAttemptedSwitch = useRef3(false);
|
|
935
920
|
const chainMismatch = walletClient?.chain?.id && walletClient.chain.id !== asset.chainId;
|
|
936
921
|
const sameRoute = targetChain === asset.chainId && targetToken.toLowerCase() === asset.token.toLowerCase();
|
|
937
922
|
const targetSymbol = sameRoute ? asset.symbol : getTokenSymbol(targetToken, targetChain);
|
|
@@ -947,6 +932,21 @@ function ConfirmStep({
|
|
|
947
932
|
return formattedSendAmount;
|
|
948
933
|
})();
|
|
949
934
|
const receiveAmount = sameRoute ? formattedReceiveAmount : `~ ${formattedReceiveAmount}`;
|
|
935
|
+
useEffect4(() => {
|
|
936
|
+
if (chainMismatch && switchChain && !hasAttemptedSwitch.current) {
|
|
937
|
+
hasAttemptedSwitch.current = true;
|
|
938
|
+
setIsSwitching(true);
|
|
939
|
+
switchChain(asset.chainId).catch((err) => {
|
|
940
|
+
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
941
|
+
setError(formatUserError(raw));
|
|
942
|
+
}).finally(() => {
|
|
943
|
+
setIsSwitching(false);
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
}, [chainMismatch, switchChain, asset.chainId]);
|
|
947
|
+
useEffect4(() => {
|
|
948
|
+
hasAttemptedSwitch.current = false;
|
|
949
|
+
}, [asset.chainId]);
|
|
950
950
|
const handleConfirm = async () => {
|
|
951
951
|
if (!address || !walletClient) {
|
|
952
952
|
setError("Wallet not connected");
|
|
@@ -1005,18 +1005,6 @@ function ConfirmStep({
|
|
|
1005
1005
|
setIsSubmitting(false);
|
|
1006
1006
|
}
|
|
1007
1007
|
};
|
|
1008
|
-
const handleSwitch = async () => {
|
|
1009
|
-
if (!switchChain) return;
|
|
1010
|
-
setIsSwitching(true);
|
|
1011
|
-
try {
|
|
1012
|
-
await switchChain(asset.chainId);
|
|
1013
|
-
} catch (err) {
|
|
1014
|
-
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
1015
|
-
setError(formatUserError(raw));
|
|
1016
|
-
} finally {
|
|
1017
|
-
setIsSwitching(false);
|
|
1018
|
-
}
|
|
1019
|
-
};
|
|
1020
1008
|
return /* @__PURE__ */ jsxs4("div", { className: "rs-step", children: [
|
|
1021
1009
|
/* @__PURE__ */ jsx4("div", { style: { padding: "12px 12px 10px" }, children: /* @__PURE__ */ jsx4("div", { className: "rs-step-title", children: "Review order" }) }),
|
|
1022
1010
|
/* @__PURE__ */ jsxs4("div", { className: "rs-step-body rs-space-y-3", style: { paddingTop: 0 }, children: [
|
|
@@ -1116,23 +1104,7 @@ function ConfirmStep({
|
|
|
1116
1104
|
)
|
|
1117
1105
|
] })
|
|
1118
1106
|
] }),
|
|
1119
|
-
chainMismatch && /* @__PURE__ */
|
|
1120
|
-
/* @__PURE__ */ jsxs4("div", { className: "rs-chain-switch-text", children: [
|
|
1121
|
-
"Switch your wallet to ",
|
|
1122
|
-
getChainName(asset.chainId),
|
|
1123
|
-
" to sign."
|
|
1124
|
-
] }),
|
|
1125
|
-
switchChain && /* @__PURE__ */ jsx4(
|
|
1126
|
-
Button,
|
|
1127
|
-
{
|
|
1128
|
-
variant: "outline",
|
|
1129
|
-
size: "small",
|
|
1130
|
-
loading: isSwitching,
|
|
1131
|
-
onClick: handleSwitch,
|
|
1132
|
-
children: "Switch"
|
|
1133
|
-
}
|
|
1134
|
-
)
|
|
1135
|
-
] }),
|
|
1107
|
+
chainMismatch && /* @__PURE__ */ jsx4("div", { className: "rs-chain-switch", children: /* @__PURE__ */ jsx4("div", { className: "rs-chain-switch-text", children: isSwitching ? `Switching to ${getChainName(asset.chainId)}...` : `Switch your wallet to ${getChainName(asset.chainId)} to sign.` }) }),
|
|
1136
1108
|
error && /* @__PURE__ */ jsxs4("div", { className: "rs-alert rs-alert--error", children: [
|
|
1137
1109
|
/* @__PURE__ */ jsx4(
|
|
1138
1110
|
"svg",
|
|
@@ -1170,14 +1142,14 @@ function ConfirmStep({
|
|
|
1170
1142
|
}
|
|
1171
1143
|
|
|
1172
1144
|
// src/components/steps/DepositAddressStep.tsx
|
|
1173
|
-
import { useState as useState6, useEffect as
|
|
1145
|
+
import { useState as useState6, useEffect as useEffect6, useCallback as useCallback2, useRef as useRef4, useMemo as useMemo4 } from "react";
|
|
1174
1146
|
|
|
1175
1147
|
// src/components/ui/QRCode.tsx
|
|
1176
|
-
import { useEffect as
|
|
1148
|
+
import { useEffect as useEffect5, useMemo as useMemo3, useState as useState5 } from "react";
|
|
1177
1149
|
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1178
1150
|
function QRCode({ value, size = 200, iconSrc, className }) {
|
|
1179
1151
|
const [createQrCode, setCreateQrCode] = useState5(null);
|
|
1180
|
-
|
|
1152
|
+
useEffect5(() => {
|
|
1181
1153
|
let mounted = true;
|
|
1182
1154
|
void import("qrcode-generator").then((mod) => {
|
|
1183
1155
|
if (mounted) {
|
|
@@ -1320,7 +1292,7 @@ function DepositAddressStep({
|
|
|
1320
1292
|
);
|
|
1321
1293
|
const defaultToken = tokensForChain.includes("USDC") ? "USDC" : tokensForChain[0] ?? "USDC";
|
|
1322
1294
|
const [sourceTokenSymbol, setSourceTokenSymbol] = useState6(defaultToken);
|
|
1323
|
-
|
|
1295
|
+
useEffect6(() => {
|
|
1324
1296
|
if (!tokensForChain.includes(sourceTokenSymbol)) {
|
|
1325
1297
|
setSourceTokenSymbol(tokensForChain[0] ?? "USDC");
|
|
1326
1298
|
}
|
|
@@ -1329,12 +1301,12 @@ function DepositAddressStep({
|
|
|
1329
1301
|
const [pollingError, setPollingError] = useState6(null);
|
|
1330
1302
|
const [chainDropdownOpen, setChainDropdownOpen] = useState6(false);
|
|
1331
1303
|
const [tokenDropdownOpen, setTokenDropdownOpen] = useState6(false);
|
|
1332
|
-
const depositHandledRef =
|
|
1333
|
-
const sourceSelectionRef =
|
|
1304
|
+
const depositHandledRef = useRef4(false);
|
|
1305
|
+
const sourceSelectionRef = useRef4({
|
|
1334
1306
|
chainId: defaultChainId,
|
|
1335
1307
|
tokenSymbol: defaultToken
|
|
1336
1308
|
});
|
|
1337
|
-
|
|
1309
|
+
useEffect6(() => {
|
|
1338
1310
|
sourceSelectionRef.current = {
|
|
1339
1311
|
chainId: sourceChainId,
|
|
1340
1312
|
tokenSymbol: sourceTokenSymbol
|
|
@@ -1358,7 +1330,7 @@ function DepositAddressStep({
|
|
|
1358
1330
|
setTimeout(() => setCopied(false), 2e3);
|
|
1359
1331
|
}
|
|
1360
1332
|
}, [smartAccount]);
|
|
1361
|
-
|
|
1333
|
+
useEffect6(() => {
|
|
1362
1334
|
depositHandledRef.current = false;
|
|
1363
1335
|
setPollingError(null);
|
|
1364
1336
|
let timeoutId;
|
|
@@ -1629,7 +1601,7 @@ function DepositFlow({
|
|
|
1629
1601
|
const [totalBalanceUsd, setTotalBalanceUsd] = useState7(0);
|
|
1630
1602
|
const [isConnectSelectionConfirmed, setIsConnectSelectionConfirmed] = useState7(false);
|
|
1631
1603
|
const [selectedConnectAddress, setSelectedConnectAddress] = useState7(null);
|
|
1632
|
-
const portfolioAssetsRef =
|
|
1604
|
+
const portfolioAssetsRef = useRef5([]);
|
|
1633
1605
|
const handleAssetsLoaded = useCallback3((assets) => {
|
|
1634
1606
|
portfolioAssetsRef.current = assets;
|
|
1635
1607
|
}, []);
|
|
@@ -1663,7 +1635,7 @@ function DepositFlow({
|
|
|
1663
1635
|
});
|
|
1664
1636
|
seen.add(dappWalletClient.account.address.toLowerCase());
|
|
1665
1637
|
}
|
|
1666
|
-
if (reownWallet?.address && reownWallet.isConnected && !seen.has(reownWallet.address.toLowerCase())) {
|
|
1638
|
+
if (reownWallet?.address && reownWallet.isConnected && reownWallet.walletClient && reownWallet.publicClient && !seen.has(reownWallet.address.toLowerCase())) {
|
|
1667
1639
|
options.push({
|
|
1668
1640
|
address: reownWallet.address,
|
|
1669
1641
|
label: "External Wallet",
|
|
@@ -1677,10 +1649,13 @@ function DepositFlow({
|
|
|
1677
1649
|
dappAddress,
|
|
1678
1650
|
reownWallet?.address,
|
|
1679
1651
|
reownWallet?.isConnected,
|
|
1652
|
+
reownWallet?.walletClient,
|
|
1653
|
+
reownWallet?.publicClient,
|
|
1680
1654
|
reownWallet?.icon
|
|
1681
1655
|
]);
|
|
1682
1656
|
const canAutoLock = dappWalletClient?.account && dappAddress && !reownWallet;
|
|
1683
1657
|
const hasWalletOptions = walletOptions.length > 0;
|
|
1658
|
+
const hasReownSession = Boolean(reownWallet?.isConnected || reownWallet?.address);
|
|
1684
1659
|
const showConnectStep = !canAutoLock && !isConnectSelectionConfirmed;
|
|
1685
1660
|
const signerContext = useMemo5(() => {
|
|
1686
1661
|
if (flowMode === "deposit-address") {
|
|
@@ -1733,8 +1708,8 @@ function DepositFlow({
|
|
|
1733
1708
|
targetChain
|
|
1734
1709
|
]);
|
|
1735
1710
|
const sessionKeyAddress = dappAddress ?? signerContext?.ownerAddress ?? null;
|
|
1736
|
-
const lastTargetRef =
|
|
1737
|
-
|
|
1711
|
+
const lastTargetRef = useRef5(null);
|
|
1712
|
+
useEffect7(() => {
|
|
1738
1713
|
const prev = lastTargetRef.current;
|
|
1739
1714
|
if (prev && (prev.chain !== targetChain || prev.token.toLowerCase() !== targetToken.toLowerCase())) {
|
|
1740
1715
|
if (step.type !== "processing") {
|
|
@@ -1775,10 +1750,10 @@ function DepositFlow({
|
|
|
1775
1750
|
}, []);
|
|
1776
1751
|
const stepIndex = step.type === "setup" ? 0 : step.type === "deposit-address" ? 1 : step.type === "select-asset" ? 1 : step.type === "amount" ? 2 : step.type === "confirm" ? 3 : 4;
|
|
1777
1752
|
const currentBackHandler = step.type === "deposit-address" ? handleBackFromDepositAddress : step.type === "select-asset" && signerContext && !canAutoLock ? handleBackFromSelectAsset : step.type === "amount" ? handleBackFromAmount : step.type === "confirm" ? handleBackFromConfirm : void 0;
|
|
1778
|
-
|
|
1753
|
+
useEffect7(() => {
|
|
1779
1754
|
onStepChange?.(stepIndex, currentBackHandler);
|
|
1780
1755
|
}, [stepIndex, currentBackHandler, onStepChange]);
|
|
1781
|
-
|
|
1756
|
+
useEffect7(() => {
|
|
1782
1757
|
onTotalBalanceChange?.(totalBalanceUsd);
|
|
1783
1758
|
}, [totalBalanceUsd, onTotalBalanceChange]);
|
|
1784
1759
|
const isDepositAddressMode = flowMode === "deposit-address";
|
|
@@ -1912,15 +1887,15 @@ function DepositFlow({
|
|
|
1912
1887
|
}
|
|
1913
1888
|
return null;
|
|
1914
1889
|
}, [selectedConnectAddress, walletOptions]);
|
|
1915
|
-
const
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
}, [
|
|
1923
|
-
|
|
1890
|
+
const hasNavigatedBackRef = useRef5(false);
|
|
1891
|
+
useEffect7(() => {
|
|
1892
|
+
if (!showConnectStep && isConnectSelectionConfirmed && flowMode === "wallet" && !signerContext) {
|
|
1893
|
+
setSelectedConnectAddress(null);
|
|
1894
|
+
setIsConnectSelectionConfirmed(false);
|
|
1895
|
+
setFlowMode(null);
|
|
1896
|
+
}
|
|
1897
|
+
}, [showConnectStep, isConnectSelectionConfirmed, flowMode, signerContext]);
|
|
1898
|
+
useEffect7(() => {
|
|
1924
1899
|
if (hasNavigatedBackRef.current || isConnectSelectionConfirmed || flowMode) {
|
|
1925
1900
|
return;
|
|
1926
1901
|
}
|
|
@@ -1933,12 +1908,13 @@ function DepositFlow({
|
|
|
1933
1908
|
return;
|
|
1934
1909
|
}
|
|
1935
1910
|
}
|
|
1936
|
-
if (!hasWalletOptions && dappAddress) {
|
|
1911
|
+
if (!hasWalletOptions && dappAddress && !hasReownSession) {
|
|
1937
1912
|
handleSelectTransferCrypto();
|
|
1938
1913
|
setIsConnectSelectionConfirmed(true);
|
|
1939
1914
|
}
|
|
1940
1915
|
}, [
|
|
1941
1916
|
hasWalletOptions,
|
|
1917
|
+
hasReownSession,
|
|
1942
1918
|
isConnectSelectionConfirmed,
|
|
1943
1919
|
flowMode,
|
|
1944
1920
|
selectedConnectAddressEffective,
|
|
@@ -2123,7 +2099,7 @@ function DepositFlow({
|
|
|
2123
2099
|
// src/DepositModal.tsx
|
|
2124
2100
|
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2125
2101
|
var ReownDepositInner = lazy(
|
|
2126
|
-
() => import("./DepositModalReown-
|
|
2102
|
+
() => import("./DepositModalReown-25YB4LPZ.mjs").then((m) => ({ default: m.DepositModalReown }))
|
|
2127
2103
|
);
|
|
2128
2104
|
function DepositModal(props) {
|
|
2129
2105
|
const needsReown = !!props.reownAppId;
|
|
@@ -2168,26 +2144,26 @@ function DepositModalInner({
|
|
|
2168
2144
|
onError,
|
|
2169
2145
|
debug
|
|
2170
2146
|
}) {
|
|
2171
|
-
const modalRef =
|
|
2147
|
+
const modalRef = useRef6(null);
|
|
2172
2148
|
const [currentStepIndex, setCurrentStepIndex] = useState8(0);
|
|
2173
2149
|
const [totalBalanceUsd, setTotalBalanceUsd] = useState8(null);
|
|
2174
|
-
const backHandlerRef =
|
|
2150
|
+
const backHandlerRef = useRef6(void 0);
|
|
2175
2151
|
const targetChain = getChainId(targetChainProp);
|
|
2176
2152
|
const sourceChain = sourceChainProp ? getChainId(sourceChainProp) : void 0;
|
|
2177
2153
|
const service = useMemo6(() => createDepositService(backendUrl), [backendUrl]);
|
|
2178
|
-
|
|
2154
|
+
useEffect8(() => {
|
|
2179
2155
|
if (isOpen && modalRef.current) {
|
|
2180
2156
|
applyTheme(modalRef.current, theme);
|
|
2181
2157
|
}
|
|
2182
2158
|
}, [isOpen, theme]);
|
|
2183
|
-
const hasCalledReady =
|
|
2184
|
-
|
|
2159
|
+
const hasCalledReady = useRef6(false);
|
|
2160
|
+
useEffect8(() => {
|
|
2185
2161
|
if (isOpen && !hasCalledReady.current) {
|
|
2186
2162
|
hasCalledReady.current = true;
|
|
2187
2163
|
onReady?.();
|
|
2188
2164
|
}
|
|
2189
2165
|
}, [isOpen, onReady]);
|
|
2190
|
-
|
|
2166
|
+
useEffect8(() => {
|
|
2191
2167
|
if (!isOpen) {
|
|
2192
2168
|
setCurrentStepIndex(0);
|
|
2193
2169
|
}
|