@rhinestone/deposit-modal 0.1.29 → 0.1.30
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-BVHWFWIG.mjs → DepositModalReown-OHTRNISJ.mjs} +3 -3
- package/dist/{DepositModalReown-4PFOMSC6.cjs → DepositModalReown-ZD3ROLZG.cjs} +4 -4
- package/dist/{WithdrawModalReown-CJCNT7SA.mjs → WithdrawModalReown-IJAMIPSY.mjs} +3 -3
- package/dist/{WithdrawModalReown-YREQR7DV.cjs → WithdrawModalReown-SVZQKH2X.cjs} +4 -4
- package/dist/{chunk-XTTTHW3W.mjs → chunk-BOKLFGNS.mjs} +94 -55
- package/dist/{chunk-N6T4TKXI.mjs → chunk-CIAKCO7G.mjs} +17 -20
- package/dist/{chunk-CPIQJR47.cjs → chunk-K4YSUWIT.cjs} +54 -54
- package/dist/{chunk-7ZCUANBT.cjs → chunk-KIRDZLOS.cjs} +55 -58
- package/dist/{chunk-K6YG3I6O.mjs → chunk-S76PY7GZ.mjs} +3 -3
- package/dist/{chunk-CSQRKM4Y.mjs → chunk-VL47TLTE.mjs} +5 -1
- package/dist/{chunk-DLYVHOME.cjs → chunk-WB3ZJJBH.cjs} +6 -2
- package/dist/{chunk-5QJNOPNF.cjs → chunk-WDDONQLV.cjs} +190 -151
- package/dist/constants.cjs +4 -2
- package/dist/constants.d.cts +2 -1
- package/dist/constants.d.ts +2 -1
- package/dist/constants.mjs +3 -1
- package/dist/deposit.cjs +4 -4
- package/dist/deposit.mjs +3 -3
- package/dist/index.cjs +7 -5
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +6 -4
- package/dist/reown.cjs +5 -5
- package/dist/reown.mjs +4 -4
- package/dist/withdraw.cjs +4 -4
- 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 _chunkKIRDZLOScjs = require('./chunk-KIRDZLOS.cjs');
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
@@ -36,7 +36,7 @@ var _chunk7ZCUANBTcjs = require('./chunk-7ZCUANBT.cjs');
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
var
|
|
39
|
+
var _chunkWB3ZJJBHcjs = require('./chunk-WB3ZJJBH.cjs');
|
|
40
40
|
|
|
41
41
|
// src/DepositModal.tsx
|
|
42
42
|
|
|
@@ -56,15 +56,15 @@ var _react = require('react');
|
|
|
56
56
|
|
|
57
57
|
var _jsxruntime = require('react/jsx-runtime');
|
|
58
58
|
async function resolveSessionOwner(eoaAddress) {
|
|
59
|
-
const localOwner =
|
|
59
|
+
const localOwner = _chunkKIRDZLOScjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
|
|
60
60
|
if (localOwner) {
|
|
61
61
|
return {
|
|
62
|
-
account:
|
|
62
|
+
account: _chunkKIRDZLOScjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
|
|
63
63
|
address: localOwner.address
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
-
const created =
|
|
67
|
-
|
|
66
|
+
const created = _chunkKIRDZLOScjs.createSessionOwnerKey.call(void 0, );
|
|
67
|
+
_chunkKIRDZLOScjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
|
|
68
68
|
return {
|
|
69
69
|
account: created.account,
|
|
70
70
|
address: created.address
|
|
@@ -126,7 +126,7 @@ function SetupStep({
|
|
|
126
126
|
primaryType: typedData.primaryType,
|
|
127
127
|
message: typedData.message
|
|
128
128
|
});
|
|
129
|
-
const sessionDetails =
|
|
129
|
+
const sessionDetails = _chunkKIRDZLOScjs.buildSessionDetails.call(void 0, setup.sessionDetailsUnsigned, signature);
|
|
130
130
|
setState({ type: "registering" });
|
|
131
131
|
await service.registerAccount({
|
|
132
132
|
address: smartAccount,
|
|
@@ -197,7 +197,7 @@ function SetupStep({
|
|
|
197
197
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
198
198
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", children: [
|
|
199
199
|
isLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
200
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
200
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKIRDZLOScjs.Spinner, { className: "rs-spinner--lg rs-text-accent" }),
|
|
201
201
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-text", children: [
|
|
202
202
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: renderStateMessage() }),
|
|
203
203
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-subtitle", children: "This may take a moment" })
|
|
@@ -234,7 +234,7 @@ function SetupStep({
|
|
|
234
234
|
] })
|
|
235
235
|
] })
|
|
236
236
|
] }),
|
|
237
|
-
isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
237
|
+
isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKIRDZLOScjs.Button, { onClick: handleRetry, variant: "default", fullWidth: true, children: "Try Again" }) })
|
|
238
238
|
] });
|
|
239
239
|
}
|
|
240
240
|
|
|
@@ -257,7 +257,7 @@ function AssetSelectStep({
|
|
|
257
257
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
258
258
|
const defaultAssetId = _react.useMemo.call(void 0, () => {
|
|
259
259
|
if (!defaultSourceChain || !defaultSourceToken) return null;
|
|
260
|
-
return
|
|
260
|
+
return _chunkKIRDZLOScjs.getAssetId.call(void 0, {
|
|
261
261
|
chainId: defaultSourceChain,
|
|
262
262
|
token: defaultSourceToken
|
|
263
263
|
});
|
|
@@ -274,10 +274,10 @@ function AssetSelectStep({
|
|
|
274
274
|
try {
|
|
275
275
|
const portfolio = await service.fetchPortfolio(address);
|
|
276
276
|
if (!active) return;
|
|
277
|
-
const portfolioAssets =
|
|
277
|
+
const portfolioAssets = _chunkKIRDZLOScjs.portfolioToAssets.call(void 0, portfolio.tokens);
|
|
278
278
|
setAssets(portfolioAssets);
|
|
279
279
|
const hasNative = portfolioAssets.some(
|
|
280
|
-
(asset) => asset.token.toLowerCase() ===
|
|
280
|
+
(asset) => asset.token.toLowerCase() === _chunkWB3ZJJBHcjs.NATIVE_TOKEN_ADDRESS
|
|
281
281
|
);
|
|
282
282
|
if (!hasNative) {
|
|
283
283
|
const nativeAssets = await fetchNativeAssets(
|
|
@@ -342,7 +342,7 @@ function AssetSelectStep({
|
|
|
342
342
|
const raw = _viem.formatUnits.call(void 0, BigInt(asset.balance), asset.decimals);
|
|
343
343
|
const numeric = Number(raw);
|
|
344
344
|
if (!Number.isFinite(numeric)) return raw;
|
|
345
|
-
return
|
|
345
|
+
return _chunkKIRDZLOScjs.tokenFormatter.format(numeric);
|
|
346
346
|
} catch (e3) {
|
|
347
347
|
return asset.balance;
|
|
348
348
|
}
|
|
@@ -356,7 +356,7 @@ function AssetSelectStep({
|
|
|
356
356
|
style: { paddingTop: 4, overflow: "auto", maxHeight: 340 },
|
|
357
357
|
children: [
|
|
358
358
|
loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
359
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
359
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKIRDZLOScjs.Spinner, { className: "rs-text-tertiary" }),
|
|
360
360
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
361
361
|
] }),
|
|
362
362
|
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 +389,9 @@ function AssetSelectStep({
|
|
|
389
389
|
!loading && !error && rows.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-list", children: rows.map((asset) => {
|
|
390
390
|
const isSelected = selectedAssetId === asset.id;
|
|
391
391
|
const tokenAmount = formatBalance(asset);
|
|
392
|
-
const badge =
|
|
393
|
-
const tokenIcon =
|
|
394
|
-
const chainIcon =
|
|
392
|
+
const badge = _chunkWB3ZJJBHcjs.getChainBadge.call(void 0, asset.chainId);
|
|
393
|
+
const tokenIcon = _chunkWB3ZJJBHcjs.getTokenIcon.call(void 0, asset.symbol);
|
|
394
|
+
const chainIcon = _chunkWB3ZJJBHcjs.getChainIcon.call(void 0, asset.chainId);
|
|
395
395
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
396
396
|
"button",
|
|
397
397
|
{
|
|
@@ -415,7 +415,7 @@ function AssetSelectStep({
|
|
|
415
415
|
"img",
|
|
416
416
|
{
|
|
417
417
|
src: chainIcon,
|
|
418
|
-
alt:
|
|
418
|
+
alt: _chunkWB3ZJJBHcjs.getChainName.call(void 0, asset.chainId),
|
|
419
419
|
className: "rs-asset-chain-badge"
|
|
420
420
|
}
|
|
421
421
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -436,7 +436,7 @@ function AssetSelectStep({
|
|
|
436
436
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-asset-chain", children: [
|
|
437
437
|
" ",
|
|
438
438
|
"on ",
|
|
439
|
-
|
|
439
|
+
_chunkWB3ZJJBHcjs.getChainName.call(void 0, asset.chainId)
|
|
440
440
|
] })
|
|
441
441
|
] }),
|
|
442
442
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-balance-small", children: [
|
|
@@ -446,7 +446,7 @@ function AssetSelectStep({
|
|
|
446
446
|
] })
|
|
447
447
|
] })
|
|
448
448
|
] }),
|
|
449
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 ?
|
|
449
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ? _chunkKIRDZLOScjs.currencyFormatter.format(asset.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${asset.symbol}` : "--" })
|
|
450
450
|
]
|
|
451
451
|
},
|
|
452
452
|
asset.id
|
|
@@ -456,7 +456,7 @@ function AssetSelectStep({
|
|
|
456
456
|
}
|
|
457
457
|
),
|
|
458
458
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
459
|
-
|
|
459
|
+
_chunkKIRDZLOScjs.Button,
|
|
460
460
|
{
|
|
461
461
|
onClick: () => selectedAsset && onContinue(selectedAsset),
|
|
462
462
|
disabled: !selectedAsset,
|
|
@@ -464,17 +464,17 @@ function AssetSelectStep({
|
|
|
464
464
|
children: "Continue"
|
|
465
465
|
}
|
|
466
466
|
) }),
|
|
467
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
467
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKIRDZLOScjs.PoweredBy, {})
|
|
468
468
|
] });
|
|
469
469
|
}
|
|
470
470
|
async function fetchNativeAssets(address, publicClient, existing) {
|
|
471
471
|
const existingIds = new Set(existing.map((asset) => asset.id));
|
|
472
472
|
const connectedChainId = _optionalChain([publicClient, 'access', _5 => _5.chain, 'optionalAccess', _6 => _6.id]);
|
|
473
473
|
if (!connectedChainId) return [];
|
|
474
|
-
if (!
|
|
475
|
-
const id =
|
|
474
|
+
if (!_chunkWB3ZJJBHcjs.SOURCE_CHAINS.some((chain) => chain.id === connectedChainId)) return [];
|
|
475
|
+
const id = _chunkKIRDZLOScjs.getAssetId.call(void 0, {
|
|
476
476
|
chainId: connectedChainId,
|
|
477
|
-
token:
|
|
477
|
+
token: _chunkWB3ZJJBHcjs.NATIVE_TOKEN_ADDRESS
|
|
478
478
|
});
|
|
479
479
|
if (existingIds.has(id)) return [];
|
|
480
480
|
try {
|
|
@@ -483,7 +483,7 @@ async function fetchNativeAssets(address, publicClient, existing) {
|
|
|
483
483
|
{
|
|
484
484
|
id,
|
|
485
485
|
chainId: connectedChainId,
|
|
486
|
-
token:
|
|
486
|
+
token: _chunkWB3ZJJBHcjs.NATIVE_TOKEN_ADDRESS,
|
|
487
487
|
symbol: "ETH",
|
|
488
488
|
name: "Ethereum",
|
|
489
489
|
decimals: 18,
|
|
@@ -525,7 +525,7 @@ function AmountStep({
|
|
|
525
525
|
onBalanceUsdChange,
|
|
526
526
|
onContinue
|
|
527
527
|
}) {
|
|
528
|
-
const [
|
|
528
|
+
const [amount, setAmount] = _react.useState.call(void 0, "");
|
|
529
529
|
const [balance, setBalance] = _react.useState.call(void 0, null);
|
|
530
530
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
531
531
|
const [isSwitching, setIsSwitching] = _react.useState.call(void 0, false);
|
|
@@ -534,25 +534,29 @@ function AmountStep({
|
|
|
534
534
|
_optionalChain([walletClient, 'optionalAccess', _7 => _7.chain, 'optionalAccess', _8 => _8.id]) && walletClient.chain.id !== asset.chainId
|
|
535
535
|
);
|
|
536
536
|
const tokenPriceUsd = _react.useMemo.call(void 0, () => {
|
|
537
|
-
if (tokenPriceUsdOverride !== void 0
|
|
538
|
-
|
|
537
|
+
if (tokenPriceUsdOverride !== void 0 && tokenPriceUsdOverride > 0)
|
|
538
|
+
return tokenPriceUsdOverride;
|
|
539
|
+
if (asset.balanceUsd === void 0 || !asset.balanceUsd || !asset.balance)
|
|
540
|
+
return null;
|
|
539
541
|
try {
|
|
540
542
|
const balanceUnits = Number(
|
|
541
543
|
_viem.formatUnits.call(void 0, BigInt(asset.balance), asset.decimals)
|
|
542
544
|
);
|
|
543
545
|
if (!Number.isFinite(balanceUnits) || balanceUnits <= 0) return null;
|
|
544
|
-
|
|
546
|
+
const price = asset.balanceUsd / balanceUnits;
|
|
547
|
+
return price > 0 ? price : null;
|
|
545
548
|
} catch (e5) {
|
|
546
549
|
return null;
|
|
547
550
|
}
|
|
548
551
|
}, [tokenPriceUsdOverride, asset.balanceUsd, asset.balance, asset.decimals]);
|
|
552
|
+
const hasPricing = tokenPriceUsd !== null;
|
|
549
553
|
_react.useEffect.call(void 0, () => {
|
|
550
554
|
let active = true;
|
|
551
555
|
async function fetchBalance() {
|
|
552
556
|
const balanceTarget = _nullishCoalesce(balanceAddress, () => ( address));
|
|
553
557
|
if (!balanceTarget || !publicClient) return;
|
|
554
558
|
try {
|
|
555
|
-
const bal =
|
|
559
|
+
const bal = _chunkKIRDZLOScjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: balanceTarget }) : await publicClient.readContract({
|
|
556
560
|
address: asset.token,
|
|
557
561
|
abi: _viem.erc20Abi,
|
|
558
562
|
functionName: "balanceOf",
|
|
@@ -585,14 +589,18 @@ function AmountStep({
|
|
|
585
589
|
}
|
|
586
590
|
}, [chainMismatch, switchChain, asset.chainId]);
|
|
587
591
|
_react.useEffect.call(void 0, () => {
|
|
588
|
-
if (defaultAmount &&
|
|
592
|
+
if (defaultAmount && !amount) {
|
|
589
593
|
const parsed = Number(defaultAmount);
|
|
590
594
|
if (Number.isFinite(parsed) && parsed > 0) {
|
|
591
|
-
|
|
592
|
-
|
|
595
|
+
if (hasPricing) {
|
|
596
|
+
const usdValue = parsed * tokenPriceUsd;
|
|
597
|
+
setAmount(usdValue.toFixed(2));
|
|
598
|
+
} else {
|
|
599
|
+
setAmount(parsed.toString());
|
|
600
|
+
}
|
|
593
601
|
}
|
|
594
602
|
}
|
|
595
|
-
}, [defaultAmount, tokenPriceUsd,
|
|
603
|
+
}, [defaultAmount, tokenPriceUsd, hasPricing, amount]);
|
|
596
604
|
const balanceUsd = _react.useMemo.call(void 0, () => {
|
|
597
605
|
if (balance === null || tokenPriceUsd === null) return null;
|
|
598
606
|
try {
|
|
@@ -604,8 +612,7 @@ function AmountStep({
|
|
|
604
612
|
}
|
|
605
613
|
}, [balance, tokenPriceUsd, asset.decimals]);
|
|
606
614
|
_react.useEffect.call(void 0, () => {
|
|
607
|
-
|
|
608
|
-
_optionalChain([onBalanceUsdChange, 'optionalCall', _9 => _9(balanceUsd)]);
|
|
615
|
+
_optionalChain([onBalanceUsdChange, 'optionalCall', _9 => _9(_nullishCoalesce(balanceUsd, () => ( 0)))]);
|
|
609
616
|
}, [balanceUsd, onBalanceUsdChange]);
|
|
610
617
|
const formattedBalance = _react.useMemo.call(void 0, () => {
|
|
611
618
|
if (balance === null) return "...";
|
|
@@ -613,57 +620,72 @@ function AmountStep({
|
|
|
613
620
|
const raw = _viem.formatUnits.call(void 0, balance, asset.decimals);
|
|
614
621
|
const numeric = Number(raw);
|
|
615
622
|
if (!Number.isFinite(numeric)) return raw;
|
|
616
|
-
return
|
|
623
|
+
return _chunkKIRDZLOScjs.tokenFormatter.format(numeric);
|
|
617
624
|
} catch (e8) {
|
|
618
625
|
return "...";
|
|
619
626
|
}
|
|
620
627
|
}, [balance, asset.decimals]);
|
|
621
628
|
const tokenAmount = _react.useMemo.call(void 0, () => {
|
|
622
|
-
if (!
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
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]);
|
|
628
638
|
const formattedTokenAmount = _react.useMemo.call(void 0, () => {
|
|
629
639
|
if (tokenAmount === null) return "0.00";
|
|
630
|
-
return
|
|
640
|
+
return _chunkKIRDZLOScjs.tokenFormatter.format(tokenAmount);
|
|
631
641
|
}, [tokenAmount]);
|
|
632
|
-
const targetSymbol =
|
|
642
|
+
const targetSymbol = _chunkWB3ZJJBHcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
633
643
|
const handlePresetClick = (percentage) => {
|
|
634
|
-
if (
|
|
635
|
-
|
|
636
|
-
|
|
644
|
+
if (balance === null) return;
|
|
645
|
+
if (hasPricing && balanceUsd !== null) {
|
|
646
|
+
const value = balanceUsd * percentage / 100;
|
|
647
|
+
setAmount(value.toFixed(2));
|
|
648
|
+
} else {
|
|
649
|
+
try {
|
|
650
|
+
const balanceUnits = Number(_viem.formatUnits.call(void 0, balance, asset.decimals));
|
|
651
|
+
if (Number.isFinite(balanceUnits)) {
|
|
652
|
+
const value = balanceUnits * percentage / 100;
|
|
653
|
+
setAmount(value.toString());
|
|
654
|
+
}
|
|
655
|
+
} catch (e9) {
|
|
656
|
+
return;
|
|
657
|
+
}
|
|
658
|
+
}
|
|
637
659
|
if (error) setError(null);
|
|
638
660
|
};
|
|
639
661
|
const handleContinue = () => {
|
|
640
|
-
const
|
|
641
|
-
if (isNaN(
|
|
662
|
+
const numericAmount = parseFloat(amount);
|
|
663
|
+
if (isNaN(numericAmount) || numericAmount <= 0) {
|
|
642
664
|
setError("Please enter a valid amount");
|
|
643
665
|
return;
|
|
644
666
|
}
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
667
|
+
let tokenAmountStr;
|
|
668
|
+
if (hasPricing) {
|
|
669
|
+
if (_optionalChain([uiConfig, 'optionalAccess', _10 => _10.maxDepositUsd]) && numericAmount > uiConfig.maxDepositUsd) {
|
|
670
|
+
setError(
|
|
671
|
+
`Maximum deposit is ${_chunkKIRDZLOScjs.currencyFormatter.format(uiConfig.maxDepositUsd)}`
|
|
672
|
+
);
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
if (_optionalChain([uiConfig, 'optionalAccess', _11 => _11.minDepositUsd]) && numericAmount < uiConfig.minDepositUsd) {
|
|
676
|
+
setError(
|
|
677
|
+
`Minimum deposit is ${_chunkKIRDZLOScjs.currencyFormatter.format(uiConfig.minDepositUsd)}`
|
|
678
|
+
);
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
tokenAmountStr = (numericAmount / tokenPriceUsd).toString();
|
|
682
|
+
} else {
|
|
683
|
+
tokenAmountStr = numericAmount.toString();
|
|
660
684
|
}
|
|
661
|
-
const tokenAmountValue = usdValue / tokenPriceUsd;
|
|
662
|
-
let tokenAmountStr = tokenAmountValue.toString();
|
|
663
685
|
let amountInUnits;
|
|
664
686
|
try {
|
|
665
687
|
amountInUnits = _viem.parseUnits.call(void 0, tokenAmountStr, asset.decimals);
|
|
666
|
-
} catch (
|
|
688
|
+
} catch (e10) {
|
|
667
689
|
setError("Please enter a valid amount");
|
|
668
690
|
return;
|
|
669
691
|
}
|
|
@@ -689,38 +711,55 @@ function AmountStep({
|
|
|
689
711
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
690
712
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body", style: { paddingTop: 0 }, children: [
|
|
691
713
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-display", children: [
|
|
692
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-amount-input-wrapper", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
714
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-amount-input-wrapper", children: hasPricing ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
693
715
|
"input",
|
|
694
716
|
{
|
|
695
717
|
type: "text",
|
|
696
718
|
inputMode: "decimal",
|
|
697
719
|
className: "rs-amount-input-large",
|
|
698
720
|
placeholder: "$0.00",
|
|
699
|
-
value:
|
|
721
|
+
value: amount ? `$${amount}` : "",
|
|
700
722
|
onChange: (e) => {
|
|
701
723
|
const raw = e.target.value.replace(/[^0-9.]/g, "");
|
|
702
724
|
const parts = raw.split(".");
|
|
703
725
|
if (parts.length > 2) return;
|
|
704
|
-
|
|
726
|
+
setAmount(raw);
|
|
727
|
+
if (error) setError(null);
|
|
728
|
+
},
|
|
729
|
+
autoFocus: true
|
|
730
|
+
}
|
|
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);
|
|
705
744
|
if (error) setError(null);
|
|
706
745
|
},
|
|
707
746
|
autoFocus: true
|
|
708
747
|
}
|
|
709
748
|
) }),
|
|
710
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-token-value", children: [
|
|
749
|
+
hasPricing ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-token-value", children: [
|
|
711
750
|
formattedTokenAmount,
|
|
712
751
|
" ",
|
|
713
752
|
asset.symbol
|
|
714
|
-
] }),
|
|
753
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-amount-token-value", style: { color: "var(--rs-muted-foreground)" }, children: "Price unavailable" }),
|
|
715
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: [
|
|
716
755
|
formattedBalance,
|
|
717
756
|
" ",
|
|
718
757
|
asset.symbol,
|
|
719
758
|
" available",
|
|
720
|
-
balanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { style: { color: "var(--rs-muted-foreground)" }, children: [
|
|
759
|
+
hasPricing && balanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { style: { color: "var(--rs-muted-foreground)" }, children: [
|
|
721
760
|
" ",
|
|
722
761
|
"(",
|
|
723
|
-
|
|
762
|
+
_chunkKIRDZLOScjs.currencyFormatter.format(balanceUsd),
|
|
724
763
|
")"
|
|
725
764
|
] })
|
|
726
765
|
] }) })
|
|
@@ -734,26 +773,26 @@ function AmountStep({
|
|
|
734
773
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-flow-pill-label", children: "You send" }),
|
|
735
774
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token", children: [
|
|
736
775
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token-icon-wrapper", children: [
|
|
737
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children:
|
|
776
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children: _chunkWB3ZJJBHcjs.getTokenIcon.call(void 0, asset.symbol) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
738
777
|
"img",
|
|
739
778
|
{
|
|
740
|
-
src:
|
|
779
|
+
src: _chunkWB3ZJJBHcjs.getTokenIcon.call(void 0, asset.symbol),
|
|
741
780
|
alt: asset.symbol
|
|
742
781
|
}
|
|
743
782
|
) : asset.symbol.slice(0, 2) }),
|
|
744
783
|
(() => {
|
|
745
|
-
const chainIcon =
|
|
784
|
+
const chainIcon = _chunkWB3ZJJBHcjs.getChainIcon.call(void 0, asset.chainId);
|
|
746
785
|
if (chainIcon) {
|
|
747
786
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
748
787
|
"img",
|
|
749
788
|
{
|
|
750
789
|
src: chainIcon,
|
|
751
|
-
alt:
|
|
790
|
+
alt: _chunkWB3ZJJBHcjs.getChainName.call(void 0, asset.chainId),
|
|
752
791
|
className: "rs-flow-pill-chain-badge"
|
|
753
792
|
}
|
|
754
793
|
);
|
|
755
794
|
}
|
|
756
|
-
const badge =
|
|
795
|
+
const badge = _chunkWB3ZJJBHcjs.getChainBadge.call(void 0, asset.chainId);
|
|
757
796
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
758
797
|
"div",
|
|
759
798
|
{
|
|
@@ -791,26 +830,26 @@ function AmountStep({
|
|
|
791
830
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-flow-pill-label", children: "You receive" }),
|
|
792
831
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token", children: [
|
|
793
832
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token-icon-wrapper", children: [
|
|
794
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children:
|
|
833
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children: _chunkWB3ZJJBHcjs.getTokenIcon.call(void 0, targetSymbol) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
795
834
|
"img",
|
|
796
835
|
{
|
|
797
|
-
src:
|
|
836
|
+
src: _chunkWB3ZJJBHcjs.getTokenIcon.call(void 0, targetSymbol),
|
|
798
837
|
alt: targetSymbol
|
|
799
838
|
}
|
|
800
839
|
) : targetSymbol.slice(0, 2) }),
|
|
801
840
|
(() => {
|
|
802
|
-
const chainIcon =
|
|
841
|
+
const chainIcon = _chunkWB3ZJJBHcjs.getChainIcon.call(void 0, targetChain);
|
|
803
842
|
if (chainIcon) {
|
|
804
843
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
805
844
|
"img",
|
|
806
845
|
{
|
|
807
846
|
src: chainIcon,
|
|
808
|
-
alt:
|
|
847
|
+
alt: _chunkWB3ZJJBHcjs.getChainName.call(void 0, targetChain),
|
|
809
848
|
className: "rs-flow-pill-chain-badge"
|
|
810
849
|
}
|
|
811
850
|
);
|
|
812
851
|
}
|
|
813
|
-
const badge =
|
|
852
|
+
const badge = _chunkWB3ZJJBHcjs.getChainBadge.call(void 0, targetChain);
|
|
814
853
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
815
854
|
"div",
|
|
816
855
|
{
|
|
@@ -837,7 +876,7 @@ function AmountStep({
|
|
|
837
876
|
type: "button",
|
|
838
877
|
className: "rs-amount-preset-btn",
|
|
839
878
|
onClick: () => handlePresetClick(pct),
|
|
840
|
-
disabled:
|
|
879
|
+
disabled: balance === null,
|
|
841
880
|
children: [
|
|
842
881
|
pct,
|
|
843
882
|
"%"
|
|
@@ -851,7 +890,7 @@ function AmountStep({
|
|
|
851
890
|
type: "button",
|
|
852
891
|
className: "rs-amount-preset-btn",
|
|
853
892
|
onClick: () => handlePresetClick(100),
|
|
854
|
-
disabled:
|
|
893
|
+
disabled: balance === null,
|
|
855
894
|
children: "Max"
|
|
856
895
|
}
|
|
857
896
|
)
|
|
@@ -859,11 +898,11 @@ function AmountStep({
|
|
|
859
898
|
chainMismatch && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch", style: { marginTop: 16 }, children: [
|
|
860
899
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch-text", children: [
|
|
861
900
|
"Switch your wallet to ",
|
|
862
|
-
|
|
901
|
+
_chunkWB3ZJJBHcjs.getChainName.call(void 0, asset.chainId),
|
|
863
902
|
" to continue."
|
|
864
903
|
] }),
|
|
865
904
|
switchChain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
866
|
-
|
|
905
|
+
_chunkKIRDZLOScjs.Button,
|
|
867
906
|
{
|
|
868
907
|
variant: "outline",
|
|
869
908
|
size: "small",
|
|
@@ -896,15 +935,15 @@ function AmountStep({
|
|
|
896
935
|
] })
|
|
897
936
|
] }),
|
|
898
937
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
899
|
-
|
|
938
|
+
_chunkKIRDZLOScjs.Button,
|
|
900
939
|
{
|
|
901
940
|
onClick: handleContinue,
|
|
902
941
|
fullWidth: true,
|
|
903
|
-
disabled: !
|
|
942
|
+
disabled: !amount || chainMismatch,
|
|
904
943
|
children: "Continue"
|
|
905
944
|
}
|
|
906
945
|
) }),
|
|
907
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
946
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKIRDZLOScjs.PoweredBy, {})
|
|
908
947
|
] });
|
|
909
948
|
}
|
|
910
949
|
|
|
@@ -933,7 +972,7 @@ function ConfirmStep({
|
|
|
933
972
|
const [isSwitching, setIsSwitching] = _react.useState.call(void 0, false);
|
|
934
973
|
const chainMismatch = _optionalChain([walletClient, 'optionalAccess', _12 => _12.chain, 'optionalAccess', _13 => _13.id]) && walletClient.chain.id !== asset.chainId;
|
|
935
974
|
const sameRoute = targetChain === asset.chainId && targetToken.toLowerCase() === asset.token.toLowerCase();
|
|
936
|
-
const targetSymbol = sameRoute ? asset.symbol :
|
|
975
|
+
const targetSymbol = sameRoute ? asset.symbol : _chunkWB3ZJJBHcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
937
976
|
const formattedAmount = amount && !Number.isNaN(Number(amount)) ? Number(amount).toLocaleString("en-US", { maximumFractionDigits: 6 }) : "0";
|
|
938
977
|
const tokenPriceUsd = _react.useMemo.call(void 0, () => {
|
|
939
978
|
if (asset.balanceUsd === void 0 || !asset.balance) return null;
|
|
@@ -943,7 +982,7 @@ function ConfirmStep({
|
|
|
943
982
|
);
|
|
944
983
|
if (!Number.isFinite(balanceUnits) || balanceUnits <= 0) return null;
|
|
945
984
|
return asset.balanceUsd / balanceUnits;
|
|
946
|
-
} catch (
|
|
985
|
+
} catch (e11) {
|
|
947
986
|
return null;
|
|
948
987
|
}
|
|
949
988
|
}, [asset.balanceUsd, asset.balance, asset.decimals]);
|
|
@@ -986,7 +1025,7 @@ function ConfirmStep({
|
|
|
986
1025
|
return;
|
|
987
1026
|
}
|
|
988
1027
|
if (chainMismatch) {
|
|
989
|
-
setError(`Switch to ${
|
|
1028
|
+
setError(`Switch to ${_chunkWB3ZJJBHcjs.getChainName.call(void 0, asset.chainId)} to sign`);
|
|
990
1029
|
return;
|
|
991
1030
|
}
|
|
992
1031
|
const parsedAmount = parseFloat(amount);
|
|
@@ -997,7 +1036,7 @@ function ConfirmStep({
|
|
|
997
1036
|
let amountUnits;
|
|
998
1037
|
try {
|
|
999
1038
|
amountUnits = _viem.parseUnits.call(void 0, amount, asset.decimals);
|
|
1000
|
-
} catch (
|
|
1039
|
+
} catch (e12) {
|
|
1001
1040
|
setError("Please enter a valid amount");
|
|
1002
1041
|
return;
|
|
1003
1042
|
}
|
|
@@ -1014,7 +1053,7 @@ function ConfirmStep({
|
|
|
1014
1053
|
throw new Error("Wallet not properly connected");
|
|
1015
1054
|
}
|
|
1016
1055
|
const transferTo = sameRoute ? recipient : smartAccount;
|
|
1017
|
-
const hash =
|
|
1056
|
+
const hash = _chunkKIRDZLOScjs.isNativeAsset.call(void 0, asset) ? await walletClient.sendTransaction({
|
|
1018
1057
|
account,
|
|
1019
1058
|
chain,
|
|
1020
1059
|
to: transferTo,
|
|
@@ -1031,7 +1070,7 @@ function ConfirmStep({
|
|
|
1031
1070
|
onConfirm(hash, asset.chainId, amountUnits.toString(), asset.token);
|
|
1032
1071
|
} catch (err) {
|
|
1033
1072
|
const raw = err instanceof Error ? err.message : "Transfer failed";
|
|
1034
|
-
const message =
|
|
1073
|
+
const message = _chunkKIRDZLOScjs.formatUserError.call(void 0, raw);
|
|
1035
1074
|
setError(message);
|
|
1036
1075
|
_optionalChain([onError, 'optionalCall', _15 => _15(message, "TRANSFER_ERROR")]);
|
|
1037
1076
|
} finally {
|
|
@@ -1045,7 +1084,7 @@ function ConfirmStep({
|
|
|
1045
1084
|
await switchChain(asset.chainId);
|
|
1046
1085
|
} catch (err) {
|
|
1047
1086
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
1048
|
-
setError(
|
|
1087
|
+
setError(_chunkKIRDZLOScjs.formatUserError.call(void 0, raw));
|
|
1049
1088
|
} finally {
|
|
1050
1089
|
setIsSwitching(false);
|
|
1051
1090
|
}
|
|
@@ -1062,15 +1101,15 @@ function ConfirmStep({
|
|
|
1062
1101
|
className: "rs-card-value",
|
|
1063
1102
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
1064
1103
|
children: [
|
|
1065
|
-
|
|
1104
|
+
_chunkWB3ZJJBHcjs.getChainIcon.call(void 0, asset.chainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1066
1105
|
"img",
|
|
1067
1106
|
{
|
|
1068
|
-
src:
|
|
1107
|
+
src: _chunkWB3ZJJBHcjs.getChainIcon.call(void 0, asset.chainId),
|
|
1069
1108
|
alt: "",
|
|
1070
1109
|
style: { width: 16, height: 16, borderRadius: "50%" }
|
|
1071
1110
|
}
|
|
1072
1111
|
),
|
|
1073
|
-
|
|
1112
|
+
_chunkWB3ZJJBHcjs.getChainName.call(void 0, asset.chainId)
|
|
1074
1113
|
]
|
|
1075
1114
|
}
|
|
1076
1115
|
)
|
|
@@ -1083,15 +1122,15 @@ function ConfirmStep({
|
|
|
1083
1122
|
className: "rs-card-value",
|
|
1084
1123
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
1085
1124
|
children: [
|
|
1086
|
-
|
|
1125
|
+
_chunkWB3ZJJBHcjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1087
1126
|
"img",
|
|
1088
1127
|
{
|
|
1089
|
-
src:
|
|
1128
|
+
src: _chunkWB3ZJJBHcjs.getChainIcon.call(void 0, targetChain),
|
|
1090
1129
|
alt: "",
|
|
1091
1130
|
style: { width: 16, height: 16, borderRadius: "50%" }
|
|
1092
1131
|
}
|
|
1093
1132
|
),
|
|
1094
|
-
|
|
1133
|
+
_chunkWB3ZJJBHcjs.getChainName.call(void 0, targetChain)
|
|
1095
1134
|
]
|
|
1096
1135
|
}
|
|
1097
1136
|
)
|
|
@@ -1110,10 +1149,10 @@ function ConfirmStep({
|
|
|
1110
1149
|
className: "rs-card-value",
|
|
1111
1150
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
1112
1151
|
children: [
|
|
1113
|
-
|
|
1152
|
+
_chunkWB3ZJJBHcjs.getTokenIcon.call(void 0, asset.symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1114
1153
|
"img",
|
|
1115
1154
|
{
|
|
1116
|
-
src:
|
|
1155
|
+
src: _chunkWB3ZJJBHcjs.getTokenIcon.call(void 0, asset.symbol),
|
|
1117
1156
|
alt: "",
|
|
1118
1157
|
style: { width: 16, height: 16, borderRadius: "50%" }
|
|
1119
1158
|
}
|
|
@@ -1133,10 +1172,10 @@ function ConfirmStep({
|
|
|
1133
1172
|
className: "rs-card-value",
|
|
1134
1173
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
1135
1174
|
children: [
|
|
1136
|
-
|
|
1175
|
+
_chunkWB3ZJJBHcjs.getTokenIcon.call(void 0, targetSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1137
1176
|
"img",
|
|
1138
1177
|
{
|
|
1139
|
-
src:
|
|
1178
|
+
src: _chunkWB3ZJJBHcjs.getTokenIcon.call(void 0, targetSymbol),
|
|
1140
1179
|
alt: "",
|
|
1141
1180
|
style: { width: 16, height: 16, borderRadius: "50%" }
|
|
1142
1181
|
}
|
|
@@ -1150,17 +1189,17 @@ function ConfirmStep({
|
|
|
1150
1189
|
] }),
|
|
1151
1190
|
receiveAmountUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
|
|
1152
1191
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "Value" }),
|
|
1153
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-value", children:
|
|
1192
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-value", children: _chunkKIRDZLOScjs.currencyFormatter.format(receiveAmountUsd) })
|
|
1154
1193
|
] })
|
|
1155
1194
|
] }),
|
|
1156
1195
|
chainMismatch && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch", children: [
|
|
1157
1196
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch-text", children: [
|
|
1158
1197
|
"Switch your wallet to ",
|
|
1159
|
-
|
|
1198
|
+
_chunkWB3ZJJBHcjs.getChainName.call(void 0, asset.chainId),
|
|
1160
1199
|
" to sign."
|
|
1161
1200
|
] }),
|
|
1162
1201
|
switchChain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1163
|
-
|
|
1202
|
+
_chunkKIRDZLOScjs.Button,
|
|
1164
1203
|
{
|
|
1165
1204
|
variant: "outline",
|
|
1166
1205
|
size: "small",
|
|
@@ -1193,7 +1232,7 @@ function ConfirmStep({
|
|
|
1193
1232
|
] })
|
|
1194
1233
|
] }),
|
|
1195
1234
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1196
|
-
|
|
1235
|
+
_chunkKIRDZLOScjs.Button,
|
|
1197
1236
|
{
|
|
1198
1237
|
onClick: handleConfirm,
|
|
1199
1238
|
loading: isSubmitting,
|
|
@@ -1202,7 +1241,7 @@ function ConfirmStep({
|
|
|
1202
1241
|
children: "Confirm Order"
|
|
1203
1242
|
}
|
|
1204
1243
|
) }),
|
|
1205
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1244
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKIRDZLOScjs.PoweredBy, {})
|
|
1206
1245
|
] });
|
|
1207
1246
|
}
|
|
1208
1247
|
|
|
@@ -1347,12 +1386,12 @@ function DepositAddressStep({
|
|
|
1347
1386
|
onDepositDetected,
|
|
1348
1387
|
onError
|
|
1349
1388
|
}) {
|
|
1350
|
-
const supportedChainIds = _react.useMemo.call(void 0, () =>
|
|
1389
|
+
const supportedChainIds = _react.useMemo.call(void 0, () => _chunkWB3ZJJBHcjs.getSupportedChainIds.call(void 0, ), []);
|
|
1351
1390
|
const BASE_CHAIN_ID = 8453;
|
|
1352
1391
|
const defaultChainId = supportedChainIds.includes(BASE_CHAIN_ID) ? BASE_CHAIN_ID : supportedChainIds[0];
|
|
1353
1392
|
const [sourceChainId, setSourceChainId] = _react.useState.call(void 0, defaultChainId);
|
|
1354
1393
|
const tokensForChain = _react.useMemo.call(void 0,
|
|
1355
|
-
() =>
|
|
1394
|
+
() => _chunkWB3ZJJBHcjs.getTargetTokenSymbolsForChain.call(void 0, sourceChainId),
|
|
1356
1395
|
[sourceChainId]
|
|
1357
1396
|
);
|
|
1358
1397
|
const defaultToken = tokensForChain.includes("USDC") ? "USDC" : _nullishCoalesce(tokensForChain[0], () => ( "USDC"));
|
|
@@ -1382,7 +1421,7 @@ function DepositAddressStep({
|
|
|
1382
1421
|
await navigator.clipboard.writeText(smartAccount);
|
|
1383
1422
|
setCopied(true);
|
|
1384
1423
|
setTimeout(() => setCopied(false), 2e3);
|
|
1385
|
-
} catch (
|
|
1424
|
+
} catch (e13) {
|
|
1386
1425
|
const textarea = document.createElement("textarea");
|
|
1387
1426
|
textarea.value = smartAccount;
|
|
1388
1427
|
textarea.style.position = "fixed";
|
|
@@ -1407,7 +1446,7 @@ function DepositAddressStep({
|
|
|
1407
1446
|
const status = await service.fetchLatestStatus(smartAccount);
|
|
1408
1447
|
if (cancelled || depositHandledRef.current) return;
|
|
1409
1448
|
const event = status.lastEvent;
|
|
1410
|
-
const eventTxHash =
|
|
1449
|
+
const eventTxHash = _chunkKIRDZLOScjs.isDepositEvent.call(void 0, event) ? _nullishCoalesce(_optionalChain([_chunkKIRDZLOScjs.getEventTxHash.call(void 0, event), 'optionalAccess', _19 => _19.toLowerCase, 'call', _20 => _20()]), () => ( null)) : null;
|
|
1411
1450
|
if (baselineTxHash === void 0) {
|
|
1412
1451
|
baselineTxHash = eventTxHash;
|
|
1413
1452
|
} else if (eventTxHash && eventTxHash !== baselineTxHash) {
|
|
@@ -1415,7 +1454,7 @@ function DepositAddressStep({
|
|
|
1415
1454
|
const fallback = sourceSelectionRef.current;
|
|
1416
1455
|
const chainId = _nullishCoalesce(details.chainId, () => ( fallback.chainId));
|
|
1417
1456
|
const amount = _nullishCoalesce(details.amount, () => ( "0"));
|
|
1418
|
-
const token = _nullishCoalesce(details.token, () => (
|
|
1457
|
+
const token = _nullishCoalesce(details.token, () => ( _chunkWB3ZJJBHcjs.getTokenAddress.call(void 0, fallback.tokenSymbol, fallback.chainId)));
|
|
1419
1458
|
if (token) {
|
|
1420
1459
|
depositHandledRef.current = true;
|
|
1421
1460
|
onDepositDetected(eventTxHash, chainId, amount, token);
|
|
@@ -1440,12 +1479,12 @@ function DepositAddressStep({
|
|
|
1440
1479
|
clearTimeout(timeoutId);
|
|
1441
1480
|
};
|
|
1442
1481
|
}, [smartAccount, service, onDepositDetected, onError]);
|
|
1443
|
-
const chainIconSrc =
|
|
1482
|
+
const chainIconSrc = _chunkWB3ZJJBHcjs.getChainIcon.call(void 0, sourceChainId);
|
|
1444
1483
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
1445
1484
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-body", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address", children: [
|
|
1446
1485
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-selectors", children: [
|
|
1447
1486
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-dropdown", children: [
|
|
1448
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-dropdown-label", children: "
|
|
1487
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-dropdown-label", children: "Fallback token" }),
|
|
1449
1488
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1450
1489
|
"button",
|
|
1451
1490
|
{
|
|
@@ -1456,10 +1495,10 @@ function DepositAddressStep({
|
|
|
1456
1495
|
setChainDropdownOpen(false);
|
|
1457
1496
|
},
|
|
1458
1497
|
children: [
|
|
1459
|
-
|
|
1498
|
+
_chunkWB3ZJJBHcjs.getTokenIcon.call(void 0, sourceTokenSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1460
1499
|
"img",
|
|
1461
1500
|
{
|
|
1462
|
-
src:
|
|
1501
|
+
src: _chunkWB3ZJJBHcjs.getTokenIcon.call(void 0, sourceTokenSymbol),
|
|
1463
1502
|
alt: "",
|
|
1464
1503
|
className: "rs-deposit-address-dropdown-icon"
|
|
1465
1504
|
}
|
|
@@ -1496,10 +1535,10 @@ function DepositAddressStep({
|
|
|
1496
1535
|
setTokenDropdownOpen(false);
|
|
1497
1536
|
},
|
|
1498
1537
|
children: [
|
|
1499
|
-
|
|
1538
|
+
_chunkWB3ZJJBHcjs.getTokenIcon.call(void 0, symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1500
1539
|
"img",
|
|
1501
1540
|
{
|
|
1502
|
-
src:
|
|
1541
|
+
src: _chunkWB3ZJJBHcjs.getTokenIcon.call(void 0, symbol),
|
|
1503
1542
|
alt: "",
|
|
1504
1543
|
className: "rs-deposit-address-dropdown-icon"
|
|
1505
1544
|
}
|
|
@@ -1511,7 +1550,7 @@ function DepositAddressStep({
|
|
|
1511
1550
|
)) })
|
|
1512
1551
|
] }),
|
|
1513
1552
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-dropdown", children: [
|
|
1514
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-dropdown-label", children: "
|
|
1553
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-dropdown-label", children: "Fallback chain" }),
|
|
1515
1554
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1516
1555
|
"button",
|
|
1517
1556
|
{
|
|
@@ -1522,15 +1561,15 @@ function DepositAddressStep({
|
|
|
1522
1561
|
setTokenDropdownOpen(false);
|
|
1523
1562
|
},
|
|
1524
1563
|
children: [
|
|
1525
|
-
|
|
1564
|
+
_chunkWB3ZJJBHcjs.getChainIcon.call(void 0, sourceChainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1526
1565
|
"img",
|
|
1527
1566
|
{
|
|
1528
|
-
src:
|
|
1567
|
+
src: _chunkWB3ZJJBHcjs.getChainIcon.call(void 0, sourceChainId),
|
|
1529
1568
|
alt: "",
|
|
1530
1569
|
className: "rs-deposit-address-dropdown-icon"
|
|
1531
1570
|
}
|
|
1532
1571
|
),
|
|
1533
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
1572
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkWB3ZJJBHcjs.getChainName.call(void 0, sourceChainId) }),
|
|
1534
1573
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1535
1574
|
"svg",
|
|
1536
1575
|
{
|
|
@@ -1562,15 +1601,15 @@ function DepositAddressStep({
|
|
|
1562
1601
|
setChainDropdownOpen(false);
|
|
1563
1602
|
},
|
|
1564
1603
|
children: [
|
|
1565
|
-
|
|
1604
|
+
_chunkWB3ZJJBHcjs.getChainIcon.call(void 0, chainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1566
1605
|
"img",
|
|
1567
1606
|
{
|
|
1568
|
-
src:
|
|
1607
|
+
src: _chunkWB3ZJJBHcjs.getChainIcon.call(void 0, chainId),
|
|
1569
1608
|
alt: "",
|
|
1570
1609
|
className: "rs-deposit-address-dropdown-icon"
|
|
1571
1610
|
}
|
|
1572
1611
|
),
|
|
1573
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
1612
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkWB3ZJJBHcjs.getChainName.call(void 0, chainId) })
|
|
1574
1613
|
]
|
|
1575
1614
|
},
|
|
1576
1615
|
chainId
|
|
@@ -1620,7 +1659,7 @@ function DepositAddressStep({
|
|
|
1620
1659
|
] }),
|
|
1621
1660
|
pollingError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-error", children: pollingError })
|
|
1622
1661
|
] }) }),
|
|
1623
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1662
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKIRDZLOScjs.PoweredBy, {})
|
|
1624
1663
|
] });
|
|
1625
1664
|
}
|
|
1626
1665
|
DepositAddressStep.displayName = "DepositAddressStep";
|
|
@@ -1641,7 +1680,7 @@ function DepositFlow({
|
|
|
1641
1680
|
sourceToken: defaultSourceToken,
|
|
1642
1681
|
amount: defaultAmount,
|
|
1643
1682
|
recipient,
|
|
1644
|
-
signerAddress =
|
|
1683
|
+
signerAddress = _chunkWB3ZJJBHcjs.DEFAULT_SIGNER_ADDRESS,
|
|
1645
1684
|
sessionChainIds,
|
|
1646
1685
|
forceRegister = false,
|
|
1647
1686
|
waitForFinalTx = true,
|
|
@@ -1705,7 +1744,7 @@ function DepositFlow({
|
|
|
1705
1744
|
return {
|
|
1706
1745
|
ownerAddress: dappAddress,
|
|
1707
1746
|
walletClient: void 0,
|
|
1708
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
1747
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkKIRDZLOScjs.getPublicClient.call(void 0, targetChain))),
|
|
1709
1748
|
switchChain: void 0
|
|
1710
1749
|
};
|
|
1711
1750
|
}
|
|
@@ -1714,7 +1753,7 @@ function DepositFlow({
|
|
|
1714
1753
|
return {
|
|
1715
1754
|
ownerAddress: dappWalletClient.account.address,
|
|
1716
1755
|
walletClient: dappWalletClient,
|
|
1717
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
1756
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkKIRDZLOScjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
1718
1757
|
switchChain: dappSwitchChain
|
|
1719
1758
|
};
|
|
1720
1759
|
}
|
|
@@ -1724,7 +1763,7 @@ function DepositFlow({
|
|
|
1724
1763
|
return {
|
|
1725
1764
|
ownerAddress: dappWalletClient.account.address,
|
|
1726
1765
|
walletClient: dappWalletClient,
|
|
1727
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
1766
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkKIRDZLOScjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
1728
1767
|
switchChain: dappSwitchChain
|
|
1729
1768
|
};
|
|
1730
1769
|
}
|
|
@@ -1932,7 +1971,7 @@ function DepositFlow({
|
|
|
1932
1971
|
}, [walletOptionsKey, selectedConnectAddressEffective]);
|
|
1933
1972
|
if (showConnectStep) {
|
|
1934
1973
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1935
|
-
|
|
1974
|
+
_chunkKIRDZLOScjs.ConnectStep,
|
|
1936
1975
|
{
|
|
1937
1976
|
walletOptions,
|
|
1938
1977
|
selectedAddress: selectedConnectAddressEffective,
|
|
@@ -1983,7 +2022,7 @@ function DepositFlow({
|
|
|
1983
2022
|
}
|
|
1984
2023
|
),
|
|
1985
2024
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1986
|
-
|
|
2025
|
+
_chunkKIRDZLOScjs.ProcessingStep,
|
|
1987
2026
|
{
|
|
1988
2027
|
smartAccount: step.smartAccount,
|
|
1989
2028
|
txHash: step.txHash,
|
|
@@ -2014,7 +2053,7 @@ function DepositFlow({
|
|
|
2014
2053
|
if (_optionalChain([signerContext, 'access', _55 => _55.publicClient, 'access', _56 => _56.chain, 'optionalAccess', _57 => _57.id]) === chainId) {
|
|
2015
2054
|
return signerContext.publicClient;
|
|
2016
2055
|
}
|
|
2017
|
-
return
|
|
2056
|
+
return _chunkKIRDZLOScjs.getPublicClient.call(void 0, chainId);
|
|
2018
2057
|
};
|
|
2019
2058
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
2020
2059
|
step.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2080,7 +2119,7 @@ function DepositFlow({
|
|
|
2080
2119
|
}
|
|
2081
2120
|
),
|
|
2082
2121
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2083
|
-
|
|
2122
|
+
_chunkKIRDZLOScjs.ProcessingStep,
|
|
2084
2123
|
{
|
|
2085
2124
|
smartAccount: step.smartAccount,
|
|
2086
2125
|
txHash: step.txHash,
|
|
@@ -2105,7 +2144,7 @@ function DepositFlow({
|
|
|
2105
2144
|
// src/DepositModal.tsx
|
|
2106
2145
|
|
|
2107
2146
|
var ReownDepositInner = _react.lazy.call(void 0,
|
|
2108
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-
|
|
2147
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-ZD3ROLZG.cjs"))).then((m) => ({ default: m.DepositModalReown }))
|
|
2109
2148
|
);
|
|
2110
2149
|
function DepositModal(props) {
|
|
2111
2150
|
const needsReown = !!props.reownAppId;
|
|
@@ -2128,8 +2167,8 @@ function DepositModalInner({
|
|
|
2128
2167
|
sourceToken,
|
|
2129
2168
|
defaultAmount,
|
|
2130
2169
|
recipient,
|
|
2131
|
-
backendUrl =
|
|
2132
|
-
signerAddress =
|
|
2170
|
+
backendUrl = _chunkWB3ZJJBHcjs.DEFAULT_BACKEND_URL,
|
|
2171
|
+
signerAddress = _chunkWB3ZJJBHcjs.DEFAULT_SIGNER_ADDRESS,
|
|
2133
2172
|
sessionChainIds,
|
|
2134
2173
|
forceRegister = false,
|
|
2135
2174
|
waitForFinalTx = true,
|
|
@@ -2153,12 +2192,12 @@ function DepositModalInner({
|
|
|
2153
2192
|
const [currentStepIndex, setCurrentStepIndex] = _react.useState.call(void 0, 0);
|
|
2154
2193
|
const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, null);
|
|
2155
2194
|
const backHandlerRef = _react.useRef.call(void 0, void 0);
|
|
2156
|
-
const targetChain =
|
|
2157
|
-
const sourceChain = sourceChainProp ?
|
|
2158
|
-
const service = _react.useMemo.call(void 0, () =>
|
|
2195
|
+
const targetChain = _chunkWB3ZJJBHcjs.getChainId.call(void 0, targetChainProp);
|
|
2196
|
+
const sourceChain = sourceChainProp ? _chunkWB3ZJJBHcjs.getChainId.call(void 0, sourceChainProp) : void 0;
|
|
2197
|
+
const service = _react.useMemo.call(void 0, () => _chunkKIRDZLOScjs.createDepositService.call(void 0, backendUrl), [backendUrl]);
|
|
2159
2198
|
_react.useEffect.call(void 0, () => {
|
|
2160
2199
|
if (isOpen && modalRef.current) {
|
|
2161
|
-
|
|
2200
|
+
_chunkKIRDZLOScjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
2162
2201
|
}
|
|
2163
2202
|
}, [isOpen, theme]);
|
|
2164
2203
|
const hasCalledReady = _react.useRef.call(void 0, false);
|
|
@@ -2194,7 +2233,7 @@ function DepositModalInner({
|
|
|
2194
2233
|
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _66 => _66.title]), () => ( "Deposit"));
|
|
2195
2234
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 4 && backHandlerRef.current !== void 0;
|
|
2196
2235
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2197
|
-
|
|
2236
|
+
_chunkKIRDZLOScjs.Modal,
|
|
2198
2237
|
{
|
|
2199
2238
|
isOpen,
|
|
2200
2239
|
onClose,
|
|
@@ -2255,7 +2294,7 @@ function DepositModalInner({
|
|
|
2255
2294
|
balanceTitle,
|
|
2256
2295
|
":"
|
|
2257
2296
|
] }),
|
|
2258
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children:
|
|
2297
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _chunkKIRDZLOScjs.currencyFormatter.format(totalBalanceUsd) })
|
|
2259
2298
|
] })
|
|
2260
2299
|
] }),
|
|
2261
2300
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|