@rhinestone/deposit-modal 0.1.38 → 0.1.40
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-BJWM3JMC.mjs → DepositModalReown-3HNOCOOO.mjs} +3 -3
- package/dist/{DepositModalReown-M6GRPFJW.cjs → DepositModalReown-ZZKRN6J3.cjs} +4 -4
- package/dist/{WithdrawModalReown-OGPBUDZU.cjs → WithdrawModalReown-2CWNDVJD.cjs} +4 -4
- package/dist/{WithdrawModalReown-OIG2DANP.mjs → WithdrawModalReown-XXCOZYVU.mjs} +3 -3
- package/dist/{chunk-4ZOF4A2N.cjs → chunk-3O37UPSC.cjs} +226 -193
- package/dist/{chunk-NULE6WII.cjs → chunk-AHOFT42H.cjs} +106 -54
- package/dist/{chunk-P7B7B6LU.mjs → chunk-CFLZYWX7.mjs} +3 -3
- package/dist/{chunk-7HJ7TUHX.mjs → chunk-F5S6RHUI.mjs} +94 -61
- package/dist/{chunk-HYUITBRV.cjs → chunk-FLXTBFMZ.cjs} +27 -6
- package/dist/{chunk-ZL4KPLWE.mjs → chunk-I7RYTI4G.mjs} +28 -7
- package/dist/{chunk-UBPIPY3L.mjs → chunk-IC2M2DZ7.mjs} +65 -13
- package/dist/{chunk-G4EYX7SO.cjs → chunk-K7BHCDJQ.cjs} +55 -55
- package/dist/constants.cjs +2 -2
- package/dist/constants.mjs +1 -1
- package/dist/deposit.cjs +4 -4
- package/dist/deposit.mjs +3 -3
- package/dist/index.cjs +5 -5
- package/dist/index.mjs +4 -4
- package/dist/reown.cjs +5 -5
- package/dist/reown.mjs +4 -4
- package/dist/withdraw.cjs +4 -4
- package/dist/withdraw.mjs +3 -3
- package/package.json +1 -1
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
var _chunkNULE6WIIcjs = require('./chunk-NULE6WII.cjs');
|
|
25
24
|
|
|
25
|
+
var _chunkAHOFT42Hcjs = require('./chunk-AHOFT42H.cjs');
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
@@ -37,7 +37,8 @@ var _chunkNULE6WIIcjs = require('./chunk-NULE6WII.cjs');
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
|
|
41
|
+
var _chunkFLXTBFMZcjs = require('./chunk-FLXTBFMZ.cjs');
|
|
41
42
|
|
|
42
43
|
// src/DepositModal.tsx
|
|
43
44
|
|
|
@@ -57,15 +58,15 @@ var _react = require('react');
|
|
|
57
58
|
|
|
58
59
|
var _jsxruntime = require('react/jsx-runtime');
|
|
59
60
|
async function resolveSessionOwner(eoaAddress) {
|
|
60
|
-
const localOwner =
|
|
61
|
+
const localOwner = _chunkAHOFT42Hcjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
|
|
61
62
|
if (localOwner) {
|
|
62
63
|
return {
|
|
63
|
-
account:
|
|
64
|
+
account: _chunkAHOFT42Hcjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
|
|
64
65
|
address: localOwner.address
|
|
65
66
|
};
|
|
66
67
|
}
|
|
67
|
-
const created =
|
|
68
|
-
|
|
68
|
+
const created = _chunkAHOFT42Hcjs.createSessionOwnerKey.call(void 0, );
|
|
69
|
+
_chunkAHOFT42Hcjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
|
|
69
70
|
return {
|
|
70
71
|
account: created.account,
|
|
71
72
|
address: created.address
|
|
@@ -127,7 +128,7 @@ function SetupStep({
|
|
|
127
128
|
primaryType: typedData.primaryType,
|
|
128
129
|
message: typedData.message
|
|
129
130
|
});
|
|
130
|
-
const sessionDetails =
|
|
131
|
+
const sessionDetails = _chunkAHOFT42Hcjs.buildSessionDetails.call(void 0, setup.sessionDetailsUnsigned, signature);
|
|
131
132
|
setState({ type: "registering" });
|
|
132
133
|
await service.registerAccount({
|
|
133
134
|
address: smartAccount,
|
|
@@ -198,7 +199,7 @@ function SetupStep({
|
|
|
198
199
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
199
200
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", children: [
|
|
200
201
|
isLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
201
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
202
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkAHOFT42Hcjs.Spinner, { className: "rs-spinner--lg rs-text-accent" }),
|
|
202
203
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-text", children: [
|
|
203
204
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: renderStateMessage() }),
|
|
204
205
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-subtitle", children: "This may take a moment" })
|
|
@@ -235,7 +236,7 @@ function SetupStep({
|
|
|
235
236
|
] })
|
|
236
237
|
] })
|
|
237
238
|
] }),
|
|
238
|
-
isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
239
|
+
isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkAHOFT42Hcjs.Button, { onClick: handleRetry, variant: "default", fullWidth: true, children: "Try Again" }) })
|
|
239
240
|
] });
|
|
240
241
|
}
|
|
241
242
|
|
|
@@ -259,7 +260,7 @@ function AssetSelectStep({
|
|
|
259
260
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
260
261
|
const defaultAssetId = _react.useMemo.call(void 0, () => {
|
|
261
262
|
if (!defaultSourceChain || !defaultSourceToken) return null;
|
|
262
|
-
return
|
|
263
|
+
return _chunkAHOFT42Hcjs.getAssetId.call(void 0, {
|
|
263
264
|
chainId: defaultSourceChain,
|
|
264
265
|
token: defaultSourceToken
|
|
265
266
|
});
|
|
@@ -276,10 +277,10 @@ function AssetSelectStep({
|
|
|
276
277
|
try {
|
|
277
278
|
const portfolio = await service.fetchPortfolio(address);
|
|
278
279
|
if (!active) return;
|
|
279
|
-
const portfolioAssets =
|
|
280
|
+
const portfolioAssets = _chunkAHOFT42Hcjs.portfolioToAssets.call(void 0, portfolio.tokens);
|
|
280
281
|
setAssets(portfolioAssets);
|
|
281
282
|
const hasNative = portfolioAssets.some(
|
|
282
|
-
(asset) => asset.token.toLowerCase() ===
|
|
283
|
+
(asset) => asset.token.toLowerCase() === _chunkFLXTBFMZcjs.NATIVE_TOKEN_ADDRESS
|
|
283
284
|
);
|
|
284
285
|
if (!hasNative) {
|
|
285
286
|
const nativeAssets = await fetchNativeAssets(
|
|
@@ -345,7 +346,7 @@ function AssetSelectStep({
|
|
|
345
346
|
const raw = _viem.formatUnits.call(void 0, BigInt(asset.balance), asset.decimals);
|
|
346
347
|
const numeric = Number(raw);
|
|
347
348
|
if (!Number.isFinite(numeric)) return raw;
|
|
348
|
-
return
|
|
349
|
+
return _chunkAHOFT42Hcjs.tokenFormatter.format(numeric);
|
|
349
350
|
} catch (e3) {
|
|
350
351
|
return asset.balance;
|
|
351
352
|
}
|
|
@@ -359,7 +360,7 @@ function AssetSelectStep({
|
|
|
359
360
|
style: { paddingTop: 4, overflow: "auto", maxHeight: 340 },
|
|
360
361
|
children: [
|
|
361
362
|
loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
362
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
363
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkAHOFT42Hcjs.Spinner, { className: "rs-text-tertiary" }),
|
|
363
364
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
364
365
|
] }),
|
|
365
366
|
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 }) }),
|
|
@@ -392,9 +393,9 @@ function AssetSelectStep({
|
|
|
392
393
|
!loading && !error && rows.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-list", children: rows.map((asset) => {
|
|
393
394
|
const isSelected = selectedAssetId === asset.id;
|
|
394
395
|
const tokenAmount = formatBalance(asset);
|
|
395
|
-
const badge =
|
|
396
|
-
const tokenIcon =
|
|
397
|
-
const chainIcon =
|
|
396
|
+
const badge = _chunkFLXTBFMZcjs.getChainBadge.call(void 0, asset.chainId);
|
|
397
|
+
const tokenIcon = _chunkFLXTBFMZcjs.getTokenIcon.call(void 0, asset.symbol);
|
|
398
|
+
const chainIcon = _chunkFLXTBFMZcjs.getChainIcon.call(void 0, asset.chainId);
|
|
398
399
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
399
400
|
"button",
|
|
400
401
|
{
|
|
@@ -418,7 +419,7 @@ function AssetSelectStep({
|
|
|
418
419
|
"img",
|
|
419
420
|
{
|
|
420
421
|
src: chainIcon,
|
|
421
|
-
alt:
|
|
422
|
+
alt: _chunkFLXTBFMZcjs.getChainName.call(void 0, asset.chainId),
|
|
422
423
|
className: "rs-asset-chain-badge"
|
|
423
424
|
}
|
|
424
425
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -439,7 +440,7 @@ function AssetSelectStep({
|
|
|
439
440
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-asset-chain", children: [
|
|
440
441
|
" ",
|
|
441
442
|
"on ",
|
|
442
|
-
|
|
443
|
+
_chunkFLXTBFMZcjs.getChainName.call(void 0, asset.chainId)
|
|
443
444
|
] })
|
|
444
445
|
] }),
|
|
445
446
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-asset-balance-small", children: [
|
|
@@ -449,7 +450,7 @@ function AssetSelectStep({
|
|
|
449
450
|
] })
|
|
450
451
|
] })
|
|
451
452
|
] }),
|
|
452
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ?
|
|
453
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ? _chunkAHOFT42Hcjs.currencyFormatter.format(asset.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${asset.symbol}` : "--" })
|
|
453
454
|
]
|
|
454
455
|
},
|
|
455
456
|
asset.id
|
|
@@ -459,7 +460,7 @@ function AssetSelectStep({
|
|
|
459
460
|
}
|
|
460
461
|
),
|
|
461
462
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
462
|
-
|
|
463
|
+
_chunkAHOFT42Hcjs.Button,
|
|
463
464
|
{
|
|
464
465
|
onClick: () => selectedAsset && onContinue(selectedAsset),
|
|
465
466
|
disabled: !selectedAsset,
|
|
@@ -467,17 +468,17 @@ function AssetSelectStep({
|
|
|
467
468
|
children: "Continue"
|
|
468
469
|
}
|
|
469
470
|
) }),
|
|
470
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
471
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkAHOFT42Hcjs.PoweredBy, {})
|
|
471
472
|
] });
|
|
472
473
|
}
|
|
473
474
|
async function fetchNativeAssets(address, publicClient, existing) {
|
|
474
475
|
const existingIds = new Set(existing.map((asset) => asset.id));
|
|
475
476
|
const connectedChainId = _optionalChain([publicClient, 'access', _6 => _6.chain, 'optionalAccess', _7 => _7.id]);
|
|
476
477
|
if (!connectedChainId) return [];
|
|
477
|
-
if (!
|
|
478
|
-
const id =
|
|
478
|
+
if (!_chunkFLXTBFMZcjs.SOURCE_CHAINS.some((chain) => chain.id === connectedChainId)) return [];
|
|
479
|
+
const id = _chunkAHOFT42Hcjs.getAssetId.call(void 0, {
|
|
479
480
|
chainId: connectedChainId,
|
|
480
|
-
token:
|
|
481
|
+
token: _chunkFLXTBFMZcjs.NATIVE_TOKEN_ADDRESS
|
|
481
482
|
});
|
|
482
483
|
if (existingIds.has(id)) return [];
|
|
483
484
|
try {
|
|
@@ -486,7 +487,7 @@ async function fetchNativeAssets(address, publicClient, existing) {
|
|
|
486
487
|
{
|
|
487
488
|
id,
|
|
488
489
|
chainId: connectedChainId,
|
|
489
|
-
token:
|
|
490
|
+
token: _chunkFLXTBFMZcjs.NATIVE_TOKEN_ADDRESS,
|
|
490
491
|
symbol: "ETH",
|
|
491
492
|
name: "Ethereum",
|
|
492
493
|
decimals: 18,
|
|
@@ -536,8 +537,8 @@ function AmountStep({
|
|
|
536
537
|
const chainMismatch = Boolean(
|
|
537
538
|
_optionalChain([walletClient, 'optionalAccess', _8 => _8.chain, 'optionalAccess', _9 => _9.id]) && walletClient.chain.id !== asset.chainId
|
|
538
539
|
);
|
|
539
|
-
const targetSymbol =
|
|
540
|
-
const isSourceStablecoin =
|
|
540
|
+
const targetSymbol = _chunkFLXTBFMZcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
541
|
+
const isSourceStablecoin = _chunkFLXTBFMZcjs.isStablecoinSymbol.call(void 0, asset.symbol);
|
|
541
542
|
const tokenPriceUsd = _react.useMemo.call(void 0, () => {
|
|
542
543
|
if (tokenPriceUsdOverride !== void 0 && tokenPriceUsdOverride > 0)
|
|
543
544
|
return tokenPriceUsdOverride;
|
|
@@ -561,7 +562,7 @@ function AmountStep({
|
|
|
561
562
|
const balanceTarget = _nullishCoalesce(balanceAddress, () => ( address));
|
|
562
563
|
if (!balanceTarget || !publicClient) return;
|
|
563
564
|
try {
|
|
564
|
-
const bal =
|
|
565
|
+
const bal = _chunkAHOFT42Hcjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: balanceTarget }) : await publicClient.readContract({
|
|
565
566
|
address: asset.token,
|
|
566
567
|
abi: _viem.erc20Abi,
|
|
567
568
|
functionName: "balanceOf",
|
|
@@ -587,7 +588,7 @@ function AmountStep({
|
|
|
587
588
|
setIsSwitching(true);
|
|
588
589
|
switchChain(asset.chainId).catch((err) => {
|
|
589
590
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
590
|
-
setError(
|
|
591
|
+
setError(_chunkAHOFT42Hcjs.formatUserError.call(void 0, raw));
|
|
591
592
|
}).finally(() => {
|
|
592
593
|
setIsSwitching(false);
|
|
593
594
|
});
|
|
@@ -623,7 +624,7 @@ function AmountStep({
|
|
|
623
624
|
const raw = _viem.formatUnits.call(void 0, balance, asset.decimals);
|
|
624
625
|
const numeric = Number(raw);
|
|
625
626
|
if (!Number.isFinite(numeric)) return raw;
|
|
626
|
-
return
|
|
627
|
+
return _chunkAHOFT42Hcjs.tokenFormatter.format(numeric);
|
|
627
628
|
} catch (e8) {
|
|
628
629
|
return "...";
|
|
629
630
|
}
|
|
@@ -665,13 +666,13 @@ function AmountStep({
|
|
|
665
666
|
const usdValue = numericAmount;
|
|
666
667
|
if (_optionalChain([uiConfig, 'optionalAccess', _11 => _11.maxDepositUsd]) && usdValue > uiConfig.maxDepositUsd) {
|
|
667
668
|
setError(
|
|
668
|
-
`Maximum deposit is ${
|
|
669
|
+
`Maximum deposit is ${_chunkAHOFT42Hcjs.currencyFormatter.format(uiConfig.maxDepositUsd)}`
|
|
669
670
|
);
|
|
670
671
|
return;
|
|
671
672
|
}
|
|
672
673
|
if (_optionalChain([uiConfig, 'optionalAccess', _12 => _12.minDepositUsd]) && usdValue < uiConfig.minDepositUsd) {
|
|
673
674
|
setError(
|
|
674
|
-
`Minimum deposit is ${
|
|
675
|
+
`Minimum deposit is ${_chunkAHOFT42Hcjs.currencyFormatter.format(uiConfig.minDepositUsd)}`
|
|
675
676
|
);
|
|
676
677
|
return;
|
|
677
678
|
}
|
|
@@ -720,7 +721,7 @@ function AmountStep({
|
|
|
720
721
|
hasPricing && balanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { style: { color: "var(--rs-muted-foreground)" }, children: [
|
|
721
722
|
" ",
|
|
722
723
|
"(",
|
|
723
|
-
|
|
724
|
+
_chunkAHOFT42Hcjs.currencyFormatter.format(balanceUsd),
|
|
724
725
|
")"
|
|
725
726
|
] })
|
|
726
727
|
] }) })
|
|
@@ -734,26 +735,26 @@ function AmountStep({
|
|
|
734
735
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-flow-pill-label", children: "You send" }),
|
|
735
736
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token", children: [
|
|
736
737
|
/* @__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:
|
|
738
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children: _chunkFLXTBFMZcjs.getTokenIcon.call(void 0, asset.symbol) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
738
739
|
"img",
|
|
739
740
|
{
|
|
740
|
-
src:
|
|
741
|
+
src: _chunkFLXTBFMZcjs.getTokenIcon.call(void 0, asset.symbol),
|
|
741
742
|
alt: asset.symbol
|
|
742
743
|
}
|
|
743
744
|
) : asset.symbol.slice(0, 2) }),
|
|
744
745
|
(() => {
|
|
745
|
-
const chainIcon =
|
|
746
|
+
const chainIcon = _chunkFLXTBFMZcjs.getChainIcon.call(void 0, asset.chainId);
|
|
746
747
|
if (chainIcon) {
|
|
747
748
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
748
749
|
"img",
|
|
749
750
|
{
|
|
750
751
|
src: chainIcon,
|
|
751
|
-
alt:
|
|
752
|
+
alt: _chunkFLXTBFMZcjs.getChainName.call(void 0, asset.chainId),
|
|
752
753
|
className: "rs-flow-pill-chain-badge"
|
|
753
754
|
}
|
|
754
755
|
);
|
|
755
756
|
}
|
|
756
|
-
const badge =
|
|
757
|
+
const badge = _chunkFLXTBFMZcjs.getChainBadge.call(void 0, asset.chainId);
|
|
757
758
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
758
759
|
"div",
|
|
759
760
|
{
|
|
@@ -791,26 +792,26 @@ function AmountStep({
|
|
|
791
792
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-flow-pill-label", children: "You receive" }),
|
|
792
793
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-flow-pill-token", children: [
|
|
793
794
|
/* @__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:
|
|
795
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-flow-pill-token-icon", children: _chunkFLXTBFMZcjs.getTokenIcon.call(void 0, targetSymbol) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
795
796
|
"img",
|
|
796
797
|
{
|
|
797
|
-
src:
|
|
798
|
+
src: _chunkFLXTBFMZcjs.getTokenIcon.call(void 0, targetSymbol),
|
|
798
799
|
alt: targetSymbol
|
|
799
800
|
}
|
|
800
801
|
) : targetSymbol.slice(0, 2) }),
|
|
801
802
|
(() => {
|
|
802
|
-
const chainIcon =
|
|
803
|
+
const chainIcon = _chunkFLXTBFMZcjs.getChainIcon.call(void 0, targetChain);
|
|
803
804
|
if (chainIcon) {
|
|
804
805
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
805
806
|
"img",
|
|
806
807
|
{
|
|
807
808
|
src: chainIcon,
|
|
808
|
-
alt:
|
|
809
|
+
alt: _chunkFLXTBFMZcjs.getChainName.call(void 0, targetChain),
|
|
809
810
|
className: "rs-flow-pill-chain-badge"
|
|
810
811
|
}
|
|
811
812
|
);
|
|
812
813
|
}
|
|
813
|
-
const badge =
|
|
814
|
+
const badge = _chunkFLXTBFMZcjs.getChainBadge.call(void 0, targetChain);
|
|
814
815
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
815
816
|
"div",
|
|
816
817
|
{
|
|
@@ -856,7 +857,7 @@ function AmountStep({
|
|
|
856
857
|
}
|
|
857
858
|
)
|
|
858
859
|
] }),
|
|
859
|
-
chainMismatch && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-chain-switch", style: { marginTop: 16 }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-chain-switch-text", children: isSwitching ? `Switching to ${
|
|
860
|
+
chainMismatch && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-chain-switch", style: { marginTop: 16 }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-chain-switch-text", children: isSwitching ? `Switching to ${_chunkFLXTBFMZcjs.getChainName.call(void 0, asset.chainId)}...` : `Switch your wallet to ${_chunkFLXTBFMZcjs.getChainName.call(void 0, asset.chainId)} to continue.` }) }),
|
|
860
861
|
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error", children: [
|
|
861
862
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
862
863
|
"svg",
|
|
@@ -880,7 +881,7 @@ function AmountStep({
|
|
|
880
881
|
] })
|
|
881
882
|
] }),
|
|
882
883
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
883
|
-
|
|
884
|
+
_chunkAHOFT42Hcjs.Button,
|
|
884
885
|
{
|
|
885
886
|
onClick: handleContinue,
|
|
886
887
|
fullWidth: true,
|
|
@@ -888,7 +889,7 @@ function AmountStep({
|
|
|
888
889
|
children: "Continue"
|
|
889
890
|
}
|
|
890
891
|
) }),
|
|
891
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
892
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkAHOFT42Hcjs.PoweredBy, {})
|
|
892
893
|
] });
|
|
893
894
|
}
|
|
894
895
|
|
|
@@ -919,7 +920,7 @@ function ConfirmStep({
|
|
|
919
920
|
const hasAttemptedSwitch = _react.useRef.call(void 0, false);
|
|
920
921
|
const chainMismatch = _optionalChain([walletClient, 'optionalAccess', _13 => _13.chain, 'optionalAccess', _14 => _14.id]) && walletClient.chain.id !== asset.chainId;
|
|
921
922
|
const sameRoute = targetChain === asset.chainId && targetToken.toLowerCase() === asset.token.toLowerCase();
|
|
922
|
-
const targetSymbol = sameRoute ? asset.symbol :
|
|
923
|
+
const targetSymbol = sameRoute ? asset.symbol : _chunkFLXTBFMZcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
923
924
|
const formattedSendAmount = amount && !Number.isNaN(Number(amount)) ? Number(amount).toLocaleString("en-US", { maximumFractionDigits: 6 }) : "0";
|
|
924
925
|
const formattedReceiveAmount = (() => {
|
|
925
926
|
if (sameRoute) return formattedSendAmount;
|
|
@@ -938,7 +939,7 @@ function ConfirmStep({
|
|
|
938
939
|
setIsSwitching(true);
|
|
939
940
|
switchChain(asset.chainId).catch((err) => {
|
|
940
941
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
941
|
-
setError(
|
|
942
|
+
setError(_chunkAHOFT42Hcjs.formatUserError.call(void 0, raw));
|
|
942
943
|
}).finally(() => {
|
|
943
944
|
setIsSwitching(false);
|
|
944
945
|
});
|
|
@@ -953,7 +954,7 @@ function ConfirmStep({
|
|
|
953
954
|
return;
|
|
954
955
|
}
|
|
955
956
|
if (chainMismatch) {
|
|
956
|
-
setError(`Switch to ${
|
|
957
|
+
setError(`Switch to ${_chunkFLXTBFMZcjs.getChainName.call(void 0, asset.chainId)} to sign`);
|
|
957
958
|
return;
|
|
958
959
|
}
|
|
959
960
|
const parsedAmount = parseFloat(amount);
|
|
@@ -981,7 +982,7 @@ function ConfirmStep({
|
|
|
981
982
|
throw new Error("Wallet not properly connected");
|
|
982
983
|
}
|
|
983
984
|
const transferTo = sameRoute ? recipient : smartAccount;
|
|
984
|
-
const hash =
|
|
985
|
+
const hash = _chunkAHOFT42Hcjs.isNativeAsset.call(void 0, asset) ? await walletClient.sendTransaction({
|
|
985
986
|
account,
|
|
986
987
|
chain,
|
|
987
988
|
to: transferTo,
|
|
@@ -998,7 +999,7 @@ function ConfirmStep({
|
|
|
998
999
|
onConfirm(hash, asset.chainId, amountUnits.toString(), asset.token);
|
|
999
1000
|
} catch (err) {
|
|
1000
1001
|
const raw = err instanceof Error ? err.message : "Transfer failed";
|
|
1001
|
-
const message =
|
|
1002
|
+
const message = _chunkAHOFT42Hcjs.formatUserError.call(void 0, raw);
|
|
1002
1003
|
setError(message);
|
|
1003
1004
|
_optionalChain([onError, 'optionalCall', _16 => _16(message, "TRANSFER_ERROR")]);
|
|
1004
1005
|
} finally {
|
|
@@ -1017,15 +1018,15 @@ function ConfirmStep({
|
|
|
1017
1018
|
className: "rs-card-value",
|
|
1018
1019
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
1019
1020
|
children: [
|
|
1020
|
-
|
|
1021
|
+
_chunkFLXTBFMZcjs.getChainIcon.call(void 0, asset.chainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1021
1022
|
"img",
|
|
1022
1023
|
{
|
|
1023
|
-
src:
|
|
1024
|
+
src: _chunkFLXTBFMZcjs.getChainIcon.call(void 0, asset.chainId),
|
|
1024
1025
|
alt: "",
|
|
1025
1026
|
style: { width: 16, height: 16, borderRadius: 3 }
|
|
1026
1027
|
}
|
|
1027
1028
|
),
|
|
1028
|
-
|
|
1029
|
+
_chunkFLXTBFMZcjs.getChainName.call(void 0, asset.chainId)
|
|
1029
1030
|
]
|
|
1030
1031
|
}
|
|
1031
1032
|
)
|
|
@@ -1038,15 +1039,15 @@ function ConfirmStep({
|
|
|
1038
1039
|
className: "rs-card-value",
|
|
1039
1040
|
style: { display: "flex", alignItems: "center", gap: 8 },
|
|
1040
1041
|
children: [
|
|
1041
|
-
|
|
1042
|
+
_chunkFLXTBFMZcjs.getChainIcon.call(void 0, targetChain) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1042
1043
|
"img",
|
|
1043
1044
|
{
|
|
1044
|
-
src:
|
|
1045
|
+
src: _chunkFLXTBFMZcjs.getChainIcon.call(void 0, targetChain),
|
|
1045
1046
|
alt: "",
|
|
1046
1047
|
style: { width: 16, height: 16, borderRadius: 3 }
|
|
1047
1048
|
}
|
|
1048
1049
|
),
|
|
1049
|
-
|
|
1050
|
+
_chunkFLXTBFMZcjs.getChainName.call(void 0, targetChain)
|
|
1050
1051
|
]
|
|
1051
1052
|
}
|
|
1052
1053
|
)
|
|
@@ -1065,10 +1066,10 @@ function ConfirmStep({
|
|
|
1065
1066
|
className: "rs-card-value",
|
|
1066
1067
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
1067
1068
|
children: [
|
|
1068
|
-
|
|
1069
|
+
_chunkFLXTBFMZcjs.getTokenIcon.call(void 0, asset.symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1069
1070
|
"img",
|
|
1070
1071
|
{
|
|
1071
|
-
src:
|
|
1072
|
+
src: _chunkFLXTBFMZcjs.getTokenIcon.call(void 0, asset.symbol),
|
|
1072
1073
|
alt: "",
|
|
1073
1074
|
style: { width: 16, height: 16, borderRadius: "50%" }
|
|
1074
1075
|
}
|
|
@@ -1088,10 +1089,10 @@ function ConfirmStep({
|
|
|
1088
1089
|
className: "rs-card-value",
|
|
1089
1090
|
style: { display: "flex", alignItems: "center", gap: 6 },
|
|
1090
1091
|
children: [
|
|
1091
|
-
|
|
1092
|
+
_chunkFLXTBFMZcjs.getTokenIcon.call(void 0, targetSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1092
1093
|
"img",
|
|
1093
1094
|
{
|
|
1094
|
-
src:
|
|
1095
|
+
src: _chunkFLXTBFMZcjs.getTokenIcon.call(void 0, targetSymbol),
|
|
1095
1096
|
alt: "",
|
|
1096
1097
|
style: { width: 16, height: 16, borderRadius: "50%" }
|
|
1097
1098
|
}
|
|
@@ -1104,7 +1105,7 @@ function ConfirmStep({
|
|
|
1104
1105
|
)
|
|
1105
1106
|
] })
|
|
1106
1107
|
] }),
|
|
1107
|
-
chainMismatch && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-chain-switch", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-chain-switch-text", children: isSwitching ? `Switching to ${
|
|
1108
|
+
chainMismatch && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-chain-switch", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-chain-switch-text", children: isSwitching ? `Switching to ${_chunkFLXTBFMZcjs.getChainName.call(void 0, asset.chainId)}...` : `Switch your wallet to ${_chunkFLXTBFMZcjs.getChainName.call(void 0, asset.chainId)} to sign.` }) }),
|
|
1108
1109
|
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-alert rs-alert--error", children: [
|
|
1109
1110
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1110
1111
|
"svg",
|
|
@@ -1128,7 +1129,7 @@ function ConfirmStep({
|
|
|
1128
1129
|
] })
|
|
1129
1130
|
] }),
|
|
1130
1131
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1131
|
-
|
|
1132
|
+
_chunkAHOFT42Hcjs.Button,
|
|
1132
1133
|
{
|
|
1133
1134
|
onClick: handleConfirm,
|
|
1134
1135
|
loading: isSubmitting,
|
|
@@ -1137,7 +1138,7 @@ function ConfirmStep({
|
|
|
1137
1138
|
children: "Confirm Order"
|
|
1138
1139
|
}
|
|
1139
1140
|
) }),
|
|
1140
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1141
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkAHOFT42Hcjs.PoweredBy, {})
|
|
1141
1142
|
] });
|
|
1142
1143
|
}
|
|
1143
1144
|
|
|
@@ -1236,58 +1237,18 @@ QRCode.displayName = "QRCode";
|
|
|
1236
1237
|
// src/components/steps/DepositAddressStep.tsx
|
|
1237
1238
|
|
|
1238
1239
|
var POLL_INTERVAL_MS = 4e3;
|
|
1239
|
-
function isRecord(value) {
|
|
1240
|
-
return typeof value === "object" && value !== null;
|
|
1241
|
-
}
|
|
1242
|
-
function asNumber(value) {
|
|
1243
|
-
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
1244
|
-
if (typeof value === "string" && value.trim() !== "") {
|
|
1245
|
-
const parsed = Number(value);
|
|
1246
|
-
return Number.isFinite(parsed) ? parsed : void 0;
|
|
1247
|
-
}
|
|
1248
|
-
return void 0;
|
|
1249
|
-
}
|
|
1250
|
-
function asAmount(value) {
|
|
1251
|
-
if (typeof value === "string") return value;
|
|
1252
|
-
if (typeof value === "number" && Number.isFinite(value)) {
|
|
1253
|
-
return value.toString();
|
|
1254
|
-
}
|
|
1255
|
-
return void 0;
|
|
1256
|
-
}
|
|
1257
|
-
function asAddress(value) {
|
|
1258
|
-
if (typeof value !== "string") return void 0;
|
|
1259
|
-
return /^0x[a-fA-F0-9]{40}$/.test(value) ? value : void 0;
|
|
1260
|
-
}
|
|
1261
|
-
function getDepositEventDetails(event) {
|
|
1262
|
-
if (!_optionalChain([event, 'optionalAccess', _17 => _17.type]) || !isRecord(event.data)) return {};
|
|
1263
|
-
if (event.type === "deposit-received") {
|
|
1264
|
-
return {
|
|
1265
|
-
chainId: asNumber(event.data.chain),
|
|
1266
|
-
amount: asAmount(event.data.amount),
|
|
1267
|
-
token: asAddress(event.data.token)
|
|
1268
|
-
};
|
|
1269
|
-
}
|
|
1270
|
-
if (event.type === "bridge-started") {
|
|
1271
|
-
const source = isRecord(event.data.source) ? event.data.source : void 0;
|
|
1272
|
-
return {
|
|
1273
|
-
chainId: asNumber(_optionalChain([source, 'optionalAccess', _18 => _18.chain])),
|
|
1274
|
-
token: asAddress(_optionalChain([source, 'optionalAccess', _19 => _19.asset]))
|
|
1275
|
-
};
|
|
1276
|
-
}
|
|
1277
|
-
return {};
|
|
1278
|
-
}
|
|
1279
1240
|
function DepositAddressStep({
|
|
1280
1241
|
smartAccount,
|
|
1281
1242
|
service,
|
|
1282
1243
|
onDepositDetected,
|
|
1283
1244
|
onError
|
|
1284
1245
|
}) {
|
|
1285
|
-
const supportedChainIds = _react.useMemo.call(void 0, () =>
|
|
1246
|
+
const supportedChainIds = _react.useMemo.call(void 0, () => _chunkFLXTBFMZcjs.getSupportedChainIds.call(void 0, ), []);
|
|
1286
1247
|
const BASE_CHAIN_ID = 8453;
|
|
1287
1248
|
const defaultChainId = supportedChainIds.includes(BASE_CHAIN_ID) ? BASE_CHAIN_ID : supportedChainIds[0];
|
|
1288
1249
|
const [sourceChainId, setSourceChainId] = _react.useState.call(void 0, defaultChainId);
|
|
1289
1250
|
const tokensForChain = _react.useMemo.call(void 0,
|
|
1290
|
-
() =>
|
|
1251
|
+
() => _chunkFLXTBFMZcjs.getTargetTokenSymbolsForChain.call(void 0, sourceChainId),
|
|
1291
1252
|
[sourceChainId]
|
|
1292
1253
|
);
|
|
1293
1254
|
const defaultToken = tokensForChain.includes("USDC") ? "USDC" : _nullishCoalesce(tokensForChain[0], () => ( "USDC"));
|
|
@@ -1319,8 +1280,8 @@ function DepositAddressStep({
|
|
|
1319
1280
|
function handlePointerDown(event) {
|
|
1320
1281
|
const target = event.target;
|
|
1321
1282
|
if (!target) return;
|
|
1322
|
-
const clickedChainDropdown = _optionalChain([chainDropdownRef, 'access',
|
|
1323
|
-
const clickedTokenDropdown = _optionalChain([tokenDropdownRef, 'access',
|
|
1283
|
+
const clickedChainDropdown = _optionalChain([chainDropdownRef, 'access', _17 => _17.current, 'optionalAccess', _18 => _18.contains, 'call', _19 => _19(target)]);
|
|
1284
|
+
const clickedTokenDropdown = _optionalChain([tokenDropdownRef, 'access', _20 => _20.current, 'optionalAccess', _21 => _21.contains, 'call', _22 => _22(target)]);
|
|
1324
1285
|
if (clickedChainDropdown || clickedTokenDropdown) return;
|
|
1325
1286
|
setChainDropdownOpen(false);
|
|
1326
1287
|
setTokenDropdownOpen(false);
|
|
@@ -1362,15 +1323,15 @@ function DepositAddressStep({
|
|
|
1362
1323
|
const status = await service.fetchLatestStatus(smartAccount);
|
|
1363
1324
|
if (cancelled || depositHandledRef.current) return;
|
|
1364
1325
|
const event = status.lastEvent;
|
|
1365
|
-
const eventTxHash =
|
|
1326
|
+
const eventTxHash = _chunkAHOFT42Hcjs.isDepositEvent.call(void 0, event) ? _nullishCoalesce(_optionalChain([_chunkAHOFT42Hcjs.getEventTxHash.call(void 0, event), 'optionalAccess', _23 => _23.toLowerCase, 'call', _24 => _24()]), () => ( null)) : null;
|
|
1366
1327
|
if (baselineTxHash === void 0) {
|
|
1367
1328
|
baselineTxHash = eventTxHash;
|
|
1368
1329
|
} else if (eventTxHash && eventTxHash !== baselineTxHash) {
|
|
1369
|
-
const details =
|
|
1330
|
+
const details = _chunkAHOFT42Hcjs.getEventSourceDetails.call(void 0, event);
|
|
1370
1331
|
const fallback = sourceSelectionRef.current;
|
|
1371
1332
|
const chainId = _nullishCoalesce(details.chainId, () => ( fallback.chainId));
|
|
1372
1333
|
const amount = _nullishCoalesce(details.amount, () => ( "0"));
|
|
1373
|
-
const token = _nullishCoalesce(details.token, () => (
|
|
1334
|
+
const token = _nullishCoalesce(details.token, () => ( _chunkFLXTBFMZcjs.getTokenAddress.call(void 0, fallback.tokenSymbol, fallback.chainId)));
|
|
1374
1335
|
if (token) {
|
|
1375
1336
|
depositHandledRef.current = true;
|
|
1376
1337
|
onDepositDetected(eventTxHash, chainId, amount, token);
|
|
@@ -1382,7 +1343,7 @@ function DepositAddressStep({
|
|
|
1382
1343
|
if (!cancelled) {
|
|
1383
1344
|
const msg = err instanceof Error ? err.message : "Failed to check status";
|
|
1384
1345
|
setPollingError(msg);
|
|
1385
|
-
_optionalChain([onError, 'optionalCall',
|
|
1346
|
+
_optionalChain([onError, 'optionalCall', _25 => _25(msg, "STATUS_POLL_ERROR")]);
|
|
1386
1347
|
}
|
|
1387
1348
|
}
|
|
1388
1349
|
if (!cancelled && !depositHandledRef.current) {
|
|
@@ -1395,7 +1356,7 @@ function DepositAddressStep({
|
|
|
1395
1356
|
clearTimeout(timeoutId);
|
|
1396
1357
|
};
|
|
1397
1358
|
}, [smartAccount, service, onDepositDetected, onError]);
|
|
1398
|
-
const chainIconSrc =
|
|
1359
|
+
const chainIconSrc = _chunkFLXTBFMZcjs.getChainIcon.call(void 0, sourceChainId);
|
|
1399
1360
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
1400
1361
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-body", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address", children: [
|
|
1401
1362
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-deposit-address-selectors", children: [
|
|
@@ -1411,10 +1372,10 @@ function DepositAddressStep({
|
|
|
1411
1372
|
setChainDropdownOpen(false);
|
|
1412
1373
|
},
|
|
1413
1374
|
children: [
|
|
1414
|
-
|
|
1375
|
+
_chunkFLXTBFMZcjs.getTokenIcon.call(void 0, sourceTokenSymbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1415
1376
|
"img",
|
|
1416
1377
|
{
|
|
1417
|
-
src:
|
|
1378
|
+
src: _chunkFLXTBFMZcjs.getTokenIcon.call(void 0, sourceTokenSymbol),
|
|
1418
1379
|
alt: "",
|
|
1419
1380
|
className: "rs-deposit-address-dropdown-icon"
|
|
1420
1381
|
}
|
|
@@ -1451,10 +1412,10 @@ function DepositAddressStep({
|
|
|
1451
1412
|
setTokenDropdownOpen(false);
|
|
1452
1413
|
},
|
|
1453
1414
|
children: [
|
|
1454
|
-
|
|
1415
|
+
_chunkFLXTBFMZcjs.getTokenIcon.call(void 0, symbol) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1455
1416
|
"img",
|
|
1456
1417
|
{
|
|
1457
|
-
src:
|
|
1418
|
+
src: _chunkFLXTBFMZcjs.getTokenIcon.call(void 0, symbol),
|
|
1458
1419
|
alt: "",
|
|
1459
1420
|
className: "rs-deposit-address-dropdown-icon"
|
|
1460
1421
|
}
|
|
@@ -1477,15 +1438,15 @@ function DepositAddressStep({
|
|
|
1477
1438
|
setTokenDropdownOpen(false);
|
|
1478
1439
|
},
|
|
1479
1440
|
children: [
|
|
1480
|
-
|
|
1441
|
+
_chunkFLXTBFMZcjs.getChainIcon.call(void 0, sourceChainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1481
1442
|
"img",
|
|
1482
1443
|
{
|
|
1483
|
-
src:
|
|
1444
|
+
src: _chunkFLXTBFMZcjs.getChainIcon.call(void 0, sourceChainId),
|
|
1484
1445
|
alt: "",
|
|
1485
1446
|
className: "rs-deposit-address-dropdown-icon"
|
|
1486
1447
|
}
|
|
1487
1448
|
),
|
|
1488
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
1449
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkFLXTBFMZcjs.getChainName.call(void 0, sourceChainId) }),
|
|
1489
1450
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1490
1451
|
"svg",
|
|
1491
1452
|
{
|
|
@@ -1517,15 +1478,15 @@ function DepositAddressStep({
|
|
|
1517
1478
|
setChainDropdownOpen(false);
|
|
1518
1479
|
},
|
|
1519
1480
|
children: [
|
|
1520
|
-
|
|
1481
|
+
_chunkFLXTBFMZcjs.getChainIcon.call(void 0, chainId) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1521
1482
|
"img",
|
|
1522
1483
|
{
|
|
1523
|
-
src:
|
|
1484
|
+
src: _chunkFLXTBFMZcjs.getChainIcon.call(void 0, chainId),
|
|
1524
1485
|
alt: "",
|
|
1525
1486
|
className: "rs-deposit-address-dropdown-icon"
|
|
1526
1487
|
}
|
|
1527
1488
|
),
|
|
1528
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
1489
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkFLXTBFMZcjs.getChainName.call(void 0, chainId) })
|
|
1529
1490
|
]
|
|
1530
1491
|
},
|
|
1531
1492
|
chainId
|
|
@@ -1575,7 +1536,7 @@ function DepositAddressStep({
|
|
|
1575
1536
|
] }),
|
|
1576
1537
|
pollingError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-error", children: pollingError })
|
|
1577
1538
|
] }) }),
|
|
1578
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1539
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkAHOFT42Hcjs.PoweredBy, {})
|
|
1579
1540
|
] });
|
|
1580
1541
|
}
|
|
1581
1542
|
DepositAddressStep.displayName = "DepositAddressStep";
|
|
@@ -1585,6 +1546,9 @@ DepositAddressStep.displayName = "DepositAddressStep";
|
|
|
1585
1546
|
function isSameRoute(sourceChain, sourceToken, targetChain, targetToken) {
|
|
1586
1547
|
return sourceChain === targetChain && sourceToken.toLowerCase() === targetToken.toLowerCase();
|
|
1587
1548
|
}
|
|
1549
|
+
function getAddressKey(address) {
|
|
1550
|
+
return address ? address.toLowerCase() : null;
|
|
1551
|
+
}
|
|
1588
1552
|
function DepositFlow({
|
|
1589
1553
|
dappWalletClient,
|
|
1590
1554
|
dappPublicClient,
|
|
@@ -1596,7 +1560,7 @@ function DepositFlow({
|
|
|
1596
1560
|
sourceToken: defaultSourceToken,
|
|
1597
1561
|
amount: defaultAmount,
|
|
1598
1562
|
recipient,
|
|
1599
|
-
signerAddress =
|
|
1563
|
+
signerAddress = _chunkFLXTBFMZcjs.DEFAULT_SIGNER_ADDRESS,
|
|
1600
1564
|
sessionChainIds,
|
|
1601
1565
|
forceRegister = false,
|
|
1602
1566
|
waitForFinalTx = true,
|
|
@@ -1622,6 +1586,9 @@ function DepositFlow({
|
|
|
1622
1586
|
const [isConnectSelectionConfirmed, setIsConnectSelectionConfirmed] = _react.useState.call(void 0, false);
|
|
1623
1587
|
const [selectedConnectAddress, setSelectedConnectAddress] = _react.useState.call(void 0, null);
|
|
1624
1588
|
const portfolioAssetsRef = _react.useRef.call(void 0, []);
|
|
1589
|
+
const stableWalletSignerRef = _react.useRef.call(void 0, null);
|
|
1590
|
+
const stableWalletSelectionKeyRef = _react.useRef.call(void 0, null);
|
|
1591
|
+
const hasNavigatedBackRef = _react.useRef.call(void 0, false);
|
|
1625
1592
|
const handleAssetsLoaded = _react.useCallback.call(void 0, (assets) => {
|
|
1626
1593
|
portfolioAssetsRef.current = assets;
|
|
1627
1594
|
}, []);
|
|
@@ -1639,23 +1606,24 @@ function DepositFlow({
|
|
|
1639
1606
|
return null;
|
|
1640
1607
|
}, []);
|
|
1641
1608
|
const dappSwitchChain = _react.useMemo.call(void 0, () => {
|
|
1642
|
-
if (!_optionalChain([dappWalletClient, 'optionalAccess',
|
|
1609
|
+
if (!_optionalChain([dappWalletClient, 'optionalAccess', _26 => _26.switchChain])) return void 0;
|
|
1643
1610
|
return async (chainId) => {
|
|
1644
|
-
await _optionalChain([dappWalletClient, 'access',
|
|
1611
|
+
await _optionalChain([dappWalletClient, 'access', _27 => _27.switchChain, 'optionalCall', _28 => _28({ id: chainId })]);
|
|
1645
1612
|
};
|
|
1646
1613
|
}, [dappWalletClient]);
|
|
1614
|
+
const connectedWalletAddress = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _29 => _29.account, 'optionalAccess', _30 => _30.address]), () => ( null));
|
|
1647
1615
|
const walletOptions = _react.useMemo.call(void 0, () => {
|
|
1648
1616
|
const options = [];
|
|
1649
1617
|
const seen = /* @__PURE__ */ new Set();
|
|
1650
|
-
if (
|
|
1618
|
+
if (connectedWalletAddress && dappAddress) {
|
|
1651
1619
|
options.push({
|
|
1652
|
-
address:
|
|
1620
|
+
address: connectedWalletAddress,
|
|
1653
1621
|
label: "Connected Wallet",
|
|
1654
1622
|
kind: "connected"
|
|
1655
1623
|
});
|
|
1656
|
-
seen.add(
|
|
1624
|
+
seen.add(connectedWalletAddress.toLowerCase());
|
|
1657
1625
|
}
|
|
1658
|
-
if (_optionalChain([reownWallet, 'optionalAccess',
|
|
1626
|
+
if (_optionalChain([reownWallet, 'optionalAccess', _31 => _31.address]) && reownWallet.isConnected && reownWallet.walletClient && reownWallet.publicClient && !seen.has(reownWallet.address.toLowerCase())) {
|
|
1659
1627
|
options.push({
|
|
1660
1628
|
address: reownWallet.address,
|
|
1661
1629
|
label: "External Wallet",
|
|
@@ -1665,48 +1633,58 @@ function DepositFlow({
|
|
|
1665
1633
|
}
|
|
1666
1634
|
return options;
|
|
1667
1635
|
}, [
|
|
1668
|
-
|
|
1636
|
+
connectedWalletAddress,
|
|
1669
1637
|
dappAddress,
|
|
1670
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
1671
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
1672
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
1673
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
1674
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
1638
|
+
_optionalChain([reownWallet, 'optionalAccess', _32 => _32.address]),
|
|
1639
|
+
_optionalChain([reownWallet, 'optionalAccess', _33 => _33.isConnected]),
|
|
1640
|
+
_optionalChain([reownWallet, 'optionalAccess', _34 => _34.walletClient]),
|
|
1641
|
+
_optionalChain([reownWallet, 'optionalAccess', _35 => _35.publicClient]),
|
|
1642
|
+
_optionalChain([reownWallet, 'optionalAccess', _36 => _36.icon])
|
|
1675
1643
|
]);
|
|
1676
|
-
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess',
|
|
1644
|
+
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess', _37 => _37.account]) && dappAddress && !reownWallet;
|
|
1677
1645
|
const hasWalletOptions = walletOptions.length > 0;
|
|
1678
|
-
const hasReownSession = Boolean(
|
|
1679
|
-
|
|
1680
|
-
|
|
1646
|
+
const hasReownSession = Boolean(
|
|
1647
|
+
_optionalChain([reownWallet, 'optionalAccess', _38 => _38.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _39 => _39.address])
|
|
1648
|
+
);
|
|
1649
|
+
const showConnectStep = flowMode === null && !canAutoLock && !isConnectSelectionConfirmed;
|
|
1650
|
+
const walletSelectionKey = _react.useMemo.call(void 0, () => {
|
|
1651
|
+
if (flowMode !== "wallet") return null;
|
|
1652
|
+
if (canAutoLock) {
|
|
1653
|
+
return getAddressKey(connectedWalletAddress);
|
|
1654
|
+
}
|
|
1655
|
+
if (!isConnectSelectionConfirmed) return null;
|
|
1656
|
+
return getAddressKey(selectedConnectAddress);
|
|
1657
|
+
}, [
|
|
1658
|
+
flowMode,
|
|
1659
|
+
canAutoLock,
|
|
1660
|
+
connectedWalletAddress,
|
|
1661
|
+
isConnectSelectionConfirmed,
|
|
1662
|
+
selectedConnectAddress
|
|
1663
|
+
]);
|
|
1664
|
+
const walletSignerContext = _react.useMemo.call(void 0, () => {
|
|
1681
1665
|
if (flowMode === "deposit-address") {
|
|
1682
|
-
|
|
1683
|
-
return {
|
|
1684
|
-
ownerAddress: dappAddress,
|
|
1685
|
-
walletClient: void 0,
|
|
1686
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkNULE6WIIcjs.getPublicClient.call(void 0, targetChain))),
|
|
1687
|
-
switchChain: void 0
|
|
1688
|
-
};
|
|
1666
|
+
return null;
|
|
1689
1667
|
}
|
|
1690
1668
|
if (canAutoLock) {
|
|
1691
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
1669
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _40 => _40.chain, 'optionalAccess', _41 => _41.id]), () => ( targetChain));
|
|
1692
1670
|
return {
|
|
1693
1671
|
ownerAddress: dappWalletClient.account.address,
|
|
1694
1672
|
walletClient: dappWalletClient,
|
|
1695
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
1673
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkAHOFT42Hcjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
1696
1674
|
switchChain: dappSwitchChain
|
|
1697
1675
|
};
|
|
1698
1676
|
}
|
|
1699
1677
|
if (!isConnectSelectionConfirmed || !selectedConnectAddress) return null;
|
|
1700
|
-
if (_optionalChain([dappWalletClient, 'optionalAccess',
|
|
1701
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
1678
|
+
if (_optionalChain([dappWalletClient, 'optionalAccess', _42 => _42.account]) && dappWalletClient.account.address.toLowerCase() === selectedConnectAddress.toLowerCase()) {
|
|
1679
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _43 => _43.chain, 'optionalAccess', _44 => _44.id]), () => ( targetChain));
|
|
1702
1680
|
return {
|
|
1703
1681
|
ownerAddress: dappWalletClient.account.address,
|
|
1704
1682
|
walletClient: dappWalletClient,
|
|
1705
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
1683
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkAHOFT42Hcjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
1706
1684
|
switchChain: dappSwitchChain
|
|
1707
1685
|
};
|
|
1708
1686
|
}
|
|
1709
|
-
if (_optionalChain([reownWallet, 'optionalAccess',
|
|
1687
|
+
if (_optionalChain([reownWallet, 'optionalAccess', _45 => _45.address, 'optionalAccess', _46 => _46.toLowerCase, 'call', _47 => _47()]) === selectedConnectAddress.toLowerCase() && reownWallet.walletClient && reownWallet.publicClient) {
|
|
1710
1688
|
return {
|
|
1711
1689
|
ownerAddress: reownWallet.address,
|
|
1712
1690
|
walletClient: reownWallet.walletClient,
|
|
@@ -1716,7 +1694,6 @@ function DepositFlow({
|
|
|
1716
1694
|
}
|
|
1717
1695
|
return null;
|
|
1718
1696
|
}, [
|
|
1719
|
-
flowMode,
|
|
1720
1697
|
canAutoLock,
|
|
1721
1698
|
isConnectSelectionConfirmed,
|
|
1722
1699
|
selectedConnectAddress,
|
|
@@ -1727,7 +1704,50 @@ function DepositFlow({
|
|
|
1727
1704
|
reownWallet,
|
|
1728
1705
|
targetChain
|
|
1729
1706
|
]);
|
|
1730
|
-
|
|
1707
|
+
_react.useEffect.call(void 0, () => {
|
|
1708
|
+
if (flowMode !== "wallet") {
|
|
1709
|
+
stableWalletSelectionKeyRef.current = null;
|
|
1710
|
+
stableWalletSignerRef.current = null;
|
|
1711
|
+
return;
|
|
1712
|
+
}
|
|
1713
|
+
if (walletSelectionKey !== stableWalletSelectionKeyRef.current) {
|
|
1714
|
+
stableWalletSelectionKeyRef.current = walletSelectionKey;
|
|
1715
|
+
stableWalletSignerRef.current = null;
|
|
1716
|
+
}
|
|
1717
|
+
if (walletSignerContext && walletSelectionKey) {
|
|
1718
|
+
stableWalletSelectionKeyRef.current = walletSelectionKey;
|
|
1719
|
+
stableWalletSignerRef.current = walletSignerContext;
|
|
1720
|
+
}
|
|
1721
|
+
}, [flowMode, walletSelectionKey, walletSignerContext]);
|
|
1722
|
+
const signerContext = _react.useMemo.call(void 0, () => {
|
|
1723
|
+
if (flowMode === "deposit-address") {
|
|
1724
|
+
if (!dappAddress) return null;
|
|
1725
|
+
return {
|
|
1726
|
+
ownerAddress: dappAddress,
|
|
1727
|
+
walletClient: void 0,
|
|
1728
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkAHOFT42Hcjs.getPublicClient.call(void 0, targetChain))),
|
|
1729
|
+
switchChain: void 0
|
|
1730
|
+
};
|
|
1731
|
+
}
|
|
1732
|
+
if (flowMode !== "wallet") {
|
|
1733
|
+
return null;
|
|
1734
|
+
}
|
|
1735
|
+
if (walletSignerContext) {
|
|
1736
|
+
return walletSignerContext;
|
|
1737
|
+
}
|
|
1738
|
+
if (walletSelectionKey && stableWalletSelectionKeyRef.current === walletSelectionKey) {
|
|
1739
|
+
return stableWalletSignerRef.current;
|
|
1740
|
+
}
|
|
1741
|
+
return null;
|
|
1742
|
+
}, [
|
|
1743
|
+
flowMode,
|
|
1744
|
+
dappAddress,
|
|
1745
|
+
dappPublicClient,
|
|
1746
|
+
targetChain,
|
|
1747
|
+
walletSignerContext,
|
|
1748
|
+
walletSelectionKey
|
|
1749
|
+
]);
|
|
1750
|
+
const sessionKeyAddress = _nullishCoalesce(_nullishCoalesce(dappAddress, () => ( _optionalChain([signerContext, 'optionalAccess', _48 => _48.ownerAddress]))), () => ( null));
|
|
1731
1751
|
const lastTargetRef = _react.useRef.call(void 0, null);
|
|
1732
1752
|
_react.useEffect.call(void 0, () => {
|
|
1733
1753
|
const prev = lastTargetRef.current;
|
|
@@ -1747,6 +1767,7 @@ function DepositFlow({
|
|
|
1747
1767
|
const handleBackFromSelectAsset = _react.useCallback.call(void 0, () => {
|
|
1748
1768
|
if (hasWalletOptions || reownWallet) {
|
|
1749
1769
|
hasNavigatedBackRef.current = true;
|
|
1770
|
+
setFlowMode(null);
|
|
1750
1771
|
setIsConnectSelectionConfirmed(false);
|
|
1751
1772
|
}
|
|
1752
1773
|
}, [hasWalletOptions, reownWallet]);
|
|
@@ -1771,10 +1792,10 @@ function DepositFlow({
|
|
|
1771
1792
|
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;
|
|
1772
1793
|
const currentBackHandler = step.type === "deposit-address" ? handleBackFromDepositAddress : step.type === "select-asset" && signerContext && !canAutoLock ? handleBackFromSelectAsset : step.type === "amount" ? handleBackFromAmount : step.type === "confirm" ? handleBackFromConfirm : void 0;
|
|
1773
1794
|
_react.useEffect.call(void 0, () => {
|
|
1774
|
-
_optionalChain([onStepChange, 'optionalCall',
|
|
1795
|
+
_optionalChain([onStepChange, 'optionalCall', _49 => _49(stepIndex, currentBackHandler)]);
|
|
1775
1796
|
}, [stepIndex, currentBackHandler, onStepChange]);
|
|
1776
1797
|
_react.useEffect.call(void 0, () => {
|
|
1777
|
-
_optionalChain([onTotalBalanceChange, 'optionalCall',
|
|
1798
|
+
_optionalChain([onTotalBalanceChange, 'optionalCall', _50 => _50(totalBalanceUsd)]);
|
|
1778
1799
|
}, [totalBalanceUsd, onTotalBalanceChange]);
|
|
1779
1800
|
const isDepositAddressMode = flowMode === "deposit-address";
|
|
1780
1801
|
const handleSelectProvider = _react.useCallback.call(void 0, () => {
|
|
@@ -1784,10 +1805,20 @@ function DepositFlow({
|
|
|
1784
1805
|
setFlowMode("deposit-address");
|
|
1785
1806
|
setStep({ type: "setup" });
|
|
1786
1807
|
}, []);
|
|
1787
|
-
const
|
|
1808
|
+
const handleResetFlow = _react.useCallback.call(void 0, () => {
|
|
1809
|
+
portfolioAssetsRef.current = [];
|
|
1810
|
+
stableWalletSignerRef.current = null;
|
|
1811
|
+
stableWalletSelectionKeyRef.current = null;
|
|
1812
|
+
hasNavigatedBackRef.current = false;
|
|
1813
|
+
setTotalBalanceUsd(0);
|
|
1814
|
+
setSelectedConnectAddress(null);
|
|
1815
|
+
setIsConnectSelectionConfirmed(false);
|
|
1788
1816
|
setFlowMode(null);
|
|
1789
1817
|
setStep({ type: "setup" });
|
|
1790
1818
|
}, []);
|
|
1819
|
+
const handleNewDeposit = _react.useCallback.call(void 0, () => {
|
|
1820
|
+
handleResetFlow();
|
|
1821
|
+
}, [handleResetFlow]);
|
|
1791
1822
|
const handleSetupComplete = _react.useCallback.call(void 0,
|
|
1792
1823
|
(smartAccount) => {
|
|
1793
1824
|
if (isDepositAddressMode) {
|
|
@@ -1812,13 +1843,13 @@ function DepositFlow({
|
|
|
1812
1843
|
directTransfer: isSameRoute(chainId, token, targetChain, targetToken)
|
|
1813
1844
|
};
|
|
1814
1845
|
});
|
|
1815
|
-
_optionalChain([onDepositSubmitted, 'optionalCall',
|
|
1846
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _51 => _51({ txHash, sourceChain: chainId, amount })]);
|
|
1816
1847
|
},
|
|
1817
1848
|
[onDepositSubmitted, targetChain, targetToken]
|
|
1818
1849
|
);
|
|
1819
1850
|
const handleConnected = _react.useCallback.call(void 0,
|
|
1820
1851
|
(addr, smartAccount) => {
|
|
1821
|
-
_optionalChain([onConnected, 'optionalCall',
|
|
1852
|
+
_optionalChain([onConnected, 'optionalCall', _52 => _52({ address: addr, smartAccount })]);
|
|
1822
1853
|
},
|
|
1823
1854
|
[onConnected]
|
|
1824
1855
|
);
|
|
@@ -1838,8 +1869,8 @@ function DepositFlow({
|
|
|
1838
1869
|
);
|
|
1839
1870
|
const handleAmountContinue = _react.useCallback.call(void 0,
|
|
1840
1871
|
(amount, targetAmount, balance) => {
|
|
1841
|
-
const targetSym =
|
|
1842
|
-
const isTargetStable =
|
|
1872
|
+
const targetSym = _chunkFLXTBFMZcjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
1873
|
+
const isTargetStable = _chunkFLXTBFMZcjs.isStablecoinSymbol.call(void 0, targetSym);
|
|
1843
1874
|
const targetTokenPriceUsd = isTargetStable ? 1 : getTokenPriceUsd(targetSym);
|
|
1844
1875
|
setStep((prev) => {
|
|
1845
1876
|
if (prev.type !== "amount") return prev;
|
|
@@ -1875,25 +1906,25 @@ function DepositFlow({
|
|
|
1875
1906
|
);
|
|
1876
1907
|
const handleDepositSubmittedCallback = _react.useCallback.call(void 0,
|
|
1877
1908
|
(txHash, sourceChain, amount) => {
|
|
1878
|
-
_optionalChain([onDepositSubmitted, 'optionalCall',
|
|
1909
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _53 => _53({ txHash, sourceChain, amount })]);
|
|
1879
1910
|
},
|
|
1880
1911
|
[onDepositSubmitted]
|
|
1881
1912
|
);
|
|
1882
1913
|
const handleDepositComplete = _react.useCallback.call(void 0,
|
|
1883
1914
|
(txHash, destinationTxHash) => {
|
|
1884
|
-
_optionalChain([onDepositComplete, 'optionalCall',
|
|
1915
|
+
_optionalChain([onDepositComplete, 'optionalCall', _54 => _54({ txHash, destinationTxHash })]);
|
|
1885
1916
|
},
|
|
1886
1917
|
[onDepositComplete]
|
|
1887
1918
|
);
|
|
1888
1919
|
const handleDepositFailed = _react.useCallback.call(void 0,
|
|
1889
1920
|
(txHash, error) => {
|
|
1890
|
-
_optionalChain([onDepositFailed, 'optionalCall',
|
|
1921
|
+
_optionalChain([onDepositFailed, 'optionalCall', _55 => _55({ txHash, error })]);
|
|
1891
1922
|
},
|
|
1892
1923
|
[onDepositFailed]
|
|
1893
1924
|
);
|
|
1894
1925
|
const handleError = _react.useCallback.call(void 0,
|
|
1895
1926
|
(message, code) => {
|
|
1896
|
-
_optionalChain([onError, 'optionalCall',
|
|
1927
|
+
_optionalChain([onError, 'optionalCall', _56 => _56({ message, code })]);
|
|
1897
1928
|
},
|
|
1898
1929
|
[onError]
|
|
1899
1930
|
);
|
|
@@ -1907,7 +1938,6 @@ function DepositFlow({
|
|
|
1907
1938
|
}
|
|
1908
1939
|
return null;
|
|
1909
1940
|
}, [selectedConnectAddress, walletOptions]);
|
|
1910
|
-
const hasNavigatedBackRef = _react.useRef.call(void 0, false);
|
|
1911
1941
|
_react.useEffect.call(void 0, () => {
|
|
1912
1942
|
if (!showConnectStep && isConnectSelectionConfirmed && flowMode === "wallet" && !signerContext) {
|
|
1913
1943
|
setSelectedConnectAddress(null);
|
|
@@ -1944,7 +1974,7 @@ function DepositFlow({
|
|
|
1944
1974
|
]);
|
|
1945
1975
|
if (showConnectStep) {
|
|
1946
1976
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1947
|
-
|
|
1977
|
+
_chunkAHOFT42Hcjs.ConnectStep,
|
|
1948
1978
|
{
|
|
1949
1979
|
walletOptions,
|
|
1950
1980
|
selectedAddress: selectedConnectAddressEffective,
|
|
@@ -1996,7 +2026,7 @@ function DepositFlow({
|
|
|
1996
2026
|
}
|
|
1997
2027
|
),
|
|
1998
2028
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1999
|
-
|
|
2029
|
+
_chunkAHOFT42Hcjs.ProcessingStep,
|
|
2000
2030
|
{
|
|
2001
2031
|
smartAccount: step.smartAccount,
|
|
2002
2032
|
txHash: step.txHash,
|
|
@@ -2017,16 +2047,16 @@ function DepositFlow({
|
|
|
2017
2047
|
)
|
|
2018
2048
|
] });
|
|
2019
2049
|
}
|
|
2020
|
-
if (!_optionalChain([signerContext, 'optionalAccess',
|
|
2050
|
+
if (!_optionalChain([signerContext, 'optionalAccess', _57 => _57.walletClient]) || !_optionalChain([signerContext, 'optionalAccess', _58 => _58.publicClient])) {
|
|
2021
2051
|
return null;
|
|
2022
2052
|
}
|
|
2023
2053
|
const ownerAddress = signerContext.ownerAddress;
|
|
2024
|
-
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access',
|
|
2054
|
+
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _59 => _59.walletClient, 'optionalAccess', _60 => _60.chain, 'optionalAccess', _61 => _61.id]), () => ( _optionalChain([signerContext, 'access', _62 => _62.publicClient, 'access', _63 => _63.chain, 'optionalAccess', _64 => _64.id]))), () => ( targetChain));
|
|
2025
2055
|
const getReadClientForChain = (chainId) => {
|
|
2026
|
-
if (_optionalChain([signerContext, 'access',
|
|
2056
|
+
if (_optionalChain([signerContext, 'access', _65 => _65.publicClient, 'access', _66 => _66.chain, 'optionalAccess', _67 => _67.id]) === chainId) {
|
|
2027
2057
|
return signerContext.publicClient;
|
|
2028
2058
|
}
|
|
2029
|
-
return
|
|
2059
|
+
return _chunkAHOFT42Hcjs.getPublicClient.call(void 0, chainId);
|
|
2030
2060
|
};
|
|
2031
2061
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
2032
2062
|
step.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2095,7 +2125,7 @@ function DepositFlow({
|
|
|
2095
2125
|
}
|
|
2096
2126
|
),
|
|
2097
2127
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2098
|
-
|
|
2128
|
+
_chunkAHOFT42Hcjs.ProcessingStep,
|
|
2099
2129
|
{
|
|
2100
2130
|
smartAccount: step.smartAccount,
|
|
2101
2131
|
txHash: step.txHash,
|
|
@@ -2119,7 +2149,7 @@ function DepositFlow({
|
|
|
2119
2149
|
// src/DepositModal.tsx
|
|
2120
2150
|
|
|
2121
2151
|
var ReownDepositInner = _react.lazy.call(void 0,
|
|
2122
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-
|
|
2152
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-ZZKRN6J3.cjs"))).then((m) => ({ default: m.DepositModalReown }))
|
|
2123
2153
|
);
|
|
2124
2154
|
function DepositModal(props) {
|
|
2125
2155
|
const needsReown = !!props.reownAppId;
|
|
@@ -2142,8 +2172,8 @@ function DepositModalInner({
|
|
|
2142
2172
|
sourceToken,
|
|
2143
2173
|
defaultAmount,
|
|
2144
2174
|
recipient,
|
|
2145
|
-
backendUrl =
|
|
2146
|
-
signerAddress =
|
|
2175
|
+
backendUrl = _chunkFLXTBFMZcjs.DEFAULT_BACKEND_URL,
|
|
2176
|
+
signerAddress = _chunkFLXTBFMZcjs.DEFAULT_SIGNER_ADDRESS,
|
|
2147
2177
|
sessionChainIds,
|
|
2148
2178
|
forceRegister = false,
|
|
2149
2179
|
waitForFinalTx = true,
|
|
@@ -2168,24 +2198,27 @@ function DepositModalInner({
|
|
|
2168
2198
|
const [currentStepIndex, setCurrentStepIndex] = _react.useState.call(void 0, 0);
|
|
2169
2199
|
const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, null);
|
|
2170
2200
|
const backHandlerRef = _react.useRef.call(void 0, void 0);
|
|
2171
|
-
const targetChain =
|
|
2172
|
-
const sourceChain = sourceChainProp ?
|
|
2173
|
-
const service = _react.useMemo.call(void 0, () =>
|
|
2201
|
+
const targetChain = _chunkFLXTBFMZcjs.getChainId.call(void 0, targetChainProp);
|
|
2202
|
+
const sourceChain = sourceChainProp ? _chunkFLXTBFMZcjs.getChainId.call(void 0, sourceChainProp) : void 0;
|
|
2203
|
+
const service = _react.useMemo.call(void 0, () => _chunkAHOFT42Hcjs.createDepositService.call(void 0, backendUrl), [backendUrl]);
|
|
2174
2204
|
_react.useEffect.call(void 0, () => {
|
|
2175
2205
|
if (isOpen && modalRef.current) {
|
|
2176
|
-
|
|
2206
|
+
_chunkAHOFT42Hcjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
2177
2207
|
}
|
|
2178
2208
|
}, [isOpen, theme]);
|
|
2179
2209
|
const hasCalledReady = _react.useRef.call(void 0, false);
|
|
2180
2210
|
_react.useEffect.call(void 0, () => {
|
|
2181
2211
|
if (isOpen && !hasCalledReady.current) {
|
|
2182
2212
|
hasCalledReady.current = true;
|
|
2183
|
-
_optionalChain([onReady, 'optionalCall',
|
|
2213
|
+
_optionalChain([onReady, 'optionalCall', _68 => _68()]);
|
|
2184
2214
|
}
|
|
2185
2215
|
}, [isOpen, onReady]);
|
|
2186
2216
|
_react.useEffect.call(void 0, () => {
|
|
2187
2217
|
if (!isOpen) {
|
|
2188
2218
|
setCurrentStepIndex(0);
|
|
2219
|
+
setTotalBalanceUsd(null);
|
|
2220
|
+
backHandlerRef.current = void 0;
|
|
2221
|
+
hasCalledReady.current = false;
|
|
2189
2222
|
}
|
|
2190
2223
|
}, [isOpen]);
|
|
2191
2224
|
const handleStepChange = _react.useCallback.call(void 0,
|
|
@@ -2199,17 +2232,17 @@ function DepositModalInner({
|
|
|
2199
2232
|
setTotalBalanceUsd(balance2);
|
|
2200
2233
|
}, []);
|
|
2201
2234
|
const handleBack = _react.useCallback.call(void 0, () => {
|
|
2202
|
-
_optionalChain([backHandlerRef, 'access',
|
|
2235
|
+
_optionalChain([backHandlerRef, 'access', _69 => _69.current, 'optionalCall', _70 => _70()]);
|
|
2203
2236
|
}, []);
|
|
2204
|
-
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2205
|
-
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2206
|
-
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
2207
|
-
const balance = _optionalChain([uiConfig, 'optionalAccess',
|
|
2208
|
-
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess',
|
|
2209
|
-
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess',
|
|
2237
|
+
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _71 => _71.showLogo]), () => ( false));
|
|
2238
|
+
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _72 => _72.showStepper]), () => ( false));
|
|
2239
|
+
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _73 => _73.showBackButton]), () => ( true));
|
|
2240
|
+
const balance = _optionalChain([uiConfig, 'optionalAccess', _74 => _74.balance]);
|
|
2241
|
+
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _75 => _75.logoUrl]), () => ( "https://github.com/rhinestonewtf.png"));
|
|
2242
|
+
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _76 => _76.title]), () => ( "Deposit"));
|
|
2210
2243
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 4 && backHandlerRef.current !== void 0;
|
|
2211
2244
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2212
|
-
|
|
2245
|
+
_chunkAHOFT42Hcjs.Modal,
|
|
2213
2246
|
{
|
|
2214
2247
|
isOpen,
|
|
2215
2248
|
onClose,
|
|
@@ -2270,7 +2303,7 @@ function DepositModalInner({
|
|
|
2270
2303
|
balance.title,
|
|
2271
2304
|
":"
|
|
2272
2305
|
] }),
|
|
2273
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ?
|
|
2306
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ? _chunkAHOFT42Hcjs.currencyFormatter.format(totalBalanceUsd) : null))) })
|
|
2274
2307
|
] })
|
|
2275
2308
|
] }),
|
|
2276
2309
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|