@rhinestone/deposit-modal 0.1.31 → 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-S7HER5HU.mjs → DepositModalReown-7ZO7HUN3.mjs} +9 -5
- package/dist/{DepositModalReown-N7GCYZF7.cjs → DepositModalReown-VNKZT5A7.cjs} +12 -8
- package/dist/{WithdrawModalReown-DMDRLYTE.mjs → WithdrawModalReown-PMPLUJBE.mjs} +9 -5
- package/dist/{WithdrawModalReown-DJCJ5U7E.cjs → WithdrawModalReown-YP4PEERJ.cjs} +12 -8
- package/dist/{chunk-SZ35G2DT.cjs → chunk-4WXSBBHQ.cjs} +101 -107
- package/dist/{chunk-3ICS43XC.mjs → chunk-C6I5TFSL.mjs} +4 -0
- package/dist/{chunk-EVU7M7A6.mjs → chunk-DLFUXLAM.mjs} +14 -13
- package/dist/{chunk-SLI5FHTT.mjs → chunk-ECLVABYN.mjs} +34 -40
- package/dist/{chunk-AWFJFSPH.mjs → chunk-HNDZ6G5K.mjs} +166 -249
- package/dist/{chunk-PE6OK3FH.cjs → chunk-S4UBVD3H.cjs} +5 -1
- package/dist/{chunk-MU2BOEDN.cjs → chunk-SIGTZB3C.cjs} +244 -327
- package/dist/{chunk-CS6UIMCF.mjs → chunk-SJEIKMVO.mjs} +10 -2
- package/dist/{chunk-VKQA3FO3.cjs → chunk-V7I5T4SW.cjs} +9 -1
- package/dist/{chunk-G2RDCQHL.cjs → chunk-YIHOACM3.cjs} +38 -37
- package/dist/constants.cjs +2 -2
- package/dist/constants.mjs +1 -1
- package/dist/deposit.cjs +4 -4
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +3 -3
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +4 -4
- package/dist/reown.cjs +5 -5
- package/dist/reown.d.cts +1 -1
- package/dist/reown.d.ts +1 -1
- package/dist/reown.mjs +4 -4
- package/dist/{types-DTBfMH0p.d.ts → types-Bp2n2RQ3.d.ts} +0 -1
- package/dist/{types-DELv717e.d.cts → types-CIaQPR6F.d.cts} +0 -1
- package/dist/withdraw.cjs +4 -4
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +2 -2
- package/dist/withdraw.mjs +3 -3
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkYIHOACM3cjs = require('./chunk-YIHOACM3.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
@@ -29,7 +29,7 @@ var _chunkG2RDCQHLcjs = require('./chunk-G2RDCQHL.cjs');
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _chunkS4UBVD3Hcjs = require('./chunk-S4UBVD3H.cjs');
|
|
33
33
|
|
|
34
34
|
// src/WithdrawModal.tsx
|
|
35
35
|
|
|
@@ -75,6 +75,7 @@ function WithdrawFormStep({
|
|
|
75
75
|
onTargetChainChange,
|
|
76
76
|
onTargetTokenChange,
|
|
77
77
|
switchChain,
|
|
78
|
+
walletIcon,
|
|
78
79
|
submitting = false,
|
|
79
80
|
onSubmit,
|
|
80
81
|
onBalanceUsdChange
|
|
@@ -101,8 +102,8 @@ function WithdrawFormStep({
|
|
|
101
102
|
const chainMismatch = Boolean(
|
|
102
103
|
_optionalChain([walletClient, 'optionalAccess', _3 => _3.chain, 'optionalAccess', _4 => _4.id]) && walletClient.chain.id !== asset.chainId
|
|
103
104
|
);
|
|
104
|
-
const targetSymbol =
|
|
105
|
-
const targetChainName =
|
|
105
|
+
const targetSymbol = _chunkS4UBVD3Hcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
106
|
+
const targetChainName = _chunkS4UBVD3Hcjs.getChainName.call(void 0, targetChain);
|
|
106
107
|
const isBusy = submitting || isSubmitting;
|
|
107
108
|
_react.useEffect.call(void 0, () => {
|
|
108
109
|
if (chainMismatch && switchChain && !hasAttemptedSwitch.current) {
|
|
@@ -110,7 +111,7 @@ function WithdrawFormStep({
|
|
|
110
111
|
setIsSwitching(true);
|
|
111
112
|
switchChain(asset.chainId).catch((err) => {
|
|
112
113
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
113
|
-
setError(
|
|
114
|
+
setError(_chunkYIHOACM3cjs.formatUserError.call(void 0, raw));
|
|
114
115
|
}).finally(() => {
|
|
115
116
|
setIsSwitching(false);
|
|
116
117
|
});
|
|
@@ -127,7 +128,7 @@ function WithdrawFormStep({
|
|
|
127
128
|
return;
|
|
128
129
|
}
|
|
129
130
|
try {
|
|
130
|
-
const bal =
|
|
131
|
+
const bal = _chunkYIHOACM3cjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: safeAddress }) : await publicClient.readContract({
|
|
131
132
|
address: asset.token,
|
|
132
133
|
abi: _viem.erc20Abi,
|
|
133
134
|
functionName: "balanceOf",
|
|
@@ -229,23 +230,11 @@ function WithdrawFormStep({
|
|
|
229
230
|
await onSubmit(recipient, amount);
|
|
230
231
|
} catch (err) {
|
|
231
232
|
const raw = err instanceof Error ? err.message : "Withdrawal failed";
|
|
232
|
-
setError(
|
|
233
|
+
setError(_chunkYIHOACM3cjs.formatUserError.call(void 0, raw));
|
|
233
234
|
} finally {
|
|
234
235
|
setIsSubmitting(false);
|
|
235
236
|
}
|
|
236
237
|
}, [recipient, amount, balance, asset.decimals, onSubmit]);
|
|
237
|
-
const handleSwitch = async () => {
|
|
238
|
-
if (!asset.chainId || !switchChain) return;
|
|
239
|
-
setIsSwitching(true);
|
|
240
|
-
try {
|
|
241
|
-
await switchChain(asset.chainId);
|
|
242
|
-
} catch (err) {
|
|
243
|
-
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
244
|
-
setError(_chunkG2RDCQHLcjs.formatUserError.call(void 0, raw));
|
|
245
|
-
} finally {
|
|
246
|
-
setIsSwitching(false);
|
|
247
|
-
}
|
|
248
|
-
};
|
|
249
238
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
250
239
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body rs-withdraw-form", children: [
|
|
251
240
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-section", children: [
|
|
@@ -264,14 +253,22 @@ function WithdrawFormStep({
|
|
|
264
253
|
}
|
|
265
254
|
}
|
|
266
255
|
),
|
|
267
|
-
address && /* @__PURE__ */ _jsxruntime.
|
|
256
|
+
address && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
268
257
|
"button",
|
|
269
258
|
{
|
|
270
259
|
type: "button",
|
|
271
260
|
className: `rs-withdraw-use-connected ${isRecipientConnected ? "rs-withdraw-use-connected--active" : ""}`,
|
|
272
261
|
onClick: handleUseConnected,
|
|
273
262
|
title: isRecipientConnected ? "Using connected wallet" : "Use connected wallet",
|
|
274
|
-
children:
|
|
263
|
+
children: walletIcon ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
264
|
+
"img",
|
|
265
|
+
{
|
|
266
|
+
src: walletIcon,
|
|
267
|
+
alt: "Wallet",
|
|
268
|
+
style: { width: 18, height: 18, borderRadius: 4 },
|
|
269
|
+
className: "rs-withdraw-use-connected-icon"
|
|
270
|
+
}
|
|
271
|
+
) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
275
272
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
276
273
|
"svg",
|
|
277
274
|
{
|
|
@@ -291,7 +288,7 @@ function WithdrawFormStep({
|
|
|
291
288
|
}
|
|
292
289
|
),
|
|
293
290
|
isRecipientConnected ? null : "Wallet"
|
|
294
|
-
]
|
|
291
|
+
] })
|
|
295
292
|
}
|
|
296
293
|
)
|
|
297
294
|
] })
|
|
@@ -331,7 +328,7 @@ function WithdrawFormStep({
|
|
|
331
328
|
] })
|
|
332
329
|
] }),
|
|
333
330
|
/* @__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 ?
|
|
331
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ? _chunkYIHOACM3cjs.currencyFormatter.format(amountUsd) : "$0.00" }),
|
|
335
332
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-withdraw-balance", children: [
|
|
336
333
|
formattedBalance,
|
|
337
334
|
" ",
|
|
@@ -359,10 +356,10 @@ function WithdrawFormStep({
|
|
|
359
356
|
},
|
|
360
357
|
children: [
|
|
361
358
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-dropdown-value", children: [
|
|
362
|
-
|
|
359
|
+
_chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, targetSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
363
360
|
"img",
|
|
364
361
|
{
|
|
365
|
-
src:
|
|
362
|
+
src: _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, targetSymbol),
|
|
366
363
|
alt: targetSymbol,
|
|
367
364
|
className: "rs-withdraw-dropdown-icon"
|
|
368
365
|
}
|
|
@@ -403,10 +400,10 @@ function WithdrawFormStep({
|
|
|
403
400
|
setShowTokenDropdown(false);
|
|
404
401
|
},
|
|
405
402
|
children: [
|
|
406
|
-
|
|
403
|
+
_chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, option.symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
407
404
|
"img",
|
|
408
405
|
{
|
|
409
|
-
src:
|
|
406
|
+
src: _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, option.symbol),
|
|
410
407
|
alt: option.symbol,
|
|
411
408
|
className: "rs-withdraw-dropdown-icon"
|
|
412
409
|
}
|
|
@@ -439,10 +436,10 @@ function WithdrawFormStep({
|
|
|
439
436
|
},
|
|
440
437
|
children: [
|
|
441
438
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-dropdown-value", children: [
|
|
442
|
-
|
|
439
|
+
_chunkS4UBVD3Hcjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
443
440
|
"img",
|
|
444
441
|
{
|
|
445
|
-
src:
|
|
442
|
+
src: _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, targetChain),
|
|
446
443
|
alt: targetChainName,
|
|
447
444
|
className: "rs-withdraw-dropdown-icon"
|
|
448
445
|
}
|
|
@@ -483,10 +480,10 @@ function WithdrawFormStep({
|
|
|
483
480
|
setShowChainDropdown(false);
|
|
484
481
|
},
|
|
485
482
|
children: [
|
|
486
|
-
|
|
483
|
+
_chunkS4UBVD3Hcjs.getChainIcon.call(void 0, chain.id) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
487
484
|
"img",
|
|
488
485
|
{
|
|
489
|
-
src:
|
|
486
|
+
src: _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, chain.id),
|
|
490
487
|
alt: chain.name,
|
|
491
488
|
className: "rs-withdraw-dropdown-icon"
|
|
492
489
|
}
|
|
@@ -501,23 +498,7 @@ function WithdrawFormStep({
|
|
|
501
498
|
)
|
|
502
499
|
] })
|
|
503
500
|
] }),
|
|
504
|
-
chainMismatch && /* @__PURE__ */ _jsxruntime.
|
|
505
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch-text", children: [
|
|
506
|
-
"Switch to ",
|
|
507
|
-
_chunkPE6OK3FHcjs.getChainName.call(void 0, asset.chainId),
|
|
508
|
-
" to continue."
|
|
509
|
-
] }),
|
|
510
|
-
switchChain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
511
|
-
_chunkG2RDCQHLcjs.Button,
|
|
512
|
-
{
|
|
513
|
-
variant: "outline",
|
|
514
|
-
size: "small",
|
|
515
|
-
loading: isSwitching,
|
|
516
|
-
onClick: handleSwitch,
|
|
517
|
-
children: "Switch"
|
|
518
|
-
}
|
|
519
|
-
)
|
|
520
|
-
] }),
|
|
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.` }) }),
|
|
521
502
|
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-error", children: [
|
|
522
503
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
523
504
|
"svg",
|
|
@@ -540,7 +521,7 @@ function WithdrawFormStep({
|
|
|
540
521
|
] })
|
|
541
522
|
] }),
|
|
542
523
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
543
|
-
|
|
524
|
+
_chunkYIHOACM3cjs.Button,
|
|
544
525
|
{
|
|
545
526
|
onClick: handleWithdraw,
|
|
546
527
|
fullWidth: true,
|
|
@@ -549,7 +530,7 @@ function WithdrawFormStep({
|
|
|
549
530
|
children: isBusy ? "Preparing..." : "Withdraw"
|
|
550
531
|
}
|
|
551
532
|
) }),
|
|
552
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
533
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYIHOACM3cjs.PoweredBy, {})
|
|
553
534
|
] });
|
|
554
535
|
}
|
|
555
536
|
WithdrawFormStep.displayName = "WithdrawFormStep";
|
|
@@ -632,7 +613,7 @@ async function executeSafeEthTransfer(params) {
|
|
|
632
613
|
throw new Error("Wallet not connected");
|
|
633
614
|
}
|
|
634
615
|
if (chain.id !== chainId) {
|
|
635
|
-
throw new Error(`Switch to ${
|
|
616
|
+
throw new Error(`Switch to ${_chunkS4UBVD3Hcjs.getChainName.call(void 0, chainId)} to sign`);
|
|
636
617
|
}
|
|
637
618
|
const isOwner = await publicClient.readContract({
|
|
638
619
|
address: safeAddress,
|
|
@@ -715,7 +696,7 @@ async function executeSafeErc20Transfer(params) {
|
|
|
715
696
|
throw new Error("Wallet not connected");
|
|
716
697
|
}
|
|
717
698
|
if (chain.id !== chainId) {
|
|
718
|
-
throw new Error(`Switch to ${
|
|
699
|
+
throw new Error(`Switch to ${_chunkS4UBVD3Hcjs.getChainName.call(void 0, chainId)} to sign`);
|
|
719
700
|
}
|
|
720
701
|
const isOwner = await publicClient.readContract({
|
|
721
702
|
address: safeAddress,
|
|
@@ -854,12 +835,13 @@ function WithdrawFlow({
|
|
|
854
835
|
recipient: defaultRecipient,
|
|
855
836
|
amount: defaultAmount,
|
|
856
837
|
service,
|
|
857
|
-
signerAddress =
|
|
838
|
+
signerAddress = _chunkS4UBVD3Hcjs.DEFAULT_SIGNER_ADDRESS,
|
|
858
839
|
sessionChainIds,
|
|
859
840
|
forceRegister = false,
|
|
860
841
|
waitForFinalTx = true,
|
|
861
842
|
reownWallet,
|
|
862
843
|
onConnect,
|
|
844
|
+
onDisconnect,
|
|
863
845
|
onSignTransaction,
|
|
864
846
|
onRequestConnect,
|
|
865
847
|
connectButtonLabel,
|
|
@@ -901,11 +883,12 @@ function WithdrawFlow({
|
|
|
901
883
|
});
|
|
902
884
|
seen.add(dappWalletClient.account.address.toLowerCase());
|
|
903
885
|
}
|
|
904
|
-
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())) {
|
|
905
887
|
options.push({
|
|
906
888
|
address: reownWallet.address,
|
|
907
889
|
label: "External Wallet",
|
|
908
|
-
kind: "external"
|
|
890
|
+
kind: "external",
|
|
891
|
+
icon: reownWallet.icon
|
|
909
892
|
});
|
|
910
893
|
}
|
|
911
894
|
return options;
|
|
@@ -913,9 +896,11 @@ function WithdrawFlow({
|
|
|
913
896
|
dappWalletClient,
|
|
914
897
|
dappAddress,
|
|
915
898
|
_optionalChain([reownWallet, 'optionalAccess', _11 => _11.address]),
|
|
916
|
-
_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])
|
|
917
902
|
]);
|
|
918
|
-
const canAutoLock = (_optionalChain([dappWalletClient, 'optionalAccess',
|
|
903
|
+
const canAutoLock = (_optionalChain([dappWalletClient, 'optionalAccess', _15 => _15.account]) && dappAddress || hasCustomSigner) && !reownWallet;
|
|
919
904
|
const [selectedConnectAddress, setSelectedConnectAddress] = _react.useState.call(void 0, null);
|
|
920
905
|
const signerContext = _react.useMemo.call(void 0, () => {
|
|
921
906
|
if (canAutoLock) {
|
|
@@ -923,27 +908,27 @@ function WithdrawFlow({
|
|
|
923
908
|
return {
|
|
924
909
|
ownerAddress: dappAddress,
|
|
925
910
|
walletClient: _nullishCoalesce(dappWalletClient, () => ( void 0)),
|
|
926
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
911
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkYIHOACM3cjs.getPublicClient.call(void 0, sourceChain))),
|
|
927
912
|
switchChain: dappSwitchChain
|
|
928
913
|
};
|
|
929
914
|
}
|
|
930
915
|
return {
|
|
931
916
|
ownerAddress: dappWalletClient.account.address,
|
|
932
917
|
walletClient: dappWalletClient,
|
|
933
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
918
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkYIHOACM3cjs.getPublicClient.call(void 0, sourceChain))),
|
|
934
919
|
switchChain: dappSwitchChain
|
|
935
920
|
};
|
|
936
921
|
}
|
|
937
922
|
if (!isConnectSelectionConfirmed || !selectedConnectAddress) return null;
|
|
938
|
-
if (_optionalChain([dappWalletClient, 'optionalAccess',
|
|
923
|
+
if (_optionalChain([dappWalletClient, 'optionalAccess', _16 => _16.account]) && dappWalletClient.account.address.toLowerCase() === selectedConnectAddress.toLowerCase()) {
|
|
939
924
|
return {
|
|
940
925
|
ownerAddress: dappWalletClient.account.address,
|
|
941
926
|
walletClient: dappWalletClient,
|
|
942
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
927
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkYIHOACM3cjs.getPublicClient.call(void 0, sourceChain))),
|
|
943
928
|
switchChain: dappSwitchChain
|
|
944
929
|
};
|
|
945
930
|
}
|
|
946
|
-
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) {
|
|
947
932
|
return {
|
|
948
933
|
ownerAddress: reownWallet.address,
|
|
949
934
|
walletClient: reownWallet.walletClient,
|
|
@@ -965,10 +950,10 @@ function WithdrawFlow({
|
|
|
965
950
|
sourceChain
|
|
966
951
|
]);
|
|
967
952
|
const asset = _react.useMemo.call(void 0, () => {
|
|
968
|
-
const symbol =
|
|
969
|
-
const decimals =
|
|
953
|
+
const symbol = _chunkS4UBVD3Hcjs.getTokenSymbol.call(void 0, sourceToken, sourceChain);
|
|
954
|
+
const decimals = _chunkS4UBVD3Hcjs.getTokenDecimalsByAddress.call(void 0, sourceToken, sourceChain);
|
|
970
955
|
return {
|
|
971
|
-
id:
|
|
956
|
+
id: _chunkYIHOACM3cjs.getAssetId.call(void 0, { chainId: sourceChain, token: sourceToken }),
|
|
972
957
|
chainId: sourceChain,
|
|
973
958
|
token: sourceToken,
|
|
974
959
|
symbol,
|
|
@@ -976,37 +961,37 @@ function WithdrawFlow({
|
|
|
976
961
|
decimals
|
|
977
962
|
};
|
|
978
963
|
}, [sourceChain, sourceToken]);
|
|
979
|
-
const isSourceNative = sourceToken.toLowerCase() ===
|
|
964
|
+
const isSourceNative = sourceToken.toLowerCase() === _chunkS4UBVD3Hcjs.NATIVE_TOKEN_ADDRESS.toLowerCase();
|
|
980
965
|
const stepIndex = step.type === "form" ? 0 : 1;
|
|
981
966
|
const currentBackHandler = void 0;
|
|
982
967
|
_react.useEffect.call(void 0, () => {
|
|
983
|
-
_optionalChain([onStepChange, 'optionalCall',
|
|
968
|
+
_optionalChain([onStepChange, 'optionalCall', _20 => _20(stepIndex, currentBackHandler)]);
|
|
984
969
|
}, [stepIndex, currentBackHandler, onStepChange]);
|
|
985
970
|
_react.useEffect.call(void 0, () => {
|
|
986
|
-
_optionalChain([onTotalBalanceChange, 'optionalCall',
|
|
971
|
+
_optionalChain([onTotalBalanceChange, 'optionalCall', _21 => _21(totalBalanceUsd)]);
|
|
987
972
|
}, [totalBalanceUsd, onTotalBalanceChange]);
|
|
988
973
|
const handleConnected = _react.useCallback.call(void 0,
|
|
989
974
|
(addr, smartAccount) => {
|
|
990
|
-
_optionalChain([onConnected, 'optionalCall',
|
|
975
|
+
_optionalChain([onConnected, 'optionalCall', _22 => _22({ address: addr, smartAccount })]);
|
|
991
976
|
},
|
|
992
977
|
[onConnected]
|
|
993
978
|
);
|
|
994
979
|
const handleError = _react.useCallback.call(void 0,
|
|
995
980
|
(message, code) => {
|
|
996
|
-
_optionalChain([onError, 'optionalCall',
|
|
981
|
+
_optionalChain([onError, 'optionalCall', _23 => _23({ message, code })]);
|
|
997
982
|
},
|
|
998
983
|
[onError]
|
|
999
984
|
);
|
|
1000
985
|
const resolveSessionOwner = _react.useCallback.call(void 0, async (eoaAddress) => {
|
|
1001
|
-
const localOwner =
|
|
986
|
+
const localOwner = _chunkYIHOACM3cjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
|
|
1002
987
|
if (localOwner) {
|
|
1003
988
|
return {
|
|
1004
|
-
account:
|
|
989
|
+
account: _chunkYIHOACM3cjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
|
|
1005
990
|
address: localOwner.address
|
|
1006
991
|
};
|
|
1007
992
|
}
|
|
1008
|
-
const created =
|
|
1009
|
-
|
|
993
|
+
const created = _chunkYIHOACM3cjs.createSessionOwnerKey.call(void 0, );
|
|
994
|
+
_chunkYIHOACM3cjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
|
|
1010
995
|
return {
|
|
1011
996
|
account: created.account,
|
|
1012
997
|
address: created.address
|
|
@@ -1014,11 +999,11 @@ function WithdrawFlow({
|
|
|
1014
999
|
}, []);
|
|
1015
1000
|
const handleFormSubmit = _react.useCallback.call(void 0,
|
|
1016
1001
|
async (recipient, amountValue) => {
|
|
1017
|
-
const ownerAddress2 = _optionalChain([signerContext, 'optionalAccess',
|
|
1002
|
+
const ownerAddress2 = _optionalChain([signerContext, 'optionalAccess', _24 => _24.ownerAddress]);
|
|
1018
1003
|
if (!ownerAddress2) {
|
|
1019
1004
|
throw new Error("Wallet not connected");
|
|
1020
1005
|
}
|
|
1021
|
-
if (!onSignTransaction && !_optionalChain([signerContext, 'optionalAccess',
|
|
1006
|
+
if (!onSignTransaction && !_optionalChain([signerContext, 'optionalAccess', _25 => _25.walletClient])) {
|
|
1022
1007
|
throw new Error("Wallet not connected");
|
|
1023
1008
|
}
|
|
1024
1009
|
setIsSubmitting(true);
|
|
@@ -1050,7 +1035,7 @@ function WithdrawFlow({
|
|
|
1050
1035
|
primaryType: typedData.primaryType,
|
|
1051
1036
|
message: typedData.message
|
|
1052
1037
|
});
|
|
1053
|
-
const sessionDetails =
|
|
1038
|
+
const sessionDetails = _chunkYIHOACM3cjs.buildSessionDetails.call(void 0, setup.sessionDetailsUnsigned, signature);
|
|
1054
1039
|
await service.registerAccount({
|
|
1055
1040
|
address: smartAccount,
|
|
1056
1041
|
accountParams: {
|
|
@@ -1069,7 +1054,7 @@ function WithdrawFlow({
|
|
|
1069
1054
|
}
|
|
1070
1055
|
handleConnected(ownerAddress2, smartAccount);
|
|
1071
1056
|
const amountUnits = _viem.parseUnits.call(void 0, amountValue, asset.decimals);
|
|
1072
|
-
const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess',
|
|
1057
|
+
const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _26 => _26.publicClient]), () => ( _chunkYIHOACM3cjs.getPublicClient.call(void 0, sourceChain)));
|
|
1073
1058
|
let result;
|
|
1074
1059
|
if (onSignTransaction) {
|
|
1075
1060
|
const transferData = isSourceNative ? { to: smartAccount, value: amountUnits, data: "0x" } : {
|
|
@@ -1121,7 +1106,7 @@ function WithdrawFlow({
|
|
|
1121
1106
|
chainId: sourceChain
|
|
1122
1107
|
});
|
|
1123
1108
|
}
|
|
1124
|
-
_optionalChain([onWithdrawSubmitted, 'optionalCall',
|
|
1109
|
+
_optionalChain([onWithdrawSubmitted, 'optionalCall', _27 => _27({
|
|
1125
1110
|
txHash: result.txHash,
|
|
1126
1111
|
sourceChain,
|
|
1127
1112
|
amount: amountUnits.toString(),
|
|
@@ -1137,7 +1122,7 @@ function WithdrawFlow({
|
|
|
1137
1122
|
});
|
|
1138
1123
|
} catch (err) {
|
|
1139
1124
|
const raw = err instanceof Error ? err.message : "Withdraw failed";
|
|
1140
|
-
handleError(
|
|
1125
|
+
handleError(_chunkYIHOACM3cjs.formatUserError.call(void 0, raw), "WITHDRAW_FLOW_ERROR");
|
|
1141
1126
|
throw err;
|
|
1142
1127
|
} finally {
|
|
1143
1128
|
setIsSubmitting(false);
|
|
@@ -1165,23 +1150,23 @@ function WithdrawFlow({
|
|
|
1165
1150
|
);
|
|
1166
1151
|
const handleWithdrawComplete = _react.useCallback.call(void 0,
|
|
1167
1152
|
(txHash, destinationTxHash) => {
|
|
1168
|
-
_optionalChain([onWithdrawComplete, 'optionalCall',
|
|
1153
|
+
_optionalChain([onWithdrawComplete, 'optionalCall', _28 => _28({ txHash, destinationTxHash })]);
|
|
1169
1154
|
},
|
|
1170
1155
|
[onWithdrawComplete]
|
|
1171
1156
|
);
|
|
1172
1157
|
const handleWithdrawFailed = _react.useCallback.call(void 0,
|
|
1173
1158
|
(txHash, error) => {
|
|
1174
|
-
_optionalChain([onWithdrawFailed, 'optionalCall',
|
|
1159
|
+
_optionalChain([onWithdrawFailed, 'optionalCall', _29 => _29({ txHash, error })]);
|
|
1175
1160
|
},
|
|
1176
1161
|
[onWithdrawFailed]
|
|
1177
1162
|
);
|
|
1178
1163
|
const targetChainOptions = _react.useMemo.call(void 0, () => {
|
|
1179
|
-
return
|
|
1180
|
-
(chain) =>
|
|
1164
|
+
return _chunkS4UBVD3Hcjs.SOURCE_CHAINS.filter(
|
|
1165
|
+
(chain) => _chunkS4UBVD3Hcjs.getSupportedTargetTokens.call(void 0, chain.id).length > 0
|
|
1181
1166
|
);
|
|
1182
1167
|
}, []);
|
|
1183
1168
|
const targetTokenOptions = _react.useMemo.call(void 0,
|
|
1184
|
-
() =>
|
|
1169
|
+
() => _chunkS4UBVD3Hcjs.getSupportedTargetTokens.call(void 0, targetChain),
|
|
1185
1170
|
[targetChain]
|
|
1186
1171
|
);
|
|
1187
1172
|
_react.useEffect.call(void 0, () => {
|
|
@@ -1196,7 +1181,7 @@ function WithdrawFlow({
|
|
|
1196
1181
|
const handleTargetChainChange = _react.useCallback.call(void 0,
|
|
1197
1182
|
(chainId) => {
|
|
1198
1183
|
setTargetChain(chainId);
|
|
1199
|
-
const options =
|
|
1184
|
+
const options = _chunkS4UBVD3Hcjs.getSupportedTargetTokens.call(void 0, chainId);
|
|
1200
1185
|
if (options.length === 0) {
|
|
1201
1186
|
return;
|
|
1202
1187
|
}
|
|
@@ -1229,13 +1214,14 @@ function WithdrawFlow({
|
|
|
1229
1214
|
}, [walletOptionsKey, selectedConnectAddressEffective]);
|
|
1230
1215
|
if (showConnectStep) {
|
|
1231
1216
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1232
|
-
|
|
1217
|
+
_chunkYIHOACM3cjs.ConnectStep,
|
|
1233
1218
|
{
|
|
1234
1219
|
walletOptions,
|
|
1235
1220
|
selectedAddress: selectedConnectAddressEffective,
|
|
1236
1221
|
onSelectAddress: setSelectedConnectAddress,
|
|
1237
1222
|
onRequestConnect,
|
|
1238
1223
|
onConnect,
|
|
1224
|
+
onDisconnect,
|
|
1239
1225
|
onContinue: () => {
|
|
1240
1226
|
if (selectedConnectAddressEffective) {
|
|
1241
1227
|
setSelectedConnectAddress(selectedConnectAddressEffective);
|
|
@@ -1249,7 +1235,13 @@ function WithdrawFlow({
|
|
|
1249
1235
|
if (!signerContext) return null;
|
|
1250
1236
|
if (!onSignTransaction && !signerContext.walletClient) return null;
|
|
1251
1237
|
const ownerAddress = signerContext.ownerAddress;
|
|
1252
|
-
const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => (
|
|
1238
|
+
const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => ( _chunkYIHOACM3cjs.getPublicClient.call(void 0, sourceChain)));
|
|
1239
|
+
const selectedWalletIcon = _react.useMemo.call(void 0, () => {
|
|
1240
|
+
const selected = walletOptions.find(
|
|
1241
|
+
(o) => o.address.toLowerCase() === ownerAddress.toLowerCase()
|
|
1242
|
+
);
|
|
1243
|
+
return _nullishCoalesce(_optionalChain([selected, 'optionalAccess', _30 => _30.icon]), () => ( _optionalChain([reownWallet, 'optionalAccess', _31 => _31.icon])));
|
|
1244
|
+
}, [walletOptions, ownerAddress, _optionalChain([reownWallet, 'optionalAccess', _32 => _32.icon])]);
|
|
1253
1245
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
1254
1246
|
step.type === "form" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1255
1247
|
WithdrawFormStep,
|
|
@@ -1268,20 +1260,20 @@ function WithdrawFlow({
|
|
|
1268
1260
|
onTargetChainChange: handleTargetChainChange,
|
|
1269
1261
|
onTargetTokenChange: handleTargetTokenChange,
|
|
1270
1262
|
switchChain: signerContext.switchChain,
|
|
1263
|
+
walletIcon: selectedWalletIcon,
|
|
1271
1264
|
submitting: isSubmitting,
|
|
1272
1265
|
onSubmit: handleFormSubmit,
|
|
1273
1266
|
onBalanceUsdChange: setTotalBalanceUsd
|
|
1274
1267
|
}
|
|
1275
1268
|
),
|
|
1276
1269
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1277
|
-
|
|
1270
|
+
_chunkYIHOACM3cjs.ProcessingStep,
|
|
1278
1271
|
{
|
|
1279
1272
|
smartAccount: step.smartAccount,
|
|
1280
1273
|
txHash: step.txHash,
|
|
1281
1274
|
sourceChain: step.sourceChain,
|
|
1282
1275
|
sourceToken: step.sourceToken,
|
|
1283
1276
|
targetChain,
|
|
1284
|
-
targetToken,
|
|
1285
1277
|
amount: step.amount,
|
|
1286
1278
|
waitForFinalTx,
|
|
1287
1279
|
service,
|
|
@@ -1300,7 +1292,7 @@ function WithdrawFlow({
|
|
|
1300
1292
|
// src/WithdrawModal.tsx
|
|
1301
1293
|
|
|
1302
1294
|
var ReownWithdrawInner = _react.lazy.call(void 0,
|
|
1303
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-
|
|
1295
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-YP4PEERJ.cjs"))).then((m) => ({
|
|
1304
1296
|
default: m.WithdrawModalReown
|
|
1305
1297
|
}))
|
|
1306
1298
|
);
|
|
@@ -1326,13 +1318,14 @@ function WithdrawModalInner({
|
|
|
1326
1318
|
isOpen,
|
|
1327
1319
|
onClose,
|
|
1328
1320
|
inline,
|
|
1329
|
-
backendUrl =
|
|
1330
|
-
signerAddress =
|
|
1321
|
+
backendUrl = _chunkS4UBVD3Hcjs.DEFAULT_BACKEND_URL,
|
|
1322
|
+
signerAddress = _chunkS4UBVD3Hcjs.DEFAULT_SIGNER_ADDRESS,
|
|
1331
1323
|
sessionChainIds,
|
|
1332
1324
|
forceRegister = false,
|
|
1333
1325
|
waitForFinalTx = true,
|
|
1334
1326
|
reownWallet,
|
|
1335
1327
|
onConnect,
|
|
1328
|
+
onDisconnect,
|
|
1336
1329
|
onSignTransaction,
|
|
1337
1330
|
onRequestConnect,
|
|
1338
1331
|
connectButtonLabel,
|
|
@@ -1352,19 +1345,19 @@ function WithdrawModalInner({
|
|
|
1352
1345
|
const [currentStepIndex, setCurrentStepIndex] = _react.useState.call(void 0, 0);
|
|
1353
1346
|
const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, null);
|
|
1354
1347
|
const backHandlerRef = _react.useRef.call(void 0, void 0);
|
|
1355
|
-
const targetChain =
|
|
1356
|
-
const sourceChain =
|
|
1357
|
-
const service = _react.useMemo.call(void 0, () =>
|
|
1348
|
+
const targetChain = _chunkS4UBVD3Hcjs.getChainId.call(void 0, targetChainProp);
|
|
1349
|
+
const sourceChain = _chunkS4UBVD3Hcjs.getChainId.call(void 0, sourceChainProp);
|
|
1350
|
+
const service = _react.useMemo.call(void 0, () => _chunkYIHOACM3cjs.createDepositService.call(void 0, backendUrl), [backendUrl]);
|
|
1358
1351
|
_react.useEffect.call(void 0, () => {
|
|
1359
1352
|
if (isOpen && modalRef.current) {
|
|
1360
|
-
|
|
1353
|
+
_chunkYIHOACM3cjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
1361
1354
|
}
|
|
1362
1355
|
}, [isOpen, theme]);
|
|
1363
1356
|
const hasCalledReady = _react.useRef.call(void 0, false);
|
|
1364
1357
|
_react.useEffect.call(void 0, () => {
|
|
1365
1358
|
if (isOpen && !hasCalledReady.current) {
|
|
1366
1359
|
hasCalledReady.current = true;
|
|
1367
|
-
_optionalChain([onReady, 'optionalCall',
|
|
1360
|
+
_optionalChain([onReady, 'optionalCall', _33 => _33()]);
|
|
1368
1361
|
}
|
|
1369
1362
|
}, [isOpen, onReady]);
|
|
1370
1363
|
_react.useEffect.call(void 0, () => {
|
|
@@ -1383,17 +1376,17 @@ function WithdrawModalInner({
|
|
|
1383
1376
|
setTotalBalanceUsd(balance2);
|
|
1384
1377
|
}, []);
|
|
1385
1378
|
const handleBack = _react.useCallback.call(void 0, () => {
|
|
1386
|
-
_optionalChain([backHandlerRef, 'access',
|
|
1379
|
+
_optionalChain([backHandlerRef, 'access', _34 => _34.current, 'optionalCall', _35 => _35()]);
|
|
1387
1380
|
}, []);
|
|
1388
|
-
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
1389
|
-
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
1390
|
-
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
1391
|
-
const balance = _optionalChain([uiConfig, 'optionalAccess',
|
|
1392
|
-
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess',
|
|
1393
|
-
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"));
|
|
1394
1387
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 3 && backHandlerRef.current;
|
|
1395
1388
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1396
|
-
|
|
1389
|
+
_chunkYIHOACM3cjs.Modal,
|
|
1397
1390
|
{
|
|
1398
1391
|
isOpen,
|
|
1399
1392
|
onClose,
|
|
@@ -1451,7 +1444,7 @@ function WithdrawModalInner({
|
|
|
1451
1444
|
] }),
|
|
1452
1445
|
balance && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header-balance", children: [
|
|
1453
1446
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-label", children: balance.title }),
|
|
1454
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ?
|
|
1447
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ? _chunkYIHOACM3cjs.currencyFormatter.format(totalBalanceUsd) : null))) })
|
|
1455
1448
|
] })
|
|
1456
1449
|
] }),
|
|
1457
1450
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1501,6 +1494,7 @@ function WithdrawModalInner({
|
|
|
1501
1494
|
waitForFinalTx,
|
|
1502
1495
|
reownWallet,
|
|
1503
1496
|
onConnect,
|
|
1497
|
+
onDisconnect,
|
|
1504
1498
|
onSignTransaction,
|
|
1505
1499
|
onRequestConnect,
|
|
1506
1500
|
connectButtonLabel,
|
|
@@ -341,6 +341,9 @@ function getTokenSymbol(token, chainId) {
|
|
|
341
341
|
}
|
|
342
342
|
return "Token";
|
|
343
343
|
}
|
|
344
|
+
function isStablecoinSymbol(symbol) {
|
|
345
|
+
return /^(usdc|usdt|dai|usd)$/i.test(symbol);
|
|
346
|
+
}
|
|
344
347
|
var CHAIN_BADGES = {
|
|
345
348
|
[mainnet.id]: { shortLabel: "ETH", color: "#627EEA", bg: "#EEF2FF" },
|
|
346
349
|
[base.id]: { shortLabel: "Base", color: "#0052FF", bg: "#E7F0FF" },
|
|
@@ -420,6 +423,7 @@ export {
|
|
|
420
423
|
getTokenDecimalsByAddress,
|
|
421
424
|
findChainIdForToken,
|
|
422
425
|
getTokenSymbol,
|
|
426
|
+
isStablecoinSymbol,
|
|
423
427
|
getChainName,
|
|
424
428
|
getChainBadge,
|
|
425
429
|
getExplorerUrl,
|