@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
|
@@ -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 = hasCustomSigner || Boolean(_optionalChain([dappWalletClient, 'optionalAccess', _15 => _15.account]) && dappAddress) && !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
|
);
|
|
@@ -1230,14 +1204,21 @@ function WithdrawFlow({
|
|
|
1230
1204
|
}
|
|
1231
1205
|
return null;
|
|
1232
1206
|
}, [selectedConnectAddress, walletOptions]);
|
|
1233
|
-
const walletOptionsKey = _react.useMemo.call(void 0,
|
|
1234
|
-
() => walletOptions.map((option) => option.address.toLowerCase()).join(","),
|
|
1235
|
-
[walletOptions]
|
|
1236
|
-
);
|
|
1237
1207
|
const showConnectStep = !canAutoLock && !isConnectSelectionConfirmed;
|
|
1238
1208
|
_react.useEffect.call(void 0, () => {
|
|
1239
|
-
|
|
1240
|
-
|
|
1209
|
+
if (!showConnectStep && isConnectSelectionConfirmed && !signerContext) {
|
|
1210
|
+
setSelectedConnectAddress(null);
|
|
1211
|
+
setIsConnectSelectionConfirmed(false);
|
|
1212
|
+
}
|
|
1213
|
+
}, [showConnectStep, isConnectSelectionConfirmed, signerContext]);
|
|
1214
|
+
const ownerAddress = _optionalChain([signerContext, 'optionalAccess', _30 => _30.ownerAddress]);
|
|
1215
|
+
const selectedWalletIcon = _react.useMemo.call(void 0, () => {
|
|
1216
|
+
if (!ownerAddress) return _optionalChain([reownWallet, 'optionalAccess', _31 => _31.icon]);
|
|
1217
|
+
const selected = walletOptions.find(
|
|
1218
|
+
(o) => o.address.toLowerCase() === ownerAddress.toLowerCase()
|
|
1219
|
+
);
|
|
1220
|
+
return _nullishCoalesce(_optionalChain([selected, 'optionalAccess', _32 => _32.icon]), () => ( _optionalChain([reownWallet, 'optionalAccess', _33 => _33.icon])));
|
|
1221
|
+
}, [walletOptions, ownerAddress, _optionalChain([reownWallet, 'optionalAccess', _34 => _34.icon])]);
|
|
1241
1222
|
if (showConnectStep) {
|
|
1242
1223
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1243
1224
|
_chunkYIHOACM3cjs.ConnectStep,
|
|
@@ -1260,24 +1241,18 @@ function WithdrawFlow({
|
|
|
1260
1241
|
}
|
|
1261
1242
|
if (!signerContext) return null;
|
|
1262
1243
|
if (!onSignTransaction && !signerContext.walletClient) return null;
|
|
1263
|
-
const
|
|
1244
|
+
const resolvedOwnerAddress = signerContext.ownerAddress;
|
|
1264
1245
|
const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => ( _chunkYIHOACM3cjs.getPublicClient.call(void 0, sourceChain)));
|
|
1265
|
-
const selectedWalletIcon = _react.useMemo.call(void 0, () => {
|
|
1266
|
-
const selected = walletOptions.find(
|
|
1267
|
-
(o) => o.address.toLowerCase() === ownerAddress.toLowerCase()
|
|
1268
|
-
);
|
|
1269
|
-
return _nullishCoalesce(_optionalChain([selected, 'optionalAccess', _28 => _28.icon]), () => ( _optionalChain([reownWallet, 'optionalAccess', _29 => _29.icon])));
|
|
1270
|
-
}, [walletOptions, ownerAddress, _optionalChain([reownWallet, 'optionalAccess', _30 => _30.icon])]);
|
|
1271
1246
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
1272
1247
|
step.type === "form" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1273
1248
|
WithdrawFormStep,
|
|
1274
1249
|
{
|
|
1275
1250
|
walletClient: signerContext.walletClient,
|
|
1276
1251
|
publicClient: formPublicClient,
|
|
1277
|
-
address:
|
|
1252
|
+
address: resolvedOwnerAddress,
|
|
1278
1253
|
safeAddress,
|
|
1279
1254
|
asset,
|
|
1280
|
-
defaultRecipient: _nullishCoalesce(defaultRecipient, () => (
|
|
1255
|
+
defaultRecipient: _nullishCoalesce(defaultRecipient, () => ( resolvedOwnerAddress)),
|
|
1281
1256
|
defaultAmount,
|
|
1282
1257
|
targetChain,
|
|
1283
1258
|
targetToken,
|
|
@@ -1318,7 +1293,7 @@ function WithdrawFlow({
|
|
|
1318
1293
|
// src/WithdrawModal.tsx
|
|
1319
1294
|
|
|
1320
1295
|
var ReownWithdrawInner = _react.lazy.call(void 0,
|
|
1321
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-
|
|
1296
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-HTPBAGPM.cjs"))).then((m) => ({
|
|
1322
1297
|
default: m.WithdrawModalReown
|
|
1323
1298
|
}))
|
|
1324
1299
|
);
|
|
@@ -1383,7 +1358,7 @@ function WithdrawModalInner({
|
|
|
1383
1358
|
_react.useEffect.call(void 0, () => {
|
|
1384
1359
|
if (isOpen && !hasCalledReady.current) {
|
|
1385
1360
|
hasCalledReady.current = true;
|
|
1386
|
-
_optionalChain([onReady, 'optionalCall',
|
|
1361
|
+
_optionalChain([onReady, 'optionalCall', _35 => _35()]);
|
|
1387
1362
|
}
|
|
1388
1363
|
}, [isOpen, onReady]);
|
|
1389
1364
|
_react.useEffect.call(void 0, () => {
|
|
@@ -1402,14 +1377,14 @@ function WithdrawModalInner({
|
|
|
1402
1377
|
setTotalBalanceUsd(balance2);
|
|
1403
1378
|
}, []);
|
|
1404
1379
|
const handleBack = _react.useCallback.call(void 0, () => {
|
|
1405
|
-
_optionalChain([backHandlerRef, 'access',
|
|
1380
|
+
_optionalChain([backHandlerRef, 'access', _36 => _36.current, 'optionalCall', _37 => _37()]);
|
|
1406
1381
|
}, []);
|
|
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',
|
|
1382
|
+
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _38 => _38.showLogo]), () => ( false));
|
|
1383
|
+
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _39 => _39.showStepper]), () => ( false));
|
|
1384
|
+
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _40 => _40.showBackButton]), () => ( true));
|
|
1385
|
+
const balance = _optionalChain([uiConfig, 'optionalAccess', _41 => _41.balance]);
|
|
1386
|
+
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _42 => _42.logoUrl]), () => ( "https://github.com/rhinestonewtf.png"));
|
|
1387
|
+
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _43 => _43.title]), () => ( "Withdraw"));
|
|
1413
1388
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 3 && backHandlerRef.current;
|
|
1414
1389
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1415
1390
|
_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,9 +896,11 @@ 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
|
-
const canAutoLock = (dappWalletClient?.account && dappAddress
|
|
903
|
+
const canAutoLock = hasCustomSigner || Boolean(dappWalletClient?.account && dappAddress) && !reownWallet;
|
|
930
904
|
const [selectedConnectAddress, setSelectedConnectAddress] = useState2(null);
|
|
931
905
|
const signerContext = useMemo2(() => {
|
|
932
906
|
if (canAutoLock) {
|
|
@@ -1230,14 +1204,21 @@ function WithdrawFlow({
|
|
|
1230
1204
|
}
|
|
1231
1205
|
return null;
|
|
1232
1206
|
}, [selectedConnectAddress, walletOptions]);
|
|
1233
|
-
const walletOptionsKey = useMemo2(
|
|
1234
|
-
() => walletOptions.map((option) => option.address.toLowerCase()).join(","),
|
|
1235
|
-
[walletOptions]
|
|
1236
|
-
);
|
|
1237
1207
|
const showConnectStep = !canAutoLock && !isConnectSelectionConfirmed;
|
|
1238
1208
|
useEffect2(() => {
|
|
1239
|
-
|
|
1240
|
-
|
|
1209
|
+
if (!showConnectStep && isConnectSelectionConfirmed && !signerContext) {
|
|
1210
|
+
setSelectedConnectAddress(null);
|
|
1211
|
+
setIsConnectSelectionConfirmed(false);
|
|
1212
|
+
}
|
|
1213
|
+
}, [showConnectStep, isConnectSelectionConfirmed, signerContext]);
|
|
1214
|
+
const ownerAddress = signerContext?.ownerAddress;
|
|
1215
|
+
const selectedWalletIcon = useMemo2(() => {
|
|
1216
|
+
if (!ownerAddress) return reownWallet?.icon;
|
|
1217
|
+
const selected = walletOptions.find(
|
|
1218
|
+
(o) => o.address.toLowerCase() === ownerAddress.toLowerCase()
|
|
1219
|
+
);
|
|
1220
|
+
return selected?.icon ?? reownWallet?.icon;
|
|
1221
|
+
}, [walletOptions, ownerAddress, reownWallet?.icon]);
|
|
1241
1222
|
if (showConnectStep) {
|
|
1242
1223
|
return /* @__PURE__ */ jsx2("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx2(
|
|
1243
1224
|
ConnectStep,
|
|
@@ -1260,24 +1241,18 @@ function WithdrawFlow({
|
|
|
1260
1241
|
}
|
|
1261
1242
|
if (!signerContext) return null;
|
|
1262
1243
|
if (!onSignTransaction && !signerContext.walletClient) return null;
|
|
1263
|
-
const
|
|
1244
|
+
const resolvedOwnerAddress = signerContext.ownerAddress;
|
|
1264
1245
|
const formPublicClient = signerContext.publicClient ?? getPublicClient(sourceChain);
|
|
1265
|
-
const selectedWalletIcon = useMemo2(() => {
|
|
1266
|
-
const selected = walletOptions.find(
|
|
1267
|
-
(o) => o.address.toLowerCase() === ownerAddress.toLowerCase()
|
|
1268
|
-
);
|
|
1269
|
-
return selected?.icon ?? reownWallet?.icon;
|
|
1270
|
-
}, [walletOptions, ownerAddress, reownWallet?.icon]);
|
|
1271
1246
|
return /* @__PURE__ */ jsxs2("div", { className: "rs-modal-body", children: [
|
|
1272
1247
|
step.type === "form" && /* @__PURE__ */ jsx2(
|
|
1273
1248
|
WithdrawFormStep,
|
|
1274
1249
|
{
|
|
1275
1250
|
walletClient: signerContext.walletClient,
|
|
1276
1251
|
publicClient: formPublicClient,
|
|
1277
|
-
address:
|
|
1252
|
+
address: resolvedOwnerAddress,
|
|
1278
1253
|
safeAddress,
|
|
1279
1254
|
asset,
|
|
1280
|
-
defaultRecipient: defaultRecipient ??
|
|
1255
|
+
defaultRecipient: defaultRecipient ?? resolvedOwnerAddress,
|
|
1281
1256
|
defaultAmount,
|
|
1282
1257
|
targetChain,
|
|
1283
1258
|
targetToken,
|
|
@@ -1318,7 +1293,7 @@ function WithdrawFlow({
|
|
|
1318
1293
|
// src/WithdrawModal.tsx
|
|
1319
1294
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1320
1295
|
var ReownWithdrawInner = lazy(
|
|
1321
|
-
() => import("./WithdrawModalReown-
|
|
1296
|
+
() => import("./WithdrawModalReown-E3OEW7QZ.mjs").then((m) => ({
|
|
1322
1297
|
default: m.WithdrawModalReown
|
|
1323
1298
|
}))
|
|
1324
1299
|
);
|
|
@@ -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
|
};
|