@rhinestone/deposit-modal 0.2.4 → 0.2.5-alpha.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/dist/{DepositModalReown-CY5MSQGK.mjs → DepositModalReown-GIODYNOK.mjs} +4 -2
- package/dist/{DepositModalReown-2UMPITRN.cjs → DepositModalReown-SVVA3OZ6.cjs} +5 -3
- package/dist/{WithdrawModalReown-YSRO5ZTA.mjs → WithdrawModalReown-HTEB4XGU.mjs} +3 -2
- package/dist/{WithdrawModalReown-Z5BUZQ4Z.cjs → WithdrawModalReown-VNTKGALT.cjs} +4 -3
- package/dist/{chunk-QUOP5C6V.cjs → chunk-4S262VLP.cjs} +54 -338
- package/dist/{chunk-ARGMXV6E.cjs → chunk-AHQY2O3U.cjs} +507 -235
- package/dist/{chunk-WNFGZS56.mjs → chunk-DUGDAMAF.mjs} +134 -132
- package/dist/chunk-J2SWZSXL.mjs +295 -0
- package/dist/{chunk-NFXJEOE6.cjs → chunk-KE6CJVOV.cjs} +88 -86
- package/dist/chunk-LHOHM67Z.mjs +234 -0
- package/dist/{chunk-HFQV7EHS.mjs → chunk-RQ2VCKLS.mjs} +451 -179
- package/dist/{chunk-KJEHVIPZ.mjs → chunk-WA4RA4HB.mjs} +14 -298
- package/dist/chunk-YKGL66EF.cjs +295 -0
- package/dist/chunk-ZHLQMSQM.cjs +234 -0
- package/dist/deposit.cjs +5 -3
- package/dist/deposit.d.cts +3 -3
- package/dist/deposit.d.ts +3 -3
- package/dist/deposit.mjs +4 -2
- package/dist/index.cjs +6 -4
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +5 -3
- package/dist/reown.cjs +6 -4
- package/dist/reown.d.cts +2 -2
- package/dist/reown.d.ts +2 -2
- package/dist/reown.mjs +5 -3
- package/dist/safe-CB7TvRCc.d.cts +62 -0
- package/dist/safe-CB7TvRCc.d.ts +62 -0
- package/dist/safe.cjs +22 -1
- package/dist/safe.d.cts +11 -59
- package/dist/safe.d.ts +11 -59
- package/dist/safe.mjs +22 -0
- package/dist/{types-DGQzvl6v.d.ts → types-CeFbJ-MW.d.ts} +8 -1
- package/dist/{types-DJ1fzNC7.d.cts → types-D0NawmZ8.d.cts} +8 -1
- package/dist/withdraw.cjs +4 -3
- package/dist/withdraw.d.cts +3 -3
- package/dist/withdraw.d.ts +3 -3
- package/dist/withdraw.mjs +3 -2
- package/package.json +1 -1
|
@@ -21,7 +21,12 @@
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _chunkKE6CJVOVcjs = require('./chunk-KE6CJVOV.cjs');
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
var _chunkYKGL66EFcjs = require('./chunk-YKGL66EF.cjs');
|
|
25
30
|
|
|
26
31
|
|
|
27
32
|
|
|
@@ -127,7 +132,7 @@ function WithdrawFormStep({
|
|
|
127
132
|
setIsSwitching(true);
|
|
128
133
|
switchChain(asset.chainId).catch((err) => {
|
|
129
134
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
130
|
-
setError(
|
|
135
|
+
setError(_chunkKE6CJVOVcjs.formatUserError.call(void 0, raw));
|
|
131
136
|
}).finally(() => {
|
|
132
137
|
setIsSwitching(false);
|
|
133
138
|
});
|
|
@@ -147,7 +152,7 @@ function WithdrawFormStep({
|
|
|
147
152
|
return;
|
|
148
153
|
}
|
|
149
154
|
try {
|
|
150
|
-
const bal =
|
|
155
|
+
const bal = _chunkKE6CJVOVcjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: safeAddress }) : await publicClient.readContract({
|
|
151
156
|
address: asset.token,
|
|
152
157
|
abi: _viem.erc20Abi,
|
|
153
158
|
functionName: "balanceOf",
|
|
@@ -250,7 +255,7 @@ function WithdrawFormStep({
|
|
|
250
255
|
await onSubmit(recipient, amount);
|
|
251
256
|
} catch (err) {
|
|
252
257
|
const raw = err instanceof Error ? err.message : "Withdrawal failed";
|
|
253
|
-
setError(
|
|
258
|
+
setError(_chunkKE6CJVOVcjs.formatUserError.call(void 0, raw));
|
|
254
259
|
} finally {
|
|
255
260
|
setIsSubmitting(false);
|
|
256
261
|
}
|
|
@@ -258,11 +263,11 @@ function WithdrawFormStep({
|
|
|
258
263
|
if (isBalanceLoading) {
|
|
259
264
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
260
265
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body rs-withdraw-loading", children: [
|
|
261
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
266
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKE6CJVOVcjs.Spinner, { className: "rs-spinner--lg" }),
|
|
262
267
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-loading-title", children: "Loading on-chain balance" }),
|
|
263
268
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-loading-subtitle", children: chainMismatch ? `Switch to ${_chunkR2HP743Tcjs.getChainName.call(void 0, asset.chainId)} to continue.` : "Please wait before withdrawing." })
|
|
264
269
|
] }),
|
|
265
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
270
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKE6CJVOVcjs.PoweredBy, {})
|
|
266
271
|
] });
|
|
267
272
|
}
|
|
268
273
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
@@ -361,7 +366,7 @@ function WithdrawFormStep({
|
|
|
361
366
|
] })
|
|
362
367
|
] }),
|
|
363
368
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-amount-info", children: [
|
|
364
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ?
|
|
369
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ? _chunkKE6CJVOVcjs.currencyFormatter.format(amountUsd) : "$0.00" }),
|
|
365
370
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-withdraw-balance", children: [
|
|
366
371
|
"Balance: ",
|
|
367
372
|
formattedBalance,
|
|
@@ -555,7 +560,7 @@ function WithdrawFormStep({
|
|
|
555
560
|
] })
|
|
556
561
|
] }),
|
|
557
562
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
558
|
-
|
|
563
|
+
_chunkKE6CJVOVcjs.Button,
|
|
559
564
|
{
|
|
560
565
|
onClick: handleWithdraw,
|
|
561
566
|
fullWidth: true,
|
|
@@ -564,296 +569,11 @@ function WithdrawFormStep({
|
|
|
564
569
|
children: isBusy ? "Preparing..." : !recipient ? "Enter Recipient Address" : !amount ? "Enter Withdraw Amount" : "Withdraw"
|
|
565
570
|
}
|
|
566
571
|
) }),
|
|
567
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
572
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKE6CJVOVcjs.PoweredBy, {})
|
|
568
573
|
] });
|
|
569
574
|
}
|
|
570
575
|
WithdrawFormStep.displayName = "WithdrawFormStep";
|
|
571
576
|
|
|
572
|
-
// src/core/safe.ts
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
var SAFE_ABI = [
|
|
584
|
-
{
|
|
585
|
-
type: "function",
|
|
586
|
-
name: "isOwner",
|
|
587
|
-
stateMutability: "view",
|
|
588
|
-
inputs: [{ name: "owner", type: "address" }],
|
|
589
|
-
outputs: [{ name: "", type: "bool" }]
|
|
590
|
-
},
|
|
591
|
-
{
|
|
592
|
-
type: "function",
|
|
593
|
-
name: "nonce",
|
|
594
|
-
stateMutability: "view",
|
|
595
|
-
inputs: [],
|
|
596
|
-
outputs: [{ type: "uint256" }]
|
|
597
|
-
},
|
|
598
|
-
{
|
|
599
|
-
type: "function",
|
|
600
|
-
name: "execTransaction",
|
|
601
|
-
stateMutability: "payable",
|
|
602
|
-
inputs: [
|
|
603
|
-
{ name: "to", type: "address" },
|
|
604
|
-
{ name: "value", type: "uint256" },
|
|
605
|
-
{ name: "data", type: "bytes" },
|
|
606
|
-
{ name: "operation", type: "uint8" },
|
|
607
|
-
{ name: "safeTxGas", type: "uint256" },
|
|
608
|
-
{ name: "baseGas", type: "uint256" },
|
|
609
|
-
{ name: "gasPrice", type: "uint256" },
|
|
610
|
-
{ name: "gasToken", type: "address" },
|
|
611
|
-
{ name: "refundReceiver", type: "address" },
|
|
612
|
-
{ name: "signatures", type: "bytes" }
|
|
613
|
-
],
|
|
614
|
-
outputs: [{ name: "success", type: "bool" }]
|
|
615
|
-
},
|
|
616
|
-
{
|
|
617
|
-
type: "event",
|
|
618
|
-
name: "ExecutionSuccess",
|
|
619
|
-
inputs: [
|
|
620
|
-
{ name: "txHash", type: "bytes32", indexed: true },
|
|
621
|
-
{ name: "payment", type: "uint256", indexed: false }
|
|
622
|
-
],
|
|
623
|
-
anonymous: false
|
|
624
|
-
},
|
|
625
|
-
{
|
|
626
|
-
type: "event",
|
|
627
|
-
name: "ExecutionFailure",
|
|
628
|
-
inputs: [
|
|
629
|
-
{ name: "txHash", type: "bytes32", indexed: true },
|
|
630
|
-
{ name: "payment", type: "uint256", indexed: false }
|
|
631
|
-
],
|
|
632
|
-
anonymous: false
|
|
633
|
-
}
|
|
634
|
-
];
|
|
635
|
-
async function executeSafeEthTransfer(params) {
|
|
636
|
-
const {
|
|
637
|
-
walletClient,
|
|
638
|
-
publicClient,
|
|
639
|
-
safeAddress,
|
|
640
|
-
recipient,
|
|
641
|
-
amount,
|
|
642
|
-
chainId
|
|
643
|
-
} = params;
|
|
644
|
-
const account = walletClient.account;
|
|
645
|
-
const chain = walletClient.chain;
|
|
646
|
-
if (!account || !chain) {
|
|
647
|
-
throw new Error("Wallet not connected");
|
|
648
|
-
}
|
|
649
|
-
if (chain.id !== chainId) {
|
|
650
|
-
throw new Error(`Switch to ${_chunkR2HP743Tcjs.getChainName.call(void 0, chainId)} to sign`);
|
|
651
|
-
}
|
|
652
|
-
const isOwner = await publicClient.readContract({
|
|
653
|
-
address: safeAddress,
|
|
654
|
-
abi: SAFE_ABI,
|
|
655
|
-
functionName: "isOwner",
|
|
656
|
-
args: [account.address]
|
|
657
|
-
});
|
|
658
|
-
if (!isOwner) {
|
|
659
|
-
throw new Error("Connected wallet is not a Safe owner");
|
|
660
|
-
}
|
|
661
|
-
const safeTx = {
|
|
662
|
-
to: recipient,
|
|
663
|
-
value: amount,
|
|
664
|
-
data: "0x",
|
|
665
|
-
operation: 0,
|
|
666
|
-
safeTxGas: 0n,
|
|
667
|
-
baseGas: 0n,
|
|
668
|
-
gasPrice: 0n,
|
|
669
|
-
gasToken: _viem.zeroAddress,
|
|
670
|
-
refundReceiver: _viem.zeroAddress
|
|
671
|
-
};
|
|
672
|
-
const signature = _viem.concat.call(void 0, [
|
|
673
|
-
_viem.pad.call(void 0, account.address, { size: 32 }),
|
|
674
|
-
_viem.pad.call(void 0, _viem.toHex.call(void 0, 0), { size: 32 }),
|
|
675
|
-
_viem.toHex.call(void 0, 1, { size: 1 })
|
|
676
|
-
]);
|
|
677
|
-
const txHash = await walletClient.writeContract({
|
|
678
|
-
account,
|
|
679
|
-
chain,
|
|
680
|
-
address: safeAddress,
|
|
681
|
-
abi: SAFE_ABI,
|
|
682
|
-
functionName: "execTransaction",
|
|
683
|
-
args: [
|
|
684
|
-
safeTx.to,
|
|
685
|
-
safeTx.value,
|
|
686
|
-
safeTx.data,
|
|
687
|
-
safeTx.operation,
|
|
688
|
-
safeTx.safeTxGas,
|
|
689
|
-
safeTx.baseGas,
|
|
690
|
-
safeTx.gasPrice,
|
|
691
|
-
safeTx.gasToken,
|
|
692
|
-
safeTx.refundReceiver,
|
|
693
|
-
signature
|
|
694
|
-
]
|
|
695
|
-
});
|
|
696
|
-
const receipt = await publicClient.waitForTransactionReceipt({
|
|
697
|
-
hash: txHash
|
|
698
|
-
});
|
|
699
|
-
const safeLogs = receipt.logs.filter(
|
|
700
|
-
(log) => log.address.toLowerCase() === safeAddress.toLowerCase()
|
|
701
|
-
);
|
|
702
|
-
const parsed = _viem.parseEventLogs.call(void 0, {
|
|
703
|
-
abi: SAFE_ABI,
|
|
704
|
-
logs: safeLogs,
|
|
705
|
-
strict: false
|
|
706
|
-
});
|
|
707
|
-
const failed = parsed.find((log) => log.eventName === "ExecutionFailure");
|
|
708
|
-
if (failed) {
|
|
709
|
-
throw new Error("Safe transaction failed");
|
|
710
|
-
}
|
|
711
|
-
const succeeded = parsed.find((log) => log.eventName === "ExecutionSuccess");
|
|
712
|
-
if (!succeeded) {
|
|
713
|
-
throw new Error("Safe transaction status unavailable");
|
|
714
|
-
}
|
|
715
|
-
return { txHash };
|
|
716
|
-
}
|
|
717
|
-
async function executeSafeErc20Transfer(params) {
|
|
718
|
-
const {
|
|
719
|
-
walletClient,
|
|
720
|
-
publicClient,
|
|
721
|
-
safeAddress,
|
|
722
|
-
tokenAddress,
|
|
723
|
-
recipient,
|
|
724
|
-
amount,
|
|
725
|
-
chainId
|
|
726
|
-
} = params;
|
|
727
|
-
const account = walletClient.account;
|
|
728
|
-
const chain = walletClient.chain;
|
|
729
|
-
if (!account || !chain) {
|
|
730
|
-
throw new Error("Wallet not connected");
|
|
731
|
-
}
|
|
732
|
-
if (chain.id !== chainId) {
|
|
733
|
-
throw new Error(`Switch to ${_chunkR2HP743Tcjs.getChainName.call(void 0, chainId)} to sign`);
|
|
734
|
-
}
|
|
735
|
-
const isOwner = await publicClient.readContract({
|
|
736
|
-
address: safeAddress,
|
|
737
|
-
abi: SAFE_ABI,
|
|
738
|
-
functionName: "isOwner",
|
|
739
|
-
args: [account.address]
|
|
740
|
-
});
|
|
741
|
-
if (!isOwner) {
|
|
742
|
-
throw new Error("Connected wallet is not a Safe owner");
|
|
743
|
-
}
|
|
744
|
-
const data = _viem.encodeFunctionData.call(void 0, {
|
|
745
|
-
abi: _viem.erc20Abi,
|
|
746
|
-
functionName: "transfer",
|
|
747
|
-
args: [recipient, amount]
|
|
748
|
-
});
|
|
749
|
-
const safeTx = {
|
|
750
|
-
to: tokenAddress,
|
|
751
|
-
value: 0n,
|
|
752
|
-
data,
|
|
753
|
-
operation: 0,
|
|
754
|
-
safeTxGas: 0n,
|
|
755
|
-
baseGas: 0n,
|
|
756
|
-
gasPrice: 0n,
|
|
757
|
-
gasToken: _viem.zeroAddress,
|
|
758
|
-
refundReceiver: _viem.zeroAddress
|
|
759
|
-
};
|
|
760
|
-
const signature = _viem.concat.call(void 0, [
|
|
761
|
-
_viem.pad.call(void 0, account.address, { size: 32 }),
|
|
762
|
-
_viem.pad.call(void 0, _viem.toHex.call(void 0, 0), { size: 32 }),
|
|
763
|
-
_viem.toHex.call(void 0, 1, { size: 1 })
|
|
764
|
-
]);
|
|
765
|
-
const txHash = await walletClient.writeContract({
|
|
766
|
-
account,
|
|
767
|
-
chain,
|
|
768
|
-
address: safeAddress,
|
|
769
|
-
abi: SAFE_ABI,
|
|
770
|
-
functionName: "execTransaction",
|
|
771
|
-
args: [
|
|
772
|
-
safeTx.to,
|
|
773
|
-
safeTx.value,
|
|
774
|
-
safeTx.data,
|
|
775
|
-
safeTx.operation,
|
|
776
|
-
safeTx.safeTxGas,
|
|
777
|
-
safeTx.baseGas,
|
|
778
|
-
safeTx.gasPrice,
|
|
779
|
-
safeTx.gasToken,
|
|
780
|
-
safeTx.refundReceiver,
|
|
781
|
-
signature
|
|
782
|
-
]
|
|
783
|
-
});
|
|
784
|
-
const receipt = await publicClient.waitForTransactionReceipt({
|
|
785
|
-
hash: txHash
|
|
786
|
-
});
|
|
787
|
-
const safeLogs = receipt.logs.filter(
|
|
788
|
-
(log) => log.address.toLowerCase() === safeAddress.toLowerCase()
|
|
789
|
-
);
|
|
790
|
-
const parsed = _viem.parseEventLogs.call(void 0, {
|
|
791
|
-
abi: SAFE_ABI,
|
|
792
|
-
logs: safeLogs,
|
|
793
|
-
strict: false
|
|
794
|
-
});
|
|
795
|
-
const failed = parsed.find((log) => log.eventName === "ExecutionFailure");
|
|
796
|
-
if (failed) {
|
|
797
|
-
throw new Error("Safe transaction failed");
|
|
798
|
-
}
|
|
799
|
-
const succeeded = parsed.find((log) => log.eventName === "ExecutionSuccess");
|
|
800
|
-
if (!succeeded) {
|
|
801
|
-
throw new Error("Safe transaction status unavailable");
|
|
802
|
-
}
|
|
803
|
-
return { txHash };
|
|
804
|
-
}
|
|
805
|
-
var SAFE_TX_TYPES = {
|
|
806
|
-
SafeTx: [
|
|
807
|
-
{ name: "to", type: "address" },
|
|
808
|
-
{ name: "value", type: "uint256" },
|
|
809
|
-
{ name: "data", type: "bytes" },
|
|
810
|
-
{ name: "operation", type: "uint8" },
|
|
811
|
-
{ name: "safeTxGas", type: "uint256" },
|
|
812
|
-
{ name: "baseGas", type: "uint256" },
|
|
813
|
-
{ name: "gasPrice", type: "uint256" },
|
|
814
|
-
{ name: "gasToken", type: "address" },
|
|
815
|
-
{ name: "refundReceiver", type: "address" },
|
|
816
|
-
{ name: "nonce", type: "uint256" }
|
|
817
|
-
]
|
|
818
|
-
};
|
|
819
|
-
async function buildSafeTransaction(params) {
|
|
820
|
-
const { publicClient, safeAddress, to, value, data, chainId } = params;
|
|
821
|
-
const nonce = await publicClient.readContract({
|
|
822
|
-
address: safeAddress,
|
|
823
|
-
abi: SAFE_ABI,
|
|
824
|
-
functionName: "nonce"
|
|
825
|
-
});
|
|
826
|
-
const message = {
|
|
827
|
-
to,
|
|
828
|
-
value,
|
|
829
|
-
data,
|
|
830
|
-
operation: 0,
|
|
831
|
-
safeTxGas: 0n,
|
|
832
|
-
baseGas: 0n,
|
|
833
|
-
gasPrice: 0n,
|
|
834
|
-
gasToken: _viem.zeroAddress,
|
|
835
|
-
refundReceiver: _viem.zeroAddress,
|
|
836
|
-
nonce
|
|
837
|
-
};
|
|
838
|
-
const safeTxHash = _viem.hashTypedData.call(void 0, {
|
|
839
|
-
domain: { chainId, verifyingContract: safeAddress },
|
|
840
|
-
types: SAFE_TX_TYPES,
|
|
841
|
-
primaryType: "SafeTx",
|
|
842
|
-
message
|
|
843
|
-
});
|
|
844
|
-
return {
|
|
845
|
-
chainId,
|
|
846
|
-
safeAddress,
|
|
847
|
-
safeTxHash,
|
|
848
|
-
typedData: {
|
|
849
|
-
domain: { chainId, verifyingContract: safeAddress },
|
|
850
|
-
types: SAFE_TX_TYPES,
|
|
851
|
-
primaryType: "SafeTx",
|
|
852
|
-
message
|
|
853
|
-
}
|
|
854
|
-
};
|
|
855
|
-
}
|
|
856
|
-
|
|
857
577
|
// src/WithdrawFlow.tsx
|
|
858
578
|
|
|
859
579
|
|
|
@@ -891,27 +611,27 @@ function WithdrawFlow({
|
|
|
891
611
|
onError,
|
|
892
612
|
debug
|
|
893
613
|
}) {
|
|
894
|
-
const onStepChangeRef =
|
|
895
|
-
const onTotalBalanceChangeRef =
|
|
896
|
-
const onEventRef =
|
|
897
|
-
const onConnectedRef =
|
|
898
|
-
const onWithdrawSubmittedRef =
|
|
899
|
-
const onWithdrawCompleteRef =
|
|
900
|
-
const onWithdrawFailedRef =
|
|
901
|
-
const onErrorRef =
|
|
614
|
+
const onStepChangeRef = _chunkKE6CJVOVcjs.useLatestRef.call(void 0, onStepChange);
|
|
615
|
+
const onTotalBalanceChangeRef = _chunkKE6CJVOVcjs.useLatestRef.call(void 0, onTotalBalanceChange);
|
|
616
|
+
const onEventRef = _chunkKE6CJVOVcjs.useLatestRef.call(void 0, onEvent);
|
|
617
|
+
const onConnectedRef = _chunkKE6CJVOVcjs.useLatestRef.call(void 0, onConnected);
|
|
618
|
+
const onWithdrawSubmittedRef = _chunkKE6CJVOVcjs.useLatestRef.call(void 0, onWithdrawSubmitted);
|
|
619
|
+
const onWithdrawCompleteRef = _chunkKE6CJVOVcjs.useLatestRef.call(void 0, onWithdrawComplete);
|
|
620
|
+
const onWithdrawFailedRef = _chunkKE6CJVOVcjs.useLatestRef.call(void 0, onWithdrawFailed);
|
|
621
|
+
const onErrorRef = _chunkKE6CJVOVcjs.useLatestRef.call(void 0, onError);
|
|
902
622
|
const [step, setStep] = _react.useState.call(void 0, { type: "form" });
|
|
903
623
|
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
904
624
|
const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, 0);
|
|
905
625
|
const [isConnectSelectionConfirmed, setIsConnectSelectionConfirmed] = _react.useState.call(void 0, false);
|
|
906
626
|
const logFlow = _react.useCallback.call(void 0,
|
|
907
627
|
(message, data) => {
|
|
908
|
-
|
|
628
|
+
_chunkKE6CJVOVcjs.debugLog.call(void 0, debug, "withdraw-flow", message, data);
|
|
909
629
|
},
|
|
910
630
|
[debug]
|
|
911
631
|
);
|
|
912
632
|
const logFlowError = _react.useCallback.call(void 0,
|
|
913
633
|
(message, error, data) => {
|
|
914
|
-
|
|
634
|
+
_chunkKE6CJVOVcjs.debugError.call(void 0, debug, "withdraw-flow", message, error, data);
|
|
915
635
|
},
|
|
916
636
|
[debug]
|
|
917
637
|
);
|
|
@@ -970,14 +690,14 @@ function WithdrawFlow({
|
|
|
970
690
|
return {
|
|
971
691
|
ownerAddress: dappAddress,
|
|
972
692
|
walletClient: _nullishCoalesce(dappWalletClient, () => ( void 0)),
|
|
973
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
693
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkKE6CJVOVcjs.getPublicClient.call(void 0, sourceChain))),
|
|
974
694
|
switchChain: dappSwitchChain
|
|
975
695
|
};
|
|
976
696
|
}
|
|
977
697
|
return {
|
|
978
698
|
ownerAddress: dappWalletClient.account.address,
|
|
979
699
|
walletClient: dappWalletClient,
|
|
980
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
700
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkKE6CJVOVcjs.getPublicClient.call(void 0, sourceChain))),
|
|
981
701
|
switchChain: dappSwitchChain
|
|
982
702
|
};
|
|
983
703
|
}
|
|
@@ -988,7 +708,7 @@ function WithdrawFlow({
|
|
|
988
708
|
return {
|
|
989
709
|
ownerAddress: dappWalletClient.account.address,
|
|
990
710
|
walletClient: dappWalletClient,
|
|
991
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
711
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkKE6CJVOVcjs.getPublicClient.call(void 0, sourceChain))),
|
|
992
712
|
switchChain: dappSwitchChain
|
|
993
713
|
};
|
|
994
714
|
}
|
|
@@ -1018,7 +738,7 @@ function WithdrawFlow({
|
|
|
1018
738
|
const symbol = _chunkR2HP743Tcjs.getTokenSymbol.call(void 0, sourceToken, sourceChain);
|
|
1019
739
|
const decimals = _chunkR2HP743Tcjs.getTokenDecimalsByAddress.call(void 0, sourceToken, sourceChain);
|
|
1020
740
|
return {
|
|
1021
|
-
id:
|
|
741
|
+
id: _chunkKE6CJVOVcjs.getAssetId.call(void 0, { chainId: sourceChain, token: sourceToken }),
|
|
1022
742
|
chainId: sourceChain,
|
|
1023
743
|
token: sourceToken,
|
|
1024
744
|
symbol,
|
|
@@ -1090,15 +810,15 @@ function WithdrawFlow({
|
|
|
1090
810
|
[logFlowError, onErrorRef]
|
|
1091
811
|
);
|
|
1092
812
|
const resolveSessionOwner = _react.useCallback.call(void 0, async (eoaAddress) => {
|
|
1093
|
-
const localOwner =
|
|
813
|
+
const localOwner = _chunkKE6CJVOVcjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
|
|
1094
814
|
if (localOwner) {
|
|
1095
815
|
return {
|
|
1096
|
-
account:
|
|
816
|
+
account: _chunkKE6CJVOVcjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
|
|
1097
817
|
address: localOwner.address
|
|
1098
818
|
};
|
|
1099
819
|
}
|
|
1100
|
-
const created =
|
|
1101
|
-
|
|
820
|
+
const created = _chunkKE6CJVOVcjs.createSessionOwnerKey.call(void 0, );
|
|
821
|
+
_chunkKE6CJVOVcjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
|
|
1102
822
|
return {
|
|
1103
823
|
account: created.account,
|
|
1104
824
|
address: created.address
|
|
@@ -1138,7 +858,7 @@ function WithdrawFlow({
|
|
|
1138
858
|
const setup = await service.setupAccount({
|
|
1139
859
|
ownerAddress: ownerAddress2,
|
|
1140
860
|
sessionOwnerAddress: sessionOwner.address,
|
|
1141
|
-
targetChain:
|
|
861
|
+
targetChain: _chunkKE6CJVOVcjs.toEvmCaip2.call(void 0, targetChain),
|
|
1142
862
|
targetToken,
|
|
1143
863
|
recipient,
|
|
1144
864
|
signerAddress,
|
|
@@ -1166,7 +886,7 @@ function WithdrawFlow({
|
|
|
1166
886
|
primaryType: typedData.primaryType,
|
|
1167
887
|
message: typedData.message
|
|
1168
888
|
});
|
|
1169
|
-
const sessionDetails =
|
|
889
|
+
const sessionDetails = _chunkKE6CJVOVcjs.buildSessionDetails.call(void 0,
|
|
1170
890
|
setup.sessionDetailsUnsigned,
|
|
1171
891
|
signature
|
|
1172
892
|
);
|
|
@@ -1180,7 +900,7 @@ function WithdrawFlow({
|
|
|
1180
900
|
eoaAddress: ownerAddress2,
|
|
1181
901
|
sessionOwner: sessionOwner.address,
|
|
1182
902
|
target: {
|
|
1183
|
-
chain:
|
|
903
|
+
chain: _chunkKE6CJVOVcjs.toEvmCaip2.call(void 0, targetChain),
|
|
1184
904
|
token: targetToken,
|
|
1185
905
|
recipient
|
|
1186
906
|
}
|
|
@@ -1189,7 +909,7 @@ function WithdrawFlow({
|
|
|
1189
909
|
}
|
|
1190
910
|
handleConnected(ownerAddress2, smartAccount);
|
|
1191
911
|
const amountUnits = _viem.parseUnits.call(void 0, amountValue, asset.decimals);
|
|
1192
|
-
const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _34 => _34.publicClient]), () => (
|
|
912
|
+
const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _34 => _34.publicClient]), () => ( _chunkKE6CJVOVcjs.getPublicClient.call(void 0, sourceChain)));
|
|
1193
913
|
let result;
|
|
1194
914
|
if (onSignTransaction) {
|
|
1195
915
|
const transferTarget = isSameRoute ? recipient : smartAccount;
|
|
@@ -1202,7 +922,7 @@ function WithdrawFlow({
|
|
|
1202
922
|
args: [transferTarget, amountUnits]
|
|
1203
923
|
})
|
|
1204
924
|
};
|
|
1205
|
-
const request = await buildSafeTransaction({
|
|
925
|
+
const request = await _chunkYKGL66EFcjs.buildSafeTransaction.call(void 0, {
|
|
1206
926
|
publicClient: pc,
|
|
1207
927
|
safeAddress,
|
|
1208
928
|
to: transferData.to,
|
|
@@ -1213,7 +933,7 @@ function WithdrawFlow({
|
|
|
1213
933
|
const { signature } = await onSignTransaction(request);
|
|
1214
934
|
const relayResult = await service.relayWithdraw({
|
|
1215
935
|
smartAccount,
|
|
1216
|
-
chainId:
|
|
936
|
+
chainId: _chunkKE6CJVOVcjs.toEvmCaip2.call(void 0, sourceChain),
|
|
1217
937
|
safeAddress,
|
|
1218
938
|
safeTransaction: request.typedData.message,
|
|
1219
939
|
signature
|
|
@@ -1223,7 +943,7 @@ function WithdrawFlow({
|
|
|
1223
943
|
}
|
|
1224
944
|
result = { txHash: relayResult.txHash };
|
|
1225
945
|
} else if (isSourceNative) {
|
|
1226
|
-
result = await executeSafeEthTransfer({
|
|
946
|
+
result = await _chunkYKGL66EFcjs.executeSafeEthTransfer.call(void 0, {
|
|
1227
947
|
walletClient: signerContext.walletClient,
|
|
1228
948
|
publicClient: pc,
|
|
1229
949
|
safeAddress,
|
|
@@ -1232,7 +952,7 @@ function WithdrawFlow({
|
|
|
1232
952
|
chainId: sourceChain
|
|
1233
953
|
});
|
|
1234
954
|
} else {
|
|
1235
|
-
result = await executeSafeErc20Transfer({
|
|
955
|
+
result = await _chunkYKGL66EFcjs.executeSafeErc20Transfer.call(void 0, {
|
|
1236
956
|
walletClient: signerContext.walletClient,
|
|
1237
957
|
publicClient: pc,
|
|
1238
958
|
safeAddress,
|
|
@@ -1272,7 +992,7 @@ function WithdrawFlow({
|
|
|
1272
992
|
targetChain,
|
|
1273
993
|
targetToken
|
|
1274
994
|
});
|
|
1275
|
-
handleError(
|
|
995
|
+
handleError(_chunkKE6CJVOVcjs.formatUserError.call(void 0, raw), "WITHDRAW_FLOW_ERROR");
|
|
1276
996
|
throw err;
|
|
1277
997
|
} finally {
|
|
1278
998
|
setIsSubmitting(false);
|
|
@@ -1411,20 +1131,16 @@ function WithdrawFlow({
|
|
|
1411
1131
|
}, [walletOptions, ownerAddress, _optionalChain([reownWallet, 'optionalAccess', _51 => _51.icon])]);
|
|
1412
1132
|
if (showConnectStep) {
|
|
1413
1133
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1414
|
-
|
|
1134
|
+
_chunkKE6CJVOVcjs.ConnectStep,
|
|
1415
1135
|
{
|
|
1416
1136
|
walletOptions,
|
|
1417
|
-
|
|
1418
|
-
|
|
1137
|
+
onSelectWallet: (walletId) => {
|
|
1138
|
+
setSelectedWalletId(walletId);
|
|
1139
|
+
setIsConnectSelectionConfirmed(true);
|
|
1140
|
+
},
|
|
1419
1141
|
onRequestConnect,
|
|
1420
1142
|
onConnect,
|
|
1421
1143
|
onDisconnect,
|
|
1422
|
-
onContinue: () => {
|
|
1423
|
-
if (selectedWalletIdEffective) {
|
|
1424
|
-
setSelectedWalletId(selectedWalletIdEffective);
|
|
1425
|
-
}
|
|
1426
|
-
setIsConnectSelectionConfirmed(true);
|
|
1427
|
-
},
|
|
1428
1144
|
connectButtonLabel
|
|
1429
1145
|
}
|
|
1430
1146
|
) });
|
|
@@ -1432,7 +1148,7 @@ function WithdrawFlow({
|
|
|
1432
1148
|
if (!signerContext) return null;
|
|
1433
1149
|
if (!onSignTransaction && !signerContext.walletClient) return null;
|
|
1434
1150
|
const resolvedConnectedRecipient = _optionalChain([selectedWalletOption, 'optionalAccess', _52 => _52.kind]) === "external" ? selectedWalletOption.address : void 0;
|
|
1435
|
-
const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => (
|
|
1151
|
+
const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => ( _chunkKE6CJVOVcjs.getPublicClient.call(void 0, sourceChain)));
|
|
1436
1152
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
1437
1153
|
step.type === "form" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1438
1154
|
WithdrawFormStep,
|
|
@@ -1458,7 +1174,7 @@ function WithdrawFlow({
|
|
|
1458
1174
|
}
|
|
1459
1175
|
),
|
|
1460
1176
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1461
|
-
|
|
1177
|
+
_chunkKE6CJVOVcjs.ProcessingStep,
|
|
1462
1178
|
{
|
|
1463
1179
|
smartAccount: step.smartAccount,
|
|
1464
1180
|
txHash: step.txHash,
|
|
@@ -1485,7 +1201,7 @@ function WithdrawFlow({
|
|
|
1485
1201
|
// src/WithdrawModal.tsx
|
|
1486
1202
|
|
|
1487
1203
|
var ReownWithdrawInner = _react.lazy.call(void 0,
|
|
1488
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-
|
|
1204
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-VNTKGALT.cjs"))).then((m) => ({
|
|
1489
1205
|
default: m.WithdrawModalReown
|
|
1490
1206
|
}))
|
|
1491
1207
|
);
|
|
@@ -1538,19 +1254,19 @@ function WithdrawModalInner({
|
|
|
1538
1254
|
debug
|
|
1539
1255
|
}) {
|
|
1540
1256
|
const modalRef = _react.useRef.call(void 0, null);
|
|
1541
|
-
const onReadyRef =
|
|
1257
|
+
const onReadyRef = _chunkKE6CJVOVcjs.useLatestRef.call(void 0, onReady);
|
|
1542
1258
|
const [currentStepIndex, setCurrentStepIndex] = _react.useState.call(void 0, 0);
|
|
1543
1259
|
const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, null);
|
|
1544
1260
|
const backHandlerRef = _react.useRef.call(void 0, void 0);
|
|
1545
1261
|
const targetChain = _chunkR2HP743Tcjs.getChainId.call(void 0, targetChainProp);
|
|
1546
1262
|
const sourceChain = _chunkR2HP743Tcjs.getChainId.call(void 0, sourceChainProp);
|
|
1547
1263
|
const service = _react.useMemo.call(void 0,
|
|
1548
|
-
() =>
|
|
1264
|
+
() => _chunkKE6CJVOVcjs.createDepositService.call(void 0, backendUrl, { debug, debugScope: "service:withdraw" }),
|
|
1549
1265
|
[backendUrl, debug]
|
|
1550
1266
|
);
|
|
1551
1267
|
_react.useEffect.call(void 0, () => {
|
|
1552
1268
|
if (isOpen && modalRef.current) {
|
|
1553
|
-
|
|
1269
|
+
_chunkKE6CJVOVcjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
1554
1270
|
}
|
|
1555
1271
|
}, [isOpen, theme]);
|
|
1556
1272
|
_react.useEffect.call(void 0, () => {
|
|
@@ -1584,7 +1300,7 @@ function WithdrawModalInner({
|
|
|
1584
1300
|
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _62 => _62.title]), () => ( "Withdraw"));
|
|
1585
1301
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 3 && backHandlerRef.current;
|
|
1586
1302
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1587
|
-
|
|
1303
|
+
_chunkKE6CJVOVcjs.Modal,
|
|
1588
1304
|
{
|
|
1589
1305
|
isOpen,
|
|
1590
1306
|
onClose,
|
|
@@ -1643,7 +1359,7 @@ function WithdrawModalInner({
|
|
|
1643
1359
|
] }),
|
|
1644
1360
|
balance && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header-balance", children: [
|
|
1645
1361
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-label", children: balance.title }),
|
|
1646
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ?
|
|
1362
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ? _chunkKE6CJVOVcjs.currencyFormatter.format(totalBalanceUsd) : null))) })
|
|
1647
1363
|
] })
|
|
1648
1364
|
] }),
|
|
1649
1365
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|