@rhinestone/deposit-modal 0.1.32 → 0.1.33
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-7ZO7HUN3.mjs} +2 -2
- package/dist/{DepositModalReown-XUAEWIW7.cjs → DepositModalReown-VNKZT5A7.cjs} +5 -5
- package/dist/{WithdrawModalReown-YGGV7BL2.mjs → WithdrawModalReown-PMPLUJBE.mjs} +2 -2
- package/dist/{WithdrawModalReown-53FDOZG2.cjs → WithdrawModalReown-YP4PEERJ.cjs} +5 -5
- package/dist/{chunk-SQDXU7ML.cjs → chunk-4WXSBBHQ.cjs} +29 -55
- package/dist/{chunk-RR25E5DZ.mjs → chunk-ECLVABYN.mjs} +6 -32
- package/dist/{chunk-MKKJ7ZE2.mjs → chunk-HNDZ6G5K.mjs} +57 -81
- package/dist/{chunk-NYEWO4NW.cjs → chunk-SIGTZB3C.cjs} +56 -80
- package/dist/{chunk-K2JJKFTV.mjs → chunk-SJEIKMVO.mjs} +5 -1
- package/dist/{chunk-52FVEYTL.cjs → chunk-V7I5T4SW.cjs} +5 -1
- 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-HNDZ6G5K.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 _chunkSIGTZB3Ccjs = require('./chunk-SIGTZB3C.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
|
+
_chunkSIGTZB3Ccjs.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-ECLVABYN.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 _chunk4WXSBBHQcjs = require('./chunk-4WXSBBHQ.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
|
+
_chunk4WXSBBHQcjs.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
|
|
|
@@ -235,18 +235,6 @@ function WithdrawFormStep({
|
|
|
235
235
|
setIsSubmitting(false);
|
|
236
236
|
}
|
|
237
237
|
}, [recipient, amount, balance, asset.decimals, onSubmit]);
|
|
238
|
-
const handleSwitch = async () => {
|
|
239
|
-
if (!asset.chainId || !switchChain) return;
|
|
240
|
-
setIsSwitching(true);
|
|
241
|
-
try {
|
|
242
|
-
await switchChain(asset.chainId);
|
|
243
|
-
} catch (err) {
|
|
244
|
-
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
245
|
-
setError(_chunkYIHOACM3cjs.formatUserError.call(void 0, raw));
|
|
246
|
-
} finally {
|
|
247
|
-
setIsSwitching(false);
|
|
248
|
-
}
|
|
249
|
-
};
|
|
250
238
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
251
239
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body rs-withdraw-form", children: [
|
|
252
240
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-section", children: [
|
|
@@ -510,23 +498,7 @@ function WithdrawFormStep({
|
|
|
510
498
|
)
|
|
511
499
|
] })
|
|
512
500
|
] }),
|
|
513
|
-
chainMismatch && /* @__PURE__ */ _jsxruntime.
|
|
514
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch-text", children: [
|
|
515
|
-
"Switch to ",
|
|
516
|
-
_chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId),
|
|
517
|
-
" to continue."
|
|
518
|
-
] }),
|
|
519
|
-
switchChain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
520
|
-
_chunkYIHOACM3cjs.Button,
|
|
521
|
-
{
|
|
522
|
-
variant: "outline",
|
|
523
|
-
size: "small",
|
|
524
|
-
loading: isSwitching,
|
|
525
|
-
onClick: handleSwitch,
|
|
526
|
-
children: "Switch"
|
|
527
|
-
}
|
|
528
|
-
)
|
|
529
|
-
] }),
|
|
501
|
+
chainMismatch && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-chain-switch", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-chain-switch-text", children: isSwitching ? `Switching to ${_chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId)}...` : `Switch to ${_chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId)} to continue.` }) }),
|
|
530
502
|
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-error", children: [
|
|
531
503
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
532
504
|
"svg",
|
|
@@ -911,7 +883,7 @@ function WithdrawFlow({
|
|
|
911
883
|
});
|
|
912
884
|
seen.add(dappWalletClient.account.address.toLowerCase());
|
|
913
885
|
}
|
|
914
|
-
if (_optionalChain([reownWallet, 'optionalAccess', _10 => _10.address]) && reownWallet.isConnected && !seen.has(reownWallet.address.toLowerCase())) {
|
|
886
|
+
if (_optionalChain([reownWallet, 'optionalAccess', _10 => _10.address]) && reownWallet.isConnected && reownWallet.walletClient && reownWallet.publicClient && !seen.has(reownWallet.address.toLowerCase())) {
|
|
915
887
|
options.push({
|
|
916
888
|
address: reownWallet.address,
|
|
917
889
|
label: "External Wallet",
|
|
@@ -924,9 +896,11 @@ function WithdrawFlow({
|
|
|
924
896
|
dappWalletClient,
|
|
925
897
|
dappAddress,
|
|
926
898
|
_optionalChain([reownWallet, 'optionalAccess', _11 => _11.address]),
|
|
927
|
-
_optionalChain([reownWallet, 'optionalAccess', _12 => _12.isConnected])
|
|
899
|
+
_optionalChain([reownWallet, 'optionalAccess', _12 => _12.isConnected]),
|
|
900
|
+
_optionalChain([reownWallet, 'optionalAccess', _13 => _13.walletClient]),
|
|
901
|
+
_optionalChain([reownWallet, 'optionalAccess', _14 => _14.publicClient])
|
|
928
902
|
]);
|
|
929
|
-
const canAutoLock = (_optionalChain([dappWalletClient, 'optionalAccess',
|
|
903
|
+
const canAutoLock = (_optionalChain([dappWalletClient, 'optionalAccess', _15 => _15.account]) && dappAddress || hasCustomSigner) && !reownWallet;
|
|
930
904
|
const [selectedConnectAddress, setSelectedConnectAddress] = _react.useState.call(void 0, null);
|
|
931
905
|
const signerContext = _react.useMemo.call(void 0, () => {
|
|
932
906
|
if (canAutoLock) {
|
|
@@ -946,7 +920,7 @@ function WithdrawFlow({
|
|
|
946
920
|
};
|
|
947
921
|
}
|
|
948
922
|
if (!isConnectSelectionConfirmed || !selectedConnectAddress) return null;
|
|
949
|
-
if (_optionalChain([dappWalletClient, 'optionalAccess',
|
|
923
|
+
if (_optionalChain([dappWalletClient, 'optionalAccess', _16 => _16.account]) && dappWalletClient.account.address.toLowerCase() === selectedConnectAddress.toLowerCase()) {
|
|
950
924
|
return {
|
|
951
925
|
ownerAddress: dappWalletClient.account.address,
|
|
952
926
|
walletClient: dappWalletClient,
|
|
@@ -954,7 +928,7 @@ function WithdrawFlow({
|
|
|
954
928
|
switchChain: dappSwitchChain
|
|
955
929
|
};
|
|
956
930
|
}
|
|
957
|
-
if (_optionalChain([reownWallet, 'optionalAccess',
|
|
931
|
+
if (_optionalChain([reownWallet, 'optionalAccess', _17 => _17.address, 'optionalAccess', _18 => _18.toLowerCase, 'call', _19 => _19()]) === selectedConnectAddress.toLowerCase() && reownWallet.walletClient && reownWallet.publicClient) {
|
|
958
932
|
return {
|
|
959
933
|
ownerAddress: reownWallet.address,
|
|
960
934
|
walletClient: reownWallet.walletClient,
|
|
@@ -991,20 +965,20 @@ function WithdrawFlow({
|
|
|
991
965
|
const stepIndex = step.type === "form" ? 0 : 1;
|
|
992
966
|
const currentBackHandler = void 0;
|
|
993
967
|
_react.useEffect.call(void 0, () => {
|
|
994
|
-
_optionalChain([onStepChange, 'optionalCall',
|
|
968
|
+
_optionalChain([onStepChange, 'optionalCall', _20 => _20(stepIndex, currentBackHandler)]);
|
|
995
969
|
}, [stepIndex, currentBackHandler, onStepChange]);
|
|
996
970
|
_react.useEffect.call(void 0, () => {
|
|
997
|
-
_optionalChain([onTotalBalanceChange, 'optionalCall',
|
|
971
|
+
_optionalChain([onTotalBalanceChange, 'optionalCall', _21 => _21(totalBalanceUsd)]);
|
|
998
972
|
}, [totalBalanceUsd, onTotalBalanceChange]);
|
|
999
973
|
const handleConnected = _react.useCallback.call(void 0,
|
|
1000
974
|
(addr, smartAccount) => {
|
|
1001
|
-
_optionalChain([onConnected, 'optionalCall',
|
|
975
|
+
_optionalChain([onConnected, 'optionalCall', _22 => _22({ address: addr, smartAccount })]);
|
|
1002
976
|
},
|
|
1003
977
|
[onConnected]
|
|
1004
978
|
);
|
|
1005
979
|
const handleError = _react.useCallback.call(void 0,
|
|
1006
980
|
(message, code) => {
|
|
1007
|
-
_optionalChain([onError, 'optionalCall',
|
|
981
|
+
_optionalChain([onError, 'optionalCall', _23 => _23({ message, code })]);
|
|
1008
982
|
},
|
|
1009
983
|
[onError]
|
|
1010
984
|
);
|
|
@@ -1025,11 +999,11 @@ function WithdrawFlow({
|
|
|
1025
999
|
}, []);
|
|
1026
1000
|
const handleFormSubmit = _react.useCallback.call(void 0,
|
|
1027
1001
|
async (recipient, amountValue) => {
|
|
1028
|
-
const ownerAddress2 = _optionalChain([signerContext, 'optionalAccess',
|
|
1002
|
+
const ownerAddress2 = _optionalChain([signerContext, 'optionalAccess', _24 => _24.ownerAddress]);
|
|
1029
1003
|
if (!ownerAddress2) {
|
|
1030
1004
|
throw new Error("Wallet not connected");
|
|
1031
1005
|
}
|
|
1032
|
-
if (!onSignTransaction && !_optionalChain([signerContext, 'optionalAccess',
|
|
1006
|
+
if (!onSignTransaction && !_optionalChain([signerContext, 'optionalAccess', _25 => _25.walletClient])) {
|
|
1033
1007
|
throw new Error("Wallet not connected");
|
|
1034
1008
|
}
|
|
1035
1009
|
setIsSubmitting(true);
|
|
@@ -1080,7 +1054,7 @@ function WithdrawFlow({
|
|
|
1080
1054
|
}
|
|
1081
1055
|
handleConnected(ownerAddress2, smartAccount);
|
|
1082
1056
|
const amountUnits = _viem.parseUnits.call(void 0, amountValue, asset.decimals);
|
|
1083
|
-
const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess',
|
|
1057
|
+
const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _26 => _26.publicClient]), () => ( _chunkYIHOACM3cjs.getPublicClient.call(void 0, sourceChain)));
|
|
1084
1058
|
let result;
|
|
1085
1059
|
if (onSignTransaction) {
|
|
1086
1060
|
const transferData = isSourceNative ? { to: smartAccount, value: amountUnits, data: "0x" } : {
|
|
@@ -1132,7 +1106,7 @@ function WithdrawFlow({
|
|
|
1132
1106
|
chainId: sourceChain
|
|
1133
1107
|
});
|
|
1134
1108
|
}
|
|
1135
|
-
_optionalChain([onWithdrawSubmitted, 'optionalCall',
|
|
1109
|
+
_optionalChain([onWithdrawSubmitted, 'optionalCall', _27 => _27({
|
|
1136
1110
|
txHash: result.txHash,
|
|
1137
1111
|
sourceChain,
|
|
1138
1112
|
amount: amountUnits.toString(),
|
|
@@ -1176,13 +1150,13 @@ function WithdrawFlow({
|
|
|
1176
1150
|
);
|
|
1177
1151
|
const handleWithdrawComplete = _react.useCallback.call(void 0,
|
|
1178
1152
|
(txHash, destinationTxHash) => {
|
|
1179
|
-
_optionalChain([onWithdrawComplete, 'optionalCall',
|
|
1153
|
+
_optionalChain([onWithdrawComplete, 'optionalCall', _28 => _28({ txHash, destinationTxHash })]);
|
|
1180
1154
|
},
|
|
1181
1155
|
[onWithdrawComplete]
|
|
1182
1156
|
);
|
|
1183
1157
|
const handleWithdrawFailed = _react.useCallback.call(void 0,
|
|
1184
1158
|
(txHash, error) => {
|
|
1185
|
-
_optionalChain([onWithdrawFailed, 'optionalCall',
|
|
1159
|
+
_optionalChain([onWithdrawFailed, 'optionalCall', _29 => _29({ txHash, error })]);
|
|
1186
1160
|
},
|
|
1187
1161
|
[onWithdrawFailed]
|
|
1188
1162
|
);
|
|
@@ -1266,8 +1240,8 @@ function WithdrawFlow({
|
|
|
1266
1240
|
const selected = walletOptions.find(
|
|
1267
1241
|
(o) => o.address.toLowerCase() === ownerAddress.toLowerCase()
|
|
1268
1242
|
);
|
|
1269
|
-
return _nullishCoalesce(_optionalChain([selected, 'optionalAccess',
|
|
1270
|
-
}, [walletOptions, ownerAddress, _optionalChain([reownWallet, 'optionalAccess',
|
|
1243
|
+
return _nullishCoalesce(_optionalChain([selected, 'optionalAccess', _30 => _30.icon]), () => ( _optionalChain([reownWallet, 'optionalAccess', _31 => _31.icon])));
|
|
1244
|
+
}, [walletOptions, ownerAddress, _optionalChain([reownWallet, 'optionalAccess', _32 => _32.icon])]);
|
|
1271
1245
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
1272
1246
|
step.type === "form" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1273
1247
|
WithdrawFormStep,
|
|
@@ -1318,7 +1292,7 @@ function WithdrawFlow({
|
|
|
1318
1292
|
// src/WithdrawModal.tsx
|
|
1319
1293
|
|
|
1320
1294
|
var ReownWithdrawInner = _react.lazy.call(void 0,
|
|
1321
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-
|
|
1295
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-YP4PEERJ.cjs"))).then((m) => ({
|
|
1322
1296
|
default: m.WithdrawModalReown
|
|
1323
1297
|
}))
|
|
1324
1298
|
);
|
|
@@ -1383,7 +1357,7 @@ function WithdrawModalInner({
|
|
|
1383
1357
|
_react.useEffect.call(void 0, () => {
|
|
1384
1358
|
if (isOpen && !hasCalledReady.current) {
|
|
1385
1359
|
hasCalledReady.current = true;
|
|
1386
|
-
_optionalChain([onReady, 'optionalCall',
|
|
1360
|
+
_optionalChain([onReady, 'optionalCall', _33 => _33()]);
|
|
1387
1361
|
}
|
|
1388
1362
|
}, [isOpen, onReady]);
|
|
1389
1363
|
_react.useEffect.call(void 0, () => {
|
|
@@ -1402,14 +1376,14 @@ function WithdrawModalInner({
|
|
|
1402
1376
|
setTotalBalanceUsd(balance2);
|
|
1403
1377
|
}, []);
|
|
1404
1378
|
const handleBack = _react.useCallback.call(void 0, () => {
|
|
1405
|
-
_optionalChain([backHandlerRef, 'access',
|
|
1379
|
+
_optionalChain([backHandlerRef, 'access', _34 => _34.current, 'optionalCall', _35 => _35()]);
|
|
1406
1380
|
}, []);
|
|
1407
|
-
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
1408
|
-
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
1409
|
-
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
1410
|
-
const balance = _optionalChain([uiConfig, 'optionalAccess',
|
|
1411
|
-
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess',
|
|
1412
|
-
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess',
|
|
1381
|
+
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _36 => _36.showLogo]), () => ( false));
|
|
1382
|
+
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _37 => _37.showStepper]), () => ( false));
|
|
1383
|
+
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _38 => _38.showBackButton]), () => ( true));
|
|
1384
|
+
const balance = _optionalChain([uiConfig, 'optionalAccess', _39 => _39.balance]);
|
|
1385
|
+
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _40 => _40.logoUrl]), () => ( "https://github.com/rhinestonewtf.png"));
|
|
1386
|
+
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _41 => _41.title]), () => ( "Withdraw"));
|
|
1413
1387
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 3 && backHandlerRef.current;
|
|
1414
1388
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1415
1389
|
_chunkYIHOACM3cjs.Modal,
|
|
@@ -235,18 +235,6 @@ function WithdrawFormStep({
|
|
|
235
235
|
setIsSubmitting(false);
|
|
236
236
|
}
|
|
237
237
|
}, [recipient, amount, balance, asset.decimals, onSubmit]);
|
|
238
|
-
const handleSwitch = async () => {
|
|
239
|
-
if (!asset.chainId || !switchChain) return;
|
|
240
|
-
setIsSwitching(true);
|
|
241
|
-
try {
|
|
242
|
-
await switchChain(asset.chainId);
|
|
243
|
-
} catch (err) {
|
|
244
|
-
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
245
|
-
setError(formatUserError(raw));
|
|
246
|
-
} finally {
|
|
247
|
-
setIsSwitching(false);
|
|
248
|
-
}
|
|
249
|
-
};
|
|
250
238
|
return /* @__PURE__ */ jsxs("div", { className: "rs-step", children: [
|
|
251
239
|
/* @__PURE__ */ jsxs("div", { className: "rs-step-body rs-withdraw-form", children: [
|
|
252
240
|
/* @__PURE__ */ jsxs("div", { className: "rs-withdraw-section", children: [
|
|
@@ -510,23 +498,7 @@ function WithdrawFormStep({
|
|
|
510
498
|
)
|
|
511
499
|
] })
|
|
512
500
|
] }),
|
|
513
|
-
chainMismatch && /* @__PURE__ */
|
|
514
|
-
/* @__PURE__ */ jsxs("div", { className: "rs-chain-switch-text", children: [
|
|
515
|
-
"Switch to ",
|
|
516
|
-
getChainName(asset.chainId),
|
|
517
|
-
" to continue."
|
|
518
|
-
] }),
|
|
519
|
-
switchChain && /* @__PURE__ */ jsx(
|
|
520
|
-
Button,
|
|
521
|
-
{
|
|
522
|
-
variant: "outline",
|
|
523
|
-
size: "small",
|
|
524
|
-
loading: isSwitching,
|
|
525
|
-
onClick: handleSwitch,
|
|
526
|
-
children: "Switch"
|
|
527
|
-
}
|
|
528
|
-
)
|
|
529
|
-
] }),
|
|
501
|
+
chainMismatch && /* @__PURE__ */ jsx("div", { className: "rs-chain-switch", children: /* @__PURE__ */ jsx("div", { className: "rs-chain-switch-text", children: isSwitching ? `Switching to ${getChainName(asset.chainId)}...` : `Switch to ${getChainName(asset.chainId)} to continue.` }) }),
|
|
530
502
|
error && /* @__PURE__ */ jsxs("div", { className: "rs-withdraw-error", children: [
|
|
531
503
|
/* @__PURE__ */ jsx(
|
|
532
504
|
"svg",
|
|
@@ -911,7 +883,7 @@ function WithdrawFlow({
|
|
|
911
883
|
});
|
|
912
884
|
seen.add(dappWalletClient.account.address.toLowerCase());
|
|
913
885
|
}
|
|
914
|
-
if (reownWallet?.address && reownWallet.isConnected && !seen.has(reownWallet.address.toLowerCase())) {
|
|
886
|
+
if (reownWallet?.address && reownWallet.isConnected && reownWallet.walletClient && reownWallet.publicClient && !seen.has(reownWallet.address.toLowerCase())) {
|
|
915
887
|
options.push({
|
|
916
888
|
address: reownWallet.address,
|
|
917
889
|
label: "External Wallet",
|
|
@@ -924,7 +896,9 @@ function WithdrawFlow({
|
|
|
924
896
|
dappWalletClient,
|
|
925
897
|
dappAddress,
|
|
926
898
|
reownWallet?.address,
|
|
927
|
-
reownWallet?.isConnected
|
|
899
|
+
reownWallet?.isConnected,
|
|
900
|
+
reownWallet?.walletClient,
|
|
901
|
+
reownWallet?.publicClient
|
|
928
902
|
]);
|
|
929
903
|
const canAutoLock = (dappWalletClient?.account && dappAddress || hasCustomSigner) && !reownWallet;
|
|
930
904
|
const [selectedConnectAddress, setSelectedConnectAddress] = useState2(null);
|
|
@@ -1318,7 +1292,7 @@ function WithdrawFlow({
|
|
|
1318
1292
|
// src/WithdrawModal.tsx
|
|
1319
1293
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1320
1294
|
var ReownWithdrawInner = lazy(
|
|
1321
|
-
() => import("./WithdrawModalReown-
|
|
1295
|
+
() => import("./WithdrawModalReown-PMPLUJBE.mjs").then((m) => ({
|
|
1322
1296
|
default: m.WithdrawModalReown
|
|
1323
1297
|
}))
|
|
1324
1298
|
);
|
|
@@ -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";
|
|
@@ -1916,11 +1891,11 @@ function DepositFlow({
|
|
|
1916
1891
|
() => walletOptions.map((option) => option.address.toLowerCase()).join(","),
|
|
1917
1892
|
[walletOptions]
|
|
1918
1893
|
);
|
|
1919
|
-
const hasNavigatedBackRef =
|
|
1920
|
-
|
|
1894
|
+
const hasNavigatedBackRef = useRef5(false);
|
|
1895
|
+
useEffect7(() => {
|
|
1921
1896
|
setIsConnectSelectionConfirmed(false);
|
|
1922
1897
|
}, [walletOptionsKey]);
|
|
1923
|
-
|
|
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-7ZO7HUN3.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
|
}
|
|
@@ -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(_chunkYIHOACM3cjs.formatUserError.call(void 0, raw));
|
|
591
591
|
}).finally(() => {
|
|
592
592
|
setIsSwitching(false);
|
|
593
593
|
});
|
|
594
594
|
}
|
|
595
595
|
}, [chainMismatch, switchChain, asset.chainId]);
|
|
596
|
+
_react.useEffect.call(void 0, () => {
|
|
597
|
+
hasAttemptedSwitch.current = false;
|
|
598
|
+
}, [asset.chainId]);
|
|
596
599
|
_react.useEffect.call(void 0, () => {
|
|
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, _nullishCoalesce(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__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
704
695
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body", style: { paddingTop: 0 }, children: [
|
|
705
696
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-display", children: [
|
|
@@ -865,14 +856,7 @@ function AmountStep({
|
|
|
865
856
|
}
|
|
866
857
|
)
|
|
867
858
|
] }),
|
|
868
|
-
chainMismatch &&
|
|
869
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch-text", children: [
|
|
870
|
-
"Switch your wallet to ",
|
|
871
|
-
_chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId),
|
|
872
|
-
" to continue."
|
|
873
|
-
] }),
|
|
874
|
-
switchChain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYIHOACM3cjs.Button, { variant: "outline", size: "small", onClick: handleSwitch, children: "Switch" })
|
|
875
|
-
] }),
|
|
859
|
+
chainMismatch && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-chain-switch", style: { marginTop: 16 }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-chain-switch-text", children: isSwitching ? `Switching to ${_chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId)}...` : `Switch your wallet to ${_chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId)} to continue.` }) }),
|
|
876
860
|
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error", children: [
|
|
877
861
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
878
862
|
"svg",
|
|
@@ -932,6 +916,7 @@ function ConfirmStep({
|
|
|
932
916
|
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
933
917
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
934
918
|
const [isSwitching, setIsSwitching] = _react.useState.call(void 0, false);
|
|
919
|
+
const hasAttemptedSwitch = _react.useRef.call(void 0, false);
|
|
935
920
|
const chainMismatch = _optionalChain([walletClient, 'optionalAccess', _13 => _13.chain, 'optionalAccess', _14 => _14.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 : _chunkS4UBVD3Hcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
@@ -947,6 +932,21 @@ function ConfirmStep({
|
|
|
947
932
|
return formattedSendAmount;
|
|
948
933
|
})();
|
|
949
934
|
const receiveAmount = sameRoute ? formattedReceiveAmount : `~ ${formattedReceiveAmount}`;
|
|
935
|
+
_react.useEffect.call(void 0, () => {
|
|
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(_chunkYIHOACM3cjs.formatUserError.call(void 0, raw));
|
|
942
|
+
}).finally(() => {
|
|
943
|
+
setIsSwitching(false);
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
}, [chainMismatch, switchChain, asset.chainId]);
|
|
947
|
+
_react.useEffect.call(void 0, () => {
|
|
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(_chunkYIHOACM3cjs.formatUserError.call(void 0, raw));
|
|
1016
|
-
} finally {
|
|
1017
|
-
setIsSwitching(false);
|
|
1018
|
-
}
|
|
1019
|
-
};
|
|
1020
1008
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
1021
1009
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { padding: "12px 12px 10px" }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-title", children: "Review order" }) }),
|
|
1022
1010
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "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__ */ _jsxruntime.
|
|
1120
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch-text", children: [
|
|
1121
|
-
"Switch your wallet to ",
|
|
1122
|
-
_chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId),
|
|
1123
|
-
" to sign."
|
|
1124
|
-
] }),
|
|
1125
|
-
switchChain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1126
|
-
_chunkYIHOACM3cjs.Button,
|
|
1127
|
-
{
|
|
1128
|
-
variant: "outline",
|
|
1129
|
-
size: "small",
|
|
1130
|
-
loading: isSwitching,
|
|
1131
|
-
onClick: handleSwitch,
|
|
1132
|
-
children: "Switch"
|
|
1133
|
-
}
|
|
1134
|
-
)
|
|
1135
|
-
] }),
|
|
1107
|
+
chainMismatch && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-chain-switch", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-chain-switch-text", children: isSwitching ? `Switching to ${_chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId)}...` : `Switch your wallet to ${_chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId)} to sign.` }) }),
|
|
1136
1108
|
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-alert rs-alert--error", children: [
|
|
1137
1109
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1138
1110
|
"svg",
|
|
@@ -1663,7 +1635,7 @@ function DepositFlow({
|
|
|
1663
1635
|
});
|
|
1664
1636
|
seen.add(dappWalletClient.account.address.toLowerCase());
|
|
1665
1637
|
}
|
|
1666
|
-
if (_optionalChain([reownWallet, 'optionalAccess', _27 => _27.address]) && reownWallet.isConnected && !seen.has(reownWallet.address.toLowerCase())) {
|
|
1638
|
+
if (_optionalChain([reownWallet, 'optionalAccess', _27 => _27.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
|
_optionalChain([reownWallet, 'optionalAccess', _28 => _28.address]),
|
|
1679
1651
|
_optionalChain([reownWallet, 'optionalAccess', _29 => _29.isConnected]),
|
|
1680
|
-
_optionalChain([reownWallet, 'optionalAccess', _30 => _30.
|
|
1652
|
+
_optionalChain([reownWallet, 'optionalAccess', _30 => _30.walletClient]),
|
|
1653
|
+
_optionalChain([reownWallet, 'optionalAccess', _31 => _31.publicClient]),
|
|
1654
|
+
_optionalChain([reownWallet, 'optionalAccess', _32 => _32.icon])
|
|
1681
1655
|
]);
|
|
1682
|
-
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess',
|
|
1656
|
+
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess', _33 => _33.account]) && dappAddress && !reownWallet;
|
|
1683
1657
|
const hasWalletOptions = walletOptions.length > 0;
|
|
1658
|
+
const hasReownSession = Boolean(_optionalChain([reownWallet, 'optionalAccess', _34 => _34.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _35 => _35.address]));
|
|
1684
1659
|
const showConnectStep = !canAutoLock && !isConnectSelectionConfirmed;
|
|
1685
1660
|
const signerContext = _react.useMemo.call(void 0, () => {
|
|
1686
1661
|
if (flowMode === "deposit-address") {
|
|
@@ -1693,7 +1668,7 @@ function DepositFlow({
|
|
|
1693
1668
|
};
|
|
1694
1669
|
}
|
|
1695
1670
|
if (canAutoLock) {
|
|
1696
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
1671
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _36 => _36.chain, 'optionalAccess', _37 => _37.id]), () => ( targetChain));
|
|
1697
1672
|
return {
|
|
1698
1673
|
ownerAddress: dappWalletClient.account.address,
|
|
1699
1674
|
walletClient: dappWalletClient,
|
|
@@ -1702,8 +1677,8 @@ function DepositFlow({
|
|
|
1702
1677
|
};
|
|
1703
1678
|
}
|
|
1704
1679
|
if (!isConnectSelectionConfirmed || !selectedConnectAddress) return null;
|
|
1705
|
-
if (_optionalChain([dappWalletClient, 'optionalAccess',
|
|
1706
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
1680
|
+
if (_optionalChain([dappWalletClient, 'optionalAccess', _38 => _38.account]) && dappWalletClient.account.address.toLowerCase() === selectedConnectAddress.toLowerCase()) {
|
|
1681
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _39 => _39.chain, 'optionalAccess', _40 => _40.id]), () => ( targetChain));
|
|
1707
1682
|
return {
|
|
1708
1683
|
ownerAddress: dappWalletClient.account.address,
|
|
1709
1684
|
walletClient: dappWalletClient,
|
|
@@ -1711,7 +1686,7 @@ function DepositFlow({
|
|
|
1711
1686
|
switchChain: dappSwitchChain
|
|
1712
1687
|
};
|
|
1713
1688
|
}
|
|
1714
|
-
if (_optionalChain([reownWallet, 'optionalAccess',
|
|
1689
|
+
if (_optionalChain([reownWallet, 'optionalAccess', _41 => _41.address, 'optionalAccess', _42 => _42.toLowerCase, 'call', _43 => _43()]) === selectedConnectAddress.toLowerCase() && reownWallet.walletClient && reownWallet.publicClient) {
|
|
1715
1690
|
return {
|
|
1716
1691
|
ownerAddress: reownWallet.address,
|
|
1717
1692
|
walletClient: reownWallet.walletClient,
|
|
@@ -1732,7 +1707,7 @@ function DepositFlow({
|
|
|
1732
1707
|
reownWallet,
|
|
1733
1708
|
targetChain
|
|
1734
1709
|
]);
|
|
1735
|
-
const sessionKeyAddress = _nullishCoalesce(_nullishCoalesce(dappAddress, () => ( _optionalChain([signerContext, 'optionalAccess',
|
|
1710
|
+
const sessionKeyAddress = _nullishCoalesce(_nullishCoalesce(dappAddress, () => ( _optionalChain([signerContext, 'optionalAccess', _44 => _44.ownerAddress]))), () => ( null));
|
|
1736
1711
|
const lastTargetRef = _react.useRef.call(void 0, null);
|
|
1737
1712
|
_react.useEffect.call(void 0, () => {
|
|
1738
1713
|
const prev = lastTargetRef.current;
|
|
@@ -1776,10 +1751,10 @@ function DepositFlow({
|
|
|
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
|
_react.useEffect.call(void 0, () => {
|
|
1779
|
-
_optionalChain([onStepChange, 'optionalCall',
|
|
1754
|
+
_optionalChain([onStepChange, 'optionalCall', _45 => _45(stepIndex, currentBackHandler)]);
|
|
1780
1755
|
}, [stepIndex, currentBackHandler, onStepChange]);
|
|
1781
1756
|
_react.useEffect.call(void 0, () => {
|
|
1782
|
-
_optionalChain([onTotalBalanceChange, 'optionalCall',
|
|
1757
|
+
_optionalChain([onTotalBalanceChange, 'optionalCall', _46 => _46(totalBalanceUsd)]);
|
|
1783
1758
|
}, [totalBalanceUsd, onTotalBalanceChange]);
|
|
1784
1759
|
const isDepositAddressMode = flowMode === "deposit-address";
|
|
1785
1760
|
const handleSelectProvider = _react.useCallback.call(void 0, () => {
|
|
@@ -1817,13 +1792,13 @@ function DepositFlow({
|
|
|
1817
1792
|
directTransfer: isSameRoute(chainId, token, targetChain, targetToken)
|
|
1818
1793
|
};
|
|
1819
1794
|
});
|
|
1820
|
-
_optionalChain([onDepositSubmitted, 'optionalCall',
|
|
1795
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _47 => _47({ txHash, sourceChain: chainId, amount })]);
|
|
1821
1796
|
},
|
|
1822
1797
|
[onDepositSubmitted, targetChain, targetToken]
|
|
1823
1798
|
);
|
|
1824
1799
|
const handleConnected = _react.useCallback.call(void 0,
|
|
1825
1800
|
(addr, smartAccount) => {
|
|
1826
|
-
_optionalChain([onConnected, 'optionalCall',
|
|
1801
|
+
_optionalChain([onConnected, 'optionalCall', _48 => _48({ address: addr, smartAccount })]);
|
|
1827
1802
|
},
|
|
1828
1803
|
[onConnected]
|
|
1829
1804
|
);
|
|
@@ -1880,25 +1855,25 @@ function DepositFlow({
|
|
|
1880
1855
|
);
|
|
1881
1856
|
const handleDepositSubmittedCallback = _react.useCallback.call(void 0,
|
|
1882
1857
|
(txHash, sourceChain, amount) => {
|
|
1883
|
-
_optionalChain([onDepositSubmitted, 'optionalCall',
|
|
1858
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _49 => _49({ txHash, sourceChain, amount })]);
|
|
1884
1859
|
},
|
|
1885
1860
|
[onDepositSubmitted]
|
|
1886
1861
|
);
|
|
1887
1862
|
const handleDepositComplete = _react.useCallback.call(void 0,
|
|
1888
1863
|
(txHash, destinationTxHash) => {
|
|
1889
|
-
_optionalChain([onDepositComplete, 'optionalCall',
|
|
1864
|
+
_optionalChain([onDepositComplete, 'optionalCall', _50 => _50({ txHash, destinationTxHash })]);
|
|
1890
1865
|
},
|
|
1891
1866
|
[onDepositComplete]
|
|
1892
1867
|
);
|
|
1893
1868
|
const handleDepositFailed = _react.useCallback.call(void 0,
|
|
1894
1869
|
(txHash, error) => {
|
|
1895
|
-
_optionalChain([onDepositFailed, 'optionalCall',
|
|
1870
|
+
_optionalChain([onDepositFailed, 'optionalCall', _51 => _51({ txHash, error })]);
|
|
1896
1871
|
},
|
|
1897
1872
|
[onDepositFailed]
|
|
1898
1873
|
);
|
|
1899
1874
|
const handleError = _react.useCallback.call(void 0,
|
|
1900
1875
|
(message, code) => {
|
|
1901
|
-
_optionalChain([onError, 'optionalCall',
|
|
1876
|
+
_optionalChain([onError, 'optionalCall', _52 => _52({ message, code })]);
|
|
1902
1877
|
},
|
|
1903
1878
|
[onError]
|
|
1904
1879
|
);
|
|
@@ -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,
|
|
@@ -2021,13 +1997,13 @@ function DepositFlow({
|
|
|
2021
1997
|
)
|
|
2022
1998
|
] });
|
|
2023
1999
|
}
|
|
2024
|
-
if (!_optionalChain([signerContext, 'optionalAccess',
|
|
2000
|
+
if (!_optionalChain([signerContext, 'optionalAccess', _53 => _53.walletClient]) || !_optionalChain([signerContext, 'optionalAccess', _54 => _54.publicClient])) {
|
|
2025
2001
|
return null;
|
|
2026
2002
|
}
|
|
2027
2003
|
const ownerAddress = signerContext.ownerAddress;
|
|
2028
|
-
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access',
|
|
2004
|
+
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _55 => _55.walletClient, 'optionalAccess', _56 => _56.chain, 'optionalAccess', _57 => _57.id]), () => ( _optionalChain([signerContext, 'access', _58 => _58.publicClient, 'access', _59 => _59.chain, 'optionalAccess', _60 => _60.id]))), () => ( targetChain));
|
|
2029
2005
|
const getReadClientForChain = (chainId) => {
|
|
2030
|
-
if (_optionalChain([signerContext, 'access',
|
|
2006
|
+
if (_optionalChain([signerContext, 'access', _61 => _61.publicClient, 'access', _62 => _62.chain, 'optionalAccess', _63 => _63.id]) === chainId) {
|
|
2031
2007
|
return signerContext.publicClient;
|
|
2032
2008
|
}
|
|
2033
2009
|
return _chunkYIHOACM3cjs.getPublicClient.call(void 0, chainId);
|
|
@@ -2123,7 +2099,7 @@ function DepositFlow({
|
|
|
2123
2099
|
// src/DepositModal.tsx
|
|
2124
2100
|
|
|
2125
2101
|
var ReownDepositInner = _react.lazy.call(void 0,
|
|
2126
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-
|
|
2102
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-VNKZT5A7.cjs"))).then((m) => ({ default: m.DepositModalReown }))
|
|
2127
2103
|
);
|
|
2128
2104
|
function DepositModal(props) {
|
|
2129
2105
|
const needsReown = !!props.reownAppId;
|
|
@@ -2184,7 +2160,7 @@ function DepositModalInner({
|
|
|
2184
2160
|
_react.useEffect.call(void 0, () => {
|
|
2185
2161
|
if (isOpen && !hasCalledReady.current) {
|
|
2186
2162
|
hasCalledReady.current = true;
|
|
2187
|
-
_optionalChain([onReady, 'optionalCall',
|
|
2163
|
+
_optionalChain([onReady, 'optionalCall', _64 => _64()]);
|
|
2188
2164
|
}
|
|
2189
2165
|
}, [isOpen, onReady]);
|
|
2190
2166
|
_react.useEffect.call(void 0, () => {
|
|
@@ -2203,14 +2179,14 @@ function DepositModalInner({
|
|
|
2203
2179
|
setTotalBalanceUsd(balance2);
|
|
2204
2180
|
}, []);
|
|
2205
2181
|
const handleBack = _react.useCallback.call(void 0, () => {
|
|
2206
|
-
_optionalChain([backHandlerRef, 'access',
|
|
2182
|
+
_optionalChain([backHandlerRef, 'access', _65 => _65.current, 'optionalCall', _66 => _66()]);
|
|
2207
2183
|
}, []);
|
|
2208
|
-
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2209
|
-
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2210
|
-
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2211
|
-
const balance = _optionalChain([uiConfig, 'optionalAccess',
|
|
2212
|
-
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess',
|
|
2213
|
-
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess',
|
|
2184
|
+
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _67 => _67.showLogo]), () => ( false));
|
|
2185
|
+
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _68 => _68.showStepper]), () => ( false));
|
|
2186
|
+
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _69 => _69.showBackButton]), () => ( true));
|
|
2187
|
+
const balance = _optionalChain([uiConfig, 'optionalAccess', _70 => _70.balance]);
|
|
2188
|
+
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _71 => _71.logoUrl]), () => ( "https://github.com/rhinestonewtf.png"));
|
|
2189
|
+
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _72 => _72.title]), () => ( "Deposit"));
|
|
2214
2190
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 4 && backHandlerRef.current !== void 0;
|
|
2215
2191
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2216
2192
|
_chunkYIHOACM3cjs.Modal,
|
|
@@ -79,12 +79,16 @@ function useReownWallet() {
|
|
|
79
79
|
isConnected,
|
|
80
80
|
icon: walletInfo?.icon,
|
|
81
81
|
openConnect: () => {
|
|
82
|
-
void open({ view:
|
|
82
|
+
void open({ view: "Connect" });
|
|
83
83
|
},
|
|
84
84
|
disconnect: () => {
|
|
85
85
|
wagmiDisconnect();
|
|
86
86
|
},
|
|
87
87
|
switchChain: async (chainId) => {
|
|
88
|
+
if (walletClient?.switchChain) {
|
|
89
|
+
await walletClient.switchChain({ id: chainId });
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
88
92
|
await switchChainAsync({ chainId });
|
|
89
93
|
}
|
|
90
94
|
};
|
|
@@ -79,12 +79,16 @@ function useReownWallet() {
|
|
|
79
79
|
isConnected,
|
|
80
80
|
icon: _optionalChain([walletInfo, 'optionalAccess', _3 => _3.icon]),
|
|
81
81
|
openConnect: () => {
|
|
82
|
-
void open({ view:
|
|
82
|
+
void open({ view: "Connect" });
|
|
83
83
|
},
|
|
84
84
|
disconnect: () => {
|
|
85
85
|
wagmiDisconnect();
|
|
86
86
|
},
|
|
87
87
|
switchChain: async (chainId) => {
|
|
88
|
+
if (_optionalChain([walletClient, 'optionalAccess', _4 => _4.switchChain])) {
|
|
89
|
+
await walletClient.switchChain({ id: chainId });
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
88
92
|
await switchChainAsync({ chainId });
|
|
89
93
|
}
|
|
90
94
|
};
|
package/dist/deposit.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkSIGTZB3Ccjs = require('./chunk-SIGTZB3C.cjs');
|
|
4
4
|
require('./chunk-YIHOACM3.cjs');
|
|
5
5
|
require('./chunk-S4UBVD3H.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
exports.DepositModal =
|
|
8
|
+
exports.DepositModal = _chunkSIGTZB3Ccjs.DepositModal;
|
package/dist/deposit.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkSIGTZB3Ccjs = require('./chunk-SIGTZB3C.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk4WXSBBHQcjs = require('./chunk-4WXSBBHQ.cjs');
|
|
7
7
|
require('./chunk-YIHOACM3.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
@@ -66,4 +66,4 @@ var _chunkS4UBVD3Hcjs = require('./chunk-S4UBVD3H.cjs');
|
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
exports.CHAIN_BY_ID = _chunkS4UBVD3Hcjs.CHAIN_BY_ID; exports.DEFAULT_BACKEND_URL = _chunkS4UBVD3Hcjs.DEFAULT_BACKEND_URL; exports.DEFAULT_SIGNER_ADDRESS = _chunkS4UBVD3Hcjs.DEFAULT_SIGNER_ADDRESS; exports.DepositModal =
|
|
69
|
+
exports.CHAIN_BY_ID = _chunkS4UBVD3Hcjs.CHAIN_BY_ID; exports.DEFAULT_BACKEND_URL = _chunkS4UBVD3Hcjs.DEFAULT_BACKEND_URL; exports.DEFAULT_SIGNER_ADDRESS = _chunkS4UBVD3Hcjs.DEFAULT_SIGNER_ADDRESS; exports.DepositModal = _chunkSIGTZB3Ccjs.DepositModal; exports.NATIVE_TOKEN_ADDRESS = _chunkS4UBVD3Hcjs.NATIVE_TOKEN_ADDRESS; exports.SOURCE_CHAINS = _chunkS4UBVD3Hcjs.SOURCE_CHAINS; exports.SUPPORTED_CHAINS = _chunkS4UBVD3Hcjs.SUPPORTED_CHAINS; exports.WithdrawModal = _chunk4WXSBBHQcjs.WithdrawModal; exports.chainRegistry = _chunkS4UBVD3Hcjs.chainRegistry; exports.findChainIdForToken = _chunkS4UBVD3Hcjs.findChainIdForToken; exports.getChainBadge = _chunkS4UBVD3Hcjs.getChainBadge; exports.getChainIcon = _chunkS4UBVD3Hcjs.getChainIcon; exports.getChainId = _chunkS4UBVD3Hcjs.getChainId; exports.getChainName = _chunkS4UBVD3Hcjs.getChainName; exports.getChainObject = _chunkS4UBVD3Hcjs.getChainObject; exports.getExplorerName = _chunkS4UBVD3Hcjs.getExplorerName; exports.getExplorerTxUrl = _chunkS4UBVD3Hcjs.getExplorerTxUrl; exports.getExplorerUrl = _chunkS4UBVD3Hcjs.getExplorerUrl; exports.getSupportedChainIds = _chunkS4UBVD3Hcjs.getSupportedChainIds; exports.getSupportedTargetTokens = _chunkS4UBVD3Hcjs.getSupportedTargetTokens; exports.getSupportedTokenSymbolsForChain = _chunkS4UBVD3Hcjs.getSupportedTokenSymbolsForChain; exports.getTargetTokenSymbolsForChain = _chunkS4UBVD3Hcjs.getTargetTokenSymbolsForChain; exports.getTokenAddress = _chunkS4UBVD3Hcjs.getTokenAddress; exports.getTokenDecimals = _chunkS4UBVD3Hcjs.getTokenDecimals; exports.getTokenDecimalsByAddress = _chunkS4UBVD3Hcjs.getTokenDecimalsByAddress; exports.getTokenIcon = _chunkS4UBVD3Hcjs.getTokenIcon; exports.getTokenSymbol = _chunkS4UBVD3Hcjs.getTokenSymbol; exports.getUsdcAddress = _chunkS4UBVD3Hcjs.getUsdcAddress; exports.getUsdcDecimals = _chunkS4UBVD3Hcjs.getUsdcDecimals; exports.isSupportedTokenAddressForChain = _chunkS4UBVD3Hcjs.isSupportedTokenAddressForChain;
|
package/dist/index.mjs
CHANGED
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 _chunkSIGTZB3Ccjs = require('./chunk-SIGTZB3C.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk4WXSBBHQcjs = require('./chunk-4WXSBBHQ.cjs');
|
|
7
7
|
require('./chunk-YIHOACM3.cjs');
|
|
8
8
|
require('./chunk-S4UBVD3H.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.DepositModal =
|
|
12
|
+
exports.DepositModal = _chunkSIGTZB3Ccjs.DepositModal; exports.WithdrawModal = _chunk4WXSBBHQcjs.WithdrawModal;
|
package/dist/reown.mjs
CHANGED
package/dist/withdraw.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk4WXSBBHQcjs = require('./chunk-4WXSBBHQ.cjs');
|
|
4
4
|
require('./chunk-YIHOACM3.cjs');
|
|
5
5
|
require('./chunk-S4UBVD3H.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
exports.WithdrawModal =
|
|
8
|
+
exports.WithdrawModal = _chunk4WXSBBHQcjs.WithdrawModal;
|
package/dist/withdraw.mjs
CHANGED