@rhinestone/deposit-modal 0.3.0-alpha.0 → 0.3.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DepositModalReown-GXY65HZP.mjs → DepositModalReown-2S76TEXU.mjs} +9 -6
- package/dist/{DepositModalReown-HVIEA6YA.cjs → DepositModalReown-4NV6JM2U.cjs} +12 -9
- package/dist/{QRCode-SMMYPUQC.cjs → QRCode-KG47KTGX.cjs} +1 -1
- package/dist/{QRCode-YMQTKSSK.mjs → QRCode-YJ3EGWQS.mjs} +1 -1
- package/dist/{WithdrawModalReown-O6V6KRH6.mjs → WithdrawModalReown-QEQPCSWT.mjs} +4 -4
- package/dist/{WithdrawModalReown-4M3PBY2T.cjs → WithdrawModalReown-Z5JVENP6.cjs} +7 -7
- package/dist/{chunk-Y3RA3YGA.cjs → chunk-2TWQGPPB.cjs} +1323 -590
- package/dist/chunk-7JIDIX27.cjs +554 -0
- package/dist/{chunk-FKPTIHU7.mjs → chunk-7MZNQ4C2.mjs} +76 -351
- package/dist/{chunk-YQFH2WSW.cjs → chunk-FGVSNARE.cjs} +55 -25
- package/dist/{chunk-7SYZG47X.cjs → chunk-HUPEN2T5.cjs} +2820 -1509
- package/dist/{chunk-U5QIFNG4.mjs → chunk-N5NOJ4ZV.mjs} +2746 -1435
- package/dist/{chunk-5YXAQB6A.mjs → chunk-QXIJLRKC.mjs} +56 -26
- package/dist/chunk-SZIYS42B.mjs +554 -0
- package/dist/{chunk-UIHAYD7J.mjs → chunk-WVE3JN3C.mjs} +1308 -575
- package/dist/{chunk-Z2SIC2TH.cjs → chunk-YI63OMXN.cjs} +157 -432
- package/dist/constants-DqVn968d.d.cts +52 -0
- package/dist/constants-DqVn968d.d.ts +52 -0
- package/dist/constants.cjs +8 -2
- package/dist/constants.d.cts +17 -48
- package/dist/constants.d.ts +17 -48
- package/dist/constants.mjs +7 -1
- package/dist/deposit.cjs +4 -4
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +3 -3
- package/dist/index.cjs +16 -7
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +16 -7
- package/dist/styles.css +656 -207
- package/dist/{types-DRou84ZM.d.cts → types-D6wrO4Ow.d.cts} +33 -8
- package/dist/{types-DRou84ZM.d.ts → types-D6wrO4Ow.d.ts} +33 -8
- package/dist/withdraw.cjs +4 -4
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +2 -2
- package/dist/withdraw.mjs +3 -3
- package/package.json +5 -5
- package/dist/chunk-EEHUOFIW.mjs +0 -524
- package/dist/chunk-XCAF6B3D.cjs +0 -524
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
AlertTriangleIcon,
|
|
3
2
|
BodyHeader,
|
|
4
3
|
Button,
|
|
4
|
+
Callout,
|
|
5
5
|
ChevronDownIcon,
|
|
6
6
|
ChevronLeftIcon,
|
|
7
7
|
CircleArrowOutUpLeftIcon,
|
|
@@ -14,12 +14,15 @@ import {
|
|
|
14
14
|
WalletIcon,
|
|
15
15
|
accountFromPrivateKey,
|
|
16
16
|
applyTheme,
|
|
17
|
+
buildSafeTransaction,
|
|
17
18
|
buildSessionDetails,
|
|
18
19
|
createDepositService,
|
|
19
20
|
createSessionOwnerKey,
|
|
20
21
|
currencyFormatter,
|
|
21
22
|
debugError,
|
|
22
23
|
debugLog,
|
|
24
|
+
executeSafeErc20Transfer,
|
|
25
|
+
executeSafeEthTransfer,
|
|
23
26
|
formatUserError,
|
|
24
27
|
getAssetId,
|
|
25
28
|
getPublicClient,
|
|
@@ -28,7 +31,7 @@ import {
|
|
|
28
31
|
saveSessionOwnerToStorage,
|
|
29
32
|
toEvmCaip2,
|
|
30
33
|
useLatestRef
|
|
31
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-WVE3JN3C.mjs";
|
|
32
35
|
import {
|
|
33
36
|
DEFAULT_BACKEND_URL,
|
|
34
37
|
DEFAULT_SIGNER_ADDRESS,
|
|
@@ -41,7 +44,7 @@ import {
|
|
|
41
44
|
getTokenDecimalsByAddress,
|
|
42
45
|
getTokenIcon,
|
|
43
46
|
getTokenSymbol
|
|
44
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-SZIYS42B.mjs";
|
|
45
48
|
|
|
46
49
|
// src/WithdrawModal.tsx
|
|
47
50
|
import {
|
|
@@ -57,7 +60,7 @@ import {
|
|
|
57
60
|
// src/WithdrawFlow.tsx
|
|
58
61
|
import { useCallback as useCallback2, useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2, useState as useState3 } from "react";
|
|
59
62
|
|
|
60
|
-
// src/store/withdraw.
|
|
63
|
+
// src/store/withdraw.ts
|
|
61
64
|
import { createContext, createElement, useContext } from "react";
|
|
62
65
|
import { useStore } from "zustand";
|
|
63
66
|
import { createStore } from "zustand/vanilla";
|
|
@@ -316,7 +319,7 @@ function WithdrawFormStep({
|
|
|
316
319
|
useEffect(() => {
|
|
317
320
|
if (balance === null) return;
|
|
318
321
|
const sym = asset.symbol.toUpperCase();
|
|
319
|
-
if (sym !== "USDC" && sym !== "USDT") return;
|
|
322
|
+
if (sym !== "USDC" && sym !== "USDT" && sym !== "USDT0") return;
|
|
320
323
|
try {
|
|
321
324
|
const raw = formatUnits(balance, asset.decimals);
|
|
322
325
|
const numeric = Number(raw);
|
|
@@ -331,7 +334,7 @@ function WithdrawFormStep({
|
|
|
331
334
|
const parsed = Number(amount);
|
|
332
335
|
if (!Number.isFinite(parsed) || parsed <= 0) return null;
|
|
333
336
|
const sym = asset.symbol.toUpperCase();
|
|
334
|
-
if (sym === "USDC" || sym === "USDT") {
|
|
337
|
+
if (sym === "USDC" || sym === "USDT" || sym === "USDT0") {
|
|
335
338
|
return parsed;
|
|
336
339
|
}
|
|
337
340
|
return null;
|
|
@@ -382,8 +385,8 @@ function WithdrawFormStep({
|
|
|
382
385
|
}
|
|
383
386
|
}, [recipient, amount, balance, asset.decimals, onSubmit]);
|
|
384
387
|
if (isBalanceLoading) {
|
|
385
|
-
return /* @__PURE__ */ jsxs("div", { className: "rs-
|
|
386
|
-
/* @__PURE__ */ jsxs("div", { className: "rs-
|
|
388
|
+
return /* @__PURE__ */ jsxs("div", { className: "rs-screen", children: [
|
|
389
|
+
/* @__PURE__ */ jsxs("div", { className: "rs-screen-body rs-withdraw-loading", children: [
|
|
387
390
|
/* @__PURE__ */ jsx(Spinner, { className: "rs-spinner--lg" }),
|
|
388
391
|
/* @__PURE__ */ jsx("div", { className: "rs-withdraw-loading-title", children: "Loading on-chain balance" }),
|
|
389
392
|
/* @__PURE__ */ jsx("div", { className: "rs-withdraw-loading-subtitle", children: chainMismatch ? `Switch to ${getChainName(asset.chainId)} to continue.` : "Please wait before withdrawing." })
|
|
@@ -391,15 +394,23 @@ function WithdrawFormStep({
|
|
|
391
394
|
/* @__PURE__ */ jsx(PoweredBy, {})
|
|
392
395
|
] });
|
|
393
396
|
}
|
|
394
|
-
return /* @__PURE__ */ jsxs("div", { className: "rs-
|
|
395
|
-
/* @__PURE__ */ jsxs("div", { className: "rs-
|
|
397
|
+
return /* @__PURE__ */ jsxs("div", { className: "rs-screen", children: [
|
|
398
|
+
/* @__PURE__ */ jsxs("div", { className: "rs-screen-body", children: [
|
|
396
399
|
/* @__PURE__ */ jsx(BodyHeader, { icon: /* @__PURE__ */ jsx(CircleArrowOutUpLeftIcon, {}), title: "Withdraw" }),
|
|
397
400
|
/* @__PURE__ */ jsxs("div", { className: "rs-withdraw-section", children: [
|
|
398
|
-
/* @__PURE__ */ jsx(
|
|
401
|
+
/* @__PURE__ */ jsx(
|
|
402
|
+
"label",
|
|
403
|
+
{
|
|
404
|
+
className: "rs-withdraw-label",
|
|
405
|
+
htmlFor: "rs-withdraw-recipient",
|
|
406
|
+
children: "Recipient address"
|
|
407
|
+
}
|
|
408
|
+
),
|
|
399
409
|
/* @__PURE__ */ jsxs("div", { className: "rs-withdraw-input-row", children: [
|
|
400
410
|
/* @__PURE__ */ jsx(
|
|
401
411
|
"input",
|
|
402
412
|
{
|
|
413
|
+
id: "rs-withdraw-recipient",
|
|
403
414
|
type: "text",
|
|
404
415
|
className: "rs-withdraw-input rs-withdraw-input--address",
|
|
405
416
|
placeholder: "0x...",
|
|
@@ -439,11 +450,12 @@ function WithdrawFormStep({
|
|
|
439
450
|
] })
|
|
440
451
|
] }),
|
|
441
452
|
/* @__PURE__ */ jsxs("div", { className: "rs-withdraw-section", children: [
|
|
442
|
-
/* @__PURE__ */ jsx("label", { className: "rs-withdraw-label", children: "Amount" }),
|
|
453
|
+
/* @__PURE__ */ jsx("label", { className: "rs-withdraw-label", htmlFor: "rs-withdraw-amount", children: "Amount" }),
|
|
443
454
|
/* @__PURE__ */ jsxs("div", { className: "rs-withdraw-input-row", children: [
|
|
444
455
|
/* @__PURE__ */ jsx(
|
|
445
456
|
"input",
|
|
446
457
|
{
|
|
458
|
+
id: "rs-withdraw-amount",
|
|
447
459
|
type: "text",
|
|
448
460
|
inputMode: "decimal",
|
|
449
461
|
className: "rs-withdraw-input rs-withdraw-input--amount",
|
|
@@ -481,7 +493,7 @@ function WithdrawFormStep({
|
|
|
481
493
|
] }),
|
|
482
494
|
/* @__PURE__ */ jsxs("div", { className: "rs-withdraw-receive-row", children: [
|
|
483
495
|
/* @__PURE__ */ jsxs("div", { className: "rs-withdraw-receive-col", children: [
|
|
484
|
-
/* @__PURE__ */ jsx("
|
|
496
|
+
/* @__PURE__ */ jsx("span", { className: "rs-withdraw-label rs-withdraw-label--sm", children: "Receive chain" }),
|
|
485
497
|
/* @__PURE__ */ jsxs(
|
|
486
498
|
"div",
|
|
487
499
|
{
|
|
@@ -492,6 +504,7 @@ function WithdrawFormStep({
|
|
|
492
504
|
"button",
|
|
493
505
|
{
|
|
494
506
|
type: "button",
|
|
507
|
+
"aria-label": "Receive chain",
|
|
495
508
|
className: "rs-withdraw-dropdown",
|
|
496
509
|
onClick: () => {
|
|
497
510
|
setShowChainDropdown(!showChainDropdown);
|
|
@@ -549,7 +562,7 @@ function WithdrawFormStep({
|
|
|
549
562
|
)
|
|
550
563
|
] }),
|
|
551
564
|
/* @__PURE__ */ jsxs("div", { className: "rs-withdraw-receive-col", children: [
|
|
552
|
-
/* @__PURE__ */ jsx("
|
|
565
|
+
/* @__PURE__ */ jsx("span", { className: "rs-withdraw-label rs-withdraw-label--sm", children: "Receive token" }),
|
|
553
566
|
/* @__PURE__ */ jsxs(
|
|
554
567
|
"div",
|
|
555
568
|
{
|
|
@@ -560,6 +573,7 @@ function WithdrawFormStep({
|
|
|
560
573
|
"button",
|
|
561
574
|
{
|
|
562
575
|
type: "button",
|
|
576
|
+
"aria-label": "Receive token",
|
|
563
577
|
className: "rs-withdraw-dropdown",
|
|
564
578
|
onClick: () => {
|
|
565
579
|
setShowTokenDropdown(!showTokenDropdown);
|
|
@@ -618,25 +632,19 @@ function WithdrawFormStep({
|
|
|
618
632
|
] })
|
|
619
633
|
] }),
|
|
620
634
|
chainMismatch && /* @__PURE__ */ jsx("div", { className: "rs-chain-switch", children: /* @__PURE__ */ jsx("div", { className: "rs-chain-switch-text", children: isSwitching ? `Switching to ${getChainName(asset.chainId)}...` : `Switch to ${getChainName(asset.chainId)} to continue.` }) }),
|
|
621
|
-
error && /* @__PURE__ */
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
635
|
+
error && /* @__PURE__ */ jsx(Callout, { variant: "error", children: error }),
|
|
636
|
+
!error && registrationError && /* @__PURE__ */ jsx(Callout, { variant: "error", children: registrationError }),
|
|
637
|
+
/* @__PURE__ */ jsx(
|
|
638
|
+
Button,
|
|
639
|
+
{
|
|
640
|
+
onClick: handleWithdraw,
|
|
641
|
+
fullWidth: true,
|
|
642
|
+
loading: isBusy,
|
|
643
|
+
disabled: !recipient || !amount || chainMismatch || isBusy || Boolean(registrationError),
|
|
644
|
+
children: isBusy ? "Preparing..." : registrationPending ? "Preparing session..." : !recipient ? "Enter Recipient Address" : !amount ? "Enter Withdraw Amount" : "Withdraw"
|
|
645
|
+
}
|
|
646
|
+
)
|
|
629
647
|
] }),
|
|
630
|
-
/* @__PURE__ */ jsx("div", { className: "rs-step-footer", children: /* @__PURE__ */ jsx(
|
|
631
|
-
Button,
|
|
632
|
-
{
|
|
633
|
-
onClick: handleWithdraw,
|
|
634
|
-
fullWidth: true,
|
|
635
|
-
loading: isBusy,
|
|
636
|
-
disabled: !recipient || !amount || chainMismatch || isBusy || Boolean(registrationError),
|
|
637
|
-
children: isBusy ? "Preparing..." : registrationPending ? "Preparing session..." : !recipient ? "Enter Recipient Address" : !amount ? "Enter Withdraw Amount" : "Withdraw"
|
|
638
|
-
}
|
|
639
|
-
) }),
|
|
640
648
|
/* @__PURE__ */ jsx(PoweredBy, {})
|
|
641
649
|
] });
|
|
642
650
|
}
|
|
@@ -694,60 +702,54 @@ function WithdrawReviewStep({
|
|
|
694
702
|
title: "Review withdrawal"
|
|
695
703
|
}
|
|
696
704
|
),
|
|
697
|
-
/* @__PURE__ */ jsxs2("div", { className: "rs-
|
|
698
|
-
/* @__PURE__ */ jsxs2("div", { className: "rs-
|
|
705
|
+
/* @__PURE__ */ jsxs2("div", { className: "rs-review-details", children: [
|
|
706
|
+
/* @__PURE__ */ jsxs2("div", { className: "rs-review-detail-row", children: [
|
|
699
707
|
/* @__PURE__ */ jsx2("span", { children: "You send" }),
|
|
700
|
-
/* @__PURE__ */ jsxs2("span", { className: "rs-
|
|
708
|
+
/* @__PURE__ */ jsxs2("span", { className: "rs-review-detail-value", children: [
|
|
701
709
|
/* @__PURE__ */ jsxs2("span", { children: [
|
|
702
710
|
amount,
|
|
703
711
|
" ",
|
|
704
712
|
sourceSymbol
|
|
705
713
|
] }),
|
|
706
|
-
sourceTokenIcon && /* @__PURE__ */ jsx2("span", { className: "rs-
|
|
714
|
+
sourceTokenIcon && /* @__PURE__ */ jsx2("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx2("img", { src: sourceTokenIcon, alt: "" }) })
|
|
707
715
|
] })
|
|
708
716
|
] }),
|
|
709
|
-
/* @__PURE__ */ jsxs2("div", { className: "rs-
|
|
717
|
+
/* @__PURE__ */ jsxs2("div", { className: "rs-review-detail-row", children: [
|
|
710
718
|
/* @__PURE__ */ jsx2("span", { children: "Source chain" }),
|
|
711
|
-
/* @__PURE__ */ jsxs2("span", { className: "rs-
|
|
719
|
+
/* @__PURE__ */ jsxs2("span", { className: "rs-review-detail-value", children: [
|
|
712
720
|
/* @__PURE__ */ jsx2("span", { children: sourceChainName }),
|
|
713
|
-
sourceChainIcon && /* @__PURE__ */ jsx2("span", { className: "rs-
|
|
721
|
+
sourceChainIcon && /* @__PURE__ */ jsx2("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx2("img", { src: sourceChainIcon, alt: "" }) })
|
|
714
722
|
] })
|
|
715
723
|
] }),
|
|
716
|
-
/* @__PURE__ */ jsxs2("div", { className: "rs-
|
|
724
|
+
/* @__PURE__ */ jsxs2("div", { className: "rs-review-detail-row", children: [
|
|
717
725
|
/* @__PURE__ */ jsx2("span", { children: "Recipient" }),
|
|
718
|
-
/* @__PURE__ */ jsx2("span", { className: "rs-
|
|
726
|
+
/* @__PURE__ */ jsx2("span", { className: "rs-review-detail-value", children: /* @__PURE__ */ jsx2("span", { children: shortenAddress(recipient) }) })
|
|
719
727
|
] }),
|
|
720
|
-
/* @__PURE__ */ jsxs2("div", { className: "rs-
|
|
728
|
+
/* @__PURE__ */ jsxs2("div", { className: "rs-review-detail-row", children: [
|
|
721
729
|
/* @__PURE__ */ jsx2("span", { children: "Receive" }),
|
|
722
|
-
/* @__PURE__ */ jsxs2("span", { className: "rs-
|
|
730
|
+
/* @__PURE__ */ jsxs2("span", { className: "rs-review-detail-value", children: [
|
|
723
731
|
/* @__PURE__ */ jsxs2("span", { children: [
|
|
724
732
|
amount,
|
|
725
733
|
" ",
|
|
726
734
|
targetSymbol
|
|
727
735
|
] }),
|
|
728
|
-
targetTokenIcon && /* @__PURE__ */ jsx2("span", { className: "rs-
|
|
736
|
+
targetTokenIcon && /* @__PURE__ */ jsx2("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx2("img", { src: targetTokenIcon, alt: "" }) })
|
|
729
737
|
] })
|
|
730
738
|
] }),
|
|
731
|
-
/* @__PURE__ */ jsxs2("div", { className: "rs-
|
|
739
|
+
/* @__PURE__ */ jsxs2("div", { className: "rs-review-detail-row", children: [
|
|
732
740
|
/* @__PURE__ */ jsx2("span", { children: "Destination chain" }),
|
|
733
|
-
/* @__PURE__ */ jsxs2("span", { className: "rs-
|
|
741
|
+
/* @__PURE__ */ jsxs2("span", { className: "rs-review-detail-value", children: [
|
|
734
742
|
/* @__PURE__ */ jsx2("span", { children: targetChainName }),
|
|
735
|
-
targetChainIcon && /* @__PURE__ */ jsx2("span", { className: "rs-
|
|
743
|
+
targetChainIcon && /* @__PURE__ */ jsx2("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx2("img", { src: targetChainIcon, alt: "" }) })
|
|
736
744
|
] })
|
|
737
745
|
] }),
|
|
738
|
-
/* @__PURE__ */ jsxs2("div", { className: "rs-
|
|
746
|
+
/* @__PURE__ */ jsxs2("div", { className: "rs-review-detail-row", children: [
|
|
739
747
|
/* @__PURE__ */ jsx2("span", { children: "Estimated time" }),
|
|
740
|
-
/* @__PURE__ */ jsx2("span", { className: "rs-
|
|
748
|
+
/* @__PURE__ */ jsx2("span", { className: "rs-review-detail-value", children: estimatedTime })
|
|
741
749
|
] })
|
|
742
750
|
] }),
|
|
743
|
-
error && /* @__PURE__ */
|
|
744
|
-
|
|
745
|
-
/* @__PURE__ */ jsx2("span", { children: error })
|
|
746
|
-
] }),
|
|
747
|
-
!error && registrationError && /* @__PURE__ */ jsxs2("div", { className: "rs-amount-error", role: "alert", children: [
|
|
748
|
-
/* @__PURE__ */ jsx2(AlertTriangleIcon, { style: { width: 16, height: 16, flexShrink: 0 } }),
|
|
749
|
-
/* @__PURE__ */ jsx2("span", { children: registrationError })
|
|
750
|
-
] }),
|
|
751
|
+
error && /* @__PURE__ */ jsx2(Callout, { variant: "error", children: error }),
|
|
752
|
+
!error && registrationError && /* @__PURE__ */ jsx2(Callout, { variant: "error", children: registrationError }),
|
|
751
753
|
/* @__PURE__ */ jsx2(
|
|
752
754
|
Button,
|
|
753
755
|
{
|
|
@@ -765,293 +767,8 @@ function WithdrawReviewStep({
|
|
|
765
767
|
}
|
|
766
768
|
WithdrawReviewStep.displayName = "WithdrawReviewStep";
|
|
767
769
|
|
|
768
|
-
// src/core/safe.ts
|
|
769
|
-
import {
|
|
770
|
-
concat,
|
|
771
|
-
encodeFunctionData,
|
|
772
|
-
erc20Abi as erc20Abi2,
|
|
773
|
-
hashTypedData,
|
|
774
|
-
pad,
|
|
775
|
-
parseEventLogs,
|
|
776
|
-
toHex,
|
|
777
|
-
zeroAddress
|
|
778
|
-
} from "viem";
|
|
779
|
-
var SAFE_ABI = [
|
|
780
|
-
{
|
|
781
|
-
type: "function",
|
|
782
|
-
name: "isOwner",
|
|
783
|
-
stateMutability: "view",
|
|
784
|
-
inputs: [{ name: "owner", type: "address" }],
|
|
785
|
-
outputs: [{ name: "", type: "bool" }]
|
|
786
|
-
},
|
|
787
|
-
{
|
|
788
|
-
type: "function",
|
|
789
|
-
name: "nonce",
|
|
790
|
-
stateMutability: "view",
|
|
791
|
-
inputs: [],
|
|
792
|
-
outputs: [{ type: "uint256" }]
|
|
793
|
-
},
|
|
794
|
-
{
|
|
795
|
-
type: "function",
|
|
796
|
-
name: "execTransaction",
|
|
797
|
-
stateMutability: "payable",
|
|
798
|
-
inputs: [
|
|
799
|
-
{ name: "to", type: "address" },
|
|
800
|
-
{ name: "value", type: "uint256" },
|
|
801
|
-
{ name: "data", type: "bytes" },
|
|
802
|
-
{ name: "operation", type: "uint8" },
|
|
803
|
-
{ name: "safeTxGas", type: "uint256" },
|
|
804
|
-
{ name: "baseGas", type: "uint256" },
|
|
805
|
-
{ name: "gasPrice", type: "uint256" },
|
|
806
|
-
{ name: "gasToken", type: "address" },
|
|
807
|
-
{ name: "refundReceiver", type: "address" },
|
|
808
|
-
{ name: "signatures", type: "bytes" }
|
|
809
|
-
],
|
|
810
|
-
outputs: [{ name: "success", type: "bool" }]
|
|
811
|
-
},
|
|
812
|
-
{
|
|
813
|
-
type: "event",
|
|
814
|
-
name: "ExecutionSuccess",
|
|
815
|
-
inputs: [
|
|
816
|
-
{ name: "txHash", type: "bytes32", indexed: true },
|
|
817
|
-
{ name: "payment", type: "uint256", indexed: false }
|
|
818
|
-
],
|
|
819
|
-
anonymous: false
|
|
820
|
-
},
|
|
821
|
-
{
|
|
822
|
-
type: "event",
|
|
823
|
-
name: "ExecutionFailure",
|
|
824
|
-
inputs: [
|
|
825
|
-
{ name: "txHash", type: "bytes32", indexed: true },
|
|
826
|
-
{ name: "payment", type: "uint256", indexed: false }
|
|
827
|
-
],
|
|
828
|
-
anonymous: false
|
|
829
|
-
}
|
|
830
|
-
];
|
|
831
|
-
async function executeSafeEthTransfer(params) {
|
|
832
|
-
const {
|
|
833
|
-
walletClient,
|
|
834
|
-
publicClient,
|
|
835
|
-
safeAddress,
|
|
836
|
-
recipient,
|
|
837
|
-
amount,
|
|
838
|
-
chainId
|
|
839
|
-
} = params;
|
|
840
|
-
const account = walletClient.account;
|
|
841
|
-
const chain = walletClient.chain;
|
|
842
|
-
if (!account || !chain) {
|
|
843
|
-
throw new Error("Wallet not connected");
|
|
844
|
-
}
|
|
845
|
-
if (chain.id !== chainId) {
|
|
846
|
-
throw new Error(`Switch to ${getChainName(chainId)} to sign`);
|
|
847
|
-
}
|
|
848
|
-
const isOwner = await publicClient.readContract({
|
|
849
|
-
address: safeAddress,
|
|
850
|
-
abi: SAFE_ABI,
|
|
851
|
-
functionName: "isOwner",
|
|
852
|
-
args: [account.address]
|
|
853
|
-
});
|
|
854
|
-
if (!isOwner) {
|
|
855
|
-
throw new Error("Connected wallet is not a Safe owner");
|
|
856
|
-
}
|
|
857
|
-
const safeTx = {
|
|
858
|
-
to: recipient,
|
|
859
|
-
value: amount,
|
|
860
|
-
data: "0x",
|
|
861
|
-
operation: 0,
|
|
862
|
-
safeTxGas: 0n,
|
|
863
|
-
baseGas: 0n,
|
|
864
|
-
gasPrice: 0n,
|
|
865
|
-
gasToken: zeroAddress,
|
|
866
|
-
refundReceiver: zeroAddress
|
|
867
|
-
};
|
|
868
|
-
const signature = concat([
|
|
869
|
-
pad(account.address, { size: 32 }),
|
|
870
|
-
pad(toHex(0), { size: 32 }),
|
|
871
|
-
toHex(1, { size: 1 })
|
|
872
|
-
]);
|
|
873
|
-
const txHash = await walletClient.writeContract({
|
|
874
|
-
account,
|
|
875
|
-
chain,
|
|
876
|
-
address: safeAddress,
|
|
877
|
-
abi: SAFE_ABI,
|
|
878
|
-
functionName: "execTransaction",
|
|
879
|
-
args: [
|
|
880
|
-
safeTx.to,
|
|
881
|
-
safeTx.value,
|
|
882
|
-
safeTx.data,
|
|
883
|
-
safeTx.operation,
|
|
884
|
-
safeTx.safeTxGas,
|
|
885
|
-
safeTx.baseGas,
|
|
886
|
-
safeTx.gasPrice,
|
|
887
|
-
safeTx.gasToken,
|
|
888
|
-
safeTx.refundReceiver,
|
|
889
|
-
signature
|
|
890
|
-
]
|
|
891
|
-
});
|
|
892
|
-
const receipt = await publicClient.waitForTransactionReceipt({
|
|
893
|
-
hash: txHash
|
|
894
|
-
});
|
|
895
|
-
const safeLogs = receipt.logs.filter(
|
|
896
|
-
(log) => log.address.toLowerCase() === safeAddress.toLowerCase()
|
|
897
|
-
);
|
|
898
|
-
const parsed = parseEventLogs({
|
|
899
|
-
abi: SAFE_ABI,
|
|
900
|
-
logs: safeLogs,
|
|
901
|
-
strict: false
|
|
902
|
-
});
|
|
903
|
-
const failed = parsed.find((log) => log.eventName === "ExecutionFailure");
|
|
904
|
-
if (failed) {
|
|
905
|
-
throw new Error("Safe transaction failed");
|
|
906
|
-
}
|
|
907
|
-
const succeeded = parsed.find((log) => log.eventName === "ExecutionSuccess");
|
|
908
|
-
if (!succeeded) {
|
|
909
|
-
throw new Error("Safe transaction status unavailable");
|
|
910
|
-
}
|
|
911
|
-
return { txHash };
|
|
912
|
-
}
|
|
913
|
-
async function executeSafeErc20Transfer(params) {
|
|
914
|
-
const {
|
|
915
|
-
walletClient,
|
|
916
|
-
publicClient,
|
|
917
|
-
safeAddress,
|
|
918
|
-
tokenAddress,
|
|
919
|
-
recipient,
|
|
920
|
-
amount,
|
|
921
|
-
chainId
|
|
922
|
-
} = params;
|
|
923
|
-
const account = walletClient.account;
|
|
924
|
-
const chain = walletClient.chain;
|
|
925
|
-
if (!account || !chain) {
|
|
926
|
-
throw new Error("Wallet not connected");
|
|
927
|
-
}
|
|
928
|
-
if (chain.id !== chainId) {
|
|
929
|
-
throw new Error(`Switch to ${getChainName(chainId)} to sign`);
|
|
930
|
-
}
|
|
931
|
-
const isOwner = await publicClient.readContract({
|
|
932
|
-
address: safeAddress,
|
|
933
|
-
abi: SAFE_ABI,
|
|
934
|
-
functionName: "isOwner",
|
|
935
|
-
args: [account.address]
|
|
936
|
-
});
|
|
937
|
-
if (!isOwner) {
|
|
938
|
-
throw new Error("Connected wallet is not a Safe owner");
|
|
939
|
-
}
|
|
940
|
-
const data = encodeFunctionData({
|
|
941
|
-
abi: erc20Abi2,
|
|
942
|
-
functionName: "transfer",
|
|
943
|
-
args: [recipient, amount]
|
|
944
|
-
});
|
|
945
|
-
const safeTx = {
|
|
946
|
-
to: tokenAddress,
|
|
947
|
-
value: 0n,
|
|
948
|
-
data,
|
|
949
|
-
operation: 0,
|
|
950
|
-
safeTxGas: 0n,
|
|
951
|
-
baseGas: 0n,
|
|
952
|
-
gasPrice: 0n,
|
|
953
|
-
gasToken: zeroAddress,
|
|
954
|
-
refundReceiver: zeroAddress
|
|
955
|
-
};
|
|
956
|
-
const signature = concat([
|
|
957
|
-
pad(account.address, { size: 32 }),
|
|
958
|
-
pad(toHex(0), { size: 32 }),
|
|
959
|
-
toHex(1, { size: 1 })
|
|
960
|
-
]);
|
|
961
|
-
const txHash = await walletClient.writeContract({
|
|
962
|
-
account,
|
|
963
|
-
chain,
|
|
964
|
-
address: safeAddress,
|
|
965
|
-
abi: SAFE_ABI,
|
|
966
|
-
functionName: "execTransaction",
|
|
967
|
-
args: [
|
|
968
|
-
safeTx.to,
|
|
969
|
-
safeTx.value,
|
|
970
|
-
safeTx.data,
|
|
971
|
-
safeTx.operation,
|
|
972
|
-
safeTx.safeTxGas,
|
|
973
|
-
safeTx.baseGas,
|
|
974
|
-
safeTx.gasPrice,
|
|
975
|
-
safeTx.gasToken,
|
|
976
|
-
safeTx.refundReceiver,
|
|
977
|
-
signature
|
|
978
|
-
]
|
|
979
|
-
});
|
|
980
|
-
const receipt = await publicClient.waitForTransactionReceipt({
|
|
981
|
-
hash: txHash
|
|
982
|
-
});
|
|
983
|
-
const safeLogs = receipt.logs.filter(
|
|
984
|
-
(log) => log.address.toLowerCase() === safeAddress.toLowerCase()
|
|
985
|
-
);
|
|
986
|
-
const parsed = parseEventLogs({
|
|
987
|
-
abi: SAFE_ABI,
|
|
988
|
-
logs: safeLogs,
|
|
989
|
-
strict: false
|
|
990
|
-
});
|
|
991
|
-
const failed = parsed.find((log) => log.eventName === "ExecutionFailure");
|
|
992
|
-
if (failed) {
|
|
993
|
-
throw new Error("Safe transaction failed");
|
|
994
|
-
}
|
|
995
|
-
const succeeded = parsed.find((log) => log.eventName === "ExecutionSuccess");
|
|
996
|
-
if (!succeeded) {
|
|
997
|
-
throw new Error("Safe transaction status unavailable");
|
|
998
|
-
}
|
|
999
|
-
return { txHash };
|
|
1000
|
-
}
|
|
1001
|
-
var SAFE_TX_TYPES = {
|
|
1002
|
-
SafeTx: [
|
|
1003
|
-
{ name: "to", type: "address" },
|
|
1004
|
-
{ name: "value", type: "uint256" },
|
|
1005
|
-
{ name: "data", type: "bytes" },
|
|
1006
|
-
{ name: "operation", type: "uint8" },
|
|
1007
|
-
{ name: "safeTxGas", type: "uint256" },
|
|
1008
|
-
{ name: "baseGas", type: "uint256" },
|
|
1009
|
-
{ name: "gasPrice", type: "uint256" },
|
|
1010
|
-
{ name: "gasToken", type: "address" },
|
|
1011
|
-
{ name: "refundReceiver", type: "address" },
|
|
1012
|
-
{ name: "nonce", type: "uint256" }
|
|
1013
|
-
]
|
|
1014
|
-
};
|
|
1015
|
-
async function buildSafeTransaction(params) {
|
|
1016
|
-
const { publicClient, safeAddress, to, value, data, chainId } = params;
|
|
1017
|
-
const nonce = await publicClient.readContract({
|
|
1018
|
-
address: safeAddress,
|
|
1019
|
-
abi: SAFE_ABI,
|
|
1020
|
-
functionName: "nonce"
|
|
1021
|
-
});
|
|
1022
|
-
const message = {
|
|
1023
|
-
to,
|
|
1024
|
-
value,
|
|
1025
|
-
data,
|
|
1026
|
-
operation: 0,
|
|
1027
|
-
safeTxGas: 0n,
|
|
1028
|
-
baseGas: 0n,
|
|
1029
|
-
gasPrice: 0n,
|
|
1030
|
-
gasToken: zeroAddress,
|
|
1031
|
-
refundReceiver: zeroAddress,
|
|
1032
|
-
nonce
|
|
1033
|
-
};
|
|
1034
|
-
const safeTxHash = hashTypedData({
|
|
1035
|
-
domain: { chainId, verifyingContract: safeAddress },
|
|
1036
|
-
types: SAFE_TX_TYPES,
|
|
1037
|
-
primaryType: "SafeTx",
|
|
1038
|
-
message
|
|
1039
|
-
});
|
|
1040
|
-
return {
|
|
1041
|
-
chainId,
|
|
1042
|
-
safeAddress,
|
|
1043
|
-
safeTxHash,
|
|
1044
|
-
typedData: {
|
|
1045
|
-
domain: { chainId, verifyingContract: safeAddress },
|
|
1046
|
-
types: SAFE_TX_TYPES,
|
|
1047
|
-
primaryType: "SafeTx",
|
|
1048
|
-
message
|
|
1049
|
-
}
|
|
1050
|
-
};
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1053
770
|
// src/WithdrawFlow.tsx
|
|
1054
|
-
import { encodeFunctionData
|
|
771
|
+
import { encodeFunctionData, erc20Abi as erc20Abi2, parseUnits as parseUnits2 } from "viem";
|
|
1055
772
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1056
773
|
var ADDR_REGEX = /^0x[a-fA-F0-9]{40}$/;
|
|
1057
774
|
var REGISTRATION_DEBOUNCE_MS = 600;
|
|
@@ -1087,7 +804,6 @@ function WithdrawFlow({
|
|
|
1087
804
|
signerAddress = DEFAULT_SIGNER_ADDRESS,
|
|
1088
805
|
sessionChainIds,
|
|
1089
806
|
forceRegister = false,
|
|
1090
|
-
waitForFinalTx = true,
|
|
1091
807
|
reownWallet,
|
|
1092
808
|
onConnect,
|
|
1093
809
|
onDisconnect,
|
|
@@ -1475,8 +1191,8 @@ function WithdrawFlow({
|
|
|
1475
1191
|
const transferData = isSourceNative ? { to: transferTarget, value: amountUnits, data: "0x" } : {
|
|
1476
1192
|
to: sourceToken,
|
|
1477
1193
|
value: 0n,
|
|
1478
|
-
data:
|
|
1479
|
-
abi:
|
|
1194
|
+
data: encodeFunctionData({
|
|
1195
|
+
abi: erc20Abi2,
|
|
1480
1196
|
functionName: "transfer",
|
|
1481
1197
|
args: [transferTarget, amountUnits]
|
|
1482
1198
|
})
|
|
@@ -1575,6 +1291,10 @@ function WithdrawFlow({
|
|
|
1575
1291
|
txHash,
|
|
1576
1292
|
destinationTxHash,
|
|
1577
1293
|
amount: context.amount,
|
|
1294
|
+
// Withdraw targets are always EVM — WithdrawModalProps.targetChain is
|
|
1295
|
+
// Chain | number (never "solana"). The context union is wide only
|
|
1296
|
+
// because ProcessingStep is shared with the deposit flow, so narrow
|
|
1297
|
+
// back here.
|
|
1578
1298
|
sourceChain: context.sourceChain,
|
|
1579
1299
|
sourceToken: context.sourceToken,
|
|
1580
1300
|
targetChain: context.targetChain,
|
|
@@ -1670,10 +1390,18 @@ function WithdrawFlow({
|
|
|
1670
1390
|
return selected?.kind === "external" ? selected.icon ?? reownWallet?.icon : void 0;
|
|
1671
1391
|
}, [walletOptions, ownerAddress, reownWallet?.icon]);
|
|
1672
1392
|
if (showConnectStep) {
|
|
1393
|
+
const withdrawRows = walletOptions.map((option) => ({
|
|
1394
|
+
id: option.id,
|
|
1395
|
+
kind: option.kind,
|
|
1396
|
+
label: option.label,
|
|
1397
|
+
icon: option.icon,
|
|
1398
|
+
address: option.address ?? option.solanaAddress ?? option.id,
|
|
1399
|
+
state: "ready"
|
|
1400
|
+
}));
|
|
1673
1401
|
return /* @__PURE__ */ jsx3("div", { className: "rs-modal-body", children: /* @__PURE__ */ jsx3(
|
|
1674
1402
|
ConnectStep,
|
|
1675
1403
|
{
|
|
1676
|
-
|
|
1404
|
+
walletRows: withdrawRows,
|
|
1677
1405
|
onConfirmWallet: (walletId) => {
|
|
1678
1406
|
setSelectedWalletId(walletId);
|
|
1679
1407
|
setIsConnectSelectionConfirmed(true);
|
|
@@ -1743,7 +1471,6 @@ function WithdrawFlow({
|
|
|
1743
1471
|
targetToken,
|
|
1744
1472
|
amount: storeApi.getState().amount ?? "0",
|
|
1745
1473
|
directTransfer: isSameRoute,
|
|
1746
|
-
waitForFinalTx,
|
|
1747
1474
|
service,
|
|
1748
1475
|
flowLabel: "withdraw",
|
|
1749
1476
|
onClose,
|
|
@@ -1767,7 +1494,7 @@ function deriveStepView(step, _registration) {
|
|
|
1767
1494
|
// src/WithdrawModal.tsx
|
|
1768
1495
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1769
1496
|
var ReownWithdrawInner = lazy(
|
|
1770
|
-
() => import("./WithdrawModalReown-
|
|
1497
|
+
() => import("./WithdrawModalReown-QEQPCSWT.mjs").then((m) => ({
|
|
1771
1498
|
default: m.WithdrawModalReown
|
|
1772
1499
|
}))
|
|
1773
1500
|
);
|
|
@@ -1799,7 +1526,6 @@ function WithdrawModalInner({
|
|
|
1799
1526
|
signerAddress = DEFAULT_SIGNER_ADDRESS,
|
|
1800
1527
|
sessionChainIds,
|
|
1801
1528
|
forceRegister = false,
|
|
1802
|
-
waitForFinalTx = true,
|
|
1803
1529
|
reownWallet,
|
|
1804
1530
|
onConnect,
|
|
1805
1531
|
onDisconnect,
|
|
@@ -1904,7 +1630,6 @@ function WithdrawModalInner({
|
|
|
1904
1630
|
signerAddress,
|
|
1905
1631
|
sessionChainIds,
|
|
1906
1632
|
forceRegister,
|
|
1907
|
-
waitForFinalTx,
|
|
1908
1633
|
reownWallet,
|
|
1909
1634
|
onConnect,
|
|
1910
1635
|
onDisconnect,
|