@rhinestone/deposit-modal 0.1.68 → 0.1.69
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-WXFTSZSK.cjs → DepositModalReown-3GU5B776.cjs} +6 -6
- package/dist/{DepositModalReown-RYCOXWMH.mjs → DepositModalReown-WN2E3EQ3.mjs} +3 -3
- package/dist/{WithdrawModalReown-6VYKKKJN.mjs → WithdrawModalReown-6ZBCJOPK.mjs} +3 -3
- package/dist/{WithdrawModalReown-WHPQDJJJ.cjs → WithdrawModalReown-WIV5IEIW.cjs} +6 -6
- package/dist/{chunk-LTLFJPHO.cjs → chunk-2ATEEBQZ.cjs} +52 -47
- package/dist/{chunk-OEB25YZ4.mjs → chunk-3RV2B6JM.mjs} +6 -2
- package/dist/{chunk-MBURQ26S.mjs → chunk-5YXAQB6A.mjs} +10 -0
- package/dist/{chunk-J7ILKS5N.cjs → chunk-6W42ROAB.cjs} +105 -101
- package/dist/{chunk-IUW3SJQT.mjs → chunk-DA3XVDNQ.mjs} +84 -16
- package/dist/{chunk-5FDIQNJJ.mjs → chunk-P3CGKXXZ.mjs} +12 -7
- package/dist/{chunk-FLVSQDP4.cjs → chunk-TCILEYM5.cjs} +152 -84
- package/dist/{chunk-N2Y34LQO.cjs → chunk-YQFH2WSW.cjs} +11 -1
- package/dist/deposit.cjs +3 -3
- package/dist/deposit.mjs +2 -2
- package/dist/index.cjs +8 -4
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +7 -3
- package/dist/reown.cjs +8 -4
- package/dist/reown.d.cts +4 -0
- package/dist/reown.d.ts +4 -0
- package/dist/reown.mjs +8 -4
- package/dist/withdraw.cjs +3 -3
- package/dist/withdraw.mjs +2 -2
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
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
|
|
3
|
+
var _chunk6W42ROABcjs = require('./chunk-6W42ROAB.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
8
|
-
require('./chunk-
|
|
7
|
+
var _chunkYQFH2WSWcjs = require('./chunk-YQFH2WSW.cjs');
|
|
8
|
+
require('./chunk-TCILEYM5.cjs');
|
|
9
9
|
require('./chunk-MUWVDVY4.cjs');
|
|
10
10
|
|
|
11
11
|
// src/DepositModalReown.tsx
|
|
@@ -13,7 +13,7 @@ var _react = require('react');
|
|
|
13
13
|
var _react3 = require('@reown/appkit/react');
|
|
14
14
|
var _jsxruntime = require('react/jsx-runtime');
|
|
15
15
|
function DepositModalWithReown(props) {
|
|
16
|
-
const reown =
|
|
16
|
+
const reown = _chunkYQFH2WSWcjs.useReownWallet.call(void 0, );
|
|
17
17
|
const enableSolana = _nullishCoalesce(props.enableSolana, () => ( true));
|
|
18
18
|
const { walletProvider: solanaWalletProvider } = _react3.useAppKitProvider.call(void 0,
|
|
19
19
|
enableSolana ? "solana" : "eip155"
|
|
@@ -32,7 +32,7 @@ function DepositModalWithReown(props) {
|
|
|
32
32
|
reown.disconnect();
|
|
33
33
|
}, [reown.disconnect]);
|
|
34
34
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
35
|
-
|
|
35
|
+
_chunk6W42ROABcjs.DepositModalInner,
|
|
36
36
|
{
|
|
37
37
|
...props,
|
|
38
38
|
reownWallet: reownWithSolana,
|
|
@@ -43,7 +43,7 @@ function DepositModalWithReown(props) {
|
|
|
43
43
|
}
|
|
44
44
|
function DepositModalReown(props) {
|
|
45
45
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
46
|
-
|
|
46
|
+
_chunkYQFH2WSWcjs.ReownWalletProvider,
|
|
47
47
|
{
|
|
48
48
|
projectId: props.reownAppId,
|
|
49
49
|
theme: props.theme,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DepositModalInner
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3RV2B6JM.mjs";
|
|
4
4
|
import {
|
|
5
5
|
ReownWalletProvider,
|
|
6
6
|
useReownWallet
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-5YXAQB6A.mjs";
|
|
8
|
+
import "./chunk-DA3XVDNQ.mjs";
|
|
9
9
|
import "./chunk-SDZKKUCJ.mjs";
|
|
10
10
|
|
|
11
11
|
// src/DepositModalReown.tsx
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WithdrawModalInner
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-P3CGKXXZ.mjs";
|
|
4
4
|
import {
|
|
5
5
|
ReownWalletProvider,
|
|
6
6
|
useReownWallet
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-5YXAQB6A.mjs";
|
|
8
|
+
import "./chunk-DA3XVDNQ.mjs";
|
|
9
9
|
import "./chunk-SDZKKUCJ.mjs";
|
|
10
10
|
|
|
11
11
|
// src/WithdrawModalReown.tsx
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk2ATEEBQZcjs = require('./chunk-2ATEEBQZ.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
8
|
-
require('./chunk-
|
|
7
|
+
var _chunkYQFH2WSWcjs = require('./chunk-YQFH2WSW.cjs');
|
|
8
|
+
require('./chunk-TCILEYM5.cjs');
|
|
9
9
|
require('./chunk-MUWVDVY4.cjs');
|
|
10
10
|
|
|
11
11
|
// src/WithdrawModalReown.tsx
|
|
12
12
|
var _react = require('react');
|
|
13
13
|
var _jsxruntime = require('react/jsx-runtime');
|
|
14
14
|
function WithdrawModalWithReown(props) {
|
|
15
|
-
const reown =
|
|
15
|
+
const reown = _chunkYQFH2WSWcjs.useReownWallet.call(void 0, );
|
|
16
16
|
const handleConnect = _react.useCallback.call(void 0, () => {
|
|
17
17
|
reown.openConnect();
|
|
18
18
|
}, [reown.openConnect]);
|
|
@@ -20,7 +20,7 @@ function WithdrawModalWithReown(props) {
|
|
|
20
20
|
reown.disconnect();
|
|
21
21
|
}, [reown.disconnect]);
|
|
22
22
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
23
|
-
|
|
23
|
+
_chunk2ATEEBQZcjs.WithdrawModalInner,
|
|
24
24
|
{
|
|
25
25
|
...props,
|
|
26
26
|
reownWallet: reown,
|
|
@@ -30,7 +30,7 @@ function WithdrawModalWithReown(props) {
|
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
function WithdrawModalReown(props) {
|
|
33
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
33
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYQFH2WSWcjs.ReownWalletProvider, { projectId: props.reownAppId, theme: props.theme, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WithdrawModalWithReown, { ...props }) });
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _chunkTCILEYM5cjs = require('./chunk-TCILEYM5.cjs');
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
@@ -127,7 +127,7 @@ function WithdrawFormStep({
|
|
|
127
127
|
setIsSwitching(true);
|
|
128
128
|
switchChain(asset.chainId).catch((err) => {
|
|
129
129
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
130
|
-
setError(
|
|
130
|
+
setError(_chunkTCILEYM5cjs.formatUserError.call(void 0, raw));
|
|
131
131
|
}).finally(() => {
|
|
132
132
|
setIsSwitching(false);
|
|
133
133
|
});
|
|
@@ -147,7 +147,7 @@ function WithdrawFormStep({
|
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
149
149
|
try {
|
|
150
|
-
const bal =
|
|
150
|
+
const bal = _chunkTCILEYM5cjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: safeAddress }) : await publicClient.readContract({
|
|
151
151
|
address: asset.token,
|
|
152
152
|
abi: _viem.erc20Abi,
|
|
153
153
|
functionName: "balanceOf",
|
|
@@ -250,7 +250,7 @@ function WithdrawFormStep({
|
|
|
250
250
|
await onSubmit(recipient, amount);
|
|
251
251
|
} catch (err) {
|
|
252
252
|
const raw = err instanceof Error ? err.message : "Withdrawal failed";
|
|
253
|
-
setError(
|
|
253
|
+
setError(_chunkTCILEYM5cjs.formatUserError.call(void 0, raw));
|
|
254
254
|
} finally {
|
|
255
255
|
setIsSubmitting(false);
|
|
256
256
|
}
|
|
@@ -258,11 +258,11 @@ function WithdrawFormStep({
|
|
|
258
258
|
if (isBalanceLoading) {
|
|
259
259
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
260
260
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body rs-withdraw-loading", children: [
|
|
261
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
261
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTCILEYM5cjs.Spinner, { className: "rs-spinner--lg" }),
|
|
262
262
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-loading-title", children: "Loading on-chain balance" }),
|
|
263
263
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-loading-subtitle", children: chainMismatch ? `Switch to ${_chunkMUWVDVY4cjs.getChainName.call(void 0, asset.chainId)} to continue.` : "Please wait before withdrawing." })
|
|
264
264
|
] }),
|
|
265
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
265
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTCILEYM5cjs.PoweredBy, {})
|
|
266
266
|
] });
|
|
267
267
|
}
|
|
268
268
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
@@ -361,7 +361,7 @@ function WithdrawFormStep({
|
|
|
361
361
|
] })
|
|
362
362
|
] }),
|
|
363
363
|
/* @__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 ?
|
|
364
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ? _chunkTCILEYM5cjs.currencyFormatter.format(amountUsd) : "$0.00" }),
|
|
365
365
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-withdraw-balance", children: [
|
|
366
366
|
"Balance: ",
|
|
367
367
|
formattedBalance,
|
|
@@ -555,7 +555,7 @@ function WithdrawFormStep({
|
|
|
555
555
|
] })
|
|
556
556
|
] }),
|
|
557
557
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
558
|
-
|
|
558
|
+
_chunkTCILEYM5cjs.Button,
|
|
559
559
|
{
|
|
560
560
|
onClick: handleWithdraw,
|
|
561
561
|
fullWidth: true,
|
|
@@ -564,7 +564,7 @@ function WithdrawFormStep({
|
|
|
564
564
|
children: isBusy ? "Preparing..." : !recipient ? "Enter Recipient Address" : !amount ? "Enter Withdraw Amount" : "Withdraw"
|
|
565
565
|
}
|
|
566
566
|
) }),
|
|
567
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
567
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTCILEYM5cjs.PoweredBy, {})
|
|
568
568
|
] });
|
|
569
569
|
}
|
|
570
570
|
WithdrawFormStep.displayName = "WithdrawFormStep";
|
|
@@ -891,27 +891,27 @@ function WithdrawFlow({
|
|
|
891
891
|
onError,
|
|
892
892
|
debug
|
|
893
893
|
}) {
|
|
894
|
-
const onStepChangeRef =
|
|
895
|
-
const onTotalBalanceChangeRef =
|
|
896
|
-
const onEventRef =
|
|
897
|
-
const onConnectedRef =
|
|
898
|
-
const onWithdrawSubmittedRef =
|
|
899
|
-
const onWithdrawCompleteRef =
|
|
900
|
-
const onWithdrawFailedRef =
|
|
901
|
-
const onErrorRef =
|
|
894
|
+
const onStepChangeRef = _chunkTCILEYM5cjs.useLatestRef.call(void 0, onStepChange);
|
|
895
|
+
const onTotalBalanceChangeRef = _chunkTCILEYM5cjs.useLatestRef.call(void 0, onTotalBalanceChange);
|
|
896
|
+
const onEventRef = _chunkTCILEYM5cjs.useLatestRef.call(void 0, onEvent);
|
|
897
|
+
const onConnectedRef = _chunkTCILEYM5cjs.useLatestRef.call(void 0, onConnected);
|
|
898
|
+
const onWithdrawSubmittedRef = _chunkTCILEYM5cjs.useLatestRef.call(void 0, onWithdrawSubmitted);
|
|
899
|
+
const onWithdrawCompleteRef = _chunkTCILEYM5cjs.useLatestRef.call(void 0, onWithdrawComplete);
|
|
900
|
+
const onWithdrawFailedRef = _chunkTCILEYM5cjs.useLatestRef.call(void 0, onWithdrawFailed);
|
|
901
|
+
const onErrorRef = _chunkTCILEYM5cjs.useLatestRef.call(void 0, onError);
|
|
902
902
|
const [step, setStep] = _react.useState.call(void 0, { type: "form" });
|
|
903
903
|
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
904
904
|
const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, 0);
|
|
905
905
|
const [isConnectSelectionConfirmed, setIsConnectSelectionConfirmed] = _react.useState.call(void 0, false);
|
|
906
906
|
const logFlow = _react.useCallback.call(void 0,
|
|
907
907
|
(message, data) => {
|
|
908
|
-
|
|
908
|
+
_chunkTCILEYM5cjs.debugLog.call(void 0, debug, "withdraw-flow", message, data);
|
|
909
909
|
},
|
|
910
910
|
[debug]
|
|
911
911
|
);
|
|
912
912
|
const logFlowError = _react.useCallback.call(void 0,
|
|
913
913
|
(message, error, data) => {
|
|
914
|
-
|
|
914
|
+
_chunkTCILEYM5cjs.debugError.call(void 0, debug, "withdraw-flow", message, error, data);
|
|
915
915
|
},
|
|
916
916
|
[debug]
|
|
917
917
|
);
|
|
@@ -970,14 +970,14 @@ function WithdrawFlow({
|
|
|
970
970
|
return {
|
|
971
971
|
ownerAddress: dappAddress,
|
|
972
972
|
walletClient: _nullishCoalesce(dappWalletClient, () => ( void 0)),
|
|
973
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
973
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkTCILEYM5cjs.getPublicClient.call(void 0, sourceChain))),
|
|
974
974
|
switchChain: dappSwitchChain
|
|
975
975
|
};
|
|
976
976
|
}
|
|
977
977
|
return {
|
|
978
978
|
ownerAddress: dappWalletClient.account.address,
|
|
979
979
|
walletClient: dappWalletClient,
|
|
980
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
980
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkTCILEYM5cjs.getPublicClient.call(void 0, sourceChain))),
|
|
981
981
|
switchChain: dappSwitchChain
|
|
982
982
|
};
|
|
983
983
|
}
|
|
@@ -988,7 +988,7 @@ function WithdrawFlow({
|
|
|
988
988
|
return {
|
|
989
989
|
ownerAddress: dappWalletClient.account.address,
|
|
990
990
|
walletClient: dappWalletClient,
|
|
991
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
991
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkTCILEYM5cjs.getPublicClient.call(void 0, sourceChain))),
|
|
992
992
|
switchChain: dappSwitchChain
|
|
993
993
|
};
|
|
994
994
|
}
|
|
@@ -1018,7 +1018,7 @@ function WithdrawFlow({
|
|
|
1018
1018
|
const symbol = _chunkMUWVDVY4cjs.getTokenSymbol.call(void 0, sourceToken, sourceChain);
|
|
1019
1019
|
const decimals = _chunkMUWVDVY4cjs.getTokenDecimalsByAddress.call(void 0, sourceToken, sourceChain);
|
|
1020
1020
|
return {
|
|
1021
|
-
id:
|
|
1021
|
+
id: _chunkTCILEYM5cjs.getAssetId.call(void 0, { chainId: sourceChain, token: sourceToken }),
|
|
1022
1022
|
chainId: sourceChain,
|
|
1023
1023
|
token: sourceToken,
|
|
1024
1024
|
symbol,
|
|
@@ -1027,6 +1027,7 @@ function WithdrawFlow({
|
|
|
1027
1027
|
};
|
|
1028
1028
|
}, [sourceChain, sourceToken]);
|
|
1029
1029
|
const isSourceNative = sourceToken.toLowerCase() === _chunkMUWVDVY4cjs.NATIVE_TOKEN_ADDRESS.toLowerCase();
|
|
1030
|
+
const isSameRoute = targetChain === sourceChain && targetToken.toLowerCase() === sourceToken.toLowerCase();
|
|
1030
1031
|
const stepIndex = step.type === "form" ? 0 : 1;
|
|
1031
1032
|
const currentBackHandler = void 0;
|
|
1032
1033
|
_react.useEffect.call(void 0, () => {
|
|
@@ -1089,15 +1090,15 @@ function WithdrawFlow({
|
|
|
1089
1090
|
[logFlowError, onErrorRef]
|
|
1090
1091
|
);
|
|
1091
1092
|
const resolveSessionOwner = _react.useCallback.call(void 0, async (eoaAddress) => {
|
|
1092
|
-
const localOwner =
|
|
1093
|
+
const localOwner = _chunkTCILEYM5cjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
|
|
1093
1094
|
if (localOwner) {
|
|
1094
1095
|
return {
|
|
1095
|
-
account:
|
|
1096
|
+
account: _chunkTCILEYM5cjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
|
|
1096
1097
|
address: localOwner.address
|
|
1097
1098
|
};
|
|
1098
1099
|
}
|
|
1099
|
-
const created =
|
|
1100
|
-
|
|
1100
|
+
const created = _chunkTCILEYM5cjs.createSessionOwnerKey.call(void 0, );
|
|
1101
|
+
_chunkTCILEYM5cjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
|
|
1101
1102
|
return {
|
|
1102
1103
|
account: created.account,
|
|
1103
1104
|
address: created.address
|
|
@@ -1137,7 +1138,7 @@ function WithdrawFlow({
|
|
|
1137
1138
|
const setup = await service.setupAccount({
|
|
1138
1139
|
ownerAddress: ownerAddress2,
|
|
1139
1140
|
sessionOwnerAddress: sessionOwner.address,
|
|
1140
|
-
targetChain:
|
|
1141
|
+
targetChain: _chunkTCILEYM5cjs.toEvmCaip2.call(void 0, targetChain),
|
|
1141
1142
|
targetToken,
|
|
1142
1143
|
recipient,
|
|
1143
1144
|
signerAddress,
|
|
@@ -1165,7 +1166,7 @@ function WithdrawFlow({
|
|
|
1165
1166
|
primaryType: typedData.primaryType,
|
|
1166
1167
|
message: typedData.message
|
|
1167
1168
|
});
|
|
1168
|
-
const sessionDetails =
|
|
1169
|
+
const sessionDetails = _chunkTCILEYM5cjs.buildSessionDetails.call(void 0,
|
|
1169
1170
|
setup.sessionDetailsUnsigned,
|
|
1170
1171
|
signature
|
|
1171
1172
|
);
|
|
@@ -1179,7 +1180,7 @@ function WithdrawFlow({
|
|
|
1179
1180
|
eoaAddress: ownerAddress2,
|
|
1180
1181
|
sessionOwner: sessionOwner.address,
|
|
1181
1182
|
target: {
|
|
1182
|
-
chain:
|
|
1183
|
+
chain: _chunkTCILEYM5cjs.toEvmCaip2.call(void 0, targetChain),
|
|
1183
1184
|
token: targetToken,
|
|
1184
1185
|
recipient
|
|
1185
1186
|
}
|
|
@@ -1188,16 +1189,17 @@ function WithdrawFlow({
|
|
|
1188
1189
|
}
|
|
1189
1190
|
handleConnected(ownerAddress2, smartAccount);
|
|
1190
1191
|
const amountUnits = _viem.parseUnits.call(void 0, amountValue, asset.decimals);
|
|
1191
|
-
const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _34 => _34.publicClient]), () => (
|
|
1192
|
+
const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _34 => _34.publicClient]), () => ( _chunkTCILEYM5cjs.getPublicClient.call(void 0, sourceChain)));
|
|
1192
1193
|
let result;
|
|
1193
1194
|
if (onSignTransaction) {
|
|
1194
|
-
const
|
|
1195
|
+
const transferTarget = isSameRoute ? recipient : smartAccount;
|
|
1196
|
+
const transferData = isSourceNative ? { to: transferTarget, value: amountUnits, data: "0x" } : {
|
|
1195
1197
|
to: sourceToken,
|
|
1196
1198
|
value: 0n,
|
|
1197
1199
|
data: _viem.encodeFunctionData.call(void 0, {
|
|
1198
1200
|
abi: _viem.erc20Abi,
|
|
1199
1201
|
functionName: "transfer",
|
|
1200
|
-
args: [
|
|
1202
|
+
args: [transferTarget, amountUnits]
|
|
1201
1203
|
})
|
|
1202
1204
|
};
|
|
1203
1205
|
const request = await buildSafeTransaction({
|
|
@@ -1211,7 +1213,7 @@ function WithdrawFlow({
|
|
|
1211
1213
|
const { signature } = await onSignTransaction(request);
|
|
1212
1214
|
const relayResult = await service.relayWithdraw({
|
|
1213
1215
|
smartAccount,
|
|
1214
|
-
chainId:
|
|
1216
|
+
chainId: _chunkTCILEYM5cjs.toEvmCaip2.call(void 0, sourceChain),
|
|
1215
1217
|
safeAddress,
|
|
1216
1218
|
safeTransaction: request.typedData.message,
|
|
1217
1219
|
signature
|
|
@@ -1225,7 +1227,7 @@ function WithdrawFlow({
|
|
|
1225
1227
|
walletClient: signerContext.walletClient,
|
|
1226
1228
|
publicClient: pc,
|
|
1227
1229
|
safeAddress,
|
|
1228
|
-
recipient: smartAccount,
|
|
1230
|
+
recipient: isSameRoute ? recipient : smartAccount,
|
|
1229
1231
|
amount: amountUnits,
|
|
1230
1232
|
chainId: sourceChain
|
|
1231
1233
|
});
|
|
@@ -1235,7 +1237,7 @@ function WithdrawFlow({
|
|
|
1235
1237
|
publicClient: pc,
|
|
1236
1238
|
safeAddress,
|
|
1237
1239
|
tokenAddress: sourceToken,
|
|
1238
|
-
recipient: smartAccount,
|
|
1240
|
+
recipient: isSameRoute ? recipient : smartAccount,
|
|
1239
1241
|
amount: amountUnits,
|
|
1240
1242
|
chainId: sourceChain
|
|
1241
1243
|
});
|
|
@@ -1259,7 +1261,8 @@ function WithdrawFlow({
|
|
|
1259
1261
|
txHash: result.txHash,
|
|
1260
1262
|
sourceChain,
|
|
1261
1263
|
sourceToken,
|
|
1262
|
-
amount: amountUnits.toString()
|
|
1264
|
+
amount: amountUnits.toString(),
|
|
1265
|
+
directTransfer: isSameRoute
|
|
1263
1266
|
});
|
|
1264
1267
|
} catch (err) {
|
|
1265
1268
|
const raw = err instanceof Error ? err.message : "Withdraw failed";
|
|
@@ -1269,7 +1272,7 @@ function WithdrawFlow({
|
|
|
1269
1272
|
targetChain,
|
|
1270
1273
|
targetToken
|
|
1271
1274
|
});
|
|
1272
|
-
handleError(
|
|
1275
|
+
handleError(_chunkTCILEYM5cjs.formatUserError.call(void 0, raw), "WITHDRAW_FLOW_ERROR");
|
|
1273
1276
|
throw err;
|
|
1274
1277
|
} finally {
|
|
1275
1278
|
setIsSubmitting(false);
|
|
@@ -1291,6 +1294,7 @@ function WithdrawFlow({
|
|
|
1291
1294
|
sourceChain,
|
|
1292
1295
|
onSignTransaction,
|
|
1293
1296
|
isSourceNative,
|
|
1297
|
+
isSameRoute,
|
|
1294
1298
|
handleError,
|
|
1295
1299
|
logFlow,
|
|
1296
1300
|
logFlowError,
|
|
@@ -1407,7 +1411,7 @@ function WithdrawFlow({
|
|
|
1407
1411
|
}, [walletOptions, ownerAddress, _optionalChain([reownWallet, 'optionalAccess', _51 => _51.icon])]);
|
|
1408
1412
|
if (showConnectStep) {
|
|
1409
1413
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1410
|
-
|
|
1414
|
+
_chunkTCILEYM5cjs.ConnectStep,
|
|
1411
1415
|
{
|
|
1412
1416
|
walletOptions,
|
|
1413
1417
|
selectedWalletId: selectedWalletIdEffective,
|
|
@@ -1428,7 +1432,7 @@ function WithdrawFlow({
|
|
|
1428
1432
|
if (!signerContext) return null;
|
|
1429
1433
|
if (!onSignTransaction && !signerContext.walletClient) return null;
|
|
1430
1434
|
const resolvedConnectedRecipient = _optionalChain([selectedWalletOption, 'optionalAccess', _52 => _52.kind]) === "external" ? selectedWalletOption.address : void 0;
|
|
1431
|
-
const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => (
|
|
1435
|
+
const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => ( _chunkTCILEYM5cjs.getPublicClient.call(void 0, sourceChain)));
|
|
1432
1436
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
1433
1437
|
step.type === "form" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1434
1438
|
WithdrawFormStep,
|
|
@@ -1454,7 +1458,7 @@ function WithdrawFlow({
|
|
|
1454
1458
|
}
|
|
1455
1459
|
),
|
|
1456
1460
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1457
|
-
|
|
1461
|
+
_chunkTCILEYM5cjs.ProcessingStep,
|
|
1458
1462
|
{
|
|
1459
1463
|
smartAccount: step.smartAccount,
|
|
1460
1464
|
txHash: step.txHash,
|
|
@@ -1463,6 +1467,7 @@ function WithdrawFlow({
|
|
|
1463
1467
|
targetChain,
|
|
1464
1468
|
targetToken,
|
|
1465
1469
|
amount: step.amount,
|
|
1470
|
+
directTransfer: step.directTransfer,
|
|
1466
1471
|
waitForFinalTx,
|
|
1467
1472
|
service,
|
|
1468
1473
|
flowLabel: "withdraw",
|
|
@@ -1480,7 +1485,7 @@ function WithdrawFlow({
|
|
|
1480
1485
|
// src/WithdrawModal.tsx
|
|
1481
1486
|
|
|
1482
1487
|
var ReownWithdrawInner = _react.lazy.call(void 0,
|
|
1483
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-
|
|
1488
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-WIV5IEIW.cjs"))).then((m) => ({
|
|
1484
1489
|
default: m.WithdrawModalReown
|
|
1485
1490
|
}))
|
|
1486
1491
|
);
|
|
@@ -1533,19 +1538,19 @@ function WithdrawModalInner({
|
|
|
1533
1538
|
debug
|
|
1534
1539
|
}) {
|
|
1535
1540
|
const modalRef = _react.useRef.call(void 0, null);
|
|
1536
|
-
const onReadyRef =
|
|
1541
|
+
const onReadyRef = _chunkTCILEYM5cjs.useLatestRef.call(void 0, onReady);
|
|
1537
1542
|
const [currentStepIndex, setCurrentStepIndex] = _react.useState.call(void 0, 0);
|
|
1538
1543
|
const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, null);
|
|
1539
1544
|
const backHandlerRef = _react.useRef.call(void 0, void 0);
|
|
1540
1545
|
const targetChain = _chunkMUWVDVY4cjs.getChainId.call(void 0, targetChainProp);
|
|
1541
1546
|
const sourceChain = _chunkMUWVDVY4cjs.getChainId.call(void 0, sourceChainProp);
|
|
1542
1547
|
const service = _react.useMemo.call(void 0,
|
|
1543
|
-
() =>
|
|
1548
|
+
() => _chunkTCILEYM5cjs.createDepositService.call(void 0, backendUrl, { debug, debugScope: "service:withdraw" }),
|
|
1544
1549
|
[backendUrl, debug]
|
|
1545
1550
|
);
|
|
1546
1551
|
_react.useEffect.call(void 0, () => {
|
|
1547
1552
|
if (isOpen && modalRef.current) {
|
|
1548
|
-
|
|
1553
|
+
_chunkTCILEYM5cjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
1549
1554
|
}
|
|
1550
1555
|
}, [isOpen, theme]);
|
|
1551
1556
|
_react.useEffect.call(void 0, () => {
|
|
@@ -1579,7 +1584,7 @@ function WithdrawModalInner({
|
|
|
1579
1584
|
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _62 => _62.title]), () => ( "Withdraw"));
|
|
1580
1585
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 3 && backHandlerRef.current;
|
|
1581
1586
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1582
|
-
|
|
1587
|
+
_chunkTCILEYM5cjs.Modal,
|
|
1583
1588
|
{
|
|
1584
1589
|
isOpen,
|
|
1585
1590
|
onClose,
|
|
@@ -1638,7 +1643,7 @@ function WithdrawModalInner({
|
|
|
1638
1643
|
] }),
|
|
1639
1644
|
balance && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header-balance", children: [
|
|
1640
1645
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-label", children: balance.title }),
|
|
1641
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ?
|
|
1646
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ? _chunkTCILEYM5cjs.currencyFormatter.format(totalBalanceUsd) : null))) })
|
|
1642
1647
|
] })
|
|
1643
1648
|
] }),
|
|
1644
1649
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
tokenFormatter,
|
|
29
29
|
txRefsMatch,
|
|
30
30
|
useLatestRef
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-DA3XVDNQ.mjs";
|
|
32
32
|
import {
|
|
33
33
|
DEFAULT_BACKEND_URL,
|
|
34
34
|
DEFAULT_SIGNER_ADDRESS,
|
|
@@ -119,6 +119,8 @@ function SetupStep({
|
|
|
119
119
|
targetToken,
|
|
120
120
|
recipient,
|
|
121
121
|
postBridgeActions,
|
|
122
|
+
outputTokenRules,
|
|
123
|
+
rejectUnmapped,
|
|
122
124
|
signerAddress,
|
|
123
125
|
sessionChainIds,
|
|
124
126
|
forceRegister
|
|
@@ -187,6 +189,8 @@ function SetupStep({
|
|
|
187
189
|
sessionChainIds,
|
|
188
190
|
recipient,
|
|
189
191
|
postBridgeActions,
|
|
192
|
+
outputTokenRules,
|
|
193
|
+
rejectUnmapped,
|
|
190
194
|
forceRegister,
|
|
191
195
|
enableSolana,
|
|
192
196
|
service,
|
|
@@ -4526,7 +4530,7 @@ DepositHistoryPanel.displayName = "DepositHistoryPanel";
|
|
|
4526
4530
|
// src/DepositModal.tsx
|
|
4527
4531
|
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4528
4532
|
var ReownDepositInner = lazy(
|
|
4529
|
-
() => import("./DepositModalReown-
|
|
4533
|
+
() => import("./DepositModalReown-WN2E3EQ3.mjs").then((m) => ({ default: m.DepositModalReown }))
|
|
4530
4534
|
);
|
|
4531
4535
|
function DepositModal(props) {
|
|
4532
4536
|
const needsReown = !!props.reownAppId;
|
|
@@ -78,6 +78,15 @@ function ReownWalletProvider({
|
|
|
78
78
|
const config = adapter.wagmiConfig;
|
|
79
79
|
return /* @__PURE__ */ jsx(WagmiProvider, { config, children: /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children }) });
|
|
80
80
|
}
|
|
81
|
+
async function disconnectWallet() {
|
|
82
|
+
if (!modal) {
|
|
83
|
+
console.warn(
|
|
84
|
+
"[rhinestone] disconnectWallet called before the modal provider mounted; no-op."
|
|
85
|
+
);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
await modal.disconnect();
|
|
89
|
+
}
|
|
81
90
|
function useReownWallet() {
|
|
82
91
|
const { open } = useAppKit();
|
|
83
92
|
const { address, isConnected, caipAddress } = useAppKitAccount();
|
|
@@ -118,5 +127,6 @@ function useReownWallet() {
|
|
|
118
127
|
|
|
119
128
|
export {
|
|
120
129
|
ReownWalletProvider,
|
|
130
|
+
disconnectWallet,
|
|
121
131
|
useReownWallet
|
|
122
132
|
};
|