@rhinestone/deposit-modal 0.3.1 → 0.4.1
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-G7UX4IBZ.mjs → DepositModalReown-EXI7MW65.mjs} +6 -6
- package/dist/{DepositModalReown-MECHBE6P.cjs → DepositModalReown-FMAPWBQM.cjs} +9 -9
- package/dist/{WithdrawModalReown-WJ6VBZKK.cjs → WithdrawModalReown-CTT3EXMG.cjs} +8 -8
- package/dist/{WithdrawModalReown-CUJAFUQM.mjs → WithdrawModalReown-G7EM6HXO.mjs} +5 -5
- package/dist/{chunk-DZQD3DAV.mjs → chunk-3GLQC2KQ.mjs} +86 -18
- package/dist/{chunk-R5WDHHVM.mjs → chunk-43RTPRQY.mjs} +14 -4
- package/dist/{chunk-3C35DVPE.mjs → chunk-A33QFRKD.mjs} +985 -428
- package/dist/{chunk-MILJQWPT.cjs → chunk-ABVRVW3P.cjs} +133 -8
- package/dist/{chunk-SPUZLWQS.cjs → chunk-BTDRUAPJ.cjs} +514 -543
- package/dist/{chunk-TQ2AYMWS.mjs → chunk-F7P4MV72.mjs} +1 -1
- package/dist/{chunk-BAEB5AFZ.mjs → chunk-FJWLC4AM.mjs} +1 -1
- package/dist/{chunk-LEL6GMEQ.cjs → chunk-JHT2MJ42.cjs} +175 -107
- package/dist/{chunk-MQIJZNTP.cjs → chunk-LJJCPDZO.cjs} +844 -287
- package/dist/{chunk-R5CPOBCF.cjs → chunk-NRNJAQUA.cjs} +4 -4
- package/dist/{chunk-QYSCCX4K.mjs → chunk-RTAIW3WW.mjs} +452 -481
- package/dist/{chunk-AJHFNHG3.cjs → chunk-UEKPBRBY.cjs} +3 -3
- package/dist/{chunk-ULEAK63T.cjs → chunk-ULCCXH2A.cjs} +16 -6
- package/dist/{chunk-6YRDD462.mjs → chunk-WJX3TJFK.mjs} +135 -10
- package/dist/constants.cjs +2 -2
- package/dist/constants.mjs +1 -1
- package/dist/deposit.cjs +6 -6
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +5 -5
- package/dist/index.cjs +7 -7
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +6 -6
- package/dist/polymarket.cjs +6 -6
- package/dist/polymarket.mjs +3 -3
- package/dist/styles.css +276 -27
- package/dist/{types-RzfAD14B.d.ts → types-CFRuisqK.d.cts} +1 -1
- package/dist/{types-RzfAD14B.d.cts → types-CFRuisqK.d.ts} +1 -1
- package/dist/withdraw.cjs +5 -5
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +2 -2
- package/dist/withdraw.mjs +4 -4
- package/package.json +1 -1
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
var _chunkMQIJZNTPcjs = require('./chunk-MQIJZNTP.cjs');
|
|
31
30
|
|
|
32
31
|
|
|
33
32
|
|
|
33
|
+
var _chunkLJJCPDZOcjs = require('./chunk-LJJCPDZO.cjs');
|
|
34
34
|
|
|
35
|
-
var _chunkAJHFNHG3cjs = require('./chunk-AJHFNHG3.cjs');
|
|
36
35
|
|
|
37
36
|
|
|
38
37
|
|
|
38
|
+
var _chunkUEKPBRBYcjs = require('./chunk-UEKPBRBY.cjs');
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
|
|
@@ -46,7 +46,10 @@ var _chunkAJHFNHG3cjs = require('./chunk-AJHFNHG3.cjs');
|
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
var _chunkABVRVW3Pcjs = require('./chunk-ABVRVW3P.cjs');
|
|
50
53
|
|
|
51
54
|
// src/WithdrawModal.tsx
|
|
52
55
|
|
|
@@ -237,8 +240,8 @@ function WithdrawFormStep({
|
|
|
237
240
|
const chainMismatch = Boolean(
|
|
238
241
|
_optionalChain([walletClient, 'optionalAccess', _3 => _3.chain, 'optionalAccess', _4 => _4.id]) && walletClient.chain.id !== asset.chainId
|
|
239
242
|
);
|
|
240
|
-
const targetSymbol =
|
|
241
|
-
const targetChainName =
|
|
243
|
+
const targetSymbol = _chunkABVRVW3Pcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
244
|
+
const targetChainName = _chunkABVRVW3Pcjs.getChainName.call(void 0, targetChain);
|
|
242
245
|
const isBusy = submitting || isSubmitting;
|
|
243
246
|
const seededRecipientRef = _react.useRef.call(void 0, _nullishCoalesce(defaultRecipient, () => ( "")));
|
|
244
247
|
_react.useEffect.call(void 0, () => {
|
|
@@ -257,7 +260,7 @@ function WithdrawFormStep({
|
|
|
257
260
|
setIsSwitching(true);
|
|
258
261
|
switchChain(asset.chainId).catch((err) => {
|
|
259
262
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
260
|
-
setError(
|
|
263
|
+
setError(_chunkLJJCPDZOcjs.formatUserError.call(void 0, raw));
|
|
261
264
|
}).finally(() => {
|
|
262
265
|
setIsSwitching(false);
|
|
263
266
|
});
|
|
@@ -277,7 +280,7 @@ function WithdrawFormStep({
|
|
|
277
280
|
return;
|
|
278
281
|
}
|
|
279
282
|
try {
|
|
280
|
-
const bal =
|
|
283
|
+
const bal = _chunkLJJCPDZOcjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: safeAddress }) : await publicClient.readContract({
|
|
281
284
|
address: asset.token,
|
|
282
285
|
abi: _viem.erc20Abi,
|
|
283
286
|
functionName: "balanceOf",
|
|
@@ -381,7 +384,7 @@ function WithdrawFormStep({
|
|
|
381
384
|
await onSubmit(recipient, amount);
|
|
382
385
|
} catch (err) {
|
|
383
386
|
const raw = err instanceof Error ? err.message : "Withdrawal failed";
|
|
384
|
-
setError(
|
|
387
|
+
setError(_chunkLJJCPDZOcjs.formatUserError.call(void 0, raw));
|
|
385
388
|
} finally {
|
|
386
389
|
setIsSubmitting(false);
|
|
387
390
|
}
|
|
@@ -389,16 +392,16 @@ function WithdrawFormStep({
|
|
|
389
392
|
if (isBalanceLoading) {
|
|
390
393
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
391
394
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-withdraw-loading", children: [
|
|
392
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
395
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLJJCPDZOcjs.Spinner, { className: "rs-spinner--lg" }),
|
|
393
396
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-loading-title", children: "Loading on-chain balance" }),
|
|
394
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-loading-subtitle", children: chainMismatch ? `Switch to ${
|
|
397
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-loading-subtitle", children: chainMismatch ? `Switch to ${_chunkABVRVW3Pcjs.getChainName.call(void 0, asset.chainId)} to continue.` : "Please wait before withdrawing." })
|
|
395
398
|
] }),
|
|
396
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
399
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLJJCPDZOcjs.PoweredBy, {})
|
|
397
400
|
] });
|
|
398
401
|
}
|
|
399
402
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
400
403
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body", children: [
|
|
401
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
404
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLJJCPDZOcjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLJJCPDZOcjs.CircleArrowOutUpLeftIcon, {}), title: "Withdraw" }),
|
|
402
405
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-section", children: [
|
|
403
406
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
404
407
|
"label",
|
|
@@ -444,7 +447,7 @@ function WithdrawFormStep({
|
|
|
444
447
|
),
|
|
445
448
|
isRecipientConnected ? null : "Use connected"
|
|
446
449
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
447
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
450
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLJJCPDZOcjs.WalletIcon, { className: "rs-withdraw-use-connected-icon" }),
|
|
448
451
|
isRecipientConnected ? null : "Use connected"
|
|
449
452
|
] })
|
|
450
453
|
}
|
|
@@ -484,7 +487,7 @@ function WithdrawFormStep({
|
|
|
484
487
|
) })
|
|
485
488
|
] }),
|
|
486
489
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-amount-info", children: [
|
|
487
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ?
|
|
490
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ? _chunkLJJCPDZOcjs.currencyFormatter.format(amountUsd) : "$0.00" }),
|
|
488
491
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-withdraw-balance", children: [
|
|
489
492
|
"Balance: ",
|
|
490
493
|
formattedBalance,
|
|
@@ -514,10 +517,10 @@ function WithdrawFormStep({
|
|
|
514
517
|
},
|
|
515
518
|
children: [
|
|
516
519
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-dropdown-value", children: [
|
|
517
|
-
|
|
520
|
+
_chunkABVRVW3Pcjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
518
521
|
"img",
|
|
519
522
|
{
|
|
520
|
-
src:
|
|
523
|
+
src: _chunkABVRVW3Pcjs.getChainIcon.call(void 0, targetChain),
|
|
521
524
|
alt: targetChainName,
|
|
522
525
|
className: "rs-withdraw-dropdown-icon"
|
|
523
526
|
}
|
|
@@ -525,7 +528,7 @@ function WithdrawFormStep({
|
|
|
525
528
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: targetChainName })
|
|
526
529
|
] }),
|
|
527
530
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
528
|
-
|
|
531
|
+
_chunkLJJCPDZOcjs.ChevronDownIcon,
|
|
529
532
|
{
|
|
530
533
|
className: "rs-withdraw-dropdown-arrow",
|
|
531
534
|
style: {
|
|
@@ -546,10 +549,10 @@ function WithdrawFormStep({
|
|
|
546
549
|
setShowChainDropdown(false);
|
|
547
550
|
},
|
|
548
551
|
children: [
|
|
549
|
-
|
|
552
|
+
_chunkABVRVW3Pcjs.getChainIcon.call(void 0, chain.id) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
550
553
|
"img",
|
|
551
554
|
{
|
|
552
|
-
src:
|
|
555
|
+
src: _chunkABVRVW3Pcjs.getChainIcon.call(void 0, chain.id),
|
|
553
556
|
alt: chain.name,
|
|
554
557
|
className: "rs-withdraw-dropdown-icon"
|
|
555
558
|
}
|
|
@@ -583,10 +586,10 @@ function WithdrawFormStep({
|
|
|
583
586
|
},
|
|
584
587
|
children: [
|
|
585
588
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-dropdown-value", children: [
|
|
586
|
-
|
|
589
|
+
_chunkABVRVW3Pcjs.getTokenIcon.call(void 0, targetSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
587
590
|
"img",
|
|
588
591
|
{
|
|
589
|
-
src:
|
|
592
|
+
src: _chunkABVRVW3Pcjs.getTokenIcon.call(void 0, targetSymbol),
|
|
590
593
|
alt: targetSymbol,
|
|
591
594
|
className: "rs-withdraw-dropdown-icon"
|
|
592
595
|
}
|
|
@@ -594,7 +597,7 @@ function WithdrawFormStep({
|
|
|
594
597
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: targetSymbol })
|
|
595
598
|
] }),
|
|
596
599
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
597
|
-
|
|
600
|
+
_chunkLJJCPDZOcjs.ChevronDownIcon,
|
|
598
601
|
{
|
|
599
602
|
className: "rs-withdraw-dropdown-arrow",
|
|
600
603
|
style: {
|
|
@@ -615,10 +618,10 @@ function WithdrawFormStep({
|
|
|
615
618
|
setShowTokenDropdown(false);
|
|
616
619
|
},
|
|
617
620
|
children: [
|
|
618
|
-
|
|
621
|
+
_chunkABVRVW3Pcjs.getTokenIcon.call(void 0, option.symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
619
622
|
"img",
|
|
620
623
|
{
|
|
621
|
-
src:
|
|
624
|
+
src: _chunkABVRVW3Pcjs.getTokenIcon.call(void 0, option.symbol),
|
|
622
625
|
alt: option.symbol,
|
|
623
626
|
className: "rs-withdraw-dropdown-icon"
|
|
624
627
|
}
|
|
@@ -633,11 +636,11 @@ function WithdrawFormStep({
|
|
|
633
636
|
)
|
|
634
637
|
] })
|
|
635
638
|
] }),
|
|
636
|
-
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 ${
|
|
637
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
638
|
-
!error && registrationError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
639
|
+
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 ${_chunkABVRVW3Pcjs.getChainName.call(void 0, asset.chainId)}...` : `Switch to ${_chunkABVRVW3Pcjs.getChainName.call(void 0, asset.chainId)} to continue.` }) }),
|
|
640
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLJJCPDZOcjs.Callout, { variant: "error", children: error }),
|
|
641
|
+
!error && registrationError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLJJCPDZOcjs.Callout, { variant: "error", children: registrationError }),
|
|
639
642
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
640
|
-
|
|
643
|
+
_chunkLJJCPDZOcjs.Button,
|
|
641
644
|
{
|
|
642
645
|
onClick: handleWithdraw,
|
|
643
646
|
fullWidth: true,
|
|
@@ -647,7 +650,7 @@ function WithdrawFormStep({
|
|
|
647
650
|
}
|
|
648
651
|
)
|
|
649
652
|
] }),
|
|
650
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
653
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLJJCPDZOcjs.PoweredBy, {})
|
|
651
654
|
] });
|
|
652
655
|
}
|
|
653
656
|
WithdrawFormStep.displayName = "WithdrawFormStep";
|
|
@@ -668,18 +671,29 @@ function WithdrawReviewStep({
|
|
|
668
671
|
estimatedTime = "< 1 min",
|
|
669
672
|
registrationPending = false,
|
|
670
673
|
registrationError = null,
|
|
674
|
+
service,
|
|
671
675
|
onConfirm,
|
|
672
676
|
onError
|
|
673
677
|
}) {
|
|
674
678
|
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
675
679
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
676
|
-
const sourceChainName =
|
|
677
|
-
const sourceChainIcon =
|
|
678
|
-
const targetSymbol =
|
|
679
|
-
const targetChainName =
|
|
680
|
-
const targetChainIcon =
|
|
681
|
-
const sourceTokenIcon =
|
|
682
|
-
const targetTokenIcon =
|
|
680
|
+
const sourceChainName = _chunkABVRVW3Pcjs.getChainName.call(void 0, sourceChain);
|
|
681
|
+
const sourceChainIcon = _chunkABVRVW3Pcjs.getChainIcon.call(void 0, sourceChain);
|
|
682
|
+
const targetSymbol = _chunkABVRVW3Pcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
683
|
+
const targetChainName = _chunkABVRVW3Pcjs.getChainName.call(void 0, targetChain);
|
|
684
|
+
const targetChainIcon = _chunkABVRVW3Pcjs.getChainIcon.call(void 0, targetChain);
|
|
685
|
+
const sourceTokenIcon = _chunkABVRVW3Pcjs.getTokenIcon.call(void 0, sourceSymbol);
|
|
686
|
+
const targetTokenIcon = _chunkABVRVW3Pcjs.getTokenIcon.call(void 0, targetSymbol);
|
|
687
|
+
const amountNumber = Number(amount);
|
|
688
|
+
const formattedSendAmount = _nullishCoalesce(_chunkLJJCPDZOcjs.formatTokenAmount.call(void 0, amountNumber, sourceSymbol), () => ( amount));
|
|
689
|
+
const prices = _chunkLJJCPDZOcjs.useTokenPrices.call(void 0, service, [sourceSymbol, targetSymbol]);
|
|
690
|
+
const receiveDisplay = _nullishCoalesce(_chunkLJJCPDZOcjs.formatReceiveEstimate.call(void 0, {
|
|
691
|
+
sourceAmount: Number.isFinite(amountNumber) ? amountNumber : void 0,
|
|
692
|
+
sourceSymbol,
|
|
693
|
+
targetSymbol,
|
|
694
|
+
prices
|
|
695
|
+
}), () => ( // No price for the target token — an honest dash beats a wrong number.
|
|
696
|
+
"\u2014"));
|
|
683
697
|
const handleConfirm = async () => {
|
|
684
698
|
setError(null);
|
|
685
699
|
setIsSubmitting(true);
|
|
@@ -687,7 +701,7 @@ function WithdrawReviewStep({
|
|
|
687
701
|
await onConfirm();
|
|
688
702
|
} catch (err) {
|
|
689
703
|
const raw = err instanceof Error ? err.message : "Withdraw failed";
|
|
690
|
-
const message =
|
|
704
|
+
const message = _chunkLJJCPDZOcjs.formatUserError.call(void 0, raw);
|
|
691
705
|
setError(message);
|
|
692
706
|
_optionalChain([onError, 'optionalCall', _8 => _8(message, "WITHDRAW_REVIEW_ERROR")]);
|
|
693
707
|
} finally {
|
|
@@ -698,9 +712,9 @@ function WithdrawReviewStep({
|
|
|
698
712
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
699
713
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
700
714
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
701
|
-
|
|
715
|
+
_chunkLJJCPDZOcjs.BodyHeader,
|
|
702
716
|
{
|
|
703
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
717
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLJJCPDZOcjs.CircleArrowOutUpLeftIcon, {}),
|
|
704
718
|
title: "Review withdrawal"
|
|
705
719
|
}
|
|
706
720
|
),
|
|
@@ -709,7 +723,7 @@ function WithdrawReviewStep({
|
|
|
709
723
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "You send" }),
|
|
710
724
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
711
725
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
|
|
712
|
-
|
|
726
|
+
formattedSendAmount,
|
|
713
727
|
" ",
|
|
714
728
|
sourceSymbol
|
|
715
729
|
] }),
|
|
@@ -730,11 +744,7 @@ function WithdrawReviewStep({
|
|
|
730
744
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
731
745
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Receive" }),
|
|
732
746
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
733
|
-
/* @__PURE__ */ _jsxruntime.
|
|
734
|
-
amount,
|
|
735
|
-
" ",
|
|
736
|
-
targetSymbol
|
|
737
|
-
] }),
|
|
747
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: receiveDisplay }),
|
|
738
748
|
targetTokenIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: targetTokenIcon, alt: "" }) })
|
|
739
749
|
] })
|
|
740
750
|
] }),
|
|
@@ -750,10 +760,10 @@ function WithdrawReviewStep({
|
|
|
750
760
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: estimatedTime })
|
|
751
761
|
] })
|
|
752
762
|
] }),
|
|
753
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
754
|
-
!error && registrationError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
763
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLJJCPDZOcjs.Callout, { variant: "error", children: error }),
|
|
764
|
+
!error && registrationError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLJJCPDZOcjs.Callout, { variant: "error", children: registrationError }),
|
|
755
765
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
756
|
-
|
|
766
|
+
_chunkLJJCPDZOcjs.Button,
|
|
757
767
|
{
|
|
758
768
|
onClick: handleConfirm,
|
|
759
769
|
loading: isSubmitting,
|
|
@@ -764,7 +774,7 @@ function WithdrawReviewStep({
|
|
|
764
774
|
}
|
|
765
775
|
)
|
|
766
776
|
] }),
|
|
767
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
777
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLJJCPDZOcjs.PoweredBy, {})
|
|
768
778
|
] });
|
|
769
779
|
}
|
|
770
780
|
WithdrawReviewStep.displayName = "WithdrawReviewStep";
|
|
@@ -774,16 +784,17 @@ WithdrawReviewStep.displayName = "WithdrawReviewStep";
|
|
|
774
784
|
|
|
775
785
|
var ADDR_REGEX = /^0x[a-fA-F0-9]{40}$/;
|
|
776
786
|
var REGISTRATION_DEBOUNCE_MS = 600;
|
|
787
|
+
var WITHDRAW_INDEXING_DELAY_MS = 2e3;
|
|
777
788
|
function resolveSessionOwner(eoaAddress) {
|
|
778
|
-
const localOwner =
|
|
789
|
+
const localOwner = _chunkLJJCPDZOcjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
|
|
779
790
|
if (localOwner) {
|
|
780
791
|
return {
|
|
781
|
-
account:
|
|
792
|
+
account: _chunkLJJCPDZOcjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
|
|
782
793
|
address: localOwner.address
|
|
783
794
|
};
|
|
784
795
|
}
|
|
785
|
-
const created =
|
|
786
|
-
|
|
796
|
+
const created = _chunkLJJCPDZOcjs.createSessionOwnerKey.call(void 0, );
|
|
797
|
+
_chunkLJJCPDZOcjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
|
|
787
798
|
return { account: created.account, address: created.address };
|
|
788
799
|
}
|
|
789
800
|
function targetsEqual(a, b) {
|
|
@@ -803,7 +814,7 @@ function WithdrawFlow({
|
|
|
803
814
|
amount: defaultAmount,
|
|
804
815
|
service,
|
|
805
816
|
allowedRoutes,
|
|
806
|
-
signerAddress =
|
|
817
|
+
signerAddress = _chunkABVRVW3Pcjs.DEFAULT_SIGNER_ADDRESS,
|
|
807
818
|
sessionChainIds,
|
|
808
819
|
forceRegister = false,
|
|
809
820
|
reownWallet,
|
|
@@ -818,19 +829,27 @@ function WithdrawFlow({
|
|
|
818
829
|
onError,
|
|
819
830
|
debug
|
|
820
831
|
}) {
|
|
821
|
-
const onStepChangeRef =
|
|
822
|
-
const onEventRef =
|
|
823
|
-
const onLifecycleRef =
|
|
824
|
-
const onErrorRef =
|
|
832
|
+
const onStepChangeRef = _chunkLJJCPDZOcjs.useLatestRef.call(void 0, onStepChange);
|
|
833
|
+
const onEventRef = _chunkLJJCPDZOcjs.useLatestRef.call(void 0, onEvent);
|
|
834
|
+
const onLifecycleRef = _chunkLJJCPDZOcjs.useLatestRef.call(void 0, onLifecycle);
|
|
835
|
+
const onErrorRef = _chunkLJJCPDZOcjs.useLatestRef.call(void 0, onError);
|
|
836
|
+
const isFlowActiveRef = _react.useRef.call(void 0, true);
|
|
837
|
+
const submitGenerationRef = _react.useRef.call(void 0, 0);
|
|
838
|
+
_react.useEffect.call(void 0, () => {
|
|
839
|
+
isFlowActiveRef.current = true;
|
|
840
|
+
return () => {
|
|
841
|
+
isFlowActiveRef.current = false;
|
|
842
|
+
};
|
|
843
|
+
}, []);
|
|
825
844
|
const logFlow = _react.useCallback.call(void 0,
|
|
826
845
|
(message, data) => {
|
|
827
|
-
|
|
846
|
+
_chunkLJJCPDZOcjs.debugLog.call(void 0, debug, "withdraw-flow", message, data);
|
|
828
847
|
},
|
|
829
848
|
[debug]
|
|
830
849
|
);
|
|
831
850
|
const logFlowError = _react.useCallback.call(void 0,
|
|
832
851
|
(message, error, data) => {
|
|
833
|
-
|
|
852
|
+
_chunkLJJCPDZOcjs.debugError.call(void 0, debug, "withdraw-flow", message, error, data);
|
|
834
853
|
},
|
|
835
854
|
[debug]
|
|
836
855
|
);
|
|
@@ -895,6 +914,7 @@ function WithdrawFlow({
|
|
|
895
914
|
const selectedWalletId = useWithdrawStore((s) => s.selectedWalletId);
|
|
896
915
|
const registration = useWithdrawStore((s) => s.registration);
|
|
897
916
|
const flowStep = useWithdrawStore((s) => s.step);
|
|
917
|
+
const reviewedRecipient = useWithdrawStore((s) => s.recipient);
|
|
898
918
|
const setSelectedWalletId = _react.useCallback.call(void 0,
|
|
899
919
|
(walletId) => storeApi.dispatch({ type: "wallet/id-selected", walletId }),
|
|
900
920
|
[storeApi]
|
|
@@ -905,14 +925,14 @@ function WithdrawFlow({
|
|
|
905
925
|
return {
|
|
906
926
|
ownerAddress: dappAddress,
|
|
907
927
|
walletClient: _nullishCoalesce(dappWalletClient, () => ( void 0)),
|
|
908
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
928
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkLJJCPDZOcjs.getPublicClient.call(void 0, sourceChain))),
|
|
909
929
|
switchChain: dappSwitchChain
|
|
910
930
|
};
|
|
911
931
|
}
|
|
912
932
|
return {
|
|
913
933
|
ownerAddress: dappWalletClient.account.address,
|
|
914
934
|
walletClient: dappWalletClient,
|
|
915
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
935
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkLJJCPDZOcjs.getPublicClient.call(void 0, sourceChain))),
|
|
916
936
|
switchChain: dappSwitchChain
|
|
917
937
|
};
|
|
918
938
|
}
|
|
@@ -923,7 +943,7 @@ function WithdrawFlow({
|
|
|
923
943
|
return {
|
|
924
944
|
ownerAddress: dappWalletClient.account.address,
|
|
925
945
|
walletClient: dappWalletClient,
|
|
926
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
946
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkLJJCPDZOcjs.getPublicClient.call(void 0, sourceChain))),
|
|
927
947
|
switchChain: dappSwitchChain
|
|
928
948
|
};
|
|
929
949
|
}
|
|
@@ -955,7 +975,7 @@ function WithdrawFlow({
|
|
|
955
975
|
return ADDR_REGEX.test(recipientInput) ? recipientInput : void 0;
|
|
956
976
|
}, [recipientInput]);
|
|
957
977
|
_react.useEffect.call(void 0, () => {
|
|
958
|
-
if (!ownerAddress) return;
|
|
978
|
+
if (!ownerAddress || !recipientForRegistration) return;
|
|
959
979
|
const desiredTarget = {
|
|
960
980
|
chain: targetChain,
|
|
961
981
|
token: targetToken,
|
|
@@ -980,7 +1000,7 @@ function WithdrawFlow({
|
|
|
980
1000
|
const setup = await service.setupAccount({
|
|
981
1001
|
ownerAddress,
|
|
982
1002
|
sessionOwnerAddress: sessionOwner.address,
|
|
983
|
-
targetChain:
|
|
1003
|
+
targetChain: _chunkABVRVW3Pcjs.toEvmCaip2.call(void 0, targetChain),
|
|
984
1004
|
targetToken,
|
|
985
1005
|
recipient: recipientForRegistration,
|
|
986
1006
|
signerAddress,
|
|
@@ -1005,7 +1025,7 @@ function WithdrawFlow({
|
|
|
1005
1025
|
message: typedData.message
|
|
1006
1026
|
});
|
|
1007
1027
|
if (cancelled) return;
|
|
1008
|
-
const sessionDetails =
|
|
1028
|
+
const sessionDetails = _chunkLJJCPDZOcjs.buildSessionDetails.call(void 0,
|
|
1009
1029
|
setup.sessionDetailsUnsigned,
|
|
1010
1030
|
signature
|
|
1011
1031
|
);
|
|
@@ -1019,7 +1039,7 @@ function WithdrawFlow({
|
|
|
1019
1039
|
eoaAddress: ownerAddress,
|
|
1020
1040
|
sessionOwner: sessionOwner.address,
|
|
1021
1041
|
target: {
|
|
1022
|
-
chain:
|
|
1042
|
+
chain: _chunkABVRVW3Pcjs.toEvmCaip2.call(void 0, targetChain),
|
|
1023
1043
|
token: targetToken,
|
|
1024
1044
|
recipient: recipientForRegistration
|
|
1025
1045
|
}
|
|
@@ -1042,7 +1062,7 @@ function WithdrawFlow({
|
|
|
1042
1062
|
} catch (err) {
|
|
1043
1063
|
if (cancelled) return;
|
|
1044
1064
|
const raw = err instanceof Error ? err.message : "Registration failed";
|
|
1045
|
-
const message =
|
|
1065
|
+
const message = _chunkLJJCPDZOcjs.formatUserError.call(void 0, raw);
|
|
1046
1066
|
logFlowError("auto-register:failed", err, {
|
|
1047
1067
|
ownerAddress,
|
|
1048
1068
|
targetChain,
|
|
@@ -1075,10 +1095,10 @@ function WithdrawFlow({
|
|
|
1075
1095
|
onErrorRef
|
|
1076
1096
|
]);
|
|
1077
1097
|
const asset = _react.useMemo.call(void 0, () => {
|
|
1078
|
-
const symbol =
|
|
1079
|
-
const decimals =
|
|
1098
|
+
const symbol = _chunkABVRVW3Pcjs.getTokenSymbol.call(void 0, sourceToken, sourceChain);
|
|
1099
|
+
const decimals = _chunkABVRVW3Pcjs.getTokenDecimalsByAddress.call(void 0, sourceToken, sourceChain);
|
|
1080
1100
|
return {
|
|
1081
|
-
id:
|
|
1101
|
+
id: _chunkLJJCPDZOcjs.getAssetId.call(void 0, { chainId: sourceChain, token: sourceToken }),
|
|
1082
1102
|
chainId: sourceChain,
|
|
1083
1103
|
token: sourceToken,
|
|
1084
1104
|
symbol,
|
|
@@ -1086,9 +1106,16 @@ function WithdrawFlow({
|
|
|
1086
1106
|
decimals
|
|
1087
1107
|
};
|
|
1088
1108
|
}, [sourceChain, sourceToken]);
|
|
1089
|
-
const isSourceNative = sourceToken.toLowerCase() ===
|
|
1109
|
+
const isSourceNative = sourceToken.toLowerCase() === _chunkABVRVW3Pcjs.NATIVE_TOKEN_ADDRESS.toLowerCase();
|
|
1090
1110
|
const isSameRoute = targetChain === sourceChain && targetToken.toLowerCase() === sourceToken.toLowerCase();
|
|
1111
|
+
const reviewedTarget = reviewedRecipient ? {
|
|
1112
|
+
chain: targetChain,
|
|
1113
|
+
token: targetToken,
|
|
1114
|
+
recipient: reviewedRecipient
|
|
1115
|
+
} : null;
|
|
1116
|
+
const isReviewedTargetReady = registration.kind === "ready" && reviewedTarget !== null && targetsEqual(registration.registeredTarget, reviewedTarget);
|
|
1091
1117
|
const reviewBackHandler = _react.useCallback.call(void 0, () => {
|
|
1118
|
+
submitGenerationRef.current += 1;
|
|
1092
1119
|
storeApi.dispatch({ type: "review/back" });
|
|
1093
1120
|
}, [storeApi]);
|
|
1094
1121
|
_react.useEffect.call(void 0, () => {
|
|
@@ -1104,8 +1131,8 @@ function WithdrawFlow({
|
|
|
1104
1131
|
}
|
|
1105
1132
|
if (lastStepOpenEventKeyRef.current === "form") return;
|
|
1106
1133
|
lastStepOpenEventKeyRef.current = "form";
|
|
1107
|
-
const tokenSymbol =
|
|
1108
|
-
const chainName =
|
|
1134
|
+
const tokenSymbol = _chunkABVRVW3Pcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
1135
|
+
const chainName = _chunkABVRVW3Pcjs.getChainName.call(void 0, targetChain);
|
|
1109
1136
|
_optionalChain([onEventRef, 'access', _37 => _37.current, 'optionalCall', _38 => _38({
|
|
1110
1137
|
type: "withdraw_modal_select_amount_open",
|
|
1111
1138
|
pred_balance: totalBalanceUsd,
|
|
@@ -1142,8 +1169,8 @@ function WithdrawFlow({
|
|
|
1142
1169
|
);
|
|
1143
1170
|
const handleFormContinue = _react.useCallback.call(void 0,
|
|
1144
1171
|
(recipient, amountValue) => {
|
|
1145
|
-
const tokenSymbol =
|
|
1146
|
-
const chainName =
|
|
1172
|
+
const tokenSymbol = _chunkABVRVW3Pcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
1173
|
+
const chainName = _chunkABVRVW3Pcjs.getChainName.call(void 0, targetChain);
|
|
1147
1174
|
_optionalChain([onEventRef, 'access', _41 => _41.current, 'optionalCall', _42 => _42({
|
|
1148
1175
|
type: "withdraw_modal_select_amount_cta_click",
|
|
1149
1176
|
pred_balance: totalBalanceUsd,
|
|
@@ -1163,19 +1190,38 @@ function WithdrawFlow({
|
|
|
1163
1190
|
const handleReviewConfirm = _react.useCallback.call(void 0,
|
|
1164
1191
|
async () => {
|
|
1165
1192
|
const state = storeApi.getState();
|
|
1166
|
-
if (state.registration.kind !== "ready") {
|
|
1167
|
-
throw new Error("Session not ready");
|
|
1168
|
-
}
|
|
1169
|
-
const smartAccount = state.registration.smartAccount;
|
|
1170
1193
|
const recipient = state.recipient;
|
|
1171
1194
|
const amountValue = state.amount;
|
|
1172
1195
|
if (!recipient || !amountValue) {
|
|
1173
1196
|
throw new Error("Missing recipient or amount");
|
|
1174
1197
|
}
|
|
1198
|
+
const desiredTarget = {
|
|
1199
|
+
chain: targetChain,
|
|
1200
|
+
token: targetToken,
|
|
1201
|
+
recipient
|
|
1202
|
+
};
|
|
1203
|
+
const getMatchingRegistration = () => {
|
|
1204
|
+
const current = storeApi.getState().registration;
|
|
1205
|
+
return current.kind === "ready" && targetsEqual(current.registeredTarget, desiredTarget) ? current : null;
|
|
1206
|
+
};
|
|
1207
|
+
const matchingRegistration = getMatchingRegistration();
|
|
1208
|
+
if (!matchingRegistration) {
|
|
1209
|
+
throw new Error("Withdrawal target is still being prepared");
|
|
1210
|
+
}
|
|
1211
|
+
const smartAccount = matchingRegistration.smartAccount;
|
|
1175
1212
|
if (!onSignTransaction && !_optionalChain([signerContext, 'optionalAccess', _43 => _43.walletClient])) {
|
|
1176
1213
|
throw new Error("Wallet not connected");
|
|
1177
1214
|
}
|
|
1215
|
+
const submitGeneration = submitGenerationRef.current += 1;
|
|
1216
|
+
const isSubmissionLive = () => isFlowActiveRef.current && submitGenerationRef.current === submitGeneration;
|
|
1178
1217
|
try {
|
|
1218
|
+
await new Promise((resolve) => {
|
|
1219
|
+
setTimeout(resolve, WITHDRAW_INDEXING_DELAY_MS);
|
|
1220
|
+
});
|
|
1221
|
+
if (!isSubmissionLive()) return;
|
|
1222
|
+
if (!getMatchingRegistration()) {
|
|
1223
|
+
throw new Error("Withdrawal target changed before submission");
|
|
1224
|
+
}
|
|
1179
1225
|
logFlow("submit:start", {
|
|
1180
1226
|
smartAccount,
|
|
1181
1227
|
recipient,
|
|
@@ -1186,7 +1232,7 @@ function WithdrawFlow({
|
|
|
1186
1232
|
targetToken
|
|
1187
1233
|
});
|
|
1188
1234
|
const amountUnits = _viem.parseUnits.call(void 0, amountValue, asset.decimals);
|
|
1189
|
-
const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _44 => _44.publicClient]), () => (
|
|
1235
|
+
const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _44 => _44.publicClient]), () => ( _chunkLJJCPDZOcjs.getPublicClient.call(void 0, sourceChain)));
|
|
1190
1236
|
let result;
|
|
1191
1237
|
if (onSignTransaction) {
|
|
1192
1238
|
const transferTarget = isSameRoute ? recipient : smartAccount;
|
|
@@ -1199,7 +1245,7 @@ function WithdrawFlow({
|
|
|
1199
1245
|
args: [transferTarget, amountUnits]
|
|
1200
1246
|
})
|
|
1201
1247
|
};
|
|
1202
|
-
const request = await
|
|
1248
|
+
const request = await _chunkUEKPBRBYcjs.buildSafeTransaction.call(void 0, {
|
|
1203
1249
|
publicClient: pc,
|
|
1204
1250
|
safeAddress,
|
|
1205
1251
|
to: transferData.to,
|
|
@@ -1207,10 +1253,15 @@ function WithdrawFlow({
|
|
|
1207
1253
|
data: transferData.data,
|
|
1208
1254
|
chainId: sourceChain
|
|
1209
1255
|
});
|
|
1256
|
+
if (!isSubmissionLive()) return;
|
|
1210
1257
|
const { signature } = await onSignTransaction(request);
|
|
1258
|
+
if (!isSubmissionLive()) return;
|
|
1259
|
+
if (!getMatchingRegistration()) {
|
|
1260
|
+
throw new Error("Withdrawal target changed before submission");
|
|
1261
|
+
}
|
|
1211
1262
|
const relayResult = await service.relayWithdraw({
|
|
1212
1263
|
smartAccount,
|
|
1213
|
-
chainId:
|
|
1264
|
+
chainId: _chunkABVRVW3Pcjs.toEvmCaip2.call(void 0, sourceChain),
|
|
1214
1265
|
safeAddress,
|
|
1215
1266
|
safeTransaction: request.typedData.message,
|
|
1216
1267
|
signature
|
|
@@ -1220,7 +1271,10 @@ function WithdrawFlow({
|
|
|
1220
1271
|
}
|
|
1221
1272
|
result = { txHash: relayResult.txHash };
|
|
1222
1273
|
} else if (isSourceNative) {
|
|
1223
|
-
|
|
1274
|
+
if (!getMatchingRegistration()) {
|
|
1275
|
+
throw new Error("Withdrawal target changed before submission");
|
|
1276
|
+
}
|
|
1277
|
+
result = await _chunkUEKPBRBYcjs.executeSafeEthTransfer.call(void 0, {
|
|
1224
1278
|
walletClient: signerContext.walletClient,
|
|
1225
1279
|
publicClient: pc,
|
|
1226
1280
|
safeAddress,
|
|
@@ -1229,7 +1283,10 @@ function WithdrawFlow({
|
|
|
1229
1283
|
chainId: sourceChain
|
|
1230
1284
|
});
|
|
1231
1285
|
} else {
|
|
1232
|
-
|
|
1286
|
+
if (!getMatchingRegistration()) {
|
|
1287
|
+
throw new Error("Withdrawal target changed before submission");
|
|
1288
|
+
}
|
|
1289
|
+
result = await _chunkUEKPBRBYcjs.executeSafeErc20Transfer.call(void 0, {
|
|
1233
1290
|
walletClient: signerContext.walletClient,
|
|
1234
1291
|
publicClient: pc,
|
|
1235
1292
|
safeAddress,
|
|
@@ -1239,6 +1296,7 @@ function WithdrawFlow({
|
|
|
1239
1296
|
chainId: sourceChain
|
|
1240
1297
|
});
|
|
1241
1298
|
}
|
|
1299
|
+
if (!isSubmissionLive()) return;
|
|
1242
1300
|
logFlow("withdraw:submitted", {
|
|
1243
1301
|
txHash: result.txHash,
|
|
1244
1302
|
smartAccount,
|
|
@@ -1262,7 +1320,7 @@ function WithdrawFlow({
|
|
|
1262
1320
|
targetChain,
|
|
1263
1321
|
targetToken
|
|
1264
1322
|
});
|
|
1265
|
-
handleError(
|
|
1323
|
+
handleError(_chunkLJJCPDZOcjs.formatUserError.call(void 0, raw), "WITHDRAW_FLOW_ERROR");
|
|
1266
1324
|
throw err;
|
|
1267
1325
|
}
|
|
1268
1326
|
},
|
|
@@ -1327,9 +1385,9 @@ function WithdrawFlow({
|
|
|
1327
1385
|
[_optionalChain([allowedRoutes, 'optionalAccess', _54 => _54.sourceTokens])]
|
|
1328
1386
|
);
|
|
1329
1387
|
const targetChainOptions = _react.useMemo.call(void 0, () => {
|
|
1330
|
-
return
|
|
1388
|
+
return _chunkABVRVW3Pcjs.SOURCE_CHAINS.filter((chain) => {
|
|
1331
1389
|
if (allowedChainSet && !allowedChainSet.has(chain.id)) return false;
|
|
1332
|
-
const tokens =
|
|
1390
|
+
const tokens = _chunkABVRVW3Pcjs.getSupportedTargetTokens.call(void 0, chain.id);
|
|
1333
1391
|
if (allowedTokenSet) {
|
|
1334
1392
|
return tokens.some((t) => allowedTokenSet.has(t.symbol.toUpperCase()));
|
|
1335
1393
|
}
|
|
@@ -1337,7 +1395,7 @@ function WithdrawFlow({
|
|
|
1337
1395
|
});
|
|
1338
1396
|
}, [allowedChainSet, allowedTokenSet]);
|
|
1339
1397
|
const targetTokenOptions = _react.useMemo.call(void 0, () => {
|
|
1340
|
-
const tokens =
|
|
1398
|
+
const tokens = _chunkABVRVW3Pcjs.getSupportedTargetTokens.call(void 0, targetChain);
|
|
1341
1399
|
if (!allowedTokenSet) return tokens;
|
|
1342
1400
|
return tokens.filter((t) => allowedTokenSet.has(t.symbol.toUpperCase()));
|
|
1343
1401
|
}, [targetChain, allowedTokenSet]);
|
|
@@ -1351,7 +1409,7 @@ function WithdrawFlow({
|
|
|
1351
1409
|
const handleTargetChainChange = _react.useCallback.call(void 0,
|
|
1352
1410
|
(chainId) => {
|
|
1353
1411
|
setTargetChain(chainId);
|
|
1354
|
-
let options =
|
|
1412
|
+
let options = _chunkABVRVW3Pcjs.getSupportedTargetTokens.call(void 0, chainId);
|
|
1355
1413
|
if (allowedTokenSet) {
|
|
1356
1414
|
options = options.filter(
|
|
1357
1415
|
(t) => allowedTokenSet.has(t.symbol.toUpperCase())
|
|
@@ -1401,7 +1459,7 @@ function WithdrawFlow({
|
|
|
1401
1459
|
state: "ready"
|
|
1402
1460
|
}));
|
|
1403
1461
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1404
|
-
|
|
1462
|
+
_chunkLJJCPDZOcjs.ConnectStep,
|
|
1405
1463
|
{
|
|
1406
1464
|
walletRows: withdrawRows,
|
|
1407
1465
|
onConfirmWallet: (walletId) => {
|
|
@@ -1419,7 +1477,7 @@ function WithdrawFlow({
|
|
|
1419
1477
|
if (!signerContext) return null;
|
|
1420
1478
|
if (!onSignTransaction && !signerContext.walletClient) return null;
|
|
1421
1479
|
const resolvedConnectedRecipient = _optionalChain([selectedWalletOption, 'optionalAccess', _61 => _61.kind]) === "external" ? selectedWalletOption.address : void 0;
|
|
1422
|
-
const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => (
|
|
1480
|
+
const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => ( _chunkLJJCPDZOcjs.getPublicClient.call(void 0, sourceChain)));
|
|
1423
1481
|
const stepView = deriveStepView(flowStep, registration);
|
|
1424
1482
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
1425
1483
|
stepView === "form" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1456,14 +1514,15 @@ function WithdrawFlow({
|
|
|
1456
1514
|
targetToken,
|
|
1457
1515
|
amount: _nullishCoalesce(storeApi.getState().amount, () => ( "0")),
|
|
1458
1516
|
recipient: _nullishCoalesce(_nullishCoalesce(storeApi.getState().recipient, () => ( recipientForRegistration)), () => ( "0x0")),
|
|
1459
|
-
|
|
1517
|
+
service,
|
|
1518
|
+
registrationPending: registration.kind === "pending" || registration.kind === "stale" || !isReviewedTargetReady,
|
|
1460
1519
|
registrationError: registration.kind === "failed" ? registration.error : null,
|
|
1461
1520
|
onConfirm: handleReviewConfirm,
|
|
1462
1521
|
onError: handleError
|
|
1463
1522
|
}
|
|
1464
1523
|
),
|
|
1465
1524
|
stepView === "processing" && registration.kind !== "idle" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1466
|
-
|
|
1525
|
+
_chunkLJJCPDZOcjs.ProcessingStep,
|
|
1467
1526
|
{
|
|
1468
1527
|
smartAccount: registration.kind === "ready" || registration.kind === "stale" ? registration.smartAccount : "0x0",
|
|
1469
1528
|
txHash: _nullishCoalesce(storeApi.getState().txHash, () => ( "0x0")),
|
|
@@ -1471,7 +1530,9 @@ function WithdrawFlow({
|
|
|
1471
1530
|
sourceToken,
|
|
1472
1531
|
targetChain,
|
|
1473
1532
|
targetToken,
|
|
1474
|
-
amount: _nullishCoalesce(storeApi.getState().amount, () => ( "0")),
|
|
1533
|
+
amount: toBaseUnits(_nullishCoalesce(storeApi.getState().amount, () => ( "0")), asset.decimals),
|
|
1534
|
+
sourceSymbol: asset.symbol,
|
|
1535
|
+
sourceDecimals: asset.decimals,
|
|
1475
1536
|
directTransfer: isSameRoute,
|
|
1476
1537
|
service,
|
|
1477
1538
|
flowLabel: "withdraw",
|
|
@@ -1485,6 +1546,13 @@ function WithdrawFlow({
|
|
|
1485
1546
|
)
|
|
1486
1547
|
] });
|
|
1487
1548
|
}
|
|
1549
|
+
function toBaseUnits(amount, decimals) {
|
|
1550
|
+
try {
|
|
1551
|
+
return _viem.parseUnits.call(void 0, amount, decimals).toString();
|
|
1552
|
+
} catch (e6) {
|
|
1553
|
+
return "0";
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1488
1556
|
function deriveStepView(step, _registration) {
|
|
1489
1557
|
if (step === "review") return "review";
|
|
1490
1558
|
if (step === "processing" || step === "complete" || step === "failed") {
|
|
@@ -1496,7 +1564,7 @@ function deriveStepView(step, _registration) {
|
|
|
1496
1564
|
// src/WithdrawModal.tsx
|
|
1497
1565
|
|
|
1498
1566
|
var ReownWithdrawInner = _react.lazy.call(void 0,
|
|
1499
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-
|
|
1567
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-CTT3EXMG.cjs"))).then((m) => ({
|
|
1500
1568
|
default: m.WithdrawModalReown
|
|
1501
1569
|
}))
|
|
1502
1570
|
);
|
|
@@ -1524,8 +1592,8 @@ function WithdrawModalInner({
|
|
|
1524
1592
|
inline,
|
|
1525
1593
|
closeOnOverlayClick,
|
|
1526
1594
|
allowedRoutes,
|
|
1527
|
-
backendUrl =
|
|
1528
|
-
signerAddress =
|
|
1595
|
+
backendUrl = _chunkABVRVW3Pcjs.DEFAULT_BACKEND_URL,
|
|
1596
|
+
signerAddress = _chunkABVRVW3Pcjs.DEFAULT_SIGNER_ADDRESS,
|
|
1529
1597
|
sessionChainIds,
|
|
1530
1598
|
forceRegister = false,
|
|
1531
1599
|
reownWallet,
|
|
@@ -1543,18 +1611,18 @@ function WithdrawModalInner({
|
|
|
1543
1611
|
debug
|
|
1544
1612
|
}) {
|
|
1545
1613
|
const modalRef = _react.useRef.call(void 0, null);
|
|
1546
|
-
const onReadyRef =
|
|
1614
|
+
const onReadyRef = _chunkLJJCPDZOcjs.useLatestRef.call(void 0, onReady);
|
|
1547
1615
|
const [backHandler, setBackHandler] = _react.useState.call(void 0,
|
|
1548
1616
|
void 0
|
|
1549
1617
|
);
|
|
1550
|
-
const targetChain =
|
|
1551
|
-
const sourceChain =
|
|
1618
|
+
const targetChain = _chunkABVRVW3Pcjs.getChainId.call(void 0, targetChainProp);
|
|
1619
|
+
const sourceChain = _chunkABVRVW3Pcjs.getChainId.call(void 0, sourceChainProp);
|
|
1552
1620
|
const service = _react.useMemo.call(void 0,
|
|
1553
|
-
() =>
|
|
1621
|
+
() => _chunkLJJCPDZOcjs.createDepositService.call(void 0, backendUrl, { debug, debugScope: "service:withdraw" }),
|
|
1554
1622
|
[backendUrl, debug]
|
|
1555
1623
|
);
|
|
1556
1624
|
const store = _react.useMemo.call(void 0, () => createWithdrawStore(), []);
|
|
1557
|
-
const onErrorRef =
|
|
1625
|
+
const onErrorRef = _chunkLJJCPDZOcjs.useLatestRef.call(void 0, onError);
|
|
1558
1626
|
_react.useEffect.call(void 0, () => {
|
|
1559
1627
|
if (isOpen && onSignTransaction && !dappAddress) {
|
|
1560
1628
|
_optionalChain([onErrorRef, 'access', _62 => _62.current, 'optionalCall', _63 => _63({
|
|
@@ -1565,7 +1633,7 @@ function WithdrawModalInner({
|
|
|
1565
1633
|
}, [isOpen, onSignTransaction, dappAddress, onErrorRef]);
|
|
1566
1634
|
_react.useEffect.call(void 0, () => {
|
|
1567
1635
|
if (isOpen && modalRef.current) {
|
|
1568
|
-
|
|
1636
|
+
_chunkLJJCPDZOcjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
1569
1637
|
}
|
|
1570
1638
|
}, [isOpen, theme]);
|
|
1571
1639
|
_react.useEffect.call(void 0, () => {
|
|
@@ -1584,7 +1652,7 @@ function WithdrawModalInner({
|
|
|
1584
1652
|
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _66 => _66.showBackButton]), () => ( true));
|
|
1585
1653
|
const canGoBack = backHandler !== void 0;
|
|
1586
1654
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WithdrawStoreProvider, { store, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1587
|
-
|
|
1655
|
+
_chunkLJJCPDZOcjs.Modal,
|
|
1588
1656
|
{
|
|
1589
1657
|
isOpen,
|
|
1590
1658
|
onClose,
|
|
@@ -1600,7 +1668,7 @@ function WithdrawModalInner({
|
|
|
1600
1668
|
className: "rs-modal-header-back",
|
|
1601
1669
|
"aria-label": "Go back",
|
|
1602
1670
|
onClick: backHandler,
|
|
1603
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1671
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLJJCPDZOcjs.ChevronLeftIcon, {})
|
|
1604
1672
|
}
|
|
1605
1673
|
) }),
|
|
1606
1674
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1610,7 +1678,7 @@ function WithdrawModalInner({
|
|
|
1610
1678
|
onClick: onClose,
|
|
1611
1679
|
className: "rs-modal-close",
|
|
1612
1680
|
"aria-label": "Close",
|
|
1613
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1681
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLJJCPDZOcjs.CloseIcon, {})
|
|
1614
1682
|
}
|
|
1615
1683
|
) })
|
|
1616
1684
|
] }),
|