@rhinestone/deposit-modal 0.1.31 → 0.1.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DepositModalReown-S7HER5HU.mjs → DepositModalReown-SZPCCNPH.mjs} +9 -5
- package/dist/{DepositModalReown-N7GCYZF7.cjs → DepositModalReown-XUAEWIW7.cjs} +12 -8
- package/dist/{WithdrawModalReown-DJCJ5U7E.cjs → WithdrawModalReown-53FDOZG2.cjs} +12 -8
- package/dist/{WithdrawModalReown-DMDRLYTE.mjs → WithdrawModalReown-YGGV7BL2.mjs} +9 -5
- package/dist/{chunk-VKQA3FO3.cjs → chunk-52FVEYTL.cjs} +4 -0
- package/dist/{chunk-3ICS43XC.mjs → chunk-C6I5TFSL.mjs} +4 -0
- package/dist/{chunk-EVU7M7A6.mjs → chunk-DLFUXLAM.mjs} +14 -13
- package/dist/{chunk-CS6UIMCF.mjs → chunk-K2JJKFTV.mjs} +5 -1
- package/dist/{chunk-AWFJFSPH.mjs → chunk-MKKJ7ZE2.mjs} +117 -176
- package/dist/{chunk-MU2BOEDN.cjs → chunk-NYEWO4NW.cjs} +195 -254
- package/dist/{chunk-SLI5FHTT.mjs → chunk-RR25E5DZ.mjs} +29 -9
- package/dist/{chunk-PE6OK3FH.cjs → chunk-S4UBVD3H.cjs} +5 -1
- package/dist/{chunk-SZ35G2DT.cjs → chunk-SQDXU7ML.cjs} +87 -67
- package/dist/{chunk-G2RDCQHL.cjs → chunk-YIHOACM3.cjs} +38 -37
- package/dist/constants.cjs +2 -2
- package/dist/constants.mjs +1 -1
- package/dist/deposit.cjs +4 -4
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +3 -3
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +4 -4
- package/dist/reown.cjs +5 -5
- package/dist/reown.d.cts +1 -1
- package/dist/reown.d.ts +1 -1
- package/dist/reown.mjs +4 -4
- package/dist/{types-DTBfMH0p.d.ts → types-Bp2n2RQ3.d.ts} +0 -1
- package/dist/{types-DELv717e.d.cts → types-CIaQPR6F.d.cts} +0 -1
- package/dist/withdraw.cjs +4 -4
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +2 -2
- package/dist/withdraw.mjs +3 -3
- package/package.json +1 -1
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _chunkYIHOACM3cjs = require('./chunk-YIHOACM3.cjs');
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
@@ -36,7 +36,8 @@ var _chunkG2RDCQHLcjs = require('./chunk-G2RDCQHL.cjs');
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
|
|
40
|
+
var _chunkS4UBVD3Hcjs = require('./chunk-S4UBVD3H.cjs');
|
|
40
41
|
|
|
41
42
|
// src/DepositModal.tsx
|
|
42
43
|
|
|
@@ -56,15 +57,15 @@ var _react = require('react');
|
|
|
56
57
|
|
|
57
58
|
var _jsxruntime = require('react/jsx-runtime');
|
|
58
59
|
async function resolveSessionOwner(eoaAddress) {
|
|
59
|
-
const localOwner =
|
|
60
|
+
const localOwner = _chunkYIHOACM3cjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
|
|
60
61
|
if (localOwner) {
|
|
61
62
|
return {
|
|
62
|
-
account:
|
|
63
|
+
account: _chunkYIHOACM3cjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
|
|
63
64
|
address: localOwner.address
|
|
64
65
|
};
|
|
65
66
|
}
|
|
66
|
-
const created =
|
|
67
|
-
|
|
67
|
+
const created = _chunkYIHOACM3cjs.createSessionOwnerKey.call(void 0, );
|
|
68
|
+
_chunkYIHOACM3cjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
|
|
68
69
|
return {
|
|
69
70
|
account: created.account,
|
|
70
71
|
address: created.address
|
|
@@ -126,7 +127,7 @@ function SetupStep({
|
|
|
126
127
|
primaryType: typedData.primaryType,
|
|
127
128
|
message: typedData.message
|
|
128
129
|
});
|
|
129
|
-
const sessionDetails =
|
|
130
|
+
const sessionDetails = _chunkYIHOACM3cjs.buildSessionDetails.call(void 0, setup.sessionDetailsUnsigned, signature);
|
|
130
131
|
setState({ type: "registering" });
|
|
131
132
|
await service.registerAccount({
|
|
132
133
|
address: smartAccount,
|
|
@@ -197,7 +198,7 @@ function SetupStep({
|
|
|
197
198
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
198
199
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", children: [
|
|
199
200
|
isLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
200
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
201
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYIHOACM3cjs.Spinner, { className: "rs-spinner--lg rs-text-accent" }),
|
|
201
202
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-text", children: [
|
|
202
203
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: renderStateMessage() }),
|
|
203
204
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-subtitle", children: "This may take a moment" })
|
|
@@ -234,7 +235,7 @@ function SetupStep({
|
|
|
234
235
|
] })
|
|
235
236
|
] })
|
|
236
237
|
] }),
|
|
237
|
-
isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
238
|
+
isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYIHOACM3cjs.Button, { onClick: handleRetry, variant: "default", fullWidth: true, children: "Try Again" }) })
|
|
238
239
|
] });
|
|
239
240
|
}
|
|
240
241
|
|
|
@@ -249,7 +250,8 @@ function AssetSelectStep({
|
|
|
249
250
|
defaultSourceToken,
|
|
250
251
|
service,
|
|
251
252
|
onContinue,
|
|
252
|
-
onTotalBalanceComputed
|
|
253
|
+
onTotalBalanceComputed,
|
|
254
|
+
onAssetsLoaded
|
|
253
255
|
}) {
|
|
254
256
|
const [assets, setAssets] = _react.useState.call(void 0, []);
|
|
255
257
|
const [selectedAssetId, setSelectedAssetId] = _react.useState.call(void 0, null);
|
|
@@ -257,7 +259,7 @@ function AssetSelectStep({
|
|
|
257
259
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
258
260
|
const defaultAssetId = _react.useMemo.call(void 0, () => {
|
|
259
261
|
if (!defaultSourceChain || !defaultSourceToken) return null;
|
|
260
|
-
return
|
|
262
|
+
return _chunkYIHOACM3cjs.getAssetId.call(void 0, {
|
|
261
263
|
chainId: defaultSourceChain,
|
|
262
264
|
token: defaultSourceToken
|
|
263
265
|
});
|
|
@@ -274,10 +276,10 @@ function AssetSelectStep({
|
|
|
274
276
|
try {
|
|
275
277
|
const portfolio = await service.fetchPortfolio(address);
|
|
276
278
|
if (!active) return;
|
|
277
|
-
const portfolioAssets =
|
|
279
|
+
const portfolioAssets = _chunkYIHOACM3cjs.portfolioToAssets.call(void 0, portfolio.tokens);
|
|
278
280
|
setAssets(portfolioAssets);
|
|
279
281
|
const hasNative = portfolioAssets.some(
|
|
280
|
-
(asset) => asset.token.toLowerCase() ===
|
|
282
|
+
(asset) => asset.token.toLowerCase() === _chunkS4UBVD3Hcjs.NATIVE_TOKEN_ADDRESS
|
|
281
283
|
);
|
|
282
284
|
if (!hasNative) {
|
|
283
285
|
const nativeAssets = await fetchNativeAssets(
|
|
@@ -316,7 +318,8 @@ function AssetSelectStep({
|
|
|
316
318
|
0
|
|
317
319
|
);
|
|
318
320
|
_optionalChain([onTotalBalanceComputed, 'optionalCall', _4 => _4(total)]);
|
|
319
|
-
|
|
321
|
+
if (assets.length > 0) _optionalChain([onAssetsLoaded, 'optionalCall', _5 => _5(assets)]);
|
|
322
|
+
}, [assets, onTotalBalanceComputed, onAssetsLoaded]);
|
|
320
323
|
const rows = _react.useMemo.call(void 0, () => {
|
|
321
324
|
return assets.filter((a) => {
|
|
322
325
|
try {
|
|
@@ -342,7 +345,7 @@ function AssetSelectStep({
|
|
|
342
345
|
const raw = _viem.formatUnits.call(void 0, BigInt(asset.balance), asset.decimals);
|
|
343
346
|
const numeric = Number(raw);
|
|
344
347
|
if (!Number.isFinite(numeric)) return raw;
|
|
345
|
-
return
|
|
348
|
+
return _chunkYIHOACM3cjs.tokenFormatter.format(numeric);
|
|
346
349
|
} catch (e3) {
|
|
347
350
|
return asset.balance;
|
|
348
351
|
}
|
|
@@ -356,7 +359,7 @@ function AssetSelectStep({
|
|
|
356
359
|
style: { paddingTop: 4, overflow: "auto", maxHeight: 340 },
|
|
357
360
|
children: [
|
|
358
361
|
loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
359
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
362
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYIHOACM3cjs.Spinner, { className: "rs-text-tertiary" }),
|
|
360
363
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
361
364
|
] }),
|
|
362
365
|
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-alert rs-alert--error", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-alert-text", children: error }) }),
|
|
@@ -389,9 +392,9 @@ function AssetSelectStep({
|
|
|
389
392
|
!loading && !error && rows.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-list", children: rows.map((asset) => {
|
|
390
393
|
const isSelected = selectedAssetId === asset.id;
|
|
391
394
|
const tokenAmount = formatBalance(asset);
|
|
392
|
-
const badge =
|
|
393
|
-
const tokenIcon =
|
|
394
|
-
const chainIcon =
|
|
395
|
+
const badge = _chunkS4UBVD3Hcjs.getChainBadge.call(void 0, asset.chainId);
|
|
396
|
+
const tokenIcon = _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, asset.symbol);
|
|
397
|
+
const chainIcon = _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, asset.chainId);
|
|
395
398
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
396
399
|
"button",
|
|
397
400
|
{
|
|
@@ -415,7 +418,7 @@ function AssetSelectStep({
|
|
|
415
418
|
"img",
|
|
416
419
|
{
|
|
417
420
|
src: chainIcon,
|
|
418
|
-
alt:
|
|
421
|
+
alt: _chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId),
|
|
419
422
|
className: "rs-asset-chain-badge"
|
|
420
423
|
}
|
|
421
424
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -436,7 +439,7 @@ function AssetSelectStep({
|
|
|
436
439
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-asset-chain", children: [
|
|
437
440
|
" ",
|
|
438
441
|
"on ",
|
|
439
|
-
|
|
442
|
+
_chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId)
|
|
440
443
|
] })
|
|
441
444
|
] }),
|
|
442
445
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-balance-small", children: [
|
|
@@ -446,7 +449,7 @@ function AssetSelectStep({
|
|
|
446
449
|
] })
|
|
447
450
|
] })
|
|
448
451
|
] }),
|
|
449
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ?
|
|
452
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ? _chunkYIHOACM3cjs.currencyFormatter.format(asset.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${asset.symbol}` : "--" })
|
|
450
453
|
]
|
|
451
454
|
},
|
|
452
455
|
asset.id
|
|
@@ -456,7 +459,7 @@ function AssetSelectStep({
|
|
|
456
459
|
}
|
|
457
460
|
),
|
|
458
461
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
459
|
-
|
|
462
|
+
_chunkYIHOACM3cjs.Button,
|
|
460
463
|
{
|
|
461
464
|
onClick: () => selectedAsset && onContinue(selectedAsset),
|
|
462
465
|
disabled: !selectedAsset,
|
|
@@ -464,17 +467,17 @@ function AssetSelectStep({
|
|
|
464
467
|
children: "Continue"
|
|
465
468
|
}
|
|
466
469
|
) }),
|
|
467
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
470
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYIHOACM3cjs.PoweredBy, {})
|
|
468
471
|
] });
|
|
469
472
|
}
|
|
470
473
|
async function fetchNativeAssets(address, publicClient, existing) {
|
|
471
474
|
const existingIds = new Set(existing.map((asset) => asset.id));
|
|
472
|
-
const connectedChainId = _optionalChain([publicClient, 'access',
|
|
475
|
+
const connectedChainId = _optionalChain([publicClient, 'access', _6 => _6.chain, 'optionalAccess', _7 => _7.id]);
|
|
473
476
|
if (!connectedChainId) return [];
|
|
474
|
-
if (!
|
|
475
|
-
const id =
|
|
477
|
+
if (!_chunkS4UBVD3Hcjs.SOURCE_CHAINS.some((chain) => chain.id === connectedChainId)) return [];
|
|
478
|
+
const id = _chunkYIHOACM3cjs.getAssetId.call(void 0, {
|
|
476
479
|
chainId: connectedChainId,
|
|
477
|
-
token:
|
|
480
|
+
token: _chunkS4UBVD3Hcjs.NATIVE_TOKEN_ADDRESS
|
|
478
481
|
});
|
|
479
482
|
if (existingIds.has(id)) return [];
|
|
480
483
|
try {
|
|
@@ -483,7 +486,7 @@ async function fetchNativeAssets(address, publicClient, existing) {
|
|
|
483
486
|
{
|
|
484
487
|
id,
|
|
485
488
|
chainId: connectedChainId,
|
|
486
|
-
token:
|
|
489
|
+
token: _chunkS4UBVD3Hcjs.NATIVE_TOKEN_ADDRESS,
|
|
487
490
|
symbol: "ETH",
|
|
488
491
|
name: "Ethereum",
|
|
489
492
|
decimals: 18,
|
|
@@ -531,8 +534,10 @@ function AmountStep({
|
|
|
531
534
|
const [isSwitching, setIsSwitching] = _react.useState.call(void 0, false);
|
|
532
535
|
const hasAttemptedSwitch = _react.useRef.call(void 0, false);
|
|
533
536
|
const chainMismatch = Boolean(
|
|
534
|
-
_optionalChain([walletClient, 'optionalAccess',
|
|
537
|
+
_optionalChain([walletClient, 'optionalAccess', _8 => _8.chain, 'optionalAccess', _9 => _9.id]) && walletClient.chain.id !== asset.chainId
|
|
535
538
|
);
|
|
539
|
+
const targetSymbol = _chunkS4UBVD3Hcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
540
|
+
const isSourceStablecoin = _chunkS4UBVD3Hcjs.isStablecoinSymbol.call(void 0, asset.symbol);
|
|
536
541
|
const tokenPriceUsd = _react.useMemo.call(void 0, () => {
|
|
537
542
|
if (tokenPriceUsdOverride !== void 0 && tokenPriceUsdOverride > 0)
|
|
538
543
|
return tokenPriceUsdOverride;
|
|
@@ -556,7 +561,7 @@ function AmountStep({
|
|
|
556
561
|
const balanceTarget = _nullishCoalesce(balanceAddress, () => ( address));
|
|
557
562
|
if (!balanceTarget || !publicClient) return;
|
|
558
563
|
try {
|
|
559
|
-
const bal =
|
|
564
|
+
const bal = _chunkYIHOACM3cjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: balanceTarget }) : await publicClient.readContract({
|
|
560
565
|
address: asset.token,
|
|
561
566
|
abi: _viem.erc20Abi,
|
|
562
567
|
functionName: "balanceOf",
|
|
@@ -592,15 +597,10 @@ function AmountStep({
|
|
|
592
597
|
if (defaultAmount && !amount) {
|
|
593
598
|
const parsed = Number(defaultAmount);
|
|
594
599
|
if (Number.isFinite(parsed) && parsed > 0) {
|
|
595
|
-
|
|
596
|
-
const usdValue = parsed * tokenPriceUsd;
|
|
597
|
-
setAmount(usdValue.toFixed(2));
|
|
598
|
-
} else {
|
|
599
|
-
setAmount(parsed.toString());
|
|
600
|
-
}
|
|
600
|
+
setAmount(parsed.toString());
|
|
601
601
|
}
|
|
602
602
|
}
|
|
603
|
-
}, [defaultAmount,
|
|
603
|
+
}, [defaultAmount, amount]);
|
|
604
604
|
const balanceUsd = _react.useMemo.call(void 0, () => {
|
|
605
605
|
if (balance === null || tokenPriceUsd === null) return null;
|
|
606
606
|
try {
|
|
@@ -612,7 +612,7 @@ function AmountStep({
|
|
|
612
612
|
}
|
|
613
613
|
}, [balance, tokenPriceUsd, asset.decimals]);
|
|
614
614
|
_react.useEffect.call(void 0, () => {
|
|
615
|
-
_optionalChain([onBalanceUsdChange, 'optionalCall',
|
|
615
|
+
_optionalChain([onBalanceUsdChange, 'optionalCall', _10 => _10(_nullishCoalesce(balanceUsd, () => ( 0)))]);
|
|
616
616
|
}, [balanceUsd, onBalanceUsdChange]);
|
|
617
617
|
const formattedBalance = _react.useMemo.call(void 0, () => {
|
|
618
618
|
if (balance === null) return "...";
|
|
@@ -620,41 +620,29 @@ function AmountStep({
|
|
|
620
620
|
const raw = _viem.formatUnits.call(void 0, balance, asset.decimals);
|
|
621
621
|
const numeric = Number(raw);
|
|
622
622
|
if (!Number.isFinite(numeric)) return raw;
|
|
623
|
-
return
|
|
623
|
+
return _chunkYIHOACM3cjs.tokenFormatter.format(numeric);
|
|
624
624
|
} catch (e8) {
|
|
625
625
|
return "...";
|
|
626
626
|
}
|
|
627
627
|
}, [balance, asset.decimals]);
|
|
628
|
-
const tokenAmount = _react.useMemo.call(void 0, () => {
|
|
629
|
-
if (!amount) return null;
|
|
630
|
-
if (hasPricing) {
|
|
631
|
-
const usd = Number(amount);
|
|
632
|
-
if (!Number.isFinite(usd) || usd <= 0) return null;
|
|
633
|
-
return usd / tokenPriceUsd;
|
|
634
|
-
}
|
|
635
|
-
const val = Number(amount);
|
|
636
|
-
return Number.isFinite(val) && val > 0 ? val : null;
|
|
637
|
-
}, [amount, tokenPriceUsd, hasPricing]);
|
|
638
|
-
const formattedTokenAmount = _react.useMemo.call(void 0, () => {
|
|
639
|
-
if (tokenAmount === null) return "0.00";
|
|
640
|
-
return _chunkG2RDCQHLcjs.tokenFormatter.format(tokenAmount);
|
|
641
|
-
}, [tokenAmount]);
|
|
642
|
-
const targetSymbol = _chunkPE6OK3FHcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
643
628
|
const handlePresetClick = (percentage) => {
|
|
644
629
|
if (balance === null) return;
|
|
645
|
-
|
|
646
|
-
const
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
setAmount(value.toString());
|
|
654
|
-
}
|
|
655
|
-
} catch (e9) {
|
|
656
|
-
return;
|
|
630
|
+
try {
|
|
631
|
+
const balanceUnits = Number(_viem.formatUnits.call(void 0, balance, asset.decimals));
|
|
632
|
+
if (!Number.isFinite(balanceUnits)) return;
|
|
633
|
+
let value;
|
|
634
|
+
if (isSourceStablecoin || !hasPricing) {
|
|
635
|
+
value = balanceUnits * percentage / 100;
|
|
636
|
+
} else {
|
|
637
|
+
value = (_nullishCoalesce(balanceUsd, () => ( 0))) * percentage / 100;
|
|
657
638
|
}
|
|
639
|
+
const maxDecimals = 3;
|
|
640
|
+
const factor = 10 ** maxDecimals;
|
|
641
|
+
const truncated = Math.floor(value * factor) / factor;
|
|
642
|
+
const formatted = truncated.toFixed(maxDecimals).replace(/\.?0+$/, "");
|
|
643
|
+
setAmount(formatted);
|
|
644
|
+
} catch (e9) {
|
|
645
|
+
return;
|
|
658
646
|
}
|
|
659
647
|
if (error) setError(null);
|
|
660
648
|
};
|
|
@@ -664,24 +652,28 @@ function AmountStep({
|
|
|
664
652
|
setError("Please enter a valid amount");
|
|
665
653
|
return;
|
|
666
654
|
}
|
|
667
|
-
let
|
|
655
|
+
let sourceAmount;
|
|
656
|
+
if (isSourceStablecoin || !hasPricing) {
|
|
657
|
+
sourceAmount = numericAmount;
|
|
658
|
+
} else {
|
|
659
|
+
sourceAmount = numericAmount / tokenPriceUsd;
|
|
660
|
+
}
|
|
668
661
|
if (hasPricing) {
|
|
669
|
-
|
|
662
|
+
const usdValue = numericAmount;
|
|
663
|
+
if (_optionalChain([uiConfig, 'optionalAccess', _11 => _11.maxDepositUsd]) && usdValue > uiConfig.maxDepositUsd) {
|
|
670
664
|
setError(
|
|
671
|
-
`Maximum deposit is ${
|
|
665
|
+
`Maximum deposit is ${_chunkYIHOACM3cjs.currencyFormatter.format(uiConfig.maxDepositUsd)}`
|
|
672
666
|
);
|
|
673
667
|
return;
|
|
674
668
|
}
|
|
675
|
-
if (_optionalChain([uiConfig, 'optionalAccess',
|
|
669
|
+
if (_optionalChain([uiConfig, 'optionalAccess', _12 => _12.minDepositUsd]) && usdValue < uiConfig.minDepositUsd) {
|
|
676
670
|
setError(
|
|
677
|
-
`Minimum deposit is ${
|
|
671
|
+
`Minimum deposit is ${_chunkYIHOACM3cjs.currencyFormatter.format(uiConfig.minDepositUsd)}`
|
|
678
672
|
);
|
|
679
673
|
return;
|
|
680
674
|
}
|
|
681
|
-
tokenAmountStr = (numericAmount / tokenPriceUsd).toString();
|
|
682
|
-
} else {
|
|
683
|
-
tokenAmountStr = numericAmount.toString();
|
|
684
675
|
}
|
|
676
|
+
const tokenAmountStr = sourceAmount.toString();
|
|
685
677
|
let amountInUnits;
|
|
686
678
|
try {
|
|
687
679
|
amountInUnits = _viem.parseUnits.call(void 0, tokenAmountStr, asset.decimals);
|
|
@@ -694,7 +686,7 @@ function AmountStep({
|
|
|
694
686
|
return;
|
|
695
687
|
}
|
|
696
688
|
setError(null);
|
|
697
|
-
onContinue(tokenAmountStr, _nullishCoalesce(balance, () => ( void 0)));
|
|
689
|
+
onContinue(tokenAmountStr, amount, _nullishCoalesce(balance, () => ( void 0)));
|
|
698
690
|
};
|
|
699
691
|
const handleSwitch = async () => {
|
|
700
692
|
if (!asset.chainId || !switchChain) return;
|
|
@@ -711,7 +703,7 @@ function AmountStep({
|
|
|
711
703
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
712
704
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body", style: { paddingTop: 0 }, children: [
|
|
713
705
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-display", children: [
|
|
714
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-amount-input-wrapper", children:
|
|
706
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-amount-input-wrapper", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
715
707
|
"input",
|
|
716
708
|
{
|
|
717
709
|
type: "text",
|
|
@@ -728,50 +720,19 @@ function AmountStep({
|
|
|
728
720
|
},
|
|
729
721
|
autoFocus: true
|
|
730
722
|
}
|
|
731
|
-
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
732
|
-
"input",
|
|
733
|
-
{
|
|
734
|
-
type: "text",
|
|
735
|
-
inputMode: "decimal",
|
|
736
|
-
className: "rs-amount-input-large",
|
|
737
|
-
placeholder: `0.00 ${asset.symbol}`,
|
|
738
|
-
value: amount,
|
|
739
|
-
onChange: (e) => {
|
|
740
|
-
const raw = e.target.value.replace(/[^0-9.]/g, "");
|
|
741
|
-
const parts = raw.split(".");
|
|
742
|
-
if (parts.length > 2) return;
|
|
743
|
-
setAmount(raw);
|
|
744
|
-
if (error) setError(null);
|
|
745
|
-
},
|
|
746
|
-
autoFocus: true
|
|
747
|
-
}
|
|
748
723
|
) }),
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
724
|
+
!isSourceStablecoin && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-amount-available", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-amount-available-value", children: [
|
|
725
|
+
formattedBalance,
|
|
726
|
+
" ",
|
|
727
|
+
asset.symbol,
|
|
728
|
+
" available",
|
|
729
|
+
hasPricing && balanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { style: { color: "var(--rs-muted-foreground)" }, children: [
|
|
752
730
|
" ",
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
"
|
|
756
|
-
|
|
757
|
-
|
|
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
|
-
] })
|
|
731
|
+
"(",
|
|
732
|
+
_chunkYIHOACM3cjs.currencyFormatter.format(balanceUsd),
|
|
733
|
+
")"
|
|
734
|
+
] })
|
|
735
|
+
] }) })
|
|
775
736
|
] }),
|
|
776
737
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
777
738
|
"div",
|
|
@@ -782,26 +743,26 @@ function AmountStep({
|
|
|
782
743
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-flow-pill-label", children: "You send" }),
|
|
783
744
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token", children: [
|
|
784
745
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token-icon-wrapper", children: [
|
|
785
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children:
|
|
746
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children: _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, asset.symbol) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
786
747
|
"img",
|
|
787
748
|
{
|
|
788
|
-
src:
|
|
749
|
+
src: _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, asset.symbol),
|
|
789
750
|
alt: asset.symbol
|
|
790
751
|
}
|
|
791
752
|
) : asset.symbol.slice(0, 2) }),
|
|
792
753
|
(() => {
|
|
793
|
-
const chainIcon =
|
|
754
|
+
const chainIcon = _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, asset.chainId);
|
|
794
755
|
if (chainIcon) {
|
|
795
756
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
796
757
|
"img",
|
|
797
758
|
{
|
|
798
759
|
src: chainIcon,
|
|
799
|
-
alt:
|
|
760
|
+
alt: _chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId),
|
|
800
761
|
className: "rs-flow-pill-chain-badge"
|
|
801
762
|
}
|
|
802
763
|
);
|
|
803
764
|
}
|
|
804
|
-
const badge =
|
|
765
|
+
const badge = _chunkS4UBVD3Hcjs.getChainBadge.call(void 0, asset.chainId);
|
|
805
766
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
806
767
|
"div",
|
|
807
768
|
{
|
|
@@ -839,26 +800,26 @@ function AmountStep({
|
|
|
839
800
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-flow-pill-label", children: "You receive" }),
|
|
840
801
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token", children: [
|
|
841
802
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token-icon-wrapper", children: [
|
|
842
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children:
|
|
803
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children: _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, targetSymbol) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
843
804
|
"img",
|
|
844
805
|
{
|
|
845
|
-
src:
|
|
806
|
+
src: _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, targetSymbol),
|
|
846
807
|
alt: targetSymbol
|
|
847
808
|
}
|
|
848
809
|
) : targetSymbol.slice(0, 2) }),
|
|
849
810
|
(() => {
|
|
850
|
-
const chainIcon =
|
|
811
|
+
const chainIcon = _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, targetChain);
|
|
851
812
|
if (chainIcon) {
|
|
852
813
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
853
814
|
"img",
|
|
854
815
|
{
|
|
855
816
|
src: chainIcon,
|
|
856
|
-
alt:
|
|
817
|
+
alt: _chunkS4UBVD3Hcjs.getChainName.call(void 0, targetChain),
|
|
857
818
|
className: "rs-flow-pill-chain-badge"
|
|
858
819
|
}
|
|
859
820
|
);
|
|
860
821
|
}
|
|
861
|
-
const badge =
|
|
822
|
+
const badge = _chunkS4UBVD3Hcjs.getChainBadge.call(void 0, targetChain);
|
|
862
823
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
863
824
|
"div",
|
|
864
825
|
{
|
|
@@ -904,22 +865,13 @@ function AmountStep({
|
|
|
904
865
|
}
|
|
905
866
|
)
|
|
906
867
|
] }),
|
|
907
|
-
chainMismatch && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch", style: { marginTop: 16 }, children: [
|
|
868
|
+
chainMismatch && !isSwitching && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch", style: { marginTop: 16 }, children: [
|
|
908
869
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch-text", children: [
|
|
909
870
|
"Switch your wallet to ",
|
|
910
|
-
|
|
871
|
+
_chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId),
|
|
911
872
|
" to continue."
|
|
912
873
|
] }),
|
|
913
|
-
switchChain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
914
|
-
_chunkG2RDCQHLcjs.Button,
|
|
915
|
-
{
|
|
916
|
-
variant: "outline",
|
|
917
|
-
size: "small",
|
|
918
|
-
loading: isSwitching,
|
|
919
|
-
onClick: handleSwitch,
|
|
920
|
-
children: "Switch"
|
|
921
|
-
}
|
|
922
|
-
)
|
|
874
|
+
switchChain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYIHOACM3cjs.Button, { variant: "outline", size: "small", onClick: handleSwitch, children: "Switch" })
|
|
923
875
|
] }),
|
|
924
876
|
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error", children: [
|
|
925
877
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -944,7 +896,7 @@ function AmountStep({
|
|
|
944
896
|
] })
|
|
945
897
|
] }),
|
|
946
898
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
947
|
-
|
|
899
|
+
_chunkYIHOACM3cjs.Button,
|
|
948
900
|
{
|
|
949
901
|
onClick: handleContinue,
|
|
950
902
|
fullWidth: true,
|
|
@@ -952,7 +904,7 @@ function AmountStep({
|
|
|
952
904
|
children: "Continue"
|
|
953
905
|
}
|
|
954
906
|
) }),
|
|
955
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
907
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYIHOACM3cjs.PoweredBy, {})
|
|
956
908
|
] });
|
|
957
909
|
}
|
|
958
910
|
|
|
@@ -960,7 +912,6 @@ function AmountStep({
|
|
|
960
912
|
|
|
961
913
|
|
|
962
914
|
|
|
963
|
-
var STABLECOIN_SYMBOLS = /* @__PURE__ */ new Set(["USDC", "USDT", "DAI"]);
|
|
964
915
|
function ConfirmStep({
|
|
965
916
|
walletClient,
|
|
966
917
|
address,
|
|
@@ -968,6 +919,8 @@ function ConfirmStep({
|
|
|
968
919
|
recipient,
|
|
969
920
|
asset,
|
|
970
921
|
amount,
|
|
922
|
+
targetAmount,
|
|
923
|
+
targetTokenPriceUsd,
|
|
971
924
|
balance,
|
|
972
925
|
targetChain,
|
|
973
926
|
targetToken,
|
|
@@ -981,52 +934,18 @@ function ConfirmStep({
|
|
|
981
934
|
const [isSwitching, setIsSwitching] = _react.useState.call(void 0, false);
|
|
982
935
|
const chainMismatch = _optionalChain([walletClient, 'optionalAccess', _13 => _13.chain, 'optionalAccess', _14 => _14.id]) && walletClient.chain.id !== asset.chainId;
|
|
983
936
|
const sameRoute = targetChain === asset.chainId && targetToken.toLowerCase() === asset.token.toLowerCase();
|
|
984
|
-
const targetSymbol = sameRoute ? asset.symbol :
|
|
985
|
-
const
|
|
986
|
-
const
|
|
987
|
-
if (
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
return asset.balanceUsd / balanceUnits;
|
|
994
|
-
} catch (e11) {
|
|
995
|
-
return null;
|
|
937
|
+
const targetSymbol = sameRoute ? asset.symbol : _chunkS4UBVD3Hcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
938
|
+
const formattedSendAmount = amount && !Number.isNaN(Number(amount)) ? Number(amount).toLocaleString("en-US", { maximumFractionDigits: 6 }) : "0";
|
|
939
|
+
const formattedReceiveAmount = (() => {
|
|
940
|
+
if (sameRoute) return formattedSendAmount;
|
|
941
|
+
const dollarValue = Number(targetAmount);
|
|
942
|
+
if (!Number.isFinite(dollarValue) || dollarValue <= 0) return formattedSendAmount;
|
|
943
|
+
if (targetTokenPriceUsd !== null && targetTokenPriceUsd > 0) {
|
|
944
|
+
const tokenAmount = dollarValue / targetTokenPriceUsd;
|
|
945
|
+
return tokenAmount.toLocaleString("en-US", { maximumFractionDigits: 6 });
|
|
996
946
|
}
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
if (!amount || tokenPriceUsd === null) return null;
|
|
1000
|
-
const parsed = Number(amount);
|
|
1001
|
-
if (!Number.isFinite(parsed) || parsed <= 0) return null;
|
|
1002
|
-
return parsed * tokenPriceUsd;
|
|
1003
|
-
}, [amount, tokenPriceUsd]);
|
|
1004
|
-
const targetTokenPriceUsd = _react.useMemo.call(void 0, () => {
|
|
1005
|
-
const targetSym = targetSymbol.toUpperCase();
|
|
1006
|
-
const sourceSym = asset.symbol.toUpperCase();
|
|
1007
|
-
if (STABLECOIN_SYMBOLS.has(targetSym)) return 1;
|
|
1008
|
-
if (targetSym === sourceSym && tokenPriceUsd !== null) return tokenPriceUsd;
|
|
1009
|
-
return null;
|
|
1010
|
-
}, [targetSymbol, asset.symbol, tokenPriceUsd]);
|
|
1011
|
-
const receiveAmountUsd = _react.useMemo.call(void 0, () => {
|
|
1012
|
-
if (amountUsd === null) return null;
|
|
1013
|
-
return sameRoute ? amountUsd : amountUsd * 0.99;
|
|
1014
|
-
}, [amountUsd, sameRoute]);
|
|
1015
|
-
const receiveTokenAmount = _react.useMemo.call(void 0, () => {
|
|
1016
|
-
if (sameRoute) {
|
|
1017
|
-
const parsed = Number(amount);
|
|
1018
|
-
return Number.isFinite(parsed) ? parsed : null;
|
|
1019
|
-
}
|
|
1020
|
-
if (receiveAmountUsd === null || targetTokenPriceUsd === null || targetTokenPriceUsd === 0)
|
|
1021
|
-
return null;
|
|
1022
|
-
return receiveAmountUsd / targetTokenPriceUsd;
|
|
1023
|
-
}, [sameRoute, amount, receiveAmountUsd, targetTokenPriceUsd]);
|
|
1024
|
-
const formattedReceiveAmount = _react.useMemo.call(void 0, () => {
|
|
1025
|
-
if (receiveTokenAmount === null) return formattedAmount;
|
|
1026
|
-
return receiveTokenAmount.toLocaleString("en-US", {
|
|
1027
|
-
maximumFractionDigits: 6
|
|
1028
|
-
});
|
|
1029
|
-
}, [receiveTokenAmount, formattedAmount]);
|
|
947
|
+
return formattedSendAmount;
|
|
948
|
+
})();
|
|
1030
949
|
const receiveAmount = sameRoute ? formattedReceiveAmount : `~ ${formattedReceiveAmount}`;
|
|
1031
950
|
const handleConfirm = async () => {
|
|
1032
951
|
if (!address || !walletClient) {
|
|
@@ -1034,7 +953,7 @@ function ConfirmStep({
|
|
|
1034
953
|
return;
|
|
1035
954
|
}
|
|
1036
955
|
if (chainMismatch) {
|
|
1037
|
-
setError(`Switch to ${
|
|
956
|
+
setError(`Switch to ${_chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId)} to sign`);
|
|
1038
957
|
return;
|
|
1039
958
|
}
|
|
1040
959
|
const parsedAmount = parseFloat(amount);
|
|
@@ -1045,7 +964,7 @@ function ConfirmStep({
|
|
|
1045
964
|
let amountUnits;
|
|
1046
965
|
try {
|
|
1047
966
|
amountUnits = _viem.parseUnits.call(void 0, amount, asset.decimals);
|
|
1048
|
-
} catch (
|
|
967
|
+
} catch (e11) {
|
|
1049
968
|
setError("Please enter a valid amount");
|
|
1050
969
|
return;
|
|
1051
970
|
}
|
|
@@ -1062,7 +981,7 @@ function ConfirmStep({
|
|
|
1062
981
|
throw new Error("Wallet not properly connected");
|
|
1063
982
|
}
|
|
1064
983
|
const transferTo = sameRoute ? recipient : smartAccount;
|
|
1065
|
-
const hash =
|
|
984
|
+
const hash = _chunkYIHOACM3cjs.isNativeAsset.call(void 0, asset) ? await walletClient.sendTransaction({
|
|
1066
985
|
account,
|
|
1067
986
|
chain,
|
|
1068
987
|
to: transferTo,
|
|
@@ -1079,7 +998,7 @@ function ConfirmStep({
|
|
|
1079
998
|
onConfirm(hash, asset.chainId, amountUnits.toString(), asset.token);
|
|
1080
999
|
} catch (err) {
|
|
1081
1000
|
const raw = err instanceof Error ? err.message : "Transfer failed";
|
|
1082
|
-
const message =
|
|
1001
|
+
const message = _chunkYIHOACM3cjs.formatUserError.call(void 0, raw);
|
|
1083
1002
|
setError(message);
|
|
1084
1003
|
_optionalChain([onError, 'optionalCall', _16 => _16(message, "TRANSFER_ERROR")]);
|
|
1085
1004
|
} finally {
|
|
@@ -1093,7 +1012,7 @@ function ConfirmStep({
|
|
|
1093
1012
|
await switchChain(asset.chainId);
|
|
1094
1013
|
} catch (err) {
|
|
1095
1014
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
1096
|
-
setError(
|
|
1015
|
+
setError(_chunkYIHOACM3cjs.formatUserError.call(void 0, raw));
|
|
1097
1016
|
} finally {
|
|
1098
1017
|
setIsSwitching(false);
|
|
1099
1018
|
}
|
|
@@ -1110,15 +1029,15 @@ function ConfirmStep({
|
|
|
1110
1029
|
className: "rs-card-value",
|
|
1111
1030
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
1112
1031
|
children: [
|
|
1113
|
-
|
|
1032
|
+
_chunkS4UBVD3Hcjs.getChainIcon.call(void 0, asset.chainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1114
1033
|
"img",
|
|
1115
1034
|
{
|
|
1116
|
-
src:
|
|
1035
|
+
src: _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, asset.chainId),
|
|
1117
1036
|
alt: "",
|
|
1118
1037
|
style: { width: 16, height: 16, borderRadius: 3 }
|
|
1119
1038
|
}
|
|
1120
1039
|
),
|
|
1121
|
-
|
|
1040
|
+
_chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId)
|
|
1122
1041
|
]
|
|
1123
1042
|
}
|
|
1124
1043
|
)
|
|
@@ -1131,15 +1050,15 @@ function ConfirmStep({
|
|
|
1131
1050
|
className: "rs-card-value",
|
|
1132
1051
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
1133
1052
|
children: [
|
|
1134
|
-
|
|
1053
|
+
_chunkS4UBVD3Hcjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1135
1054
|
"img",
|
|
1136
1055
|
{
|
|
1137
|
-
src:
|
|
1056
|
+
src: _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, targetChain),
|
|
1138
1057
|
alt: "",
|
|
1139
1058
|
style: { width: 16, height: 16, borderRadius: 3 }
|
|
1140
1059
|
}
|
|
1141
1060
|
),
|
|
1142
|
-
|
|
1061
|
+
_chunkS4UBVD3Hcjs.getChainName.call(void 0, targetChain)
|
|
1143
1062
|
]
|
|
1144
1063
|
}
|
|
1145
1064
|
)
|
|
@@ -1158,15 +1077,15 @@ function ConfirmStep({
|
|
|
1158
1077
|
className: "rs-card-value",
|
|
1159
1078
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
1160
1079
|
children: [
|
|
1161
|
-
|
|
1080
|
+
_chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, asset.symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1162
1081
|
"img",
|
|
1163
1082
|
{
|
|
1164
|
-
src:
|
|
1083
|
+
src: _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, asset.symbol),
|
|
1165
1084
|
alt: "",
|
|
1166
1085
|
style: { width: 16, height: 16, borderRadius: "50%" }
|
|
1167
1086
|
}
|
|
1168
1087
|
),
|
|
1169
|
-
|
|
1088
|
+
formattedSendAmount,
|
|
1170
1089
|
" ",
|
|
1171
1090
|
asset.symbol
|
|
1172
1091
|
]
|
|
@@ -1181,10 +1100,10 @@ function ConfirmStep({
|
|
|
1181
1100
|
className: "rs-card-value",
|
|
1182
1101
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
1183
1102
|
children: [
|
|
1184
|
-
|
|
1103
|
+
_chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, targetSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1185
1104
|
"img",
|
|
1186
1105
|
{
|
|
1187
|
-
src:
|
|
1106
|
+
src: _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, targetSymbol),
|
|
1188
1107
|
alt: "",
|
|
1189
1108
|
style: { width: 16, height: 16, borderRadius: "50%" }
|
|
1190
1109
|
}
|
|
@@ -1195,20 +1114,16 @@ function ConfirmStep({
|
|
|
1195
1114
|
]
|
|
1196
1115
|
}
|
|
1197
1116
|
)
|
|
1198
|
-
] }),
|
|
1199
|
-
receiveAmountUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-card-row", children: [
|
|
1200
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-label", children: "Value" }),
|
|
1201
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-card-value", children: _chunkG2RDCQHLcjs.currencyFormatter.format(receiveAmountUsd) })
|
|
1202
1117
|
] })
|
|
1203
1118
|
] }),
|
|
1204
1119
|
chainMismatch && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch", children: [
|
|
1205
1120
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-chain-switch-text", children: [
|
|
1206
1121
|
"Switch your wallet to ",
|
|
1207
|
-
|
|
1122
|
+
_chunkS4UBVD3Hcjs.getChainName.call(void 0, asset.chainId),
|
|
1208
1123
|
" to sign."
|
|
1209
1124
|
] }),
|
|
1210
1125
|
switchChain && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1211
|
-
|
|
1126
|
+
_chunkYIHOACM3cjs.Button,
|
|
1212
1127
|
{
|
|
1213
1128
|
variant: "outline",
|
|
1214
1129
|
size: "small",
|
|
@@ -1241,7 +1156,7 @@ function ConfirmStep({
|
|
|
1241
1156
|
] })
|
|
1242
1157
|
] }),
|
|
1243
1158
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1244
|
-
|
|
1159
|
+
_chunkYIHOACM3cjs.Button,
|
|
1245
1160
|
{
|
|
1246
1161
|
onClick: handleConfirm,
|
|
1247
1162
|
loading: isSubmitting,
|
|
@@ -1250,7 +1165,7 @@ function ConfirmStep({
|
|
|
1250
1165
|
children: "Confirm Order"
|
|
1251
1166
|
}
|
|
1252
1167
|
) }),
|
|
1253
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1168
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYIHOACM3cjs.PoweredBy, {})
|
|
1254
1169
|
] });
|
|
1255
1170
|
}
|
|
1256
1171
|
|
|
@@ -1395,12 +1310,12 @@ function DepositAddressStep({
|
|
|
1395
1310
|
onDepositDetected,
|
|
1396
1311
|
onError
|
|
1397
1312
|
}) {
|
|
1398
|
-
const supportedChainIds = _react.useMemo.call(void 0, () =>
|
|
1313
|
+
const supportedChainIds = _react.useMemo.call(void 0, () => _chunkS4UBVD3Hcjs.getSupportedChainIds.call(void 0, ), []);
|
|
1399
1314
|
const BASE_CHAIN_ID = 8453;
|
|
1400
1315
|
const defaultChainId = supportedChainIds.includes(BASE_CHAIN_ID) ? BASE_CHAIN_ID : supportedChainIds[0];
|
|
1401
1316
|
const [sourceChainId, setSourceChainId] = _react.useState.call(void 0, defaultChainId);
|
|
1402
1317
|
const tokensForChain = _react.useMemo.call(void 0,
|
|
1403
|
-
() =>
|
|
1318
|
+
() => _chunkS4UBVD3Hcjs.getTargetTokenSymbolsForChain.call(void 0, sourceChainId),
|
|
1404
1319
|
[sourceChainId]
|
|
1405
1320
|
);
|
|
1406
1321
|
const defaultToken = tokensForChain.includes("USDC") ? "USDC" : _nullishCoalesce(tokensForChain[0], () => ( "USDC"));
|
|
@@ -1430,7 +1345,7 @@ function DepositAddressStep({
|
|
|
1430
1345
|
await navigator.clipboard.writeText(smartAccount);
|
|
1431
1346
|
setCopied(true);
|
|
1432
1347
|
setTimeout(() => setCopied(false), 2e3);
|
|
1433
|
-
} catch (
|
|
1348
|
+
} catch (e12) {
|
|
1434
1349
|
const textarea = document.createElement("textarea");
|
|
1435
1350
|
textarea.value = smartAccount;
|
|
1436
1351
|
textarea.style.position = "fixed";
|
|
@@ -1455,7 +1370,7 @@ function DepositAddressStep({
|
|
|
1455
1370
|
const status = await service.fetchLatestStatus(smartAccount);
|
|
1456
1371
|
if (cancelled || depositHandledRef.current) return;
|
|
1457
1372
|
const event = status.lastEvent;
|
|
1458
|
-
const eventTxHash =
|
|
1373
|
+
const eventTxHash = _chunkYIHOACM3cjs.isDepositEvent.call(void 0, event) ? _nullishCoalesce(_optionalChain([_chunkYIHOACM3cjs.getEventTxHash.call(void 0, event), 'optionalAccess', _20 => _20.toLowerCase, 'call', _21 => _21()]), () => ( null)) : null;
|
|
1459
1374
|
if (baselineTxHash === void 0) {
|
|
1460
1375
|
baselineTxHash = eventTxHash;
|
|
1461
1376
|
} else if (eventTxHash && eventTxHash !== baselineTxHash) {
|
|
@@ -1463,7 +1378,7 @@ function DepositAddressStep({
|
|
|
1463
1378
|
const fallback = sourceSelectionRef.current;
|
|
1464
1379
|
const chainId = _nullishCoalesce(details.chainId, () => ( fallback.chainId));
|
|
1465
1380
|
const amount = _nullishCoalesce(details.amount, () => ( "0"));
|
|
1466
|
-
const token = _nullishCoalesce(details.token, () => (
|
|
1381
|
+
const token = _nullishCoalesce(details.token, () => ( _chunkS4UBVD3Hcjs.getTokenAddress.call(void 0, fallback.tokenSymbol, fallback.chainId)));
|
|
1467
1382
|
if (token) {
|
|
1468
1383
|
depositHandledRef.current = true;
|
|
1469
1384
|
onDepositDetected(eventTxHash, chainId, amount, token);
|
|
@@ -1488,7 +1403,7 @@ function DepositAddressStep({
|
|
|
1488
1403
|
clearTimeout(timeoutId);
|
|
1489
1404
|
};
|
|
1490
1405
|
}, [smartAccount, service, onDepositDetected, onError]);
|
|
1491
|
-
const chainIconSrc =
|
|
1406
|
+
const chainIconSrc = _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, sourceChainId);
|
|
1492
1407
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
1493
1408
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-body", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address", children: [
|
|
1494
1409
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-selectors", children: [
|
|
@@ -1504,10 +1419,10 @@ function DepositAddressStep({
|
|
|
1504
1419
|
setChainDropdownOpen(false);
|
|
1505
1420
|
},
|
|
1506
1421
|
children: [
|
|
1507
|
-
|
|
1422
|
+
_chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, sourceTokenSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1508
1423
|
"img",
|
|
1509
1424
|
{
|
|
1510
|
-
src:
|
|
1425
|
+
src: _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, sourceTokenSymbol),
|
|
1511
1426
|
alt: "",
|
|
1512
1427
|
className: "rs-deposit-address-dropdown-icon"
|
|
1513
1428
|
}
|
|
@@ -1544,10 +1459,10 @@ function DepositAddressStep({
|
|
|
1544
1459
|
setTokenDropdownOpen(false);
|
|
1545
1460
|
},
|
|
1546
1461
|
children: [
|
|
1547
|
-
|
|
1462
|
+
_chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1548
1463
|
"img",
|
|
1549
1464
|
{
|
|
1550
|
-
src:
|
|
1465
|
+
src: _chunkS4UBVD3Hcjs.getTokenIcon.call(void 0, symbol),
|
|
1551
1466
|
alt: "",
|
|
1552
1467
|
className: "rs-deposit-address-dropdown-icon"
|
|
1553
1468
|
}
|
|
@@ -1570,15 +1485,15 @@ function DepositAddressStep({
|
|
|
1570
1485
|
setTokenDropdownOpen(false);
|
|
1571
1486
|
},
|
|
1572
1487
|
children: [
|
|
1573
|
-
|
|
1488
|
+
_chunkS4UBVD3Hcjs.getChainIcon.call(void 0, sourceChainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1574
1489
|
"img",
|
|
1575
1490
|
{
|
|
1576
|
-
src:
|
|
1491
|
+
src: _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, sourceChainId),
|
|
1577
1492
|
alt: "",
|
|
1578
1493
|
className: "rs-deposit-address-dropdown-icon"
|
|
1579
1494
|
}
|
|
1580
1495
|
),
|
|
1581
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
1496
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkS4UBVD3Hcjs.getChainName.call(void 0, sourceChainId) }),
|
|
1582
1497
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1583
1498
|
"svg",
|
|
1584
1499
|
{
|
|
@@ -1610,15 +1525,15 @@ function DepositAddressStep({
|
|
|
1610
1525
|
setChainDropdownOpen(false);
|
|
1611
1526
|
},
|
|
1612
1527
|
children: [
|
|
1613
|
-
|
|
1528
|
+
_chunkS4UBVD3Hcjs.getChainIcon.call(void 0, chainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1614
1529
|
"img",
|
|
1615
1530
|
{
|
|
1616
|
-
src:
|
|
1531
|
+
src: _chunkS4UBVD3Hcjs.getChainIcon.call(void 0, chainId),
|
|
1617
1532
|
alt: "",
|
|
1618
1533
|
className: "rs-deposit-address-dropdown-icon"
|
|
1619
1534
|
}
|
|
1620
1535
|
),
|
|
1621
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
1536
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkS4UBVD3Hcjs.getChainName.call(void 0, chainId) })
|
|
1622
1537
|
]
|
|
1623
1538
|
},
|
|
1624
1539
|
chainId
|
|
@@ -1668,7 +1583,7 @@ function DepositAddressStep({
|
|
|
1668
1583
|
] }),
|
|
1669
1584
|
pollingError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-error", children: pollingError })
|
|
1670
1585
|
] }) }),
|
|
1671
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1586
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYIHOACM3cjs.PoweredBy, {})
|
|
1672
1587
|
] });
|
|
1673
1588
|
}
|
|
1674
1589
|
DepositAddressStep.displayName = "DepositAddressStep";
|
|
@@ -1689,12 +1604,13 @@ function DepositFlow({
|
|
|
1689
1604
|
sourceToken: defaultSourceToken,
|
|
1690
1605
|
amount: defaultAmount,
|
|
1691
1606
|
recipient,
|
|
1692
|
-
signerAddress =
|
|
1607
|
+
signerAddress = _chunkS4UBVD3Hcjs.DEFAULT_SIGNER_ADDRESS,
|
|
1693
1608
|
sessionChainIds,
|
|
1694
1609
|
forceRegister = false,
|
|
1695
1610
|
waitForFinalTx = true,
|
|
1696
1611
|
reownWallet,
|
|
1697
1612
|
onConnect,
|
|
1613
|
+
onDisconnect,
|
|
1698
1614
|
onRequestConnect,
|
|
1699
1615
|
connectButtonLabel,
|
|
1700
1616
|
uiConfig,
|
|
@@ -1713,6 +1629,23 @@ function DepositFlow({
|
|
|
1713
1629
|
const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, 0);
|
|
1714
1630
|
const [isConnectSelectionConfirmed, setIsConnectSelectionConfirmed] = _react.useState.call(void 0, false);
|
|
1715
1631
|
const [selectedConnectAddress, setSelectedConnectAddress] = _react.useState.call(void 0, null);
|
|
1632
|
+
const portfolioAssetsRef = _react.useRef.call(void 0, []);
|
|
1633
|
+
const handleAssetsLoaded = _react.useCallback.call(void 0, (assets) => {
|
|
1634
|
+
portfolioAssetsRef.current = assets;
|
|
1635
|
+
}, []);
|
|
1636
|
+
const getTokenPriceUsd = _react.useCallback.call(void 0, (symbol) => {
|
|
1637
|
+
const sym = symbol.toLowerCase();
|
|
1638
|
+
for (const asset of portfolioAssetsRef.current) {
|
|
1639
|
+
if (asset.symbol.toLowerCase() === sym && asset.balanceUsd && asset.balance) {
|
|
1640
|
+
try {
|
|
1641
|
+
const balanceUnits = Number(asset.balance) / 10 ** asset.decimals;
|
|
1642
|
+
if (balanceUnits > 0) return asset.balanceUsd / balanceUnits;
|
|
1643
|
+
} catch (e13) {
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
return null;
|
|
1648
|
+
}, []);
|
|
1716
1649
|
const dappSwitchChain = _react.useMemo.call(void 0, () => {
|
|
1717
1650
|
if (!_optionalChain([dappWalletClient, 'optionalAccess', _23 => _23.switchChain])) return void 0;
|
|
1718
1651
|
return async (chainId) => {
|
|
@@ -1755,7 +1688,7 @@ function DepositFlow({
|
|
|
1755
1688
|
return {
|
|
1756
1689
|
ownerAddress: dappAddress,
|
|
1757
1690
|
walletClient: void 0,
|
|
1758
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
1691
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkYIHOACM3cjs.getPublicClient.call(void 0, targetChain))),
|
|
1759
1692
|
switchChain: void 0
|
|
1760
1693
|
};
|
|
1761
1694
|
}
|
|
@@ -1764,7 +1697,7 @@ function DepositFlow({
|
|
|
1764
1697
|
return {
|
|
1765
1698
|
ownerAddress: dappWalletClient.account.address,
|
|
1766
1699
|
walletClient: dappWalletClient,
|
|
1767
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
1700
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkYIHOACM3cjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
1768
1701
|
switchChain: dappSwitchChain
|
|
1769
1702
|
};
|
|
1770
1703
|
}
|
|
@@ -1774,7 +1707,7 @@ function DepositFlow({
|
|
|
1774
1707
|
return {
|
|
1775
1708
|
ownerAddress: dappWalletClient.account.address,
|
|
1776
1709
|
walletClient: dappWalletClient,
|
|
1777
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
1710
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkYIHOACM3cjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
1778
1711
|
switchChain: dappSwitchChain
|
|
1779
1712
|
};
|
|
1780
1713
|
}
|
|
@@ -1836,8 +1769,7 @@ function DepositFlow({
|
|
|
1836
1769
|
return {
|
|
1837
1770
|
type: "amount",
|
|
1838
1771
|
smartAccount: prev.smartAccount,
|
|
1839
|
-
asset: prev.asset
|
|
1840
|
-
amount: prev.amount
|
|
1772
|
+
asset: prev.asset
|
|
1841
1773
|
};
|
|
1842
1774
|
});
|
|
1843
1775
|
}, []);
|
|
@@ -1910,7 +1842,10 @@ function DepositFlow({
|
|
|
1910
1842
|
[defaultAmount]
|
|
1911
1843
|
);
|
|
1912
1844
|
const handleAmountContinue = _react.useCallback.call(void 0,
|
|
1913
|
-
(amount, balance) => {
|
|
1845
|
+
(amount, targetAmount, balance) => {
|
|
1846
|
+
const targetSym = _chunkS4UBVD3Hcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
1847
|
+
const isTargetStable = _chunkS4UBVD3Hcjs.isStablecoinSymbol.call(void 0, targetSym);
|
|
1848
|
+
const targetTokenPriceUsd = isTargetStable ? 1 : getTokenPriceUsd(targetSym);
|
|
1914
1849
|
setStep((prev) => {
|
|
1915
1850
|
if (prev.type !== "amount") return prev;
|
|
1916
1851
|
return {
|
|
@@ -1918,11 +1853,13 @@ function DepositFlow({
|
|
|
1918
1853
|
smartAccount: prev.smartAccount,
|
|
1919
1854
|
asset: prev.asset,
|
|
1920
1855
|
amount,
|
|
1856
|
+
targetAmount,
|
|
1857
|
+
targetTokenPriceUsd,
|
|
1921
1858
|
balance
|
|
1922
1859
|
};
|
|
1923
1860
|
});
|
|
1924
1861
|
},
|
|
1925
|
-
[]
|
|
1862
|
+
[targetToken, targetChain, getTokenPriceUsd]
|
|
1926
1863
|
);
|
|
1927
1864
|
const handleDepositSubmitted = _react.useCallback.call(void 0,
|
|
1928
1865
|
(txHash, chainId, amount, token) => {
|
|
@@ -2011,7 +1948,7 @@ function DepositFlow({
|
|
|
2011
1948
|
]);
|
|
2012
1949
|
if (showConnectStep) {
|
|
2013
1950
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2014
|
-
|
|
1951
|
+
_chunkYIHOACM3cjs.ConnectStep,
|
|
2015
1952
|
{
|
|
2016
1953
|
walletOptions,
|
|
2017
1954
|
selectedAddress: selectedConnectAddressEffective,
|
|
@@ -2022,6 +1959,7 @@ function DepositFlow({
|
|
|
2022
1959
|
} : void 0,
|
|
2023
1960
|
onRequestConnect,
|
|
2024
1961
|
onConnect,
|
|
1962
|
+
onDisconnect,
|
|
2025
1963
|
onContinue: () => {
|
|
2026
1964
|
if (selectedConnectAddressEffective) {
|
|
2027
1965
|
setSelectedConnectAddress(selectedConnectAddressEffective);
|
|
@@ -2062,14 +2000,13 @@ function DepositFlow({
|
|
|
2062
2000
|
}
|
|
2063
2001
|
),
|
|
2064
2002
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2065
|
-
|
|
2003
|
+
_chunkYIHOACM3cjs.ProcessingStep,
|
|
2066
2004
|
{
|
|
2067
2005
|
smartAccount: step.smartAccount,
|
|
2068
2006
|
txHash: step.txHash,
|
|
2069
2007
|
sourceChain: step.sourceChain,
|
|
2070
2008
|
sourceToken: step.sourceToken,
|
|
2071
2009
|
targetChain,
|
|
2072
|
-
targetToken,
|
|
2073
2010
|
amount: step.amount,
|
|
2074
2011
|
waitForFinalTx,
|
|
2075
2012
|
service,
|
|
@@ -2093,7 +2030,7 @@ function DepositFlow({
|
|
|
2093
2030
|
if (_optionalChain([signerContext, 'access', _57 => _57.publicClient, 'access', _58 => _58.chain, 'optionalAccess', _59 => _59.id]) === chainId) {
|
|
2094
2031
|
return signerContext.publicClient;
|
|
2095
2032
|
}
|
|
2096
|
-
return
|
|
2033
|
+
return _chunkYIHOACM3cjs.getPublicClient.call(void 0, chainId);
|
|
2097
2034
|
};
|
|
2098
2035
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
2099
2036
|
step.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2122,7 +2059,8 @@ function DepositFlow({
|
|
|
2122
2059
|
defaultSourceToken,
|
|
2123
2060
|
service,
|
|
2124
2061
|
onContinue: handleAssetContinue,
|
|
2125
|
-
onTotalBalanceComputed: handleTotalBalanceComputed
|
|
2062
|
+
onTotalBalanceComputed: handleTotalBalanceComputed,
|
|
2063
|
+
onAssetsLoaded: handleAssetsLoaded
|
|
2126
2064
|
}
|
|
2127
2065
|
),
|
|
2128
2066
|
step.type === "amount" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2149,6 +2087,8 @@ function DepositFlow({
|
|
|
2149
2087
|
recipient,
|
|
2150
2088
|
asset: step.asset,
|
|
2151
2089
|
amount: step.amount,
|
|
2090
|
+
targetAmount: step.targetAmount,
|
|
2091
|
+
targetTokenPriceUsd: step.targetTokenPriceUsd,
|
|
2152
2092
|
balance: step.balance,
|
|
2153
2093
|
targetChain,
|
|
2154
2094
|
targetToken,
|
|
@@ -2159,14 +2099,13 @@ function DepositFlow({
|
|
|
2159
2099
|
}
|
|
2160
2100
|
),
|
|
2161
2101
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2162
|
-
|
|
2102
|
+
_chunkYIHOACM3cjs.ProcessingStep,
|
|
2163
2103
|
{
|
|
2164
2104
|
smartAccount: step.smartAccount,
|
|
2165
2105
|
txHash: step.txHash,
|
|
2166
2106
|
sourceChain: step.sourceChain,
|
|
2167
2107
|
sourceToken: step.sourceToken,
|
|
2168
2108
|
targetChain,
|
|
2169
|
-
targetToken,
|
|
2170
2109
|
amount: step.amount,
|
|
2171
2110
|
waitForFinalTx,
|
|
2172
2111
|
service,
|
|
@@ -2184,7 +2123,7 @@ function DepositFlow({
|
|
|
2184
2123
|
// src/DepositModal.tsx
|
|
2185
2124
|
|
|
2186
2125
|
var ReownDepositInner = _react.lazy.call(void 0,
|
|
2187
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-
|
|
2126
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-XUAEWIW7.cjs"))).then((m) => ({ default: m.DepositModalReown }))
|
|
2188
2127
|
);
|
|
2189
2128
|
function DepositModal(props) {
|
|
2190
2129
|
const needsReown = !!props.reownAppId;
|
|
@@ -2207,13 +2146,14 @@ function DepositModalInner({
|
|
|
2207
2146
|
sourceToken,
|
|
2208
2147
|
defaultAmount,
|
|
2209
2148
|
recipient,
|
|
2210
|
-
backendUrl =
|
|
2211
|
-
signerAddress =
|
|
2149
|
+
backendUrl = _chunkS4UBVD3Hcjs.DEFAULT_BACKEND_URL,
|
|
2150
|
+
signerAddress = _chunkS4UBVD3Hcjs.DEFAULT_SIGNER_ADDRESS,
|
|
2212
2151
|
sessionChainIds,
|
|
2213
2152
|
forceRegister = false,
|
|
2214
2153
|
waitForFinalTx = true,
|
|
2215
2154
|
reownWallet,
|
|
2216
2155
|
onConnect,
|
|
2156
|
+
onDisconnect,
|
|
2217
2157
|
onRequestConnect,
|
|
2218
2158
|
connectButtonLabel,
|
|
2219
2159
|
theme,
|
|
@@ -2232,12 +2172,12 @@ function DepositModalInner({
|
|
|
2232
2172
|
const [currentStepIndex, setCurrentStepIndex] = _react.useState.call(void 0, 0);
|
|
2233
2173
|
const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, null);
|
|
2234
2174
|
const backHandlerRef = _react.useRef.call(void 0, void 0);
|
|
2235
|
-
const targetChain =
|
|
2236
|
-
const sourceChain = sourceChainProp ?
|
|
2237
|
-
const service = _react.useMemo.call(void 0, () =>
|
|
2175
|
+
const targetChain = _chunkS4UBVD3Hcjs.getChainId.call(void 0, targetChainProp);
|
|
2176
|
+
const sourceChain = sourceChainProp ? _chunkS4UBVD3Hcjs.getChainId.call(void 0, sourceChainProp) : void 0;
|
|
2177
|
+
const service = _react.useMemo.call(void 0, () => _chunkYIHOACM3cjs.createDepositService.call(void 0, backendUrl), [backendUrl]);
|
|
2238
2178
|
_react.useEffect.call(void 0, () => {
|
|
2239
2179
|
if (isOpen && modalRef.current) {
|
|
2240
|
-
|
|
2180
|
+
_chunkYIHOACM3cjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
2241
2181
|
}
|
|
2242
2182
|
}, [isOpen, theme]);
|
|
2243
2183
|
const hasCalledReady = _react.useRef.call(void 0, false);
|
|
@@ -2273,7 +2213,7 @@ function DepositModalInner({
|
|
|
2273
2213
|
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _68 => _68.title]), () => ( "Deposit"));
|
|
2274
2214
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 4 && backHandlerRef.current !== void 0;
|
|
2275
2215
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2276
|
-
|
|
2216
|
+
_chunkYIHOACM3cjs.Modal,
|
|
2277
2217
|
{
|
|
2278
2218
|
isOpen,
|
|
2279
2219
|
onClose,
|
|
@@ -2334,7 +2274,7 @@ function DepositModalInner({
|
|
|
2334
2274
|
balance.title,
|
|
2335
2275
|
":"
|
|
2336
2276
|
] }),
|
|
2337
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ?
|
|
2277
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ? _chunkYIHOACM3cjs.currencyFormatter.format(totalBalanceUsd) : null))) })
|
|
2338
2278
|
] })
|
|
2339
2279
|
] }),
|
|
2340
2280
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2383,6 +2323,7 @@ function DepositModalInner({
|
|
|
2383
2323
|
waitForFinalTx,
|
|
2384
2324
|
reownWallet,
|
|
2385
2325
|
onConnect,
|
|
2326
|
+
onDisconnect,
|
|
2386
2327
|
onRequestConnect,
|
|
2387
2328
|
connectButtonLabel,
|
|
2388
2329
|
uiConfig,
|