@rhinestone/deposit-modal 0.3.1 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DepositModalReown-G7UX4IBZ.mjs → DepositModalReown-EXI7MW65.mjs} +6 -6
- package/dist/{DepositModalReown-MECHBE6P.cjs → DepositModalReown-FMAPWBQM.cjs} +9 -9
- package/dist/{WithdrawModalReown-WJ6VBZKK.cjs → WithdrawModalReown-CTT3EXMG.cjs} +8 -8
- package/dist/{WithdrawModalReown-CUJAFUQM.mjs → WithdrawModalReown-G7EM6HXO.mjs} +5 -5
- package/dist/{chunk-DZQD3DAV.mjs → chunk-3GLQC2KQ.mjs} +86 -18
- package/dist/{chunk-R5WDHHVM.mjs → chunk-43RTPRQY.mjs} +14 -4
- package/dist/{chunk-3C35DVPE.mjs → chunk-A33QFRKD.mjs} +985 -428
- package/dist/{chunk-MILJQWPT.cjs → chunk-ABVRVW3P.cjs} +133 -8
- package/dist/{chunk-SPUZLWQS.cjs → chunk-BTDRUAPJ.cjs} +514 -543
- package/dist/{chunk-TQ2AYMWS.mjs → chunk-F7P4MV72.mjs} +1 -1
- package/dist/{chunk-BAEB5AFZ.mjs → chunk-FJWLC4AM.mjs} +1 -1
- package/dist/{chunk-LEL6GMEQ.cjs → chunk-JHT2MJ42.cjs} +175 -107
- package/dist/{chunk-MQIJZNTP.cjs → chunk-LJJCPDZO.cjs} +844 -287
- package/dist/{chunk-R5CPOBCF.cjs → chunk-NRNJAQUA.cjs} +4 -4
- package/dist/{chunk-QYSCCX4K.mjs → chunk-RTAIW3WW.mjs} +452 -481
- package/dist/{chunk-AJHFNHG3.cjs → chunk-UEKPBRBY.cjs} +3 -3
- package/dist/{chunk-ULEAK63T.cjs → chunk-ULCCXH2A.cjs} +16 -6
- package/dist/{chunk-6YRDD462.mjs → chunk-WJX3TJFK.mjs} +135 -10
- package/dist/constants.cjs +2 -2
- package/dist/constants.mjs +1 -1
- package/dist/deposit.cjs +6 -6
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +5 -5
- package/dist/index.cjs +7 -7
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +6 -6
- package/dist/polymarket.cjs +6 -6
- package/dist/polymarket.mjs +3 -3
- package/dist/styles.css +276 -27
- package/dist/{types-RzfAD14B.d.ts → types-CFRuisqK.d.cts} +1 -1
- package/dist/{types-RzfAD14B.d.cts → types-CFRuisqK.d.ts} +1 -1
- package/dist/withdraw.cjs +5 -5
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +2 -2
- package/dist/withdraw.mjs +4 -4
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DepositModalInner
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-RTAIW3WW.mjs";
|
|
4
|
+
import "./chunk-FJWLC4AM.mjs";
|
|
5
5
|
import {
|
|
6
6
|
ReownWalletProvider,
|
|
7
7
|
useReownWallet
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-43RTPRQY.mjs";
|
|
9
|
+
import "./chunk-A33QFRKD.mjs";
|
|
10
|
+
import "./chunk-F7P4MV72.mjs";
|
|
11
|
+
import "./chunk-WJX3TJFK.mjs";
|
|
12
12
|
|
|
13
13
|
// src/DepositModalReown.tsx
|
|
14
14
|
import { useCallback, useMemo } from "react";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var _chunkBTDRUAPJcjs = require('./chunk-BTDRUAPJ.cjs');
|
|
4
|
+
require('./chunk-NRNJAQUA.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
require('./chunk-
|
|
10
|
-
require('./chunk-
|
|
11
|
-
require('./chunk-
|
|
8
|
+
var _chunkULCCXH2Acjs = require('./chunk-ULCCXH2A.cjs');
|
|
9
|
+
require('./chunk-LJJCPDZO.cjs');
|
|
10
|
+
require('./chunk-UEKPBRBY.cjs');
|
|
11
|
+
require('./chunk-ABVRVW3P.cjs');
|
|
12
12
|
|
|
13
13
|
// src/DepositModalReown.tsx
|
|
14
14
|
var _react = require('react');
|
|
@@ -16,7 +16,7 @@ var _react3 = require('@reown/appkit/react');
|
|
|
16
16
|
var _react5 = require('@reown/appkit-adapter-solana/react');
|
|
17
17
|
var _jsxruntime = require('react/jsx-runtime');
|
|
18
18
|
function DepositModalWithReown(props) {
|
|
19
|
-
const reown =
|
|
19
|
+
const reown = _chunkULCCXH2Acjs.useReownWallet.call(void 0, );
|
|
20
20
|
const enableSolana = _nullishCoalesce(props.enableSolana, () => ( true));
|
|
21
21
|
const { walletProvider: solanaWalletProvider } = _react3.useAppKitProvider.call(void 0,
|
|
22
22
|
enableSolana ? "solana" : "eip155"
|
|
@@ -37,7 +37,7 @@ function DepositModalWithReown(props) {
|
|
|
37
37
|
reown.disconnect();
|
|
38
38
|
}, [reown.disconnect]);
|
|
39
39
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
40
|
-
|
|
40
|
+
_chunkBTDRUAPJcjs.DepositModalInner,
|
|
41
41
|
{
|
|
42
42
|
...props,
|
|
43
43
|
reownWallet: reownWithSolana,
|
|
@@ -48,7 +48,7 @@ function DepositModalWithReown(props) {
|
|
|
48
48
|
}
|
|
49
49
|
function DepositModalReown(props) {
|
|
50
50
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
51
|
-
|
|
51
|
+
_chunkULCCXH2Acjs.ReownWalletProvider,
|
|
52
52
|
{
|
|
53
53
|
projectId: props.reownAppId,
|
|
54
54
|
theme: props.theme,
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkJHT2MJ42cjs = require('./chunk-JHT2MJ42.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
8
|
-
require('./chunk-
|
|
9
|
-
require('./chunk-
|
|
10
|
-
require('./chunk-
|
|
7
|
+
var _chunkULCCXH2Acjs = require('./chunk-ULCCXH2A.cjs');
|
|
8
|
+
require('./chunk-LJJCPDZO.cjs');
|
|
9
|
+
require('./chunk-UEKPBRBY.cjs');
|
|
10
|
+
require('./chunk-ABVRVW3P.cjs');
|
|
11
11
|
|
|
12
12
|
// src/WithdrawModalReown.tsx
|
|
13
13
|
var _react = require('react');
|
|
14
14
|
var _jsxruntime = require('react/jsx-runtime');
|
|
15
15
|
function WithdrawModalWithReown(props) {
|
|
16
|
-
const reown =
|
|
16
|
+
const reown = _chunkULCCXH2Acjs.useReownWallet.call(void 0, );
|
|
17
17
|
const handleConnect = _react.useCallback.call(void 0, () => {
|
|
18
18
|
reown.openConnect();
|
|
19
19
|
}, [reown.openConnect]);
|
|
@@ -21,7 +21,7 @@ function WithdrawModalWithReown(props) {
|
|
|
21
21
|
reown.disconnect();
|
|
22
22
|
}, [reown.disconnect]);
|
|
23
23
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
24
|
-
|
|
24
|
+
_chunkJHT2MJ42cjs.WithdrawModalInner,
|
|
25
25
|
{
|
|
26
26
|
...props,
|
|
27
27
|
reownWallet: reown,
|
|
@@ -31,7 +31,7 @@ function WithdrawModalWithReown(props) {
|
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
33
|
function WithdrawModalReown(props) {
|
|
34
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
34
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkULCCXH2Acjs.ReownWalletProvider, { projectId: props.reownAppId, theme: props.theme, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WithdrawModalWithReown, { ...props }) });
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WithdrawModalInner
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3GLQC2KQ.mjs";
|
|
4
4
|
import {
|
|
5
5
|
ReownWalletProvider,
|
|
6
6
|
useReownWallet
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-43RTPRQY.mjs";
|
|
8
|
+
import "./chunk-A33QFRKD.mjs";
|
|
9
|
+
import "./chunk-F7P4MV72.mjs";
|
|
10
|
+
import "./chunk-WJX3TJFK.mjs";
|
|
11
11
|
|
|
12
12
|
// src/WithdrawModalReown.tsx
|
|
13
13
|
import { useCallback } from "react";
|
|
@@ -20,19 +20,22 @@ import {
|
|
|
20
20
|
currencyFormatter,
|
|
21
21
|
debugError,
|
|
22
22
|
debugLog,
|
|
23
|
+
formatReceiveEstimate,
|
|
24
|
+
formatTokenAmount,
|
|
23
25
|
formatUserError,
|
|
24
26
|
getAssetId,
|
|
25
27
|
getPublicClient,
|
|
26
28
|
isNativeAsset,
|
|
27
29
|
loadSessionOwnerFromStorage,
|
|
28
30
|
saveSessionOwnerToStorage,
|
|
29
|
-
useLatestRef
|
|
30
|
-
|
|
31
|
+
useLatestRef,
|
|
32
|
+
useTokenPrices
|
|
33
|
+
} from "./chunk-A33QFRKD.mjs";
|
|
31
34
|
import {
|
|
32
35
|
buildSafeTransaction,
|
|
33
36
|
executeSafeErc20Transfer,
|
|
34
37
|
executeSafeEthTransfer
|
|
35
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-F7P4MV72.mjs";
|
|
36
39
|
import {
|
|
37
40
|
DEFAULT_BACKEND_URL,
|
|
38
41
|
DEFAULT_SIGNER_ADDRESS,
|
|
@@ -46,7 +49,7 @@ import {
|
|
|
46
49
|
getTokenIcon,
|
|
47
50
|
getTokenSymbol,
|
|
48
51
|
toEvmCaip2
|
|
49
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-WJX3TJFK.mjs";
|
|
50
53
|
|
|
51
54
|
// src/WithdrawModal.tsx
|
|
52
55
|
import {
|
|
@@ -668,6 +671,7 @@ function WithdrawReviewStep({
|
|
|
668
671
|
estimatedTime = "< 1 min",
|
|
669
672
|
registrationPending = false,
|
|
670
673
|
registrationError = null,
|
|
674
|
+
service,
|
|
671
675
|
onConfirm,
|
|
672
676
|
onError
|
|
673
677
|
}) {
|
|
@@ -680,6 +684,16 @@ function WithdrawReviewStep({
|
|
|
680
684
|
const targetChainIcon = getChainIcon(targetChain);
|
|
681
685
|
const sourceTokenIcon = getTokenIcon(sourceSymbol);
|
|
682
686
|
const targetTokenIcon = getTokenIcon(targetSymbol);
|
|
687
|
+
const amountNumber = Number(amount);
|
|
688
|
+
const formattedSendAmount = formatTokenAmount(amountNumber, sourceSymbol) ?? amount;
|
|
689
|
+
const prices = useTokenPrices(service, [sourceSymbol, targetSymbol]);
|
|
690
|
+
const receiveDisplay = formatReceiveEstimate({
|
|
691
|
+
sourceAmount: Number.isFinite(amountNumber) ? amountNumber : void 0,
|
|
692
|
+
sourceSymbol,
|
|
693
|
+
targetSymbol,
|
|
694
|
+
prices
|
|
695
|
+
}) ?? // No price for the target token — an honest dash beats a wrong number.
|
|
696
|
+
"\u2014";
|
|
683
697
|
const handleConfirm = async () => {
|
|
684
698
|
setError(null);
|
|
685
699
|
setIsSubmitting(true);
|
|
@@ -709,7 +723,7 @@ function WithdrawReviewStep({
|
|
|
709
723
|
/* @__PURE__ */ jsx2("span", { children: "You send" }),
|
|
710
724
|
/* @__PURE__ */ jsxs2("span", { className: "rs-review-detail-value", children: [
|
|
711
725
|
/* @__PURE__ */ jsxs2("span", { children: [
|
|
712
|
-
|
|
726
|
+
formattedSendAmount,
|
|
713
727
|
" ",
|
|
714
728
|
sourceSymbol
|
|
715
729
|
] }),
|
|
@@ -730,11 +744,7 @@ function WithdrawReviewStep({
|
|
|
730
744
|
/* @__PURE__ */ jsxs2("div", { className: "rs-review-detail-row", children: [
|
|
731
745
|
/* @__PURE__ */ jsx2("span", { children: "Receive" }),
|
|
732
746
|
/* @__PURE__ */ jsxs2("span", { className: "rs-review-detail-value", children: [
|
|
733
|
-
/* @__PURE__ */
|
|
734
|
-
amount,
|
|
735
|
-
" ",
|
|
736
|
-
targetSymbol
|
|
737
|
-
] }),
|
|
747
|
+
/* @__PURE__ */ jsx2("span", { children: receiveDisplay }),
|
|
738
748
|
targetTokenIcon && /* @__PURE__ */ jsx2("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx2("img", { src: targetTokenIcon, alt: "" }) })
|
|
739
749
|
] })
|
|
740
750
|
] }),
|
|
@@ -774,6 +784,7 @@ import { encodeFunctionData, erc20Abi as erc20Abi2, parseUnits as parseUnits2 }
|
|
|
774
784
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
775
785
|
var ADDR_REGEX = /^0x[a-fA-F0-9]{40}$/;
|
|
776
786
|
var REGISTRATION_DEBOUNCE_MS = 600;
|
|
787
|
+
var WITHDRAW_INDEXING_DELAY_MS = 2e3;
|
|
777
788
|
function resolveSessionOwner(eoaAddress) {
|
|
778
789
|
const localOwner = loadSessionOwnerFromStorage(eoaAddress);
|
|
779
790
|
if (localOwner) {
|
|
@@ -822,6 +833,14 @@ function WithdrawFlow({
|
|
|
822
833
|
const onEventRef = useLatestRef(onEvent);
|
|
823
834
|
const onLifecycleRef = useLatestRef(onLifecycle);
|
|
824
835
|
const onErrorRef = useLatestRef(onError);
|
|
836
|
+
const isFlowActiveRef = useRef2(true);
|
|
837
|
+
const submitGenerationRef = useRef2(0);
|
|
838
|
+
useEffect2(() => {
|
|
839
|
+
isFlowActiveRef.current = true;
|
|
840
|
+
return () => {
|
|
841
|
+
isFlowActiveRef.current = false;
|
|
842
|
+
};
|
|
843
|
+
}, []);
|
|
825
844
|
const logFlow = useCallback2(
|
|
826
845
|
(message, data) => {
|
|
827
846
|
debugLog(debug, "withdraw-flow", message, data);
|
|
@@ -895,6 +914,7 @@ function WithdrawFlow({
|
|
|
895
914
|
const selectedWalletId = useWithdrawStore((s) => s.selectedWalletId);
|
|
896
915
|
const registration = useWithdrawStore((s) => s.registration);
|
|
897
916
|
const flowStep = useWithdrawStore((s) => s.step);
|
|
917
|
+
const reviewedRecipient = useWithdrawStore((s) => s.recipient);
|
|
898
918
|
const setSelectedWalletId = useCallback2(
|
|
899
919
|
(walletId) => storeApi.dispatch({ type: "wallet/id-selected", walletId }),
|
|
900
920
|
[storeApi]
|
|
@@ -955,7 +975,7 @@ function WithdrawFlow({
|
|
|
955
975
|
return ADDR_REGEX.test(recipientInput) ? recipientInput : void 0;
|
|
956
976
|
}, [recipientInput]);
|
|
957
977
|
useEffect2(() => {
|
|
958
|
-
if (!ownerAddress) return;
|
|
978
|
+
if (!ownerAddress || !recipientForRegistration) return;
|
|
959
979
|
const desiredTarget = {
|
|
960
980
|
chain: targetChain,
|
|
961
981
|
token: targetToken,
|
|
@@ -1088,7 +1108,14 @@ function WithdrawFlow({
|
|
|
1088
1108
|
}, [sourceChain, sourceToken]);
|
|
1089
1109
|
const isSourceNative = sourceToken.toLowerCase() === NATIVE_TOKEN_ADDRESS.toLowerCase();
|
|
1090
1110
|
const isSameRoute = targetChain === sourceChain && targetToken.toLowerCase() === sourceToken.toLowerCase();
|
|
1111
|
+
const reviewedTarget = reviewedRecipient ? {
|
|
1112
|
+
chain: targetChain,
|
|
1113
|
+
token: targetToken,
|
|
1114
|
+
recipient: reviewedRecipient
|
|
1115
|
+
} : null;
|
|
1116
|
+
const isReviewedTargetReady = registration.kind === "ready" && reviewedTarget !== null && targetsEqual(registration.registeredTarget, reviewedTarget);
|
|
1091
1117
|
const reviewBackHandler = useCallback2(() => {
|
|
1118
|
+
submitGenerationRef.current += 1;
|
|
1092
1119
|
storeApi.dispatch({ type: "review/back" });
|
|
1093
1120
|
}, [storeApi]);
|
|
1094
1121
|
useEffect2(() => {
|
|
@@ -1163,19 +1190,38 @@ function WithdrawFlow({
|
|
|
1163
1190
|
const handleReviewConfirm = useCallback2(
|
|
1164
1191
|
async () => {
|
|
1165
1192
|
const state = storeApi.getState();
|
|
1166
|
-
if (state.registration.kind !== "ready") {
|
|
1167
|
-
throw new Error("Session not ready");
|
|
1168
|
-
}
|
|
1169
|
-
const smartAccount = state.registration.smartAccount;
|
|
1170
1193
|
const recipient = state.recipient;
|
|
1171
1194
|
const amountValue = state.amount;
|
|
1172
1195
|
if (!recipient || !amountValue) {
|
|
1173
1196
|
throw new Error("Missing recipient or amount");
|
|
1174
1197
|
}
|
|
1198
|
+
const desiredTarget = {
|
|
1199
|
+
chain: targetChain,
|
|
1200
|
+
token: targetToken,
|
|
1201
|
+
recipient
|
|
1202
|
+
};
|
|
1203
|
+
const getMatchingRegistration = () => {
|
|
1204
|
+
const current = storeApi.getState().registration;
|
|
1205
|
+
return current.kind === "ready" && targetsEqual(current.registeredTarget, desiredTarget) ? current : null;
|
|
1206
|
+
};
|
|
1207
|
+
const matchingRegistration = getMatchingRegistration();
|
|
1208
|
+
if (!matchingRegistration) {
|
|
1209
|
+
throw new Error("Withdrawal target is still being prepared");
|
|
1210
|
+
}
|
|
1211
|
+
const smartAccount = matchingRegistration.smartAccount;
|
|
1175
1212
|
if (!onSignTransaction && !signerContext?.walletClient) {
|
|
1176
1213
|
throw new Error("Wallet not connected");
|
|
1177
1214
|
}
|
|
1215
|
+
const submitGeneration = submitGenerationRef.current += 1;
|
|
1216
|
+
const isSubmissionLive = () => isFlowActiveRef.current && submitGenerationRef.current === submitGeneration;
|
|
1178
1217
|
try {
|
|
1218
|
+
await new Promise((resolve) => {
|
|
1219
|
+
setTimeout(resolve, WITHDRAW_INDEXING_DELAY_MS);
|
|
1220
|
+
});
|
|
1221
|
+
if (!isSubmissionLive()) return;
|
|
1222
|
+
if (!getMatchingRegistration()) {
|
|
1223
|
+
throw new Error("Withdrawal target changed before submission");
|
|
1224
|
+
}
|
|
1179
1225
|
logFlow("submit:start", {
|
|
1180
1226
|
smartAccount,
|
|
1181
1227
|
recipient,
|
|
@@ -1207,7 +1253,12 @@ function WithdrawFlow({
|
|
|
1207
1253
|
data: transferData.data,
|
|
1208
1254
|
chainId: sourceChain
|
|
1209
1255
|
});
|
|
1256
|
+
if (!isSubmissionLive()) return;
|
|
1210
1257
|
const { signature } = await onSignTransaction(request);
|
|
1258
|
+
if (!isSubmissionLive()) return;
|
|
1259
|
+
if (!getMatchingRegistration()) {
|
|
1260
|
+
throw new Error("Withdrawal target changed before submission");
|
|
1261
|
+
}
|
|
1211
1262
|
const relayResult = await service.relayWithdraw({
|
|
1212
1263
|
smartAccount,
|
|
1213
1264
|
chainId: toEvmCaip2(sourceChain),
|
|
@@ -1220,6 +1271,9 @@ function WithdrawFlow({
|
|
|
1220
1271
|
}
|
|
1221
1272
|
result = { txHash: relayResult.txHash };
|
|
1222
1273
|
} else if (isSourceNative) {
|
|
1274
|
+
if (!getMatchingRegistration()) {
|
|
1275
|
+
throw new Error("Withdrawal target changed before submission");
|
|
1276
|
+
}
|
|
1223
1277
|
result = await executeSafeEthTransfer({
|
|
1224
1278
|
walletClient: signerContext.walletClient,
|
|
1225
1279
|
publicClient: pc,
|
|
@@ -1229,6 +1283,9 @@ function WithdrawFlow({
|
|
|
1229
1283
|
chainId: sourceChain
|
|
1230
1284
|
});
|
|
1231
1285
|
} else {
|
|
1286
|
+
if (!getMatchingRegistration()) {
|
|
1287
|
+
throw new Error("Withdrawal target changed before submission");
|
|
1288
|
+
}
|
|
1232
1289
|
result = await executeSafeErc20Transfer({
|
|
1233
1290
|
walletClient: signerContext.walletClient,
|
|
1234
1291
|
publicClient: pc,
|
|
@@ -1239,6 +1296,7 @@ function WithdrawFlow({
|
|
|
1239
1296
|
chainId: sourceChain
|
|
1240
1297
|
});
|
|
1241
1298
|
}
|
|
1299
|
+
if (!isSubmissionLive()) return;
|
|
1242
1300
|
logFlow("withdraw:submitted", {
|
|
1243
1301
|
txHash: result.txHash,
|
|
1244
1302
|
smartAccount,
|
|
@@ -1456,7 +1514,8 @@ function WithdrawFlow({
|
|
|
1456
1514
|
targetToken,
|
|
1457
1515
|
amount: storeApi.getState().amount ?? "0",
|
|
1458
1516
|
recipient: storeApi.getState().recipient ?? recipientForRegistration ?? "0x0",
|
|
1459
|
-
|
|
1517
|
+
service,
|
|
1518
|
+
registrationPending: registration.kind === "pending" || registration.kind === "stale" || !isReviewedTargetReady,
|
|
1460
1519
|
registrationError: registration.kind === "failed" ? registration.error : null,
|
|
1461
1520
|
onConfirm: handleReviewConfirm,
|
|
1462
1521
|
onError: handleError
|
|
@@ -1471,7 +1530,9 @@ function WithdrawFlow({
|
|
|
1471
1530
|
sourceToken,
|
|
1472
1531
|
targetChain,
|
|
1473
1532
|
targetToken,
|
|
1474
|
-
amount: storeApi.getState().amount ?? "0",
|
|
1533
|
+
amount: toBaseUnits(storeApi.getState().amount ?? "0", asset.decimals),
|
|
1534
|
+
sourceSymbol: asset.symbol,
|
|
1535
|
+
sourceDecimals: asset.decimals,
|
|
1475
1536
|
directTransfer: isSameRoute,
|
|
1476
1537
|
service,
|
|
1477
1538
|
flowLabel: "withdraw",
|
|
@@ -1485,6 +1546,13 @@ function WithdrawFlow({
|
|
|
1485
1546
|
)
|
|
1486
1547
|
] });
|
|
1487
1548
|
}
|
|
1549
|
+
function toBaseUnits(amount, decimals) {
|
|
1550
|
+
try {
|
|
1551
|
+
return parseUnits2(amount, decimals).toString();
|
|
1552
|
+
} catch {
|
|
1553
|
+
return "0";
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1488
1556
|
function deriveStepView(step, _registration) {
|
|
1489
1557
|
if (step === "review") return "review";
|
|
1490
1558
|
if (step === "processing" || step === "complete" || step === "failed") {
|
|
@@ -1496,7 +1564,7 @@ function deriveStepView(step, _registration) {
|
|
|
1496
1564
|
// src/WithdrawModal.tsx
|
|
1497
1565
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1498
1566
|
var ReownWithdrawInner = lazy(
|
|
1499
|
-
() => import("./WithdrawModalReown-
|
|
1567
|
+
() => import("./WithdrawModalReown-G7EM6HXO.mjs").then((m) => ({
|
|
1500
1568
|
default: m.WithdrawModalReown
|
|
1501
1569
|
}))
|
|
1502
1570
|
);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isUnsupportedChainSwitchError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-A33QFRKD.mjs";
|
|
4
4
|
import {
|
|
5
5
|
SUPPORTED_CHAINS,
|
|
6
6
|
getChainName
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-WJX3TJFK.mjs";
|
|
8
8
|
|
|
9
9
|
// src/core/reown.tsx
|
|
10
10
|
import { useState } from "react";
|
|
@@ -33,7 +33,12 @@ import {
|
|
|
33
33
|
base,
|
|
34
34
|
bsc,
|
|
35
35
|
soneium,
|
|
36
|
-
plasma
|
|
36
|
+
plasma,
|
|
37
|
+
gnosis,
|
|
38
|
+
sonic,
|
|
39
|
+
monad,
|
|
40
|
+
unichain,
|
|
41
|
+
katana
|
|
37
42
|
} from "@reown/appkit/networks";
|
|
38
43
|
var APPKIT_NETWORK_BY_ID = {
|
|
39
44
|
[mainnet.id]: mainnet,
|
|
@@ -43,7 +48,12 @@ var APPKIT_NETWORK_BY_ID = {
|
|
|
43
48
|
[base.id]: base,
|
|
44
49
|
[bsc.id]: bsc,
|
|
45
50
|
[soneium.id]: soneium,
|
|
46
|
-
[plasma.id]: plasma
|
|
51
|
+
[plasma.id]: plasma,
|
|
52
|
+
[gnosis.id]: gnosis,
|
|
53
|
+
[sonic.id]: sonic,
|
|
54
|
+
[monad.id]: monad,
|
|
55
|
+
[unichain.id]: unichain,
|
|
56
|
+
[katana.id]: katana
|
|
47
57
|
};
|
|
48
58
|
var EVM_NETWORKS = SUPPORTED_CHAINS.map((chain) => {
|
|
49
59
|
const network = APPKIT_NETWORK_BY_ID[chain.id];
|