@rhinestone/deposit-modal 0.1.29 → 0.1.31
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-4PFOMSC6.cjs → DepositModalReown-N7GCYZF7.cjs} +7 -7
- package/dist/{DepositModalReown-BVHWFWIG.mjs → DepositModalReown-S7HER5HU.mjs} +4 -4
- package/dist/{WithdrawModalReown-YREQR7DV.cjs → WithdrawModalReown-DJCJ5U7E.cjs} +7 -7
- package/dist/{WithdrawModalReown-CJCNT7SA.mjs → WithdrawModalReown-DMDRLYTE.mjs} +4 -4
- package/dist/{chunk-CSQRKM4Y.mjs → chunk-3ICS43XC.mjs} +14 -9
- package/dist/{chunk-XTTTHW3W.mjs → chunk-AWFJFSPH.mjs} +164 -85
- package/dist/{chunk-LBEP3A2Z.mjs → chunk-CS6UIMCF.mjs} +3 -1
- package/dist/{chunk-N6T4TKXI.mjs → chunk-EVU7M7A6.mjs} +71 -42
- package/dist/{chunk-7ZCUANBT.cjs → chunk-G2RDCQHL.cjs} +109 -80
- package/dist/{chunk-5QJNOPNF.cjs → chunk-MU2BOEDN.cjs} +291 -212
- package/dist/{chunk-DLYVHOME.cjs → chunk-PE6OK3FH.cjs} +15 -10
- package/dist/{chunk-K6YG3I6O.mjs → chunk-SLI5FHTT.mjs} +9 -9
- package/dist/{chunk-CPIQJR47.cjs → chunk-SZ35G2DT.cjs} +59 -59
- package/dist/{chunk-6VJ2ZTNQ.cjs → chunk-VKQA3FO3.cjs} +2 -0
- 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.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +3 -3
- package/dist/index.cjs +7 -5
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +6 -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-BwaQ7jK5.d.cts → types-DELv717e.d.cts} +5 -1
- package/dist/{types-CgXyx46m.d.ts → types-DTBfMH0p.d.ts} +5 -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 _chunkG2RDCQHLcjs = require('./chunk-G2RDCQHL.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 _chunkPE6OK3FHcjs = require('./chunk-PE6OK3FH.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 = _chunkG2RDCQHLcjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
|
|
60
60
|
if (localOwner) {
|
|
61
61
|
return {
|
|
62
|
-
account:
|
|
62
|
+
account: _chunkG2RDCQHLcjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
|
|
63
63
|
address: localOwner.address
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
-
const created =
|
|
67
|
-
|
|
66
|
+
const created = _chunkG2RDCQHLcjs.createSessionOwnerKey.call(void 0, );
|
|
67
|
+
_chunkG2RDCQHLcjs.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 = _chunkG2RDCQHLcjs.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, _chunkG2RDCQHLcjs.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, _chunkG2RDCQHLcjs.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 _chunkG2RDCQHLcjs.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 = _chunkG2RDCQHLcjs.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() === _chunkPE6OK3FHcjs.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 _chunkG2RDCQHLcjs.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, _chunkG2RDCQHLcjs.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 = _chunkPE6OK3FHcjs.getChainBadge.call(void 0, asset.chainId);
|
|
393
|
+
const tokenIcon = _chunkPE6OK3FHcjs.getTokenIcon.call(void 0, asset.symbol);
|
|
394
|
+
const chainIcon = _chunkPE6OK3FHcjs.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: _chunkPE6OK3FHcjs.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
|
+
_chunkPE6OK3FHcjs.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 ? _chunkG2RDCQHLcjs.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
|
+
_chunkG2RDCQHLcjs.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, _chunkG2RDCQHLcjs.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 (!_chunkPE6OK3FHcjs.SOURCE_CHAINS.some((chain) => chain.id === connectedChainId)) return [];
|
|
475
|
+
const id = _chunkG2RDCQHLcjs.getAssetId.call(void 0, {
|
|
476
476
|
chainId: connectedChainId,
|
|
477
|
-
token:
|
|
477
|
+
token: _chunkPE6OK3FHcjs.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: _chunkPE6OK3FHcjs.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 = _chunkG2RDCQHLcjs.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,63 +620,78 @@ 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 _chunkG2RDCQHLcjs.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 _chunkG2RDCQHLcjs.tokenFormatter.format(tokenAmount);
|
|
631
641
|
}, [tokenAmount]);
|
|
632
|
-
const targetSymbol =
|
|
642
|
+
const targetSymbol = _chunkPE6OK3FHcjs.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 ${_chunkG2RDCQHLcjs.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 ${_chunkG2RDCQHLcjs.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
|
}
|
|
670
692
|
if (balance !== null && amountInUnits > balance) {
|
|
671
|
-
|
|
672
|
-
|
|
693
|
+
setError("Insufficient balance");
|
|
694
|
+
return;
|
|
673
695
|
}
|
|
674
696
|
setError(null);
|
|
675
697
|
onContinue(tokenAmountStr, _nullishCoalesce(balance, () => ( void 0)));
|
|
@@ -689,41 +711,67 @@ 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}` : "",
|
|
722
|
+
onChange: (e) => {
|
|
723
|
+
const raw = e.target.value.replace(/[^0-9.]/g, "");
|
|
724
|
+
const parts = raw.split(".");
|
|
725
|
+
if (parts.length > 2) return;
|
|
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,
|
|
700
739
|
onChange: (e) => {
|
|
701
740
|
const raw = e.target.value.replace(/[^0-9.]/g, "");
|
|
702
741
|
const parts = raw.split(".");
|
|
703
742
|
if (parts.length > 2) return;
|
|
704
|
-
|
|
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,
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
asset.symbol
|
|
714
|
-
] }),
|
|
715
|
-
/* @__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
|
-
formattedBalance,
|
|
717
|
-
" ",
|
|
718
|
-
asset.symbol,
|
|
719
|
-
" available",
|
|
720
|
-
balanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { style: { color: "var(--rs-muted-foreground)" }, children: [
|
|
749
|
+
(_nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _12 => _12.showTokenBalance]), () => ( false))) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
750
|
+
hasPricing ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-token-value", children: [
|
|
751
|
+
formattedTokenAmount,
|
|
721
752
|
" ",
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
"
|
|
725
|
-
|
|
726
|
-
|
|
753
|
+
asset.symbol
|
|
754
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
755
|
+
"div",
|
|
756
|
+
{
|
|
757
|
+
className: "rs-amount-token-value",
|
|
758
|
+
style: { color: "var(--rs-muted-foreground)" },
|
|
759
|
+
children: "Price unavailable"
|
|
760
|
+
}
|
|
761
|
+
),
|
|
762
|
+
/* @__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: [
|
|
763
|
+
formattedBalance,
|
|
764
|
+
" ",
|
|
765
|
+
asset.symbol,
|
|
766
|
+
" available",
|
|
767
|
+
hasPricing && balanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { style: { color: "var(--rs-muted-foreground)" }, children: [
|
|
768
|
+
" ",
|
|
769
|
+
"(",
|
|
770
|
+
_chunkG2RDCQHLcjs.currencyFormatter.format(balanceUsd),
|
|
771
|
+
")"
|
|
772
|
+
] })
|
|
773
|
+
] }) })
|
|
774
|
+
] })
|
|
727
775
|
] }),
|
|
728
776
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
729
777
|
"div",
|
|
@@ -734,26 +782,26 @@ function AmountStep({
|
|
|
734
782
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-flow-pill-label", children: "You send" }),
|
|
735
783
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token", children: [
|
|
736
784
|
/* @__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:
|
|
785
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children: _chunkPE6OK3FHcjs.getTokenIcon.call(void 0, asset.symbol) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
738
786
|
"img",
|
|
739
787
|
{
|
|
740
|
-
src:
|
|
788
|
+
src: _chunkPE6OK3FHcjs.getTokenIcon.call(void 0, asset.symbol),
|
|
741
789
|
alt: asset.symbol
|
|
742
790
|
}
|
|
743
791
|
) : asset.symbol.slice(0, 2) }),
|
|
744
792
|
(() => {
|
|
745
|
-
const chainIcon =
|
|
793
|
+
const chainIcon = _chunkPE6OK3FHcjs.getChainIcon.call(void 0, asset.chainId);
|
|
746
794
|
if (chainIcon) {
|
|
747
795
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
748
796
|
"img",
|
|
749
797
|
{
|
|
750
798
|
src: chainIcon,
|
|
751
|
-
alt:
|
|
799
|
+
alt: _chunkPE6OK3FHcjs.getChainName.call(void 0, asset.chainId),
|
|
752
800
|
className: "rs-flow-pill-chain-badge"
|
|
753
801
|
}
|
|
754
802
|
);
|
|
755
803
|
}
|
|
756
|
-
const badge =
|
|
804
|
+
const badge = _chunkPE6OK3FHcjs.getChainBadge.call(void 0, asset.chainId);
|
|
757
805
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
758
806
|
"div",
|
|
759
807
|
{
|
|
@@ -791,26 +839,26 @@ function AmountStep({
|
|
|
791
839
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-flow-pill-label", children: "You receive" }),
|
|
792
840
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token", children: [
|
|
793
841
|
/* @__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:
|
|
842
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children: _chunkPE6OK3FHcjs.getTokenIcon.call(void 0, targetSymbol) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
795
843
|
"img",
|
|
796
844
|
{
|
|
797
|
-
src:
|
|
845
|
+
src: _chunkPE6OK3FHcjs.getTokenIcon.call(void 0, targetSymbol),
|
|
798
846
|
alt: targetSymbol
|
|
799
847
|
}
|
|
800
848
|
) : targetSymbol.slice(0, 2) }),
|
|
801
849
|
(() => {
|
|
802
|
-
const chainIcon =
|
|
850
|
+
const chainIcon = _chunkPE6OK3FHcjs.getChainIcon.call(void 0, targetChain);
|
|
803
851
|
if (chainIcon) {
|
|
804
852
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
805
853
|
"img",
|
|
806
854
|
{
|
|
807
855
|
src: chainIcon,
|
|
808
|
-
alt:
|
|
856
|
+
alt: _chunkPE6OK3FHcjs.getChainName.call(void 0, targetChain),
|
|
809
857
|
className: "rs-flow-pill-chain-badge"
|
|
810
858
|
}
|
|
811
859
|
);
|
|
812
860
|
}
|
|
813
|
-
const badge =
|
|
861
|
+
const badge = _chunkPE6OK3FHcjs.getChainBadge.call(void 0, targetChain);
|
|
814
862
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
815
863
|
"div",
|
|
816
864
|
{
|
|
@@ -837,7 +885,7 @@ function AmountStep({
|
|
|
837
885
|
type: "button",
|
|
838
886
|
className: "rs-amount-preset-btn",
|
|
839
887
|
onClick: () => handlePresetClick(pct),
|
|
840
|
-
disabled:
|
|
888
|
+
disabled: balance === null,
|
|
841
889
|
children: [
|
|
842
890
|
pct,
|
|
843
891
|
"%"
|
|
@@ -851,7 +899,7 @@ function AmountStep({
|
|
|
851
899
|
type: "button",
|
|
852
900
|
className: "rs-amount-preset-btn",
|
|
853
901
|
onClick: () => handlePresetClick(100),
|
|
854
|
-
disabled:
|
|
902
|
+
disabled: balance === null,
|
|
855
903
|
children: "Max"
|
|
856
904
|
}
|
|
857
905
|
)
|
|
@@ -859,11 +907,11 @@ function AmountStep({
|
|
|
859
907
|
chainMismatch && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch", style: { marginTop: 16 }, children: [
|
|
860
908
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch-text", children: [
|
|
861
909
|
"Switch your wallet to ",
|
|
862
|
-
|
|
910
|
+
_chunkPE6OK3FHcjs.getChainName.call(void 0, asset.chainId),
|
|
863
911
|
" to continue."
|
|
864
912
|
] }),
|
|
865
913
|
switchChain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
866
|
-
|
|
914
|
+
_chunkG2RDCQHLcjs.Button,
|
|
867
915
|
{
|
|
868
916
|
variant: "outline",
|
|
869
917
|
size: "small",
|
|
@@ -896,15 +944,15 @@ function AmountStep({
|
|
|
896
944
|
] })
|
|
897
945
|
] }),
|
|
898
946
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
899
|
-
|
|
947
|
+
_chunkG2RDCQHLcjs.Button,
|
|
900
948
|
{
|
|
901
949
|
onClick: handleContinue,
|
|
902
950
|
fullWidth: true,
|
|
903
|
-
disabled: !
|
|
951
|
+
disabled: !amount || chainMismatch,
|
|
904
952
|
children: "Continue"
|
|
905
953
|
}
|
|
906
954
|
) }),
|
|
907
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
955
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG2RDCQHLcjs.PoweredBy, {})
|
|
908
956
|
] });
|
|
909
957
|
}
|
|
910
958
|
|
|
@@ -931,9 +979,9 @@ function ConfirmStep({
|
|
|
931
979
|
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
932
980
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
933
981
|
const [isSwitching, setIsSwitching] = _react.useState.call(void 0, false);
|
|
934
|
-
const chainMismatch = _optionalChain([walletClient, 'optionalAccess',
|
|
982
|
+
const chainMismatch = _optionalChain([walletClient, 'optionalAccess', _13 => _13.chain, 'optionalAccess', _14 => _14.id]) && walletClient.chain.id !== asset.chainId;
|
|
935
983
|
const sameRoute = targetChain === asset.chainId && targetToken.toLowerCase() === asset.token.toLowerCase();
|
|
936
|
-
const targetSymbol = sameRoute ? asset.symbol :
|
|
984
|
+
const targetSymbol = sameRoute ? asset.symbol : _chunkPE6OK3FHcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
937
985
|
const formattedAmount = amount && !Number.isNaN(Number(amount)) ? Number(amount).toLocaleString("en-US", { maximumFractionDigits: 6 }) : "0";
|
|
938
986
|
const tokenPriceUsd = _react.useMemo.call(void 0, () => {
|
|
939
987
|
if (asset.balanceUsd === void 0 || !asset.balance) return null;
|
|
@@ -943,7 +991,7 @@ function ConfirmStep({
|
|
|
943
991
|
);
|
|
944
992
|
if (!Number.isFinite(balanceUnits) || balanceUnits <= 0) return null;
|
|
945
993
|
return asset.balanceUsd / balanceUnits;
|
|
946
|
-
} catch (
|
|
994
|
+
} catch (e11) {
|
|
947
995
|
return null;
|
|
948
996
|
}
|
|
949
997
|
}, [asset.balanceUsd, asset.balance, asset.decimals]);
|
|
@@ -974,7 +1022,7 @@ function ConfirmStep({
|
|
|
974
1022
|
return receiveAmountUsd / targetTokenPriceUsd;
|
|
975
1023
|
}, [sameRoute, amount, receiveAmountUsd, targetTokenPriceUsd]);
|
|
976
1024
|
const formattedReceiveAmount = _react.useMemo.call(void 0, () => {
|
|
977
|
-
if (receiveTokenAmount === null) return
|
|
1025
|
+
if (receiveTokenAmount === null) return formattedAmount;
|
|
978
1026
|
return receiveTokenAmount.toLocaleString("en-US", {
|
|
979
1027
|
maximumFractionDigits: 6
|
|
980
1028
|
});
|
|
@@ -986,7 +1034,7 @@ function ConfirmStep({
|
|
|
986
1034
|
return;
|
|
987
1035
|
}
|
|
988
1036
|
if (chainMismatch) {
|
|
989
|
-
setError(`Switch to ${
|
|
1037
|
+
setError(`Switch to ${_chunkPE6OK3FHcjs.getChainName.call(void 0, asset.chainId)} to sign`);
|
|
990
1038
|
return;
|
|
991
1039
|
}
|
|
992
1040
|
const parsedAmount = parseFloat(amount);
|
|
@@ -997,7 +1045,7 @@ function ConfirmStep({
|
|
|
997
1045
|
let amountUnits;
|
|
998
1046
|
try {
|
|
999
1047
|
amountUnits = _viem.parseUnits.call(void 0, amount, asset.decimals);
|
|
1000
|
-
} catch (
|
|
1048
|
+
} catch (e12) {
|
|
1001
1049
|
setError("Please enter a valid amount");
|
|
1002
1050
|
return;
|
|
1003
1051
|
}
|
|
@@ -1014,7 +1062,7 @@ function ConfirmStep({
|
|
|
1014
1062
|
throw new Error("Wallet not properly connected");
|
|
1015
1063
|
}
|
|
1016
1064
|
const transferTo = sameRoute ? recipient : smartAccount;
|
|
1017
|
-
const hash =
|
|
1065
|
+
const hash = _chunkG2RDCQHLcjs.isNativeAsset.call(void 0, asset) ? await walletClient.sendTransaction({
|
|
1018
1066
|
account,
|
|
1019
1067
|
chain,
|
|
1020
1068
|
to: transferTo,
|
|
@@ -1027,13 +1075,13 @@ function ConfirmStep({
|
|
|
1027
1075
|
functionName: "transfer",
|
|
1028
1076
|
args: [transferTo, amountUnits]
|
|
1029
1077
|
});
|
|
1030
|
-
_optionalChain([onDepositSubmitted, 'optionalCall',
|
|
1078
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _15 => _15(hash, asset.chainId, amountUnits.toString())]);
|
|
1031
1079
|
onConfirm(hash, asset.chainId, amountUnits.toString(), asset.token);
|
|
1032
1080
|
} catch (err) {
|
|
1033
1081
|
const raw = err instanceof Error ? err.message : "Transfer failed";
|
|
1034
|
-
const message =
|
|
1082
|
+
const message = _chunkG2RDCQHLcjs.formatUserError.call(void 0, raw);
|
|
1035
1083
|
setError(message);
|
|
1036
|
-
_optionalChain([onError, 'optionalCall',
|
|
1084
|
+
_optionalChain([onError, 'optionalCall', _16 => _16(message, "TRANSFER_ERROR")]);
|
|
1037
1085
|
} finally {
|
|
1038
1086
|
setIsSubmitting(false);
|
|
1039
1087
|
}
|
|
@@ -1045,7 +1093,7 @@ function ConfirmStep({
|
|
|
1045
1093
|
await switchChain(asset.chainId);
|
|
1046
1094
|
} catch (err) {
|
|
1047
1095
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
1048
|
-
setError(
|
|
1096
|
+
setError(_chunkG2RDCQHLcjs.formatUserError.call(void 0, raw));
|
|
1049
1097
|
} finally {
|
|
1050
1098
|
setIsSwitching(false);
|
|
1051
1099
|
}
|
|
@@ -1062,15 +1110,15 @@ function ConfirmStep({
|
|
|
1062
1110
|
className: "rs-card-value",
|
|
1063
1111
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
1064
1112
|
children: [
|
|
1065
|
-
|
|
1113
|
+
_chunkPE6OK3FHcjs.getChainIcon.call(void 0, asset.chainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1066
1114
|
"img",
|
|
1067
1115
|
{
|
|
1068
|
-
src:
|
|
1116
|
+
src: _chunkPE6OK3FHcjs.getChainIcon.call(void 0, asset.chainId),
|
|
1069
1117
|
alt: "",
|
|
1070
|
-
style: { width: 16, height: 16, borderRadius:
|
|
1118
|
+
style: { width: 16, height: 16, borderRadius: 3 }
|
|
1071
1119
|
}
|
|
1072
1120
|
),
|
|
1073
|
-
|
|
1121
|
+
_chunkPE6OK3FHcjs.getChainName.call(void 0, asset.chainId)
|
|
1074
1122
|
]
|
|
1075
1123
|
}
|
|
1076
1124
|
)
|
|
@@ -1083,15 +1131,15 @@ function ConfirmStep({
|
|
|
1083
1131
|
className: "rs-card-value",
|
|
1084
1132
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
1085
1133
|
children: [
|
|
1086
|
-
|
|
1134
|
+
_chunkPE6OK3FHcjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1087
1135
|
"img",
|
|
1088
1136
|
{
|
|
1089
|
-
src:
|
|
1137
|
+
src: _chunkPE6OK3FHcjs.getChainIcon.call(void 0, targetChain),
|
|
1090
1138
|
alt: "",
|
|
1091
|
-
style: { width: 16, height: 16, borderRadius:
|
|
1139
|
+
style: { width: 16, height: 16, borderRadius: 3 }
|
|
1092
1140
|
}
|
|
1093
1141
|
),
|
|
1094
|
-
|
|
1142
|
+
_chunkPE6OK3FHcjs.getChainName.call(void 0, targetChain)
|
|
1095
1143
|
]
|
|
1096
1144
|
}
|
|
1097
1145
|
)
|
|
@@ -1110,10 +1158,10 @@ function ConfirmStep({
|
|
|
1110
1158
|
className: "rs-card-value",
|
|
1111
1159
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
1112
1160
|
children: [
|
|
1113
|
-
|
|
1161
|
+
_chunkPE6OK3FHcjs.getTokenIcon.call(void 0, asset.symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1114
1162
|
"img",
|
|
1115
1163
|
{
|
|
1116
|
-
src:
|
|
1164
|
+
src: _chunkPE6OK3FHcjs.getTokenIcon.call(void 0, asset.symbol),
|
|
1117
1165
|
alt: "",
|
|
1118
1166
|
style: { width: 16, height: 16, borderRadius: "50%" }
|
|
1119
1167
|
}
|
|
@@ -1133,10 +1181,10 @@ function ConfirmStep({
|
|
|
1133
1181
|
className: "rs-card-value",
|
|
1134
1182
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
1135
1183
|
children: [
|
|
1136
|
-
|
|
1184
|
+
_chunkPE6OK3FHcjs.getTokenIcon.call(void 0, targetSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1137
1185
|
"img",
|
|
1138
1186
|
{
|
|
1139
|
-
src:
|
|
1187
|
+
src: _chunkPE6OK3FHcjs.getTokenIcon.call(void 0, targetSymbol),
|
|
1140
1188
|
alt: "",
|
|
1141
1189
|
style: { width: 16, height: 16, borderRadius: "50%" }
|
|
1142
1190
|
}
|
|
@@ -1150,17 +1198,17 @@ function ConfirmStep({
|
|
|
1150
1198
|
] }),
|
|
1151
1199
|
receiveAmountUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
|
|
1152
1200
|
/* @__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:
|
|
1201
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-value", children: _chunkG2RDCQHLcjs.currencyFormatter.format(receiveAmountUsd) })
|
|
1154
1202
|
] })
|
|
1155
1203
|
] }),
|
|
1156
1204
|
chainMismatch && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch", children: [
|
|
1157
1205
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch-text", children: [
|
|
1158
1206
|
"Switch your wallet to ",
|
|
1159
|
-
|
|
1207
|
+
_chunkPE6OK3FHcjs.getChainName.call(void 0, asset.chainId),
|
|
1160
1208
|
" to sign."
|
|
1161
1209
|
] }),
|
|
1162
1210
|
switchChain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1163
|
-
|
|
1211
|
+
_chunkG2RDCQHLcjs.Button,
|
|
1164
1212
|
{
|
|
1165
1213
|
variant: "outline",
|
|
1166
1214
|
size: "small",
|
|
@@ -1193,7 +1241,7 @@ function ConfirmStep({
|
|
|
1193
1241
|
] })
|
|
1194
1242
|
] }),
|
|
1195
1243
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1196
|
-
|
|
1244
|
+
_chunkG2RDCQHLcjs.Button,
|
|
1197
1245
|
{
|
|
1198
1246
|
onClick: handleConfirm,
|
|
1199
1247
|
loading: isSubmitting,
|
|
@@ -1202,7 +1250,7 @@ function ConfirmStep({
|
|
|
1202
1250
|
children: "Confirm Order"
|
|
1203
1251
|
}
|
|
1204
1252
|
) }),
|
|
1205
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1253
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG2RDCQHLcjs.PoweredBy, {})
|
|
1206
1254
|
] });
|
|
1207
1255
|
}
|
|
1208
1256
|
|
|
@@ -1324,7 +1372,7 @@ function asAddress(value) {
|
|
|
1324
1372
|
return /^0x[a-fA-F0-9]{40}$/.test(value) ? value : void 0;
|
|
1325
1373
|
}
|
|
1326
1374
|
function getDepositEventDetails(event) {
|
|
1327
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
1375
|
+
if (!_optionalChain([event, 'optionalAccess', _17 => _17.type]) || !isRecord(event.data)) return {};
|
|
1328
1376
|
if (event.type === "deposit-received") {
|
|
1329
1377
|
return {
|
|
1330
1378
|
chainId: asNumber(event.data.chain),
|
|
@@ -1335,8 +1383,8 @@ function getDepositEventDetails(event) {
|
|
|
1335
1383
|
if (event.type === "bridge-started") {
|
|
1336
1384
|
const source = isRecord(event.data.source) ? event.data.source : void 0;
|
|
1337
1385
|
return {
|
|
1338
|
-
chainId: asNumber(_optionalChain([source, 'optionalAccess',
|
|
1339
|
-
token: asAddress(_optionalChain([source, 'optionalAccess',
|
|
1386
|
+
chainId: asNumber(_optionalChain([source, 'optionalAccess', _18 => _18.chain])),
|
|
1387
|
+
token: asAddress(_optionalChain([source, 'optionalAccess', _19 => _19.asset]))
|
|
1340
1388
|
};
|
|
1341
1389
|
}
|
|
1342
1390
|
return {};
|
|
@@ -1347,12 +1395,12 @@ function DepositAddressStep({
|
|
|
1347
1395
|
onDepositDetected,
|
|
1348
1396
|
onError
|
|
1349
1397
|
}) {
|
|
1350
|
-
const supportedChainIds = _react.useMemo.call(void 0, () =>
|
|
1398
|
+
const supportedChainIds = _react.useMemo.call(void 0, () => _chunkPE6OK3FHcjs.getSupportedChainIds.call(void 0, ), []);
|
|
1351
1399
|
const BASE_CHAIN_ID = 8453;
|
|
1352
1400
|
const defaultChainId = supportedChainIds.includes(BASE_CHAIN_ID) ? BASE_CHAIN_ID : supportedChainIds[0];
|
|
1353
1401
|
const [sourceChainId, setSourceChainId] = _react.useState.call(void 0, defaultChainId);
|
|
1354
1402
|
const tokensForChain = _react.useMemo.call(void 0,
|
|
1355
|
-
() =>
|
|
1403
|
+
() => _chunkPE6OK3FHcjs.getTargetTokenSymbolsForChain.call(void 0, sourceChainId),
|
|
1356
1404
|
[sourceChainId]
|
|
1357
1405
|
);
|
|
1358
1406
|
const defaultToken = tokensForChain.includes("USDC") ? "USDC" : _nullishCoalesce(tokensForChain[0], () => ( "USDC"));
|
|
@@ -1382,7 +1430,7 @@ function DepositAddressStep({
|
|
|
1382
1430
|
await navigator.clipboard.writeText(smartAccount);
|
|
1383
1431
|
setCopied(true);
|
|
1384
1432
|
setTimeout(() => setCopied(false), 2e3);
|
|
1385
|
-
} catch (
|
|
1433
|
+
} catch (e13) {
|
|
1386
1434
|
const textarea = document.createElement("textarea");
|
|
1387
1435
|
textarea.value = smartAccount;
|
|
1388
1436
|
textarea.style.position = "fixed";
|
|
@@ -1407,7 +1455,7 @@ function DepositAddressStep({
|
|
|
1407
1455
|
const status = await service.fetchLatestStatus(smartAccount);
|
|
1408
1456
|
if (cancelled || depositHandledRef.current) return;
|
|
1409
1457
|
const event = status.lastEvent;
|
|
1410
|
-
const eventTxHash =
|
|
1458
|
+
const eventTxHash = _chunkG2RDCQHLcjs.isDepositEvent.call(void 0, event) ? _nullishCoalesce(_optionalChain([_chunkG2RDCQHLcjs.getEventTxHash.call(void 0, event), 'optionalAccess', _20 => _20.toLowerCase, 'call', _21 => _21()]), () => ( null)) : null;
|
|
1411
1459
|
if (baselineTxHash === void 0) {
|
|
1412
1460
|
baselineTxHash = eventTxHash;
|
|
1413
1461
|
} else if (eventTxHash && eventTxHash !== baselineTxHash) {
|
|
@@ -1415,7 +1463,7 @@ function DepositAddressStep({
|
|
|
1415
1463
|
const fallback = sourceSelectionRef.current;
|
|
1416
1464
|
const chainId = _nullishCoalesce(details.chainId, () => ( fallback.chainId));
|
|
1417
1465
|
const amount = _nullishCoalesce(details.amount, () => ( "0"));
|
|
1418
|
-
const token = _nullishCoalesce(details.token, () => (
|
|
1466
|
+
const token = _nullishCoalesce(details.token, () => ( _chunkPE6OK3FHcjs.getTokenAddress.call(void 0, fallback.tokenSymbol, fallback.chainId)));
|
|
1419
1467
|
if (token) {
|
|
1420
1468
|
depositHandledRef.current = true;
|
|
1421
1469
|
onDepositDetected(eventTxHash, chainId, amount, token);
|
|
@@ -1427,7 +1475,7 @@ function DepositAddressStep({
|
|
|
1427
1475
|
if (!cancelled) {
|
|
1428
1476
|
const msg = err instanceof Error ? err.message : "Failed to check status";
|
|
1429
1477
|
setPollingError(msg);
|
|
1430
|
-
_optionalChain([onError, 'optionalCall',
|
|
1478
|
+
_optionalChain([onError, 'optionalCall', _22 => _22(msg, "STATUS_POLL_ERROR")]);
|
|
1431
1479
|
}
|
|
1432
1480
|
}
|
|
1433
1481
|
if (!cancelled && !depositHandledRef.current) {
|
|
@@ -1440,12 +1488,12 @@ function DepositAddressStep({
|
|
|
1440
1488
|
clearTimeout(timeoutId);
|
|
1441
1489
|
};
|
|
1442
1490
|
}, [smartAccount, service, onDepositDetected, onError]);
|
|
1443
|
-
const chainIconSrc =
|
|
1491
|
+
const chainIconSrc = _chunkPE6OK3FHcjs.getChainIcon.call(void 0, sourceChainId);
|
|
1444
1492
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
1445
1493
|
/* @__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
1494
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-selectors", children: [
|
|
1447
1495
|
/* @__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: "
|
|
1496
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-dropdown-label", children: "Fallback token" }),
|
|
1449
1497
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1450
1498
|
"button",
|
|
1451
1499
|
{
|
|
@@ -1456,10 +1504,10 @@ function DepositAddressStep({
|
|
|
1456
1504
|
setChainDropdownOpen(false);
|
|
1457
1505
|
},
|
|
1458
1506
|
children: [
|
|
1459
|
-
|
|
1507
|
+
_chunkPE6OK3FHcjs.getTokenIcon.call(void 0, sourceTokenSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1460
1508
|
"img",
|
|
1461
1509
|
{
|
|
1462
|
-
src:
|
|
1510
|
+
src: _chunkPE6OK3FHcjs.getTokenIcon.call(void 0, sourceTokenSymbol),
|
|
1463
1511
|
alt: "",
|
|
1464
1512
|
className: "rs-deposit-address-dropdown-icon"
|
|
1465
1513
|
}
|
|
@@ -1496,10 +1544,10 @@ function DepositAddressStep({
|
|
|
1496
1544
|
setTokenDropdownOpen(false);
|
|
1497
1545
|
},
|
|
1498
1546
|
children: [
|
|
1499
|
-
|
|
1547
|
+
_chunkPE6OK3FHcjs.getTokenIcon.call(void 0, symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1500
1548
|
"img",
|
|
1501
1549
|
{
|
|
1502
|
-
src:
|
|
1550
|
+
src: _chunkPE6OK3FHcjs.getTokenIcon.call(void 0, symbol),
|
|
1503
1551
|
alt: "",
|
|
1504
1552
|
className: "rs-deposit-address-dropdown-icon"
|
|
1505
1553
|
}
|
|
@@ -1511,7 +1559,7 @@ function DepositAddressStep({
|
|
|
1511
1559
|
)) })
|
|
1512
1560
|
] }),
|
|
1513
1561
|
/* @__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: "
|
|
1562
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-dropdown-label", children: "Fallback chain" }),
|
|
1515
1563
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1516
1564
|
"button",
|
|
1517
1565
|
{
|
|
@@ -1522,15 +1570,15 @@ function DepositAddressStep({
|
|
|
1522
1570
|
setTokenDropdownOpen(false);
|
|
1523
1571
|
},
|
|
1524
1572
|
children: [
|
|
1525
|
-
|
|
1573
|
+
_chunkPE6OK3FHcjs.getChainIcon.call(void 0, sourceChainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1526
1574
|
"img",
|
|
1527
1575
|
{
|
|
1528
|
-
src:
|
|
1576
|
+
src: _chunkPE6OK3FHcjs.getChainIcon.call(void 0, sourceChainId),
|
|
1529
1577
|
alt: "",
|
|
1530
1578
|
className: "rs-deposit-address-dropdown-icon"
|
|
1531
1579
|
}
|
|
1532
1580
|
),
|
|
1533
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
1581
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkPE6OK3FHcjs.getChainName.call(void 0, sourceChainId) }),
|
|
1534
1582
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1535
1583
|
"svg",
|
|
1536
1584
|
{
|
|
@@ -1562,15 +1610,15 @@ function DepositAddressStep({
|
|
|
1562
1610
|
setChainDropdownOpen(false);
|
|
1563
1611
|
},
|
|
1564
1612
|
children: [
|
|
1565
|
-
|
|
1613
|
+
_chunkPE6OK3FHcjs.getChainIcon.call(void 0, chainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1566
1614
|
"img",
|
|
1567
1615
|
{
|
|
1568
|
-
src:
|
|
1616
|
+
src: _chunkPE6OK3FHcjs.getChainIcon.call(void 0, chainId),
|
|
1569
1617
|
alt: "",
|
|
1570
1618
|
className: "rs-deposit-address-dropdown-icon"
|
|
1571
1619
|
}
|
|
1572
1620
|
),
|
|
1573
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
1621
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkPE6OK3FHcjs.getChainName.call(void 0, chainId) })
|
|
1574
1622
|
]
|
|
1575
1623
|
},
|
|
1576
1624
|
chainId
|
|
@@ -1620,7 +1668,7 @@ function DepositAddressStep({
|
|
|
1620
1668
|
] }),
|
|
1621
1669
|
pollingError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-error", children: pollingError })
|
|
1622
1670
|
] }) }),
|
|
1623
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1671
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkG2RDCQHLcjs.PoweredBy, {})
|
|
1624
1672
|
] });
|
|
1625
1673
|
}
|
|
1626
1674
|
DepositAddressStep.displayName = "DepositAddressStep";
|
|
@@ -1641,7 +1689,7 @@ function DepositFlow({
|
|
|
1641
1689
|
sourceToken: defaultSourceToken,
|
|
1642
1690
|
amount: defaultAmount,
|
|
1643
1691
|
recipient,
|
|
1644
|
-
signerAddress =
|
|
1692
|
+
signerAddress = _chunkPE6OK3FHcjs.DEFAULT_SIGNER_ADDRESS,
|
|
1645
1693
|
sessionChainIds,
|
|
1646
1694
|
forceRegister = false,
|
|
1647
1695
|
waitForFinalTx = true,
|
|
@@ -1666,15 +1714,15 @@ function DepositFlow({
|
|
|
1666
1714
|
const [isConnectSelectionConfirmed, setIsConnectSelectionConfirmed] = _react.useState.call(void 0, false);
|
|
1667
1715
|
const [selectedConnectAddress, setSelectedConnectAddress] = _react.useState.call(void 0, null);
|
|
1668
1716
|
const dappSwitchChain = _react.useMemo.call(void 0, () => {
|
|
1669
|
-
if (!_optionalChain([dappWalletClient, 'optionalAccess',
|
|
1717
|
+
if (!_optionalChain([dappWalletClient, 'optionalAccess', _23 => _23.switchChain])) return void 0;
|
|
1670
1718
|
return async (chainId) => {
|
|
1671
|
-
await _optionalChain([dappWalletClient, 'access',
|
|
1719
|
+
await _optionalChain([dappWalletClient, 'access', _24 => _24.switchChain, 'optionalCall', _25 => _25({ id: chainId })]);
|
|
1672
1720
|
};
|
|
1673
1721
|
}, [dappWalletClient]);
|
|
1674
1722
|
const walletOptions = _react.useMemo.call(void 0, () => {
|
|
1675
1723
|
const options = [];
|
|
1676
1724
|
const seen = /* @__PURE__ */ new Set();
|
|
1677
|
-
if (_optionalChain([dappWalletClient, 'optionalAccess',
|
|
1725
|
+
if (_optionalChain([dappWalletClient, 'optionalAccess', _26 => _26.account]) && dappAddress) {
|
|
1678
1726
|
options.push({
|
|
1679
1727
|
address: dappWalletClient.account.address,
|
|
1680
1728
|
label: "Connected Wallet",
|
|
@@ -1682,21 +1730,23 @@ function DepositFlow({
|
|
|
1682
1730
|
});
|
|
1683
1731
|
seen.add(dappWalletClient.account.address.toLowerCase());
|
|
1684
1732
|
}
|
|
1685
|
-
if (_optionalChain([reownWallet, 'optionalAccess',
|
|
1733
|
+
if (_optionalChain([reownWallet, 'optionalAccess', _27 => _27.address]) && reownWallet.isConnected && !seen.has(reownWallet.address.toLowerCase())) {
|
|
1686
1734
|
options.push({
|
|
1687
1735
|
address: reownWallet.address,
|
|
1688
1736
|
label: "External Wallet",
|
|
1689
|
-
kind: "external"
|
|
1737
|
+
kind: "external",
|
|
1738
|
+
icon: reownWallet.icon
|
|
1690
1739
|
});
|
|
1691
1740
|
}
|
|
1692
1741
|
return options;
|
|
1693
1742
|
}, [
|
|
1694
1743
|
dappWalletClient,
|
|
1695
1744
|
dappAddress,
|
|
1696
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
1697
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
1745
|
+
_optionalChain([reownWallet, 'optionalAccess', _28 => _28.address]),
|
|
1746
|
+
_optionalChain([reownWallet, 'optionalAccess', _29 => _29.isConnected]),
|
|
1747
|
+
_optionalChain([reownWallet, 'optionalAccess', _30 => _30.icon])
|
|
1698
1748
|
]);
|
|
1699
|
-
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess',
|
|
1749
|
+
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess', _31 => _31.account]) && dappAddress && !reownWallet;
|
|
1700
1750
|
const hasWalletOptions = walletOptions.length > 0;
|
|
1701
1751
|
const showConnectStep = !canAutoLock && !isConnectSelectionConfirmed;
|
|
1702
1752
|
const signerContext = _react.useMemo.call(void 0, () => {
|
|
@@ -1705,30 +1755,30 @@ function DepositFlow({
|
|
|
1705
1755
|
return {
|
|
1706
1756
|
ownerAddress: dappAddress,
|
|
1707
1757
|
walletClient: void 0,
|
|
1708
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
1758
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkG2RDCQHLcjs.getPublicClient.call(void 0, targetChain))),
|
|
1709
1759
|
switchChain: void 0
|
|
1710
1760
|
};
|
|
1711
1761
|
}
|
|
1712
1762
|
if (canAutoLock) {
|
|
1713
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
1763
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _32 => _32.chain, 'optionalAccess', _33 => _33.id]), () => ( targetChain));
|
|
1714
1764
|
return {
|
|
1715
1765
|
ownerAddress: dappWalletClient.account.address,
|
|
1716
1766
|
walletClient: dappWalletClient,
|
|
1717
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
1767
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkG2RDCQHLcjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
1718
1768
|
switchChain: dappSwitchChain
|
|
1719
1769
|
};
|
|
1720
1770
|
}
|
|
1721
1771
|
if (!isConnectSelectionConfirmed || !selectedConnectAddress) return null;
|
|
1722
|
-
if (_optionalChain([dappWalletClient, 'optionalAccess',
|
|
1723
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
1772
|
+
if (_optionalChain([dappWalletClient, 'optionalAccess', _34 => _34.account]) && dappWalletClient.account.address.toLowerCase() === selectedConnectAddress.toLowerCase()) {
|
|
1773
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _35 => _35.chain, 'optionalAccess', _36 => _36.id]), () => ( targetChain));
|
|
1724
1774
|
return {
|
|
1725
1775
|
ownerAddress: dappWalletClient.account.address,
|
|
1726
1776
|
walletClient: dappWalletClient,
|
|
1727
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
1777
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkG2RDCQHLcjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
1728
1778
|
switchChain: dappSwitchChain
|
|
1729
1779
|
};
|
|
1730
1780
|
}
|
|
1731
|
-
if (_optionalChain([reownWallet, 'optionalAccess',
|
|
1781
|
+
if (_optionalChain([reownWallet, 'optionalAccess', _37 => _37.address, 'optionalAccess', _38 => _38.toLowerCase, 'call', _39 => _39()]) === selectedConnectAddress.toLowerCase() && reownWallet.walletClient && reownWallet.publicClient) {
|
|
1732
1782
|
return {
|
|
1733
1783
|
ownerAddress: reownWallet.address,
|
|
1734
1784
|
walletClient: reownWallet.walletClient,
|
|
@@ -1749,7 +1799,7 @@ function DepositFlow({
|
|
|
1749
1799
|
reownWallet,
|
|
1750
1800
|
targetChain
|
|
1751
1801
|
]);
|
|
1752
|
-
const sessionKeyAddress = _nullishCoalesce(_nullishCoalesce(dappAddress, () => ( _optionalChain([signerContext, 'optionalAccess',
|
|
1802
|
+
const sessionKeyAddress = _nullishCoalesce(_nullishCoalesce(dappAddress, () => ( _optionalChain([signerContext, 'optionalAccess', _40 => _40.ownerAddress]))), () => ( null));
|
|
1753
1803
|
const lastTargetRef = _react.useRef.call(void 0, null);
|
|
1754
1804
|
_react.useEffect.call(void 0, () => {
|
|
1755
1805
|
const prev = lastTargetRef.current;
|
|
@@ -1768,6 +1818,7 @@ function DepositFlow({
|
|
|
1768
1818
|
}, []);
|
|
1769
1819
|
const handleBackFromSelectAsset = _react.useCallback.call(void 0, () => {
|
|
1770
1820
|
if (hasWalletOptions || reownWallet) {
|
|
1821
|
+
hasNavigatedBackRef.current = true;
|
|
1771
1822
|
setIsConnectSelectionConfirmed(false);
|
|
1772
1823
|
}
|
|
1773
1824
|
}, [hasWalletOptions, reownWallet]);
|
|
@@ -1775,6 +1826,7 @@ function DepositFlow({
|
|
|
1775
1826
|
setFlowMode(null);
|
|
1776
1827
|
setStep({ type: "setup" });
|
|
1777
1828
|
if (hasWalletOptions || reownWallet) {
|
|
1829
|
+
hasNavigatedBackRef.current = true;
|
|
1778
1830
|
setIsConnectSelectionConfirmed(false);
|
|
1779
1831
|
}
|
|
1780
1832
|
}, [hasWalletOptions, reownWallet]);
|
|
@@ -1792,10 +1844,10 @@ function DepositFlow({
|
|
|
1792
1844
|
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;
|
|
1793
1845
|
const currentBackHandler = step.type === "deposit-address" ? handleBackFromDepositAddress : step.type === "select-asset" && signerContext && !canAutoLock ? handleBackFromSelectAsset : step.type === "amount" ? handleBackFromAmount : step.type === "confirm" ? handleBackFromConfirm : void 0;
|
|
1794
1846
|
_react.useEffect.call(void 0, () => {
|
|
1795
|
-
_optionalChain([onStepChange, 'optionalCall',
|
|
1847
|
+
_optionalChain([onStepChange, 'optionalCall', _41 => _41(stepIndex, currentBackHandler)]);
|
|
1796
1848
|
}, [stepIndex, currentBackHandler, onStepChange]);
|
|
1797
1849
|
_react.useEffect.call(void 0, () => {
|
|
1798
|
-
_optionalChain([onTotalBalanceChange, 'optionalCall',
|
|
1850
|
+
_optionalChain([onTotalBalanceChange, 'optionalCall', _42 => _42(totalBalanceUsd)]);
|
|
1799
1851
|
}, [totalBalanceUsd, onTotalBalanceChange]);
|
|
1800
1852
|
const isDepositAddressMode = flowMode === "deposit-address";
|
|
1801
1853
|
const handleSelectProvider = _react.useCallback.call(void 0, () => {
|
|
@@ -1833,13 +1885,13 @@ function DepositFlow({
|
|
|
1833
1885
|
directTransfer: isSameRoute(chainId, token, targetChain, targetToken)
|
|
1834
1886
|
};
|
|
1835
1887
|
});
|
|
1836
|
-
_optionalChain([onDepositSubmitted, 'optionalCall',
|
|
1888
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _43 => _43({ txHash, sourceChain: chainId, amount })]);
|
|
1837
1889
|
},
|
|
1838
1890
|
[onDepositSubmitted, targetChain, targetToken]
|
|
1839
1891
|
);
|
|
1840
1892
|
const handleConnected = _react.useCallback.call(void 0,
|
|
1841
1893
|
(addr, smartAccount) => {
|
|
1842
|
-
_optionalChain([onConnected, 'optionalCall',
|
|
1894
|
+
_optionalChain([onConnected, 'optionalCall', _44 => _44({ address: addr, smartAccount })]);
|
|
1843
1895
|
},
|
|
1844
1896
|
[onConnected]
|
|
1845
1897
|
);
|
|
@@ -1891,25 +1943,25 @@ function DepositFlow({
|
|
|
1891
1943
|
);
|
|
1892
1944
|
const handleDepositSubmittedCallback = _react.useCallback.call(void 0,
|
|
1893
1945
|
(txHash, sourceChain, amount) => {
|
|
1894
|
-
_optionalChain([onDepositSubmitted, 'optionalCall',
|
|
1946
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _45 => _45({ txHash, sourceChain, amount })]);
|
|
1895
1947
|
},
|
|
1896
1948
|
[onDepositSubmitted]
|
|
1897
1949
|
);
|
|
1898
1950
|
const handleDepositComplete = _react.useCallback.call(void 0,
|
|
1899
1951
|
(txHash, destinationTxHash) => {
|
|
1900
|
-
_optionalChain([onDepositComplete, 'optionalCall',
|
|
1952
|
+
_optionalChain([onDepositComplete, 'optionalCall', _46 => _46({ txHash, destinationTxHash })]);
|
|
1901
1953
|
},
|
|
1902
1954
|
[onDepositComplete]
|
|
1903
1955
|
);
|
|
1904
1956
|
const handleDepositFailed = _react.useCallback.call(void 0,
|
|
1905
1957
|
(txHash, error) => {
|
|
1906
|
-
_optionalChain([onDepositFailed, 'optionalCall',
|
|
1958
|
+
_optionalChain([onDepositFailed, 'optionalCall', _47 => _47({ txHash, error })]);
|
|
1907
1959
|
},
|
|
1908
1960
|
[onDepositFailed]
|
|
1909
1961
|
);
|
|
1910
1962
|
const handleError = _react.useCallback.call(void 0,
|
|
1911
1963
|
(message, code) => {
|
|
1912
|
-
_optionalChain([onError, 'optionalCall',
|
|
1964
|
+
_optionalChain([onError, 'optionalCall', _48 => _48({ message, code })]);
|
|
1913
1965
|
},
|
|
1914
1966
|
[onError]
|
|
1915
1967
|
);
|
|
@@ -1927,12 +1979,39 @@ function DepositFlow({
|
|
|
1927
1979
|
() => walletOptions.map((option) => option.address.toLowerCase()).join(","),
|
|
1928
1980
|
[walletOptions]
|
|
1929
1981
|
);
|
|
1982
|
+
const hasNavigatedBackRef = _react.useRef.call(void 0, false);
|
|
1930
1983
|
_react.useEffect.call(void 0, () => {
|
|
1931
1984
|
setIsConnectSelectionConfirmed(false);
|
|
1932
|
-
}, [walletOptionsKey
|
|
1985
|
+
}, [walletOptionsKey]);
|
|
1986
|
+
_react.useEffect.call(void 0, () => {
|
|
1987
|
+
if (hasNavigatedBackRef.current || isConnectSelectionConfirmed || flowMode) {
|
|
1988
|
+
return;
|
|
1989
|
+
}
|
|
1990
|
+
if (hasWalletOptions) {
|
|
1991
|
+
const address = selectedConnectAddressEffective;
|
|
1992
|
+
if (address) {
|
|
1993
|
+
setSelectedConnectAddress(address);
|
|
1994
|
+
handleSelectProvider();
|
|
1995
|
+
setIsConnectSelectionConfirmed(true);
|
|
1996
|
+
return;
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
if (!hasWalletOptions && dappAddress) {
|
|
2000
|
+
handleSelectTransferCrypto();
|
|
2001
|
+
setIsConnectSelectionConfirmed(true);
|
|
2002
|
+
}
|
|
2003
|
+
}, [
|
|
2004
|
+
hasWalletOptions,
|
|
2005
|
+
isConnectSelectionConfirmed,
|
|
2006
|
+
flowMode,
|
|
2007
|
+
selectedConnectAddressEffective,
|
|
2008
|
+
dappAddress,
|
|
2009
|
+
handleSelectProvider,
|
|
2010
|
+
handleSelectTransferCrypto
|
|
2011
|
+
]);
|
|
1933
2012
|
if (showConnectStep) {
|
|
1934
2013
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1935
|
-
|
|
2014
|
+
_chunkG2RDCQHLcjs.ConnectStep,
|
|
1936
2015
|
{
|
|
1937
2016
|
walletOptions,
|
|
1938
2017
|
selectedAddress: selectedConnectAddressEffective,
|
|
@@ -1983,7 +2062,7 @@ function DepositFlow({
|
|
|
1983
2062
|
}
|
|
1984
2063
|
),
|
|
1985
2064
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1986
|
-
|
|
2065
|
+
_chunkG2RDCQHLcjs.ProcessingStep,
|
|
1987
2066
|
{
|
|
1988
2067
|
smartAccount: step.smartAccount,
|
|
1989
2068
|
txHash: step.txHash,
|
|
@@ -2005,16 +2084,16 @@ function DepositFlow({
|
|
|
2005
2084
|
)
|
|
2006
2085
|
] });
|
|
2007
2086
|
}
|
|
2008
|
-
if (!_optionalChain([signerContext, 'optionalAccess',
|
|
2087
|
+
if (!_optionalChain([signerContext, 'optionalAccess', _49 => _49.walletClient]) || !_optionalChain([signerContext, 'optionalAccess', _50 => _50.publicClient])) {
|
|
2009
2088
|
return null;
|
|
2010
2089
|
}
|
|
2011
2090
|
const ownerAddress = signerContext.ownerAddress;
|
|
2012
|
-
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access',
|
|
2091
|
+
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));
|
|
2013
2092
|
const getReadClientForChain = (chainId) => {
|
|
2014
|
-
if (_optionalChain([signerContext, 'access',
|
|
2093
|
+
if (_optionalChain([signerContext, 'access', _57 => _57.publicClient, 'access', _58 => _58.chain, 'optionalAccess', _59 => _59.id]) === chainId) {
|
|
2015
2094
|
return signerContext.publicClient;
|
|
2016
2095
|
}
|
|
2017
|
-
return
|
|
2096
|
+
return _chunkG2RDCQHLcjs.getPublicClient.call(void 0, chainId);
|
|
2018
2097
|
};
|
|
2019
2098
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
2020
2099
|
step.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2080,7 +2159,7 @@ function DepositFlow({
|
|
|
2080
2159
|
}
|
|
2081
2160
|
),
|
|
2082
2161
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2083
|
-
|
|
2162
|
+
_chunkG2RDCQHLcjs.ProcessingStep,
|
|
2084
2163
|
{
|
|
2085
2164
|
smartAccount: step.smartAccount,
|
|
2086
2165
|
txHash: step.txHash,
|
|
@@ -2105,7 +2184,7 @@ function DepositFlow({
|
|
|
2105
2184
|
// src/DepositModal.tsx
|
|
2106
2185
|
|
|
2107
2186
|
var ReownDepositInner = _react.lazy.call(void 0,
|
|
2108
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-
|
|
2187
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-N7GCYZF7.cjs"))).then((m) => ({ default: m.DepositModalReown }))
|
|
2109
2188
|
);
|
|
2110
2189
|
function DepositModal(props) {
|
|
2111
2190
|
const needsReown = !!props.reownAppId;
|
|
@@ -2128,8 +2207,8 @@ function DepositModalInner({
|
|
|
2128
2207
|
sourceToken,
|
|
2129
2208
|
defaultAmount,
|
|
2130
2209
|
recipient,
|
|
2131
|
-
backendUrl =
|
|
2132
|
-
signerAddress =
|
|
2210
|
+
backendUrl = _chunkPE6OK3FHcjs.DEFAULT_BACKEND_URL,
|
|
2211
|
+
signerAddress = _chunkPE6OK3FHcjs.DEFAULT_SIGNER_ADDRESS,
|
|
2133
2212
|
sessionChainIds,
|
|
2134
2213
|
forceRegister = false,
|
|
2135
2214
|
waitForFinalTx = true,
|
|
@@ -2153,19 +2232,19 @@ function DepositModalInner({
|
|
|
2153
2232
|
const [currentStepIndex, setCurrentStepIndex] = _react.useState.call(void 0, 0);
|
|
2154
2233
|
const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, null);
|
|
2155
2234
|
const backHandlerRef = _react.useRef.call(void 0, void 0);
|
|
2156
|
-
const targetChain =
|
|
2157
|
-
const sourceChain = sourceChainProp ?
|
|
2158
|
-
const service = _react.useMemo.call(void 0, () =>
|
|
2235
|
+
const targetChain = _chunkPE6OK3FHcjs.getChainId.call(void 0, targetChainProp);
|
|
2236
|
+
const sourceChain = sourceChainProp ? _chunkPE6OK3FHcjs.getChainId.call(void 0, sourceChainProp) : void 0;
|
|
2237
|
+
const service = _react.useMemo.call(void 0, () => _chunkG2RDCQHLcjs.createDepositService.call(void 0, backendUrl), [backendUrl]);
|
|
2159
2238
|
_react.useEffect.call(void 0, () => {
|
|
2160
2239
|
if (isOpen && modalRef.current) {
|
|
2161
|
-
|
|
2240
|
+
_chunkG2RDCQHLcjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
2162
2241
|
}
|
|
2163
2242
|
}, [isOpen, theme]);
|
|
2164
2243
|
const hasCalledReady = _react.useRef.call(void 0, false);
|
|
2165
2244
|
_react.useEffect.call(void 0, () => {
|
|
2166
2245
|
if (isOpen && !hasCalledReady.current) {
|
|
2167
2246
|
hasCalledReady.current = true;
|
|
2168
|
-
_optionalChain([onReady, 'optionalCall',
|
|
2247
|
+
_optionalChain([onReady, 'optionalCall', _60 => _60()]);
|
|
2169
2248
|
}
|
|
2170
2249
|
}, [isOpen, onReady]);
|
|
2171
2250
|
_react.useEffect.call(void 0, () => {
|
|
@@ -2180,21 +2259,21 @@ function DepositModalInner({
|
|
|
2180
2259
|
},
|
|
2181
2260
|
[]
|
|
2182
2261
|
);
|
|
2183
|
-
const handleTotalBalanceChange = _react.useCallback.call(void 0, (
|
|
2184
|
-
setTotalBalanceUsd(
|
|
2262
|
+
const handleTotalBalanceChange = _react.useCallback.call(void 0, (balance2) => {
|
|
2263
|
+
setTotalBalanceUsd(balance2);
|
|
2185
2264
|
}, []);
|
|
2186
2265
|
const handleBack = _react.useCallback.call(void 0, () => {
|
|
2187
|
-
_optionalChain([backHandlerRef, 'access',
|
|
2266
|
+
_optionalChain([backHandlerRef, 'access', _61 => _61.current, 'optionalCall', _62 => _62()]);
|
|
2188
2267
|
}, []);
|
|
2189
|
-
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2190
|
-
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2191
|
-
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2192
|
-
const
|
|
2193
|
-
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess',
|
|
2194
|
-
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess',
|
|
2268
|
+
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _63 => _63.showLogo]), () => ( false));
|
|
2269
|
+
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _64 => _64.showStepper]), () => ( false));
|
|
2270
|
+
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _65 => _65.showBackButton]), () => ( true));
|
|
2271
|
+
const balance = _optionalChain([uiConfig, 'optionalAccess', _66 => _66.balance]);
|
|
2272
|
+
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _67 => _67.logoUrl]), () => ( "https://github.com/rhinestonewtf.png"));
|
|
2273
|
+
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _68 => _68.title]), () => ( "Deposit"));
|
|
2195
2274
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 4 && backHandlerRef.current !== void 0;
|
|
2196
2275
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2197
|
-
|
|
2276
|
+
_chunkG2RDCQHLcjs.Modal,
|
|
2198
2277
|
{
|
|
2199
2278
|
isOpen,
|
|
2200
2279
|
onClose,
|
|
@@ -2250,12 +2329,12 @@ function DepositModalInner({
|
|
|
2250
2329
|
i
|
|
2251
2330
|
)) })
|
|
2252
2331
|
] }),
|
|
2253
|
-
|
|
2332
|
+
balance && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header-balance", children: [
|
|
2254
2333
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
|
|
2255
|
-
|
|
2334
|
+
balance.title,
|
|
2256
2335
|
":"
|
|
2257
2336
|
] }),
|
|
2258
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children:
|
|
2337
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ? _chunkG2RDCQHLcjs.currencyFormatter.format(totalBalanceUsd) : null))) })
|
|
2259
2338
|
] })
|
|
2260
2339
|
] }),
|
|
2261
2340
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|