@rhinestone/deposit-modal 0.1.60 → 0.1.62
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-S24YS35X.mjs → DepositModalReown-5CFJIJO5.mjs} +2 -2
- package/dist/{DepositModalReown-VP5E2JRC.cjs → DepositModalReown-U5ZTK3PW.cjs} +3 -3
- package/dist/{WithdrawModalReown-Y2ETJQON.mjs → WithdrawModalReown-DRSOFZLI.mjs} +2 -2
- package/dist/{WithdrawModalReown-7JLR264N.cjs → WithdrawModalReown-K73XDERE.cjs} +3 -3
- package/dist/{chunk-HX7LLE2V.cjs → chunk-6UBIFHRV.cjs} +143 -119
- package/dist/{chunk-JJMPCRKB.mjs → chunk-7YERRXZ4.mjs} +30 -16
- package/dist/{chunk-3CANBYBN.cjs → chunk-MKU7VETP.cjs} +80 -66
- package/dist/{chunk-TQ6IIGRS.cjs → chunk-MVFMDKAS.cjs} +12 -1
- package/dist/{chunk-7TTEHQBD.mjs → chunk-NDTY5AUU.mjs} +23 -12
- package/dist/{chunk-6SM3IQKZ.mjs → chunk-QME5ZAI6.mjs} +39 -15
- package/dist/deposit.cjs +3 -3
- package/dist/deposit.mjs +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.mjs +3 -3
- package/dist/reown.cjs +4 -4
- package/dist/reown.mjs +3 -3
- package/dist/withdraw.cjs +3 -3
- package/dist/withdraw.mjs +2 -2
- package/package.json +1 -1
|
@@ -19,8 +19,9 @@ import {
|
|
|
19
19
|
isNativeAsset,
|
|
20
20
|
loadSessionOwnerFromStorage,
|
|
21
21
|
saveSessionOwnerToStorage,
|
|
22
|
-
toEvmCaip2
|
|
23
|
-
|
|
22
|
+
toEvmCaip2,
|
|
23
|
+
useLatestRef
|
|
24
|
+
} from "./chunk-NDTY5AUU.mjs";
|
|
24
25
|
import {
|
|
25
26
|
DEFAULT_BACKEND_URL,
|
|
26
27
|
DEFAULT_SIGNER_ADDRESS,
|
|
@@ -40,14 +41,14 @@ import {
|
|
|
40
41
|
useCallback as useCallback3,
|
|
41
42
|
useEffect as useEffect3,
|
|
42
43
|
useMemo as useMemo3,
|
|
43
|
-
useRef as
|
|
44
|
+
useRef as useRef3,
|
|
44
45
|
useState as useState3,
|
|
45
46
|
lazy,
|
|
46
47
|
Suspense
|
|
47
48
|
} from "react";
|
|
48
49
|
|
|
49
50
|
// src/WithdrawFlow.tsx
|
|
50
|
-
import { useCallback as useCallback2, useEffect as useEffect2, useMemo as useMemo2, useState as useState2 } from "react";
|
|
51
|
+
import { useCallback as useCallback2, useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2, useState as useState2 } from "react";
|
|
51
52
|
|
|
52
53
|
// src/components/steps/WithdrawFormStep.tsx
|
|
53
54
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
@@ -905,6 +906,9 @@ function WithdrawFlow({
|
|
|
905
906
|
onError,
|
|
906
907
|
debug
|
|
907
908
|
}) {
|
|
909
|
+
const onStepChangeRef = useLatestRef(onStepChange);
|
|
910
|
+
const onTotalBalanceChangeRef = useLatestRef(onTotalBalanceChange);
|
|
911
|
+
const onEventRef = useLatestRef(onEvent);
|
|
908
912
|
const [step, setStep] = useState2({ type: "form" });
|
|
909
913
|
const [isSubmitting, setIsSubmitting] = useState2(false);
|
|
910
914
|
const [totalBalanceUsd, setTotalBalanceUsd] = useState2(0);
|
|
@@ -1036,20 +1040,29 @@ function WithdrawFlow({
|
|
|
1036
1040
|
const stepIndex = step.type === "form" ? 0 : 1;
|
|
1037
1041
|
const currentBackHandler = void 0;
|
|
1038
1042
|
useEffect2(() => {
|
|
1039
|
-
|
|
1040
|
-
}, [stepIndex, currentBackHandler,
|
|
1043
|
+
onStepChangeRef.current?.(stepIndex, currentBackHandler);
|
|
1044
|
+
}, [stepIndex, currentBackHandler, onStepChangeRef]);
|
|
1045
|
+
const lastStepOpenEventKeyRef = useRef2(null);
|
|
1041
1046
|
useEffect2(() => {
|
|
1047
|
+
if (step.type !== "form") {
|
|
1048
|
+
lastStepOpenEventKeyRef.current = null;
|
|
1049
|
+
return;
|
|
1050
|
+
}
|
|
1051
|
+
if (lastStepOpenEventKeyRef.current === "form") {
|
|
1052
|
+
return;
|
|
1053
|
+
}
|
|
1054
|
+
lastStepOpenEventKeyRef.current = "form";
|
|
1042
1055
|
if (step.type === "form") {
|
|
1043
1056
|
const tokenSymbol = getTokenSymbol(targetToken, targetChain);
|
|
1044
1057
|
const chainName = getChainName(targetChain);
|
|
1045
|
-
|
|
1058
|
+
onEventRef.current?.({
|
|
1046
1059
|
type: "withdraw_modal_select_amount_open",
|
|
1047
1060
|
pred_balance: totalBalanceUsd,
|
|
1048
1061
|
default_token: tokenSymbol,
|
|
1049
1062
|
default_chain: chainName
|
|
1050
1063
|
});
|
|
1051
1064
|
}
|
|
1052
|
-
}, [step.type,
|
|
1065
|
+
}, [step.type, targetToken, targetChain, totalBalanceUsd, onEventRef]);
|
|
1053
1066
|
useEffect2(() => {
|
|
1054
1067
|
logFlow("state:changed", {
|
|
1055
1068
|
step: step.type,
|
|
@@ -1069,8 +1082,8 @@ function WithdrawFlow({
|
|
|
1069
1082
|
targetToken
|
|
1070
1083
|
]);
|
|
1071
1084
|
useEffect2(() => {
|
|
1072
|
-
|
|
1073
|
-
}, [totalBalanceUsd,
|
|
1085
|
+
onTotalBalanceChangeRef.current?.(totalBalanceUsd);
|
|
1086
|
+
}, [totalBalanceUsd, onTotalBalanceChangeRef]);
|
|
1074
1087
|
const handleConnected = useCallback2(
|
|
1075
1088
|
(addr, smartAccount) => {
|
|
1076
1089
|
logFlow("setup:connected", { address: addr, smartAccount });
|
|
@@ -1478,7 +1491,7 @@ function WithdrawFlow({
|
|
|
1478
1491
|
// src/WithdrawModal.tsx
|
|
1479
1492
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1480
1493
|
var ReownWithdrawInner = lazy(
|
|
1481
|
-
() => import("./WithdrawModalReown-
|
|
1494
|
+
() => import("./WithdrawModalReown-DRSOFZLI.mjs").then((m) => ({
|
|
1482
1495
|
default: m.WithdrawModalReown
|
|
1483
1496
|
}))
|
|
1484
1497
|
);
|
|
@@ -1530,10 +1543,11 @@ function WithdrawModalInner({
|
|
|
1530
1543
|
onError,
|
|
1531
1544
|
debug
|
|
1532
1545
|
}) {
|
|
1533
|
-
const modalRef =
|
|
1546
|
+
const modalRef = useRef3(null);
|
|
1547
|
+
const onReadyRef = useLatestRef(onReady);
|
|
1534
1548
|
const [currentStepIndex, setCurrentStepIndex] = useState3(0);
|
|
1535
1549
|
const [totalBalanceUsd, setTotalBalanceUsd] = useState3(null);
|
|
1536
|
-
const backHandlerRef =
|
|
1550
|
+
const backHandlerRef = useRef3(void 0);
|
|
1537
1551
|
const targetChain = getChainId(targetChainProp);
|
|
1538
1552
|
const sourceChain = getChainId(sourceChainProp);
|
|
1539
1553
|
const service = useMemo3(
|
|
@@ -1545,13 +1559,13 @@ function WithdrawModalInner({
|
|
|
1545
1559
|
applyTheme(modalRef.current, theme);
|
|
1546
1560
|
}
|
|
1547
1561
|
}, [isOpen, theme]);
|
|
1548
|
-
const hasCalledReady =
|
|
1562
|
+
const hasCalledReady = useRef3(false);
|
|
1549
1563
|
useEffect3(() => {
|
|
1550
1564
|
if (isOpen && !hasCalledReady.current) {
|
|
1551
1565
|
hasCalledReady.current = true;
|
|
1552
|
-
|
|
1566
|
+
onReadyRef.current?.();
|
|
1553
1567
|
}
|
|
1554
|
-
}, [isOpen,
|
|
1568
|
+
}, [isOpen, onReadyRef]);
|
|
1555
1569
|
useEffect3(() => {
|
|
1556
1570
|
if (!isOpen) {
|
|
1557
1571
|
setCurrentStepIndex(0);
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
|
|
24
|
+
var _chunkMVFMDKAScjs = require('./chunk-MVFMDKAS.cjs');
|
|
24
25
|
|
|
25
26
|
|
|
26
27
|
|
|
@@ -141,7 +142,7 @@ function WithdrawFormStep({
|
|
|
141
142
|
setIsSwitching(true);
|
|
142
143
|
switchChain(asset.chainId).catch((err) => {
|
|
143
144
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
144
|
-
setError(
|
|
145
|
+
setError(_chunkMVFMDKAScjs.formatUserError.call(void 0, raw));
|
|
145
146
|
}).finally(() => {
|
|
146
147
|
setIsSwitching(false);
|
|
147
148
|
});
|
|
@@ -161,7 +162,7 @@ function WithdrawFormStep({
|
|
|
161
162
|
return;
|
|
162
163
|
}
|
|
163
164
|
try {
|
|
164
|
-
const bal =
|
|
165
|
+
const bal = _chunkMVFMDKAScjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: safeAddress }) : await publicClient.readContract({
|
|
165
166
|
address: asset.token,
|
|
166
167
|
abi: _viem.erc20Abi,
|
|
167
168
|
functionName: "balanceOf",
|
|
@@ -264,7 +265,7 @@ function WithdrawFormStep({
|
|
|
264
265
|
await onSubmit(recipient, amount);
|
|
265
266
|
} catch (err) {
|
|
266
267
|
const raw = err instanceof Error ? err.message : "Withdrawal failed";
|
|
267
|
-
setError(
|
|
268
|
+
setError(_chunkMVFMDKAScjs.formatUserError.call(void 0, raw));
|
|
268
269
|
} finally {
|
|
269
270
|
setIsSubmitting(false);
|
|
270
271
|
}
|
|
@@ -272,11 +273,11 @@ function WithdrawFormStep({
|
|
|
272
273
|
if (isBalanceLoading) {
|
|
273
274
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
274
275
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body rs-withdraw-loading", children: [
|
|
275
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
276
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMVFMDKAScjs.Spinner, { className: "rs-spinner--lg" }),
|
|
276
277
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-loading-title", children: "Loading on-chain balance" }),
|
|
277
278
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-loading-subtitle", children: chainMismatch ? `Switch to ${_chunkR6U6BHCVcjs.getChainName.call(void 0, asset.chainId)} to continue.` : "Please wait before withdrawing." })
|
|
278
279
|
] }),
|
|
279
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
280
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMVFMDKAScjs.PoweredBy, {})
|
|
280
281
|
] });
|
|
281
282
|
}
|
|
282
283
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
@@ -375,7 +376,7 @@ function WithdrawFormStep({
|
|
|
375
376
|
] })
|
|
376
377
|
] }),
|
|
377
378
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-amount-info", children: [
|
|
378
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ?
|
|
379
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ? _chunkMVFMDKAScjs.currencyFormatter.format(amountUsd) : "$0.00" }),
|
|
379
380
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-withdraw-balance", children: [
|
|
380
381
|
"Balance: ",
|
|
381
382
|
formattedBalance,
|
|
@@ -569,7 +570,7 @@ function WithdrawFormStep({
|
|
|
569
570
|
] })
|
|
570
571
|
] }),
|
|
571
572
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
572
|
-
|
|
573
|
+
_chunkMVFMDKAScjs.Button,
|
|
573
574
|
{
|
|
574
575
|
onClick: handleWithdraw,
|
|
575
576
|
fullWidth: true,
|
|
@@ -578,7 +579,7 @@ function WithdrawFormStep({
|
|
|
578
579
|
children: isBusy ? "Preparing..." : !recipient ? "Enter Recipient Address" : !amount ? "Enter Withdraw Amount" : "Withdraw"
|
|
579
580
|
}
|
|
580
581
|
) }),
|
|
581
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
582
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMVFMDKAScjs.PoweredBy, {})
|
|
582
583
|
] });
|
|
583
584
|
}
|
|
584
585
|
WithdrawFormStep.displayName = "WithdrawFormStep";
|
|
@@ -905,19 +906,22 @@ function WithdrawFlow({
|
|
|
905
906
|
onError,
|
|
906
907
|
debug
|
|
907
908
|
}) {
|
|
909
|
+
const onStepChangeRef = _chunkMVFMDKAScjs.useLatestRef.call(void 0, onStepChange);
|
|
910
|
+
const onTotalBalanceChangeRef = _chunkMVFMDKAScjs.useLatestRef.call(void 0, onTotalBalanceChange);
|
|
911
|
+
const onEventRef = _chunkMVFMDKAScjs.useLatestRef.call(void 0, onEvent);
|
|
908
912
|
const [step, setStep] = _react.useState.call(void 0, { type: "form" });
|
|
909
913
|
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
910
914
|
const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, 0);
|
|
911
915
|
const [isConnectSelectionConfirmed, setIsConnectSelectionConfirmed] = _react.useState.call(void 0, false);
|
|
912
916
|
const logFlow = _react.useCallback.call(void 0,
|
|
913
917
|
(message, data) => {
|
|
914
|
-
|
|
918
|
+
_chunkMVFMDKAScjs.debugLog.call(void 0, debug, "withdraw-flow", message, data);
|
|
915
919
|
},
|
|
916
920
|
[debug]
|
|
917
921
|
);
|
|
918
922
|
const logFlowError = _react.useCallback.call(void 0,
|
|
919
923
|
(message, error, data) => {
|
|
920
|
-
|
|
924
|
+
_chunkMVFMDKAScjs.debugError.call(void 0, debug, "withdraw-flow", message, error, data);
|
|
921
925
|
},
|
|
922
926
|
[debug]
|
|
923
927
|
);
|
|
@@ -976,14 +980,14 @@ function WithdrawFlow({
|
|
|
976
980
|
return {
|
|
977
981
|
ownerAddress: dappAddress,
|
|
978
982
|
walletClient: _nullishCoalesce(dappWalletClient, () => ( void 0)),
|
|
979
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
983
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkMVFMDKAScjs.getPublicClient.call(void 0, sourceChain))),
|
|
980
984
|
switchChain: dappSwitchChain
|
|
981
985
|
};
|
|
982
986
|
}
|
|
983
987
|
return {
|
|
984
988
|
ownerAddress: dappWalletClient.account.address,
|
|
985
989
|
walletClient: dappWalletClient,
|
|
986
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
990
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkMVFMDKAScjs.getPublicClient.call(void 0, sourceChain))),
|
|
987
991
|
switchChain: dappSwitchChain
|
|
988
992
|
};
|
|
989
993
|
}
|
|
@@ -994,7 +998,7 @@ function WithdrawFlow({
|
|
|
994
998
|
return {
|
|
995
999
|
ownerAddress: dappWalletClient.account.address,
|
|
996
1000
|
walletClient: dappWalletClient,
|
|
997
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
1001
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkMVFMDKAScjs.getPublicClient.call(void 0, sourceChain))),
|
|
998
1002
|
switchChain: dappSwitchChain
|
|
999
1003
|
};
|
|
1000
1004
|
}
|
|
@@ -1024,7 +1028,7 @@ function WithdrawFlow({
|
|
|
1024
1028
|
const symbol = _chunkR6U6BHCVcjs.getTokenSymbol.call(void 0, sourceToken, sourceChain);
|
|
1025
1029
|
const decimals = _chunkR6U6BHCVcjs.getTokenDecimalsByAddress.call(void 0, sourceToken, sourceChain);
|
|
1026
1030
|
return {
|
|
1027
|
-
id:
|
|
1031
|
+
id: _chunkMVFMDKAScjs.getAssetId.call(void 0, { chainId: sourceChain, token: sourceToken }),
|
|
1028
1032
|
chainId: sourceChain,
|
|
1029
1033
|
token: sourceToken,
|
|
1030
1034
|
symbol,
|
|
@@ -1036,20 +1040,29 @@ function WithdrawFlow({
|
|
|
1036
1040
|
const stepIndex = step.type === "form" ? 0 : 1;
|
|
1037
1041
|
const currentBackHandler = void 0;
|
|
1038
1042
|
_react.useEffect.call(void 0, () => {
|
|
1039
|
-
_optionalChain([
|
|
1040
|
-
}, [stepIndex, currentBackHandler,
|
|
1043
|
+
_optionalChain([onStepChangeRef, 'access', _20 => _20.current, 'optionalCall', _21 => _21(stepIndex, currentBackHandler)]);
|
|
1044
|
+
}, [stepIndex, currentBackHandler, onStepChangeRef]);
|
|
1045
|
+
const lastStepOpenEventKeyRef = _react.useRef.call(void 0, null);
|
|
1041
1046
|
_react.useEffect.call(void 0, () => {
|
|
1047
|
+
if (step.type !== "form") {
|
|
1048
|
+
lastStepOpenEventKeyRef.current = null;
|
|
1049
|
+
return;
|
|
1050
|
+
}
|
|
1051
|
+
if (lastStepOpenEventKeyRef.current === "form") {
|
|
1052
|
+
return;
|
|
1053
|
+
}
|
|
1054
|
+
lastStepOpenEventKeyRef.current = "form";
|
|
1042
1055
|
if (step.type === "form") {
|
|
1043
1056
|
const tokenSymbol = _chunkR6U6BHCVcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
1044
1057
|
const chainName = _chunkR6U6BHCVcjs.getChainName.call(void 0, targetChain);
|
|
1045
|
-
_optionalChain([
|
|
1058
|
+
_optionalChain([onEventRef, 'access', _22 => _22.current, 'optionalCall', _23 => _23({
|
|
1046
1059
|
type: "withdraw_modal_select_amount_open",
|
|
1047
1060
|
pred_balance: totalBalanceUsd,
|
|
1048
1061
|
default_token: tokenSymbol,
|
|
1049
1062
|
default_chain: chainName
|
|
1050
1063
|
})]);
|
|
1051
1064
|
}
|
|
1052
|
-
}, [step.type,
|
|
1065
|
+
}, [step.type, targetToken, targetChain, totalBalanceUsd, onEventRef]);
|
|
1053
1066
|
_react.useEffect.call(void 0, () => {
|
|
1054
1067
|
logFlow("state:changed", {
|
|
1055
1068
|
step: step.type,
|
|
@@ -1069,32 +1082,32 @@ function WithdrawFlow({
|
|
|
1069
1082
|
targetToken
|
|
1070
1083
|
]);
|
|
1071
1084
|
_react.useEffect.call(void 0, () => {
|
|
1072
|
-
_optionalChain([
|
|
1073
|
-
}, [totalBalanceUsd,
|
|
1085
|
+
_optionalChain([onTotalBalanceChangeRef, 'access', _24 => _24.current, 'optionalCall', _25 => _25(totalBalanceUsd)]);
|
|
1086
|
+
}, [totalBalanceUsd, onTotalBalanceChangeRef]);
|
|
1074
1087
|
const handleConnected = _react.useCallback.call(void 0,
|
|
1075
1088
|
(addr, smartAccount) => {
|
|
1076
1089
|
logFlow("setup:connected", { address: addr, smartAccount });
|
|
1077
|
-
_optionalChain([onConnected, 'optionalCall',
|
|
1090
|
+
_optionalChain([onConnected, 'optionalCall', _26 => _26({ address: addr, smartAccount })]);
|
|
1078
1091
|
},
|
|
1079
1092
|
[logFlow, onConnected]
|
|
1080
1093
|
);
|
|
1081
1094
|
const handleError = _react.useCallback.call(void 0,
|
|
1082
1095
|
(message, code) => {
|
|
1083
1096
|
logFlowError("flow:error", message, { code });
|
|
1084
|
-
_optionalChain([onError, 'optionalCall',
|
|
1097
|
+
_optionalChain([onError, 'optionalCall', _27 => _27({ message, code })]);
|
|
1085
1098
|
},
|
|
1086
1099
|
[logFlowError, onError]
|
|
1087
1100
|
);
|
|
1088
1101
|
const resolveSessionOwner = _react.useCallback.call(void 0, async (eoaAddress) => {
|
|
1089
|
-
const localOwner =
|
|
1102
|
+
const localOwner = _chunkMVFMDKAScjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
|
|
1090
1103
|
if (localOwner) {
|
|
1091
1104
|
return {
|
|
1092
|
-
account:
|
|
1105
|
+
account: _chunkMVFMDKAScjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
|
|
1093
1106
|
address: localOwner.address
|
|
1094
1107
|
};
|
|
1095
1108
|
}
|
|
1096
|
-
const created =
|
|
1097
|
-
|
|
1109
|
+
const created = _chunkMVFMDKAScjs.createSessionOwnerKey.call(void 0, );
|
|
1110
|
+
_chunkMVFMDKAScjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
|
|
1098
1111
|
return {
|
|
1099
1112
|
account: created.account,
|
|
1100
1113
|
address: created.address
|
|
@@ -1104,7 +1117,7 @@ function WithdrawFlow({
|
|
|
1104
1117
|
async (recipient, amountValue) => {
|
|
1105
1118
|
const tokenSymbol = _chunkR6U6BHCVcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
1106
1119
|
const chainName = _chunkR6U6BHCVcjs.getChainName.call(void 0, targetChain);
|
|
1107
|
-
_optionalChain([onEvent, 'optionalCall',
|
|
1120
|
+
_optionalChain([onEvent, 'optionalCall', _28 => _28({
|
|
1108
1121
|
type: "withdraw_modal_select_amount_cta_click",
|
|
1109
1122
|
pred_balance: totalBalanceUsd,
|
|
1110
1123
|
selected_token: tokenSymbol,
|
|
@@ -1112,11 +1125,11 @@ function WithdrawFlow({
|
|
|
1112
1125
|
amount: amountValue,
|
|
1113
1126
|
cta_name: "withdraw"
|
|
1114
1127
|
})]);
|
|
1115
|
-
const ownerAddress2 = _optionalChain([signerContext, 'optionalAccess',
|
|
1128
|
+
const ownerAddress2 = _optionalChain([signerContext, 'optionalAccess', _29 => _29.ownerAddress]);
|
|
1116
1129
|
if (!ownerAddress2) {
|
|
1117
1130
|
throw new Error("Wallet not connected");
|
|
1118
1131
|
}
|
|
1119
|
-
if (!onSignTransaction && !_optionalChain([signerContext, 'optionalAccess',
|
|
1132
|
+
if (!onSignTransaction && !_optionalChain([signerContext, 'optionalAccess', _30 => _30.walletClient])) {
|
|
1120
1133
|
throw new Error("Wallet not connected");
|
|
1121
1134
|
}
|
|
1122
1135
|
setIsSubmitting(true);
|
|
@@ -1134,7 +1147,7 @@ function WithdrawFlow({
|
|
|
1134
1147
|
const setup = await service.setupAccount({
|
|
1135
1148
|
ownerAddress: ownerAddress2,
|
|
1136
1149
|
sessionOwnerAddress: sessionOwner.address,
|
|
1137
|
-
targetChain:
|
|
1150
|
+
targetChain: _chunkMVFMDKAScjs.toEvmCaip2.call(void 0, targetChain),
|
|
1138
1151
|
targetToken,
|
|
1139
1152
|
signerAddress,
|
|
1140
1153
|
sessionChainIds,
|
|
@@ -1161,7 +1174,7 @@ function WithdrawFlow({
|
|
|
1161
1174
|
primaryType: typedData.primaryType,
|
|
1162
1175
|
message: typedData.message
|
|
1163
1176
|
});
|
|
1164
|
-
const sessionDetails =
|
|
1177
|
+
const sessionDetails = _chunkMVFMDKAScjs.buildSessionDetails.call(void 0,
|
|
1165
1178
|
setup.sessionDetailsUnsigned,
|
|
1166
1179
|
signature
|
|
1167
1180
|
);
|
|
@@ -1175,7 +1188,7 @@ function WithdrawFlow({
|
|
|
1175
1188
|
eoaAddress: ownerAddress2,
|
|
1176
1189
|
sessionOwner: sessionOwner.address,
|
|
1177
1190
|
target: {
|
|
1178
|
-
chain:
|
|
1191
|
+
chain: _chunkMVFMDKAScjs.toEvmCaip2.call(void 0, targetChain),
|
|
1179
1192
|
token: targetToken,
|
|
1180
1193
|
recipient
|
|
1181
1194
|
}
|
|
@@ -1184,7 +1197,7 @@ function WithdrawFlow({
|
|
|
1184
1197
|
}
|
|
1185
1198
|
handleConnected(ownerAddress2, smartAccount);
|
|
1186
1199
|
const amountUnits = _viem.parseUnits.call(void 0, amountValue, asset.decimals);
|
|
1187
|
-
const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess',
|
|
1200
|
+
const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _31 => _31.publicClient]), () => ( _chunkMVFMDKAScjs.getPublicClient.call(void 0, sourceChain)));
|
|
1188
1201
|
let result;
|
|
1189
1202
|
if (onSignTransaction) {
|
|
1190
1203
|
const transferData = isSourceNative ? { to: smartAccount, value: amountUnits, data: "0x" } : {
|
|
@@ -1207,7 +1220,7 @@ function WithdrawFlow({
|
|
|
1207
1220
|
const { signature } = await onSignTransaction(request);
|
|
1208
1221
|
const relayResult = await service.relayWithdraw({
|
|
1209
1222
|
smartAccount,
|
|
1210
|
-
chainId:
|
|
1223
|
+
chainId: _chunkMVFMDKAScjs.toEvmCaip2.call(void 0, sourceChain),
|
|
1211
1224
|
safeAddress,
|
|
1212
1225
|
safeTransaction: request.typedData.message,
|
|
1213
1226
|
signature
|
|
@@ -1243,7 +1256,7 @@ function WithdrawFlow({
|
|
|
1243
1256
|
sourceChain,
|
|
1244
1257
|
sourceToken
|
|
1245
1258
|
});
|
|
1246
|
-
_optionalChain([onWithdrawSubmitted, 'optionalCall',
|
|
1259
|
+
_optionalChain([onWithdrawSubmitted, 'optionalCall', _32 => _32({
|
|
1247
1260
|
txHash: result.txHash,
|
|
1248
1261
|
sourceChain,
|
|
1249
1262
|
amount: amountUnits.toString(),
|
|
@@ -1265,7 +1278,7 @@ function WithdrawFlow({
|
|
|
1265
1278
|
targetChain,
|
|
1266
1279
|
targetToken
|
|
1267
1280
|
});
|
|
1268
|
-
handleError(
|
|
1281
|
+
handleError(_chunkMVFMDKAScjs.formatUserError.call(void 0, raw), "WITHDRAW_FLOW_ERROR");
|
|
1269
1282
|
throw err;
|
|
1270
1283
|
} finally {
|
|
1271
1284
|
setIsSubmitting(false);
|
|
@@ -1298,7 +1311,7 @@ function WithdrawFlow({
|
|
|
1298
1311
|
const handleWithdrawComplete = _react.useCallback.call(void 0,
|
|
1299
1312
|
(txHash, destinationTxHash, context) => {
|
|
1300
1313
|
logFlow("withdraw:complete", { txHash, destinationTxHash, ...context });
|
|
1301
|
-
_optionalChain([onWithdrawComplete, 'optionalCall',
|
|
1314
|
+
_optionalChain([onWithdrawComplete, 'optionalCall', _33 => _33({
|
|
1302
1315
|
txHash,
|
|
1303
1316
|
destinationTxHash,
|
|
1304
1317
|
amount: context.amount,
|
|
@@ -1313,17 +1326,17 @@ function WithdrawFlow({
|
|
|
1313
1326
|
const handleWithdrawFailed = _react.useCallback.call(void 0,
|
|
1314
1327
|
(txHash, error) => {
|
|
1315
1328
|
logFlowError("withdraw:failed", error, { txHash });
|
|
1316
|
-
_optionalChain([onWithdrawFailed, 'optionalCall',
|
|
1329
|
+
_optionalChain([onWithdrawFailed, 'optionalCall', _34 => _34({ txHash, error })]);
|
|
1317
1330
|
},
|
|
1318
1331
|
[logFlowError, onWithdrawFailed]
|
|
1319
1332
|
);
|
|
1320
1333
|
const allowedChainSet = _react.useMemo.call(void 0,
|
|
1321
|
-
() => _optionalChain([allowedRoutes, 'optionalAccess',
|
|
1322
|
-
[_optionalChain([allowedRoutes, 'optionalAccess',
|
|
1334
|
+
() => _optionalChain([allowedRoutes, 'optionalAccess', _35 => _35.sourceChains]) ? new Set(allowedRoutes.sourceChains) : null,
|
|
1335
|
+
[_optionalChain([allowedRoutes, 'optionalAccess', _36 => _36.sourceChains])]
|
|
1323
1336
|
);
|
|
1324
1337
|
const allowedTokenSet = _react.useMemo.call(void 0,
|
|
1325
|
-
() => _optionalChain([allowedRoutes, 'optionalAccess',
|
|
1326
|
-
[_optionalChain([allowedRoutes, 'optionalAccess',
|
|
1338
|
+
() => _optionalChain([allowedRoutes, 'optionalAccess', _37 => _37.sourceTokens]) ? new Set(allowedRoutes.sourceTokens.map((s) => s.toUpperCase())) : null,
|
|
1339
|
+
[_optionalChain([allowedRoutes, 'optionalAccess', _38 => _38.sourceTokens])]
|
|
1327
1340
|
);
|
|
1328
1341
|
const targetChainOptions = _react.useMemo.call(void 0, () => {
|
|
1329
1342
|
return _chunkR6U6BHCVcjs.SOURCE_CHAINS.filter((chain) => {
|
|
@@ -1392,17 +1405,17 @@ function WithdrawFlow({
|
|
|
1392
1405
|
setIsConnectSelectionConfirmed(false);
|
|
1393
1406
|
}
|
|
1394
1407
|
}, [showConnectStep, isConnectSelectionConfirmed, signerContext]);
|
|
1395
|
-
const ownerAddress = _optionalChain([signerContext, 'optionalAccess',
|
|
1408
|
+
const ownerAddress = _optionalChain([signerContext, 'optionalAccess', _39 => _39.ownerAddress]);
|
|
1396
1409
|
const selectedWalletIcon = _react.useMemo.call(void 0, () => {
|
|
1397
|
-
if (!ownerAddress) return _optionalChain([reownWallet, 'optionalAccess',
|
|
1410
|
+
if (!ownerAddress) return _optionalChain([reownWallet, 'optionalAccess', _40 => _40.icon]);
|
|
1398
1411
|
const selected = walletOptions.find(
|
|
1399
|
-
(o) => _optionalChain([o, 'access',
|
|
1412
|
+
(o) => _optionalChain([o, 'access', _41 => _41.address, 'optionalAccess', _42 => _42.toLowerCase, 'call', _43 => _43()]) === ownerAddress.toLowerCase()
|
|
1400
1413
|
);
|
|
1401
|
-
return _nullishCoalesce(_optionalChain([selected, 'optionalAccess',
|
|
1402
|
-
}, [walletOptions, ownerAddress, _optionalChain([reownWallet, 'optionalAccess',
|
|
1414
|
+
return _nullishCoalesce(_optionalChain([selected, 'optionalAccess', _44 => _44.icon]), () => ( _optionalChain([reownWallet, 'optionalAccess', _45 => _45.icon])));
|
|
1415
|
+
}, [walletOptions, ownerAddress, _optionalChain([reownWallet, 'optionalAccess', _46 => _46.icon])]);
|
|
1403
1416
|
if (showConnectStep) {
|
|
1404
1417
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1405
|
-
|
|
1418
|
+
_chunkMVFMDKAScjs.ConnectStep,
|
|
1406
1419
|
{
|
|
1407
1420
|
walletOptions,
|
|
1408
1421
|
selectedWalletId: selectedWalletIdEffective,
|
|
@@ -1423,9 +1436,9 @@ function WithdrawFlow({
|
|
|
1423
1436
|
if (!signerContext) return null;
|
|
1424
1437
|
if (!onSignTransaction && !signerContext.walletClient) return null;
|
|
1425
1438
|
const resolvedOwnerAddress = signerContext.ownerAddress;
|
|
1426
|
-
const resolvedConnectedAddress = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access',
|
|
1439
|
+
const resolvedConnectedAddress = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _47 => _47.walletClient, 'optionalAccess', _48 => _48.account, 'optionalAccess', _49 => _49.address]), () => ( _optionalChain([reownWallet, 'optionalAccess', _50 => _50.address]))), () => ( _optionalChain([dappWalletClient, 'optionalAccess', _51 => _51.account, 'optionalAccess', _52 => _52.address]))), () => ( resolvedOwnerAddress));
|
|
1427
1440
|
const resolvedDefaultRecipient = _nullishCoalesce(defaultRecipient, () => ( resolvedConnectedAddress));
|
|
1428
|
-
const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => (
|
|
1441
|
+
const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => ( _chunkMVFMDKAScjs.getPublicClient.call(void 0, sourceChain)));
|
|
1429
1442
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
1430
1443
|
step.type === "form" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1431
1444
|
WithdrawFormStep,
|
|
@@ -1452,7 +1465,7 @@ function WithdrawFlow({
|
|
|
1452
1465
|
}
|
|
1453
1466
|
),
|
|
1454
1467
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1455
|
-
|
|
1468
|
+
_chunkMVFMDKAScjs.ProcessingStep,
|
|
1456
1469
|
{
|
|
1457
1470
|
smartAccount: step.smartAccount,
|
|
1458
1471
|
txHash: step.txHash,
|
|
@@ -1478,7 +1491,7 @@ function WithdrawFlow({
|
|
|
1478
1491
|
// src/WithdrawModal.tsx
|
|
1479
1492
|
|
|
1480
1493
|
var ReownWithdrawInner = _react.lazy.call(void 0,
|
|
1481
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-
|
|
1494
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-K73XDERE.cjs"))).then((m) => ({
|
|
1482
1495
|
default: m.WithdrawModalReown
|
|
1483
1496
|
}))
|
|
1484
1497
|
);
|
|
@@ -1531,27 +1544,28 @@ function WithdrawModalInner({
|
|
|
1531
1544
|
debug
|
|
1532
1545
|
}) {
|
|
1533
1546
|
const modalRef = _react.useRef.call(void 0, null);
|
|
1547
|
+
const onReadyRef = _chunkMVFMDKAScjs.useLatestRef.call(void 0, onReady);
|
|
1534
1548
|
const [currentStepIndex, setCurrentStepIndex] = _react.useState.call(void 0, 0);
|
|
1535
1549
|
const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, null);
|
|
1536
1550
|
const backHandlerRef = _react.useRef.call(void 0, void 0);
|
|
1537
1551
|
const targetChain = _chunkR6U6BHCVcjs.getChainId.call(void 0, targetChainProp);
|
|
1538
1552
|
const sourceChain = _chunkR6U6BHCVcjs.getChainId.call(void 0, sourceChainProp);
|
|
1539
1553
|
const service = _react.useMemo.call(void 0,
|
|
1540
|
-
() =>
|
|
1554
|
+
() => _chunkMVFMDKAScjs.createDepositService.call(void 0, backendUrl, { debug, debugScope: "service:withdraw" }),
|
|
1541
1555
|
[backendUrl, debug]
|
|
1542
1556
|
);
|
|
1543
1557
|
_react.useEffect.call(void 0, () => {
|
|
1544
1558
|
if (isOpen && modalRef.current) {
|
|
1545
|
-
|
|
1559
|
+
_chunkMVFMDKAScjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
1546
1560
|
}
|
|
1547
1561
|
}, [isOpen, theme]);
|
|
1548
1562
|
const hasCalledReady = _react.useRef.call(void 0, false);
|
|
1549
1563
|
_react.useEffect.call(void 0, () => {
|
|
1550
1564
|
if (isOpen && !hasCalledReady.current) {
|
|
1551
1565
|
hasCalledReady.current = true;
|
|
1552
|
-
_optionalChain([
|
|
1566
|
+
_optionalChain([onReadyRef, 'access', _53 => _53.current, 'optionalCall', _54 => _54()]);
|
|
1553
1567
|
}
|
|
1554
|
-
}, [isOpen,
|
|
1568
|
+
}, [isOpen, onReadyRef]);
|
|
1555
1569
|
_react.useEffect.call(void 0, () => {
|
|
1556
1570
|
if (!isOpen) {
|
|
1557
1571
|
setCurrentStepIndex(0);
|
|
@@ -1568,17 +1582,17 @@ function WithdrawModalInner({
|
|
|
1568
1582
|
setTotalBalanceUsd(balance2);
|
|
1569
1583
|
}, []);
|
|
1570
1584
|
const handleBack = _react.useCallback.call(void 0, () => {
|
|
1571
|
-
_optionalChain([backHandlerRef, 'access',
|
|
1585
|
+
_optionalChain([backHandlerRef, 'access', _55 => _55.current, 'optionalCall', _56 => _56()]);
|
|
1572
1586
|
}, []);
|
|
1573
|
-
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
1574
|
-
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
1575
|
-
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
1576
|
-
const balance = _optionalChain([uiConfig, 'optionalAccess',
|
|
1577
|
-
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess',
|
|
1578
|
-
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess',
|
|
1587
|
+
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _57 => _57.showLogo]), () => ( false));
|
|
1588
|
+
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _58 => _58.showStepper]), () => ( false));
|
|
1589
|
+
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _59 => _59.showBackButton]), () => ( true));
|
|
1590
|
+
const balance = _optionalChain([uiConfig, 'optionalAccess', _60 => _60.balance]);
|
|
1591
|
+
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _61 => _61.logoUrl]), () => ( "https://github.com/rhinestonewtf.png"));
|
|
1592
|
+
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _62 => _62.title]), () => ( "Withdraw"));
|
|
1579
1593
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 3 && backHandlerRef.current;
|
|
1580
1594
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1581
|
-
|
|
1595
|
+
_chunkMVFMDKAScjs.Modal,
|
|
1582
1596
|
{
|
|
1583
1597
|
isOpen,
|
|
1584
1598
|
onClose,
|
|
@@ -1637,7 +1651,7 @@ function WithdrawModalInner({
|
|
|
1637
1651
|
] }),
|
|
1638
1652
|
balance && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header-balance", children: [
|
|
1639
1653
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-label", children: balance.title }),
|
|
1640
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ?
|
|
1654
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ? _chunkMVFMDKAScjs.currencyFormatter.format(totalBalanceUsd) : null))) })
|
|
1641
1655
|
] })
|
|
1642
1656
|
] }),
|
|
1643
1657
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -809,6 +809,16 @@ function formatUserError(raw) {
|
|
|
809
809
|
return cleaned;
|
|
810
810
|
}
|
|
811
811
|
|
|
812
|
+
// src/core/useLatestRef.ts
|
|
813
|
+
|
|
814
|
+
function useLatestRef(value) {
|
|
815
|
+
const ref = _react.useRef.call(void 0, value);
|
|
816
|
+
_react.useEffect.call(void 0, () => {
|
|
817
|
+
ref.current = value;
|
|
818
|
+
}, [value]);
|
|
819
|
+
return ref;
|
|
820
|
+
}
|
|
821
|
+
|
|
812
822
|
// src/core/theme.ts
|
|
813
823
|
var RADIUS_SCALE = {
|
|
814
824
|
none: { sm: "0", md: "0", lg: "0" },
|
|
@@ -2095,4 +2105,5 @@ function getPublicClient(chainId) {
|
|
|
2095
2105
|
|
|
2096
2106
|
|
|
2097
2107
|
|
|
2098
|
-
|
|
2108
|
+
|
|
2109
|
+
exports.Modal = Modal; exports.Spinner = Spinner; exports.Button = Button; exports.ConnectStep = ConnectStep; exports.debugLog = debugLog; exports.debugError = debugError; exports.toEvmCaip2 = toEvmCaip2; exports.buildSessionDetails = buildSessionDetails; exports.createDepositService = createDepositService; exports.getAssetId = getAssetId; exports.portfolioToAssets = portfolioToAssets; exports.isNativeAsset = isNativeAsset; exports.loadSessionOwnerFromStorage = loadSessionOwnerFromStorage; exports.saveSessionOwnerToStorage = saveSessionOwnerToStorage; exports.createSessionOwnerKey = createSessionOwnerKey; exports.accountFromPrivateKey = accountFromPrivateKey; exports.PoweredBy = PoweredBy; exports.currencyFormatter = currencyFormatter; exports.tokenFormatter = tokenFormatter; exports.formatUserError = formatUserError; exports.getEventTxHash = getEventTxHash; exports.isDepositEvent = isDepositEvent; exports.txRefsMatch = txRefsMatch; exports.ProcessingStep = ProcessingStep; exports.getPublicClient = getPublicClient; exports.useLatestRef = useLatestRef; exports.applyTheme = applyTheme;
|