@rhinestone/deposit-modal 0.14.1 → 0.16.0
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/README.md +26 -24
- package/bridge-transcript.json +14 -0
- package/dist/{DepositModalReown-GAD45GIC.cjs → DepositModalReown-IFN6YLZJ.cjs} +20 -22
- package/dist/{DepositModalReown-2EVV64OA.mjs → DepositModalReown-R7UROJPJ.mjs} +5 -7
- package/dist/WithdrawModal-SZEAI473.cjs +11 -0
- package/dist/WithdrawModal-XKSSHVEJ.mjs +11 -0
- package/dist/{caip-D8aRWdEY.d.cts → caip-BMi-9t09.d.cts} +27 -3
- package/dist/{caip-D8aRWdEY.d.ts → caip-BMi-9t09.d.ts} +27 -3
- package/dist/{chunk-A6JPBMYY.cjs → chunk-24N4KMJX.cjs} +234 -115
- package/dist/{chunk-LMG46EP2.mjs → chunk-3HCCR54R.mjs} +1 -1
- package/dist/{chunk-AQVJUXSG.cjs → chunk-5CM3ZQ5U.cjs} +1 -1
- package/dist/chunk-EA5CE2UZ.mjs +7599 -0
- package/dist/{chunk-VUATPOWJ.mjs → chunk-EAGMY3QE.mjs} +74 -17
- package/dist/{chunk-5Q5CSVKF.mjs → chunk-F6ROQ6RJ.mjs} +215 -517
- package/dist/{chunk-RN5VKWI6.mjs → chunk-FTWKAJGN.mjs} +1 -1
- package/dist/chunk-H4O22O7Y.cjs +7599 -0
- package/dist/{chunk-GZ4GQ5MC.mjs → chunk-HMB2XQGD.mjs} +172 -53
- package/dist/{chunk-DW2EQA2U.cjs → chunk-LVCD6RHF.cjs} +2 -2
- package/dist/{chunk-4KCSH4T3.cjs → chunk-OY5N3E6L.cjs} +86 -29
- package/dist/{chunk-NQMC5VKQ.cjs → chunk-V466XQSG.cjs} +551 -853
- package/dist/{constants-DBrWhJWE.d.cts → constants-BT4ctuHo.d.cts} +7 -6
- package/dist/{constants-DBrWhJWE.d.ts → constants-D21ZdNOP.d.ts} +7 -6
- package/dist/constants.cjs +3 -3
- package/dist/constants.d.cts +3 -3
- package/dist/constants.d.ts +3 -3
- package/dist/constants.mjs +2 -2
- package/dist/deposit.cjs +6 -8
- package/dist/deposit.d.cts +3 -3
- package/dist/deposit.d.ts +3 -3
- package/dist/deposit.mjs +5 -7
- package/dist/embed.cjs +130 -80
- package/dist/embed.d.cts +3 -9
- package/dist/embed.d.ts +3 -9
- package/dist/embed.mjs +112 -62
- package/dist/index.cjs +8 -11
- package/dist/index.d.cts +3 -5
- package/dist/index.d.ts +3 -5
- package/dist/index.mjs +10 -13
- package/dist/polymarket.cjs +6 -6
- package/dist/polymarket.mjs +2 -2
- package/dist/server.d.cts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/styles.css +147 -100
- package/dist/{types-DP_3KwlD.d.cts → types-B9SbZQIG.d.ts} +145 -108
- package/dist/{types-Bho4OA03.d.ts → types-SwGGf0eH.d.cts} +145 -108
- package/dist/withdraw.cjs +5 -6
- package/dist/withdraw.d.cts +33 -5
- package/dist/withdraw.d.ts +33 -5
- package/dist/withdraw.mjs +4 -5
- package/package.json +6 -37
- package/dist/ClaimModal-GDFENSLV.mjs +0 -13
- package/dist/ClaimModal-L3FUBI5U.cjs +0 -13
- package/dist/WithdrawModal-FAQH35NG.cjs +0 -12
- package/dist/WithdrawModal-IKUHF5CF.mjs +0 -12
- package/dist/chunk-4J5ADVIN.cjs +0 -1848
- package/dist/chunk-62UCV2LG.cjs +0 -81
- package/dist/chunk-7AZFT2MV.cjs +0 -163
- package/dist/chunk-HAQOFI3D.cjs +0 -3699
- package/dist/chunk-QACOOLOE.mjs +0 -1062
- package/dist/chunk-R5UQ3TN4.mjs +0 -81
- package/dist/chunk-UX35GYLM.mjs +0 -3699
- package/dist/chunk-VALXN5IO.mjs +0 -163
- package/dist/chunk-XCTRKCNM.mjs +0 -1848
- package/dist/chunk-YP7QVKQ6.cjs +0 -1062
- package/dist/claim.cjs +0 -11
- package/dist/claim.d.cts +0 -17
- package/dist/claim.d.ts +0 -17
- package/dist/claim.mjs +0 -11
- package/dist/modal-ui-state-OD1RmKkK.d.cts +0 -30
- package/dist/modal-ui-state-OD1RmKkK.d.ts +0 -30
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var _chunk4J5ADVINcjs = require('./chunk-4J5ADVIN.cjs');
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
|
|
@@ -41,16 +40,20 @@ var _chunk4J5ADVINcjs = require('./chunk-4J5ADVIN.cjs');
|
|
|
41
40
|
|
|
42
41
|
|
|
43
42
|
|
|
44
|
-
var _chunkHAQOFI3Dcjs = require('./chunk-HAQOFI3D.cjs');
|
|
45
43
|
|
|
46
44
|
|
|
47
45
|
|
|
48
46
|
|
|
47
|
+
var _chunkH4O22O7Ycjs = require('./chunk-H4O22O7Y.cjs');
|
|
49
48
|
|
|
50
49
|
|
|
51
50
|
|
|
52
51
|
|
|
53
|
-
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
var _chunkOY5N3E6Lcjs = require('./chunk-OY5N3E6L.cjs');
|
|
54
57
|
|
|
55
58
|
// src/WithdrawModal.tsx
|
|
56
59
|
var _react = require('react');
|
|
@@ -235,11 +238,11 @@ function WithdrawFormStep({
|
|
|
235
238
|
const chainDropdownRef = _react.useRef.call(void 0, null);
|
|
236
239
|
const tokenDropdownRef = _react.useRef.call(void 0, null);
|
|
237
240
|
const publicClientChainId = _optionalChain([publicClient, 'access', _ => _.chain, 'optionalAccess', _2 => _2.id]);
|
|
238
|
-
const onFrictionRef =
|
|
241
|
+
const onFrictionRef = _chunkH4O22O7Ycjs.useLatestRef.call(void 0, onFriction);
|
|
239
242
|
useClickOutside(chainDropdownRef, () => setShowChainDropdown(false));
|
|
240
243
|
useClickOutside(tokenDropdownRef, () => setShowTokenDropdown(false));
|
|
241
|
-
const targetSymbol =
|
|
242
|
-
const targetChainName =
|
|
244
|
+
const targetSymbol = _chunkOY5N3E6Lcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
245
|
+
const targetChainName = _chunkOY5N3E6Lcjs.getChainName.call(void 0, targetChain);
|
|
243
246
|
const isBusy = submitting || isSubmitting;
|
|
244
247
|
const seededRecipientRef = _react.useRef.call(void 0, _nullishCoalesce(defaultRecipient, () => ( "")));
|
|
245
248
|
_react.useEffect.call(void 0, () => {
|
|
@@ -263,7 +266,7 @@ function WithdrawFormStep({
|
|
|
263
266
|
return;
|
|
264
267
|
}
|
|
265
268
|
try {
|
|
266
|
-
const bal =
|
|
269
|
+
const bal = _chunkH4O22O7Ycjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: accountAddress }) : await publicClient.readContract({
|
|
267
270
|
address: asset.token,
|
|
268
271
|
abi: _viem.erc20Abi,
|
|
269
272
|
functionName: "balanceOf",
|
|
@@ -365,7 +368,7 @@ function WithdrawFormStep({
|
|
|
365
368
|
await onSubmit(recipient, amount);
|
|
366
369
|
} catch (err) {
|
|
367
370
|
const raw = err instanceof Error ? err.message : "Withdrawal failed";
|
|
368
|
-
setError(
|
|
371
|
+
setError(_chunkH4O22O7Ycjs.formatUserError.call(void 0, raw));
|
|
369
372
|
} finally {
|
|
370
373
|
setIsSubmitting(false);
|
|
371
374
|
}
|
|
@@ -382,16 +385,16 @@ function WithdrawFormStep({
|
|
|
382
385
|
if (isBalanceLoading) {
|
|
383
386
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
384
387
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-withdraw-loading", children: [
|
|
385
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
388
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkH4O22O7Ycjs.Spinner, { className: "rs-spinner--lg" }),
|
|
386
389
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-loading-title", children: "Loading on-chain balance" }),
|
|
387
390
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-loading-subtitle", children: "Please wait before withdrawing." })
|
|
388
391
|
] }),
|
|
389
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
392
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkH4O22O7Ycjs.PoweredBy, {})
|
|
390
393
|
] });
|
|
391
394
|
}
|
|
392
395
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
393
396
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body", children: [
|
|
394
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
397
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkH4O22O7Ycjs.BodyHeader, { icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkH4O22O7Ycjs.CircleArrowOutUpLeftIcon, {}), title: "Withdraw" }),
|
|
395
398
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-section", children: [
|
|
396
399
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
397
400
|
"label",
|
|
@@ -451,7 +454,7 @@ function WithdrawFormStep({
|
|
|
451
454
|
) })
|
|
452
455
|
] }),
|
|
453
456
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-amount-info", children: [
|
|
454
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ? `~${
|
|
457
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ? `~${_chunkH4O22O7Ycjs.currencyFormatter.format(amountUsd)}` : "$0.00" }),
|
|
455
458
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-withdraw-balance", children: [
|
|
456
459
|
"Balance: ",
|
|
457
460
|
formattedBalance,
|
|
@@ -482,9 +485,9 @@ function WithdrawFormStep({
|
|
|
482
485
|
children: [
|
|
483
486
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-dropdown-value", children: [
|
|
484
487
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
485
|
-
|
|
488
|
+
_chunkH4O22O7Ycjs.CdnIcon,
|
|
486
489
|
{
|
|
487
|
-
src:
|
|
490
|
+
src: _chunkOY5N3E6Lcjs.getChainIcon.call(void 0, targetChain),
|
|
488
491
|
alt: targetChainName,
|
|
489
492
|
className: "rs-withdraw-dropdown-icon"
|
|
490
493
|
}
|
|
@@ -492,7 +495,7 @@ function WithdrawFormStep({
|
|
|
492
495
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: targetChainName })
|
|
493
496
|
] }),
|
|
494
497
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
495
|
-
|
|
498
|
+
_chunkH4O22O7Ycjs.ChevronDownIcon,
|
|
496
499
|
{
|
|
497
500
|
className: "rs-withdraw-dropdown-arrow",
|
|
498
501
|
style: {
|
|
@@ -514,9 +517,9 @@ function WithdrawFormStep({
|
|
|
514
517
|
},
|
|
515
518
|
children: [
|
|
516
519
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
517
|
-
|
|
520
|
+
_chunkH4O22O7Ycjs.CdnIcon,
|
|
518
521
|
{
|
|
519
|
-
src:
|
|
522
|
+
src: _chunkOY5N3E6Lcjs.getChainIcon.call(void 0, chain.id),
|
|
520
523
|
alt: chain.name,
|
|
521
524
|
className: "rs-withdraw-dropdown-icon"
|
|
522
525
|
}
|
|
@@ -551,7 +554,7 @@ function WithdrawFormStep({
|
|
|
551
554
|
children: [
|
|
552
555
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-dropdown-value", children: [
|
|
553
556
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
554
|
-
|
|
557
|
+
_chunkH4O22O7Ycjs.TokenIcon,
|
|
555
558
|
{
|
|
556
559
|
symbol: targetSymbol,
|
|
557
560
|
className: "rs-withdraw-dropdown-icon"
|
|
@@ -560,7 +563,7 @@ function WithdrawFormStep({
|
|
|
560
563
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: targetSymbol })
|
|
561
564
|
] }),
|
|
562
565
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
563
|
-
|
|
566
|
+
_chunkH4O22O7Ycjs.ChevronDownIcon,
|
|
564
567
|
{
|
|
565
568
|
className: "rs-withdraw-dropdown-arrow",
|
|
566
569
|
style: {
|
|
@@ -582,7 +585,7 @@ function WithdrawFormStep({
|
|
|
582
585
|
},
|
|
583
586
|
children: [
|
|
584
587
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
585
|
-
|
|
588
|
+
_chunkH4O22O7Ycjs.TokenIcon,
|
|
586
589
|
{
|
|
587
590
|
symbol: option.symbol,
|
|
588
591
|
className: "rs-withdraw-dropdown-icon"
|
|
@@ -598,10 +601,10 @@ function WithdrawFormStep({
|
|
|
598
601
|
)
|
|
599
602
|
] })
|
|
600
603
|
] }),
|
|
601
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
602
|
-
!error && registrationError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
604
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkH4O22O7Ycjs.Callout, { variant: "error", children: error }),
|
|
605
|
+
!error && registrationError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkH4O22O7Ycjs.Callout, { variant: "error", children: registrationError }),
|
|
603
606
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
604
|
-
|
|
607
|
+
_chunkH4O22O7Ycjs.Button,
|
|
605
608
|
{
|
|
606
609
|
onClick: handleWithdraw,
|
|
607
610
|
fullWidth: true,
|
|
@@ -616,7 +619,7 @@ function WithdrawFormStep({
|
|
|
616
619
|
}
|
|
617
620
|
)
|
|
618
621
|
] }),
|
|
619
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
622
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkH4O22O7Ycjs.PoweredBy, {})
|
|
620
623
|
] });
|
|
621
624
|
}
|
|
622
625
|
WithdrawFormStep.displayName = "WithdrawFormStep";
|
|
@@ -639,27 +642,34 @@ function WithdrawReviewStep({
|
|
|
639
642
|
registrationPending = false,
|
|
640
643
|
registrationError = null,
|
|
641
644
|
service,
|
|
645
|
+
onSubmittingChange,
|
|
642
646
|
onConfirm,
|
|
643
647
|
onError
|
|
644
648
|
}) {
|
|
645
649
|
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
646
650
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
647
|
-
const
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
651
|
+
const onSubmittingChangeRef = _react.useRef.call(void 0, onSubmittingChange);
|
|
652
|
+
onSubmittingChangeRef.current = onSubmittingChange;
|
|
653
|
+
_react.useEffect.call(void 0, () => {
|
|
654
|
+
_optionalChain([onSubmittingChangeRef, 'access', _15 => _15.current, 'optionalCall', _16 => _16(isSubmitting)]);
|
|
655
|
+
return () => _optionalChain([onSubmittingChangeRef, 'access', _17 => _17.current, 'optionalCall', _18 => _18(false)]);
|
|
656
|
+
}, [isSubmitting]);
|
|
657
|
+
const sourceChainName = _chunkOY5N3E6Lcjs.getChainName.call(void 0, sourceChain);
|
|
658
|
+
const sourceChainIcon = _chunkOY5N3E6Lcjs.getChainIcon.call(void 0, sourceChain);
|
|
659
|
+
const targetSymbol = _chunkOY5N3E6Lcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
660
|
+
const targetChainName = _chunkOY5N3E6Lcjs.getChainName.call(void 0, targetChain);
|
|
661
|
+
const targetChainIcon = _chunkOY5N3E6Lcjs.getChainIcon.call(void 0, targetChain);
|
|
652
662
|
const amountNumber = Number(amount);
|
|
653
|
-
const formattedSendAmount = _nullishCoalesce(
|
|
654
|
-
const prices =
|
|
663
|
+
const formattedSendAmount = _nullishCoalesce(_chunkH4O22O7Ycjs.formatTokenAmount.call(void 0, amountNumber, sourceSymbol), () => ( amount));
|
|
664
|
+
const prices = _chunkH4O22O7Ycjs.useTokenPrices.call(void 0, service, [
|
|
655
665
|
{ chainId: sourceChain, address: sourceToken, symbol: sourceSymbol },
|
|
656
666
|
{ chainId: targetChain, address: targetToken, symbol: targetSymbol }
|
|
657
667
|
]);
|
|
658
|
-
const receiveDisplay = _nullishCoalesce(
|
|
668
|
+
const receiveDisplay = _nullishCoalesce(_chunkH4O22O7Ycjs.formatReceiveEstimate.call(void 0, {
|
|
659
669
|
sourceAmount: Number.isFinite(amountNumber) ? amountNumber : void 0,
|
|
660
670
|
sourceSymbol,
|
|
661
671
|
targetSymbol,
|
|
662
|
-
sourceTrusted:
|
|
672
|
+
sourceTrusted: _chunkH4O22O7Ycjs.isRecognizedToken.call(void 0, sourceToken, sourceChain),
|
|
663
673
|
prices
|
|
664
674
|
}), () => ( // No price for the target token — an honest dash beats a wrong number.
|
|
665
675
|
"\u2014"));
|
|
@@ -671,11 +681,11 @@ function WithdrawReviewStep({
|
|
|
671
681
|
await onConfirm();
|
|
672
682
|
} catch (err) {
|
|
673
683
|
const raw = err instanceof Error ? err.message : "Withdraw failed";
|
|
674
|
-
const uncertain =
|
|
675
|
-
const message = uncertain ? "Withdrawal status is uncertain. Check your activity before trying again." :
|
|
684
|
+
const uncertain = _chunkH4O22O7Ycjs.isSubmissionUncertain.call(void 0, err);
|
|
685
|
+
const message = uncertain ? "Withdrawal status is uncertain. Check your activity before trying again." : _chunkH4O22O7Ycjs.formatUserError.call(void 0, raw);
|
|
676
686
|
if (uncertain) setSubmissionUncertain(true);
|
|
677
687
|
setError(message);
|
|
678
|
-
_optionalChain([onError, 'optionalCall',
|
|
688
|
+
_optionalChain([onError, 'optionalCall', _19 => _19(message, "WITHDRAW_REVIEW_ERROR", raw)]);
|
|
679
689
|
} finally {
|
|
680
690
|
setIsSubmitting(false);
|
|
681
691
|
}
|
|
@@ -684,9 +694,9 @@ function WithdrawReviewStep({
|
|
|
684
694
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen", children: [
|
|
685
695
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-screen-body rs-screen-body--gap-32", children: [
|
|
686
696
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
687
|
-
|
|
697
|
+
_chunkH4O22O7Ycjs.BodyHeader,
|
|
688
698
|
{
|
|
689
|
-
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
699
|
+
icon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkH4O22O7Ycjs.CircleArrowOutUpLeftIcon, {}),
|
|
690
700
|
title: "Review withdrawal"
|
|
691
701
|
}
|
|
692
702
|
),
|
|
@@ -699,14 +709,14 @@ function WithdrawReviewStep({
|
|
|
699
709
|
" ",
|
|
700
710
|
sourceSymbol
|
|
701
711
|
] }),
|
|
702
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
712
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkH4O22O7Ycjs.TokenIcon, { symbol: sourceSymbol }) })
|
|
703
713
|
] })
|
|
704
714
|
] }),
|
|
705
715
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
706
716
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Source chain" }),
|
|
707
717
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
708
718
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: sourceChainName }),
|
|
709
|
-
sourceChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
719
|
+
sourceChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkH4O22O7Ycjs.CdnIcon, { src: sourceChainIcon }) })
|
|
710
720
|
] })
|
|
711
721
|
] }),
|
|
712
722
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
@@ -717,14 +727,14 @@ function WithdrawReviewStep({
|
|
|
717
727
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Receive" }),
|
|
718
728
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
719
729
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: receiveDisplay }),
|
|
720
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
730
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkH4O22O7Ycjs.TokenIcon, { symbol: targetSymbol }) })
|
|
721
731
|
] })
|
|
722
732
|
] }),
|
|
723
733
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
724
734
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Destination chain" }),
|
|
725
735
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-review-detail-value", children: [
|
|
726
736
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: targetChainName }),
|
|
727
|
-
targetChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
737
|
+
targetChainIcon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkH4O22O7Ycjs.CdnIcon, { src: targetChainIcon }) })
|
|
728
738
|
] })
|
|
729
739
|
] }),
|
|
730
740
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-review-detail-row", children: [
|
|
@@ -732,10 +742,10 @@ function WithdrawReviewStep({
|
|
|
732
742
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-review-detail-value", children: estimatedTime })
|
|
733
743
|
] })
|
|
734
744
|
] }),
|
|
735
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
736
|
-
!error && registrationError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
745
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkH4O22O7Ycjs.Callout, { variant: "error", children: error }),
|
|
746
|
+
!error && registrationError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkH4O22O7Ycjs.Callout, { variant: "error", children: registrationError }),
|
|
737
747
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
738
|
-
|
|
748
|
+
_chunkH4O22O7Ycjs.Button,
|
|
739
749
|
{
|
|
740
750
|
onClick: handleConfirm,
|
|
741
751
|
loading: isSubmitting,
|
|
@@ -746,7 +756,7 @@ function WithdrawReviewStep({
|
|
|
746
756
|
}
|
|
747
757
|
)
|
|
748
758
|
] }),
|
|
749
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
759
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkH4O22O7Ycjs.PoweredBy, {})
|
|
750
760
|
] });
|
|
751
761
|
}
|
|
752
762
|
WithdrawReviewStep.displayName = "WithdrawReviewStep";
|
|
@@ -762,7 +772,7 @@ WithdrawReviewStep.displayName = "WithdrawReviewStep";
|
|
|
762
772
|
|
|
763
773
|
|
|
764
774
|
function withdrawFailureReasonForError(error) {
|
|
765
|
-
if (
|
|
775
|
+
if (_chunkH4O22O7Ycjs.isSubmissionUncertain.call(void 0, error)) return "submission_uncertain";
|
|
766
776
|
const message = (error instanceof Error ? error.message : String(_nullishCoalesce(error, () => ( "")))).toLowerCase();
|
|
767
777
|
if (message.includes("changed before submission")) {
|
|
768
778
|
return "registration_target_changed";
|
|
@@ -798,6 +808,23 @@ function createWithdrawAnalyticsController(emit) {
|
|
|
798
808
|
opened = true;
|
|
799
809
|
emit({ type: "withdraw_modal_open" });
|
|
800
810
|
},
|
|
811
|
+
// Never deduplicated: the visit id and the per-visit dedupe belong to the
|
|
812
|
+
// history adapter, which knows what a visit is.
|
|
813
|
+
historyOpened(detail) {
|
|
814
|
+
send({ type: "withdraw_modal_history_open", ...detail });
|
|
815
|
+
},
|
|
816
|
+
historyRowViewed(detail) {
|
|
817
|
+
send({ type: "withdraw_modal_history_row_view", ...detail });
|
|
818
|
+
},
|
|
819
|
+
historyLoadMore(detail) {
|
|
820
|
+
send({ type: "withdraw_modal_history_load_more", ...detail });
|
|
821
|
+
},
|
|
822
|
+
historyFallbackOpened(detail) {
|
|
823
|
+
send({ type: "withdraw_modal_history_fallback_open", ...detail });
|
|
824
|
+
},
|
|
825
|
+
historyRecoveryStarted(detail) {
|
|
826
|
+
send({ type: "withdraw_modal_history_recovery_start", ...detail });
|
|
827
|
+
},
|
|
801
828
|
openStep(nextStep) {
|
|
802
829
|
controller.openSession();
|
|
803
830
|
if (step === nextStep) return;
|
|
@@ -904,7 +931,7 @@ function WithdrawAnalyticsControllerProvider({
|
|
|
904
931
|
children,
|
|
905
932
|
controllerRef
|
|
906
933
|
}) {
|
|
907
|
-
const emit =
|
|
934
|
+
const emit = _chunkH4O22O7Ycjs.useWithdrawAnalyticsEmitter.call(void 0, );
|
|
908
935
|
const controller = _react.useMemo.call(void 0,
|
|
909
936
|
() => createWithdrawAnalyticsController(emit),
|
|
910
937
|
[emit]
|
|
@@ -923,7 +950,7 @@ var REGISTRATION_DEBOUNCE_MS = 600;
|
|
|
923
950
|
var WITHDRAW_INDEXING_DELAY_MS = 2e3;
|
|
924
951
|
function targetsEqual(a, b) {
|
|
925
952
|
if (!a) return false;
|
|
926
|
-
return a.chain === b.chain && a.token.toLowerCase() === b.token.toLowerCase() && (_nullishCoalesce(_optionalChain([a, 'access',
|
|
953
|
+
return a.chain === b.chain && a.token.toLowerCase() === b.token.toLowerCase() && (_nullishCoalesce(_optionalChain([a, 'access', _20 => _20.recipient, 'optionalAccess', _21 => _21.toLowerCase, 'call', _22 => _22()]), () => ( ""))) === (_nullishCoalesce(_optionalChain([b, 'access', _23 => _23.recipient, 'optionalAccess', _24 => _24.toLowerCase, 'call', _25 => _25()]), () => ( "")));
|
|
927
954
|
}
|
|
928
955
|
function WithdrawFlow({
|
|
929
956
|
accountAddress,
|
|
@@ -938,15 +965,17 @@ function WithdrawFlow({
|
|
|
938
965
|
onSendTransaction,
|
|
939
966
|
onStepChange,
|
|
940
967
|
onClose,
|
|
968
|
+
onDestinationChange,
|
|
969
|
+
onSubmittingChange,
|
|
941
970
|
onLifecycle,
|
|
942
971
|
onError,
|
|
943
972
|
debug
|
|
944
973
|
}) {
|
|
945
|
-
const rpcUrls =
|
|
946
|
-
const onStepChangeRef =
|
|
974
|
+
const rpcUrls = _chunkH4O22O7Ycjs.useRpcUrls.call(void 0, );
|
|
975
|
+
const onStepChangeRef = _chunkH4O22O7Ycjs.useLatestRef.call(void 0, onStepChange);
|
|
947
976
|
const analytics = useWithdrawAnalyticsController();
|
|
948
|
-
const onLifecycleRef =
|
|
949
|
-
const onErrorRef =
|
|
977
|
+
const onLifecycleRef = _chunkH4O22O7Ycjs.useLatestRef.call(void 0, onLifecycle);
|
|
978
|
+
const onErrorRef = _chunkH4O22O7Ycjs.useLatestRef.call(void 0, onError);
|
|
950
979
|
const isFlowActiveRef = _react.useRef.call(void 0, true);
|
|
951
980
|
const submitGenerationRef = _react.useRef.call(void 0, 0);
|
|
952
981
|
const lastSubmitFailureRef = _react.useRef.call(void 0,
|
|
@@ -960,13 +989,13 @@ function WithdrawFlow({
|
|
|
960
989
|
}, []);
|
|
961
990
|
const logFlow = _react.useCallback.call(void 0,
|
|
962
991
|
(message, data) => {
|
|
963
|
-
|
|
992
|
+
_chunkH4O22O7Ycjs.debugLog.call(void 0, debug, "withdraw-flow", message, data);
|
|
964
993
|
},
|
|
965
994
|
[debug]
|
|
966
995
|
);
|
|
967
996
|
const logFlowError = _react.useCallback.call(void 0,
|
|
968
997
|
(message, error, data) => {
|
|
969
|
-
|
|
998
|
+
_chunkH4O22O7Ycjs.debugError.call(void 0, debug, "withdraw-flow", message, error, data);
|
|
970
999
|
},
|
|
971
1000
|
[debug]
|
|
972
1001
|
);
|
|
@@ -988,11 +1017,26 @@ function WithdrawFlow({
|
|
|
988
1017
|
const registration = useWithdrawStore((s) => s.registration);
|
|
989
1018
|
const flowStep = useWithdrawStore((s) => s.step);
|
|
990
1019
|
const reviewedRecipient = useWithdrawStore((s) => s.recipient);
|
|
991
|
-
const publicClient =
|
|
1020
|
+
const publicClient = _chunkH4O22O7Ycjs.useReadClient.call(void 0, sourceChain, rpcUrls);
|
|
992
1021
|
const recipientForRegistration = _react.useMemo.call(void 0, () => {
|
|
993
1022
|
if (!recipientInput) return void 0;
|
|
994
1023
|
return ADDR_REGEX.test(recipientInput) ? recipientInput : void 0;
|
|
995
1024
|
}, [recipientInput]);
|
|
1025
|
+
const onDestinationChangeRef = _chunkH4O22O7Ycjs.useLatestRef.call(void 0, onDestinationChange);
|
|
1026
|
+
const reportedDestinationRef = _react.useRef.call(void 0, void 0);
|
|
1027
|
+
_react.useEffect.call(void 0, () => {
|
|
1028
|
+
if (reportedDestinationRef.current === recipientForRegistration) return;
|
|
1029
|
+
const report = () => {
|
|
1030
|
+
reportedDestinationRef.current = recipientForRegistration;
|
|
1031
|
+
_optionalChain([onDestinationChangeRef, 'access', _26 => _26.current, 'optionalCall', _27 => _27(recipientForRegistration)]);
|
|
1032
|
+
};
|
|
1033
|
+
if (!reportedDestinationRef.current) {
|
|
1034
|
+
report();
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
1037
|
+
const timeout = setTimeout(report, REGISTRATION_DEBOUNCE_MS);
|
|
1038
|
+
return () => clearTimeout(timeout);
|
|
1039
|
+
}, [recipientForRegistration, onDestinationChangeRef]);
|
|
996
1040
|
_react.useEffect.call(void 0, () => {
|
|
997
1041
|
if (!recipientForRegistration) return;
|
|
998
1042
|
const desiredTarget = {
|
|
@@ -1014,7 +1058,7 @@ function WithdrawFlow({
|
|
|
1014
1058
|
targetToken,
|
|
1015
1059
|
recipient: recipientForRegistration
|
|
1016
1060
|
});
|
|
1017
|
-
const salt =
|
|
1061
|
+
const salt = _chunkH4O22O7Ycjs.deriveAccountSalt.call(void 0, {
|
|
1018
1062
|
recipient: recipientForRegistration,
|
|
1019
1063
|
targetChain,
|
|
1020
1064
|
targetToken
|
|
@@ -1022,7 +1066,7 @@ function WithdrawFlow({
|
|
|
1022
1066
|
const { evmDepositAddress } = await service.registerManagedAccount({
|
|
1023
1067
|
salt,
|
|
1024
1068
|
target: {
|
|
1025
|
-
chain:
|
|
1069
|
+
chain: _chunkOY5N3E6Lcjs.targetChainToCaip2.call(void 0, targetChain),
|
|
1026
1070
|
token: targetToken,
|
|
1027
1071
|
recipient: recipientForRegistration
|
|
1028
1072
|
}
|
|
@@ -1036,7 +1080,7 @@ function WithdrawFlow({
|
|
|
1036
1080
|
smartAccount: evmDepositAddress,
|
|
1037
1081
|
registeredTarget: desiredTarget
|
|
1038
1082
|
});
|
|
1039
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
1083
|
+
_optionalChain([onLifecycleRef, 'access', _28 => _28.current, 'optionalCall', _29 => _29({
|
|
1040
1084
|
type: "connected",
|
|
1041
1085
|
address: accountAddress,
|
|
1042
1086
|
smartAccount: evmDepositAddress
|
|
@@ -1044,7 +1088,7 @@ function WithdrawFlow({
|
|
|
1044
1088
|
} catch (err) {
|
|
1045
1089
|
if (cancelled) return;
|
|
1046
1090
|
const raw = err instanceof Error ? err.message : "Registration failed";
|
|
1047
|
-
const message =
|
|
1091
|
+
const message = _chunkH4O22O7Ycjs.formatUserError.call(void 0, raw);
|
|
1048
1092
|
logFlowError("auto-register:failed", err, {
|
|
1049
1093
|
accountAddress,
|
|
1050
1094
|
targetChain,
|
|
@@ -1054,7 +1098,7 @@ function WithdrawFlow({
|
|
|
1054
1098
|
type: "registration/failed",
|
|
1055
1099
|
error: message
|
|
1056
1100
|
});
|
|
1057
|
-
_optionalChain([onErrorRef, 'access',
|
|
1101
|
+
_optionalChain([onErrorRef, 'access', _30 => _30.current, 'optionalCall', _31 => _31({ message, code: "WITHDRAW_REGISTER_FAILED" })]);
|
|
1058
1102
|
}
|
|
1059
1103
|
}, REGISTRATION_DEBOUNCE_MS);
|
|
1060
1104
|
return () => {
|
|
@@ -1075,10 +1119,10 @@ function WithdrawFlow({
|
|
|
1075
1119
|
onErrorRef
|
|
1076
1120
|
]);
|
|
1077
1121
|
const asset = _react.useMemo.call(void 0, () => {
|
|
1078
|
-
const symbol =
|
|
1079
|
-
const decimals =
|
|
1122
|
+
const symbol = _chunkOY5N3E6Lcjs.getTokenSymbol.call(void 0, sourceToken, sourceChain);
|
|
1123
|
+
const decimals = _chunkOY5N3E6Lcjs.getTokenDecimalsByAddress.call(void 0, sourceToken, sourceChain);
|
|
1080
1124
|
return {
|
|
1081
|
-
id:
|
|
1125
|
+
id: _chunkH4O22O7Ycjs.getAssetId.call(void 0, { chainId: sourceChain, token: sourceToken }),
|
|
1082
1126
|
chainId: sourceChain,
|
|
1083
1127
|
token: sourceToken,
|
|
1084
1128
|
symbol,
|
|
@@ -1086,7 +1130,7 @@ function WithdrawFlow({
|
|
|
1086
1130
|
decimals
|
|
1087
1131
|
};
|
|
1088
1132
|
}, [sourceChain, sourceToken]);
|
|
1089
|
-
const isSourceNative = sourceToken.toLowerCase() ===
|
|
1133
|
+
const isSourceNative = sourceToken.toLowerCase() === _chunkOY5N3E6Lcjs.NATIVE_TOKEN_ADDRESS.toLowerCase();
|
|
1090
1134
|
const isSameRoute = targetChain === sourceChain && targetToken.toLowerCase() === sourceToken.toLowerCase();
|
|
1091
1135
|
const reviewedTarget = reviewedRecipient ? {
|
|
1092
1136
|
chain: targetChain,
|
|
@@ -1105,7 +1149,7 @@ function WithdrawFlow({
|
|
|
1105
1149
|
storeApi.dispatch({ type: "review/back" });
|
|
1106
1150
|
}, [analytics, storeApi]);
|
|
1107
1151
|
_react.useEffect.call(void 0, () => {
|
|
1108
|
-
_optionalChain([onStepChangeRef, 'access',
|
|
1152
|
+
_optionalChain([onStepChangeRef, 'access', _32 => _32.current, 'optionalCall', _33 => _33(
|
|
1109
1153
|
flowStep === "review" ? reviewBackHandler : void 0,
|
|
1110
1154
|
flowStep
|
|
1111
1155
|
)]);
|
|
@@ -1147,7 +1191,7 @@ function WithdrawFlow({
|
|
|
1147
1191
|
analytics.friction("processor_status_poll_failed", "processing");
|
|
1148
1192
|
}
|
|
1149
1193
|
logFlowError("flow:error", _nullishCoalesce(cause, () => ( message)), { code });
|
|
1150
|
-
_optionalChain([onErrorRef, 'access',
|
|
1194
|
+
_optionalChain([onErrorRef, 'access', _34 => _34.current, 'optionalCall', _35 => _35({ message, code, cause })]);
|
|
1151
1195
|
},
|
|
1152
1196
|
[analytics, logFlowError, onErrorRef]
|
|
1153
1197
|
);
|
|
@@ -1229,7 +1273,7 @@ function WithdrawFlow({
|
|
|
1229
1273
|
if (!getMatchingRegistration()) {
|
|
1230
1274
|
throw new Error("Withdrawal target changed before submission");
|
|
1231
1275
|
}
|
|
1232
|
-
if (!_optionalChain([result, 'optionalAccess',
|
|
1276
|
+
if (!_optionalChain([result, 'optionalAccess', _36 => _36.txHash])) {
|
|
1233
1277
|
throw new Error("onSendTransaction did not return a txHash");
|
|
1234
1278
|
}
|
|
1235
1279
|
analytics.handoff(
|
|
@@ -1248,7 +1292,7 @@ function WithdrawFlow({
|
|
|
1248
1292
|
sourceChain,
|
|
1249
1293
|
sourceToken
|
|
1250
1294
|
});
|
|
1251
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
1295
|
+
_optionalChain([onLifecycleRef, 'access', _37 => _37.current, 'optionalCall', _38 => _38({
|
|
1252
1296
|
type: "submitted",
|
|
1253
1297
|
txHash: result.txHash,
|
|
1254
1298
|
sourceChain,
|
|
@@ -1276,7 +1320,7 @@ function WithdrawFlow({
|
|
|
1276
1320
|
targetChain,
|
|
1277
1321
|
targetToken
|
|
1278
1322
|
});
|
|
1279
|
-
handleError(
|
|
1323
|
+
handleError(_chunkH4O22O7Ycjs.formatUserError.call(void 0, raw), "WITHDRAW_FLOW_ERROR");
|
|
1280
1324
|
throw err;
|
|
1281
1325
|
}
|
|
1282
1326
|
},
|
|
@@ -1302,7 +1346,7 @@ function WithdrawFlow({
|
|
|
1302
1346
|
analytics.openStep("processing");
|
|
1303
1347
|
analytics.outcome("completed");
|
|
1304
1348
|
logFlow("withdraw:complete", { txHash, destinationTxHash, ...context });
|
|
1305
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
1349
|
+
_optionalChain([onLifecycleRef, 'access', _39 => _39.current, 'optionalCall', _40 => _40({
|
|
1306
1350
|
type: "complete",
|
|
1307
1351
|
txHash,
|
|
1308
1352
|
destinationTxHash,
|
|
@@ -1326,7 +1370,7 @@ function WithdrawFlow({
|
|
|
1326
1370
|
analytics.outcome("failed");
|
|
1327
1371
|
analytics.failure("processor_failed", false, "processing");
|
|
1328
1372
|
logFlowError("withdraw:failed", error, { txHash });
|
|
1329
|
-
_optionalChain([onLifecycleRef, 'access',
|
|
1373
|
+
_optionalChain([onLifecycleRef, 'access', _41 => _41.current, 'optionalCall', _42 => _42({
|
|
1330
1374
|
type: "failed",
|
|
1331
1375
|
txHash,
|
|
1332
1376
|
error
|
|
@@ -1335,8 +1379,8 @@ function WithdrawFlow({
|
|
|
1335
1379
|
},
|
|
1336
1380
|
[analytics, logFlowError, onLifecycleRef, storeApi]
|
|
1337
1381
|
);
|
|
1338
|
-
const targetChainOptions =
|
|
1339
|
-
const targetTokensFor =
|
|
1382
|
+
const targetChainOptions = _chunkH4O22O7Ycjs.useDestinationChains.call(void 0, );
|
|
1383
|
+
const targetTokensFor = _chunkH4O22O7Ycjs.useTargetTokens.call(void 0, );
|
|
1340
1384
|
const targetTokenOptions = _react.useMemo.call(void 0,
|
|
1341
1385
|
() => targetTokensFor(targetChain),
|
|
1342
1386
|
[targetChain, targetTokensFor]
|
|
@@ -1409,12 +1453,13 @@ function WithdrawFlow({
|
|
|
1409
1453
|
service,
|
|
1410
1454
|
registrationPending: registration.kind === "pending" || registration.kind === "stale" || !isReviewedTargetReady,
|
|
1411
1455
|
registrationError: registration.kind === "failed" ? registration.error : null,
|
|
1456
|
+
onSubmittingChange,
|
|
1412
1457
|
onConfirm: handleReviewConfirm,
|
|
1413
1458
|
onError: handleError
|
|
1414
1459
|
}
|
|
1415
1460
|
),
|
|
1416
1461
|
stepView === "processing" && registration.kind !== "idle" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1417
|
-
|
|
1462
|
+
_chunkH4O22O7Ycjs.ProcessingStep,
|
|
1418
1463
|
{
|
|
1419
1464
|
smartAccount: _nullishCoalesce(storeApi.getState().processingSmartAccount, () => ( (registration.kind === "ready" || registration.kind === "stale" ? registration.smartAccount : "0x0"))),
|
|
1420
1465
|
txHash: _nullishCoalesce(storeApi.getState().txHash, () => ( "0x0")),
|
|
@@ -1484,7 +1529,7 @@ function buildWithdrawAnalyticsSessionProperties({
|
|
|
1484
1529
|
recipient: recipient !== void 0,
|
|
1485
1530
|
amount: defaultAmount !== void 0
|
|
1486
1531
|
},
|
|
1487
|
-
...
|
|
1532
|
+
..._chunkH4O22O7Ycjs.analyticsTargetProperties.call(void 0, {
|
|
1488
1533
|
targetChain: seedTargetChain,
|
|
1489
1534
|
targetToken: seedTargetToken
|
|
1490
1535
|
})
|
|
@@ -1515,6 +1560,7 @@ function WithdrawModal({
|
|
|
1515
1560
|
onError,
|
|
1516
1561
|
enableAnalyticsIngest,
|
|
1517
1562
|
analyticsIngestUrl,
|
|
1563
|
+
signRecovery,
|
|
1518
1564
|
debug,
|
|
1519
1565
|
// Every prop 0.9.0 removed lands here, since none of them is named above.
|
|
1520
1566
|
// `uiConfig` is destructured, so its removed nested key isn't scanned — that
|
|
@@ -1524,35 +1570,61 @@ function WithdrawModal({
|
|
|
1524
1570
|
onUiState,
|
|
1525
1571
|
...removedProps
|
|
1526
1572
|
}) {
|
|
1527
|
-
|
|
1528
|
-
|
|
1573
|
+
_chunkH4O22O7Ycjs.warnRemovedProps.call(void 0, "WithdrawModal", removedProps);
|
|
1574
|
+
_chunkH4O22O7Ycjs.checkBackendUrl.call(void 0, "WithdrawModal", backendUrl);
|
|
1529
1575
|
const modalRef = _react.useRef.call(void 0, null);
|
|
1530
|
-
const onReadyRef =
|
|
1576
|
+
const onReadyRef = _chunkH4O22O7Ycjs.useLatestRef.call(void 0, onReady);
|
|
1531
1577
|
const analyticsControllerRef = _react.useRef.call(void 0,
|
|
1532
1578
|
null
|
|
1533
1579
|
);
|
|
1580
|
+
const analyticsSessionIdRef = _react.useRef.call(void 0, null);
|
|
1534
1581
|
const previousOpenRef = _react.useRef.call(void 0, isOpen);
|
|
1535
1582
|
const [backHandler, setBackHandler] = _react.useState.call(void 0,
|
|
1536
1583
|
void 0
|
|
1537
1584
|
);
|
|
1538
1585
|
const [screen, setScreen] = _react.useState.call(void 0, "form");
|
|
1539
|
-
const
|
|
1540
|
-
const
|
|
1541
|
-
|
|
1542
|
-
|
|
1586
|
+
const [submitting, setSubmitting] = _react.useState.call(void 0, false);
|
|
1587
|
+
const [historyRecipient, setHistoryRecipient] = _react.useState.call(void 0,
|
|
1588
|
+
recipient
|
|
1589
|
+
);
|
|
1590
|
+
const onUiStateRef = _chunkH4O22O7Ycjs.useLatestRef.call(void 0, onUiState);
|
|
1591
|
+
const targetChain = _chunkOY5N3E6Lcjs.getChainId.call(void 0, _nullishCoalesce(targetChainProp, () => ( sourceChainProp)));
|
|
1592
|
+
const sourceChain = _chunkOY5N3E6Lcjs.getChainId.call(void 0, sourceChainProp);
|
|
1593
|
+
const rpcUrls = _chunkH4O22O7Ycjs.useStableRpcUrls.call(void 0, rpcUrlsProp);
|
|
1543
1594
|
const service = _react.useMemo.call(void 0,
|
|
1544
|
-
() =>
|
|
1595
|
+
() => _chunkH4O22O7Ycjs.createDepositService.call(void 0, backendUrl, { debug, debugScope: "service:withdraw" }),
|
|
1545
1596
|
[backendUrl, debug]
|
|
1546
1597
|
);
|
|
1598
|
+
const historyAnalytics = _react.useMemo.call(void 0,
|
|
1599
|
+
() => _chunkH4O22O7Ycjs.createHistoryAnalytics.call(void 0, {
|
|
1600
|
+
modal: "withdraw",
|
|
1601
|
+
controllerRef: analyticsControllerRef,
|
|
1602
|
+
sessionIdRef: analyticsSessionIdRef
|
|
1603
|
+
}),
|
|
1604
|
+
[]
|
|
1605
|
+
);
|
|
1606
|
+
const history = _chunkH4O22O7Ycjs.useHistoryPanel.call(void 0, {
|
|
1607
|
+
isOpen,
|
|
1608
|
+
recipient: historyRecipient,
|
|
1609
|
+
service,
|
|
1610
|
+
canRecover: Boolean(signRecovery),
|
|
1611
|
+
analytics: historyAnalytics
|
|
1612
|
+
});
|
|
1613
|
+
const { markStale: markHistoryStale, recoverySubmitting } = history;
|
|
1614
|
+
const historyButtonVisible = _chunkH4O22O7Ycjs.isHistoryEntryVisible.call(void 0, {
|
|
1615
|
+
screen,
|
|
1616
|
+
submitting,
|
|
1617
|
+
settled: false
|
|
1618
|
+
});
|
|
1547
1619
|
const store = _react.useMemo.call(void 0, () => createWithdrawStore(), []);
|
|
1548
|
-
const onErrorRef =
|
|
1620
|
+
const onErrorRef = _chunkH4O22O7Ycjs.useLatestRef.call(void 0, onError);
|
|
1549
1621
|
_react.useEffect.call(void 0, () => {
|
|
1550
1622
|
if (isOpen && typeof onSendTransaction !== "function") {
|
|
1551
|
-
_optionalChain([onErrorRef, 'access',
|
|
1623
|
+
_optionalChain([onErrorRef, 'access', _43 => _43.current, 'optionalCall', _44 => _44({
|
|
1552
1624
|
message: "WithdrawModal requires an `onSendTransaction` function.",
|
|
1553
1625
|
code: "WITHDRAW_MISSING_SEND_TRANSACTION"
|
|
1554
1626
|
})]);
|
|
1555
|
-
_optionalChain([analyticsControllerRef, 'access',
|
|
1627
|
+
_optionalChain([analyticsControllerRef, 'access', _45 => _45.current, 'optionalAccess', _46 => _46.failure, 'call', _47 => _47(
|
|
1556
1628
|
"submission_handler_missing",
|
|
1557
1629
|
false,
|
|
1558
1630
|
"form"
|
|
@@ -1561,12 +1633,13 @@ function WithdrawModal({
|
|
|
1561
1633
|
}, [isOpen, onSendTransaction, onErrorRef]);
|
|
1562
1634
|
const closeWithSource = _react.useCallback.call(void 0,
|
|
1563
1635
|
(source) => {
|
|
1636
|
+
if (submitting || recoverySubmitting) return;
|
|
1564
1637
|
const analytics = analyticsControllerRef.current;
|
|
1565
|
-
_optionalChain([analytics, 'optionalAccess',
|
|
1566
|
-
_optionalChain([analytics, 'optionalAccess',
|
|
1638
|
+
_optionalChain([analytics, 'optionalAccess', _48 => _48.abandon, 'call', _49 => _49("modal_close")]);
|
|
1639
|
+
_optionalChain([analytics, 'optionalAccess', _50 => _50.close, 'call', _51 => _51(source)]);
|
|
1567
1640
|
onClose();
|
|
1568
1641
|
},
|
|
1569
|
-
[onClose]
|
|
1642
|
+
[onClose, submitting, recoverySubmitting]
|
|
1570
1643
|
);
|
|
1571
1644
|
const handleModalDismiss = _react.useCallback.call(void 0,
|
|
1572
1645
|
(reason) => {
|
|
@@ -1579,36 +1652,49 @@ function WithdrawModal({
|
|
|
1579
1652
|
_react.useEffect.call(void 0, () => {
|
|
1580
1653
|
if (previousOpenRef.current && !isOpen) {
|
|
1581
1654
|
const analytics = analyticsControllerRef.current;
|
|
1582
|
-
_optionalChain([analytics, 'optionalAccess',
|
|
1583
|
-
_optionalChain([analytics, 'optionalAccess',
|
|
1655
|
+
_optionalChain([analytics, 'optionalAccess', _52 => _52.abandon, 'call', _53 => _53("modal_close")]);
|
|
1656
|
+
_optionalChain([analytics, 'optionalAccess', _54 => _54.close, 'call', _55 => _55("host_controlled")]);
|
|
1584
1657
|
}
|
|
1585
1658
|
previousOpenRef.current = isOpen;
|
|
1586
1659
|
}, [isOpen]);
|
|
1587
1660
|
_react.useEffect.call(void 0, () => {
|
|
1588
1661
|
if (!isOpen || !modalRef.current) return;
|
|
1589
|
-
return
|
|
1662
|
+
return _chunkH4O22O7Ycjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
1590
1663
|
}, [isOpen, theme]);
|
|
1591
1664
|
_react.useEffect.call(void 0, () => {
|
|
1592
1665
|
if (isOpen) {
|
|
1593
|
-
_optionalChain([onReadyRef, 'access',
|
|
1666
|
+
_optionalChain([onReadyRef, 'access', _56 => _56.current, 'optionalCall', _57 => _57()]);
|
|
1594
1667
|
}
|
|
1595
1668
|
}, [isOpen, onReadyRef]);
|
|
1596
1669
|
_react.useEffect.call(void 0, () => {
|
|
1597
1670
|
if (!isOpen) {
|
|
1598
1671
|
store.dispatch({ type: "modal/reset" });
|
|
1672
|
+
setHistoryRecipient(recipient);
|
|
1599
1673
|
}
|
|
1600
|
-
}, [isOpen, store]);
|
|
1674
|
+
}, [isOpen, store, recipient]);
|
|
1601
1675
|
const handleStepChange = _react.useCallback.call(void 0, (onBack, next) => {
|
|
1602
1676
|
setBackHandler(() => onBack);
|
|
1603
1677
|
if (next) setScreen(next);
|
|
1604
1678
|
}, []);
|
|
1605
1679
|
_react.useEffect.call(void 0, () => {
|
|
1606
|
-
_optionalChain([onUiStateRef, 'access',
|
|
1680
|
+
_optionalChain([onUiStateRef, 'access', _58 => _58.current, 'optionalCall', _59 => _59({
|
|
1607
1681
|
screen,
|
|
1608
1682
|
back: backHandler,
|
|
1609
|
-
|
|
1683
|
+
// A transfer or a recovery in flight is a submission whose outcome is
|
|
1684
|
+
// unknown, so a native host's dismissal lock has to hold through it.
|
|
1685
|
+
submitting: submitting || recoverySubmitting
|
|
1610
1686
|
})]);
|
|
1611
|
-
}, [screen, backHandler, onUiStateRef]);
|
|
1687
|
+
}, [screen, backHandler, submitting, recoverySubmitting, onUiStateRef]);
|
|
1688
|
+
const onLifecycleRef = _chunkH4O22O7Ycjs.useLatestRef.call(void 0, onLifecycle);
|
|
1689
|
+
const handleLifecycle = _react.useCallback.call(void 0,
|
|
1690
|
+
(event) => {
|
|
1691
|
+
_optionalChain([onLifecycleRef, 'access', _60 => _60.current, 'optionalCall', _61 => _61(event)]);
|
|
1692
|
+
if (event.type === "submitted" || event.type === "complete" || event.type === "failed") {
|
|
1693
|
+
markHistoryStale();
|
|
1694
|
+
}
|
|
1695
|
+
},
|
|
1696
|
+
[onLifecycleRef, markHistoryStale]
|
|
1697
|
+
);
|
|
1612
1698
|
const analyticsSessionProperties = buildWithdrawAnalyticsSessionProperties({
|
|
1613
1699
|
inline,
|
|
1614
1700
|
closeOnOverlayClick,
|
|
@@ -1619,18 +1705,19 @@ function WithdrawModal({
|
|
|
1619
1705
|
seedTargetChain: targetChain,
|
|
1620
1706
|
seedTargetToken: _nullishCoalesce(targetToken, () => ( sourceToken))
|
|
1621
1707
|
});
|
|
1622
|
-
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
1623
|
-
const canGoBack = backHandler !== void 0;
|
|
1624
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1625
|
-
|
|
1708
|
+
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _62 => _62.showBackButton]), () => ( true));
|
|
1709
|
+
const canGoBack = backHandler !== void 0 && !submitting;
|
|
1710
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkH4O22O7Ycjs.RpcUrlsProvider, { value: rpcUrls, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkH4O22O7Ycjs.ChainCatalogProvider, { service, rpcUrls, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WithdrawStoreProvider, { store, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1711
|
+
_chunkH4O22O7Ycjs.Modal,
|
|
1626
1712
|
{
|
|
1627
1713
|
isOpen,
|
|
1628
1714
|
onClose: handleModalDismiss,
|
|
1629
1715
|
className,
|
|
1630
1716
|
inline,
|
|
1631
1717
|
closeOnOverlayClick,
|
|
1718
|
+
ariaLabel: "Withdraw",
|
|
1632
1719
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1633
|
-
|
|
1720
|
+
_chunkH4O22O7Ycjs.AnalyticsSession,
|
|
1634
1721
|
{
|
|
1635
1722
|
modal: "withdraw",
|
|
1636
1723
|
sessionProperties: analyticsSessionProperties,
|
|
@@ -1638,6 +1725,7 @@ function WithdrawModal({
|
|
|
1638
1725
|
backendUrl,
|
|
1639
1726
|
enableIngest: enableAnalyticsIngest,
|
|
1640
1727
|
ingestUrl: analyticsIngestUrl,
|
|
1728
|
+
sessionIdRef: analyticsSessionIdRef,
|
|
1641
1729
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1642
1730
|
WithdrawAnalyticsControllerProvider,
|
|
1643
1731
|
{
|
|
@@ -1651,19 +1739,28 @@ function WithdrawModal({
|
|
|
1651
1739
|
className: "rs-modal-header-back",
|
|
1652
1740
|
"aria-label": "Go back",
|
|
1653
1741
|
onClick: backHandler,
|
|
1654
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1742
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkH4O22O7Ycjs.ChevronLeftIcon, {})
|
|
1655
1743
|
}
|
|
1656
1744
|
) }),
|
|
1657
|
-
/* @__PURE__ */ _jsxruntime.
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1745
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header-nav-right", children: [
|
|
1746
|
+
historyButtonVisible && historyRecipient && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1747
|
+
_chunkH4O22O7Ycjs.HistoryEntryButton,
|
|
1748
|
+
{
|
|
1749
|
+
badge: history.badge,
|
|
1750
|
+
onClick: history.openPanel
|
|
1751
|
+
}
|
|
1752
|
+
),
|
|
1753
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1754
|
+
"button",
|
|
1755
|
+
{
|
|
1756
|
+
type: "button",
|
|
1757
|
+
onClick: () => closeWithSource("header_button"),
|
|
1758
|
+
className: "rs-modal-close",
|
|
1759
|
+
"aria-label": "Close",
|
|
1760
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkH4O22O7Ycjs.CloseIcon, {})
|
|
1761
|
+
}
|
|
1762
|
+
)
|
|
1763
|
+
] })
|
|
1667
1764
|
] }),
|
|
1668
1765
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1669
1766
|
WithdrawFlow,
|
|
@@ -1680,10 +1777,32 @@ function WithdrawModal({
|
|
|
1680
1777
|
onSendTransaction,
|
|
1681
1778
|
onStepChange: handleStepChange,
|
|
1682
1779
|
onClose: closeWithSource,
|
|
1683
|
-
|
|
1780
|
+
onDestinationChange: setHistoryRecipient,
|
|
1781
|
+
onSubmittingChange: setSubmitting,
|
|
1782
|
+
onLifecycle: handleLifecycle,
|
|
1684
1783
|
onError,
|
|
1685
1784
|
debug
|
|
1686
1785
|
}
|
|
1786
|
+
),
|
|
1787
|
+
history.isPanelOpen && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1788
|
+
_chunkH4O22O7Ycjs.HistoryOverlay,
|
|
1789
|
+
{
|
|
1790
|
+
controller: history,
|
|
1791
|
+
backLabel: "Withdraw",
|
|
1792
|
+
title: "Deposit history",
|
|
1793
|
+
recipient: historyRecipient,
|
|
1794
|
+
backendUrl,
|
|
1795
|
+
service,
|
|
1796
|
+
signRecovery,
|
|
1797
|
+
debug,
|
|
1798
|
+
onCloseModal: () => closeWithSource("header_button"),
|
|
1799
|
+
analytics: historyAnalytics,
|
|
1800
|
+
inline,
|
|
1801
|
+
closeOnOverlayClick,
|
|
1802
|
+
enableAnalyticsIngest,
|
|
1803
|
+
analyticsIngestUrl,
|
|
1804
|
+
onEvent
|
|
1805
|
+
}
|
|
1687
1806
|
)
|
|
1688
1807
|
] })
|
|
1689
1808
|
}
|