@rhinestone/deposit-modal 0.1.30 → 0.1.32
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-OHTRNISJ.mjs → DepositModalReown-SZPCCNPH.mjs} +9 -5
- package/dist/{DepositModalReown-ZD3ROLZG.cjs → DepositModalReown-XUAEWIW7.cjs} +12 -8
- package/dist/{WithdrawModalReown-SVZQKH2X.cjs → WithdrawModalReown-53FDOZG2.cjs} +12 -8
- package/dist/{WithdrawModalReown-IJAMIPSY.mjs → WithdrawModalReown-YGGV7BL2.mjs} +9 -5
- package/dist/{chunk-6VJ2ZTNQ.cjs → chunk-52FVEYTL.cjs} +6 -0
- package/dist/{chunk-VL47TLTE.mjs → chunk-C6I5TFSL.mjs} +13 -8
- package/dist/{chunk-CIAKCO7G.mjs → chunk-DLFUXLAM.mjs} +67 -34
- package/dist/{chunk-LBEP3A2Z.mjs → chunk-K2JJKFTV.mjs} +8 -2
- package/dist/{chunk-BOKLFGNS.mjs → chunk-MKKJ7ZE2.mjs} +148 -167
- package/dist/{chunk-WDDONQLV.cjs → chunk-NYEWO4NW.cjs} +265 -284
- package/dist/{chunk-S76PY7GZ.mjs → chunk-RR25E5DZ.mjs} +35 -15
- package/dist/{chunk-WB3ZJJBH.cjs → chunk-S4UBVD3H.cjs} +14 -9
- package/dist/{chunk-K4YSUWIT.cjs → chunk-SQDXU7ML.cjs} +91 -71
- package/dist/{chunk-KIRDZLOS.cjs → chunk-YIHOACM3.cjs} +91 -58
- package/dist/constants.cjs +2 -2
- package/dist/constants.mjs +1 -1
- package/dist/deposit.cjs +4 -4
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +3 -3
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +4 -4
- package/dist/reown.cjs +5 -5
- package/dist/reown.d.cts +1 -1
- package/dist/reown.d.ts +1 -1
- package/dist/reown.mjs +4 -4
- package/dist/styles.css +8 -5
- package/dist/{types-CgXyx46m.d.ts → types-Bp2n2RQ3.d.ts} +4 -1
- package/dist/{types-BwaQ7jK5.d.cts → types-CIaQPR6F.d.cts} +4 -1
- package/dist/withdraw.cjs +4 -4
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +2 -2
- package/dist/withdraw.mjs +3 -3
- package/package.json +1 -1
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _chunkYIHOACM3cjs = require('./chunk-YIHOACM3.cjs');
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
@@ -36,7 +36,8 @@ var _chunkKIRDZLOScjs = require('./chunk-KIRDZLOS.cjs');
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
|
|
40
|
+
var _chunkS4UBVD3Hcjs = require('./chunk-S4UBVD3H.cjs');
|
|
40
41
|
|
|
41
42
|
// src/DepositModal.tsx
|
|
42
43
|
|
|
@@ -56,15 +57,15 @@ var _react = require('react');
|
|
|
56
57
|
|
|
57
58
|
var _jsxruntime = require('react/jsx-runtime');
|
|
58
59
|
async function resolveSessionOwner(eoaAddress) {
|
|
59
|
-
const localOwner =
|
|
60
|
+
const localOwner = _chunkYIHOACM3cjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
|
|
60
61
|
if (localOwner) {
|
|
61
62
|
return {
|
|
62
|
-
account:
|
|
63
|
+
account: _chunkYIHOACM3cjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
|
|
63
64
|
address: localOwner.address
|
|
64
65
|
};
|
|
65
66
|
}
|
|
66
|
-
const created =
|
|
67
|
-
|
|
67
|
+
const created = _chunkYIHOACM3cjs.createSessionOwnerKey.call(void 0, );
|
|
68
|
+
_chunkYIHOACM3cjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
|
|
68
69
|
return {
|
|
69
70
|
account: created.account,
|
|
70
71
|
address: created.address
|
|
@@ -126,7 +127,7 @@ function SetupStep({
|
|
|
126
127
|
primaryType: typedData.primaryType,
|
|
127
128
|
message: typedData.message
|
|
128
129
|
});
|
|
129
|
-
const sessionDetails =
|
|
130
|
+
const sessionDetails = _chunkYIHOACM3cjs.buildSessionDetails.call(void 0, setup.sessionDetailsUnsigned, signature);
|
|
130
131
|
setState({ type: "registering" });
|
|
131
132
|
await service.registerAccount({
|
|
132
133
|
address: smartAccount,
|
|
@@ -197,7 +198,7 @@ function SetupStep({
|
|
|
197
198
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
198
199
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", children: [
|
|
199
200
|
isLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
200
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
201
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYIHOACM3cjs.Spinner, { className: "rs-spinner--lg rs-text-accent" }),
|
|
201
202
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-text", children: [
|
|
202
203
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: renderStateMessage() }),
|
|
203
204
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-subtitle", children: "This may take a moment" })
|
|
@@ -234,7 +235,7 @@ function SetupStep({
|
|
|
234
235
|
] })
|
|
235
236
|
] })
|
|
236
237
|
] }),
|
|
237
|
-
isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
238
|
+
isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYIHOACM3cjs.Button, { onClick: handleRetry, variant: "default", fullWidth: true, children: "Try Again" }) })
|
|
238
239
|
] });
|
|
239
240
|
}
|
|
240
241
|
|
|
@@ -249,7 +250,8 @@ function AssetSelectStep({
|
|
|
249
250
|
defaultSourceToken,
|
|
250
251
|
service,
|
|
251
252
|
onContinue,
|
|
252
|
-
onTotalBalanceComputed
|
|
253
|
+
onTotalBalanceComputed,
|
|
254
|
+
onAssetsLoaded
|
|
253
255
|
}) {
|
|
254
256
|
const [assets, setAssets] = _react.useState.call(void 0, []);
|
|
255
257
|
const [selectedAssetId, setSelectedAssetId] = _react.useState.call(void 0, null);
|
|
@@ -257,7 +259,7 @@ function AssetSelectStep({
|
|
|
257
259
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
258
260
|
const defaultAssetId = _react.useMemo.call(void 0, () => {
|
|
259
261
|
if (!defaultSourceChain || !defaultSourceToken) return null;
|
|
260
|
-
return
|
|
262
|
+
return _chunkYIHOACM3cjs.getAssetId.call(void 0, {
|
|
261
263
|
chainId: defaultSourceChain,
|
|
262
264
|
token: defaultSourceToken
|
|
263
265
|
});
|
|
@@ -274,10 +276,10 @@ function AssetSelectStep({
|
|
|
274
276
|
try {
|
|
275
277
|
const portfolio = await service.fetchPortfolio(address);
|
|
276
278
|
if (!active) return;
|
|
277
|
-
const portfolioAssets =
|
|
279
|
+
const portfolioAssets = _chunkYIHOACM3cjs.portfolioToAssets.call(void 0, portfolio.tokens);
|
|
278
280
|
setAssets(portfolioAssets);
|
|
279
281
|
const hasNative = portfolioAssets.some(
|
|
280
|
-
(asset) => asset.token.toLowerCase() ===
|
|
282
|
+
(asset) => asset.token.toLowerCase() === _chunkS4UBVD3Hcjs.NATIVE_TOKEN_ADDRESS
|
|
281
283
|
);
|
|
282
284
|
if (!hasNative) {
|
|
283
285
|
const nativeAssets = await fetchNativeAssets(
|
|
@@ -316,7 +318,8 @@ function AssetSelectStep({
|
|
|
316
318
|
0
|
|
317
319
|
);
|
|
318
320
|
_optionalChain([onTotalBalanceComputed, 'optionalCall', _4 => _4(total)]);
|
|
319
|
-
|
|
321
|
+
if (assets.length > 0) _optionalChain([onAssetsLoaded, 'optionalCall', _5 => _5(assets)]);
|
|
322
|
+
}, [assets, onTotalBalanceComputed, onAssetsLoaded]);
|
|
320
323
|
const rows = _react.useMemo.call(void 0, () => {
|
|
321
324
|
return assets.filter((a) => {
|
|
322
325
|
try {
|
|
@@ -342,7 +345,7 @@ function AssetSelectStep({
|
|
|
342
345
|
const raw = _viem.formatUnits.call(void 0, BigInt(asset.balance), asset.decimals);
|
|
343
346
|
const numeric = Number(raw);
|
|
344
347
|
if (!Number.isFinite(numeric)) return raw;
|
|
345
|
-
return
|
|
348
|
+
return _chunkYIHOACM3cjs.tokenFormatter.format(numeric);
|
|
346
349
|
} catch (e3) {
|
|
347
350
|
return asset.balance;
|
|
348
351
|
}
|
|
@@ -356,7 +359,7 @@ function AssetSelectStep({
|
|
|
356
359
|
style: { paddingTop: 4, overflow: "auto", maxHeight: 340 },
|
|
357
360
|
children: [
|
|
358
361
|
loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
359
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
362
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYIHOACM3cjs.Spinner, { className: "rs-text-tertiary" }),
|
|
360
363
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
361
364
|
] }),
|
|
362
365
|
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-alert rs-alert--error", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-alert-text", children: error }) }),
|
|
@@ -389,9 +392,9 @@ function AssetSelectStep({
|
|
|
389
392
|
!loading && !error && rows.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-list", children: rows.map((asset) => {
|
|
390
393
|
const isSelected = selectedAssetId === asset.id;
|
|
391
394
|
const tokenAmount = formatBalance(asset);
|
|
392
|
-
const badge =
|
|
393
|
-
const tokenIcon =
|
|
394
|
-
const chainIcon =
|
|
395
|
+
const badge = _chunkS4UBVD3Hcjs.getChainBadge.call(void 0, asset.chainId);
|
|
396
|
+
const tokenIcon = _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, asset.symbol);
|
|
397
|
+
const chainIcon = _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, asset.chainId);
|
|
395
398
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
396
399
|
"button",
|
|
397
400
|
{
|
|
@@ -415,7 +418,7 @@ function AssetSelectStep({
|
|
|
415
418
|
"img",
|
|
416
419
|
{
|
|
417
420
|
src: chainIcon,
|
|
418
|
-
alt:
|
|
421
|
+
alt: _chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId),
|
|
419
422
|
className: "rs-asset-chain-badge"
|
|
420
423
|
}
|
|
421
424
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -436,7 +439,7 @@ function AssetSelectStep({
|
|
|
436
439
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-asset-chain", children: [
|
|
437
440
|
" ",
|
|
438
441
|
"on ",
|
|
439
|
-
|
|
442
|
+
_chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId)
|
|
440
443
|
] })
|
|
441
444
|
] }),
|
|
442
445
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-balance-small", children: [
|
|
@@ -446,7 +449,7 @@ function AssetSelectStep({
|
|
|
446
449
|
] })
|
|
447
450
|
] })
|
|
448
451
|
] }),
|
|
449
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ?
|
|
452
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ? _chunkYIHOACM3cjs.currencyFormatter.format(asset.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${asset.symbol}` : "--" })
|
|
450
453
|
]
|
|
451
454
|
},
|
|
452
455
|
asset.id
|
|
@@ -456,7 +459,7 @@ function AssetSelectStep({
|
|
|
456
459
|
}
|
|
457
460
|
),
|
|
458
461
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
459
|
-
|
|
462
|
+
_chunkYIHOACM3cjs.Button,
|
|
460
463
|
{
|
|
461
464
|
onClick: () => selectedAsset && onContinue(selectedAsset),
|
|
462
465
|
disabled: !selectedAsset,
|
|
@@ -464,17 +467,17 @@ function AssetSelectStep({
|
|
|
464
467
|
children: "Continue"
|
|
465
468
|
}
|
|
466
469
|
) }),
|
|
467
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
470
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYIHOACM3cjs.PoweredBy, {})
|
|
468
471
|
] });
|
|
469
472
|
}
|
|
470
473
|
async function fetchNativeAssets(address, publicClient, existing) {
|
|
471
474
|
const existingIds = new Set(existing.map((asset) => asset.id));
|
|
472
|
-
const connectedChainId = _optionalChain([publicClient, 'access',
|
|
475
|
+
const connectedChainId = _optionalChain([publicClient, 'access', _6 => _6.chain, 'optionalAccess', _7 => _7.id]);
|
|
473
476
|
if (!connectedChainId) return [];
|
|
474
|
-
if (!
|
|
475
|
-
const id =
|
|
477
|
+
if (!_chunkS4UBVD3Hcjs.SOURCE_CHAINS.some((chain) => chain.id === connectedChainId)) return [];
|
|
478
|
+
const id = _chunkYIHOACM3cjs.getAssetId.call(void 0, {
|
|
476
479
|
chainId: connectedChainId,
|
|
477
|
-
token:
|
|
480
|
+
token: _chunkS4UBVD3Hcjs.NATIVE_TOKEN_ADDRESS
|
|
478
481
|
});
|
|
479
482
|
if (existingIds.has(id)) return [];
|
|
480
483
|
try {
|
|
@@ -483,7 +486,7 @@ async function fetchNativeAssets(address, publicClient, existing) {
|
|
|
483
486
|
{
|
|
484
487
|
id,
|
|
485
488
|
chainId: connectedChainId,
|
|
486
|
-
token:
|
|
489
|
+
token: _chunkS4UBVD3Hcjs.NATIVE_TOKEN_ADDRESS,
|
|
487
490
|
symbol: "ETH",
|
|
488
491
|
name: "Ethereum",
|
|
489
492
|
decimals: 18,
|
|
@@ -531,8 +534,10 @@ function AmountStep({
|
|
|
531
534
|
const [isSwitching, setIsSwitching] = _react.useState.call(void 0, false);
|
|
532
535
|
const hasAttemptedSwitch = _react.useRef.call(void 0, false);
|
|
533
536
|
const chainMismatch = Boolean(
|
|
534
|
-
_optionalChain([walletClient, 'optionalAccess',
|
|
537
|
+
_optionalChain([walletClient, 'optionalAccess', _8 => _8.chain, 'optionalAccess', _9 => _9.id]) && walletClient.chain.id !== asset.chainId
|
|
535
538
|
);
|
|
539
|
+
const targetSymbol = _chunkS4UBVD3Hcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
540
|
+
const isSourceStablecoin = _chunkS4UBVD3Hcjs.isStablecoinSymbol.call(void 0, asset.symbol);
|
|
536
541
|
const tokenPriceUsd = _react.useMemo.call(void 0, () => {
|
|
537
542
|
if (tokenPriceUsdOverride !== void 0 && tokenPriceUsdOverride > 0)
|
|
538
543
|
return tokenPriceUsdOverride;
|
|
@@ -556,7 +561,7 @@ function AmountStep({
|
|
|
556
561
|
const balanceTarget = _nullishCoalesce(balanceAddress, () => ( address));
|
|
557
562
|
if (!balanceTarget || !publicClient) return;
|
|
558
563
|
try {
|
|
559
|
-
const bal =
|
|
564
|
+
const bal = _chunkYIHOACM3cjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: balanceTarget }) : await publicClient.readContract({
|
|
560
565
|
address: asset.token,
|
|
561
566
|
abi: _viem.erc20Abi,
|
|
562
567
|
functionName: "balanceOf",
|
|
@@ -592,15 +597,10 @@ function AmountStep({
|
|
|
592
597
|
if (defaultAmount && !amount) {
|
|
593
598
|
const parsed = Number(defaultAmount);
|
|
594
599
|
if (Number.isFinite(parsed) && parsed > 0) {
|
|
595
|
-
|
|
596
|
-
const usdValue = parsed * tokenPriceUsd;
|
|
597
|
-
setAmount(usdValue.toFixed(2));
|
|
598
|
-
} else {
|
|
599
|
-
setAmount(parsed.toString());
|
|
600
|
-
}
|
|
600
|
+
setAmount(parsed.toString());
|
|
601
601
|
}
|
|
602
602
|
}
|
|
603
|
-
}, [defaultAmount,
|
|
603
|
+
}, [defaultAmount, amount]);
|
|
604
604
|
const balanceUsd = _react.useMemo.call(void 0, () => {
|
|
605
605
|
if (balance === null || tokenPriceUsd === null) return null;
|
|
606
606
|
try {
|
|
@@ -612,7 +612,7 @@ function AmountStep({
|
|
|
612
612
|
}
|
|
613
613
|
}, [balance, tokenPriceUsd, asset.decimals]);
|
|
614
614
|
_react.useEffect.call(void 0, () => {
|
|
615
|
-
_optionalChain([onBalanceUsdChange, 'optionalCall',
|
|
615
|
+
_optionalChain([onBalanceUsdChange, 'optionalCall', _10 => _10(_nullishCoalesce(balanceUsd, () => ( 0)))]);
|
|
616
616
|
}, [balanceUsd, onBalanceUsdChange]);
|
|
617
617
|
const formattedBalance = _react.useMemo.call(void 0, () => {
|
|
618
618
|
if (balance === null) return "...";
|
|
@@ -620,41 +620,29 @@ function AmountStep({
|
|
|
620
620
|
const raw = _viem.formatUnits.call(void 0, balance, asset.decimals);
|
|
621
621
|
const numeric = Number(raw);
|
|
622
622
|
if (!Number.isFinite(numeric)) return raw;
|
|
623
|
-
return
|
|
623
|
+
return _chunkYIHOACM3cjs.tokenFormatter.format(numeric);
|
|
624
624
|
} catch (e8) {
|
|
625
625
|
return "...";
|
|
626
626
|
}
|
|
627
627
|
}, [balance, asset.decimals]);
|
|
628
|
-
const tokenAmount = _react.useMemo.call(void 0, () => {
|
|
629
|
-
if (!amount) return null;
|
|
630
|
-
if (hasPricing) {
|
|
631
|
-
const usd = Number(amount);
|
|
632
|
-
if (!Number.isFinite(usd) || usd <= 0) return null;
|
|
633
|
-
return usd / tokenPriceUsd;
|
|
634
|
-
}
|
|
635
|
-
const val = Number(amount);
|
|
636
|
-
return Number.isFinite(val) && val > 0 ? val : null;
|
|
637
|
-
}, [amount, tokenPriceUsd, hasPricing]);
|
|
638
|
-
const formattedTokenAmount = _react.useMemo.call(void 0, () => {
|
|
639
|
-
if (tokenAmount === null) return "0.00";
|
|
640
|
-
return _chunkKIRDZLOScjs.tokenFormatter.format(tokenAmount);
|
|
641
|
-
}, [tokenAmount]);
|
|
642
|
-
const targetSymbol = _chunkWB3ZJJBHcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
643
628
|
const handlePresetClick = (percentage) => {
|
|
644
629
|
if (balance === null) return;
|
|
645
|
-
|
|
646
|
-
const
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
setAmount(value.toString());
|
|
654
|
-
}
|
|
655
|
-
} catch (e9) {
|
|
656
|
-
return;
|
|
630
|
+
try {
|
|
631
|
+
const balanceUnits = Number(_viem.formatUnits.call(void 0, balance, asset.decimals));
|
|
632
|
+
if (!Number.isFinite(balanceUnits)) return;
|
|
633
|
+
let value;
|
|
634
|
+
if (isSourceStablecoin || !hasPricing) {
|
|
635
|
+
value = balanceUnits * percentage / 100;
|
|
636
|
+
} else {
|
|
637
|
+
value = (_nullishCoalesce(balanceUsd, () => ( 0))) * percentage / 100;
|
|
657
638
|
}
|
|
639
|
+
const maxDecimals = 3;
|
|
640
|
+
const factor = 10 ** maxDecimals;
|
|
641
|
+
const truncated = Math.floor(value * factor) / factor;
|
|
642
|
+
const formatted = truncated.toFixed(maxDecimals).replace(/\.?0+$/, "");
|
|
643
|
+
setAmount(formatted);
|
|
644
|
+
} catch (e9) {
|
|
645
|
+
return;
|
|
658
646
|
}
|
|
659
647
|
if (error) setError(null);
|
|
660
648
|
};
|
|
@@ -664,24 +652,28 @@ function AmountStep({
|
|
|
664
652
|
setError("Please enter a valid amount");
|
|
665
653
|
return;
|
|
666
654
|
}
|
|
667
|
-
let
|
|
655
|
+
let sourceAmount;
|
|
656
|
+
if (isSourceStablecoin || !hasPricing) {
|
|
657
|
+
sourceAmount = numericAmount;
|
|
658
|
+
} else {
|
|
659
|
+
sourceAmount = numericAmount / tokenPriceUsd;
|
|
660
|
+
}
|
|
668
661
|
if (hasPricing) {
|
|
669
|
-
|
|
662
|
+
const usdValue = numericAmount;
|
|
663
|
+
if (_optionalChain([uiConfig, 'optionalAccess', _11 => _11.maxDepositUsd]) && usdValue > uiConfig.maxDepositUsd) {
|
|
670
664
|
setError(
|
|
671
|
-
`Maximum deposit is ${
|
|
665
|
+
`Maximum deposit is ${_chunkYIHOACM3cjs.currencyFormatter.format(uiConfig.maxDepositUsd)}`
|
|
672
666
|
);
|
|
673
667
|
return;
|
|
674
668
|
}
|
|
675
|
-
if (_optionalChain([uiConfig, 'optionalAccess',
|
|
669
|
+
if (_optionalChain([uiConfig, 'optionalAccess', _12 => _12.minDepositUsd]) && usdValue < uiConfig.minDepositUsd) {
|
|
676
670
|
setError(
|
|
677
|
-
`Minimum deposit is ${
|
|
671
|
+
`Minimum deposit is ${_chunkYIHOACM3cjs.currencyFormatter.format(uiConfig.minDepositUsd)}`
|
|
678
672
|
);
|
|
679
673
|
return;
|
|
680
674
|
}
|
|
681
|
-
tokenAmountStr = (numericAmount / tokenPriceUsd).toString();
|
|
682
|
-
} else {
|
|
683
|
-
tokenAmountStr = numericAmount.toString();
|
|
684
675
|
}
|
|
676
|
+
const tokenAmountStr = sourceAmount.toString();
|
|
685
677
|
let amountInUnits;
|
|
686
678
|
try {
|
|
687
679
|
amountInUnits = _viem.parseUnits.call(void 0, tokenAmountStr, asset.decimals);
|
|
@@ -690,11 +682,11 @@ function AmountStep({
|
|
|
690
682
|
return;
|
|
691
683
|
}
|
|
692
684
|
if (balance !== null && amountInUnits > balance) {
|
|
693
|
-
|
|
694
|
-
|
|
685
|
+
setError("Insufficient balance");
|
|
686
|
+
return;
|
|
695
687
|
}
|
|
696
688
|
setError(null);
|
|
697
|
-
onContinue(tokenAmountStr, _nullishCoalesce(balance, () => ( void 0)));
|
|
689
|
+
onContinue(tokenAmountStr, amount, _nullishCoalesce(balance, () => ( void 0)));
|
|
698
690
|
};
|
|
699
691
|
const handleSwitch = async () => {
|
|
700
692
|
if (!asset.chainId || !switchChain) return;
|
|
@@ -711,7 +703,7 @@ function AmountStep({
|
|
|
711
703
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
712
704
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body", style: { paddingTop: 0 }, children: [
|
|
713
705
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-display", children: [
|
|
714
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-amount-input-wrapper", children:
|
|
706
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-amount-input-wrapper", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
715
707
|
"input",
|
|
716
708
|
{
|
|
717
709
|
type: "text",
|
|
@@ -728,30 +720,8 @@ function AmountStep({
|
|
|
728
720
|
},
|
|
729
721
|
autoFocus: true
|
|
730
722
|
}
|
|
731
|
-
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
732
|
-
"input",
|
|
733
|
-
{
|
|
734
|
-
type: "text",
|
|
735
|
-
inputMode: "decimal",
|
|
736
|
-
className: "rs-amount-input-large",
|
|
737
|
-
placeholder: `0.00 ${asset.symbol}`,
|
|
738
|
-
value: amount,
|
|
739
|
-
onChange: (e) => {
|
|
740
|
-
const raw = e.target.value.replace(/[^0-9.]/g, "");
|
|
741
|
-
const parts = raw.split(".");
|
|
742
|
-
if (parts.length > 2) return;
|
|
743
|
-
setAmount(raw);
|
|
744
|
-
if (error) setError(null);
|
|
745
|
-
},
|
|
746
|
-
autoFocus: true
|
|
747
|
-
}
|
|
748
723
|
) }),
|
|
749
|
-
|
|
750
|
-
formattedTokenAmount,
|
|
751
|
-
" ",
|
|
752
|
-
asset.symbol
|
|
753
|
-
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-amount-token-value", style: { color: "var(--rs-muted-foreground)" }, children: "Price unavailable" }),
|
|
754
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-amount-available", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-amount-available-value", children: [
|
|
724
|
+
!isSourceStablecoin && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-amount-available", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-amount-available-value", children: [
|
|
755
725
|
formattedBalance,
|
|
756
726
|
" ",
|
|
757
727
|
asset.symbol,
|
|
@@ -759,7 +729,7 @@ function AmountStep({
|
|
|
759
729
|
hasPricing && balanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { style: { color: "var(--rs-muted-foreground)" }, children: [
|
|
760
730
|
" ",
|
|
761
731
|
"(",
|
|
762
|
-
|
|
732
|
+
_chunkYIHOACM3cjs.currencyFormatter.format(balanceUsd),
|
|
763
733
|
")"
|
|
764
734
|
] })
|
|
765
735
|
] }) })
|
|
@@ -773,26 +743,26 @@ function AmountStep({
|
|
|
773
743
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-flow-pill-label", children: "You send" }),
|
|
774
744
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token", children: [
|
|
775
745
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token-icon-wrapper", children: [
|
|
776
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children:
|
|
746
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children: _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, asset.symbol) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
777
747
|
"img",
|
|
778
748
|
{
|
|
779
|
-
src:
|
|
749
|
+
src: _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, asset.symbol),
|
|
780
750
|
alt: asset.symbol
|
|
781
751
|
}
|
|
782
752
|
) : asset.symbol.slice(0, 2) }),
|
|
783
753
|
(() => {
|
|
784
|
-
const chainIcon =
|
|
754
|
+
const chainIcon = _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, asset.chainId);
|
|
785
755
|
if (chainIcon) {
|
|
786
756
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
787
757
|
"img",
|
|
788
758
|
{
|
|
789
759
|
src: chainIcon,
|
|
790
|
-
alt:
|
|
760
|
+
alt: _chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId),
|
|
791
761
|
className: "rs-flow-pill-chain-badge"
|
|
792
762
|
}
|
|
793
763
|
);
|
|
794
764
|
}
|
|
795
|
-
const badge =
|
|
765
|
+
const badge = _chunkS4UBVD3Hcjs.getChainBadge.call(void 0, asset.chainId);
|
|
796
766
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
797
767
|
"div",
|
|
798
768
|
{
|
|
@@ -830,26 +800,26 @@ function AmountStep({
|
|
|
830
800
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-flow-pill-label", children: "You receive" }),
|
|
831
801
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token", children: [
|
|
832
802
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token-icon-wrapper", children: [
|
|
833
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children:
|
|
803
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children: _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, targetSymbol) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
834
804
|
"img",
|
|
835
805
|
{
|
|
836
|
-
src:
|
|
806
|
+
src: _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, targetSymbol),
|
|
837
807
|
alt: targetSymbol
|
|
838
808
|
}
|
|
839
809
|
) : targetSymbol.slice(0, 2) }),
|
|
840
810
|
(() => {
|
|
841
|
-
const chainIcon =
|
|
811
|
+
const chainIcon = _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, targetChain);
|
|
842
812
|
if (chainIcon) {
|
|
843
813
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
844
814
|
"img",
|
|
845
815
|
{
|
|
846
816
|
src: chainIcon,
|
|
847
|
-
alt:
|
|
817
|
+
alt: _chunkS4UBVD3Hcjs.getChainName.call(void 0, targetChain),
|
|
848
818
|
className: "rs-flow-pill-chain-badge"
|
|
849
819
|
}
|
|
850
820
|
);
|
|
851
821
|
}
|
|
852
|
-
const badge =
|
|
822
|
+
const badge = _chunkS4UBVD3Hcjs.getChainBadge.call(void 0, targetChain);
|
|
853
823
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
854
824
|
"div",
|
|
855
825
|
{
|
|
@@ -895,22 +865,13 @@ function AmountStep({
|
|
|
895
865
|
}
|
|
896
866
|
)
|
|
897
867
|
] }),
|
|
898
|
-
chainMismatch && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch", style: { marginTop: 16 }, children: [
|
|
868
|
+
chainMismatch && !isSwitching && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch", style: { marginTop: 16 }, children: [
|
|
899
869
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch-text", children: [
|
|
900
870
|
"Switch your wallet to ",
|
|
901
|
-
|
|
871
|
+
_chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId),
|
|
902
872
|
" to continue."
|
|
903
873
|
] }),
|
|
904
|
-
switchChain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
905
|
-
_chunkKIRDZLOScjs.Button,
|
|
906
|
-
{
|
|
907
|
-
variant: "outline",
|
|
908
|
-
size: "small",
|
|
909
|
-
loading: isSwitching,
|
|
910
|
-
onClick: handleSwitch,
|
|
911
|
-
children: "Switch"
|
|
912
|
-
}
|
|
913
|
-
)
|
|
874
|
+
switchChain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYIHOACM3cjs.Button, { variant: "outline", size: "small", onClick: handleSwitch, children: "Switch" })
|
|
914
875
|
] }),
|
|
915
876
|
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error", children: [
|
|
916
877
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -935,7 +896,7 @@ function AmountStep({
|
|
|
935
896
|
] })
|
|
936
897
|
] }),
|
|
937
898
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
938
|
-
|
|
899
|
+
_chunkYIHOACM3cjs.Button,
|
|
939
900
|
{
|
|
940
901
|
onClick: handleContinue,
|
|
941
902
|
fullWidth: true,
|
|
@@ -943,7 +904,7 @@ function AmountStep({
|
|
|
943
904
|
children: "Continue"
|
|
944
905
|
}
|
|
945
906
|
) }),
|
|
946
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
907
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYIHOACM3cjs.PoweredBy, {})
|
|
947
908
|
] });
|
|
948
909
|
}
|
|
949
910
|
|
|
@@ -951,7 +912,6 @@ function AmountStep({
|
|
|
951
912
|
|
|
952
913
|
|
|
953
914
|
|
|
954
|
-
var STABLECOIN_SYMBOLS = /* @__PURE__ */ new Set(["USDC", "USDT", "DAI"]);
|
|
955
915
|
function ConfirmStep({
|
|
956
916
|
walletClient,
|
|
957
917
|
address,
|
|
@@ -959,6 +919,8 @@ function ConfirmStep({
|
|
|
959
919
|
recipient,
|
|
960
920
|
asset,
|
|
961
921
|
amount,
|
|
922
|
+
targetAmount,
|
|
923
|
+
targetTokenPriceUsd,
|
|
962
924
|
balance,
|
|
963
925
|
targetChain,
|
|
964
926
|
targetToken,
|
|
@@ -970,54 +932,20 @@ function ConfirmStep({
|
|
|
970
932
|
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
971
933
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
972
934
|
const [isSwitching, setIsSwitching] = _react.useState.call(void 0, false);
|
|
973
|
-
const chainMismatch = _optionalChain([walletClient, 'optionalAccess',
|
|
935
|
+
const chainMismatch = _optionalChain([walletClient, 'optionalAccess', _13 => _13.chain, 'optionalAccess', _14 => _14.id]) && walletClient.chain.id !== asset.chainId;
|
|
974
936
|
const sameRoute = targetChain === asset.chainId && targetToken.toLowerCase() === asset.token.toLowerCase();
|
|
975
|
-
const targetSymbol = sameRoute ? asset.symbol :
|
|
976
|
-
const
|
|
977
|
-
const
|
|
978
|
-
if (
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
return asset.balanceUsd / balanceUnits;
|
|
985
|
-
} catch (e11) {
|
|
986
|
-
return null;
|
|
987
|
-
}
|
|
988
|
-
}, [asset.balanceUsd, asset.balance, asset.decimals]);
|
|
989
|
-
const amountUsd = _react.useMemo.call(void 0, () => {
|
|
990
|
-
if (!amount || tokenPriceUsd === null) return null;
|
|
991
|
-
const parsed = Number(amount);
|
|
992
|
-
if (!Number.isFinite(parsed) || parsed <= 0) return null;
|
|
993
|
-
return parsed * tokenPriceUsd;
|
|
994
|
-
}, [amount, tokenPriceUsd]);
|
|
995
|
-
const targetTokenPriceUsd = _react.useMemo.call(void 0, () => {
|
|
996
|
-
const targetSym = targetSymbol.toUpperCase();
|
|
997
|
-
const sourceSym = asset.symbol.toUpperCase();
|
|
998
|
-
if (STABLECOIN_SYMBOLS.has(targetSym)) return 1;
|
|
999
|
-
if (targetSym === sourceSym && tokenPriceUsd !== null) return tokenPriceUsd;
|
|
1000
|
-
return null;
|
|
1001
|
-
}, [targetSymbol, asset.symbol, tokenPriceUsd]);
|
|
1002
|
-
const receiveAmountUsd = _react.useMemo.call(void 0, () => {
|
|
1003
|
-
if (amountUsd === null) return null;
|
|
1004
|
-
return sameRoute ? amountUsd : amountUsd * 0.99;
|
|
1005
|
-
}, [amountUsd, sameRoute]);
|
|
1006
|
-
const receiveTokenAmount = _react.useMemo.call(void 0, () => {
|
|
1007
|
-
if (sameRoute) {
|
|
1008
|
-
const parsed = Number(amount);
|
|
1009
|
-
return Number.isFinite(parsed) ? parsed : null;
|
|
937
|
+
const targetSymbol = sameRoute ? asset.symbol : _chunkS4UBVD3Hcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
938
|
+
const formattedSendAmount = amount && !Number.isNaN(Number(amount)) ? Number(amount).toLocaleString("en-US", { maximumFractionDigits: 6 }) : "0";
|
|
939
|
+
const formattedReceiveAmount = (() => {
|
|
940
|
+
if (sameRoute) return formattedSendAmount;
|
|
941
|
+
const dollarValue = Number(targetAmount);
|
|
942
|
+
if (!Number.isFinite(dollarValue) || dollarValue <= 0) return formattedSendAmount;
|
|
943
|
+
if (targetTokenPriceUsd !== null && targetTokenPriceUsd > 0) {
|
|
944
|
+
const tokenAmount = dollarValue / targetTokenPriceUsd;
|
|
945
|
+
return tokenAmount.toLocaleString("en-US", { maximumFractionDigits: 6 });
|
|
1010
946
|
}
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
return receiveAmountUsd / targetTokenPriceUsd;
|
|
1014
|
-
}, [sameRoute, amount, receiveAmountUsd, targetTokenPriceUsd]);
|
|
1015
|
-
const formattedReceiveAmount = _react.useMemo.call(void 0, () => {
|
|
1016
|
-
if (receiveTokenAmount === null) return `~ ${formattedAmount}`;
|
|
1017
|
-
return receiveTokenAmount.toLocaleString("en-US", {
|
|
1018
|
-
maximumFractionDigits: 6
|
|
1019
|
-
});
|
|
1020
|
-
}, [receiveTokenAmount, formattedAmount]);
|
|
947
|
+
return formattedSendAmount;
|
|
948
|
+
})();
|
|
1021
949
|
const receiveAmount = sameRoute ? formattedReceiveAmount : `~ ${formattedReceiveAmount}`;
|
|
1022
950
|
const handleConfirm = async () => {
|
|
1023
951
|
if (!address || !walletClient) {
|
|
@@ -1025,7 +953,7 @@ function ConfirmStep({
|
|
|
1025
953
|
return;
|
|
1026
954
|
}
|
|
1027
955
|
if (chainMismatch) {
|
|
1028
|
-
setError(`Switch to ${
|
|
956
|
+
setError(`Switch to ${_chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId)} to sign`);
|
|
1029
957
|
return;
|
|
1030
958
|
}
|
|
1031
959
|
const parsedAmount = parseFloat(amount);
|
|
@@ -1036,7 +964,7 @@ function ConfirmStep({
|
|
|
1036
964
|
let amountUnits;
|
|
1037
965
|
try {
|
|
1038
966
|
amountUnits = _viem.parseUnits.call(void 0, amount, asset.decimals);
|
|
1039
|
-
} catch (
|
|
967
|
+
} catch (e11) {
|
|
1040
968
|
setError("Please enter a valid amount");
|
|
1041
969
|
return;
|
|
1042
970
|
}
|
|
@@ -1053,7 +981,7 @@ function ConfirmStep({
|
|
|
1053
981
|
throw new Error("Wallet not properly connected");
|
|
1054
982
|
}
|
|
1055
983
|
const transferTo = sameRoute ? recipient : smartAccount;
|
|
1056
|
-
const hash =
|
|
984
|
+
const hash = _chunkYIHOACM3cjs.isNativeAsset.call(void 0, asset) ? await walletClient.sendTransaction({
|
|
1057
985
|
account,
|
|
1058
986
|
chain,
|
|
1059
987
|
to: transferTo,
|
|
@@ -1066,13 +994,13 @@ function ConfirmStep({
|
|
|
1066
994
|
functionName: "transfer",
|
|
1067
995
|
args: [transferTo, amountUnits]
|
|
1068
996
|
});
|
|
1069
|
-
_optionalChain([onDepositSubmitted, 'optionalCall',
|
|
997
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _15 => _15(hash, asset.chainId, amountUnits.toString())]);
|
|
1070
998
|
onConfirm(hash, asset.chainId, amountUnits.toString(), asset.token);
|
|
1071
999
|
} catch (err) {
|
|
1072
1000
|
const raw = err instanceof Error ? err.message : "Transfer failed";
|
|
1073
|
-
const message =
|
|
1001
|
+
const message = _chunkYIHOACM3cjs.formatUserError.call(void 0, raw);
|
|
1074
1002
|
setError(message);
|
|
1075
|
-
_optionalChain([onError, 'optionalCall',
|
|
1003
|
+
_optionalChain([onError, 'optionalCall', _16 => _16(message, "TRANSFER_ERROR")]);
|
|
1076
1004
|
} finally {
|
|
1077
1005
|
setIsSubmitting(false);
|
|
1078
1006
|
}
|
|
@@ -1084,7 +1012,7 @@ function ConfirmStep({
|
|
|
1084
1012
|
await switchChain(asset.chainId);
|
|
1085
1013
|
} catch (err) {
|
|
1086
1014
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
1087
|
-
setError(
|
|
1015
|
+
setError(_chunkYIHOACM3cjs.formatUserError.call(void 0, raw));
|
|
1088
1016
|
} finally {
|
|
1089
1017
|
setIsSwitching(false);
|
|
1090
1018
|
}
|
|
@@ -1101,15 +1029,15 @@ function ConfirmStep({
|
|
|
1101
1029
|
className: "rs-card-value",
|
|
1102
1030
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
1103
1031
|
children: [
|
|
1104
|
-
|
|
1032
|
+
_chunkS4UBVD3Hcjs.getChainIcon.call(void 0, asset.chainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1105
1033
|
"img",
|
|
1106
1034
|
{
|
|
1107
|
-
src:
|
|
1035
|
+
src: _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, asset.chainId),
|
|
1108
1036
|
alt: "",
|
|
1109
|
-
style: { width: 16, height: 16, borderRadius:
|
|
1037
|
+
style: { width: 16, height: 16, borderRadius: 3 }
|
|
1110
1038
|
}
|
|
1111
1039
|
),
|
|
1112
|
-
|
|
1040
|
+
_chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId)
|
|
1113
1041
|
]
|
|
1114
1042
|
}
|
|
1115
1043
|
)
|
|
@@ -1122,15 +1050,15 @@ function ConfirmStep({
|
|
|
1122
1050
|
className: "rs-card-value",
|
|
1123
1051
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
1124
1052
|
children: [
|
|
1125
|
-
|
|
1053
|
+
_chunkS4UBVD3Hcjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1126
1054
|
"img",
|
|
1127
1055
|
{
|
|
1128
|
-
src:
|
|
1056
|
+
src: _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, targetChain),
|
|
1129
1057
|
alt: "",
|
|
1130
|
-
style: { width: 16, height: 16, borderRadius:
|
|
1058
|
+
style: { width: 16, height: 16, borderRadius: 3 }
|
|
1131
1059
|
}
|
|
1132
1060
|
),
|
|
1133
|
-
|
|
1061
|
+
_chunkS4UBVD3Hcjs.getChainName.call(void 0, targetChain)
|
|
1134
1062
|
]
|
|
1135
1063
|
}
|
|
1136
1064
|
)
|
|
@@ -1149,15 +1077,15 @@ function ConfirmStep({
|
|
|
1149
1077
|
className: "rs-card-value",
|
|
1150
1078
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
1151
1079
|
children: [
|
|
1152
|
-
|
|
1080
|
+
_chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, asset.symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1153
1081
|
"img",
|
|
1154
1082
|
{
|
|
1155
|
-
src:
|
|
1083
|
+
src: _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, asset.symbol),
|
|
1156
1084
|
alt: "",
|
|
1157
1085
|
style: { width: 16, height: 16, borderRadius: "50%" }
|
|
1158
1086
|
}
|
|
1159
1087
|
),
|
|
1160
|
-
|
|
1088
|
+
formattedSendAmount,
|
|
1161
1089
|
" ",
|
|
1162
1090
|
asset.symbol
|
|
1163
1091
|
]
|
|
@@ -1172,10 +1100,10 @@ function ConfirmStep({
|
|
|
1172
1100
|
className: "rs-card-value",
|
|
1173
1101
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
1174
1102
|
children: [
|
|
1175
|
-
|
|
1103
|
+
_chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, targetSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1176
1104
|
"img",
|
|
1177
1105
|
{
|
|
1178
|
-
src:
|
|
1106
|
+
src: _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, targetSymbol),
|
|
1179
1107
|
alt: "",
|
|
1180
1108
|
style: { width: 16, height: 16, borderRadius: "50%" }
|
|
1181
1109
|
}
|
|
@@ -1186,20 +1114,16 @@ function ConfirmStep({
|
|
|
1186
1114
|
]
|
|
1187
1115
|
}
|
|
1188
1116
|
)
|
|
1189
|
-
] }),
|
|
1190
|
-
receiveAmountUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
|
|
1191
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "Value" }),
|
|
1192
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-value", children: _chunkKIRDZLOScjs.currencyFormatter.format(receiveAmountUsd) })
|
|
1193
1117
|
] })
|
|
1194
1118
|
] }),
|
|
1195
1119
|
chainMismatch && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch", children: [
|
|
1196
1120
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch-text", children: [
|
|
1197
1121
|
"Switch your wallet to ",
|
|
1198
|
-
|
|
1122
|
+
_chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId),
|
|
1199
1123
|
" to sign."
|
|
1200
1124
|
] }),
|
|
1201
1125
|
switchChain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1202
|
-
|
|
1126
|
+
_chunkYIHOACM3cjs.Button,
|
|
1203
1127
|
{
|
|
1204
1128
|
variant: "outline",
|
|
1205
1129
|
size: "small",
|
|
@@ -1232,7 +1156,7 @@ function ConfirmStep({
|
|
|
1232
1156
|
] })
|
|
1233
1157
|
] }),
|
|
1234
1158
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1235
|
-
|
|
1159
|
+
_chunkYIHOACM3cjs.Button,
|
|
1236
1160
|
{
|
|
1237
1161
|
onClick: handleConfirm,
|
|
1238
1162
|
loading: isSubmitting,
|
|
@@ -1241,7 +1165,7 @@ function ConfirmStep({
|
|
|
1241
1165
|
children: "Confirm Order"
|
|
1242
1166
|
}
|
|
1243
1167
|
) }),
|
|
1244
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1168
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYIHOACM3cjs.PoweredBy, {})
|
|
1245
1169
|
] });
|
|
1246
1170
|
}
|
|
1247
1171
|
|
|
@@ -1363,7 +1287,7 @@ function asAddress(value) {
|
|
|
1363
1287
|
return /^0x[a-fA-F0-9]{40}$/.test(value) ? value : void 0;
|
|
1364
1288
|
}
|
|
1365
1289
|
function getDepositEventDetails(event) {
|
|
1366
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
1290
|
+
if (!_optionalChain([event, 'optionalAccess', _17 => _17.type]) || !isRecord(event.data)) return {};
|
|
1367
1291
|
if (event.type === "deposit-received") {
|
|
1368
1292
|
return {
|
|
1369
1293
|
chainId: asNumber(event.data.chain),
|
|
@@ -1374,8 +1298,8 @@ function getDepositEventDetails(event) {
|
|
|
1374
1298
|
if (event.type === "bridge-started") {
|
|
1375
1299
|
const source = isRecord(event.data.source) ? event.data.source : void 0;
|
|
1376
1300
|
return {
|
|
1377
|
-
chainId: asNumber(_optionalChain([source, 'optionalAccess',
|
|
1378
|
-
token: asAddress(_optionalChain([source, 'optionalAccess',
|
|
1301
|
+
chainId: asNumber(_optionalChain([source, 'optionalAccess', _18 => _18.chain])),
|
|
1302
|
+
token: asAddress(_optionalChain([source, 'optionalAccess', _19 => _19.asset]))
|
|
1379
1303
|
};
|
|
1380
1304
|
}
|
|
1381
1305
|
return {};
|
|
@@ -1386,12 +1310,12 @@ function DepositAddressStep({
|
|
|
1386
1310
|
onDepositDetected,
|
|
1387
1311
|
onError
|
|
1388
1312
|
}) {
|
|
1389
|
-
const supportedChainIds = _react.useMemo.call(void 0, () =>
|
|
1313
|
+
const supportedChainIds = _react.useMemo.call(void 0, () => _chunkS4UBVD3Hcjs.getSupportedChainIds.call(void 0, ), []);
|
|
1390
1314
|
const BASE_CHAIN_ID = 8453;
|
|
1391
1315
|
const defaultChainId = supportedChainIds.includes(BASE_CHAIN_ID) ? BASE_CHAIN_ID : supportedChainIds[0];
|
|
1392
1316
|
const [sourceChainId, setSourceChainId] = _react.useState.call(void 0, defaultChainId);
|
|
1393
1317
|
const tokensForChain = _react.useMemo.call(void 0,
|
|
1394
|
-
() =>
|
|
1318
|
+
() => _chunkS4UBVD3Hcjs.getTargetTokenSymbolsForChain.call(void 0, sourceChainId),
|
|
1395
1319
|
[sourceChainId]
|
|
1396
1320
|
);
|
|
1397
1321
|
const defaultToken = tokensForChain.includes("USDC") ? "USDC" : _nullishCoalesce(tokensForChain[0], () => ( "USDC"));
|
|
@@ -1421,7 +1345,7 @@ function DepositAddressStep({
|
|
|
1421
1345
|
await navigator.clipboard.writeText(smartAccount);
|
|
1422
1346
|
setCopied(true);
|
|
1423
1347
|
setTimeout(() => setCopied(false), 2e3);
|
|
1424
|
-
} catch (
|
|
1348
|
+
} catch (e12) {
|
|
1425
1349
|
const textarea = document.createElement("textarea");
|
|
1426
1350
|
textarea.value = smartAccount;
|
|
1427
1351
|
textarea.style.position = "fixed";
|
|
@@ -1446,7 +1370,7 @@ function DepositAddressStep({
|
|
|
1446
1370
|
const status = await service.fetchLatestStatus(smartAccount);
|
|
1447
1371
|
if (cancelled || depositHandledRef.current) return;
|
|
1448
1372
|
const event = status.lastEvent;
|
|
1449
|
-
const eventTxHash =
|
|
1373
|
+
const eventTxHash = _chunkYIHOACM3cjs.isDepositEvent.call(void 0, event) ? _nullishCoalesce(_optionalChain([_chunkYIHOACM3cjs.getEventTxHash.call(void 0, event), 'optionalAccess', _20 => _20.toLowerCase, 'call', _21 => _21()]), () => ( null)) : null;
|
|
1450
1374
|
if (baselineTxHash === void 0) {
|
|
1451
1375
|
baselineTxHash = eventTxHash;
|
|
1452
1376
|
} else if (eventTxHash && eventTxHash !== baselineTxHash) {
|
|
@@ -1454,7 +1378,7 @@ function DepositAddressStep({
|
|
|
1454
1378
|
const fallback = sourceSelectionRef.current;
|
|
1455
1379
|
const chainId = _nullishCoalesce(details.chainId, () => ( fallback.chainId));
|
|
1456
1380
|
const amount = _nullishCoalesce(details.amount, () => ( "0"));
|
|
1457
|
-
const token = _nullishCoalesce(details.token, () => (
|
|
1381
|
+
const token = _nullishCoalesce(details.token, () => ( _chunkS4UBVD3Hcjs.getTokenAddress.call(void 0, fallback.tokenSymbol, fallback.chainId)));
|
|
1458
1382
|
if (token) {
|
|
1459
1383
|
depositHandledRef.current = true;
|
|
1460
1384
|
onDepositDetected(eventTxHash, chainId, amount, token);
|
|
@@ -1466,7 +1390,7 @@ function DepositAddressStep({
|
|
|
1466
1390
|
if (!cancelled) {
|
|
1467
1391
|
const msg = err instanceof Error ? err.message : "Failed to check status";
|
|
1468
1392
|
setPollingError(msg);
|
|
1469
|
-
_optionalChain([onError, 'optionalCall',
|
|
1393
|
+
_optionalChain([onError, 'optionalCall', _22 => _22(msg, "STATUS_POLL_ERROR")]);
|
|
1470
1394
|
}
|
|
1471
1395
|
}
|
|
1472
1396
|
if (!cancelled && !depositHandledRef.current) {
|
|
@@ -1479,7 +1403,7 @@ function DepositAddressStep({
|
|
|
1479
1403
|
clearTimeout(timeoutId);
|
|
1480
1404
|
};
|
|
1481
1405
|
}, [smartAccount, service, onDepositDetected, onError]);
|
|
1482
|
-
const chainIconSrc =
|
|
1406
|
+
const chainIconSrc = _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, sourceChainId);
|
|
1483
1407
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
1484
1408
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-body", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address", children: [
|
|
1485
1409
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-selectors", children: [
|
|
@@ -1495,10 +1419,10 @@ function DepositAddressStep({
|
|
|
1495
1419
|
setChainDropdownOpen(false);
|
|
1496
1420
|
},
|
|
1497
1421
|
children: [
|
|
1498
|
-
|
|
1422
|
+
_chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, sourceTokenSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1499
1423
|
"img",
|
|
1500
1424
|
{
|
|
1501
|
-
src:
|
|
1425
|
+
src: _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, sourceTokenSymbol),
|
|
1502
1426
|
alt: "",
|
|
1503
1427
|
className: "rs-deposit-address-dropdown-icon"
|
|
1504
1428
|
}
|
|
@@ -1535,10 +1459,10 @@ function DepositAddressStep({
|
|
|
1535
1459
|
setTokenDropdownOpen(false);
|
|
1536
1460
|
},
|
|
1537
1461
|
children: [
|
|
1538
|
-
|
|
1462
|
+
_chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1539
1463
|
"img",
|
|
1540
1464
|
{
|
|
1541
|
-
src:
|
|
1465
|
+
src: _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, symbol),
|
|
1542
1466
|
alt: "",
|
|
1543
1467
|
className: "rs-deposit-address-dropdown-icon"
|
|
1544
1468
|
}
|
|
@@ -1561,15 +1485,15 @@ function DepositAddressStep({
|
|
|
1561
1485
|
setTokenDropdownOpen(false);
|
|
1562
1486
|
},
|
|
1563
1487
|
children: [
|
|
1564
|
-
|
|
1488
|
+
_chunkS4UBVD3Hcjs.getChainIcon.call(void 0, sourceChainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1565
1489
|
"img",
|
|
1566
1490
|
{
|
|
1567
|
-
src:
|
|
1491
|
+
src: _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, sourceChainId),
|
|
1568
1492
|
alt: "",
|
|
1569
1493
|
className: "rs-deposit-address-dropdown-icon"
|
|
1570
1494
|
}
|
|
1571
1495
|
),
|
|
1572
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
1496
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkS4UBVD3Hcjs.getChainName.call(void 0, sourceChainId) }),
|
|
1573
1497
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1574
1498
|
"svg",
|
|
1575
1499
|
{
|
|
@@ -1601,15 +1525,15 @@ function DepositAddressStep({
|
|
|
1601
1525
|
setChainDropdownOpen(false);
|
|
1602
1526
|
},
|
|
1603
1527
|
children: [
|
|
1604
|
-
|
|
1528
|
+
_chunkS4UBVD3Hcjs.getChainIcon.call(void 0, chainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1605
1529
|
"img",
|
|
1606
1530
|
{
|
|
1607
|
-
src:
|
|
1531
|
+
src: _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, chainId),
|
|
1608
1532
|
alt: "",
|
|
1609
1533
|
className: "rs-deposit-address-dropdown-icon"
|
|
1610
1534
|
}
|
|
1611
1535
|
),
|
|
1612
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
1536
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkS4UBVD3Hcjs.getChainName.call(void 0, chainId) })
|
|
1613
1537
|
]
|
|
1614
1538
|
},
|
|
1615
1539
|
chainId
|
|
@@ -1659,7 +1583,7 @@ function DepositAddressStep({
|
|
|
1659
1583
|
] }),
|
|
1660
1584
|
pollingError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-error", children: pollingError })
|
|
1661
1585
|
] }) }),
|
|
1662
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1586
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYIHOACM3cjs.PoweredBy, {})
|
|
1663
1587
|
] });
|
|
1664
1588
|
}
|
|
1665
1589
|
DepositAddressStep.displayName = "DepositAddressStep";
|
|
@@ -1680,12 +1604,13 @@ function DepositFlow({
|
|
|
1680
1604
|
sourceToken: defaultSourceToken,
|
|
1681
1605
|
amount: defaultAmount,
|
|
1682
1606
|
recipient,
|
|
1683
|
-
signerAddress =
|
|
1607
|
+
signerAddress = _chunkS4UBVD3Hcjs.DEFAULT_SIGNER_ADDRESS,
|
|
1684
1608
|
sessionChainIds,
|
|
1685
1609
|
forceRegister = false,
|
|
1686
1610
|
waitForFinalTx = true,
|
|
1687
1611
|
reownWallet,
|
|
1688
1612
|
onConnect,
|
|
1613
|
+
onDisconnect,
|
|
1689
1614
|
onRequestConnect,
|
|
1690
1615
|
connectButtonLabel,
|
|
1691
1616
|
uiConfig,
|
|
@@ -1704,16 +1629,33 @@ function DepositFlow({
|
|
|
1704
1629
|
const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, 0);
|
|
1705
1630
|
const [isConnectSelectionConfirmed, setIsConnectSelectionConfirmed] = _react.useState.call(void 0, false);
|
|
1706
1631
|
const [selectedConnectAddress, setSelectedConnectAddress] = _react.useState.call(void 0, null);
|
|
1632
|
+
const portfolioAssetsRef = _react.useRef.call(void 0, []);
|
|
1633
|
+
const handleAssetsLoaded = _react.useCallback.call(void 0, (assets) => {
|
|
1634
|
+
portfolioAssetsRef.current = assets;
|
|
1635
|
+
}, []);
|
|
1636
|
+
const getTokenPriceUsd = _react.useCallback.call(void 0, (symbol) => {
|
|
1637
|
+
const sym = symbol.toLowerCase();
|
|
1638
|
+
for (const asset of portfolioAssetsRef.current) {
|
|
1639
|
+
if (asset.symbol.toLowerCase() === sym && asset.balanceUsd && asset.balance) {
|
|
1640
|
+
try {
|
|
1641
|
+
const balanceUnits = Number(asset.balance) / 10 ** asset.decimals;
|
|
1642
|
+
if (balanceUnits > 0) return asset.balanceUsd / balanceUnits;
|
|
1643
|
+
} catch (e13) {
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
return null;
|
|
1648
|
+
}, []);
|
|
1707
1649
|
const dappSwitchChain = _react.useMemo.call(void 0, () => {
|
|
1708
|
-
if (!_optionalChain([dappWalletClient, 'optionalAccess',
|
|
1650
|
+
if (!_optionalChain([dappWalletClient, 'optionalAccess', _23 => _23.switchChain])) return void 0;
|
|
1709
1651
|
return async (chainId) => {
|
|
1710
|
-
await _optionalChain([dappWalletClient, 'access',
|
|
1652
|
+
await _optionalChain([dappWalletClient, 'access', _24 => _24.switchChain, 'optionalCall', _25 => _25({ id: chainId })]);
|
|
1711
1653
|
};
|
|
1712
1654
|
}, [dappWalletClient]);
|
|
1713
1655
|
const walletOptions = _react.useMemo.call(void 0, () => {
|
|
1714
1656
|
const options = [];
|
|
1715
1657
|
const seen = /* @__PURE__ */ new Set();
|
|
1716
|
-
if (_optionalChain([dappWalletClient, 'optionalAccess',
|
|
1658
|
+
if (_optionalChain([dappWalletClient, 'optionalAccess', _26 => _26.account]) && dappAddress) {
|
|
1717
1659
|
options.push({
|
|
1718
1660
|
address: dappWalletClient.account.address,
|
|
1719
1661
|
label: "Connected Wallet",
|
|
@@ -1721,21 +1663,23 @@ function DepositFlow({
|
|
|
1721
1663
|
});
|
|
1722
1664
|
seen.add(dappWalletClient.account.address.toLowerCase());
|
|
1723
1665
|
}
|
|
1724
|
-
if (_optionalChain([reownWallet, 'optionalAccess',
|
|
1666
|
+
if (_optionalChain([reownWallet, 'optionalAccess', _27 => _27.address]) && reownWallet.isConnected && !seen.has(reownWallet.address.toLowerCase())) {
|
|
1725
1667
|
options.push({
|
|
1726
1668
|
address: reownWallet.address,
|
|
1727
1669
|
label: "External Wallet",
|
|
1728
|
-
kind: "external"
|
|
1670
|
+
kind: "external",
|
|
1671
|
+
icon: reownWallet.icon
|
|
1729
1672
|
});
|
|
1730
1673
|
}
|
|
1731
1674
|
return options;
|
|
1732
1675
|
}, [
|
|
1733
1676
|
dappWalletClient,
|
|
1734
1677
|
dappAddress,
|
|
1735
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
1736
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
1678
|
+
_optionalChain([reownWallet, 'optionalAccess', _28 => _28.address]),
|
|
1679
|
+
_optionalChain([reownWallet, 'optionalAccess', _29 => _29.isConnected]),
|
|
1680
|
+
_optionalChain([reownWallet, 'optionalAccess', _30 => _30.icon])
|
|
1737
1681
|
]);
|
|
1738
|
-
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess',
|
|
1682
|
+
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess', _31 => _31.account]) && dappAddress && !reownWallet;
|
|
1739
1683
|
const hasWalletOptions = walletOptions.length > 0;
|
|
1740
1684
|
const showConnectStep = !canAutoLock && !isConnectSelectionConfirmed;
|
|
1741
1685
|
const signerContext = _react.useMemo.call(void 0, () => {
|
|
@@ -1744,30 +1688,30 @@ function DepositFlow({
|
|
|
1744
1688
|
return {
|
|
1745
1689
|
ownerAddress: dappAddress,
|
|
1746
1690
|
walletClient: void 0,
|
|
1747
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
1691
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkYIHOACM3cjs.getPublicClient.call(void 0, targetChain))),
|
|
1748
1692
|
switchChain: void 0
|
|
1749
1693
|
};
|
|
1750
1694
|
}
|
|
1751
1695
|
if (canAutoLock) {
|
|
1752
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
1696
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _32 => _32.chain, 'optionalAccess', _33 => _33.id]), () => ( targetChain));
|
|
1753
1697
|
return {
|
|
1754
1698
|
ownerAddress: dappWalletClient.account.address,
|
|
1755
1699
|
walletClient: dappWalletClient,
|
|
1756
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
1700
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkYIHOACM3cjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
1757
1701
|
switchChain: dappSwitchChain
|
|
1758
1702
|
};
|
|
1759
1703
|
}
|
|
1760
1704
|
if (!isConnectSelectionConfirmed || !selectedConnectAddress) return null;
|
|
1761
|
-
if (_optionalChain([dappWalletClient, 'optionalAccess',
|
|
1762
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
1705
|
+
if (_optionalChain([dappWalletClient, 'optionalAccess', _34 => _34.account]) && dappWalletClient.account.address.toLowerCase() === selectedConnectAddress.toLowerCase()) {
|
|
1706
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _35 => _35.chain, 'optionalAccess', _36 => _36.id]), () => ( targetChain));
|
|
1763
1707
|
return {
|
|
1764
1708
|
ownerAddress: dappWalletClient.account.address,
|
|
1765
1709
|
walletClient: dappWalletClient,
|
|
1766
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
1710
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkYIHOACM3cjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
1767
1711
|
switchChain: dappSwitchChain
|
|
1768
1712
|
};
|
|
1769
1713
|
}
|
|
1770
|
-
if (_optionalChain([reownWallet, 'optionalAccess',
|
|
1714
|
+
if (_optionalChain([reownWallet, 'optionalAccess', _37 => _37.address, 'optionalAccess', _38 => _38.toLowerCase, 'call', _39 => _39()]) === selectedConnectAddress.toLowerCase() && reownWallet.walletClient && reownWallet.publicClient) {
|
|
1771
1715
|
return {
|
|
1772
1716
|
ownerAddress: reownWallet.address,
|
|
1773
1717
|
walletClient: reownWallet.walletClient,
|
|
@@ -1788,7 +1732,7 @@ function DepositFlow({
|
|
|
1788
1732
|
reownWallet,
|
|
1789
1733
|
targetChain
|
|
1790
1734
|
]);
|
|
1791
|
-
const sessionKeyAddress = _nullishCoalesce(_nullishCoalesce(dappAddress, () => ( _optionalChain([signerContext, 'optionalAccess',
|
|
1735
|
+
const sessionKeyAddress = _nullishCoalesce(_nullishCoalesce(dappAddress, () => ( _optionalChain([signerContext, 'optionalAccess', _40 => _40.ownerAddress]))), () => ( null));
|
|
1792
1736
|
const lastTargetRef = _react.useRef.call(void 0, null);
|
|
1793
1737
|
_react.useEffect.call(void 0, () => {
|
|
1794
1738
|
const prev = lastTargetRef.current;
|
|
@@ -1807,6 +1751,7 @@ function DepositFlow({
|
|
|
1807
1751
|
}, []);
|
|
1808
1752
|
const handleBackFromSelectAsset = _react.useCallback.call(void 0, () => {
|
|
1809
1753
|
if (hasWalletOptions || reownWallet) {
|
|
1754
|
+
hasNavigatedBackRef.current = true;
|
|
1810
1755
|
setIsConnectSelectionConfirmed(false);
|
|
1811
1756
|
}
|
|
1812
1757
|
}, [hasWalletOptions, reownWallet]);
|
|
@@ -1814,6 +1759,7 @@ function DepositFlow({
|
|
|
1814
1759
|
setFlowMode(null);
|
|
1815
1760
|
setStep({ type: "setup" });
|
|
1816
1761
|
if (hasWalletOptions || reownWallet) {
|
|
1762
|
+
hasNavigatedBackRef.current = true;
|
|
1817
1763
|
setIsConnectSelectionConfirmed(false);
|
|
1818
1764
|
}
|
|
1819
1765
|
}, [hasWalletOptions, reownWallet]);
|
|
@@ -1823,18 +1769,17 @@ function DepositFlow({
|
|
|
1823
1769
|
return {
|
|
1824
1770
|
type: "amount",
|
|
1825
1771
|
smartAccount: prev.smartAccount,
|
|
1826
|
-
asset: prev.asset
|
|
1827
|
-
amount: prev.amount
|
|
1772
|
+
asset: prev.asset
|
|
1828
1773
|
};
|
|
1829
1774
|
});
|
|
1830
1775
|
}, []);
|
|
1831
1776
|
const stepIndex = step.type === "setup" ? 0 : step.type === "deposit-address" ? 1 : step.type === "select-asset" ? 1 : step.type === "amount" ? 2 : step.type === "confirm" ? 3 : 4;
|
|
1832
1777
|
const currentBackHandler = step.type === "deposit-address" ? handleBackFromDepositAddress : step.type === "select-asset" && signerContext && !canAutoLock ? handleBackFromSelectAsset : step.type === "amount" ? handleBackFromAmount : step.type === "confirm" ? handleBackFromConfirm : void 0;
|
|
1833
1778
|
_react.useEffect.call(void 0, () => {
|
|
1834
|
-
_optionalChain([onStepChange, 'optionalCall',
|
|
1779
|
+
_optionalChain([onStepChange, 'optionalCall', _41 => _41(stepIndex, currentBackHandler)]);
|
|
1835
1780
|
}, [stepIndex, currentBackHandler, onStepChange]);
|
|
1836
1781
|
_react.useEffect.call(void 0, () => {
|
|
1837
|
-
_optionalChain([onTotalBalanceChange, 'optionalCall',
|
|
1782
|
+
_optionalChain([onTotalBalanceChange, 'optionalCall', _42 => _42(totalBalanceUsd)]);
|
|
1838
1783
|
}, [totalBalanceUsd, onTotalBalanceChange]);
|
|
1839
1784
|
const isDepositAddressMode = flowMode === "deposit-address";
|
|
1840
1785
|
const handleSelectProvider = _react.useCallback.call(void 0, () => {
|
|
@@ -1872,13 +1817,13 @@ function DepositFlow({
|
|
|
1872
1817
|
directTransfer: isSameRoute(chainId, token, targetChain, targetToken)
|
|
1873
1818
|
};
|
|
1874
1819
|
});
|
|
1875
|
-
_optionalChain([onDepositSubmitted, 'optionalCall',
|
|
1820
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _43 => _43({ txHash, sourceChain: chainId, amount })]);
|
|
1876
1821
|
},
|
|
1877
1822
|
[onDepositSubmitted, targetChain, targetToken]
|
|
1878
1823
|
);
|
|
1879
1824
|
const handleConnected = _react.useCallback.call(void 0,
|
|
1880
1825
|
(addr, smartAccount) => {
|
|
1881
|
-
_optionalChain([onConnected, 'optionalCall',
|
|
1826
|
+
_optionalChain([onConnected, 'optionalCall', _44 => _44({ address: addr, smartAccount })]);
|
|
1882
1827
|
},
|
|
1883
1828
|
[onConnected]
|
|
1884
1829
|
);
|
|
@@ -1897,7 +1842,10 @@ function DepositFlow({
|
|
|
1897
1842
|
[defaultAmount]
|
|
1898
1843
|
);
|
|
1899
1844
|
const handleAmountContinue = _react.useCallback.call(void 0,
|
|
1900
|
-
(amount, balance) => {
|
|
1845
|
+
(amount, targetAmount, balance) => {
|
|
1846
|
+
const targetSym = _chunkS4UBVD3Hcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
1847
|
+
const isTargetStable = _chunkS4UBVD3Hcjs.isStablecoinSymbol.call(void 0, targetSym);
|
|
1848
|
+
const targetTokenPriceUsd = isTargetStable ? 1 : getTokenPriceUsd(targetSym);
|
|
1901
1849
|
setStep((prev) => {
|
|
1902
1850
|
if (prev.type !== "amount") return prev;
|
|
1903
1851
|
return {
|
|
@@ -1905,11 +1853,13 @@ function DepositFlow({
|
|
|
1905
1853
|
smartAccount: prev.smartAccount,
|
|
1906
1854
|
asset: prev.asset,
|
|
1907
1855
|
amount,
|
|
1856
|
+
targetAmount,
|
|
1857
|
+
targetTokenPriceUsd,
|
|
1908
1858
|
balance
|
|
1909
1859
|
};
|
|
1910
1860
|
});
|
|
1911
1861
|
},
|
|
1912
|
-
[]
|
|
1862
|
+
[targetToken, targetChain, getTokenPriceUsd]
|
|
1913
1863
|
);
|
|
1914
1864
|
const handleDepositSubmitted = _react.useCallback.call(void 0,
|
|
1915
1865
|
(txHash, chainId, amount, token) => {
|
|
@@ -1930,25 +1880,25 @@ function DepositFlow({
|
|
|
1930
1880
|
);
|
|
1931
1881
|
const handleDepositSubmittedCallback = _react.useCallback.call(void 0,
|
|
1932
1882
|
(txHash, sourceChain, amount) => {
|
|
1933
|
-
_optionalChain([onDepositSubmitted, 'optionalCall',
|
|
1883
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _45 => _45({ txHash, sourceChain, amount })]);
|
|
1934
1884
|
},
|
|
1935
1885
|
[onDepositSubmitted]
|
|
1936
1886
|
);
|
|
1937
1887
|
const handleDepositComplete = _react.useCallback.call(void 0,
|
|
1938
1888
|
(txHash, destinationTxHash) => {
|
|
1939
|
-
_optionalChain([onDepositComplete, 'optionalCall',
|
|
1889
|
+
_optionalChain([onDepositComplete, 'optionalCall', _46 => _46({ txHash, destinationTxHash })]);
|
|
1940
1890
|
},
|
|
1941
1891
|
[onDepositComplete]
|
|
1942
1892
|
);
|
|
1943
1893
|
const handleDepositFailed = _react.useCallback.call(void 0,
|
|
1944
1894
|
(txHash, error) => {
|
|
1945
|
-
_optionalChain([onDepositFailed, 'optionalCall',
|
|
1895
|
+
_optionalChain([onDepositFailed, 'optionalCall', _47 => _47({ txHash, error })]);
|
|
1946
1896
|
},
|
|
1947
1897
|
[onDepositFailed]
|
|
1948
1898
|
);
|
|
1949
1899
|
const handleError = _react.useCallback.call(void 0,
|
|
1950
1900
|
(message, code) => {
|
|
1951
|
-
_optionalChain([onError, 'optionalCall',
|
|
1901
|
+
_optionalChain([onError, 'optionalCall', _48 => _48({ message, code })]);
|
|
1952
1902
|
},
|
|
1953
1903
|
[onError]
|
|
1954
1904
|
);
|
|
@@ -1966,12 +1916,39 @@ function DepositFlow({
|
|
|
1966
1916
|
() => walletOptions.map((option) => option.address.toLowerCase()).join(","),
|
|
1967
1917
|
[walletOptions]
|
|
1968
1918
|
);
|
|
1919
|
+
const hasNavigatedBackRef = _react.useRef.call(void 0, false);
|
|
1969
1920
|
_react.useEffect.call(void 0, () => {
|
|
1970
1921
|
setIsConnectSelectionConfirmed(false);
|
|
1971
|
-
}, [walletOptionsKey
|
|
1922
|
+
}, [walletOptionsKey]);
|
|
1923
|
+
_react.useEffect.call(void 0, () => {
|
|
1924
|
+
if (hasNavigatedBackRef.current || isConnectSelectionConfirmed || flowMode) {
|
|
1925
|
+
return;
|
|
1926
|
+
}
|
|
1927
|
+
if (hasWalletOptions) {
|
|
1928
|
+
const address = selectedConnectAddressEffective;
|
|
1929
|
+
if (address) {
|
|
1930
|
+
setSelectedConnectAddress(address);
|
|
1931
|
+
handleSelectProvider();
|
|
1932
|
+
setIsConnectSelectionConfirmed(true);
|
|
1933
|
+
return;
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
if (!hasWalletOptions && dappAddress) {
|
|
1937
|
+
handleSelectTransferCrypto();
|
|
1938
|
+
setIsConnectSelectionConfirmed(true);
|
|
1939
|
+
}
|
|
1940
|
+
}, [
|
|
1941
|
+
hasWalletOptions,
|
|
1942
|
+
isConnectSelectionConfirmed,
|
|
1943
|
+
flowMode,
|
|
1944
|
+
selectedConnectAddressEffective,
|
|
1945
|
+
dappAddress,
|
|
1946
|
+
handleSelectProvider,
|
|
1947
|
+
handleSelectTransferCrypto
|
|
1948
|
+
]);
|
|
1972
1949
|
if (showConnectStep) {
|
|
1973
1950
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1974
|
-
|
|
1951
|
+
_chunkYIHOACM3cjs.ConnectStep,
|
|
1975
1952
|
{
|
|
1976
1953
|
walletOptions,
|
|
1977
1954
|
selectedAddress: selectedConnectAddressEffective,
|
|
@@ -1982,6 +1959,7 @@ function DepositFlow({
|
|
|
1982
1959
|
} : void 0,
|
|
1983
1960
|
onRequestConnect,
|
|
1984
1961
|
onConnect,
|
|
1962
|
+
onDisconnect,
|
|
1985
1963
|
onContinue: () => {
|
|
1986
1964
|
if (selectedConnectAddressEffective) {
|
|
1987
1965
|
setSelectedConnectAddress(selectedConnectAddressEffective);
|
|
@@ -2022,14 +2000,13 @@ function DepositFlow({
|
|
|
2022
2000
|
}
|
|
2023
2001
|
),
|
|
2024
2002
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2025
|
-
|
|
2003
|
+
_chunkYIHOACM3cjs.ProcessingStep,
|
|
2026
2004
|
{
|
|
2027
2005
|
smartAccount: step.smartAccount,
|
|
2028
2006
|
txHash: step.txHash,
|
|
2029
2007
|
sourceChain: step.sourceChain,
|
|
2030
2008
|
sourceToken: step.sourceToken,
|
|
2031
2009
|
targetChain,
|
|
2032
|
-
targetToken,
|
|
2033
2010
|
amount: step.amount,
|
|
2034
2011
|
waitForFinalTx,
|
|
2035
2012
|
service,
|
|
@@ -2044,16 +2021,16 @@ function DepositFlow({
|
|
|
2044
2021
|
)
|
|
2045
2022
|
] });
|
|
2046
2023
|
}
|
|
2047
|
-
if (!_optionalChain([signerContext, 'optionalAccess',
|
|
2024
|
+
if (!_optionalChain([signerContext, 'optionalAccess', _49 => _49.walletClient]) || !_optionalChain([signerContext, 'optionalAccess', _50 => _50.publicClient])) {
|
|
2048
2025
|
return null;
|
|
2049
2026
|
}
|
|
2050
2027
|
const ownerAddress = signerContext.ownerAddress;
|
|
2051
|
-
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access',
|
|
2028
|
+
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _51 => _51.walletClient, 'optionalAccess', _52 => _52.chain, 'optionalAccess', _53 => _53.id]), () => ( _optionalChain([signerContext, 'access', _54 => _54.publicClient, 'access', _55 => _55.chain, 'optionalAccess', _56 => _56.id]))), () => ( targetChain));
|
|
2052
2029
|
const getReadClientForChain = (chainId) => {
|
|
2053
|
-
if (_optionalChain([signerContext, 'access',
|
|
2030
|
+
if (_optionalChain([signerContext, 'access', _57 => _57.publicClient, 'access', _58 => _58.chain, 'optionalAccess', _59 => _59.id]) === chainId) {
|
|
2054
2031
|
return signerContext.publicClient;
|
|
2055
2032
|
}
|
|
2056
|
-
return
|
|
2033
|
+
return _chunkYIHOACM3cjs.getPublicClient.call(void 0, chainId);
|
|
2057
2034
|
};
|
|
2058
2035
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
2059
2036
|
step.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2082,7 +2059,8 @@ function DepositFlow({
|
|
|
2082
2059
|
defaultSourceToken,
|
|
2083
2060
|
service,
|
|
2084
2061
|
onContinue: handleAssetContinue,
|
|
2085
|
-
onTotalBalanceComputed: handleTotalBalanceComputed
|
|
2062
|
+
onTotalBalanceComputed: handleTotalBalanceComputed,
|
|
2063
|
+
onAssetsLoaded: handleAssetsLoaded
|
|
2086
2064
|
}
|
|
2087
2065
|
),
|
|
2088
2066
|
step.type === "amount" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2109,6 +2087,8 @@ function DepositFlow({
|
|
|
2109
2087
|
recipient,
|
|
2110
2088
|
asset: step.asset,
|
|
2111
2089
|
amount: step.amount,
|
|
2090
|
+
targetAmount: step.targetAmount,
|
|
2091
|
+
targetTokenPriceUsd: step.targetTokenPriceUsd,
|
|
2112
2092
|
balance: step.balance,
|
|
2113
2093
|
targetChain,
|
|
2114
2094
|
targetToken,
|
|
@@ -2119,14 +2099,13 @@ function DepositFlow({
|
|
|
2119
2099
|
}
|
|
2120
2100
|
),
|
|
2121
2101
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2122
|
-
|
|
2102
|
+
_chunkYIHOACM3cjs.ProcessingStep,
|
|
2123
2103
|
{
|
|
2124
2104
|
smartAccount: step.smartAccount,
|
|
2125
2105
|
txHash: step.txHash,
|
|
2126
2106
|
sourceChain: step.sourceChain,
|
|
2127
2107
|
sourceToken: step.sourceToken,
|
|
2128
2108
|
targetChain,
|
|
2129
|
-
targetToken,
|
|
2130
2109
|
amount: step.amount,
|
|
2131
2110
|
waitForFinalTx,
|
|
2132
2111
|
service,
|
|
@@ -2144,7 +2123,7 @@ function DepositFlow({
|
|
|
2144
2123
|
// src/DepositModal.tsx
|
|
2145
2124
|
|
|
2146
2125
|
var ReownDepositInner = _react.lazy.call(void 0,
|
|
2147
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-
|
|
2126
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-XUAEWIW7.cjs"))).then((m) => ({ default: m.DepositModalReown }))
|
|
2148
2127
|
);
|
|
2149
2128
|
function DepositModal(props) {
|
|
2150
2129
|
const needsReown = !!props.reownAppId;
|
|
@@ -2167,13 +2146,14 @@ function DepositModalInner({
|
|
|
2167
2146
|
sourceToken,
|
|
2168
2147
|
defaultAmount,
|
|
2169
2148
|
recipient,
|
|
2170
|
-
backendUrl =
|
|
2171
|
-
signerAddress =
|
|
2149
|
+
backendUrl = _chunkS4UBVD3Hcjs.DEFAULT_BACKEND_URL,
|
|
2150
|
+
signerAddress = _chunkS4UBVD3Hcjs.DEFAULT_SIGNER_ADDRESS,
|
|
2172
2151
|
sessionChainIds,
|
|
2173
2152
|
forceRegister = false,
|
|
2174
2153
|
waitForFinalTx = true,
|
|
2175
2154
|
reownWallet,
|
|
2176
2155
|
onConnect,
|
|
2156
|
+
onDisconnect,
|
|
2177
2157
|
onRequestConnect,
|
|
2178
2158
|
connectButtonLabel,
|
|
2179
2159
|
theme,
|
|
@@ -2192,19 +2172,19 @@ function DepositModalInner({
|
|
|
2192
2172
|
const [currentStepIndex, setCurrentStepIndex] = _react.useState.call(void 0, 0);
|
|
2193
2173
|
const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, null);
|
|
2194
2174
|
const backHandlerRef = _react.useRef.call(void 0, void 0);
|
|
2195
|
-
const targetChain =
|
|
2196
|
-
const sourceChain = sourceChainProp ?
|
|
2197
|
-
const service = _react.useMemo.call(void 0, () =>
|
|
2175
|
+
const targetChain = _chunkS4UBVD3Hcjs.getChainId.call(void 0, targetChainProp);
|
|
2176
|
+
const sourceChain = sourceChainProp ? _chunkS4UBVD3Hcjs.getChainId.call(void 0, sourceChainProp) : void 0;
|
|
2177
|
+
const service = _react.useMemo.call(void 0, () => _chunkYIHOACM3cjs.createDepositService.call(void 0, backendUrl), [backendUrl]);
|
|
2198
2178
|
_react.useEffect.call(void 0, () => {
|
|
2199
2179
|
if (isOpen && modalRef.current) {
|
|
2200
|
-
|
|
2180
|
+
_chunkYIHOACM3cjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
2201
2181
|
}
|
|
2202
2182
|
}, [isOpen, theme]);
|
|
2203
2183
|
const hasCalledReady = _react.useRef.call(void 0, false);
|
|
2204
2184
|
_react.useEffect.call(void 0, () => {
|
|
2205
2185
|
if (isOpen && !hasCalledReady.current) {
|
|
2206
2186
|
hasCalledReady.current = true;
|
|
2207
|
-
_optionalChain([onReady, 'optionalCall',
|
|
2187
|
+
_optionalChain([onReady, 'optionalCall', _60 => _60()]);
|
|
2208
2188
|
}
|
|
2209
2189
|
}, [isOpen, onReady]);
|
|
2210
2190
|
_react.useEffect.call(void 0, () => {
|
|
@@ -2219,21 +2199,21 @@ function DepositModalInner({
|
|
|
2219
2199
|
},
|
|
2220
2200
|
[]
|
|
2221
2201
|
);
|
|
2222
|
-
const handleTotalBalanceChange = _react.useCallback.call(void 0, (
|
|
2223
|
-
setTotalBalanceUsd(
|
|
2202
|
+
const handleTotalBalanceChange = _react.useCallback.call(void 0, (balance2) => {
|
|
2203
|
+
setTotalBalanceUsd(balance2);
|
|
2224
2204
|
}, []);
|
|
2225
2205
|
const handleBack = _react.useCallback.call(void 0, () => {
|
|
2226
|
-
_optionalChain([backHandlerRef, 'access',
|
|
2206
|
+
_optionalChain([backHandlerRef, 'access', _61 => _61.current, 'optionalCall', _62 => _62()]);
|
|
2227
2207
|
}, []);
|
|
2228
|
-
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2229
|
-
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2230
|
-
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2231
|
-
const
|
|
2232
|
-
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess',
|
|
2233
|
-
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess',
|
|
2208
|
+
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _63 => _63.showLogo]), () => ( false));
|
|
2209
|
+
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _64 => _64.showStepper]), () => ( false));
|
|
2210
|
+
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _65 => _65.showBackButton]), () => ( true));
|
|
2211
|
+
const balance = _optionalChain([uiConfig, 'optionalAccess', _66 => _66.balance]);
|
|
2212
|
+
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _67 => _67.logoUrl]), () => ( "https://github.com/rhinestonewtf.png"));
|
|
2213
|
+
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _68 => _68.title]), () => ( "Deposit"));
|
|
2234
2214
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 4 && backHandlerRef.current !== void 0;
|
|
2235
2215
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2236
|
-
|
|
2216
|
+
_chunkYIHOACM3cjs.Modal,
|
|
2237
2217
|
{
|
|
2238
2218
|
isOpen,
|
|
2239
2219
|
onClose,
|
|
@@ -2289,12 +2269,12 @@ function DepositModalInner({
|
|
|
2289
2269
|
i
|
|
2290
2270
|
)) })
|
|
2291
2271
|
] }),
|
|
2292
|
-
|
|
2272
|
+
balance && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header-balance", children: [
|
|
2293
2273
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
|
|
2294
|
-
|
|
2274
|
+
balance.title,
|
|
2295
2275
|
":"
|
|
2296
2276
|
] }),
|
|
2297
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children:
|
|
2277
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ? _chunkYIHOACM3cjs.currencyFormatter.format(totalBalanceUsd) : null))) })
|
|
2298
2278
|
] })
|
|
2299
2279
|
] }),
|
|
2300
2280
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2343,6 +2323,7 @@ function DepositModalInner({
|
|
|
2343
2323
|
waitForFinalTx,
|
|
2344
2324
|
reownWallet,
|
|
2345
2325
|
onConnect,
|
|
2326
|
+
onDisconnect,
|
|
2346
2327
|
onRequestConnect,
|
|
2347
2328
|
connectButtonLabel,
|
|
2348
2329
|
uiConfig,
|