@rhinestone/deposit-modal 0.1.36 → 0.1.38
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-25YB4LPZ.mjs → DepositModalReown-BJWM3JMC.mjs} +3 -3
- package/dist/{DepositModalReown-TLKQ7Y4X.cjs → DepositModalReown-M6GRPFJW.cjs} +4 -4
- package/dist/{WithdrawModalReown-BYOEPR3E.cjs → WithdrawModalReown-OGPBUDZU.cjs} +4 -4
- package/dist/{WithdrawModalReown-4AKKZCLY.mjs → WithdrawModalReown-OIG2DANP.mjs} +3 -3
- package/dist/{chunk-YCXVHPGZ.cjs → chunk-4ZOF4A2N.cjs} +160 -140
- package/dist/{chunk-DL5M5QZZ.mjs → chunk-7HJ7TUHX.mjs} +27 -7
- package/dist/{chunk-N2SJUU4I.cjs → chunk-G4EYX7SO.cjs} +75 -59
- package/dist/{chunk-S4UBVD3H.cjs → chunk-HYUITBRV.cjs} +23 -7
- package/dist/{chunk-YIHOACM3.cjs → chunk-NULE6WII.cjs} +26 -26
- package/dist/{chunk-G6YFXESU.mjs → chunk-P7B7B6LU.mjs} +26 -10
- package/dist/{chunk-DLFUXLAM.mjs → chunk-UBPIPY3L.mjs} +1 -1
- package/dist/{chunk-C6I5TFSL.mjs → chunk-ZL4KPLWE.mjs} +23 -7
- package/dist/constants.cjs +2 -2
- package/dist/constants.mjs +1 -1
- package/dist/deposit.cjs +4 -4
- package/dist/deposit.mjs +3 -3
- package/dist/index.cjs +5 -5
- package/dist/index.mjs +4 -4
- package/dist/reown.cjs +5 -5
- package/dist/reown.mjs +4 -4
- package/dist/styles.css +24 -0
- package/dist/withdraw.cjs +4 -4
- package/dist/withdraw.mjs +3 -3
- package/package.json +1 -1
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
portfolioToAssets,
|
|
22
22
|
saveSessionOwnerToStorage,
|
|
23
23
|
tokenFormatter
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-UBPIPY3L.mjs";
|
|
25
25
|
import {
|
|
26
26
|
DEFAULT_BACKEND_URL,
|
|
27
27
|
DEFAULT_SIGNER_ADDRESS,
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
getTokenIcon,
|
|
38
38
|
getTokenSymbol,
|
|
39
39
|
isStablecoinSymbol
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-ZL4KPLWE.mjs";
|
|
41
41
|
|
|
42
42
|
// src/DepositModal.tsx
|
|
43
43
|
import {
|
|
@@ -1301,6 +1301,8 @@ function DepositAddressStep({
|
|
|
1301
1301
|
const [pollingError, setPollingError] = useState6(null);
|
|
1302
1302
|
const [chainDropdownOpen, setChainDropdownOpen] = useState6(false);
|
|
1303
1303
|
const [tokenDropdownOpen, setTokenDropdownOpen] = useState6(false);
|
|
1304
|
+
const chainDropdownRef = useRef4(null);
|
|
1305
|
+
const tokenDropdownRef = useRef4(null);
|
|
1304
1306
|
const depositHandledRef = useRef4(false);
|
|
1305
1307
|
const sourceSelectionRef = useRef4({
|
|
1306
1308
|
chainId: defaultChainId,
|
|
@@ -1312,6 +1314,24 @@ function DepositAddressStep({
|
|
|
1312
1314
|
tokenSymbol: sourceTokenSymbol
|
|
1313
1315
|
};
|
|
1314
1316
|
}, [sourceChainId, sourceTokenSymbol]);
|
|
1317
|
+
useEffect6(() => {
|
|
1318
|
+
if (!chainDropdownOpen && !tokenDropdownOpen) return;
|
|
1319
|
+
function handlePointerDown(event) {
|
|
1320
|
+
const target = event.target;
|
|
1321
|
+
if (!target) return;
|
|
1322
|
+
const clickedChainDropdown = chainDropdownRef.current?.contains(target);
|
|
1323
|
+
const clickedTokenDropdown = tokenDropdownRef.current?.contains(target);
|
|
1324
|
+
if (clickedChainDropdown || clickedTokenDropdown) return;
|
|
1325
|
+
setChainDropdownOpen(false);
|
|
1326
|
+
setTokenDropdownOpen(false);
|
|
1327
|
+
}
|
|
1328
|
+
document.addEventListener("mousedown", handlePointerDown);
|
|
1329
|
+
document.addEventListener("touchstart", handlePointerDown);
|
|
1330
|
+
return () => {
|
|
1331
|
+
document.removeEventListener("mousedown", handlePointerDown);
|
|
1332
|
+
document.removeEventListener("touchstart", handlePointerDown);
|
|
1333
|
+
};
|
|
1334
|
+
}, [chainDropdownOpen, tokenDropdownOpen]);
|
|
1315
1335
|
const handleCopy = useCallback2(async () => {
|
|
1316
1336
|
try {
|
|
1317
1337
|
await navigator.clipboard.writeText(smartAccount);
|
|
@@ -1379,8 +1399,8 @@ function DepositAddressStep({
|
|
|
1379
1399
|
return /* @__PURE__ */ jsxs6("div", { className: "rs-step", children: [
|
|
1380
1400
|
/* @__PURE__ */ jsx6("div", { className: "rs-step-body", children: /* @__PURE__ */ jsxs6("div", { className: "rs-deposit-address", children: [
|
|
1381
1401
|
/* @__PURE__ */ jsxs6("div", { className: "rs-deposit-address-selectors", children: [
|
|
1382
|
-
/* @__PURE__ */ jsxs6("div", { className: "rs-deposit-address-dropdown", children: [
|
|
1383
|
-
/* @__PURE__ */ jsx6("div", { className: "rs-deposit-address-dropdown-label", children: "
|
|
1402
|
+
/* @__PURE__ */ jsxs6("div", { className: "rs-deposit-address-dropdown", ref: tokenDropdownRef, children: [
|
|
1403
|
+
/* @__PURE__ */ jsx6("div", { className: "rs-deposit-address-dropdown-label", children: "Supported token" }),
|
|
1384
1404
|
/* @__PURE__ */ jsxs6(
|
|
1385
1405
|
"button",
|
|
1386
1406
|
{
|
|
@@ -1445,8 +1465,8 @@ function DepositAddressStep({
|
|
|
1445
1465
|
symbol
|
|
1446
1466
|
)) })
|
|
1447
1467
|
] }),
|
|
1448
|
-
/* @__PURE__ */ jsxs6("div", { className: "rs-deposit-address-dropdown", children: [
|
|
1449
|
-
/* @__PURE__ */ jsx6("div", { className: "rs-deposit-address-dropdown-label", children: "
|
|
1468
|
+
/* @__PURE__ */ jsxs6("div", { className: "rs-deposit-address-dropdown", ref: chainDropdownRef, children: [
|
|
1469
|
+
/* @__PURE__ */ jsx6("div", { className: "rs-deposit-address-dropdown-label", children: "Supported chain" }),
|
|
1450
1470
|
/* @__PURE__ */ jsxs6(
|
|
1451
1471
|
"button",
|
|
1452
1472
|
{
|
|
@@ -2099,7 +2119,7 @@ function DepositFlow({
|
|
|
2099
2119
|
// src/DepositModal.tsx
|
|
2100
2120
|
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2101
2121
|
var ReownDepositInner = lazy(
|
|
2102
|
-
() => import("./DepositModalReown-
|
|
2122
|
+
() => import("./DepositModalReown-BJWM3JMC.mjs").then((m) => ({ default: m.DepositModalReown }))
|
|
2103
2123
|
);
|
|
2104
2124
|
function DepositModal(props) {
|
|
2105
2125
|
const needsReown = !!props.reownAppId;
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var _chunkYIHOACM3cjs = require('./chunk-YIHOACM3.cjs');
|
|
20
19
|
|
|
20
|
+
var _chunkNULE6WIIcjs = require('./chunk-NULE6WII.cjs');
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
@@ -29,7 +29,8 @@ var _chunkYIHOACM3cjs = require('./chunk-YIHOACM3.cjs');
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
|
|
33
|
+
var _chunkHYUITBRVcjs = require('./chunk-HYUITBRV.cjs');
|
|
33
34
|
|
|
34
35
|
// src/WithdrawModal.tsx
|
|
35
36
|
|
|
@@ -99,6 +100,7 @@ function WithdrawFormStep({
|
|
|
99
100
|
const [recipient, setRecipient] = _react.useState.call(void 0, seededRecipient);
|
|
100
101
|
const [amount, setAmount] = _react.useState.call(void 0, _nullishCoalesce(defaultAmount, () => ( "")));
|
|
101
102
|
const [balance, setBalance] = _react.useState.call(void 0, null);
|
|
103
|
+
const [isBalanceLoading, setIsBalanceLoading] = _react.useState.call(void 0, true);
|
|
102
104
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
103
105
|
const [isSwitching, setIsSwitching] = _react.useState.call(void 0, false);
|
|
104
106
|
const [showChainDropdown, setShowChainDropdown] = _react.useState.call(void 0, false);
|
|
@@ -116,8 +118,8 @@ function WithdrawFormStep({
|
|
|
116
118
|
const chainMismatch = Boolean(
|
|
117
119
|
_optionalChain([walletClient, 'optionalAccess', _3 => _3.chain, 'optionalAccess', _4 => _4.id]) && walletClient.chain.id !== asset.chainId
|
|
118
120
|
);
|
|
119
|
-
const targetSymbol =
|
|
120
|
-
const targetChainName =
|
|
121
|
+
const targetSymbol = _chunkHYUITBRVcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
122
|
+
const targetChainName = _chunkHYUITBRVcjs.getChainName.call(void 0, targetChain);
|
|
121
123
|
const isBusy = submitting || isSubmitting;
|
|
122
124
|
const seededRecipientRef = _react.useRef.call(void 0, seededRecipient);
|
|
123
125
|
_react.useEffect.call(void 0, () => {
|
|
@@ -136,7 +138,7 @@ function WithdrawFormStep({
|
|
|
136
138
|
setIsSwitching(true);
|
|
137
139
|
switchChain(asset.chainId).catch((err) => {
|
|
138
140
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
139
|
-
setError(
|
|
141
|
+
setError(_chunkNULE6WIIcjs.formatUserError.call(void 0, raw));
|
|
140
142
|
}).finally(() => {
|
|
141
143
|
setIsSwitching(false);
|
|
142
144
|
});
|
|
@@ -147,13 +149,16 @@ function WithdrawFormStep({
|
|
|
147
149
|
}, [asset.chainId]);
|
|
148
150
|
_react.useEffect.call(void 0, () => {
|
|
149
151
|
let active = true;
|
|
152
|
+
let timeoutId;
|
|
153
|
+
let retryDelayMs = 5e3;
|
|
150
154
|
async function fetchBalance() {
|
|
151
155
|
if (!safeAddress || !publicClient) return;
|
|
152
156
|
if (publicClientChainId && publicClientChainId !== asset.chainId) {
|
|
157
|
+
timeoutId = setTimeout(fetchBalance, 1e3);
|
|
153
158
|
return;
|
|
154
159
|
}
|
|
155
160
|
try {
|
|
156
|
-
const bal =
|
|
161
|
+
const bal = _chunkNULE6WIIcjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: safeAddress }) : await publicClient.readContract({
|
|
157
162
|
address: asset.token,
|
|
158
163
|
abi: _viem.erc20Abi,
|
|
159
164
|
functionName: "balanceOf",
|
|
@@ -161,23 +166,24 @@ function WithdrawFormStep({
|
|
|
161
166
|
});
|
|
162
167
|
if (active) {
|
|
163
168
|
setBalance(bal);
|
|
169
|
+
setIsBalanceLoading(false);
|
|
164
170
|
}
|
|
165
171
|
} catch (e2) {
|
|
166
172
|
if (active) {
|
|
167
173
|
setBalance(null);
|
|
174
|
+
timeoutId = setTimeout(fetchBalance, retryDelayMs);
|
|
175
|
+
retryDelayMs = Math.min(Math.round(retryDelayMs * 1.5), 3e4);
|
|
168
176
|
}
|
|
169
177
|
}
|
|
170
178
|
}
|
|
179
|
+
setBalance(null);
|
|
180
|
+
setIsBalanceLoading(true);
|
|
171
181
|
void fetchBalance();
|
|
172
|
-
const unwatch = publicClient.watchBlockNumber({
|
|
173
|
-
emitOnBegin: false,
|
|
174
|
-
onBlockNumber() {
|
|
175
|
-
void fetchBalance();
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
182
|
return () => {
|
|
179
183
|
active = false;
|
|
180
|
-
|
|
184
|
+
if (timeoutId) {
|
|
185
|
+
clearTimeout(timeoutId);
|
|
186
|
+
}
|
|
181
187
|
};
|
|
182
188
|
}, [safeAddress, publicClient, publicClientChainId, asset]);
|
|
183
189
|
const formattedBalance = _react.useMemo.call(void 0, () => {
|
|
@@ -255,11 +261,21 @@ function WithdrawFormStep({
|
|
|
255
261
|
await onSubmit(recipient, amount);
|
|
256
262
|
} catch (err) {
|
|
257
263
|
const raw = err instanceof Error ? err.message : "Withdrawal failed";
|
|
258
|
-
setError(
|
|
264
|
+
setError(_chunkNULE6WIIcjs.formatUserError.call(void 0, raw));
|
|
259
265
|
} finally {
|
|
260
266
|
setIsSubmitting(false);
|
|
261
267
|
}
|
|
262
268
|
}, [recipient, amount, balance, asset.decimals, onSubmit]);
|
|
269
|
+
if (isBalanceLoading) {
|
|
270
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
271
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body rs-withdraw-loading", children: [
|
|
272
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNULE6WIIcjs.Spinner, { className: "rs-spinner--lg" }),
|
|
273
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-loading-title", children: "Loading on-chain balance" }),
|
|
274
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-withdraw-loading-subtitle", children: chainMismatch ? `Switch to ${_chunkHYUITBRVcjs.getChainName.call(void 0, asset.chainId)} to continue.` : "Please wait before withdrawing." })
|
|
275
|
+
] }),
|
|
276
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNULE6WIIcjs.PoweredBy, {})
|
|
277
|
+
] });
|
|
278
|
+
}
|
|
263
279
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
264
280
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body rs-withdraw-form", children: [
|
|
265
281
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-section", children: [
|
|
@@ -353,7 +369,7 @@ function WithdrawFormStep({
|
|
|
353
369
|
] })
|
|
354
370
|
] }),
|
|
355
371
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-amount-info", children: [
|
|
356
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ?
|
|
372
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-withdraw-usd", children: amountUsd !== null ? _chunkNULE6WIIcjs.currencyFormatter.format(amountUsd) : "$0.00" }),
|
|
357
373
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-withdraw-balance", children: [
|
|
358
374
|
formattedBalance,
|
|
359
375
|
" ",
|
|
@@ -381,10 +397,10 @@ function WithdrawFormStep({
|
|
|
381
397
|
},
|
|
382
398
|
children: [
|
|
383
399
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-dropdown-value", children: [
|
|
384
|
-
|
|
400
|
+
_chunkHYUITBRVcjs.getTokenIcon.call(void 0, targetSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
385
401
|
"img",
|
|
386
402
|
{
|
|
387
|
-
src:
|
|
403
|
+
src: _chunkHYUITBRVcjs.getTokenIcon.call(void 0, targetSymbol),
|
|
388
404
|
alt: targetSymbol,
|
|
389
405
|
className: "rs-withdraw-dropdown-icon"
|
|
390
406
|
}
|
|
@@ -425,10 +441,10 @@ function WithdrawFormStep({
|
|
|
425
441
|
setShowTokenDropdown(false);
|
|
426
442
|
},
|
|
427
443
|
children: [
|
|
428
|
-
|
|
444
|
+
_chunkHYUITBRVcjs.getTokenIcon.call(void 0, option.symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
429
445
|
"img",
|
|
430
446
|
{
|
|
431
|
-
src:
|
|
447
|
+
src: _chunkHYUITBRVcjs.getTokenIcon.call(void 0, option.symbol),
|
|
432
448
|
alt: option.symbol,
|
|
433
449
|
className: "rs-withdraw-dropdown-icon"
|
|
434
450
|
}
|
|
@@ -461,10 +477,10 @@ function WithdrawFormStep({
|
|
|
461
477
|
},
|
|
462
478
|
children: [
|
|
463
479
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-dropdown-value", children: [
|
|
464
|
-
|
|
480
|
+
_chunkHYUITBRVcjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
465
481
|
"img",
|
|
466
482
|
{
|
|
467
|
-
src:
|
|
483
|
+
src: _chunkHYUITBRVcjs.getChainIcon.call(void 0, targetChain),
|
|
468
484
|
alt: targetChainName,
|
|
469
485
|
className: "rs-withdraw-dropdown-icon"
|
|
470
486
|
}
|
|
@@ -505,10 +521,10 @@ function WithdrawFormStep({
|
|
|
505
521
|
setShowChainDropdown(false);
|
|
506
522
|
},
|
|
507
523
|
children: [
|
|
508
|
-
|
|
524
|
+
_chunkHYUITBRVcjs.getChainIcon.call(void 0, chain.id) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
509
525
|
"img",
|
|
510
526
|
{
|
|
511
|
-
src:
|
|
527
|
+
src: _chunkHYUITBRVcjs.getChainIcon.call(void 0, chain.id),
|
|
512
528
|
alt: chain.name,
|
|
513
529
|
className: "rs-withdraw-dropdown-icon"
|
|
514
530
|
}
|
|
@@ -523,7 +539,7 @@ function WithdrawFormStep({
|
|
|
523
539
|
)
|
|
524
540
|
] })
|
|
525
541
|
] }),
|
|
526
|
-
chainMismatch && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-chain-switch", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-chain-switch-text", children: isSwitching ? `Switching to ${
|
|
542
|
+
chainMismatch && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-chain-switch", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-chain-switch-text", children: isSwitching ? `Switching to ${_chunkHYUITBRVcjs.getChainName.call(void 0, asset.chainId)}...` : `Switch to ${_chunkHYUITBRVcjs.getChainName.call(void 0, asset.chainId)} to continue.` }) }),
|
|
527
543
|
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-withdraw-error", children: [
|
|
528
544
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
529
545
|
"svg",
|
|
@@ -546,7 +562,7 @@ function WithdrawFormStep({
|
|
|
546
562
|
] })
|
|
547
563
|
] }),
|
|
548
564
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
549
|
-
|
|
565
|
+
_chunkNULE6WIIcjs.Button,
|
|
550
566
|
{
|
|
551
567
|
onClick: handleWithdraw,
|
|
552
568
|
fullWidth: true,
|
|
@@ -555,7 +571,7 @@ function WithdrawFormStep({
|
|
|
555
571
|
children: isBusy ? "Preparing..." : "Withdraw"
|
|
556
572
|
}
|
|
557
573
|
) }),
|
|
558
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
574
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNULE6WIIcjs.PoweredBy, {})
|
|
559
575
|
] });
|
|
560
576
|
}
|
|
561
577
|
WithdrawFormStep.displayName = "WithdrawFormStep";
|
|
@@ -638,7 +654,7 @@ async function executeSafeEthTransfer(params) {
|
|
|
638
654
|
throw new Error("Wallet not connected");
|
|
639
655
|
}
|
|
640
656
|
if (chain.id !== chainId) {
|
|
641
|
-
throw new Error(`Switch to ${
|
|
657
|
+
throw new Error(`Switch to ${_chunkHYUITBRVcjs.getChainName.call(void 0, chainId)} to sign`);
|
|
642
658
|
}
|
|
643
659
|
const isOwner = await publicClient.readContract({
|
|
644
660
|
address: safeAddress,
|
|
@@ -721,7 +737,7 @@ async function executeSafeErc20Transfer(params) {
|
|
|
721
737
|
throw new Error("Wallet not connected");
|
|
722
738
|
}
|
|
723
739
|
if (chain.id !== chainId) {
|
|
724
|
-
throw new Error(`Switch to ${
|
|
740
|
+
throw new Error(`Switch to ${_chunkHYUITBRVcjs.getChainName.call(void 0, chainId)} to sign`);
|
|
725
741
|
}
|
|
726
742
|
const isOwner = await publicClient.readContract({
|
|
727
743
|
address: safeAddress,
|
|
@@ -860,7 +876,7 @@ function WithdrawFlow({
|
|
|
860
876
|
recipient: defaultRecipient,
|
|
861
877
|
amount: defaultAmount,
|
|
862
878
|
service,
|
|
863
|
-
signerAddress =
|
|
879
|
+
signerAddress = _chunkHYUITBRVcjs.DEFAULT_SIGNER_ADDRESS,
|
|
864
880
|
sessionChainIds,
|
|
865
881
|
forceRegister = false,
|
|
866
882
|
waitForFinalTx = true,
|
|
@@ -933,14 +949,14 @@ function WithdrawFlow({
|
|
|
933
949
|
return {
|
|
934
950
|
ownerAddress: dappAddress,
|
|
935
951
|
walletClient: _nullishCoalesce(dappWalletClient, () => ( void 0)),
|
|
936
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
952
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkNULE6WIIcjs.getPublicClient.call(void 0, sourceChain))),
|
|
937
953
|
switchChain: dappSwitchChain
|
|
938
954
|
};
|
|
939
955
|
}
|
|
940
956
|
return {
|
|
941
957
|
ownerAddress: dappWalletClient.account.address,
|
|
942
958
|
walletClient: dappWalletClient,
|
|
943
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
959
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkNULE6WIIcjs.getPublicClient.call(void 0, sourceChain))),
|
|
944
960
|
switchChain: dappSwitchChain
|
|
945
961
|
};
|
|
946
962
|
}
|
|
@@ -949,7 +965,7 @@ function WithdrawFlow({
|
|
|
949
965
|
return {
|
|
950
966
|
ownerAddress: dappWalletClient.account.address,
|
|
951
967
|
walletClient: dappWalletClient,
|
|
952
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
968
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkNULE6WIIcjs.getPublicClient.call(void 0, sourceChain))),
|
|
953
969
|
switchChain: dappSwitchChain
|
|
954
970
|
};
|
|
955
971
|
}
|
|
@@ -975,10 +991,10 @@ function WithdrawFlow({
|
|
|
975
991
|
sourceChain
|
|
976
992
|
]);
|
|
977
993
|
const asset = _react.useMemo.call(void 0, () => {
|
|
978
|
-
const symbol =
|
|
979
|
-
const decimals =
|
|
994
|
+
const symbol = _chunkHYUITBRVcjs.getTokenSymbol.call(void 0, sourceToken, sourceChain);
|
|
995
|
+
const decimals = _chunkHYUITBRVcjs.getTokenDecimalsByAddress.call(void 0, sourceToken, sourceChain);
|
|
980
996
|
return {
|
|
981
|
-
id:
|
|
997
|
+
id: _chunkNULE6WIIcjs.getAssetId.call(void 0, { chainId: sourceChain, token: sourceToken }),
|
|
982
998
|
chainId: sourceChain,
|
|
983
999
|
token: sourceToken,
|
|
984
1000
|
symbol,
|
|
@@ -986,7 +1002,7 @@ function WithdrawFlow({
|
|
|
986
1002
|
decimals
|
|
987
1003
|
};
|
|
988
1004
|
}, [sourceChain, sourceToken]);
|
|
989
|
-
const isSourceNative = sourceToken.toLowerCase() ===
|
|
1005
|
+
const isSourceNative = sourceToken.toLowerCase() === _chunkHYUITBRVcjs.NATIVE_TOKEN_ADDRESS.toLowerCase();
|
|
990
1006
|
const stepIndex = step.type === "form" ? 0 : 1;
|
|
991
1007
|
const currentBackHandler = void 0;
|
|
992
1008
|
_react.useEffect.call(void 0, () => {
|
|
@@ -1008,15 +1024,15 @@ function WithdrawFlow({
|
|
|
1008
1024
|
[onError]
|
|
1009
1025
|
);
|
|
1010
1026
|
const resolveSessionOwner = _react.useCallback.call(void 0, async (eoaAddress) => {
|
|
1011
|
-
const localOwner =
|
|
1027
|
+
const localOwner = _chunkNULE6WIIcjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
|
|
1012
1028
|
if (localOwner) {
|
|
1013
1029
|
return {
|
|
1014
|
-
account:
|
|
1030
|
+
account: _chunkNULE6WIIcjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
|
|
1015
1031
|
address: localOwner.address
|
|
1016
1032
|
};
|
|
1017
1033
|
}
|
|
1018
|
-
const created =
|
|
1019
|
-
|
|
1034
|
+
const created = _chunkNULE6WIIcjs.createSessionOwnerKey.call(void 0, );
|
|
1035
|
+
_chunkNULE6WIIcjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
|
|
1020
1036
|
return {
|
|
1021
1037
|
account: created.account,
|
|
1022
1038
|
address: created.address
|
|
@@ -1060,7 +1076,7 @@ function WithdrawFlow({
|
|
|
1060
1076
|
primaryType: typedData.primaryType,
|
|
1061
1077
|
message: typedData.message
|
|
1062
1078
|
});
|
|
1063
|
-
const sessionDetails =
|
|
1079
|
+
const sessionDetails = _chunkNULE6WIIcjs.buildSessionDetails.call(void 0,
|
|
1064
1080
|
setup.sessionDetailsUnsigned,
|
|
1065
1081
|
signature
|
|
1066
1082
|
);
|
|
@@ -1082,7 +1098,7 @@ function WithdrawFlow({
|
|
|
1082
1098
|
}
|
|
1083
1099
|
handleConnected(ownerAddress2, smartAccount);
|
|
1084
1100
|
const amountUnits = _viem.parseUnits.call(void 0, amountValue, asset.decimals);
|
|
1085
|
-
const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _26 => _26.publicClient]), () => (
|
|
1101
|
+
const pc = _nullishCoalesce(_optionalChain([signerContext, 'optionalAccess', _26 => _26.publicClient]), () => ( _chunkNULE6WIIcjs.getPublicClient.call(void 0, sourceChain)));
|
|
1086
1102
|
let result;
|
|
1087
1103
|
if (onSignTransaction) {
|
|
1088
1104
|
const transferData = isSourceNative ? { to: smartAccount, value: amountUnits, data: "0x" } : {
|
|
@@ -1150,7 +1166,7 @@ function WithdrawFlow({
|
|
|
1150
1166
|
});
|
|
1151
1167
|
} catch (err) {
|
|
1152
1168
|
const raw = err instanceof Error ? err.message : "Withdraw failed";
|
|
1153
|
-
handleError(
|
|
1169
|
+
handleError(_chunkNULE6WIIcjs.formatUserError.call(void 0, raw), "WITHDRAW_FLOW_ERROR");
|
|
1154
1170
|
throw err;
|
|
1155
1171
|
} finally {
|
|
1156
1172
|
setIsSubmitting(false);
|
|
@@ -1189,12 +1205,12 @@ function WithdrawFlow({
|
|
|
1189
1205
|
[onWithdrawFailed]
|
|
1190
1206
|
);
|
|
1191
1207
|
const targetChainOptions = _react.useMemo.call(void 0, () => {
|
|
1192
|
-
return
|
|
1193
|
-
(chain) =>
|
|
1208
|
+
return _chunkHYUITBRVcjs.SOURCE_CHAINS.filter(
|
|
1209
|
+
(chain) => _chunkHYUITBRVcjs.getSupportedTargetTokens.call(void 0, chain.id).length > 0
|
|
1194
1210
|
);
|
|
1195
1211
|
}, []);
|
|
1196
1212
|
const targetTokenOptions = _react.useMemo.call(void 0,
|
|
1197
|
-
() =>
|
|
1213
|
+
() => _chunkHYUITBRVcjs.getSupportedTargetTokens.call(void 0, targetChain),
|
|
1198
1214
|
[targetChain]
|
|
1199
1215
|
);
|
|
1200
1216
|
_react.useEffect.call(void 0, () => {
|
|
@@ -1209,7 +1225,7 @@ function WithdrawFlow({
|
|
|
1209
1225
|
const handleTargetChainChange = _react.useCallback.call(void 0,
|
|
1210
1226
|
(chainId) => {
|
|
1211
1227
|
setTargetChain(chainId);
|
|
1212
|
-
const options =
|
|
1228
|
+
const options = _chunkHYUITBRVcjs.getSupportedTargetTokens.call(void 0, chainId);
|
|
1213
1229
|
if (options.length === 0) {
|
|
1214
1230
|
return;
|
|
1215
1231
|
}
|
|
@@ -1249,7 +1265,7 @@ function WithdrawFlow({
|
|
|
1249
1265
|
}, [walletOptions, ownerAddress, _optionalChain([reownWallet, 'optionalAccess', _34 => _34.icon])]);
|
|
1250
1266
|
if (showConnectStep) {
|
|
1251
1267
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1252
|
-
|
|
1268
|
+
_chunkNULE6WIIcjs.ConnectStep,
|
|
1253
1269
|
{
|
|
1254
1270
|
walletOptions,
|
|
1255
1271
|
selectedAddress: selectedConnectAddressEffective,
|
|
@@ -1272,7 +1288,7 @@ function WithdrawFlow({
|
|
|
1272
1288
|
const resolvedOwnerAddress = signerContext.ownerAddress;
|
|
1273
1289
|
const resolvedConnectedAddress = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _35 => _35.walletClient, 'optionalAccess', _36 => _36.account, 'optionalAccess', _37 => _37.address]), () => ( _optionalChain([reownWallet, 'optionalAccess', _38 => _38.address]))), () => ( _optionalChain([dappWalletClient, 'optionalAccess', _39 => _39.account, 'optionalAccess', _40 => _40.address]))), () => ( resolvedOwnerAddress));
|
|
1274
1290
|
const resolvedDefaultRecipient = _nullishCoalesce(defaultRecipient, () => ( resolvedConnectedAddress));
|
|
1275
|
-
const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => (
|
|
1291
|
+
const formPublicClient = _nullishCoalesce(signerContext.publicClient, () => ( _chunkNULE6WIIcjs.getPublicClient.call(void 0, sourceChain)));
|
|
1276
1292
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
1277
1293
|
step.type === "form" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1278
1294
|
WithdrawFormStep,
|
|
@@ -1299,7 +1315,7 @@ function WithdrawFlow({
|
|
|
1299
1315
|
}
|
|
1300
1316
|
),
|
|
1301
1317
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1302
|
-
|
|
1318
|
+
_chunkNULE6WIIcjs.ProcessingStep,
|
|
1303
1319
|
{
|
|
1304
1320
|
smartAccount: step.smartAccount,
|
|
1305
1321
|
txHash: step.txHash,
|
|
@@ -1324,7 +1340,7 @@ function WithdrawFlow({
|
|
|
1324
1340
|
// src/WithdrawModal.tsx
|
|
1325
1341
|
|
|
1326
1342
|
var ReownWithdrawInner = _react.lazy.call(void 0,
|
|
1327
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-
|
|
1343
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./WithdrawModalReown-OGPBUDZU.cjs"))).then((m) => ({
|
|
1328
1344
|
default: m.WithdrawModalReown
|
|
1329
1345
|
}))
|
|
1330
1346
|
);
|
|
@@ -1350,8 +1366,8 @@ function WithdrawModalInner({
|
|
|
1350
1366
|
isOpen,
|
|
1351
1367
|
onClose,
|
|
1352
1368
|
inline,
|
|
1353
|
-
backendUrl =
|
|
1354
|
-
signerAddress =
|
|
1369
|
+
backendUrl = _chunkHYUITBRVcjs.DEFAULT_BACKEND_URL,
|
|
1370
|
+
signerAddress = _chunkHYUITBRVcjs.DEFAULT_SIGNER_ADDRESS,
|
|
1355
1371
|
sessionChainIds,
|
|
1356
1372
|
forceRegister = false,
|
|
1357
1373
|
waitForFinalTx = true,
|
|
@@ -1377,12 +1393,12 @@ function WithdrawModalInner({
|
|
|
1377
1393
|
const [currentStepIndex, setCurrentStepIndex] = _react.useState.call(void 0, 0);
|
|
1378
1394
|
const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, null);
|
|
1379
1395
|
const backHandlerRef = _react.useRef.call(void 0, void 0);
|
|
1380
|
-
const targetChain =
|
|
1381
|
-
const sourceChain =
|
|
1382
|
-
const service = _react.useMemo.call(void 0, () =>
|
|
1396
|
+
const targetChain = _chunkHYUITBRVcjs.getChainId.call(void 0, targetChainProp);
|
|
1397
|
+
const sourceChain = _chunkHYUITBRVcjs.getChainId.call(void 0, sourceChainProp);
|
|
1398
|
+
const service = _react.useMemo.call(void 0, () => _chunkNULE6WIIcjs.createDepositService.call(void 0, backendUrl), [backendUrl]);
|
|
1383
1399
|
_react.useEffect.call(void 0, () => {
|
|
1384
1400
|
if (isOpen && modalRef.current) {
|
|
1385
|
-
|
|
1401
|
+
_chunkNULE6WIIcjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
1386
1402
|
}
|
|
1387
1403
|
}, [isOpen, theme]);
|
|
1388
1404
|
const hasCalledReady = _react.useRef.call(void 0, false);
|
|
@@ -1418,7 +1434,7 @@ function WithdrawModalInner({
|
|
|
1418
1434
|
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _49 => _49.title]), () => ( "Withdraw"));
|
|
1419
1435
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 3 && backHandlerRef.current;
|
|
1420
1436
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1421
|
-
|
|
1437
|
+
_chunkNULE6WIIcjs.Modal,
|
|
1422
1438
|
{
|
|
1423
1439
|
isOpen,
|
|
1424
1440
|
onClose,
|
|
@@ -1476,7 +1492,7 @@ function WithdrawModalInner({
|
|
|
1476
1492
|
] }),
|
|
1477
1493
|
balance && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header-balance", children: [
|
|
1478
1494
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-label", children: balance.title }),
|
|
1479
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ?
|
|
1495
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ? _chunkNULE6WIIcjs.currencyFormatter.format(totalBalanceUsd) : null))) })
|
|
1480
1496
|
] })
|
|
1481
1497
|
] }),
|
|
1482
1498
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|