@rhinestone/deposit-modal 0.1.47 → 0.1.49
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-IUZNTZ3Y.cjs → DepositModalReown-AVQEEWEQ.cjs} +3 -3
- package/dist/{DepositModalReown-DKLN3IE3.mjs → DepositModalReown-PWD3WK7I.mjs} +2 -2
- package/dist/{WithdrawModalReown-XOFREB4D.mjs → WithdrawModalReown-FODH7PY5.mjs} +2 -2
- package/dist/{WithdrawModalReown-FGUHFUVN.cjs → WithdrawModalReown-ZSR3RP44.cjs} +3 -3
- package/dist/{chunk-LT3QKJI2.cjs → chunk-7HJ7IBRH.cjs} +43 -27
- package/dist/{chunk-QIK6ONMQ.mjs → chunk-FKNYONM2.mjs} +43 -27
- package/dist/{chunk-O3VFAUSL.mjs → chunk-HCZNF6CR.mjs} +2 -2
- package/dist/{chunk-LOOU3NCI.cjs → chunk-KOYHFHYW.cjs} +298 -214
- package/dist/{chunk-MS2J6M5C.cjs → chunk-PW55TOFK.cjs} +33 -33
- package/dist/{chunk-7U5TNZZB.mjs → chunk-QLLL6ARN.mjs} +164 -80
- package/dist/deposit.cjs +3 -3
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +3 -3
- package/dist/reown.cjs +4 -4
- package/dist/reown.d.cts +1 -1
- package/dist/reown.d.ts +1 -1
- package/dist/reown.mjs +3 -3
- package/dist/{types-DQG7NEBI.d.ts → types-B0FLVdXb.d.ts} +6 -1
- package/dist/{types-CyUiKQ4H.d.cts → types-dY70pF2y.d.cts} +6 -1
- package/dist/withdraw.cjs +3 -3
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +2 -2
- package/dist/withdraw.mjs +2 -2
- package/package.json +1 -1
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
var
|
|
28
|
+
var _chunk7HJ7IBRHcjs = require('./chunk-7HJ7IBRH.cjs');
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
@@ -56,21 +56,20 @@ var _react = require('react');
|
|
|
56
56
|
|
|
57
57
|
// src/DepositFlow.tsx
|
|
58
58
|
|
|
59
|
-
var _viem = require('viem');
|
|
60
59
|
|
|
61
60
|
// src/components/steps/SetupStep.tsx
|
|
62
61
|
|
|
63
62
|
var _jsxruntime = require('react/jsx-runtime');
|
|
64
63
|
async function resolveSessionOwner(eoaAddress) {
|
|
65
|
-
const localOwner =
|
|
64
|
+
const localOwner = _chunk7HJ7IBRHcjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
|
|
66
65
|
if (localOwner) {
|
|
67
66
|
return {
|
|
68
|
-
account:
|
|
67
|
+
account: _chunk7HJ7IBRHcjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
|
|
69
68
|
address: localOwner.address
|
|
70
69
|
};
|
|
71
70
|
}
|
|
72
|
-
const created =
|
|
73
|
-
|
|
71
|
+
const created = _chunk7HJ7IBRHcjs.createSessionOwnerKey.call(void 0, );
|
|
72
|
+
_chunk7HJ7IBRHcjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
|
|
74
73
|
return {
|
|
75
74
|
account: created.account,
|
|
76
75
|
address: created.address
|
|
@@ -105,7 +104,7 @@ function SetupStep({
|
|
|
105
104
|
const setup = await service.setupAccount({
|
|
106
105
|
ownerAddress: address,
|
|
107
106
|
sessionOwnerAddress: sessionOwner.address,
|
|
108
|
-
targetChain:
|
|
107
|
+
targetChain: _chunk7HJ7IBRHcjs.toEvmCaip2.call(void 0, targetChain),
|
|
109
108
|
targetToken,
|
|
110
109
|
signerAddress,
|
|
111
110
|
sessionChainIds,
|
|
@@ -132,7 +131,7 @@ function SetupStep({
|
|
|
132
131
|
primaryType: typedData.primaryType,
|
|
133
132
|
message: typedData.message
|
|
134
133
|
});
|
|
135
|
-
const sessionDetails =
|
|
134
|
+
const sessionDetails = _chunk7HJ7IBRHcjs.buildSessionDetails.call(void 0, setup.sessionDetailsUnsigned, signature);
|
|
136
135
|
setState({ type: "registering" });
|
|
137
136
|
const registerResult = await service.registerAccount({
|
|
138
137
|
address: smartAccount,
|
|
@@ -144,7 +143,7 @@ function SetupStep({
|
|
|
144
143
|
eoaAddress: address,
|
|
145
144
|
sessionOwner: sessionOwner.address,
|
|
146
145
|
target: {
|
|
147
|
-
chain:
|
|
146
|
+
chain: _chunk7HJ7IBRHcjs.toEvmCaip2.call(void 0, targetChain),
|
|
148
147
|
token: targetToken,
|
|
149
148
|
...recipient && { recipient }
|
|
150
149
|
}
|
|
@@ -203,7 +202,7 @@ function SetupStep({
|
|
|
203
202
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
204
203
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", children: [
|
|
205
204
|
isLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
206
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
205
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HJ7IBRHcjs.Spinner, { className: "rs-spinner--lg rs-text-accent" }),
|
|
207
206
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-text", children: [
|
|
208
207
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: renderStateMessage() }),
|
|
209
208
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-subtitle", children: "This may take a moment" })
|
|
@@ -240,19 +239,20 @@ function SetupStep({
|
|
|
240
239
|
] })
|
|
241
240
|
] })
|
|
242
241
|
] }),
|
|
243
|
-
isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
242
|
+
isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HJ7IBRHcjs.Button, { onClick: handleRetry, variant: "default", fullWidth: true, children: "Try Again" }) })
|
|
244
243
|
] });
|
|
245
244
|
}
|
|
246
245
|
|
|
247
246
|
// src/components/steps/AssetSelectStep.tsx
|
|
248
247
|
|
|
249
|
-
|
|
248
|
+
var _viem = require('viem');
|
|
250
249
|
|
|
251
250
|
function AssetSelectStep({
|
|
252
251
|
address,
|
|
253
252
|
publicClient,
|
|
254
253
|
defaultSourceChain,
|
|
255
254
|
defaultSourceToken,
|
|
255
|
+
allowedRoutes,
|
|
256
256
|
service,
|
|
257
257
|
onContinue,
|
|
258
258
|
onTotalBalanceComputed,
|
|
@@ -264,7 +264,7 @@ function AssetSelectStep({
|
|
|
264
264
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
265
265
|
const defaultAssetId = _react.useMemo.call(void 0, () => {
|
|
266
266
|
if (!defaultSourceChain || !defaultSourceToken) return null;
|
|
267
|
-
return
|
|
267
|
+
return _chunk7HJ7IBRHcjs.getAssetId.call(void 0, {
|
|
268
268
|
chainId: defaultSourceChain,
|
|
269
269
|
token: defaultSourceToken
|
|
270
270
|
});
|
|
@@ -281,7 +281,7 @@ function AssetSelectStep({
|
|
|
281
281
|
try {
|
|
282
282
|
const portfolio = await service.fetchPortfolio(address);
|
|
283
283
|
if (!active) return;
|
|
284
|
-
const portfolioAssets =
|
|
284
|
+
const portfolioAssets = _chunk7HJ7IBRHcjs.portfolioToAssets.call(void 0, portfolio.tokens);
|
|
285
285
|
setAssets(portfolioAssets);
|
|
286
286
|
const hasNative = portfolioAssets.some(
|
|
287
287
|
(asset) => asset.token.toLowerCase() === _chunkNELAYNA3cjs.NATIVE_TOKEN_ADDRESS
|
|
@@ -325,13 +325,25 @@ function AssetSelectStep({
|
|
|
325
325
|
_optionalChain([onTotalBalanceComputed, 'optionalCall', _4 => _4(total)]);
|
|
326
326
|
if (assets.length > 0) _optionalChain([onAssetsLoaded, 'optionalCall', _5 => _5(assets)]);
|
|
327
327
|
}, [assets, onTotalBalanceComputed, onAssetsLoaded]);
|
|
328
|
+
const allowedChainSet = _react.useMemo.call(void 0,
|
|
329
|
+
() => _optionalChain([allowedRoutes, 'optionalAccess', _6 => _6.sourceChains]) ? new Set(allowedRoutes.sourceChains) : null,
|
|
330
|
+
[_optionalChain([allowedRoutes, 'optionalAccess', _7 => _7.sourceChains])]
|
|
331
|
+
);
|
|
332
|
+
const allowedTokenSet = _react.useMemo.call(void 0,
|
|
333
|
+
() => _optionalChain([allowedRoutes, 'optionalAccess', _8 => _8.sourceTokens]) ? new Set(allowedRoutes.sourceTokens.map((s) => s.toUpperCase())) : null,
|
|
334
|
+
[_optionalChain([allowedRoutes, 'optionalAccess', _9 => _9.sourceTokens])]
|
|
335
|
+
);
|
|
328
336
|
const rows = _react.useMemo.call(void 0, () => {
|
|
329
337
|
return assets.filter((a) => {
|
|
330
338
|
try {
|
|
331
|
-
|
|
339
|
+
if (BigInt(_nullishCoalesce(a.balance, () => ( "0"))) <= BigInt(0)) return false;
|
|
332
340
|
} catch (e2) {
|
|
333
341
|
return false;
|
|
334
342
|
}
|
|
343
|
+
if (allowedChainSet && !allowedChainSet.has(a.chainId)) return false;
|
|
344
|
+
if (allowedTokenSet && !allowedTokenSet.has(a.symbol.toUpperCase()))
|
|
345
|
+
return false;
|
|
346
|
+
return true;
|
|
335
347
|
}).sort((a, b) => {
|
|
336
348
|
const usdA = _nullishCoalesce(a.balanceUsd, () => ( 0));
|
|
337
349
|
const usdB = _nullishCoalesce(b.balanceUsd, () => ( 0));
|
|
@@ -342,7 +354,7 @@ function AssetSelectStep({
|
|
|
342
354
|
if (balB < balA) return -1;
|
|
343
355
|
return 0;
|
|
344
356
|
});
|
|
345
|
-
}, [assets]);
|
|
357
|
+
}, [assets, allowedChainSet, allowedTokenSet]);
|
|
346
358
|
const selectedAsset = selectedAssetId && assets.find((asset) => asset.id === selectedAssetId);
|
|
347
359
|
const formatBalance = (asset) => {
|
|
348
360
|
if (!asset.balance) return "--";
|
|
@@ -350,7 +362,7 @@ function AssetSelectStep({
|
|
|
350
362
|
const raw = _viem.formatUnits.call(void 0, BigInt(asset.balance), asset.decimals);
|
|
351
363
|
const numeric = Number(raw);
|
|
352
364
|
if (!Number.isFinite(numeric)) return raw;
|
|
353
|
-
return
|
|
365
|
+
return _chunk7HJ7IBRHcjs.tokenFormatter.format(numeric);
|
|
354
366
|
} catch (e3) {
|
|
355
367
|
return asset.balance;
|
|
356
368
|
}
|
|
@@ -364,7 +376,7 @@ function AssetSelectStep({
|
|
|
364
376
|
style: { paddingTop: 4, overflow: "auto", maxHeight: 340 },
|
|
365
377
|
children: [
|
|
366
378
|
loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
367
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
379
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HJ7IBRHcjs.Spinner, { className: "rs-text-tertiary" }),
|
|
368
380
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
369
381
|
] }),
|
|
370
382
|
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 }) }),
|
|
@@ -454,7 +466,7 @@ function AssetSelectStep({
|
|
|
454
466
|
] })
|
|
455
467
|
] })
|
|
456
468
|
] }),
|
|
457
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ?
|
|
469
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ? _chunk7HJ7IBRHcjs.currencyFormatter.format(asset.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${asset.symbol}` : "--" })
|
|
458
470
|
]
|
|
459
471
|
},
|
|
460
472
|
asset.id
|
|
@@ -464,7 +476,7 @@ function AssetSelectStep({
|
|
|
464
476
|
}
|
|
465
477
|
),
|
|
466
478
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
467
|
-
|
|
479
|
+
_chunk7HJ7IBRHcjs.Button,
|
|
468
480
|
{
|
|
469
481
|
onClick: () => selectedAsset && onContinue(selectedAsset),
|
|
470
482
|
disabled: !selectedAsset,
|
|
@@ -472,15 +484,15 @@ function AssetSelectStep({
|
|
|
472
484
|
children: "Continue"
|
|
473
485
|
}
|
|
474
486
|
) }),
|
|
475
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
487
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HJ7IBRHcjs.PoweredBy, {})
|
|
476
488
|
] });
|
|
477
489
|
}
|
|
478
490
|
async function fetchNativeAssets(address, publicClient, existing) {
|
|
479
491
|
const existingIds = new Set(existing.map((asset) => asset.id));
|
|
480
|
-
const connectedChainId = _optionalChain([publicClient, 'access',
|
|
492
|
+
const connectedChainId = _optionalChain([publicClient, 'access', _10 => _10.chain, 'optionalAccess', _11 => _11.id]);
|
|
481
493
|
if (!connectedChainId) return [];
|
|
482
494
|
if (!_chunkNELAYNA3cjs.SOURCE_CHAINS.some((chain) => chain.id === connectedChainId)) return [];
|
|
483
|
-
const id =
|
|
495
|
+
const id = _chunk7HJ7IBRHcjs.getAssetId.call(void 0, {
|
|
484
496
|
chainId: connectedChainId,
|
|
485
497
|
token: _chunkNELAYNA3cjs.NATIVE_TOKEN_ADDRESS
|
|
486
498
|
});
|
|
@@ -539,7 +551,7 @@ function AmountStep({
|
|
|
539
551
|
const [isSwitching, setIsSwitching] = _react.useState.call(void 0, false);
|
|
540
552
|
const hasAttemptedSwitch = _react.useRef.call(void 0, false);
|
|
541
553
|
const chainMismatch = Boolean(
|
|
542
|
-
_optionalChain([walletClient, 'optionalAccess',
|
|
554
|
+
_optionalChain([walletClient, 'optionalAccess', _12 => _12.chain, 'optionalAccess', _13 => _13.id]) && walletClient.chain.id !== asset.chainId
|
|
543
555
|
);
|
|
544
556
|
const targetSymbol = _chunkNELAYNA3cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
545
557
|
const isSourceStablecoin = _chunkNELAYNA3cjs.isStablecoinSymbol.call(void 0, asset.symbol);
|
|
@@ -566,7 +578,7 @@ function AmountStep({
|
|
|
566
578
|
const balanceTarget = _nullishCoalesce(balanceAddress, () => ( address));
|
|
567
579
|
if (!balanceTarget || !publicClient) return;
|
|
568
580
|
try {
|
|
569
|
-
const bal =
|
|
581
|
+
const bal = _chunk7HJ7IBRHcjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: balanceTarget }) : await publicClient.readContract({
|
|
570
582
|
address: asset.token,
|
|
571
583
|
abi: _viem.erc20Abi,
|
|
572
584
|
functionName: "balanceOf",
|
|
@@ -592,7 +604,7 @@ function AmountStep({
|
|
|
592
604
|
setIsSwitching(true);
|
|
593
605
|
switchChain(asset.chainId).catch((err) => {
|
|
594
606
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
595
|
-
setError(
|
|
607
|
+
setError(_chunk7HJ7IBRHcjs.formatUserError.call(void 0, raw));
|
|
596
608
|
}).finally(() => {
|
|
597
609
|
setIsSwitching(false);
|
|
598
610
|
});
|
|
@@ -620,7 +632,7 @@ function AmountStep({
|
|
|
620
632
|
}
|
|
621
633
|
}, [balance, tokenPriceUsd, asset.decimals]);
|
|
622
634
|
_react.useEffect.call(void 0, () => {
|
|
623
|
-
_optionalChain([onBalanceUsdChange, 'optionalCall',
|
|
635
|
+
_optionalChain([onBalanceUsdChange, 'optionalCall', _14 => _14(_nullishCoalesce(balanceUsd, () => ( 0)))]);
|
|
624
636
|
}, [balanceUsd, onBalanceUsdChange]);
|
|
625
637
|
const formattedBalance = _react.useMemo.call(void 0, () => {
|
|
626
638
|
if (balance === null) return "...";
|
|
@@ -628,7 +640,7 @@ function AmountStep({
|
|
|
628
640
|
const raw = _viem.formatUnits.call(void 0, balance, asset.decimals);
|
|
629
641
|
const numeric = Number(raw);
|
|
630
642
|
if (!Number.isFinite(numeric)) return raw;
|
|
631
|
-
return
|
|
643
|
+
return _chunk7HJ7IBRHcjs.tokenFormatter.format(numeric);
|
|
632
644
|
} catch (e8) {
|
|
633
645
|
return "...";
|
|
634
646
|
}
|
|
@@ -668,15 +680,15 @@ function AmountStep({
|
|
|
668
680
|
}
|
|
669
681
|
if (hasPricing) {
|
|
670
682
|
const usdValue = numericAmount;
|
|
671
|
-
if (_optionalChain([uiConfig, 'optionalAccess',
|
|
683
|
+
if (_optionalChain([uiConfig, 'optionalAccess', _15 => _15.maxDepositUsd]) && usdValue > uiConfig.maxDepositUsd) {
|
|
672
684
|
setError(
|
|
673
|
-
`Maximum deposit is ${
|
|
685
|
+
`Maximum deposit is ${_chunk7HJ7IBRHcjs.currencyFormatter.format(uiConfig.maxDepositUsd)}`
|
|
674
686
|
);
|
|
675
687
|
return;
|
|
676
688
|
}
|
|
677
|
-
if (_optionalChain([uiConfig, 'optionalAccess',
|
|
689
|
+
if (_optionalChain([uiConfig, 'optionalAccess', _16 => _16.minDepositUsd]) && usdValue < uiConfig.minDepositUsd) {
|
|
678
690
|
setError(
|
|
679
|
-
`Minimum deposit is ${
|
|
691
|
+
`Minimum deposit is ${_chunk7HJ7IBRHcjs.currencyFormatter.format(uiConfig.minDepositUsd)}`
|
|
680
692
|
);
|
|
681
693
|
return;
|
|
682
694
|
}
|
|
@@ -725,7 +737,7 @@ function AmountStep({
|
|
|
725
737
|
hasPricing && balanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { style: { color: "var(--rs-muted-foreground)" }, children: [
|
|
726
738
|
" ",
|
|
727
739
|
"(",
|
|
728
|
-
|
|
740
|
+
_chunk7HJ7IBRHcjs.currencyFormatter.format(balanceUsd),
|
|
729
741
|
")"
|
|
730
742
|
] })
|
|
731
743
|
] }) })
|
|
@@ -884,7 +896,7 @@ function AmountStep({
|
|
|
884
896
|
] })
|
|
885
897
|
] }),
|
|
886
898
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
887
|
-
|
|
899
|
+
_chunk7HJ7IBRHcjs.Button,
|
|
888
900
|
{
|
|
889
901
|
onClick: handleContinue,
|
|
890
902
|
fullWidth: true,
|
|
@@ -892,7 +904,7 @@ function AmountStep({
|
|
|
892
904
|
children: "Continue"
|
|
893
905
|
}
|
|
894
906
|
) }),
|
|
895
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
907
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HJ7IBRHcjs.PoweredBy, {})
|
|
896
908
|
] });
|
|
897
909
|
}
|
|
898
910
|
|
|
@@ -921,7 +933,7 @@ function ConfirmStep({
|
|
|
921
933
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
922
934
|
const [isSwitching, setIsSwitching] = _react.useState.call(void 0, false);
|
|
923
935
|
const hasAttemptedSwitch = _react.useRef.call(void 0, false);
|
|
924
|
-
const chainMismatch = _optionalChain([walletClient, 'optionalAccess',
|
|
936
|
+
const chainMismatch = _optionalChain([walletClient, 'optionalAccess', _17 => _17.chain, 'optionalAccess', _18 => _18.id]) && walletClient.chain.id !== asset.chainId;
|
|
925
937
|
const sameRoute = targetChain === asset.chainId && targetToken.toLowerCase() === asset.token.toLowerCase();
|
|
926
938
|
const targetSymbol = sameRoute ? asset.symbol : _chunkNELAYNA3cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
927
939
|
const formattedSendAmount = amount && !Number.isNaN(Number(amount)) ? Number(amount).toLocaleString("en-US", { maximumFractionDigits: 6 }) : "0";
|
|
@@ -942,7 +954,7 @@ function ConfirmStep({
|
|
|
942
954
|
setIsSwitching(true);
|
|
943
955
|
switchChain(asset.chainId).catch((err) => {
|
|
944
956
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
945
|
-
setError(
|
|
957
|
+
setError(_chunk7HJ7IBRHcjs.formatUserError.call(void 0, raw));
|
|
946
958
|
}).finally(() => {
|
|
947
959
|
setIsSwitching(false);
|
|
948
960
|
});
|
|
@@ -985,7 +997,7 @@ function ConfirmStep({
|
|
|
985
997
|
throw new Error("Wallet not properly connected");
|
|
986
998
|
}
|
|
987
999
|
const transferTo = sameRoute ? recipient : smartAccount;
|
|
988
|
-
const hash =
|
|
1000
|
+
const hash = _chunk7HJ7IBRHcjs.isNativeAsset.call(void 0, asset) ? await walletClient.sendTransaction({
|
|
989
1001
|
account,
|
|
990
1002
|
chain,
|
|
991
1003
|
to: transferTo,
|
|
@@ -998,13 +1010,13 @@ function ConfirmStep({
|
|
|
998
1010
|
functionName: "transfer",
|
|
999
1011
|
args: [transferTo, amountUnits]
|
|
1000
1012
|
});
|
|
1001
|
-
_optionalChain([onDepositSubmitted, 'optionalCall',
|
|
1013
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _19 => _19(hash, asset.chainId, amountUnits.toString())]);
|
|
1002
1014
|
onConfirm(hash, asset.chainId, amountUnits.toString(), asset.token);
|
|
1003
1015
|
} catch (err) {
|
|
1004
1016
|
const raw = err instanceof Error ? err.message : "Transfer failed";
|
|
1005
|
-
const message =
|
|
1017
|
+
const message = _chunk7HJ7IBRHcjs.formatUserError.call(void 0, raw);
|
|
1006
1018
|
setError(message);
|
|
1007
|
-
_optionalChain([onError, 'optionalCall',
|
|
1019
|
+
_optionalChain([onError, 'optionalCall', _20 => _20(message, "TRANSFER_ERROR")]);
|
|
1008
1020
|
} finally {
|
|
1009
1021
|
setIsSubmitting(false);
|
|
1010
1022
|
}
|
|
@@ -1131,7 +1143,7 @@ function ConfirmStep({
|
|
|
1131
1143
|
] })
|
|
1132
1144
|
] }),
|
|
1133
1145
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1134
|
-
|
|
1146
|
+
_chunk7HJ7IBRHcjs.Button,
|
|
1135
1147
|
{
|
|
1136
1148
|
onClick: handleConfirm,
|
|
1137
1149
|
loading: isSubmitting,
|
|
@@ -1140,7 +1152,7 @@ function ConfirmStep({
|
|
|
1140
1152
|
children: "Confirm Order"
|
|
1141
1153
|
}
|
|
1142
1154
|
) }),
|
|
1143
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1155
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HJ7IBRHcjs.PoweredBy, {})
|
|
1144
1156
|
] });
|
|
1145
1157
|
}
|
|
1146
1158
|
|
|
@@ -1265,7 +1277,7 @@ var DEFAULT_SOLANA_RPC_URL = "https://api.mainnet.solana.com";
|
|
|
1265
1277
|
var configuredSolanaRpcUrl = null;
|
|
1266
1278
|
var cachedConnections = /* @__PURE__ */ new Map();
|
|
1267
1279
|
function configureSolanaRpcUrl(rpcUrl) {
|
|
1268
|
-
const normalized = _optionalChain([rpcUrl, 'optionalAccess',
|
|
1280
|
+
const normalized = _optionalChain([rpcUrl, 'optionalAccess', _21 => _21.trim, 'call', _22 => _22()]);
|
|
1269
1281
|
configuredSolanaRpcUrl = normalized ? normalized : null;
|
|
1270
1282
|
cachedConnections.clear();
|
|
1271
1283
|
}
|
|
@@ -1400,7 +1412,7 @@ function resolveSolanaTokenMeta(token) {
|
|
|
1400
1412
|
return {};
|
|
1401
1413
|
}
|
|
1402
1414
|
function getDepositEventDetails(event) {
|
|
1403
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
1415
|
+
if (!_optionalChain([event, 'optionalAccess', _23 => _23.type]) || !isRecord(event.data)) return {};
|
|
1404
1416
|
if (event.type === "deposit-received") {
|
|
1405
1417
|
const chainId = asChainId(event.data.chain);
|
|
1406
1418
|
const token = asString(event.data.token);
|
|
@@ -1414,12 +1426,12 @@ function getDepositEventDetails(event) {
|
|
|
1414
1426
|
}
|
|
1415
1427
|
if (event.type === "bridge-started") {
|
|
1416
1428
|
const source = isRecord(event.data.source) ? event.data.source : void 0;
|
|
1417
|
-
const chainId = asChainId(_optionalChain([source, 'optionalAccess',
|
|
1418
|
-
const token = asString(_optionalChain([source, 'optionalAccess',
|
|
1429
|
+
const chainId = asChainId(_optionalChain([source, 'optionalAccess', _24 => _24.chain]));
|
|
1430
|
+
const token = asString(_optionalChain([source, 'optionalAccess', _25 => _25.asset]));
|
|
1419
1431
|
const solanaMeta = chainId === "solana" ? resolveSolanaTokenMeta(token) : {};
|
|
1420
1432
|
return {
|
|
1421
1433
|
chainId,
|
|
1422
|
-
amount: asAmount(_optionalChain([source, 'optionalAccess',
|
|
1434
|
+
amount: asAmount(_optionalChain([source, 'optionalAccess', _26 => _26.amount])),
|
|
1423
1435
|
token,
|
|
1424
1436
|
...solanaMeta
|
|
1425
1437
|
};
|
|
@@ -1472,9 +1484,9 @@ function DepositAddressStep({
|
|
|
1472
1484
|
const matched = _nullishCoalesce(SOLANA_TOKENS.find((t) => t.symbol === sourceTokenSymbol), () => ( SOLANA_TOKENS[0]));
|
|
1473
1485
|
sourceSelectionRef.current = {
|
|
1474
1486
|
chainId: "solana",
|
|
1475
|
-
token: _optionalChain([matched, 'optionalAccess',
|
|
1476
|
-
sourceSymbol: _optionalChain([matched, 'optionalAccess',
|
|
1477
|
-
sourceDecimals: _optionalChain([matched, 'optionalAccess',
|
|
1487
|
+
token: _optionalChain([matched, 'optionalAccess', _27 => _27.mint]),
|
|
1488
|
+
sourceSymbol: _optionalChain([matched, 'optionalAccess', _28 => _28.symbol]),
|
|
1489
|
+
sourceDecimals: _optionalChain([matched, 'optionalAccess', _29 => _29.decimals])
|
|
1478
1490
|
};
|
|
1479
1491
|
return;
|
|
1480
1492
|
}
|
|
@@ -1490,8 +1502,8 @@ function DepositAddressStep({
|
|
|
1490
1502
|
function handlePointerDown(event) {
|
|
1491
1503
|
const target = event.target;
|
|
1492
1504
|
if (!target) return;
|
|
1493
|
-
const clickedChainDropdown = _optionalChain([chainDropdownRef, 'access',
|
|
1494
|
-
const clickedTokenDropdown = _optionalChain([tokenDropdownRef, 'access',
|
|
1505
|
+
const clickedChainDropdown = _optionalChain([chainDropdownRef, 'access', _30 => _30.current, 'optionalAccess', _31 => _31.contains, 'call', _32 => _32(target)]);
|
|
1506
|
+
const clickedTokenDropdown = _optionalChain([tokenDropdownRef, 'access', _33 => _33.current, 'optionalAccess', _34 => _34.contains, 'call', _35 => _35(target)]);
|
|
1495
1507
|
if (clickedChainDropdown || clickedTokenDropdown) return;
|
|
1496
1508
|
setChainDropdownOpen(false);
|
|
1497
1509
|
setTokenDropdownOpen(false);
|
|
@@ -1538,10 +1550,10 @@ function DepositAddressStep({
|
|
|
1538
1550
|
const status = await service.fetchLatestStatus(smartAccount);
|
|
1539
1551
|
if (cancelled || depositHandledRef.current) return;
|
|
1540
1552
|
const event = status.lastEvent;
|
|
1541
|
-
const eventTxHash =
|
|
1553
|
+
const eventTxHash = _chunk7HJ7IBRHcjs.isDepositEvent.call(void 0, event) ? _nullishCoalesce(_chunk7HJ7IBRHcjs.getEventTxHash.call(void 0, event), () => ( null)) : null;
|
|
1542
1554
|
if (baselineTxHash === void 0) {
|
|
1543
1555
|
baselineTxHash = eventTxHash;
|
|
1544
|
-
} else if (eventTxHash && (!baselineTxHash || !
|
|
1556
|
+
} else if (eventTxHash && (!baselineTxHash || !_chunk7HJ7IBRHcjs.txRefsMatch.call(void 0, eventTxHash, baselineTxHash))) {
|
|
1545
1557
|
const details = getDepositEventDetails(event);
|
|
1546
1558
|
const fallback = sourceSelectionRef.current;
|
|
1547
1559
|
const chainId = _nullishCoalesce(details.chainId, () => ( fallback.chainId));
|
|
@@ -1567,7 +1579,7 @@ function DepositAddressStep({
|
|
|
1567
1579
|
if (!cancelled) {
|
|
1568
1580
|
const msg = err instanceof Error ? err.message : "Failed to check status";
|
|
1569
1581
|
setPollingError(msg);
|
|
1570
|
-
_optionalChain([onError, 'optionalCall',
|
|
1582
|
+
_optionalChain([onError, 'optionalCall', _36 => _36(msg, "STATUS_POLL_ERROR")]);
|
|
1571
1583
|
}
|
|
1572
1584
|
}
|
|
1573
1585
|
if (!cancelled && !depositHandledRef.current) {
|
|
@@ -1764,7 +1776,7 @@ function DepositAddressStep({
|
|
|
1764
1776
|
] }),
|
|
1765
1777
|
pollingError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-address-error", children: pollingError })
|
|
1766
1778
|
] }) }),
|
|
1767
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1779
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HJ7IBRHcjs.PoweredBy, {})
|
|
1768
1780
|
] });
|
|
1769
1781
|
}
|
|
1770
1782
|
DepositAddressStep.displayName = "DepositAddressStep";
|
|
@@ -1795,7 +1807,7 @@ function SolanaTokenSelectStep({
|
|
|
1795
1807
|
setError(null);
|
|
1796
1808
|
const portfolioBySymbol = {};
|
|
1797
1809
|
try {
|
|
1798
|
-
|
|
1810
|
+
_chunk7HJ7IBRHcjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:request", {
|
|
1799
1811
|
solanaAddress
|
|
1800
1812
|
});
|
|
1801
1813
|
const portfolio = await service.fetchSolanaPortfolio(solanaAddress);
|
|
@@ -1818,12 +1830,12 @@ function SolanaTokenSelectStep({
|
|
|
1818
1830
|
};
|
|
1819
1831
|
}
|
|
1820
1832
|
}
|
|
1821
|
-
|
|
1833
|
+
_chunk7HJ7IBRHcjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:success", {
|
|
1822
1834
|
symbols: Object.keys(portfolioBySymbol)
|
|
1823
1835
|
});
|
|
1824
1836
|
} catch (err) {
|
|
1825
1837
|
if (!active) return;
|
|
1826
|
-
|
|
1838
|
+
_chunk7HJ7IBRHcjs.debugError.call(void 0, debug, "solana-token-select", "portfolio:failure", err, {
|
|
1827
1839
|
solanaAddress
|
|
1828
1840
|
});
|
|
1829
1841
|
setError(
|
|
@@ -1848,7 +1860,7 @@ function SolanaTokenSelectStep({
|
|
|
1848
1860
|
setTokenBalances(results);
|
|
1849
1861
|
setLoading(false);
|
|
1850
1862
|
const totalUsd = results.reduce((sum, r) => sum + r.balanceUsd, 0);
|
|
1851
|
-
_optionalChain([onTotalBalanceComputed, 'optionalCall',
|
|
1863
|
+
_optionalChain([onTotalBalanceComputed, 'optionalCall', _37 => _37(totalUsd)]);
|
|
1852
1864
|
}
|
|
1853
1865
|
void loadBalances();
|
|
1854
1866
|
return () => {
|
|
@@ -1877,7 +1889,7 @@ function SolanaTokenSelectStep({
|
|
|
1877
1889
|
style: { paddingTop: 4, overflow: "auto", maxHeight: 340 },
|
|
1878
1890
|
children: [
|
|
1879
1891
|
loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
1880
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1892
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HJ7IBRHcjs.Spinner, { className: "rs-text-tertiary" }),
|
|
1881
1893
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
1882
1894
|
] }),
|
|
1883
1895
|
!loading && rows.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-state", children: [
|
|
@@ -1914,7 +1926,7 @@ function SolanaTokenSelectStep({
|
|
|
1914
1926
|
try {
|
|
1915
1927
|
const raw = _viem.formatUnits.call(void 0, entry.balance, entry.token.decimals);
|
|
1916
1928
|
const numeric = Number(raw);
|
|
1917
|
-
formattedBalance = Number.isFinite(numeric) ?
|
|
1929
|
+
formattedBalance = Number.isFinite(numeric) ? _chunk7HJ7IBRHcjs.tokenFormatter.format(numeric) : raw;
|
|
1918
1930
|
} catch (e14) {
|
|
1919
1931
|
formattedBalance = "...";
|
|
1920
1932
|
}
|
|
@@ -1958,7 +1970,7 @@ function SolanaTokenSelectStep({
|
|
|
1958
1970
|
] })
|
|
1959
1971
|
] })
|
|
1960
1972
|
] }),
|
|
1961
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ?
|
|
1973
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ? _chunk7HJ7IBRHcjs.currencyFormatter.format(entry.balanceUsd) : `${formattedBalance} ${entry.token.symbol}` })
|
|
1962
1974
|
]
|
|
1963
1975
|
},
|
|
1964
1976
|
entry.token.symbol
|
|
@@ -1968,7 +1980,7 @@ function SolanaTokenSelectStep({
|
|
|
1968
1980
|
}
|
|
1969
1981
|
),
|
|
1970
1982
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1971
|
-
|
|
1983
|
+
_chunk7HJ7IBRHcjs.Button,
|
|
1972
1984
|
{
|
|
1973
1985
|
onClick: () => selectedEntry && onContinue(
|
|
1974
1986
|
selectedEntry.token,
|
|
@@ -1980,7 +1992,7 @@ function SolanaTokenSelectStep({
|
|
|
1980
1992
|
children: "Continue"
|
|
1981
1993
|
}
|
|
1982
1994
|
) }),
|
|
1983
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1995
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HJ7IBRHcjs.PoweredBy, {})
|
|
1984
1996
|
] });
|
|
1985
1997
|
}
|
|
1986
1998
|
|
|
@@ -1993,45 +2005,91 @@ function SolanaAmountStep({
|
|
|
1993
2005
|
token,
|
|
1994
2006
|
balance,
|
|
1995
2007
|
balanceUsd,
|
|
2008
|
+
defaultAmount,
|
|
2009
|
+
uiConfig,
|
|
1996
2010
|
onContinue,
|
|
1997
2011
|
debug
|
|
1998
2012
|
}) {
|
|
1999
2013
|
const [amount, setAmount] = _react.useState.call(void 0, "");
|
|
2000
2014
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
2015
|
+
const isSourceStablecoin = _chunkNELAYNA3cjs.isStablecoinSymbol.call(void 0, token.symbol);
|
|
2016
|
+
const tokenPriceUsd = _react.useMemo.call(void 0, () => {
|
|
2017
|
+
if (isSourceStablecoin) return 1;
|
|
2018
|
+
try {
|
|
2019
|
+
const balanceUnits = Number(_viem.formatUnits.call(void 0, balance, token.decimals));
|
|
2020
|
+
if (!Number.isFinite(balanceUnits) || balanceUnits <= 0 || balanceUsd <= 0) {
|
|
2021
|
+
return null;
|
|
2022
|
+
}
|
|
2023
|
+
const price = balanceUsd / balanceUnits;
|
|
2024
|
+
return price > 0 ? price : null;
|
|
2025
|
+
} catch (e15) {
|
|
2026
|
+
return null;
|
|
2027
|
+
}
|
|
2028
|
+
}, [isSourceStablecoin, balance, token.decimals, balanceUsd]);
|
|
2029
|
+
const hasPricing = tokenPriceUsd !== null;
|
|
2030
|
+
_react.useEffect.call(void 0, () => {
|
|
2031
|
+
if (defaultAmount && !amount) {
|
|
2032
|
+
const parsed = Number(defaultAmount);
|
|
2033
|
+
if (Number.isFinite(parsed) && parsed > 0) {
|
|
2034
|
+
setAmount(parsed.toString());
|
|
2035
|
+
}
|
|
2036
|
+
}
|
|
2037
|
+
}, [defaultAmount, amount]);
|
|
2001
2038
|
const formattedBalance = _react.useMemo.call(void 0, () => {
|
|
2002
2039
|
try {
|
|
2003
2040
|
const raw = _viem.formatUnits.call(void 0, balance, token.decimals);
|
|
2004
2041
|
const numeric = Number(raw);
|
|
2005
2042
|
if (!Number.isFinite(numeric)) return raw;
|
|
2006
|
-
return
|
|
2007
|
-
} catch (
|
|
2043
|
+
return _chunk7HJ7IBRHcjs.tokenFormatter.format(numeric);
|
|
2044
|
+
} catch (e16) {
|
|
2008
2045
|
return "...";
|
|
2009
2046
|
}
|
|
2010
2047
|
}, [balance, token.decimals]);
|
|
2048
|
+
const computedBalanceUsd = _react.useMemo.call(void 0, () => {
|
|
2049
|
+
try {
|
|
2050
|
+
const balanceUnits = Number(_viem.formatUnits.call(void 0, balance, token.decimals));
|
|
2051
|
+
if (!Number.isFinite(balanceUnits) || balanceUnits < 0) return null;
|
|
2052
|
+
if (tokenPriceUsd !== null) return balanceUnits * tokenPriceUsd;
|
|
2053
|
+
if (Number.isFinite(balanceUsd) && balanceUsd > 0) return balanceUsd;
|
|
2054
|
+
return null;
|
|
2055
|
+
} catch (e17) {
|
|
2056
|
+
return null;
|
|
2057
|
+
}
|
|
2058
|
+
}, [balance, token.decimals, tokenPriceUsd, balanceUsd]);
|
|
2011
2059
|
const formattedBalanceUsd = _react.useMemo.call(void 0, () => {
|
|
2012
|
-
if (
|
|
2013
|
-
return
|
|
2014
|
-
}, [
|
|
2060
|
+
if (computedBalanceUsd === null || computedBalanceUsd <= 0) return null;
|
|
2061
|
+
return _chunk7HJ7IBRHcjs.currencyFormatter.format(computedBalanceUsd);
|
|
2062
|
+
}, [computedBalanceUsd]);
|
|
2015
2063
|
const spendableBalance = _react.useMemo.call(void 0, () => {
|
|
2016
2064
|
if (!isNativeSol(token)) return balance;
|
|
2017
2065
|
return balance > SOL_FEE_RESERVE_LAMPORTS ? balance - SOL_FEE_RESERVE_LAMPORTS : 0n;
|
|
2018
2066
|
}, [balance, token]);
|
|
2067
|
+
const spendableBalanceUsd = _react.useMemo.call(void 0, () => {
|
|
2068
|
+
try {
|
|
2069
|
+
const spendableUnits = Number(_viem.formatUnits.call(void 0, spendableBalance, token.decimals));
|
|
2070
|
+
if (!Number.isFinite(spendableUnits) || spendableUnits < 0) return null;
|
|
2071
|
+
if (tokenPriceUsd !== null) return spendableUnits * tokenPriceUsd;
|
|
2072
|
+
return null;
|
|
2073
|
+
} catch (e18) {
|
|
2074
|
+
return null;
|
|
2075
|
+
}
|
|
2076
|
+
}, [spendableBalance, token.decimals, tokenPriceUsd]);
|
|
2019
2077
|
const handlePresetClick = (percentage) => {
|
|
2020
2078
|
try {
|
|
2021
2079
|
const spendableUnits = Number(_viem.formatUnits.call(void 0, spendableBalance, token.decimals));
|
|
2022
2080
|
if (!Number.isFinite(spendableUnits) || spendableUnits <= 0) return;
|
|
2023
|
-
const value = spendableUnits * percentage / 100;
|
|
2024
|
-
const maxDecimals =
|
|
2081
|
+
const value = isSourceStablecoin || !hasPricing ? spendableUnits * percentage / 100 : (_nullishCoalesce(spendableBalanceUsd, () => ( 0))) * percentage / 100;
|
|
2082
|
+
const maxDecimals = 3;
|
|
2025
2083
|
const factor = 10 ** maxDecimals;
|
|
2026
2084
|
const truncated = Math.floor(value * factor) / factor;
|
|
2027
2085
|
const formatted = truncated.toFixed(maxDecimals).replace(/\.?0+$/, "");
|
|
2028
|
-
|
|
2086
|
+
_chunk7HJ7IBRHcjs.debugLog.call(void 0, debug, "solana-amount", "amount:preset", {
|
|
2029
2087
|
percentage,
|
|
2030
2088
|
symbol: token.symbol,
|
|
2031
2089
|
formatted
|
|
2032
2090
|
});
|
|
2033
2091
|
setAmount(formatted);
|
|
2034
|
-
} catch (
|
|
2092
|
+
} catch (e19) {
|
|
2035
2093
|
return;
|
|
2036
2094
|
}
|
|
2037
2095
|
if (error) setError(null);
|
|
@@ -2039,19 +2097,37 @@ function SolanaAmountStep({
|
|
|
2039
2097
|
const handleContinue = () => {
|
|
2040
2098
|
const numericAmount = parseFloat(amount);
|
|
2041
2099
|
if (isNaN(numericAmount) || numericAmount <= 0) {
|
|
2042
|
-
|
|
2100
|
+
_chunk7HJ7IBRHcjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
|
|
2043
2101
|
amount,
|
|
2044
2102
|
reason: "nan-or-non-positive"
|
|
2045
2103
|
});
|
|
2046
2104
|
setError("Please enter a valid amount");
|
|
2047
2105
|
return;
|
|
2048
2106
|
}
|
|
2107
|
+
const sourceAmount = isSourceStablecoin || !hasPricing ? numericAmount : numericAmount / tokenPriceUsd;
|
|
2108
|
+
if (hasPricing) {
|
|
2109
|
+
const usdValue = numericAmount;
|
|
2110
|
+
if (_optionalChain([uiConfig, 'optionalAccess', _38 => _38.maxDepositUsd]) && usdValue > uiConfig.maxDepositUsd) {
|
|
2111
|
+
setError(
|
|
2112
|
+
`Maximum deposit is ${_chunk7HJ7IBRHcjs.currencyFormatter.format(uiConfig.maxDepositUsd)}`
|
|
2113
|
+
);
|
|
2114
|
+
return;
|
|
2115
|
+
}
|
|
2116
|
+
if (_optionalChain([uiConfig, 'optionalAccess', _39 => _39.minDepositUsd]) && usdValue < uiConfig.minDepositUsd) {
|
|
2117
|
+
setError(
|
|
2118
|
+
`Minimum deposit is ${_chunk7HJ7IBRHcjs.currencyFormatter.format(uiConfig.minDepositUsd)}`
|
|
2119
|
+
);
|
|
2120
|
+
return;
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
const sourceAmountStr = sourceAmount.toString();
|
|
2049
2124
|
let amountInUnits;
|
|
2050
2125
|
try {
|
|
2051
|
-
amountInUnits = _viem.parseUnits.call(void 0,
|
|
2052
|
-
} catch (
|
|
2053
|
-
|
|
2126
|
+
amountInUnits = _viem.parseUnits.call(void 0, sourceAmountStr, token.decimals);
|
|
2127
|
+
} catch (e20) {
|
|
2128
|
+
_chunk7HJ7IBRHcjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
|
|
2054
2129
|
amount,
|
|
2130
|
+
sourceAmount: sourceAmountStr,
|
|
2055
2131
|
reason: "parse-units-failed"
|
|
2056
2132
|
});
|
|
2057
2133
|
setError("Please enter a valid amount");
|
|
@@ -2059,7 +2135,7 @@ function SolanaAmountStep({
|
|
|
2059
2135
|
}
|
|
2060
2136
|
if (amountInUnits > spendableBalance) {
|
|
2061
2137
|
const isReserveIssue = isNativeSol(token) && amountInUnits <= balance;
|
|
2062
|
-
|
|
2138
|
+
_chunk7HJ7IBRHcjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
|
|
2063
2139
|
amount,
|
|
2064
2140
|
balance: balance.toString(),
|
|
2065
2141
|
spendableBalance: spendableBalance.toString(),
|
|
@@ -2071,48 +2147,49 @@ function SolanaAmountStep({
|
|
|
2071
2147
|
);
|
|
2072
2148
|
return;
|
|
2073
2149
|
}
|
|
2074
|
-
|
|
2150
|
+
_chunk7HJ7IBRHcjs.debugLog.call(void 0, debug, "solana-amount", "amount:continue", {
|
|
2075
2151
|
symbol: token.symbol,
|
|
2076
|
-
amount,
|
|
2152
|
+
inputAmountUsd: amount,
|
|
2153
|
+
sourceAmount: sourceAmountStr,
|
|
2077
2154
|
amountInUnits: amountInUnits.toString()
|
|
2078
2155
|
});
|
|
2079
2156
|
setError(null);
|
|
2080
|
-
onContinue(token, amount);
|
|
2157
|
+
onContinue(token, sourceAmountStr, amount);
|
|
2081
2158
|
};
|
|
2082
2159
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
2083
2160
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { padding: "12px 12px 4px" }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-title", children: "Enter amount" }) }),
|
|
2084
2161
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body", style: { paddingTop: 0 }, children: [
|
|
2085
2162
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-display", children: [
|
|
2086
|
-
/* @__PURE__ */ _jsxruntime.
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2163
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-amount-input-wrapper", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2164
|
+
"input",
|
|
2165
|
+
{
|
|
2166
|
+
type: "text",
|
|
2167
|
+
inputMode: "decimal",
|
|
2168
|
+
className: "rs-amount-input-large",
|
|
2169
|
+
placeholder: "$0.00",
|
|
2170
|
+
value: amount ? `$${amount}` : "",
|
|
2171
|
+
onChange: (e) => {
|
|
2172
|
+
const raw = e.target.value.replace(/[^0-9.]/g, "");
|
|
2173
|
+
const parts = raw.split(".");
|
|
2174
|
+
if (parts.length > 2) return;
|
|
2175
|
+
setAmount(raw);
|
|
2176
|
+
if (error) setError(null);
|
|
2177
|
+
},
|
|
2178
|
+
autoFocus: true
|
|
2179
|
+
}
|
|
2180
|
+
) }),
|
|
2181
|
+
!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: [
|
|
2182
|
+
formattedBalance,
|
|
2183
|
+
" ",
|
|
2184
|
+
token.symbol,
|
|
2185
|
+
" available",
|
|
2186
|
+
formattedBalanceUsd && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { style: { color: "var(--rs-muted-foreground)" }, children: [
|
|
2110
2187
|
" ",
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
] })
|
|
2188
|
+
"(",
|
|
2189
|
+
formattedBalanceUsd,
|
|
2190
|
+
")"
|
|
2191
|
+
] })
|
|
2192
|
+
] }) })
|
|
2116
2193
|
] }),
|
|
2117
2194
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-presets", children: [
|
|
2118
2195
|
[25, 50, 75].map((pct) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
@@ -2161,7 +2238,7 @@ function SolanaAmountStep({
|
|
|
2161
2238
|
] })
|
|
2162
2239
|
] }),
|
|
2163
2240
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2164
|
-
|
|
2241
|
+
_chunk7HJ7IBRHcjs.Button,
|
|
2165
2242
|
{
|
|
2166
2243
|
onClick: handleContinue,
|
|
2167
2244
|
fullWidth: true,
|
|
@@ -2169,7 +2246,7 @@ function SolanaAmountStep({
|
|
|
2169
2246
|
children: "Continue"
|
|
2170
2247
|
}
|
|
2171
2248
|
) }),
|
|
2172
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2249
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HJ7IBRHcjs.PoweredBy, {})
|
|
2173
2250
|
] });
|
|
2174
2251
|
}
|
|
2175
2252
|
|
|
@@ -2182,7 +2259,8 @@ function SolanaConfirmStep({
|
|
|
2182
2259
|
solanaAddress,
|
|
2183
2260
|
solanaDepositAddress,
|
|
2184
2261
|
token,
|
|
2185
|
-
|
|
2262
|
+
sourceAmount,
|
|
2263
|
+
inputAmountUsd,
|
|
2186
2264
|
targetAmount,
|
|
2187
2265
|
targetTokenPriceUsd,
|
|
2188
2266
|
targetChain,
|
|
@@ -2197,7 +2275,7 @@ function SolanaConfirmStep({
|
|
|
2197
2275
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
2198
2276
|
const targetSymbol = _chunkNELAYNA3cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
2199
2277
|
const isSameToken = token.symbol.toUpperCase() === targetSymbol.toUpperCase();
|
|
2200
|
-
const formattedAmount =
|
|
2278
|
+
const formattedAmount = sourceAmount && !Number.isNaN(Number(sourceAmount)) ? Number(sourceAmount).toLocaleString("en-US", { maximumFractionDigits: 6 }) : "0";
|
|
2201
2279
|
const formattedReceiveAmount = (() => {
|
|
2202
2280
|
if (isSameToken) return formattedAmount;
|
|
2203
2281
|
const dollarValue = Number(targetAmount);
|
|
@@ -2212,33 +2290,34 @@ function SolanaConfirmStep({
|
|
|
2212
2290
|
const receiveAmount = isSameToken ? formattedReceiveAmount : `~ ${formattedReceiveAmount}`;
|
|
2213
2291
|
const handleConfirm = async () => {
|
|
2214
2292
|
if (!solanaProvider) {
|
|
2215
|
-
|
|
2293
|
+
_chunk7HJ7IBRHcjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
|
|
2216
2294
|
reason: "missing-provider"
|
|
2217
2295
|
});
|
|
2218
2296
|
setError("Solana wallet not connected");
|
|
2219
2297
|
return;
|
|
2220
2298
|
}
|
|
2221
|
-
const parsedAmount = parseFloat(
|
|
2299
|
+
const parsedAmount = parseFloat(sourceAmount);
|
|
2222
2300
|
if (isNaN(parsedAmount) || parsedAmount <= 0) {
|
|
2223
|
-
|
|
2301
|
+
_chunk7HJ7IBRHcjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
|
|
2224
2302
|
reason: "invalid-amount",
|
|
2225
|
-
|
|
2303
|
+
sourceAmount
|
|
2226
2304
|
});
|
|
2227
2305
|
setError("Please enter a valid amount");
|
|
2228
2306
|
return;
|
|
2229
2307
|
}
|
|
2230
2308
|
setError(null);
|
|
2231
2309
|
setIsSubmitting(true);
|
|
2232
|
-
|
|
2310
|
+
_chunk7HJ7IBRHcjs.debugLog.call(void 0, debug, "solana-confirm", "submit:start", {
|
|
2233
2311
|
smartAccount,
|
|
2234
2312
|
solanaAddress,
|
|
2235
2313
|
solanaDepositAddress,
|
|
2236
2314
|
token: token.symbol,
|
|
2237
|
-
|
|
2315
|
+
sourceAmount,
|
|
2316
|
+
inputAmountUsd
|
|
2238
2317
|
});
|
|
2239
2318
|
try {
|
|
2240
2319
|
const check = await service.checkAccount(smartAccount);
|
|
2241
|
-
|
|
2320
|
+
_chunk7HJ7IBRHcjs.debugLog.call(void 0, debug, "solana-confirm", "check:success", {
|
|
2242
2321
|
smartAccount,
|
|
2243
2322
|
isRegistered: check.isRegistered,
|
|
2244
2323
|
targetChain: check.targetChain,
|
|
@@ -2250,10 +2329,10 @@ function SolanaConfirmStep({
|
|
|
2250
2329
|
);
|
|
2251
2330
|
}
|
|
2252
2331
|
const connection = getSolanaConnection();
|
|
2253
|
-
const amountUnits = _viem.parseUnits.call(void 0,
|
|
2254
|
-
|
|
2332
|
+
const amountUnits = _viem.parseUnits.call(void 0, sourceAmount, token.decimals);
|
|
2333
|
+
_chunk7HJ7IBRHcjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:start", {
|
|
2255
2334
|
token: token.symbol,
|
|
2256
|
-
|
|
2335
|
+
sourceAmount,
|
|
2257
2336
|
amountUnits: amountUnits.toString()
|
|
2258
2337
|
});
|
|
2259
2338
|
const transaction = isNativeSol(token) ? await buildSolTransferTransaction(
|
|
@@ -2268,10 +2347,10 @@ function SolanaConfirmStep({
|
|
|
2268
2347
|
token.mint,
|
|
2269
2348
|
amountUnits
|
|
2270
2349
|
);
|
|
2271
|
-
|
|
2350
|
+
_chunk7HJ7IBRHcjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:success", {
|
|
2272
2351
|
token: token.symbol,
|
|
2273
2352
|
instructionCount: transaction.instructions.length,
|
|
2274
|
-
feePayer: _optionalChain([transaction, 'access',
|
|
2353
|
+
feePayer: _optionalChain([transaction, 'access', _40 => _40.feePayer, 'optionalAccess', _41 => _41.toBase58, 'call', _42 => _42()]),
|
|
2275
2354
|
recentBlockhash: transaction.recentBlockhash
|
|
2276
2355
|
});
|
|
2277
2356
|
const txHash = await sendSolanaTransaction(
|
|
@@ -2279,21 +2358,21 @@ function SolanaConfirmStep({
|
|
|
2279
2358
|
connection,
|
|
2280
2359
|
transaction
|
|
2281
2360
|
);
|
|
2282
|
-
|
|
2361
|
+
_chunk7HJ7IBRHcjs.debugLog.call(void 0, debug, "solana-confirm", "tx:sent", {
|
|
2283
2362
|
txHash,
|
|
2284
2363
|
amountUnits: amountUnits.toString()
|
|
2285
2364
|
});
|
|
2286
2365
|
onConfirm(txHash, amountUnits.toString());
|
|
2287
2366
|
} catch (err) {
|
|
2288
2367
|
const raw = err instanceof Error ? err.message : "Transfer failed";
|
|
2289
|
-
const message =
|
|
2290
|
-
|
|
2368
|
+
const message = _chunk7HJ7IBRHcjs.formatUserError.call(void 0, raw);
|
|
2369
|
+
_chunk7HJ7IBRHcjs.debugError.call(void 0, debug, "solana-confirm", "submit:failure", err, {
|
|
2291
2370
|
smartAccount,
|
|
2292
2371
|
token: token.symbol,
|
|
2293
|
-
|
|
2372
|
+
sourceAmount
|
|
2294
2373
|
});
|
|
2295
2374
|
setError(message);
|
|
2296
|
-
_optionalChain([onError, 'optionalCall',
|
|
2375
|
+
_optionalChain([onError, 'optionalCall', _43 => _43(message, "SOLANA_TRANSFER_ERROR")]);
|
|
2297
2376
|
} finally {
|
|
2298
2377
|
setIsSubmitting(false);
|
|
2299
2378
|
}
|
|
@@ -2420,16 +2499,16 @@ function SolanaConfirmStep({
|
|
|
2420
2499
|
] })
|
|
2421
2500
|
] }),
|
|
2422
2501
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2423
|
-
|
|
2502
|
+
_chunk7HJ7IBRHcjs.Button,
|
|
2424
2503
|
{
|
|
2425
2504
|
onClick: handleConfirm,
|
|
2426
2505
|
loading: isSubmitting,
|
|
2427
|
-
disabled: !
|
|
2506
|
+
disabled: !sourceAmount || Number(sourceAmount) <= 0,
|
|
2428
2507
|
fullWidth: true,
|
|
2429
2508
|
children: "Confirm Order"
|
|
2430
2509
|
}
|
|
2431
2510
|
) }),
|
|
2432
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2511
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HJ7IBRHcjs.PoweredBy, {})
|
|
2433
2512
|
] });
|
|
2434
2513
|
}
|
|
2435
2514
|
|
|
@@ -2462,6 +2541,7 @@ function DepositFlow({
|
|
|
2462
2541
|
onRequestConnect,
|
|
2463
2542
|
connectButtonLabel,
|
|
2464
2543
|
uiConfig,
|
|
2544
|
+
allowedRoutes,
|
|
2465
2545
|
onStepChange,
|
|
2466
2546
|
onTotalBalanceChange,
|
|
2467
2547
|
onClose,
|
|
@@ -2484,13 +2564,13 @@ function DepositFlow({
|
|
|
2484
2564
|
flowModeRef.current = flowMode;
|
|
2485
2565
|
const logFlow = _react.useCallback.call(void 0,
|
|
2486
2566
|
(message, data) => {
|
|
2487
|
-
|
|
2567
|
+
_chunk7HJ7IBRHcjs.debugLog.call(void 0, debug, "deposit-flow", message, data);
|
|
2488
2568
|
},
|
|
2489
2569
|
[debug]
|
|
2490
2570
|
);
|
|
2491
2571
|
const logFlowError = _react.useCallback.call(void 0,
|
|
2492
2572
|
(message, error, data) => {
|
|
2493
|
-
|
|
2573
|
+
_chunk7HJ7IBRHcjs.debugError.call(void 0, debug, "deposit-flow", message, error, data);
|
|
2494
2574
|
},
|
|
2495
2575
|
[debug]
|
|
2496
2576
|
);
|
|
@@ -2504,19 +2584,19 @@ function DepositFlow({
|
|
|
2504
2584
|
try {
|
|
2505
2585
|
const balanceUnits = Number(asset.balance) / 10 ** asset.decimals;
|
|
2506
2586
|
if (balanceUnits > 0) return asset.balanceUsd / balanceUnits;
|
|
2507
|
-
} catch (
|
|
2587
|
+
} catch (e21) {
|
|
2508
2588
|
}
|
|
2509
2589
|
}
|
|
2510
2590
|
}
|
|
2511
2591
|
return null;
|
|
2512
2592
|
}, []);
|
|
2513
2593
|
const dappSwitchChain = _react.useMemo.call(void 0, () => {
|
|
2514
|
-
if (!_optionalChain([dappWalletClient, 'optionalAccess',
|
|
2594
|
+
if (!_optionalChain([dappWalletClient, 'optionalAccess', _44 => _44.switchChain])) return void 0;
|
|
2515
2595
|
return async (chainId) => {
|
|
2516
|
-
await _optionalChain([dappWalletClient, 'access',
|
|
2596
|
+
await _optionalChain([dappWalletClient, 'access', _45 => _45.switchChain, 'optionalCall', _46 => _46({ id: chainId })]);
|
|
2517
2597
|
};
|
|
2518
2598
|
}, [dappWalletClient]);
|
|
2519
|
-
const connectedWalletAddress = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
2599
|
+
const connectedWalletAddress = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _47 => _47.account, 'optionalAccess', _48 => _48.address]), () => ( null));
|
|
2520
2600
|
const walletOptions = _react.useMemo.call(void 0, () => {
|
|
2521
2601
|
const options = [];
|
|
2522
2602
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -2530,7 +2610,7 @@ function DepositFlow({
|
|
|
2530
2610
|
});
|
|
2531
2611
|
seen.add(id);
|
|
2532
2612
|
}
|
|
2533
|
-
if (_optionalChain([reownWallet, 'optionalAccess',
|
|
2613
|
+
if (_optionalChain([reownWallet, 'optionalAccess', _49 => _49.isConnected]) && reownWallet.isSolana && reownWallet.solanaAddress && dappAddress) {
|
|
2534
2614
|
const id = _nullishCoalesce(reownWallet.caipAddress, () => ( `solana:${reownWallet.solanaAddress}`));
|
|
2535
2615
|
if (!seen.has(id)) {
|
|
2536
2616
|
options.push({
|
|
@@ -2542,7 +2622,7 @@ function DepositFlow({
|
|
|
2542
2622
|
});
|
|
2543
2623
|
seen.add(id);
|
|
2544
2624
|
}
|
|
2545
|
-
} else if (_optionalChain([reownWallet, 'optionalAccess',
|
|
2625
|
+
} else if (_optionalChain([reownWallet, 'optionalAccess', _50 => _50.address]) && reownWallet.isConnected && reownWallet.walletClient && reownWallet.publicClient && !seen.has(`evm:${reownWallet.address.toLowerCase()}`)) {
|
|
2546
2626
|
const id = `evm:${reownWallet.address.toLowerCase()}`;
|
|
2547
2627
|
if (!seen.has(id)) {
|
|
2548
2628
|
options.push({
|
|
@@ -2559,19 +2639,19 @@ function DepositFlow({
|
|
|
2559
2639
|
}, [
|
|
2560
2640
|
connectedWalletAddress,
|
|
2561
2641
|
dappAddress,
|
|
2562
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2563
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2564
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2565
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2566
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2567
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2568
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2569
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2642
|
+
_optionalChain([reownWallet, 'optionalAccess', _51 => _51.address]),
|
|
2643
|
+
_optionalChain([reownWallet, 'optionalAccess', _52 => _52.isConnected]),
|
|
2644
|
+
_optionalChain([reownWallet, 'optionalAccess', _53 => _53.walletClient]),
|
|
2645
|
+
_optionalChain([reownWallet, 'optionalAccess', _54 => _54.publicClient]),
|
|
2646
|
+
_optionalChain([reownWallet, 'optionalAccess', _55 => _55.icon]),
|
|
2647
|
+
_optionalChain([reownWallet, 'optionalAccess', _56 => _56.isSolana]),
|
|
2648
|
+
_optionalChain([reownWallet, 'optionalAccess', _57 => _57.solanaAddress]),
|
|
2649
|
+
_optionalChain([reownWallet, 'optionalAccess', _58 => _58.caipAddress])
|
|
2570
2650
|
]);
|
|
2571
|
-
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess',
|
|
2651
|
+
const canAutoLock = _optionalChain([dappWalletClient, 'optionalAccess', _59 => _59.account]) && dappAddress && !reownWallet;
|
|
2572
2652
|
const hasWalletOptions = walletOptions.length > 0;
|
|
2573
2653
|
const hasReownSession = Boolean(
|
|
2574
|
-
_optionalChain([reownWallet, 'optionalAccess',
|
|
2654
|
+
_optionalChain([reownWallet, 'optionalAccess', _60 => _60.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _61 => _61.address])
|
|
2575
2655
|
);
|
|
2576
2656
|
const showConnectStep = flowMode === null && !canAutoLock && !isConnectSelectionConfirmed;
|
|
2577
2657
|
const walletSelectionKey = _react.useMemo.call(void 0, () => {
|
|
@@ -2597,16 +2677,16 @@ function DepositFlow({
|
|
|
2597
2677
|
return {
|
|
2598
2678
|
ownerAddress: dappAddress,
|
|
2599
2679
|
walletClient: void 0,
|
|
2600
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
2680
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunk7HJ7IBRHcjs.getPublicClient.call(void 0, targetChain))),
|
|
2601
2681
|
switchChain: void 0
|
|
2602
2682
|
};
|
|
2603
2683
|
}
|
|
2604
2684
|
if (canAutoLock) {
|
|
2605
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
2685
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _62 => _62.chain, 'optionalAccess', _63 => _63.id]), () => ( targetChain));
|
|
2606
2686
|
return {
|
|
2607
2687
|
ownerAddress: dappWalletClient.account.address,
|
|
2608
2688
|
walletClient: dappWalletClient,
|
|
2609
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
2689
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunk7HJ7IBRHcjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
2610
2690
|
switchChain: dappSwitchChain
|
|
2611
2691
|
};
|
|
2612
2692
|
}
|
|
@@ -2620,24 +2700,24 @@ function DepositFlow({
|
|
|
2620
2700
|
return {
|
|
2621
2701
|
ownerAddress: dappAddress,
|
|
2622
2702
|
walletClient: void 0,
|
|
2623
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
2703
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunk7HJ7IBRHcjs.getPublicClient.call(void 0, targetChain))),
|
|
2624
2704
|
switchChain: void 0
|
|
2625
2705
|
};
|
|
2626
2706
|
}
|
|
2627
|
-
if (selectedOption.kind === "connected" && _optionalChain([dappWalletClient, 'optionalAccess',
|
|
2628
|
-
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess',
|
|
2707
|
+
if (selectedOption.kind === "connected" && _optionalChain([dappWalletClient, 'optionalAccess', _64 => _64.account]) && selectedOption.address && dappWalletClient.account.address.toLowerCase() === selectedOption.address.toLowerCase()) {
|
|
2708
|
+
const fallbackChainId = _nullishCoalesce(_optionalChain([dappWalletClient, 'optionalAccess', _65 => _65.chain, 'optionalAccess', _66 => _66.id]), () => ( targetChain));
|
|
2629
2709
|
return {
|
|
2630
2710
|
ownerAddress: dappWalletClient.account.address,
|
|
2631
2711
|
walletClient: dappWalletClient,
|
|
2632
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
2712
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunk7HJ7IBRHcjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
2633
2713
|
switchChain: dappSwitchChain
|
|
2634
2714
|
};
|
|
2635
2715
|
}
|
|
2636
|
-
if (selectedOption.kind === "external" && _optionalChain([reownWallet, 'optionalAccess',
|
|
2716
|
+
if (selectedOption.kind === "external" && _optionalChain([reownWallet, 'optionalAccess', _67 => _67.address]) && selectedOption.address && reownWallet.address.toLowerCase() === selectedOption.address.toLowerCase()) {
|
|
2637
2717
|
return {
|
|
2638
2718
|
ownerAddress: reownWallet.address,
|
|
2639
2719
|
walletClient: reownWallet.walletClient,
|
|
2640
|
-
publicClient: _nullishCoalesce(reownWallet.publicClient, () => (
|
|
2720
|
+
publicClient: _nullishCoalesce(reownWallet.publicClient, () => ( _chunk7HJ7IBRHcjs.getPublicClient.call(void 0, targetChain))),
|
|
2641
2721
|
switchChain: reownWallet.switchChain
|
|
2642
2722
|
};
|
|
2643
2723
|
}
|
|
@@ -2675,7 +2755,7 @@ function DepositFlow({
|
|
|
2675
2755
|
return {
|
|
2676
2756
|
ownerAddress: dappAddress,
|
|
2677
2757
|
walletClient: void 0,
|
|
2678
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
2758
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunk7HJ7IBRHcjs.getPublicClient.call(void 0, targetChain))),
|
|
2679
2759
|
switchChain: void 0
|
|
2680
2760
|
};
|
|
2681
2761
|
}
|
|
@@ -2697,7 +2777,7 @@ function DepositFlow({
|
|
|
2697
2777
|
walletSignerContext,
|
|
2698
2778
|
walletSelectionKey
|
|
2699
2779
|
]);
|
|
2700
|
-
const sessionKeyAddress = _nullishCoalesce(_nullishCoalesce(dappAddress, () => ( _optionalChain([signerContext, 'optionalAccess',
|
|
2780
|
+
const sessionKeyAddress = _nullishCoalesce(_nullishCoalesce(dappAddress, () => ( _optionalChain([signerContext, 'optionalAccess', _68 => _68.ownerAddress]))), () => ( null));
|
|
2701
2781
|
const lastTargetRef = _react.useRef.call(void 0, null);
|
|
2702
2782
|
_react.useEffect.call(void 0, () => {
|
|
2703
2783
|
const prev = lastTargetRef.current;
|
|
@@ -2756,7 +2836,8 @@ function DepositFlow({
|
|
|
2756
2836
|
solanaDepositAddress: prev.solanaDepositAddress,
|
|
2757
2837
|
token: prev.token,
|
|
2758
2838
|
balance: prev.balance,
|
|
2759
|
-
balanceUsd: prev.balanceUsd
|
|
2839
|
+
balanceUsd: prev.balanceUsd,
|
|
2840
|
+
inputAmountUsd: prev.inputAmountUsd
|
|
2760
2841
|
};
|
|
2761
2842
|
});
|
|
2762
2843
|
}, []);
|
|
@@ -2773,7 +2854,7 @@ function DepositFlow({
|
|
|
2773
2854
|
const stepIndex = step.type === "setup" ? 0 : step.type === "deposit-address" ? 1 : step.type === "select-asset" ? 1 : step.type === "solana-token-select" ? 1 : step.type === "solana-amount" ? 2 : step.type === "amount" ? 2 : step.type === "confirm" ? 3 : step.type === "solana-confirm" ? 3 : 4;
|
|
2774
2855
|
const currentBackHandler = step.type === "deposit-address" ? handleBackFromDepositAddress : step.type === "select-asset" && signerContext && !canAutoLock ? handleBackFromSelectAsset : step.type === "solana-token-select" ? handleBackFromSolanaTokenSelect : step.type === "solana-amount" ? handleBackFromSolanaAmount : step.type === "solana-confirm" ? handleBackFromSolanaConfirm : step.type === "amount" ? handleBackFromAmount : step.type === "confirm" ? handleBackFromConfirm : void 0;
|
|
2775
2856
|
_react.useEffect.call(void 0, () => {
|
|
2776
|
-
_optionalChain([onStepChange, 'optionalCall',
|
|
2857
|
+
_optionalChain([onStepChange, 'optionalCall', _69 => _69(stepIndex, currentBackHandler)]);
|
|
2777
2858
|
}, [stepIndex, currentBackHandler, onStepChange]);
|
|
2778
2859
|
_react.useEffect.call(void 0, () => {
|
|
2779
2860
|
logFlow("state:changed", {
|
|
@@ -2792,7 +2873,7 @@ function DepositFlow({
|
|
|
2792
2873
|
targetToken
|
|
2793
2874
|
]);
|
|
2794
2875
|
_react.useEffect.call(void 0, () => {
|
|
2795
|
-
_optionalChain([onTotalBalanceChange, 'optionalCall',
|
|
2876
|
+
_optionalChain([onTotalBalanceChange, 'optionalCall', _70 => _70(totalBalanceUsd)]);
|
|
2796
2877
|
}, [totalBalanceUsd, onTotalBalanceChange]);
|
|
2797
2878
|
const isDepositAddressMode = flowMode === "deposit-address";
|
|
2798
2879
|
const isSolanaWalletMode = flowMode === "solana-wallet";
|
|
@@ -2834,7 +2915,7 @@ function DepositFlow({
|
|
|
2834
2915
|
solanaDepositAddress
|
|
2835
2916
|
});
|
|
2836
2917
|
} else {
|
|
2837
|
-
_optionalChain([onError, 'optionalCall',
|
|
2918
|
+
_optionalChain([onError, 'optionalCall', _71 => _71({
|
|
2838
2919
|
message: "Solana deposit address not available. Please try again.",
|
|
2839
2920
|
code: "SOLANA_SETUP_FAILED"
|
|
2840
2921
|
})]);
|
|
@@ -2869,7 +2950,7 @@ function DepositFlow({
|
|
|
2869
2950
|
directTransfer
|
|
2870
2951
|
};
|
|
2871
2952
|
});
|
|
2872
|
-
_optionalChain([onDepositSubmitted, 'optionalCall',
|
|
2953
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _72 => _72({ txHash, sourceChain: chainId, amount })]);
|
|
2873
2954
|
},
|
|
2874
2955
|
[onDepositSubmitted, targetChain, targetToken]
|
|
2875
2956
|
);
|
|
@@ -2884,38 +2965,35 @@ function DepositFlow({
|
|
|
2884
2965
|
solanaDepositAddress: prev.solanaDepositAddress,
|
|
2885
2966
|
token,
|
|
2886
2967
|
balance,
|
|
2887
|
-
balanceUsd
|
|
2968
|
+
balanceUsd,
|
|
2969
|
+
inputAmountUsd: defaultAmount
|
|
2888
2970
|
};
|
|
2889
2971
|
});
|
|
2890
2972
|
},
|
|
2891
|
-
[logFlow]
|
|
2973
|
+
[defaultAmount, logFlow]
|
|
2892
2974
|
);
|
|
2893
2975
|
const handleSolanaAmountContinue = _react.useCallback.call(void 0,
|
|
2894
|
-
(token,
|
|
2976
|
+
(token, sourceAmount, inputAmountUsd) => {
|
|
2895
2977
|
const targetSym = _chunkNELAYNA3cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
2896
2978
|
const isTargetStable = _chunkNELAYNA3cjs.isStablecoinSymbol.call(void 0, targetSym);
|
|
2897
2979
|
const targetTokenPriceUsd = isTargetStable ? 1 : getTokenPriceUsd(targetSym);
|
|
2898
2980
|
logFlow("solana:amount:continue", {
|
|
2899
2981
|
token: token.symbol,
|
|
2900
|
-
|
|
2982
|
+
sourceAmount,
|
|
2983
|
+
inputAmountUsd,
|
|
2901
2984
|
targetSymbol: targetSym,
|
|
2902
2985
|
targetTokenPriceUsd
|
|
2903
2986
|
});
|
|
2904
2987
|
setStep((prev) => {
|
|
2905
2988
|
if (prev.type !== "solana-amount") return prev;
|
|
2906
|
-
const sourceBalance = Number(
|
|
2907
|
-
_viem.formatUnits.call(void 0, prev.balance, prev.token.decimals)
|
|
2908
|
-
);
|
|
2909
|
-
const sourceTokenPriceUsd = Number.isFinite(sourceBalance) && sourceBalance > 0 && prev.balanceUsd > 0 ? prev.balanceUsd / sourceBalance : null;
|
|
2910
|
-
const parsedAmount = Number(amount);
|
|
2911
|
-
const targetAmount = sourceTokenPriceUsd !== null && Number.isFinite(parsedAmount) && parsedAmount > 0 ? (parsedAmount * sourceTokenPriceUsd).toString() : amount;
|
|
2912
2989
|
return {
|
|
2913
2990
|
type: "solana-confirm",
|
|
2914
2991
|
smartAccount: prev.smartAccount,
|
|
2915
2992
|
solanaDepositAddress: prev.solanaDepositAddress,
|
|
2916
2993
|
token,
|
|
2917
|
-
|
|
2918
|
-
|
|
2994
|
+
sourceAmount,
|
|
2995
|
+
inputAmountUsd,
|
|
2996
|
+
targetAmount: inputAmountUsd,
|
|
2919
2997
|
targetTokenPriceUsd,
|
|
2920
2998
|
balance: prev.balance,
|
|
2921
2999
|
balanceUsd: prev.balanceUsd
|
|
@@ -2944,7 +3022,7 @@ function DepositFlow({
|
|
|
2944
3022
|
sourceDecimals: prev.token.decimals
|
|
2945
3023
|
};
|
|
2946
3024
|
});
|
|
2947
|
-
_optionalChain([onDepositSubmitted, 'optionalCall',
|
|
3025
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _73 => _73({
|
|
2948
3026
|
txHash,
|
|
2949
3027
|
sourceChain: "solana",
|
|
2950
3028
|
amount: amountUnits
|
|
@@ -2954,7 +3032,7 @@ function DepositFlow({
|
|
|
2954
3032
|
);
|
|
2955
3033
|
const handleConnected = _react.useCallback.call(void 0,
|
|
2956
3034
|
(addr, smartAccount) => {
|
|
2957
|
-
_optionalChain([onConnected, 'optionalCall',
|
|
3035
|
+
_optionalChain([onConnected, 'optionalCall', _74 => _74({ address: addr, smartAccount })]);
|
|
2958
3036
|
},
|
|
2959
3037
|
[onConnected]
|
|
2960
3038
|
);
|
|
@@ -3017,28 +3095,28 @@ function DepositFlow({
|
|
|
3017
3095
|
);
|
|
3018
3096
|
const handleDepositSubmittedCallback = _react.useCallback.call(void 0,
|
|
3019
3097
|
(txHash, sourceChain, amount) => {
|
|
3020
|
-
_optionalChain([onDepositSubmitted, 'optionalCall',
|
|
3098
|
+
_optionalChain([onDepositSubmitted, 'optionalCall', _75 => _75({ txHash, sourceChain, amount })]);
|
|
3021
3099
|
},
|
|
3022
3100
|
[onDepositSubmitted]
|
|
3023
3101
|
);
|
|
3024
3102
|
const handleDepositComplete = _react.useCallback.call(void 0,
|
|
3025
3103
|
(txHash, destinationTxHash) => {
|
|
3026
3104
|
logFlow("deposit:complete", { txHash, destinationTxHash });
|
|
3027
|
-
_optionalChain([onDepositComplete, 'optionalCall',
|
|
3105
|
+
_optionalChain([onDepositComplete, 'optionalCall', _76 => _76({ txHash, destinationTxHash })]);
|
|
3028
3106
|
},
|
|
3029
3107
|
[logFlow, onDepositComplete]
|
|
3030
3108
|
);
|
|
3031
3109
|
const handleDepositFailed = _react.useCallback.call(void 0,
|
|
3032
3110
|
(txHash, error) => {
|
|
3033
3111
|
logFlowError("deposit:failed", error, { txHash });
|
|
3034
|
-
_optionalChain([onDepositFailed, 'optionalCall',
|
|
3112
|
+
_optionalChain([onDepositFailed, 'optionalCall', _77 => _77({ txHash, error })]);
|
|
3035
3113
|
},
|
|
3036
3114
|
[logFlowError, onDepositFailed]
|
|
3037
3115
|
);
|
|
3038
3116
|
const handleError = _react.useCallback.call(void 0,
|
|
3039
3117
|
(message, code) => {
|
|
3040
3118
|
logFlowError("flow:error", message, { code });
|
|
3041
|
-
_optionalChain([onError, 'optionalCall',
|
|
3119
|
+
_optionalChain([onError, 'optionalCall', _78 => _78({ message, code })]);
|
|
3042
3120
|
},
|
|
3043
3121
|
[logFlowError, onError]
|
|
3044
3122
|
);
|
|
@@ -3084,7 +3162,7 @@ function DepositFlow({
|
|
|
3084
3162
|
if (walletId) {
|
|
3085
3163
|
const selectedOption = walletOptions.find((o) => o.id === walletId);
|
|
3086
3164
|
setSelectedWalletId(walletId);
|
|
3087
|
-
if (_optionalChain([selectedOption, 'optionalAccess',
|
|
3165
|
+
if (_optionalChain([selectedOption, 'optionalAccess', _79 => _79.kind]) === "solana") {
|
|
3088
3166
|
handleSelectSolanaWallet();
|
|
3089
3167
|
} else {
|
|
3090
3168
|
handleSelectProvider();
|
|
@@ -3112,7 +3190,7 @@ function DepositFlow({
|
|
|
3112
3190
|
]);
|
|
3113
3191
|
if (showConnectStep) {
|
|
3114
3192
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3115
|
-
|
|
3193
|
+
_chunk7HJ7IBRHcjs.ConnectStep,
|
|
3116
3194
|
{
|
|
3117
3195
|
walletOptions,
|
|
3118
3196
|
selectedWalletId: selectedWalletIdEffective,
|
|
@@ -3131,7 +3209,7 @@ function DepositFlow({
|
|
|
3131
3209
|
const selectedOption = walletOptions.find(
|
|
3132
3210
|
(o) => o.id === selectedWalletIdEffective
|
|
3133
3211
|
);
|
|
3134
|
-
if (_optionalChain([selectedOption, 'optionalAccess',
|
|
3212
|
+
if (_optionalChain([selectedOption, 'optionalAccess', _80 => _80.kind]) === "solana") {
|
|
3135
3213
|
handleSelectSolanaWallet();
|
|
3136
3214
|
} else {
|
|
3137
3215
|
handleSelectProvider();
|
|
@@ -3172,7 +3250,7 @@ function DepositFlow({
|
|
|
3172
3250
|
}
|
|
3173
3251
|
),
|
|
3174
3252
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3175
|
-
|
|
3253
|
+
_chunk7HJ7IBRHcjs.ProcessingStep,
|
|
3176
3254
|
{
|
|
3177
3255
|
smartAccount: step.smartAccount,
|
|
3178
3256
|
txHash: step.txHash,
|
|
@@ -3197,8 +3275,8 @@ function DepositFlow({
|
|
|
3197
3275
|
}
|
|
3198
3276
|
if (isSolanaWalletMode) {
|
|
3199
3277
|
if (!sessionKeyAddress) return null;
|
|
3200
|
-
const solanaAddr = _optionalChain([reownWallet, 'optionalAccess',
|
|
3201
|
-
const solanaProvider = _optionalChain([reownWallet, 'optionalAccess',
|
|
3278
|
+
const solanaAddr = _optionalChain([reownWallet, 'optionalAccess', _81 => _81.solanaAddress]);
|
|
3279
|
+
const solanaProvider = _optionalChain([reownWallet, 'optionalAccess', _82 => _82.solanaProvider]);
|
|
3202
3280
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
3203
3281
|
step.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3204
3282
|
SetupStep,
|
|
@@ -3232,6 +3310,8 @@ function DepositFlow({
|
|
|
3232
3310
|
token: step.token,
|
|
3233
3311
|
balance: step.balance,
|
|
3234
3312
|
balanceUsd: step.balanceUsd,
|
|
3313
|
+
defaultAmount: step.inputAmountUsd,
|
|
3314
|
+
uiConfig,
|
|
3235
3315
|
onContinue: handleSolanaAmountContinue,
|
|
3236
3316
|
debug
|
|
3237
3317
|
}
|
|
@@ -3243,7 +3323,8 @@ function DepositFlow({
|
|
|
3243
3323
|
solanaAddress: solanaAddr,
|
|
3244
3324
|
solanaDepositAddress: step.solanaDepositAddress,
|
|
3245
3325
|
token: step.token,
|
|
3246
|
-
|
|
3326
|
+
sourceAmount: step.sourceAmount,
|
|
3327
|
+
inputAmountUsd: step.inputAmountUsd,
|
|
3247
3328
|
targetAmount: step.targetAmount,
|
|
3248
3329
|
targetTokenPriceUsd: step.targetTokenPriceUsd,
|
|
3249
3330
|
targetChain,
|
|
@@ -3289,7 +3370,7 @@ function DepositFlow({
|
|
|
3289
3370
|
) })
|
|
3290
3371
|
] }) : null,
|
|
3291
3372
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3292
|
-
|
|
3373
|
+
_chunk7HJ7IBRHcjs.ProcessingStep,
|
|
3293
3374
|
{
|
|
3294
3375
|
smartAccount: step.smartAccount,
|
|
3295
3376
|
txHash: step.txHash,
|
|
@@ -3312,16 +3393,16 @@ function DepositFlow({
|
|
|
3312
3393
|
)
|
|
3313
3394
|
] });
|
|
3314
3395
|
}
|
|
3315
|
-
if (!_optionalChain([signerContext, 'optionalAccess',
|
|
3396
|
+
if (!_optionalChain([signerContext, 'optionalAccess', _83 => _83.walletClient]) || !_optionalChain([signerContext, 'optionalAccess', _84 => _84.publicClient])) {
|
|
3316
3397
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-state", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-text", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: "Connecting wallet..." }) }) }) }) });
|
|
3317
3398
|
}
|
|
3318
3399
|
const ownerAddress = signerContext.ownerAddress;
|
|
3319
|
-
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access',
|
|
3400
|
+
const ownerChainId = _nullishCoalesce(_nullishCoalesce(_optionalChain([signerContext, 'access', _85 => _85.walletClient, 'optionalAccess', _86 => _86.chain, 'optionalAccess', _87 => _87.id]), () => ( _optionalChain([signerContext, 'access', _88 => _88.publicClient, 'access', _89 => _89.chain, 'optionalAccess', _90 => _90.id]))), () => ( targetChain));
|
|
3320
3401
|
const getReadClientForChain = (chainId) => {
|
|
3321
|
-
if (_optionalChain([signerContext, 'access',
|
|
3402
|
+
if (_optionalChain([signerContext, 'access', _91 => _91.publicClient, 'access', _92 => _92.chain, 'optionalAccess', _93 => _93.id]) === chainId) {
|
|
3322
3403
|
return signerContext.publicClient;
|
|
3323
3404
|
}
|
|
3324
|
-
return
|
|
3405
|
+
return _chunk7HJ7IBRHcjs.getPublicClient.call(void 0, chainId);
|
|
3325
3406
|
};
|
|
3326
3407
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
3327
3408
|
step.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3348,6 +3429,7 @@ function DepositFlow({
|
|
|
3348
3429
|
publicClient: getReadClientForChain(ownerChainId),
|
|
3349
3430
|
defaultSourceChain,
|
|
3350
3431
|
defaultSourceToken,
|
|
3432
|
+
allowedRoutes,
|
|
3351
3433
|
service,
|
|
3352
3434
|
onContinue: handleAssetContinue,
|
|
3353
3435
|
onTotalBalanceComputed: handleTotalBalanceComputed,
|
|
@@ -3390,7 +3472,7 @@ function DepositFlow({
|
|
|
3390
3472
|
}
|
|
3391
3473
|
),
|
|
3392
3474
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3393
|
-
|
|
3475
|
+
_chunk7HJ7IBRHcjs.ProcessingStep,
|
|
3394
3476
|
{
|
|
3395
3477
|
smartAccount: step.smartAccount,
|
|
3396
3478
|
txHash: step.txHash,
|
|
@@ -3417,7 +3499,7 @@ function DepositFlow({
|
|
|
3417
3499
|
// src/DepositModal.tsx
|
|
3418
3500
|
|
|
3419
3501
|
var ReownDepositInner = _react.lazy.call(void 0,
|
|
3420
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-
|
|
3502
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-AVQEEWEQ.cjs"))).then((m) => ({ default: m.DepositModalReown }))
|
|
3421
3503
|
);
|
|
3422
3504
|
function DepositModal(props) {
|
|
3423
3505
|
const needsReown = !!props.reownAppId;
|
|
@@ -3454,6 +3536,7 @@ function DepositModalInner({
|
|
|
3454
3536
|
theme,
|
|
3455
3537
|
branding,
|
|
3456
3538
|
uiConfig,
|
|
3539
|
+
allowedRoutes,
|
|
3457
3540
|
className,
|
|
3458
3541
|
onReady,
|
|
3459
3542
|
onConnected,
|
|
@@ -3470,7 +3553,7 @@ function DepositModalInner({
|
|
|
3470
3553
|
const targetChain = _chunkNELAYNA3cjs.getChainId.call(void 0, targetChainProp);
|
|
3471
3554
|
const sourceChain = sourceChainProp ? _chunkNELAYNA3cjs.getChainId.call(void 0, sourceChainProp) : void 0;
|
|
3472
3555
|
const service = _react.useMemo.call(void 0,
|
|
3473
|
-
() =>
|
|
3556
|
+
() => _chunk7HJ7IBRHcjs.createDepositService.call(void 0, backendUrl, {
|
|
3474
3557
|
debug,
|
|
3475
3558
|
debugScope: "service:deposit"
|
|
3476
3559
|
}),
|
|
@@ -3478,7 +3561,7 @@ function DepositModalInner({
|
|
|
3478
3561
|
);
|
|
3479
3562
|
_react.useEffect.call(void 0, () => {
|
|
3480
3563
|
if (isOpen && modalRef.current) {
|
|
3481
|
-
|
|
3564
|
+
_chunk7HJ7IBRHcjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
3482
3565
|
}
|
|
3483
3566
|
}, [isOpen, theme]);
|
|
3484
3567
|
_react.useEffect.call(void 0, () => {
|
|
@@ -3488,7 +3571,7 @@ function DepositModalInner({
|
|
|
3488
3571
|
_react.useEffect.call(void 0, () => {
|
|
3489
3572
|
if (isOpen && !hasCalledReady.current) {
|
|
3490
3573
|
hasCalledReady.current = true;
|
|
3491
|
-
_optionalChain([onReady, 'optionalCall',
|
|
3574
|
+
_optionalChain([onReady, 'optionalCall', _94 => _94()]);
|
|
3492
3575
|
}
|
|
3493
3576
|
}, [isOpen, onReady]);
|
|
3494
3577
|
_react.useEffect.call(void 0, () => {
|
|
@@ -3507,17 +3590,17 @@ function DepositModalInner({
|
|
|
3507
3590
|
setTotalBalanceUsd(balance2);
|
|
3508
3591
|
}, []);
|
|
3509
3592
|
const handleBack = _react.useCallback.call(void 0, () => {
|
|
3510
|
-
_optionalChain([backHandlerRef, 'access',
|
|
3593
|
+
_optionalChain([backHandlerRef, 'access', _95 => _95.current, 'optionalCall', _96 => _96()]);
|
|
3511
3594
|
}, []);
|
|
3512
|
-
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
3513
|
-
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
3514
|
-
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess',
|
|
3515
|
-
const balance = _optionalChain([uiConfig, 'optionalAccess',
|
|
3516
|
-
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess',
|
|
3517
|
-
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess',
|
|
3595
|
+
const showLogo = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _97 => _97.showLogo]), () => ( false));
|
|
3596
|
+
const showStepper = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _98 => _98.showStepper]), () => ( false));
|
|
3597
|
+
const showBackButton = _nullishCoalesce(_optionalChain([uiConfig, 'optionalAccess', _99 => _99.showBackButton]), () => ( true));
|
|
3598
|
+
const balance = _optionalChain([uiConfig, 'optionalAccess', _100 => _100.balance]);
|
|
3599
|
+
const logoUrl = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _101 => _101.logoUrl]), () => ( "https://github.com/rhinestonewtf.png"));
|
|
3600
|
+
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _102 => _102.title]), () => ( "Deposit"));
|
|
3518
3601
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 4 && backHandlerRef.current !== void 0;
|
|
3519
3602
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3520
|
-
|
|
3603
|
+
_chunk7HJ7IBRHcjs.Modal,
|
|
3521
3604
|
{
|
|
3522
3605
|
isOpen,
|
|
3523
3606
|
onClose,
|
|
@@ -3578,7 +3661,7 @@ function DepositModalInner({
|
|
|
3578
3661
|
balance.title,
|
|
3579
3662
|
":"
|
|
3580
3663
|
] }),
|
|
3581
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ?
|
|
3664
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ? _chunk7HJ7IBRHcjs.currencyFormatter.format(totalBalanceUsd) : null))) })
|
|
3582
3665
|
] })
|
|
3583
3666
|
] }),
|
|
3584
3667
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-header-nav-right", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3631,6 +3714,7 @@ function DepositModalInner({
|
|
|
3631
3714
|
onRequestConnect,
|
|
3632
3715
|
connectButtonLabel,
|
|
3633
3716
|
uiConfig,
|
|
3717
|
+
allowedRoutes,
|
|
3634
3718
|
onStepChange: handleStepChange,
|
|
3635
3719
|
onTotalBalanceChange: handleTotalBalanceChange,
|
|
3636
3720
|
onClose,
|