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