@rhinestone/deposit-modal 0.1.37 → 0.1.39
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-72SF66F7.cjs → DepositModalReown-UMUTS37L.cjs} +4 -4
- package/dist/{DepositModalReown-BVOV57WT.mjs → DepositModalReown-YTUE3XAB.mjs} +3 -3
- package/dist/{WithdrawModalReown-P3XFNMCB.cjs → WithdrawModalReown-2CWNDVJD.cjs} +4 -4
- package/dist/{WithdrawModalReown-UWTDJXSE.mjs → WithdrawModalReown-XXCOZYVU.mjs} +3 -3
- package/dist/{chunk-YIHOACM3.cjs → chunk-AHOFT42H.cjs} +106 -54
- package/dist/{chunk-MKOZFFFJ.mjs → chunk-CFLZYWX7.mjs} +3 -3
- package/dist/{chunk-S4UBVD3H.cjs → chunk-FLXTBFMZ.cjs} +47 -10
- package/dist/{chunk-C6I5TFSL.mjs → chunk-I7RYTI4G.mjs} +48 -11
- package/dist/{chunk-DLFUXLAM.mjs → chunk-IC2M2DZ7.mjs} +65 -13
- package/dist/{chunk-SFYMDLKJ.cjs → chunk-K7BHCDJQ.cjs} +55 -55
- package/dist/{chunk-MMVDUFJD.mjs → chunk-TK7BVWX6.mjs} +79 -59
- package/dist/{chunk-FQIIKMDJ.cjs → chunk-VTTEVMB6.cjs} +211 -191
- package/dist/constants.cjs +2 -2
- package/dist/constants.mjs +1 -1
- package/dist/deposit.cjs +4 -4
- package/dist/deposit.mjs +3 -3
- package/dist/index.cjs +5 -5
- package/dist/index.mjs +4 -4
- package/dist/reown.cjs +5 -5
- package/dist/reown.mjs +4 -4
- package/dist/withdraw.cjs +4 -4
- package/dist/withdraw.mjs +3 -3
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _chunkAHOFT42Hcjs = require('./chunk-AHOFT42H.cjs');
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
@@ -30,7 +30,7 @@ var _chunkYIHOACM3cjs = require('./chunk-YIHOACM3.cjs');
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
var
|
|
33
|
+
var _chunkFLXTBFMZcjs = require('./chunk-FLXTBFMZ.cjs');
|
|
34
34
|
|
|
35
35
|
// src/WithdrawModal.tsx
|
|
36
36
|
|
|
@@ -118,8 +118,8 @@ function WithdrawFormStep({
|
|
|
118
118
|
const chainMismatch = Boolean(
|
|
119
119
|
_optionalChain([walletClient, 'optionalAccess', _3 => _3.chain, 'optionalAccess', _4 => _4.id]) && walletClient.chain.id !== asset.chainId
|
|
120
120
|
);
|
|
121
|
-
const targetSymbol =
|
|
122
|
-
const targetChainName =
|
|
121
|
+
const targetSymbol = _chunkFLXTBFMZcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
122
|
+
const targetChainName = _chunkFLXTBFMZcjs.getChainName.call(void 0, targetChain);
|
|
123
123
|
const isBusy = submitting || isSubmitting;
|
|
124
124
|
const seededRecipientRef = _react.useRef.call(void 0, seededRecipient);
|
|
125
125
|
_react.useEffect.call(void 0, () => {
|
|
@@ -138,7 +138,7 @@ function WithdrawFormStep({
|
|
|
138
138
|
setIsSwitching(true);
|
|
139
139
|
switchChain(asset.chainId).catch((err) => {
|
|
140
140
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
141
|
-
setError(
|
|
141
|
+
setError(_chunkAHOFT42Hcjs.formatUserError.call(void 0, raw));
|
|
142
142
|
}).finally(() => {
|
|
143
143
|
setIsSwitching(false);
|
|
144
144
|
});
|
|
@@ -158,7 +158,7 @@ function WithdrawFormStep({
|
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
160
|
try {
|
|
161
|
-
const bal =
|
|
161
|
+
const bal = _chunkAHOFT42Hcjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: safeAddress }) : await publicClient.readContract({
|
|
162
162
|
address: asset.token,
|
|
163
163
|
abi: _viem.erc20Abi,
|
|
164
164
|
functionName: "balanceOf",
|
|
@@ -261,7 +261,7 @@ function WithdrawFormStep({
|
|
|
261
261
|
await onSubmit(recipient, amount);
|
|
262
262
|
} catch (err) {
|
|
263
263
|
const raw = err instanceof Error ? err.message : "Withdrawal failed";
|
|
264
|
-
setError(
|
|
264
|
+
setError(_chunkAHOFT42Hcjs.formatUserError.call(void 0, raw));
|
|
265
265
|
} finally {
|
|
266
266
|
setIsSubmitting(false);
|
|
267
267
|
}
|
|
@@ -269,11 +269,11 @@ function WithdrawFormStep({
|
|
|
269
269
|
if (isBalanceLoading) {
|
|
270
270
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
271
271
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body rs-withdraw-loading", children: [
|
|
272
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
272
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkAHOFT42Hcjs.Spinner, { className: "rs-spinner--lg" }),
|
|
273
273
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-loading-title", children: "Loading on-chain balance" }),
|
|
274
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-loading-subtitle", children: chainMismatch ? `Switch to ${
|
|
274
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-loading-subtitle", children: chainMismatch ? `Switch to ${_chunkFLXTBFMZcjs.getChainName.call(void 0, asset.chainId)} to continue.` : "Please wait before withdrawing." })
|
|
275
275
|
] }),
|
|
276
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
276
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkAHOFT42Hcjs.PoweredBy, {})
|
|
277
277
|
] });
|
|
278
278
|
}
|
|
279
279
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
@@ -369,7 +369,7 @@ function WithdrawFormStep({
|
|
|
369
369
|
] })
|
|
370
370
|
] }),
|
|
371
371
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-amount-info", children: [
|
|
372
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ?
|
|
372
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ? _chunkAHOFT42Hcjs.currencyFormatter.format(amountUsd) : "$0.00" }),
|
|
373
373
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-withdraw-balance", children: [
|
|
374
374
|
formattedBalance,
|
|
375
375
|
" ",
|
|
@@ -397,10 +397,10 @@ function WithdrawFormStep({
|
|
|
397
397
|
},
|
|
398
398
|
children: [
|
|
399
399
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-dropdown-value", children: [
|
|
400
|
-
|
|
400
|
+
_chunkFLXTBFMZcjs.getTokenIcon.call(void 0, targetSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
401
401
|
"img",
|
|
402
402
|
{
|
|
403
|
-
src:
|
|
403
|
+
src: _chunkFLXTBFMZcjs.getTokenIcon.call(void 0, targetSymbol),
|
|
404
404
|
alt: targetSymbol,
|
|
405
405
|
className: "rs-withdraw-dropdown-icon"
|
|
406
406
|
}
|
|
@@ -441,10 +441,10 @@ function WithdrawFormStep({
|
|
|
441
441
|
setShowTokenDropdown(false);
|
|
442
442
|
},
|
|
443
443
|
children: [
|
|
444
|
-
|
|
444
|
+
_chunkFLXTBFMZcjs.getTokenIcon.call(void 0, option.symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
445
445
|
"img",
|
|
446
446
|
{
|
|
447
|
-
src:
|
|
447
|
+
src: _chunkFLXTBFMZcjs.getTokenIcon.call(void 0, option.symbol),
|
|
448
448
|
alt: option.symbol,
|
|
449
449
|
className: "rs-withdraw-dropdown-icon"
|
|
450
450
|
}
|
|
@@ -477,10 +477,10 @@ function WithdrawFormStep({
|
|
|
477
477
|
},
|
|
478
478
|
children: [
|
|
479
479
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-dropdown-value", children: [
|
|
480
|
-
|
|
480
|
+
_chunkFLXTBFMZcjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
481
481
|
"img",
|
|
482
482
|
{
|
|
483
|
-
src:
|
|
483
|
+
src: _chunkFLXTBFMZcjs.getChainIcon.call(void 0, targetChain),
|
|
484
484
|
alt: targetChainName,
|
|
485
485
|
className: "rs-withdraw-dropdown-icon"
|
|
486
486
|
}
|
|
@@ -521,10 +521,10 @@ function WithdrawFormStep({
|
|
|
521
521
|
setShowChainDropdown(false);
|
|
522
522
|
},
|
|
523
523
|
children: [
|
|
524
|
-
|
|
524
|
+
_chunkFLXTBFMZcjs.getChainIcon.call(void 0, chain.id) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
525
525
|
"img",
|
|
526
526
|
{
|
|
527
|
-
src:
|
|
527
|
+
src: _chunkFLXTBFMZcjs.getChainIcon.call(void 0, chain.id),
|
|
528
528
|
alt: chain.name,
|
|
529
529
|
className: "rs-withdraw-dropdown-icon"
|
|
530
530
|
}
|
|
@@ -539,7 +539,7 @@ function WithdrawFormStep({
|
|
|
539
539
|
)
|
|
540
540
|
] })
|
|
541
541
|
] }),
|
|
542
|
-
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 ${
|
|
542
|
+
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 ${_chunkFLXTBFMZcjs.getChainName.call(void 0, asset.chainId)}...` : `Switch to ${_chunkFLXTBFMZcjs.getChainName.call(void 0, asset.chainId)} to continue.` }) }),
|
|
543
543
|
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-error", children: [
|
|
544
544
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
545
545
|
"svg",
|
|
@@ -562,7 +562,7 @@ function WithdrawFormStep({
|
|
|
562
562
|
] })
|
|
563
563
|
] }),
|
|
564
564
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
565
|
-
|
|
565
|
+
_chunkAHOFT42Hcjs.Button,
|
|
566
566
|
{
|
|
567
567
|
onClick: handleWithdraw,
|
|
568
568
|
fullWidth: true,
|
|
@@ -571,7 +571,7 @@ function WithdrawFormStep({
|
|
|
571
571
|
children: isBusy ? "Preparing..." : "Withdraw"
|
|
572
572
|
}
|
|
573
573
|
) }),
|
|
574
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
574
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkAHOFT42Hcjs.PoweredBy, {})
|
|
575
575
|
] });
|
|
576
576
|
}
|
|
577
577
|
WithdrawFormStep.displayName = "WithdrawFormStep";
|
|
@@ -654,7 +654,7 @@ async function executeSafeEthTransfer(params) {
|
|
|
654
654
|
throw new Error("Wallet not connected");
|
|
655
655
|
}
|
|
656
656
|
if (chain.id !== chainId) {
|
|
657
|
-
throw new Error(`Switch to ${
|
|
657
|
+
throw new Error(`Switch to ${_chunkFLXTBFMZcjs.getChainName.call(void 0, chainId)} to sign`);
|
|
658
658
|
}
|
|
659
659
|
const isOwner = await publicClient.readContract({
|
|
660
660
|
address: safeAddress,
|
|
@@ -737,7 +737,7 @@ async function executeSafeErc20Transfer(params) {
|
|
|
737
737
|
throw new Error("Wallet not connected");
|
|
738
738
|
}
|
|
739
739
|
if (chain.id !== chainId) {
|
|
740
|
-
throw new Error(`Switch to ${
|
|
740
|
+
throw new Error(`Switch to ${_chunkFLXTBFMZcjs.getChainName.call(void 0, chainId)} to sign`);
|
|
741
741
|
}
|
|
742
742
|
const isOwner = await publicClient.readContract({
|
|
743
743
|
address: safeAddress,
|
|
@@ -876,7 +876,7 @@ function WithdrawFlow({
|
|
|
876
876
|
recipient: defaultRecipient,
|
|
877
877
|
amount: defaultAmount,
|
|
878
878
|
service,
|
|
879
|
-
signerAddress =
|
|
879
|
+
signerAddress = _chunkFLXTBFMZcjs.DEFAULT_SIGNER_ADDRESS,
|
|
880
880
|
sessionChainIds,
|
|
881
881
|
forceRegister = false,
|
|
882
882
|
waitForFinalTx = true,
|
|
@@ -949,14 +949,14 @@ function WithdrawFlow({
|
|
|
949
949
|
return {
|
|
950
950
|
ownerAddress: dappAddress,
|
|
951
951
|
walletClient: _nullishCoalesce(dappWalletClient, () => ( void 0)),
|
|
952
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
952
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkAHOFT42Hcjs.getPublicClient.call(void 0, sourceChain))),
|
|
953
953
|
switchChain: dappSwitchChain
|
|
954
954
|
};
|
|
955
955
|
}
|
|
956
956
|
return {
|
|
957
957
|
ownerAddress: dappWalletClient.account.address,
|
|
958
958
|
walletClient: dappWalletClient,
|
|
959
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
959
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkAHOFT42Hcjs.getPublicClient.call(void 0, sourceChain))),
|
|
960
960
|
switchChain: dappSwitchChain
|
|
961
961
|
};
|
|
962
962
|
}
|
|
@@ -965,7 +965,7 @@ function WithdrawFlow({
|
|
|
965
965
|
return {
|
|
966
966
|
ownerAddress: dappWalletClient.account.address,
|
|
967
967
|
walletClient: dappWalletClient,
|
|
968
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
968
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkAHOFT42Hcjs.getPublicClient.call(void 0, sourceChain))),
|
|
969
969
|
switchChain: dappSwitchChain
|
|
970
970
|
};
|
|
971
971
|
}
|
|
@@ -991,10 +991,10 @@ function WithdrawFlow({
|
|
|
991
991
|
sourceChain
|
|
992
992
|
]);
|
|
993
993
|
const asset = _react.useMemo.call(void 0, () => {
|
|
994
|
-
const symbol =
|
|
995
|
-
const decimals =
|
|
994
|
+
const symbol = _chunkFLXTBFMZcjs.getTokenSymbol.call(void 0, sourceToken, sourceChain);
|
|
995
|
+
const decimals = _chunkFLXTBFMZcjs.getTokenDecimalsByAddress.call(void 0, sourceToken, sourceChain);
|
|
996
996
|
return {
|
|
997
|
-
id:
|
|
997
|
+
id: _chunkAHOFT42Hcjs.getAssetId.call(void 0, { chainId: sourceChain, token: sourceToken }),
|
|
998
998
|
chainId: sourceChain,
|
|
999
999
|
token: sourceToken,
|
|
1000
1000
|
symbol,
|
|
@@ -1002,7 +1002,7 @@ function WithdrawFlow({
|
|
|
1002
1002
|
decimals
|
|
1003
1003
|
};
|
|
1004
1004
|
}, [sourceChain, sourceToken]);
|
|
1005
|
-
const isSourceNative = sourceToken.toLowerCase() ===
|
|
1005
|
+
const isSourceNative = sourceToken.toLowerCase() === _chunkFLXTBFMZcjs.NATIVE_TOKEN_ADDRESS.toLowerCase();
|
|
1006
1006
|
const stepIndex = step.type === "form" ? 0 : 1;
|
|
1007
1007
|
const currentBackHandler = void 0;
|
|
1008
1008
|
_react.useEffect.call(void 0, () => {
|
|
@@ -1024,15 +1024,15 @@ function WithdrawFlow({
|
|
|
1024
1024
|
[onError]
|
|
1025
1025
|
);
|
|
1026
1026
|
const resolveSessionOwner = _react.useCallback.call(void 0, async (eoaAddress) => {
|
|
1027
|
-
const localOwner =
|
|
1027
|
+
const localOwner = _chunkAHOFT42Hcjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
|
|
1028
1028
|
if (localOwner) {
|
|
1029
1029
|
return {
|
|
1030
|
-
account:
|
|
1030
|
+
account: _chunkAHOFT42Hcjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
|
|
1031
1031
|
address: localOwner.address
|
|
1032
1032
|
};
|
|
1033
1033
|
}
|
|
1034
|
-
const created =
|
|
1035
|
-
|
|
1034
|
+
const created = _chunkAHOFT42Hcjs.createSessionOwnerKey.call(void 0, );
|
|
1035
|
+
_chunkAHOFT42Hcjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
|
|
1036
1036
|
return {
|
|
1037
1037
|
account: created.account,
|
|
1038
1038
|
address: created.address
|
|
@@ -1076,7 +1076,7 @@ function WithdrawFlow({
|
|
|
1076
1076
|
primaryType: typedData.primaryType,
|
|
1077
1077
|
message: typedData.message
|
|
1078
1078
|
});
|
|
1079
|
-
const sessionDetails =
|
|
1079
|
+
const sessionDetails = _chunkAHOFT42Hcjs.buildSessionDetails.call(void 0,
|
|
1080
1080
|
setup.sessionDetailsUnsigned,
|
|
1081
1081
|
signature
|
|
1082
1082
|
);
|
|
@@ -1098,7 +1098,7 @@ function WithdrawFlow({
|
|
|
1098
1098
|
}
|
|
1099
1099
|
handleConnected(ownerAddress2, smartAccount);
|
|
1100
1100
|
const amountUnits = _viem.parseUnits.call(void 0, amountValue, asset.decimals);
|
|
1101
|
-
const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _26 => _26.publicClient]), () => (
|
|
1101
|
+
const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _26 => _26.publicClient]), () => ( _chunkAHOFT42Hcjs.getPublicClient.call(void 0, sourceChain)));
|
|
1102
1102
|
let result;
|
|
1103
1103
|
if (onSignTransaction) {
|
|
1104
1104
|
const transferData = isSourceNative ? { to: smartAccount, value: amountUnits, data: "0x" } : {
|
|
@@ -1166,7 +1166,7 @@ function WithdrawFlow({
|
|
|
1166
1166
|
});
|
|
1167
1167
|
} catch (err) {
|
|
1168
1168
|
const raw = err instanceof Error ? err.message : "Withdraw failed";
|
|
1169
|
-
handleError(
|
|
1169
|
+
handleError(_chunkAHOFT42Hcjs.formatUserError.call(void 0, raw), "WITHDRAW_FLOW_ERROR");
|
|
1170
1170
|
throw err;
|
|
1171
1171
|
} finally {
|
|
1172
1172
|
setIsSubmitting(false);
|
|
@@ -1205,12 +1205,12 @@ function WithdrawFlow({
|
|
|
1205
1205
|
[onWithdrawFailed]
|
|
1206
1206
|
);
|
|
1207
1207
|
const targetChainOptions = _react.useMemo.call(void 0, () => {
|
|
1208
|
-
return
|
|
1209
|
-
(chain) =>
|
|
1208
|
+
return _chunkFLXTBFMZcjs.SOURCE_CHAINS.filter(
|
|
1209
|
+
(chain) => _chunkFLXTBFMZcjs.getSupportedTargetTokens.call(void 0, chain.id).length > 0
|
|
1210
1210
|
);
|
|
1211
1211
|
}, []);
|
|
1212
1212
|
const targetTokenOptions = _react.useMemo.call(void 0,
|
|
1213
|
-
() =>
|
|
1213
|
+
() => _chunkFLXTBFMZcjs.getSupportedTargetTokens.call(void 0, targetChain),
|
|
1214
1214
|
[targetChain]
|
|
1215
1215
|
);
|
|
1216
1216
|
_react.useEffect.call(void 0, () => {
|
|
@@ -1225,7 +1225,7 @@ function WithdrawFlow({
|
|
|
1225
1225
|
const handleTargetChainChange = _react.useCallback.call(void 0,
|
|
1226
1226
|
(chainId) => {
|
|
1227
1227
|
setTargetChain(chainId);
|
|
1228
|
-
const options =
|
|
1228
|
+
const options = _chunkFLXTBFMZcjs.getSupportedTargetTokens.call(void 0, chainId);
|
|
1229
1229
|
if (options.length === 0) {
|
|
1230
1230
|
return;
|
|
1231
1231
|
}
|
|
@@ -1265,7 +1265,7 @@ function WithdrawFlow({
|
|
|
1265
1265
|
}, [walletOptions, ownerAddress, _optionalChain([reownWallet, 'optionalAccess', _34 => _34.icon])]);
|
|
1266
1266
|
if (showConnectStep) {
|
|
1267
1267
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1268
|
-
|
|
1268
|
+
_chunkAHOFT42Hcjs.ConnectStep,
|
|
1269
1269
|
{
|
|
1270
1270
|
walletOptions,
|
|
1271
1271
|
selectedAddress: selectedConnectAddressEffective,
|
|
@@ -1288,7 +1288,7 @@ function WithdrawFlow({
|
|
|
1288
1288
|
const resolvedOwnerAddress = signerContext.ownerAddress;
|
|
1289
1289
|
const resolvedConnectedAddress = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _35 => _35.walletClient, 'optionalAccess', _36 => _36.account, 'optionalAccess', _37 => _37.address]), () => ( _optionalChain([reownWallet, 'optionalAccess', _38 => _38.address]))), () => ( _optionalChain([dappWalletClient, 'optionalAccess', _39 => _39.account, 'optionalAccess', _40 => _40.address]))), () => ( resolvedOwnerAddress));
|
|
1290
1290
|
const resolvedDefaultRecipient = _nullishCoalesce(defaultRecipient, () => ( resolvedConnectedAddress));
|
|
1291
|
-
const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => (
|
|
1291
|
+
const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => ( _chunkAHOFT42Hcjs.getPublicClient.call(void 0, sourceChain)));
|
|
1292
1292
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
1293
1293
|
step.type === "form" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1294
1294
|
WithdrawFormStep,
|
|
@@ -1315,7 +1315,7 @@ function WithdrawFlow({
|
|
|
1315
1315
|
}
|
|
1316
1316
|
),
|
|
1317
1317
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1318
|
-
|
|
1318
|
+
_chunkAHOFT42Hcjs.ProcessingStep,
|
|
1319
1319
|
{
|
|
1320
1320
|
smartAccount: step.smartAccount,
|
|
1321
1321
|
txHash: step.txHash,
|
|
@@ -1340,7 +1340,7 @@ function WithdrawFlow({
|
|
|
1340
1340
|
// src/WithdrawModal.tsx
|
|
1341
1341
|
|
|
1342
1342
|
var ReownWithdrawInner = _react.lazy.call(void 0,
|
|
1343
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-
|
|
1343
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-2CWNDVJD.cjs"))).then((m) => ({
|
|
1344
1344
|
default: m.WithdrawModalReown
|
|
1345
1345
|
}))
|
|
1346
1346
|
);
|
|
@@ -1366,8 +1366,8 @@ function WithdrawModalInner({
|
|
|
1366
1366
|
isOpen,
|
|
1367
1367
|
onClose,
|
|
1368
1368
|
inline,
|
|
1369
|
-
backendUrl =
|
|
1370
|
-
signerAddress =
|
|
1369
|
+
backendUrl = _chunkFLXTBFMZcjs.DEFAULT_BACKEND_URL,
|
|
1370
|
+
signerAddress = _chunkFLXTBFMZcjs.DEFAULT_SIGNER_ADDRESS,
|
|
1371
1371
|
sessionChainIds,
|
|
1372
1372
|
forceRegister = false,
|
|
1373
1373
|
waitForFinalTx = true,
|
|
@@ -1393,12 +1393,12 @@ function WithdrawModalInner({
|
|
|
1393
1393
|
const [currentStepIndex, setCurrentStepIndex] = _react.useState.call(void 0, 0);
|
|
1394
1394
|
const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, null);
|
|
1395
1395
|
const backHandlerRef = _react.useRef.call(void 0, void 0);
|
|
1396
|
-
const targetChain =
|
|
1397
|
-
const sourceChain =
|
|
1398
|
-
const service = _react.useMemo.call(void 0, () =>
|
|
1396
|
+
const targetChain = _chunkFLXTBFMZcjs.getChainId.call(void 0, targetChainProp);
|
|
1397
|
+
const sourceChain = _chunkFLXTBFMZcjs.getChainId.call(void 0, sourceChainProp);
|
|
1398
|
+
const service = _react.useMemo.call(void 0, () => _chunkAHOFT42Hcjs.createDepositService.call(void 0, backendUrl), [backendUrl]);
|
|
1399
1399
|
_react.useEffect.call(void 0, () => {
|
|
1400
1400
|
if (isOpen && modalRef.current) {
|
|
1401
|
-
|
|
1401
|
+
_chunkAHOFT42Hcjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
1402
1402
|
}
|
|
1403
1403
|
}, [isOpen, theme]);
|
|
1404
1404
|
const hasCalledReady = _react.useRef.call(void 0, false);
|
|
@@ -1434,7 +1434,7 @@ function WithdrawModalInner({
|
|
|
1434
1434
|
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _49 => _49.title]), () => ( "Withdraw"));
|
|
1435
1435
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 3 && backHandlerRef.current;
|
|
1436
1436
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1437
|
-
|
|
1437
|
+
_chunkAHOFT42Hcjs.Modal,
|
|
1438
1438
|
{
|
|
1439
1439
|
isOpen,
|
|
1440
1440
|
onClose,
|
|
@@ -1492,7 +1492,7 @@ function WithdrawModalInner({
|
|
|
1492
1492
|
] }),
|
|
1493
1493
|
balance && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header-balance", children: [
|
|
1494
1494
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-label", children: balance.title }),
|
|
1495
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ?
|
|
1495
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ? _chunkAHOFT42Hcjs.currencyFormatter.format(totalBalanceUsd) : null))) })
|
|
1496
1496
|
] })
|
|
1497
1497
|
] }),
|
|
1498
1498
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
currencyFormatter,
|
|
14
14
|
formatUserError,
|
|
15
15
|
getAssetId,
|
|
16
|
+
getEventSourceDetails,
|
|
16
17
|
getEventTxHash,
|
|
17
18
|
getPublicClient,
|
|
18
19
|
isDepositEvent,
|
|
@@ -21,7 +22,7 @@ import {
|
|
|
21
22
|
portfolioToAssets,
|
|
22
23
|
saveSessionOwnerToStorage,
|
|
23
24
|
tokenFormatter
|
|
24
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-IC2M2DZ7.mjs";
|
|
25
26
|
import {
|
|
26
27
|
DEFAULT_BACKEND_URL,
|
|
27
28
|
DEFAULT_SIGNER_ADDRESS,
|
|
@@ -37,7 +38,7 @@ import {
|
|
|
37
38
|
getTokenIcon,
|
|
38
39
|
getTokenSymbol,
|
|
39
40
|
isStablecoinSymbol
|
|
40
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-I7RYTI4G.mjs";
|
|
41
42
|
|
|
42
43
|
// src/DepositModal.tsx
|
|
43
44
|
import {
|
|
@@ -1236,46 +1237,6 @@ QRCode.displayName = "QRCode";
|
|
|
1236
1237
|
// src/components/steps/DepositAddressStep.tsx
|
|
1237
1238
|
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1238
1239
|
var POLL_INTERVAL_MS = 4e3;
|
|
1239
|
-
function isRecord(value) {
|
|
1240
|
-
return typeof value === "object" && value !== null;
|
|
1241
|
-
}
|
|
1242
|
-
function asNumber(value) {
|
|
1243
|
-
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
1244
|
-
if (typeof value === "string" && value.trim() !== "") {
|
|
1245
|
-
const parsed = Number(value);
|
|
1246
|
-
return Number.isFinite(parsed) ? parsed : void 0;
|
|
1247
|
-
}
|
|
1248
|
-
return void 0;
|
|
1249
|
-
}
|
|
1250
|
-
function asAmount(value) {
|
|
1251
|
-
if (typeof value === "string") return value;
|
|
1252
|
-
if (typeof value === "number" && Number.isFinite(value)) {
|
|
1253
|
-
return value.toString();
|
|
1254
|
-
}
|
|
1255
|
-
return void 0;
|
|
1256
|
-
}
|
|
1257
|
-
function asAddress(value) {
|
|
1258
|
-
if (typeof value !== "string") return void 0;
|
|
1259
|
-
return /^0x[a-fA-F0-9]{40}$/.test(value) ? value : void 0;
|
|
1260
|
-
}
|
|
1261
|
-
function getDepositEventDetails(event) {
|
|
1262
|
-
if (!event?.type || !isRecord(event.data)) return {};
|
|
1263
|
-
if (event.type === "deposit-received") {
|
|
1264
|
-
return {
|
|
1265
|
-
chainId: asNumber(event.data.chain),
|
|
1266
|
-
amount: asAmount(event.data.amount),
|
|
1267
|
-
token: asAddress(event.data.token)
|
|
1268
|
-
};
|
|
1269
|
-
}
|
|
1270
|
-
if (event.type === "bridge-started") {
|
|
1271
|
-
const source = isRecord(event.data.source) ? event.data.source : void 0;
|
|
1272
|
-
return {
|
|
1273
|
-
chainId: asNumber(source?.chain),
|
|
1274
|
-
token: asAddress(source?.asset)
|
|
1275
|
-
};
|
|
1276
|
-
}
|
|
1277
|
-
return {};
|
|
1278
|
-
}
|
|
1279
1240
|
function DepositAddressStep({
|
|
1280
1241
|
smartAccount,
|
|
1281
1242
|
service,
|
|
@@ -1366,7 +1327,7 @@ function DepositAddressStep({
|
|
|
1366
1327
|
if (baselineTxHash === void 0) {
|
|
1367
1328
|
baselineTxHash = eventTxHash;
|
|
1368
1329
|
} else if (eventTxHash && eventTxHash !== baselineTxHash) {
|
|
1369
|
-
const details =
|
|
1330
|
+
const details = getEventSourceDetails(event);
|
|
1370
1331
|
const fallback = sourceSelectionRef.current;
|
|
1371
1332
|
const chainId = details.chainId ?? fallback.chainId;
|
|
1372
1333
|
const amount = details.amount ?? "0";
|
|
@@ -1585,6 +1546,9 @@ import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
|
1585
1546
|
function isSameRoute(sourceChain, sourceToken, targetChain, targetToken) {
|
|
1586
1547
|
return sourceChain === targetChain && sourceToken.toLowerCase() === targetToken.toLowerCase();
|
|
1587
1548
|
}
|
|
1549
|
+
function getAddressKey(address) {
|
|
1550
|
+
return address ? address.toLowerCase() : null;
|
|
1551
|
+
}
|
|
1588
1552
|
function DepositFlow({
|
|
1589
1553
|
dappWalletClient,
|
|
1590
1554
|
dappPublicClient,
|
|
@@ -1622,6 +1586,8 @@ function DepositFlow({
|
|
|
1622
1586
|
const [isConnectSelectionConfirmed, setIsConnectSelectionConfirmed] = useState7(false);
|
|
1623
1587
|
const [selectedConnectAddress, setSelectedConnectAddress] = useState7(null);
|
|
1624
1588
|
const portfolioAssetsRef = useRef5([]);
|
|
1589
|
+
const stableWalletSignerRef = useRef5(null);
|
|
1590
|
+
const stableWalletSelectionKeyRef = useRef5(null);
|
|
1625
1591
|
const handleAssetsLoaded = useCallback3((assets) => {
|
|
1626
1592
|
portfolioAssetsRef.current = assets;
|
|
1627
1593
|
}, []);
|
|
@@ -1644,16 +1610,17 @@ function DepositFlow({
|
|
|
1644
1610
|
await dappWalletClient.switchChain?.({ id: chainId });
|
|
1645
1611
|
};
|
|
1646
1612
|
}, [dappWalletClient]);
|
|
1613
|
+
const connectedWalletAddress = dappWalletClient?.account?.address ?? null;
|
|
1647
1614
|
const walletOptions = useMemo5(() => {
|
|
1648
1615
|
const options = [];
|
|
1649
1616
|
const seen = /* @__PURE__ */ new Set();
|
|
1650
|
-
if (
|
|
1617
|
+
if (connectedWalletAddress && dappAddress) {
|
|
1651
1618
|
options.push({
|
|
1652
|
-
address:
|
|
1619
|
+
address: connectedWalletAddress,
|
|
1653
1620
|
label: "Connected Wallet",
|
|
1654
1621
|
kind: "connected"
|
|
1655
1622
|
});
|
|
1656
|
-
seen.add(
|
|
1623
|
+
seen.add(connectedWalletAddress.toLowerCase());
|
|
1657
1624
|
}
|
|
1658
1625
|
if (reownWallet?.address && reownWallet.isConnected && reownWallet.walletClient && reownWallet.publicClient && !seen.has(reownWallet.address.toLowerCase())) {
|
|
1659
1626
|
options.push({
|
|
@@ -1665,7 +1632,7 @@ function DepositFlow({
|
|
|
1665
1632
|
}
|
|
1666
1633
|
return options;
|
|
1667
1634
|
}, [
|
|
1668
|
-
|
|
1635
|
+
connectedWalletAddress,
|
|
1669
1636
|
dappAddress,
|
|
1670
1637
|
reownWallet?.address,
|
|
1671
1638
|
reownWallet?.isConnected,
|
|
@@ -1675,17 +1642,27 @@ function DepositFlow({
|
|
|
1675
1642
|
]);
|
|
1676
1643
|
const canAutoLock = dappWalletClient?.account && dappAddress && !reownWallet;
|
|
1677
1644
|
const hasWalletOptions = walletOptions.length > 0;
|
|
1678
|
-
const hasReownSession = Boolean(
|
|
1679
|
-
|
|
1680
|
-
|
|
1645
|
+
const hasReownSession = Boolean(
|
|
1646
|
+
reownWallet?.isConnected || reownWallet?.address
|
|
1647
|
+
);
|
|
1648
|
+
const showConnectStep = flowMode === null && !canAutoLock && !isConnectSelectionConfirmed;
|
|
1649
|
+
const walletSelectionKey = useMemo5(() => {
|
|
1650
|
+
if (flowMode !== "wallet") return null;
|
|
1651
|
+
if (canAutoLock) {
|
|
1652
|
+
return getAddressKey(connectedWalletAddress);
|
|
1653
|
+
}
|
|
1654
|
+
if (!isConnectSelectionConfirmed) return null;
|
|
1655
|
+
return getAddressKey(selectedConnectAddress);
|
|
1656
|
+
}, [
|
|
1657
|
+
flowMode,
|
|
1658
|
+
canAutoLock,
|
|
1659
|
+
connectedWalletAddress,
|
|
1660
|
+
isConnectSelectionConfirmed,
|
|
1661
|
+
selectedConnectAddress
|
|
1662
|
+
]);
|
|
1663
|
+
const walletSignerContext = useMemo5(() => {
|
|
1681
1664
|
if (flowMode === "deposit-address") {
|
|
1682
|
-
|
|
1683
|
-
return {
|
|
1684
|
-
ownerAddress: dappAddress,
|
|
1685
|
-
walletClient: void 0,
|
|
1686
|
-
publicClient: dappPublicClient ?? getPublicClient(targetChain),
|
|
1687
|
-
switchChain: void 0
|
|
1688
|
-
};
|
|
1665
|
+
return null;
|
|
1689
1666
|
}
|
|
1690
1667
|
if (canAutoLock) {
|
|
1691
1668
|
const fallbackChainId = dappWalletClient?.chain?.id ?? targetChain;
|
|
@@ -1716,7 +1693,6 @@ function DepositFlow({
|
|
|
1716
1693
|
}
|
|
1717
1694
|
return null;
|
|
1718
1695
|
}, [
|
|
1719
|
-
flowMode,
|
|
1720
1696
|
canAutoLock,
|
|
1721
1697
|
isConnectSelectionConfirmed,
|
|
1722
1698
|
selectedConnectAddress,
|
|
@@ -1727,6 +1703,49 @@ function DepositFlow({
|
|
|
1727
1703
|
reownWallet,
|
|
1728
1704
|
targetChain
|
|
1729
1705
|
]);
|
|
1706
|
+
useEffect7(() => {
|
|
1707
|
+
if (flowMode !== "wallet") {
|
|
1708
|
+
stableWalletSelectionKeyRef.current = null;
|
|
1709
|
+
stableWalletSignerRef.current = null;
|
|
1710
|
+
return;
|
|
1711
|
+
}
|
|
1712
|
+
if (walletSelectionKey !== stableWalletSelectionKeyRef.current) {
|
|
1713
|
+
stableWalletSelectionKeyRef.current = walletSelectionKey;
|
|
1714
|
+
stableWalletSignerRef.current = null;
|
|
1715
|
+
}
|
|
1716
|
+
if (walletSignerContext && walletSelectionKey) {
|
|
1717
|
+
stableWalletSelectionKeyRef.current = walletSelectionKey;
|
|
1718
|
+
stableWalletSignerRef.current = walletSignerContext;
|
|
1719
|
+
}
|
|
1720
|
+
}, [flowMode, walletSelectionKey, walletSignerContext]);
|
|
1721
|
+
const signerContext = useMemo5(() => {
|
|
1722
|
+
if (flowMode === "deposit-address") {
|
|
1723
|
+
if (!dappAddress) return null;
|
|
1724
|
+
return {
|
|
1725
|
+
ownerAddress: dappAddress,
|
|
1726
|
+
walletClient: void 0,
|
|
1727
|
+
publicClient: dappPublicClient ?? getPublicClient(targetChain),
|
|
1728
|
+
switchChain: void 0
|
|
1729
|
+
};
|
|
1730
|
+
}
|
|
1731
|
+
if (flowMode !== "wallet") {
|
|
1732
|
+
return null;
|
|
1733
|
+
}
|
|
1734
|
+
if (walletSignerContext) {
|
|
1735
|
+
return walletSignerContext;
|
|
1736
|
+
}
|
|
1737
|
+
if (walletSelectionKey && stableWalletSelectionKeyRef.current === walletSelectionKey) {
|
|
1738
|
+
return stableWalletSignerRef.current;
|
|
1739
|
+
}
|
|
1740
|
+
return null;
|
|
1741
|
+
}, [
|
|
1742
|
+
flowMode,
|
|
1743
|
+
dappAddress,
|
|
1744
|
+
dappPublicClient,
|
|
1745
|
+
targetChain,
|
|
1746
|
+
walletSignerContext,
|
|
1747
|
+
walletSelectionKey
|
|
1748
|
+
]);
|
|
1730
1749
|
const sessionKeyAddress = dappAddress ?? signerContext?.ownerAddress ?? null;
|
|
1731
1750
|
const lastTargetRef = useRef5(null);
|
|
1732
1751
|
useEffect7(() => {
|
|
@@ -1747,6 +1766,7 @@ function DepositFlow({
|
|
|
1747
1766
|
const handleBackFromSelectAsset = useCallback3(() => {
|
|
1748
1767
|
if (hasWalletOptions || reownWallet) {
|
|
1749
1768
|
hasNavigatedBackRef.current = true;
|
|
1769
|
+
setFlowMode(null);
|
|
1750
1770
|
setIsConnectSelectionConfirmed(false);
|
|
1751
1771
|
}
|
|
1752
1772
|
}, [hasWalletOptions, reownWallet]);
|
|
@@ -2119,7 +2139,7 @@ function DepositFlow({
|
|
|
2119
2139
|
// src/DepositModal.tsx
|
|
2120
2140
|
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2121
2141
|
var ReownDepositInner = lazy(
|
|
2122
|
-
() => import("./DepositModalReown-
|
|
2142
|
+
() => import("./DepositModalReown-YTUE3XAB.mjs").then((m) => ({ default: m.DepositModalReown }))
|
|
2123
2143
|
);
|
|
2124
2144
|
function DepositModal(props) {
|
|
2125
2145
|
const needsReown = !!props.reownAppId;
|