@rhinestone/deposit-modal 0.1.27 → 0.1.29
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-NGYZ4G7Q.cjs → DepositModalReown-4PFOMSC6.cjs} +4 -4
- package/dist/{DepositModalReown-PFKTSKDS.mjs → DepositModalReown-BVHWFWIG.mjs} +3 -3
- package/dist/{WithdrawModalReown-6AAWH35J.mjs → WithdrawModalReown-CJCNT7SA.mjs} +3 -3
- package/dist/{WithdrawModalReown-BA6ECON3.cjs → WithdrawModalReown-YREQR7DV.cjs} +4 -4
- package/dist/{chunk-7MQU2SR7.cjs → chunk-5QJNOPNF.cjs} +164 -171
- package/dist/{chunk-QWYZJL3L.cjs → chunk-7ZCUANBT.cjs} +40 -61
- package/dist/{chunk-XIS33BZ6.cjs → chunk-CPIQJR47.cjs} +82 -87
- package/dist/{chunk-A6QLADED.mjs → chunk-CSQRKM4Y.mjs} +123 -2
- package/dist/{chunk-CEIWN53N.cjs → chunk-DLYVHOME.cjs} +130 -9
- package/dist/{chunk-QCRZCGAE.mjs → chunk-K6YG3I6O.mjs} +21 -26
- package/dist/{chunk-YOFGP4FV.mjs → chunk-N6T4TKXI.mjs} +12 -33
- package/dist/{chunk-AJALMXW4.mjs → chunk-XTTTHW3W.mjs} +22 -29
- package/dist/constants.cjs +2 -2
- package/dist/constants.d.cts +11 -2
- package/dist/constants.d.ts +11 -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.d.cts +1 -2
- package/dist/index.d.ts +1 -2
- 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 +56 -9
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunk7ZCUANBTcjs = require('./chunk-7ZCUANBT.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
@@ -29,7 +29,7 @@ var _chunkQWYZJL3Lcjs = require('./chunk-QWYZJL3L.cjs');
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _chunkDLYVHOMEcjs = require('./chunk-DLYVHOME.cjs');
|
|
33
33
|
|
|
34
34
|
// src/WithdrawModal.tsx
|
|
35
35
|
|
|
@@ -101,8 +101,8 @@ function WithdrawFormStep({
|
|
|
101
101
|
const chainMismatch = Boolean(
|
|
102
102
|
_optionalChain([walletClient, 'optionalAccess', _3 => _3.chain, 'optionalAccess', _4 => _4.id]) && walletClient.chain.id !== asset.chainId
|
|
103
103
|
);
|
|
104
|
-
const targetSymbol =
|
|
105
|
-
const targetChainName =
|
|
104
|
+
const targetSymbol = _chunkDLYVHOMEcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
105
|
+
const targetChainName = _chunkDLYVHOMEcjs.getChainName.call(void 0, targetChain);
|
|
106
106
|
const isBusy = submitting || isSubmitting;
|
|
107
107
|
_react.useEffect.call(void 0, () => {
|
|
108
108
|
if (chainMismatch && switchChain && !hasAttemptedSwitch.current) {
|
|
@@ -110,7 +110,7 @@ function WithdrawFormStep({
|
|
|
110
110
|
setIsSwitching(true);
|
|
111
111
|
switchChain(asset.chainId).catch((err) => {
|
|
112
112
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
113
|
-
setError(
|
|
113
|
+
setError(_chunk7ZCUANBTcjs.formatUserError.call(void 0, raw));
|
|
114
114
|
}).finally(() => {
|
|
115
115
|
setIsSwitching(false);
|
|
116
116
|
});
|
|
@@ -127,7 +127,7 @@ function WithdrawFormStep({
|
|
|
127
127
|
return;
|
|
128
128
|
}
|
|
129
129
|
try {
|
|
130
|
-
const bal =
|
|
130
|
+
const bal = _chunk7ZCUANBTcjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: safeAddress }) : await publicClient.readContract({
|
|
131
131
|
address: asset.token,
|
|
132
132
|
abi: _viem.erc20Abi,
|
|
133
133
|
functionName: "balanceOf",
|
|
@@ -229,7 +229,7 @@ function WithdrawFormStep({
|
|
|
229
229
|
await onSubmit(recipient, amount);
|
|
230
230
|
} catch (err) {
|
|
231
231
|
const raw = err instanceof Error ? err.message : "Withdrawal failed";
|
|
232
|
-
setError(
|
|
232
|
+
setError(_chunk7ZCUANBTcjs.formatUserError.call(void 0, raw));
|
|
233
233
|
} finally {
|
|
234
234
|
setIsSubmitting(false);
|
|
235
235
|
}
|
|
@@ -241,7 +241,7 @@ function WithdrawFormStep({
|
|
|
241
241
|
await switchChain(asset.chainId);
|
|
242
242
|
} catch (err) {
|
|
243
243
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
244
|
-
setError(
|
|
244
|
+
setError(_chunk7ZCUANBTcjs.formatUserError.call(void 0, raw));
|
|
245
245
|
} finally {
|
|
246
246
|
setIsSwitching(false);
|
|
247
247
|
}
|
|
@@ -331,7 +331,7 @@ function WithdrawFormStep({
|
|
|
331
331
|
] })
|
|
332
332
|
] }),
|
|
333
333
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-amount-info", children: [
|
|
334
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ?
|
|
334
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ? _chunk7ZCUANBTcjs.currencyFormatter.format(amountUsd) : "$0.00" }),
|
|
335
335
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-withdraw-balance", children: [
|
|
336
336
|
formattedBalance,
|
|
337
337
|
" ",
|
|
@@ -359,10 +359,10 @@ function WithdrawFormStep({
|
|
|
359
359
|
},
|
|
360
360
|
children: [
|
|
361
361
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-dropdown-value", children: [
|
|
362
|
-
|
|
362
|
+
_chunkDLYVHOMEcjs.getTokenIcon.call(void 0, targetSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
363
363
|
"img",
|
|
364
364
|
{
|
|
365
|
-
src:
|
|
365
|
+
src: _chunkDLYVHOMEcjs.getTokenIcon.call(void 0, targetSymbol),
|
|
366
366
|
alt: targetSymbol,
|
|
367
367
|
className: "rs-withdraw-dropdown-icon"
|
|
368
368
|
}
|
|
@@ -403,10 +403,10 @@ function WithdrawFormStep({
|
|
|
403
403
|
setShowTokenDropdown(false);
|
|
404
404
|
},
|
|
405
405
|
children: [
|
|
406
|
-
|
|
406
|
+
_chunkDLYVHOMEcjs.getTokenIcon.call(void 0, option.symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
407
407
|
"img",
|
|
408
408
|
{
|
|
409
|
-
src:
|
|
409
|
+
src: _chunkDLYVHOMEcjs.getTokenIcon.call(void 0, option.symbol),
|
|
410
410
|
alt: option.symbol,
|
|
411
411
|
className: "rs-withdraw-dropdown-icon"
|
|
412
412
|
}
|
|
@@ -439,10 +439,10 @@ function WithdrawFormStep({
|
|
|
439
439
|
},
|
|
440
440
|
children: [
|
|
441
441
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-dropdown-value", children: [
|
|
442
|
-
|
|
442
|
+
_chunkDLYVHOMEcjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
443
443
|
"img",
|
|
444
444
|
{
|
|
445
|
-
src:
|
|
445
|
+
src: _chunkDLYVHOMEcjs.getChainIcon.call(void 0, targetChain),
|
|
446
446
|
alt: targetChainName,
|
|
447
447
|
className: "rs-withdraw-dropdown-icon"
|
|
448
448
|
}
|
|
@@ -483,10 +483,10 @@ function WithdrawFormStep({
|
|
|
483
483
|
setShowChainDropdown(false);
|
|
484
484
|
},
|
|
485
485
|
children: [
|
|
486
|
-
|
|
486
|
+
_chunkDLYVHOMEcjs.getChainIcon.call(void 0, chain.id) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
487
487
|
"img",
|
|
488
488
|
{
|
|
489
|
-
src:
|
|
489
|
+
src: _chunkDLYVHOMEcjs.getChainIcon.call(void 0, chain.id),
|
|
490
490
|
alt: chain.name,
|
|
491
491
|
className: "rs-withdraw-dropdown-icon"
|
|
492
492
|
}
|
|
@@ -504,11 +504,11 @@ function WithdrawFormStep({
|
|
|
504
504
|
chainMismatch && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch", children: [
|
|
505
505
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch-text", children: [
|
|
506
506
|
"Switch to ",
|
|
507
|
-
|
|
507
|
+
_chunkDLYVHOMEcjs.getChainName.call(void 0, asset.chainId),
|
|
508
508
|
" to continue."
|
|
509
509
|
] }),
|
|
510
510
|
switchChain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
511
|
-
|
|
511
|
+
_chunk7ZCUANBTcjs.Button,
|
|
512
512
|
{
|
|
513
513
|
variant: "outline",
|
|
514
514
|
size: "small",
|
|
@@ -540,7 +540,7 @@ function WithdrawFormStep({
|
|
|
540
540
|
] })
|
|
541
541
|
] }),
|
|
542
542
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
543
|
-
|
|
543
|
+
_chunk7ZCUANBTcjs.Button,
|
|
544
544
|
{
|
|
545
545
|
onClick: handleWithdraw,
|
|
546
546
|
fullWidth: true,
|
|
@@ -549,7 +549,7 @@ function WithdrawFormStep({
|
|
|
549
549
|
children: isBusy ? "Preparing..." : "Withdraw"
|
|
550
550
|
}
|
|
551
551
|
) }),
|
|
552
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
552
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7ZCUANBTcjs.PoweredBy, {})
|
|
553
553
|
] });
|
|
554
554
|
}
|
|
555
555
|
WithdrawFormStep.displayName = "WithdrawFormStep";
|
|
@@ -632,7 +632,7 @@ async function executeSafeEthTransfer(params) {
|
|
|
632
632
|
throw new Error("Wallet not connected");
|
|
633
633
|
}
|
|
634
634
|
if (chain.id !== chainId) {
|
|
635
|
-
throw new Error(`Switch to ${
|
|
635
|
+
throw new Error(`Switch to ${_chunkDLYVHOMEcjs.getChainName.call(void 0, chainId)} to sign`);
|
|
636
636
|
}
|
|
637
637
|
const isOwner = await publicClient.readContract({
|
|
638
638
|
address: safeAddress,
|
|
@@ -715,7 +715,7 @@ async function executeSafeErc20Transfer(params) {
|
|
|
715
715
|
throw new Error("Wallet not connected");
|
|
716
716
|
}
|
|
717
717
|
if (chain.id !== chainId) {
|
|
718
|
-
throw new Error(`Switch to ${
|
|
718
|
+
throw new Error(`Switch to ${_chunkDLYVHOMEcjs.getChainName.call(void 0, chainId)} to sign`);
|
|
719
719
|
}
|
|
720
720
|
const isOwner = await publicClient.readContract({
|
|
721
721
|
address: safeAddress,
|
|
@@ -854,7 +854,7 @@ function WithdrawFlow({
|
|
|
854
854
|
recipient: defaultRecipient,
|
|
855
855
|
amount: defaultAmount,
|
|
856
856
|
service,
|
|
857
|
-
signerAddress =
|
|
857
|
+
signerAddress = _chunkDLYVHOMEcjs.DEFAULT_SIGNER_ADDRESS,
|
|
858
858
|
sessionChainIds,
|
|
859
859
|
forceRegister = false,
|
|
860
860
|
waitForFinalTx = true,
|
|
@@ -923,14 +923,14 @@ function WithdrawFlow({
|
|
|
923
923
|
return {
|
|
924
924
|
ownerAddress: dappAddress,
|
|
925
925
|
walletClient: _nullishCoalesce(dappWalletClient, () => ( void 0)),
|
|
926
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
926
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunk7ZCUANBTcjs.getPublicClient.call(void 0, sourceChain))),
|
|
927
927
|
switchChain: dappSwitchChain
|
|
928
928
|
};
|
|
929
929
|
}
|
|
930
930
|
return {
|
|
931
931
|
ownerAddress: dappWalletClient.account.address,
|
|
932
932
|
walletClient: dappWalletClient,
|
|
933
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
933
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunk7ZCUANBTcjs.getPublicClient.call(void 0, sourceChain))),
|
|
934
934
|
switchChain: dappSwitchChain
|
|
935
935
|
};
|
|
936
936
|
}
|
|
@@ -939,7 +939,7 @@ function WithdrawFlow({
|
|
|
939
939
|
return {
|
|
940
940
|
ownerAddress: dappWalletClient.account.address,
|
|
941
941
|
walletClient: dappWalletClient,
|
|
942
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
942
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunk7ZCUANBTcjs.getPublicClient.call(void 0, sourceChain))),
|
|
943
943
|
switchChain: dappSwitchChain
|
|
944
944
|
};
|
|
945
945
|
}
|
|
@@ -965,10 +965,10 @@ function WithdrawFlow({
|
|
|
965
965
|
sourceChain
|
|
966
966
|
]);
|
|
967
967
|
const asset = _react.useMemo.call(void 0, () => {
|
|
968
|
-
const symbol =
|
|
969
|
-
const decimals =
|
|
968
|
+
const symbol = _chunkDLYVHOMEcjs.getTokenSymbol.call(void 0, sourceToken, sourceChain);
|
|
969
|
+
const decimals = _chunkDLYVHOMEcjs.getTokenDecimalsByAddress.call(void 0, sourceToken, sourceChain);
|
|
970
970
|
return {
|
|
971
|
-
id:
|
|
971
|
+
id: _chunk7ZCUANBTcjs.getAssetId.call(void 0, { chainId: sourceChain, token: sourceToken }),
|
|
972
972
|
chainId: sourceChain,
|
|
973
973
|
token: sourceToken,
|
|
974
974
|
symbol,
|
|
@@ -976,7 +976,7 @@ function WithdrawFlow({
|
|
|
976
976
|
decimals
|
|
977
977
|
};
|
|
978
978
|
}, [sourceChain, sourceToken]);
|
|
979
|
-
const isSourceNative = sourceToken.toLowerCase() ===
|
|
979
|
+
const isSourceNative = sourceToken.toLowerCase() === _chunkDLYVHOMEcjs.NATIVE_TOKEN_ADDRESS.toLowerCase();
|
|
980
980
|
const stepIndex = step.type === "form" ? 0 : 1;
|
|
981
981
|
const currentBackHandler = void 0;
|
|
982
982
|
_react.useEffect.call(void 0, () => {
|
|
@@ -998,15 +998,15 @@ function WithdrawFlow({
|
|
|
998
998
|
[onError]
|
|
999
999
|
);
|
|
1000
1000
|
const resolveSessionOwner = _react.useCallback.call(void 0, async (eoaAddress) => {
|
|
1001
|
-
const localOwner =
|
|
1001
|
+
const localOwner = _chunk7ZCUANBTcjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
|
|
1002
1002
|
if (localOwner) {
|
|
1003
1003
|
return {
|
|
1004
|
-
account:
|
|
1004
|
+
account: _chunk7ZCUANBTcjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
|
|
1005
1005
|
address: localOwner.address
|
|
1006
1006
|
};
|
|
1007
1007
|
}
|
|
1008
|
-
const created =
|
|
1009
|
-
|
|
1008
|
+
const created = _chunk7ZCUANBTcjs.createSessionOwnerKey.call(void 0, );
|
|
1009
|
+
_chunk7ZCUANBTcjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
|
|
1010
1010
|
return {
|
|
1011
1011
|
account: created.account,
|
|
1012
1012
|
address: created.address
|
|
@@ -1024,23 +1024,21 @@ function WithdrawFlow({
|
|
|
1024
1024
|
setIsSubmitting(true);
|
|
1025
1025
|
try {
|
|
1026
1026
|
const sessionOwner = await resolveSessionOwner(ownerAddress2);
|
|
1027
|
-
const
|
|
1028
|
-
ownerAddress2,
|
|
1029
|
-
sessionOwner.address
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
});
|
|
1043
|
-
const typedData = prepared.sessionDetailsUnsigned.data;
|
|
1027
|
+
const setup = await service.setupAccount({
|
|
1028
|
+
ownerAddress: ownerAddress2,
|
|
1029
|
+
sessionOwnerAddress: sessionOwner.address,
|
|
1030
|
+
targetChain,
|
|
1031
|
+
targetToken,
|
|
1032
|
+
signerAddress,
|
|
1033
|
+
sessionChainIds,
|
|
1034
|
+
forceRegister
|
|
1035
|
+
});
|
|
1036
|
+
const smartAccount = setup.smartAccount;
|
|
1037
|
+
if (setup.needsRegistration) {
|
|
1038
|
+
if (!setup.accountParams || !setup.sessionDetailsUnsigned) {
|
|
1039
|
+
throw new Error("Missing registration payload from setup-account");
|
|
1040
|
+
}
|
|
1041
|
+
const typedData = setup.sessionDetailsUnsigned.data;
|
|
1044
1042
|
if (!sessionOwner.account.signTypedData) {
|
|
1045
1043
|
throw new Error(
|
|
1046
1044
|
"Session owner account does not support signTypedData"
|
|
@@ -1052,15 +1050,12 @@ function WithdrawFlow({
|
|
|
1052
1050
|
primaryType: typedData.primaryType,
|
|
1053
1051
|
message: typedData.message
|
|
1054
1052
|
});
|
|
1055
|
-
const sessionDetails =
|
|
1056
|
-
prepared.sessionDetailsUnsigned,
|
|
1057
|
-
signature
|
|
1058
|
-
);
|
|
1053
|
+
const sessionDetails = _chunk7ZCUANBTcjs.buildSessionDetails.call(void 0, setup.sessionDetailsUnsigned, signature);
|
|
1059
1054
|
await service.registerAccount({
|
|
1060
1055
|
address: smartAccount,
|
|
1061
1056
|
accountParams: {
|
|
1062
|
-
factory:
|
|
1063
|
-
factoryData:
|
|
1057
|
+
factory: setup.accountParams.factory,
|
|
1058
|
+
factoryData: setup.accountParams.factoryData,
|
|
1064
1059
|
sessionDetails
|
|
1065
1060
|
},
|
|
1066
1061
|
eoaAddress: ownerAddress2,
|
|
@@ -1074,7 +1069,7 @@ function WithdrawFlow({
|
|
|
1074
1069
|
}
|
|
1075
1070
|
handleConnected(ownerAddress2, smartAccount);
|
|
1076
1071
|
const amountUnits = _viem.parseUnits.call(void 0, amountValue, asset.decimals);
|
|
1077
|
-
const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess',
|
|
1072
|
+
const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _24 => _24.publicClient]), () => ( _chunk7ZCUANBTcjs.getPublicClient.call(void 0, sourceChain)));
|
|
1078
1073
|
let result;
|
|
1079
1074
|
if (onSignTransaction) {
|
|
1080
1075
|
const transferData = isSourceNative ? { to: smartAccount, value: amountUnits, data: "0x" } : {
|
|
@@ -1126,7 +1121,7 @@ function WithdrawFlow({
|
|
|
1126
1121
|
chainId: sourceChain
|
|
1127
1122
|
});
|
|
1128
1123
|
}
|
|
1129
|
-
_optionalChain([onWithdrawSubmitted, 'optionalCall',
|
|
1124
|
+
_optionalChain([onWithdrawSubmitted, 'optionalCall', _25 => _25({
|
|
1130
1125
|
txHash: result.txHash,
|
|
1131
1126
|
sourceChain,
|
|
1132
1127
|
amount: amountUnits.toString(),
|
|
@@ -1142,7 +1137,7 @@ function WithdrawFlow({
|
|
|
1142
1137
|
});
|
|
1143
1138
|
} catch (err) {
|
|
1144
1139
|
const raw = err instanceof Error ? err.message : "Withdraw failed";
|
|
1145
|
-
handleError(
|
|
1140
|
+
handleError(_chunk7ZCUANBTcjs.formatUserError.call(void 0, raw), "WITHDRAW_FLOW_ERROR");
|
|
1146
1141
|
throw err;
|
|
1147
1142
|
} finally {
|
|
1148
1143
|
setIsSubmitting(false);
|
|
@@ -1170,23 +1165,23 @@ function WithdrawFlow({
|
|
|
1170
1165
|
);
|
|
1171
1166
|
const handleWithdrawComplete = _react.useCallback.call(void 0,
|
|
1172
1167
|
(txHash, destinationTxHash) => {
|
|
1173
|
-
_optionalChain([onWithdrawComplete, 'optionalCall',
|
|
1168
|
+
_optionalChain([onWithdrawComplete, 'optionalCall', _26 => _26({ txHash, destinationTxHash })]);
|
|
1174
1169
|
},
|
|
1175
1170
|
[onWithdrawComplete]
|
|
1176
1171
|
);
|
|
1177
1172
|
const handleWithdrawFailed = _react.useCallback.call(void 0,
|
|
1178
1173
|
(txHash, error) => {
|
|
1179
|
-
_optionalChain([onWithdrawFailed, 'optionalCall',
|
|
1174
|
+
_optionalChain([onWithdrawFailed, 'optionalCall', _27 => _27({ txHash, error })]);
|
|
1180
1175
|
},
|
|
1181
1176
|
[onWithdrawFailed]
|
|
1182
1177
|
);
|
|
1183
1178
|
const targetChainOptions = _react.useMemo.call(void 0, () => {
|
|
1184
|
-
return
|
|
1185
|
-
(chain) =>
|
|
1179
|
+
return _chunkDLYVHOMEcjs.SOURCE_CHAINS.filter(
|
|
1180
|
+
(chain) => _chunkDLYVHOMEcjs.getSupportedTargetTokens.call(void 0, chain.id).length > 0
|
|
1186
1181
|
);
|
|
1187
1182
|
}, []);
|
|
1188
1183
|
const targetTokenOptions = _react.useMemo.call(void 0,
|
|
1189
|
-
() =>
|
|
1184
|
+
() => _chunkDLYVHOMEcjs.getSupportedTargetTokens.call(void 0, targetChain),
|
|
1190
1185
|
[targetChain]
|
|
1191
1186
|
);
|
|
1192
1187
|
_react.useEffect.call(void 0, () => {
|
|
@@ -1201,7 +1196,7 @@ function WithdrawFlow({
|
|
|
1201
1196
|
const handleTargetChainChange = _react.useCallback.call(void 0,
|
|
1202
1197
|
(chainId) => {
|
|
1203
1198
|
setTargetChain(chainId);
|
|
1204
|
-
const options =
|
|
1199
|
+
const options = _chunkDLYVHOMEcjs.getSupportedTargetTokens.call(void 0, chainId);
|
|
1205
1200
|
if (options.length === 0) {
|
|
1206
1201
|
return;
|
|
1207
1202
|
}
|
|
@@ -1234,7 +1229,7 @@ function WithdrawFlow({
|
|
|
1234
1229
|
}, [walletOptionsKey, selectedConnectAddressEffective]);
|
|
1235
1230
|
if (showConnectStep) {
|
|
1236
1231
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1237
|
-
|
|
1232
|
+
_chunk7ZCUANBTcjs.ConnectStep,
|
|
1238
1233
|
{
|
|
1239
1234
|
walletOptions,
|
|
1240
1235
|
selectedAddress: selectedConnectAddressEffective,
|
|
@@ -1254,7 +1249,7 @@ function WithdrawFlow({
|
|
|
1254
1249
|
if (!signerContext) return null;
|
|
1255
1250
|
if (!onSignTransaction && !signerContext.walletClient) return null;
|
|
1256
1251
|
const ownerAddress = signerContext.ownerAddress;
|
|
1257
|
-
const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => (
|
|
1252
|
+
const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => ( _chunk7ZCUANBTcjs.getPublicClient.call(void 0, sourceChain)));
|
|
1258
1253
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
1259
1254
|
step.type === "form" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1260
1255
|
WithdrawFormStep,
|
|
@@ -1279,7 +1274,7 @@ function WithdrawFlow({
|
|
|
1279
1274
|
}
|
|
1280
1275
|
),
|
|
1281
1276
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1282
|
-
|
|
1277
|
+
_chunk7ZCUANBTcjs.ProcessingStep,
|
|
1283
1278
|
{
|
|
1284
1279
|
smartAccount: step.smartAccount,
|
|
1285
1280
|
txHash: step.txHash,
|
|
@@ -1305,7 +1300,7 @@ function WithdrawFlow({
|
|
|
1305
1300
|
// src/WithdrawModal.tsx
|
|
1306
1301
|
|
|
1307
1302
|
var ReownWithdrawInner = _react.lazy.call(void 0,
|
|
1308
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-
|
|
1303
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-YREQR7DV.cjs"))).then((m) => ({
|
|
1309
1304
|
default: m.WithdrawModalReown
|
|
1310
1305
|
}))
|
|
1311
1306
|
);
|
|
@@ -1331,8 +1326,8 @@ function WithdrawModalInner({
|
|
|
1331
1326
|
isOpen,
|
|
1332
1327
|
onClose,
|
|
1333
1328
|
inline,
|
|
1334
|
-
backendUrl =
|
|
1335
|
-
signerAddress =
|
|
1329
|
+
backendUrl = _chunkDLYVHOMEcjs.DEFAULT_BACKEND_URL,
|
|
1330
|
+
signerAddress = _chunkDLYVHOMEcjs.DEFAULT_SIGNER_ADDRESS,
|
|
1336
1331
|
sessionChainIds,
|
|
1337
1332
|
forceRegister = false,
|
|
1338
1333
|
waitForFinalTx = true,
|
|
@@ -1357,19 +1352,19 @@ function WithdrawModalInner({
|
|
|
1357
1352
|
const [currentStepIndex, setCurrentStepIndex] = _react.useState.call(void 0, 0);
|
|
1358
1353
|
const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, null);
|
|
1359
1354
|
const backHandlerRef = _react.useRef.call(void 0, void 0);
|
|
1360
|
-
const targetChain =
|
|
1361
|
-
const sourceChain =
|
|
1362
|
-
const service = _react.useMemo.call(void 0, () =>
|
|
1355
|
+
const targetChain = _chunkDLYVHOMEcjs.getChainId.call(void 0, targetChainProp);
|
|
1356
|
+
const sourceChain = _chunkDLYVHOMEcjs.getChainId.call(void 0, sourceChainProp);
|
|
1357
|
+
const service = _react.useMemo.call(void 0, () => _chunk7ZCUANBTcjs.createDepositService.call(void 0, backendUrl), [backendUrl]);
|
|
1363
1358
|
_react.useEffect.call(void 0, () => {
|
|
1364
1359
|
if (isOpen && modalRef.current) {
|
|
1365
|
-
|
|
1360
|
+
_chunk7ZCUANBTcjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
1366
1361
|
}
|
|
1367
1362
|
}, [isOpen, theme]);
|
|
1368
1363
|
const hasCalledReady = _react.useRef.call(void 0, false);
|
|
1369
1364
|
_react.useEffect.call(void 0, () => {
|
|
1370
1365
|
if (isOpen && !hasCalledReady.current) {
|
|
1371
1366
|
hasCalledReady.current = true;
|
|
1372
|
-
_optionalChain([onReady, 'optionalCall',
|
|
1367
|
+
_optionalChain([onReady, 'optionalCall', _28 => _28()]);
|
|
1373
1368
|
}
|
|
1374
1369
|
}, [isOpen, onReady]);
|
|
1375
1370
|
_react.useEffect.call(void 0, () => {
|
|
@@ -1388,17 +1383,17 @@ function WithdrawModalInner({
|
|
|
1388
1383
|
setTotalBalanceUsd(balance);
|
|
1389
1384
|
}, []);
|
|
1390
1385
|
const handleBack = _react.useCallback.call(void 0, () => {
|
|
1391
|
-
_optionalChain([backHandlerRef, 'access',
|
|
1386
|
+
_optionalChain([backHandlerRef, 'access', _29 => _29.current, 'optionalCall', _30 => _30()]);
|
|
1392
1387
|
}, []);
|
|
1393
|
-
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
1394
|
-
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
1395
|
-
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
1396
|
-
const balanceTitle = _optionalChain([uiConfig, 'optionalAccess',
|
|
1397
|
-
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess',
|
|
1398
|
-
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess',
|
|
1388
|
+
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _31 => _31.showLogo]), () => ( false));
|
|
1389
|
+
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _32 => _32.showStepper]), () => ( false));
|
|
1390
|
+
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _33 => _33.showBackButton]), () => ( true));
|
|
1391
|
+
const balanceTitle = _optionalChain([uiConfig, 'optionalAccess', _34 => _34.balanceTitle]);
|
|
1392
|
+
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _35 => _35.logoUrl]), () => ( "https://github.com/rhinestonewtf.png"));
|
|
1393
|
+
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _36 => _36.title]), () => ( "Withdraw"));
|
|
1399
1394
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 3 && backHandlerRef.current;
|
|
1400
1395
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1401
|
-
|
|
1396
|
+
_chunk7ZCUANBTcjs.Modal,
|
|
1402
1397
|
{
|
|
1403
1398
|
isOpen,
|
|
1404
1399
|
onClose,
|
|
@@ -1456,7 +1451,7 @@ function WithdrawModalInner({
|
|
|
1456
1451
|
] }),
|
|
1457
1452
|
balanceTitle && totalBalanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header-balance", children: [
|
|
1458
1453
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-label", children: balanceTitle }),
|
|
1459
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children:
|
|
1454
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _chunk7ZCUANBTcjs.currencyFormatter.format(totalBalanceUsd) })
|
|
1460
1455
|
] })
|
|
1461
1456
|
] }),
|
|
1462
1457
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
optimism,
|
|
8
8
|
polygon
|
|
9
9
|
} from "viem/chains";
|
|
10
|
-
import { chainRegistry } from "@rhinestone/shared-configs";
|
|
11
10
|
var DEFAULT_BACKEND_URL = "https://v1.orchestrator.rhinestone.dev/deposit-widget";
|
|
12
11
|
var DEFAULT_SIGNER_ADDRESS = "0x177bfcdd15bc01e99013dcc5d2b09cd87a18ce9c";
|
|
13
12
|
var NATIVE_TOKEN_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
@@ -61,6 +60,128 @@ var SYMBOL_ALIASES = {
|
|
|
61
60
|
var CANONICAL_SYMBOL_BY_REGISTRY_SYMBOL = {
|
|
62
61
|
USDT0: "USDT"
|
|
63
62
|
};
|
|
63
|
+
var chainRegistry = {
|
|
64
|
+
[mainnet.id]: {
|
|
65
|
+
name: mainnet.name,
|
|
66
|
+
tokens: [
|
|
67
|
+
{ symbol: "ETH", address: NATIVE_TOKEN_ADDRESS, decimals: 18 },
|
|
68
|
+
{
|
|
69
|
+
symbol: "USDC",
|
|
70
|
+
address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
71
|
+
decimals: 6
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
symbol: "WETH",
|
|
75
|
+
address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
|
76
|
+
decimals: 18
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
symbol: "USDT0",
|
|
80
|
+
address: "0xdac17f958d2ee523a2206206994597c13d831ec7",
|
|
81
|
+
decimals: 6
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
[base.id]: {
|
|
86
|
+
name: base.name,
|
|
87
|
+
tokens: [
|
|
88
|
+
{ symbol: "ETH", address: NATIVE_TOKEN_ADDRESS, decimals: 18 },
|
|
89
|
+
{
|
|
90
|
+
symbol: "USDC",
|
|
91
|
+
address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
92
|
+
decimals: 6
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
symbol: "WETH",
|
|
96
|
+
address: "0x4200000000000000000000000000000000000006",
|
|
97
|
+
decimals: 18
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
[arbitrum.id]: {
|
|
102
|
+
name: arbitrum.name,
|
|
103
|
+
tokens: [
|
|
104
|
+
{ symbol: "ETH", address: NATIVE_TOKEN_ADDRESS, decimals: 18 },
|
|
105
|
+
{
|
|
106
|
+
symbol: "USDC",
|
|
107
|
+
address: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
108
|
+
decimals: 6
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
symbol: "WETH",
|
|
112
|
+
address: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
|
|
113
|
+
decimals: 18
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
symbol: "USDT0",
|
|
117
|
+
address: "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",
|
|
118
|
+
decimals: 6
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
},
|
|
122
|
+
[optimism.id]: {
|
|
123
|
+
name: optimism.name,
|
|
124
|
+
tokens: [
|
|
125
|
+
{ symbol: "ETH", address: NATIVE_TOKEN_ADDRESS, decimals: 18 },
|
|
126
|
+
{
|
|
127
|
+
symbol: "USDC",
|
|
128
|
+
address: "0x0b2c639c533813f4aa9d7837caf62653d097ff85",
|
|
129
|
+
decimals: 6
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
symbol: "WETH",
|
|
133
|
+
address: "0x4200000000000000000000000000000000000006",
|
|
134
|
+
decimals: 18
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
symbol: "USDT0",
|
|
138
|
+
address: "0x01bFF41798a0BcF287b996046Ca68b395DbC1071",
|
|
139
|
+
decimals: 6
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
},
|
|
143
|
+
[polygon.id]: {
|
|
144
|
+
name: polygon.name,
|
|
145
|
+
tokens: [
|
|
146
|
+
{ symbol: "ETH", address: NATIVE_TOKEN_ADDRESS, decimals: 18 },
|
|
147
|
+
{
|
|
148
|
+
symbol: "USDC",
|
|
149
|
+
address: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
|
|
150
|
+
decimals: 6
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
symbol: "WETH",
|
|
154
|
+
address: "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",
|
|
155
|
+
decimals: 18
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
symbol: "USDT0",
|
|
159
|
+
address: "0xc2132d05d31c914a87c6611c10748aeb04b58e8f",
|
|
160
|
+
decimals: 6
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
[bsc.id]: {
|
|
165
|
+
name: bsc.name,
|
|
166
|
+
tokens: [
|
|
167
|
+
{
|
|
168
|
+
symbol: "USDC",
|
|
169
|
+
address: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",
|
|
170
|
+
decimals: 18
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
symbol: "WETH",
|
|
174
|
+
address: "0x2170Ed0880ac9A755fd29B2688956BD959F933F8",
|
|
175
|
+
decimals: 18
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
symbol: "USDT",
|
|
179
|
+
address: "0x55d398326f99059fF775485246999027B3197955",
|
|
180
|
+
decimals: 18
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
};
|
|
64
185
|
function getChainId(chain) {
|
|
65
186
|
return typeof chain === "number" ? chain : chain.id;
|
|
66
187
|
}
|
|
@@ -274,13 +395,13 @@ function getTokenIcon(symbol) {
|
|
|
274
395
|
}
|
|
275
396
|
|
|
276
397
|
export {
|
|
277
|
-
chainRegistry,
|
|
278
398
|
DEFAULT_BACKEND_URL,
|
|
279
399
|
DEFAULT_SIGNER_ADDRESS,
|
|
280
400
|
NATIVE_TOKEN_ADDRESS,
|
|
281
401
|
CHAIN_BY_ID,
|
|
282
402
|
SOURCE_CHAINS,
|
|
283
403
|
SUPPORTED_CHAINS,
|
|
404
|
+
chainRegistry,
|
|
284
405
|
getChainId,
|
|
285
406
|
getChainObject,
|
|
286
407
|
getUsdcAddress,
|