@rhinestone/deposit-modal 0.1.69 → 0.2.0
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-3GU5B776.cjs → DepositModalReown-66DE7NAY.cjs} +3 -3
- package/dist/{DepositModalReown-WN2E3EQ3.mjs → DepositModalReown-PROPLCBI.mjs} +2 -2
- package/dist/{WithdrawModalReown-WIV5IEIW.cjs → WithdrawModalReown-HXTXSZCJ.cjs} +3 -3
- package/dist/{WithdrawModalReown-6ZBCJOPK.mjs → WithdrawModalReown-URF6AERQ.mjs} +2 -2
- package/dist/{chunk-DA3XVDNQ.mjs → chunk-3CRG5NPG.mjs} +44 -0
- package/dist/{chunk-3RV2B6JM.mjs → chunk-7NEVAAPY.mjs} +141 -20
- package/dist/{chunk-2ATEEBQZ.cjs → chunk-7TEGUTU4.cjs} +42 -42
- package/dist/{chunk-P3CGKXXZ.mjs → chunk-TKTOPC2W.mjs} +2 -2
- package/dist/{chunk-6W42ROAB.cjs → chunk-UHQSFV5V.cjs} +244 -123
- package/dist/{chunk-TCILEYM5.cjs → chunk-XW4M7WDI.cjs} +44 -0
- package/dist/deposit.cjs +3 -3
- package/dist/deposit.mjs +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.mjs +3 -3
- package/dist/reown.cjs +4 -4
- package/dist/reown.mjs +3 -3
- package/dist/styles.css +5 -5
- package/dist/withdraw.cjs +3 -3
- package/dist/withdraw.mjs +2 -2
- package/package.json +1 -1
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
var
|
|
31
|
+
var _chunkXW4M7WDIcjs = require('./chunk-XW4M7WDI.cjs');
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
@@ -68,15 +68,15 @@ var _viem = require('viem');
|
|
|
68
68
|
|
|
69
69
|
var _jsxruntime = require('react/jsx-runtime');
|
|
70
70
|
async function resolveSessionOwner(eoaAddress) {
|
|
71
|
-
const localOwner =
|
|
71
|
+
const localOwner = _chunkXW4M7WDIcjs.loadSessionOwnerFromStorage.call(void 0, eoaAddress);
|
|
72
72
|
if (localOwner) {
|
|
73
73
|
return {
|
|
74
|
-
account:
|
|
74
|
+
account: _chunkXW4M7WDIcjs.accountFromPrivateKey.call(void 0, localOwner.privateKey),
|
|
75
75
|
address: localOwner.address
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
-
const created =
|
|
79
|
-
|
|
78
|
+
const created = _chunkXW4M7WDIcjs.createSessionOwnerKey.call(void 0, );
|
|
79
|
+
_chunkXW4M7WDIcjs.saveSessionOwnerToStorage.call(void 0, eoaAddress, created.privateKey, created.address);
|
|
80
80
|
return {
|
|
81
81
|
account: created.account,
|
|
82
82
|
address: created.address
|
|
@@ -115,7 +115,7 @@ function SetupStep({
|
|
|
115
115
|
const setup = await service.setupAccount({
|
|
116
116
|
ownerAddress: address,
|
|
117
117
|
sessionOwnerAddress: sessionOwner.address,
|
|
118
|
-
targetChain:
|
|
118
|
+
targetChain: _chunkXW4M7WDIcjs.toEvmCaip2.call(void 0, targetChain),
|
|
119
119
|
targetToken,
|
|
120
120
|
recipient,
|
|
121
121
|
postBridgeActions,
|
|
@@ -149,7 +149,7 @@ function SetupStep({
|
|
|
149
149
|
primaryType: typedData.primaryType,
|
|
150
150
|
message: typedData.message
|
|
151
151
|
});
|
|
152
|
-
const sessionDetails =
|
|
152
|
+
const sessionDetails = _chunkXW4M7WDIcjs.buildSessionDetails.call(void 0, setup.sessionDetailsUnsigned, signature);
|
|
153
153
|
setState({ type: "registering" });
|
|
154
154
|
const registerResult = await service.registerAccount({
|
|
155
155
|
address: smartAccount,
|
|
@@ -161,7 +161,7 @@ function SetupStep({
|
|
|
161
161
|
eoaAddress: address,
|
|
162
162
|
sessionOwner: sessionOwner.address,
|
|
163
163
|
target: {
|
|
164
|
-
chain:
|
|
164
|
+
chain: _chunkXW4M7WDIcjs.toEvmCaip2.call(void 0, targetChain),
|
|
165
165
|
token: targetToken,
|
|
166
166
|
...recipient && { recipient },
|
|
167
167
|
..._optionalChain([postBridgeActions, 'optionalAccess', _2 => _2.length]) && { postBridgeActions },
|
|
@@ -230,7 +230,7 @@ function SetupStep({
|
|
|
230
230
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
231
231
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", children: [
|
|
232
232
|
isLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
233
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
233
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXW4M7WDIcjs.Spinner, { className: "rs-spinner--lg rs-text-accent" }),
|
|
234
234
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-text", children: [
|
|
235
235
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-title", children: renderStateMessage() }),
|
|
236
236
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-loading-subtitle", children: "This may take a moment" })
|
|
@@ -267,7 +267,7 @@ function SetupStep({
|
|
|
267
267
|
] })
|
|
268
268
|
] })
|
|
269
269
|
] }),
|
|
270
|
-
isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
270
|
+
isError && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXW4M7WDIcjs.Button, { onClick: handleRetry, variant: "default", fullWidth: true, children: "Try Again" }) })
|
|
271
271
|
] });
|
|
272
272
|
}
|
|
273
273
|
|
|
@@ -293,7 +293,7 @@ function AssetSelectStep({
|
|
|
293
293
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
294
294
|
const defaultAssetId = _react.useMemo.call(void 0, () => {
|
|
295
295
|
if (!defaultSourceChain || !defaultSourceToken) return null;
|
|
296
|
-
return
|
|
296
|
+
return _chunkXW4M7WDIcjs.getAssetId.call(void 0, {
|
|
297
297
|
chainId: defaultSourceChain,
|
|
298
298
|
token: defaultSourceToken
|
|
299
299
|
});
|
|
@@ -310,7 +310,7 @@ function AssetSelectStep({
|
|
|
310
310
|
try {
|
|
311
311
|
const portfolio = await service.fetchPortfolio(address);
|
|
312
312
|
if (!active) return;
|
|
313
|
-
const portfolioAssets =
|
|
313
|
+
const portfolioAssets = _chunkXW4M7WDIcjs.portfolioToAssets.call(void 0, portfolio.tokens);
|
|
314
314
|
setAssets(portfolioAssets);
|
|
315
315
|
const hasNative = portfolioAssets.some(
|
|
316
316
|
(asset) => asset.token.toLowerCase() === _chunkMUWVDVY4cjs.NATIVE_TOKEN_ADDRESS
|
|
@@ -391,7 +391,7 @@ function AssetSelectStep({
|
|
|
391
391
|
const raw = _viem.formatUnits.call(void 0, BigInt(asset.balance), asset.decimals);
|
|
392
392
|
const numeric = Number(raw);
|
|
393
393
|
if (!Number.isFinite(numeric)) return raw;
|
|
394
|
-
return
|
|
394
|
+
return _chunkXW4M7WDIcjs.tokenFormatter.format(numeric);
|
|
395
395
|
} catch (e3) {
|
|
396
396
|
return asset.balance;
|
|
397
397
|
}
|
|
@@ -405,7 +405,7 @@ function AssetSelectStep({
|
|
|
405
405
|
style: { paddingTop: 4, overflow: "auto", maxHeight: 340 },
|
|
406
406
|
children: [
|
|
407
407
|
loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
408
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
408
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXW4M7WDIcjs.Spinner, { className: "rs-text-tertiary" }),
|
|
409
409
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
410
410
|
] }),
|
|
411
411
|
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 }) }),
|
|
@@ -504,7 +504,7 @@ function AssetSelectStep({
|
|
|
504
504
|
] })
|
|
505
505
|
] })
|
|
506
506
|
] }),
|
|
507
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ?
|
|
507
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: asset.balanceUsd !== void 0 && asset.balanceUsd > 0 ? _chunkXW4M7WDIcjs.currencyFormatter.format(asset.balanceUsd) : tokenAmount !== "--" ? `${tokenAmount} ${asset.symbol}` : "--" })
|
|
508
508
|
]
|
|
509
509
|
},
|
|
510
510
|
asset.id
|
|
@@ -514,7 +514,7 @@ function AssetSelectStep({
|
|
|
514
514
|
}
|
|
515
515
|
),
|
|
516
516
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
517
|
-
|
|
517
|
+
_chunkXW4M7WDIcjs.Button,
|
|
518
518
|
{
|
|
519
519
|
onClick: () => selectedAsset && onContinue(selectedAsset),
|
|
520
520
|
disabled: !selectedAsset,
|
|
@@ -522,7 +522,7 @@ function AssetSelectStep({
|
|
|
522
522
|
children: "Continue"
|
|
523
523
|
}
|
|
524
524
|
) }),
|
|
525
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
525
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXW4M7WDIcjs.PoweredBy, {})
|
|
526
526
|
] });
|
|
527
527
|
}
|
|
528
528
|
async function fetchNativeAssets(address, publicClient, existing) {
|
|
@@ -530,7 +530,7 @@ async function fetchNativeAssets(address, publicClient, existing) {
|
|
|
530
530
|
const connectedChainId = _optionalChain([publicClient, 'access', _12 => _12.chain, 'optionalAccess', _13 => _13.id]);
|
|
531
531
|
if (!connectedChainId) return [];
|
|
532
532
|
if (!_chunkMUWVDVY4cjs.SOURCE_CHAINS.some((chain) => chain.id === connectedChainId)) return [];
|
|
533
|
-
const id =
|
|
533
|
+
const id = _chunkXW4M7WDIcjs.getAssetId.call(void 0, {
|
|
534
534
|
chainId: connectedChainId,
|
|
535
535
|
token: _chunkMUWVDVY4cjs.NATIVE_TOKEN_ADDRESS
|
|
536
536
|
});
|
|
@@ -582,12 +582,14 @@ function AmountStep({
|
|
|
582
582
|
tokenPriceUsdOverride,
|
|
583
583
|
onBalanceUsdChange,
|
|
584
584
|
onContinue,
|
|
585
|
-
onCtaClick
|
|
585
|
+
onCtaClick,
|
|
586
|
+
service
|
|
586
587
|
}) {
|
|
587
588
|
const [amount, setAmount] = _react.useState.call(void 0, "");
|
|
588
589
|
const [balance, setBalance] = _react.useState.call(void 0, null);
|
|
589
590
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
590
591
|
const [isSwitching, setIsSwitching] = _react.useState.call(void 0, false);
|
|
592
|
+
const [isCheckingLiquidity, setIsCheckingLiquidity] = _react.useState.call(void 0, false);
|
|
591
593
|
const hasAttemptedSwitch = _react.useRef.call(void 0, false);
|
|
592
594
|
const chainMismatch = Boolean(
|
|
593
595
|
_optionalChain([walletClient, 'optionalAccess', _14 => _14.chain, 'optionalAccess', _15 => _15.id]) && walletClient.chain.id !== asset.chainId
|
|
@@ -617,7 +619,7 @@ function AmountStep({
|
|
|
617
619
|
const balanceTarget = _nullishCoalesce(balanceAddress, () => ( address));
|
|
618
620
|
if (!balanceTarget || !publicClient) return;
|
|
619
621
|
try {
|
|
620
|
-
const bal =
|
|
622
|
+
const bal = _chunkXW4M7WDIcjs.isNativeAsset.call(void 0, asset) ? await publicClient.getBalance({ address: balanceTarget }) : await publicClient.readContract({
|
|
621
623
|
address: asset.token,
|
|
622
624
|
abi: _viem.erc20Abi,
|
|
623
625
|
functionName: "balanceOf",
|
|
@@ -643,7 +645,7 @@ function AmountStep({
|
|
|
643
645
|
setIsSwitching(true);
|
|
644
646
|
switchChain(asset.chainId).catch((err) => {
|
|
645
647
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
646
|
-
setError(
|
|
648
|
+
setError(_chunkXW4M7WDIcjs.formatUserError.call(void 0, raw));
|
|
647
649
|
}).finally(() => {
|
|
648
650
|
setIsSwitching(false);
|
|
649
651
|
});
|
|
@@ -679,7 +681,7 @@ function AmountStep({
|
|
|
679
681
|
const raw = _viem.formatUnits.call(void 0, balance, asset.decimals);
|
|
680
682
|
const numeric = Number(raw);
|
|
681
683
|
if (!Number.isFinite(numeric)) return raw;
|
|
682
|
-
return
|
|
684
|
+
return _chunkXW4M7WDIcjs.tokenFormatter.format(numeric);
|
|
683
685
|
} catch (e8) {
|
|
684
686
|
return "...";
|
|
685
687
|
}
|
|
@@ -707,7 +709,7 @@ function AmountStep({
|
|
|
707
709
|
}
|
|
708
710
|
if (error) setError(null);
|
|
709
711
|
};
|
|
710
|
-
const handleContinue = () => {
|
|
712
|
+
const handleContinue = async () => {
|
|
711
713
|
const numericAmount = parseFloat(amount);
|
|
712
714
|
if (isNaN(numericAmount) || numericAmount <= 0) {
|
|
713
715
|
setError("Please enter a valid amount");
|
|
@@ -723,7 +725,7 @@ function AmountStep({
|
|
|
723
725
|
const usdValue = numericAmount;
|
|
724
726
|
if (_optionalChain([uiConfig, 'optionalAccess', _18 => _18.maxDepositUsd]) && usdValue > uiConfig.maxDepositUsd) {
|
|
725
727
|
setError(
|
|
726
|
-
`Maximum deposit is ${
|
|
728
|
+
`Maximum deposit is ${_chunkXW4M7WDIcjs.currencyFormatter.format(uiConfig.maxDepositUsd)}`
|
|
727
729
|
);
|
|
728
730
|
return;
|
|
729
731
|
}
|
|
@@ -747,7 +749,34 @@ function AmountStep({
|
|
|
747
749
|
}
|
|
748
750
|
setError(null);
|
|
749
751
|
_optionalChain([onCtaClick, 'optionalCall', _20 => _20("continue")]);
|
|
750
|
-
|
|
752
|
+
setIsCheckingLiquidity(true);
|
|
753
|
+
let liquidityWarning;
|
|
754
|
+
try {
|
|
755
|
+
const liquidity = await service.checkLiquidity({
|
|
756
|
+
sourceChainId: asset.chainId,
|
|
757
|
+
sourceToken: asset.token,
|
|
758
|
+
destinationChainId: targetChain,
|
|
759
|
+
destinationToken: targetToken,
|
|
760
|
+
amount: amountInUnits.toString()
|
|
761
|
+
});
|
|
762
|
+
if (liquidity.unlimited || liquidity.hasLiquidity) {
|
|
763
|
+
liquidityWarning = void 0;
|
|
764
|
+
} else if (liquidity.maxAmount !== null) {
|
|
765
|
+
liquidityWarning = {
|
|
766
|
+
kind: "low",
|
|
767
|
+
maxAmount: liquidity.maxAmount,
|
|
768
|
+
decimals: liquidity.decimals,
|
|
769
|
+
symbol: liquidity.symbol
|
|
770
|
+
};
|
|
771
|
+
} else {
|
|
772
|
+
liquidityWarning = { kind: "unavailable" };
|
|
773
|
+
}
|
|
774
|
+
} catch (e11) {
|
|
775
|
+
liquidityWarning = { kind: "check-failed" };
|
|
776
|
+
} finally {
|
|
777
|
+
setIsCheckingLiquidity(false);
|
|
778
|
+
}
|
|
779
|
+
onContinue(tokenAmountStr, amount, _nullishCoalesce(balance, () => ( void 0)), liquidityWarning);
|
|
751
780
|
};
|
|
752
781
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step", children: [
|
|
753
782
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-step-body", style: { paddingTop: 0 }, children: [
|
|
@@ -778,7 +807,7 @@ function AmountStep({
|
|
|
778
807
|
hasPricing && balanceUsd !== null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { style: { color: "var(--rs-muted-foreground)" }, children: [
|
|
779
808
|
" ",
|
|
780
809
|
"(",
|
|
781
|
-
|
|
810
|
+
_chunkXW4M7WDIcjs.currencyFormatter.format(balanceUsd),
|
|
782
811
|
")"
|
|
783
812
|
] })
|
|
784
813
|
] }) })
|
|
@@ -915,7 +944,7 @@ function AmountStep({
|
|
|
915
944
|
)
|
|
916
945
|
] }),
|
|
917
946
|
_optionalChain([uiConfig, 'optionalAccess', _21 => _21.minDepositUsd]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-minimum", children: [
|
|
918
|
-
|
|
947
|
+
_chunkXW4M7WDIcjs.currencyFormatter.format(uiConfig.minDepositUsd),
|
|
919
948
|
" minimum deposit"
|
|
920
949
|
] }),
|
|
921
950
|
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error", children: [
|
|
@@ -941,15 +970,15 @@ function AmountStep({
|
|
|
941
970
|
] })
|
|
942
971
|
] }),
|
|
943
972
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
944
|
-
|
|
973
|
+
_chunkXW4M7WDIcjs.Button,
|
|
945
974
|
{
|
|
946
975
|
onClick: handleContinue,
|
|
947
976
|
fullWidth: true,
|
|
948
|
-
disabled: !amount || chainMismatch,
|
|
949
|
-
children: _optionalChain([uiConfig, 'optionalAccess', _22 => _22.minDepositUsd]) && parseFloat(amount) > 0 && parseFloat(amount) < uiConfig.minDepositUsd ? "Update order" : "Continue"
|
|
977
|
+
disabled: !amount || chainMismatch || isCheckingLiquidity,
|
|
978
|
+
children: isCheckingLiquidity ? "Checking liquidity\u2026" : _optionalChain([uiConfig, 'optionalAccess', _22 => _22.minDepositUsd]) && parseFloat(amount) > 0 && parseFloat(amount) < uiConfig.minDepositUsd ? "Update order" : "Continue"
|
|
950
979
|
}
|
|
951
980
|
) }),
|
|
952
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
981
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXW4M7WDIcjs.PoweredBy, {})
|
|
953
982
|
] });
|
|
954
983
|
}
|
|
955
984
|
|
|
@@ -970,6 +999,7 @@ function ConfirmStep({
|
|
|
970
999
|
targetChain,
|
|
971
1000
|
targetToken,
|
|
972
1001
|
switchChain,
|
|
1002
|
+
liquidityWarning,
|
|
973
1003
|
onConfirm,
|
|
974
1004
|
onError,
|
|
975
1005
|
onDepositSubmitted
|
|
@@ -999,7 +1029,7 @@ function ConfirmStep({
|
|
|
999
1029
|
setIsSwitching(true);
|
|
1000
1030
|
switchChain(asset.chainId).catch((err) => {
|
|
1001
1031
|
const raw = err instanceof Error ? err.message : "Failed to switch chain";
|
|
1002
|
-
setError(
|
|
1032
|
+
setError(_chunkXW4M7WDIcjs.formatUserError.call(void 0, raw));
|
|
1003
1033
|
}).finally(() => {
|
|
1004
1034
|
setIsSwitching(false);
|
|
1005
1035
|
});
|
|
@@ -1025,7 +1055,7 @@ function ConfirmStep({
|
|
|
1025
1055
|
let amountUnits;
|
|
1026
1056
|
try {
|
|
1027
1057
|
amountUnits = _viem.parseUnits.call(void 0, amount, asset.decimals);
|
|
1028
|
-
} catch (
|
|
1058
|
+
} catch (e12) {
|
|
1029
1059
|
setError("Please enter a valid amount");
|
|
1030
1060
|
return;
|
|
1031
1061
|
}
|
|
@@ -1042,7 +1072,7 @@ function ConfirmStep({
|
|
|
1042
1072
|
throw new Error("Wallet not properly connected");
|
|
1043
1073
|
}
|
|
1044
1074
|
const transferTo = sameRoute ? recipient : smartAccount;
|
|
1045
|
-
const hash =
|
|
1075
|
+
const hash = _chunkXW4M7WDIcjs.isNativeAsset.call(void 0, asset) ? await walletClient.sendTransaction({
|
|
1046
1076
|
account,
|
|
1047
1077
|
chain,
|
|
1048
1078
|
to: transferTo,
|
|
@@ -1059,7 +1089,7 @@ function ConfirmStep({
|
|
|
1059
1089
|
onConfirm(hash, asset.chainId, amountUnits.toString(), asset.token);
|
|
1060
1090
|
} catch (err) {
|
|
1061
1091
|
const raw = err instanceof Error ? err.message : "Transfer failed";
|
|
1062
|
-
const message =
|
|
1092
|
+
const message = _chunkXW4M7WDIcjs.formatUserError.call(void 0, raw);
|
|
1063
1093
|
setError(message);
|
|
1064
1094
|
_optionalChain([onError, 'optionalCall', _26 => _26(message, "TRANSFER_ERROR")]);
|
|
1065
1095
|
} finally {
|
|
@@ -1165,6 +1195,19 @@ function ConfirmStep({
|
|
|
1165
1195
|
)
|
|
1166
1196
|
] })
|
|
1167
1197
|
] }),
|
|
1198
|
+
liquidityWarning && (liquidityWarning.kind === "unavailable" || liquidityWarning.kind === "check-failed") && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1199
|
+
"div",
|
|
1200
|
+
{
|
|
1201
|
+
style: {
|
|
1202
|
+
fontSize: 11,
|
|
1203
|
+
color: "var(--color-amber8)",
|
|
1204
|
+
marginTop: 8,
|
|
1205
|
+
textAlign: "center",
|
|
1206
|
+
opacity: 0.85
|
|
1207
|
+
},
|
|
1208
|
+
children: liquidityWarning.kind === "unavailable" ? "Route may be unavailable" : "Liquidity check failed"
|
|
1209
|
+
}
|
|
1210
|
+
),
|
|
1168
1211
|
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-alert rs-alert--error", children: [
|
|
1169
1212
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1170
1213
|
"svg",
|
|
@@ -1188,7 +1231,7 @@ function ConfirmStep({
|
|
|
1188
1231
|
] })
|
|
1189
1232
|
] }),
|
|
1190
1233
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1191
|
-
|
|
1234
|
+
_chunkXW4M7WDIcjs.Button,
|
|
1192
1235
|
{
|
|
1193
1236
|
onClick: handleConfirm,
|
|
1194
1237
|
loading: isSubmitting,
|
|
@@ -1197,13 +1240,14 @@ function ConfirmStep({
|
|
|
1197
1240
|
children: "Confirm Order"
|
|
1198
1241
|
}
|
|
1199
1242
|
) }),
|
|
1200
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1243
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXW4M7WDIcjs.PoweredBy, {})
|
|
1201
1244
|
] });
|
|
1202
1245
|
}
|
|
1203
1246
|
|
|
1204
1247
|
// src/components/steps/DepositAddressStep.tsx
|
|
1205
1248
|
|
|
1206
1249
|
|
|
1250
|
+
|
|
1207
1251
|
// src/components/ui/QRCode.tsx
|
|
1208
1252
|
var _reactqrcodelogo = require('react-qrcode-logo');
|
|
1209
1253
|
|
|
@@ -1334,9 +1378,9 @@ var INITIAL_POLL_INTERVAL = 3e3;
|
|
|
1334
1378
|
var MAX_POLL_INTERVAL = 3e4;
|
|
1335
1379
|
var BACKOFF_MULTIPLIER = 1.5;
|
|
1336
1380
|
function isEventForTx(event, txHash) {
|
|
1337
|
-
const eventTxHash =
|
|
1381
|
+
const eventTxHash = _chunkXW4M7WDIcjs.getEventTxHash.call(void 0, event);
|
|
1338
1382
|
if (!eventTxHash) return false;
|
|
1339
|
-
return
|
|
1383
|
+
return _chunkXW4M7WDIcjs.txRefsMatch.call(void 0, eventTxHash, txHash);
|
|
1340
1384
|
}
|
|
1341
1385
|
function truncateHash(hash) {
|
|
1342
1386
|
return `${hash.slice(0, 4)}\u2026${hash.slice(-4)}`;
|
|
@@ -1430,7 +1474,7 @@ function DepositNotification({
|
|
|
1430
1474
|
const pollIntervalRef = _react.useRef.call(void 0, INITIAL_POLL_INTERVAL);
|
|
1431
1475
|
const pollTimeoutRef = _react.useRef.call(void 0, null);
|
|
1432
1476
|
const completedRef = _react.useRef.call(void 0, _nullishCoalesce(directTransfer, () => ( false)));
|
|
1433
|
-
const depositContextRef =
|
|
1477
|
+
const depositContextRef = _chunkXW4M7WDIcjs.useLatestRef.call(void 0, {
|
|
1434
1478
|
amount,
|
|
1435
1479
|
sourceChain,
|
|
1436
1480
|
sourceToken: token,
|
|
@@ -1439,8 +1483,8 @@ function DepositNotification({
|
|
|
1439
1483
|
waitForFinalTx,
|
|
1440
1484
|
hasPostBridgeActions
|
|
1441
1485
|
});
|
|
1442
|
-
const onCompleteRef =
|
|
1443
|
-
const onFailedRef =
|
|
1486
|
+
const onCompleteRef = _chunkXW4M7WDIcjs.useLatestRef.call(void 0, onComplete);
|
|
1487
|
+
const onFailedRef = _chunkXW4M7WDIcjs.useLatestRef.call(void 0, onFailed);
|
|
1444
1488
|
const handleComplete = _react.useCallback.call(void 0,
|
|
1445
1489
|
(destTxHash) => {
|
|
1446
1490
|
if (completedRef.current) return;
|
|
@@ -1510,7 +1554,7 @@ function DepositNotification({
|
|
|
1510
1554
|
return;
|
|
1511
1555
|
}
|
|
1512
1556
|
scheduleNextPoll();
|
|
1513
|
-
} catch (
|
|
1557
|
+
} catch (e13) {
|
|
1514
1558
|
scheduleNextPoll();
|
|
1515
1559
|
}
|
|
1516
1560
|
}
|
|
@@ -1577,7 +1621,7 @@ function DepositNotification({
|
|
|
1577
1621
|
}
|
|
1578
1622
|
)
|
|
1579
1623
|
}
|
|
1580
|
-
) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--processing", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1624
|
+
) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-deposit-notification-badge rs-deposit-notification-badge--processing", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXW4M7WDIcjs.Spinner, {}) });
|
|
1581
1625
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1582
1626
|
"div",
|
|
1583
1627
|
{
|
|
@@ -1949,6 +1993,59 @@ function DepositAddressStep({
|
|
|
1949
1993
|
sourceSymbol: sourceTokenSymbol
|
|
1950
1994
|
};
|
|
1951
1995
|
}, [sourceChainId, sourceTokenSymbol, isSolana]);
|
|
1996
|
+
const [liquidityHelper, setLiquidityHelper] = _react.useState.call(void 0, {
|
|
1997
|
+
kind: "idle"
|
|
1998
|
+
});
|
|
1999
|
+
_react.useEffect.call(void 0, () => {
|
|
2000
|
+
if (isSolana) {
|
|
2001
|
+
setLiquidityHelper({ kind: "idle" });
|
|
2002
|
+
return;
|
|
2003
|
+
}
|
|
2004
|
+
const sourceTokenAddress = _chunkMUWVDVY4cjs.getTokenAddress.call(void 0,
|
|
2005
|
+
sourceTokenSymbol,
|
|
2006
|
+
sourceChainId
|
|
2007
|
+
);
|
|
2008
|
+
if (!sourceTokenAddress) {
|
|
2009
|
+
setLiquidityHelper({ kind: "idle" });
|
|
2010
|
+
return;
|
|
2011
|
+
}
|
|
2012
|
+
let cancelled = false;
|
|
2013
|
+
setLiquidityHelper({ kind: "loading" });
|
|
2014
|
+
service.checkLiquidity({
|
|
2015
|
+
sourceChainId,
|
|
2016
|
+
sourceToken: sourceTokenAddress,
|
|
2017
|
+
destinationChainId: targetChain,
|
|
2018
|
+
destinationToken: targetToken,
|
|
2019
|
+
amount: "1"
|
|
2020
|
+
}).then((result) => {
|
|
2021
|
+
if (cancelled) return;
|
|
2022
|
+
if (result.unlimited) {
|
|
2023
|
+
setLiquidityHelper({ kind: "unlimited" });
|
|
2024
|
+
} else if (result.maxAmount === null) {
|
|
2025
|
+
setLiquidityHelper({ kind: "unavailable" });
|
|
2026
|
+
} else {
|
|
2027
|
+
setLiquidityHelper({
|
|
2028
|
+
kind: "max",
|
|
2029
|
+
maxAmount: result.maxAmount,
|
|
2030
|
+
decimals: result.decimals,
|
|
2031
|
+
symbol: result.symbol || sourceTokenSymbol
|
|
2032
|
+
});
|
|
2033
|
+
}
|
|
2034
|
+
}).catch(() => {
|
|
2035
|
+
if (cancelled) return;
|
|
2036
|
+
setLiquidityHelper({ kind: "error" });
|
|
2037
|
+
});
|
|
2038
|
+
return () => {
|
|
2039
|
+
cancelled = true;
|
|
2040
|
+
};
|
|
2041
|
+
}, [
|
|
2042
|
+
isSolana,
|
|
2043
|
+
sourceChainId,
|
|
2044
|
+
sourceTokenSymbol,
|
|
2045
|
+
targetChain,
|
|
2046
|
+
targetToken,
|
|
2047
|
+
service
|
|
2048
|
+
]);
|
|
1952
2049
|
const displayAddress = isSolana && solanaDepositAddress ? solanaDepositAddress : smartAccount;
|
|
1953
2050
|
_react.useEffect.call(void 0, () => {
|
|
1954
2051
|
if (!chainDropdownOpen && !tokenDropdownOpen) return;
|
|
@@ -1974,7 +2071,7 @@ function DepositAddressStep({
|
|
|
1974
2071
|
await navigator.clipboard.writeText(displayAddress);
|
|
1975
2072
|
setCopied(true);
|
|
1976
2073
|
setTimeout(() => setCopied(false), 2e3);
|
|
1977
|
-
} catch (
|
|
2074
|
+
} catch (e14) {
|
|
1978
2075
|
const textarea = document.createElement("textarea");
|
|
1979
2076
|
textarea.value = displayAddress;
|
|
1980
2077
|
textarea.style.position = "fixed";
|
|
@@ -2028,10 +2125,10 @@ function DepositAddressStep({
|
|
|
2028
2125
|
return;
|
|
2029
2126
|
}
|
|
2030
2127
|
const event = status.lastEvent;
|
|
2031
|
-
const eventTxHash =
|
|
2128
|
+
const eventTxHash = _chunkXW4M7WDIcjs.isDepositEvent.call(void 0, event) ? _nullishCoalesce(_chunkXW4M7WDIcjs.getEventTxHash.call(void 0, event), () => ( null)) : null;
|
|
2032
2129
|
if (baselineTxHashRef.current === void 0) {
|
|
2033
2130
|
baselineTxHashRef.current = eventTxHash;
|
|
2034
|
-
} else if (eventTxHash && (!baselineTxHashRef.current || !
|
|
2131
|
+
} else if (eventTxHash && (!baselineTxHashRef.current || !_chunkXW4M7WDIcjs.txRefsMatch.call(void 0, eventTxHash, baselineTxHashRef.current))) {
|
|
2035
2132
|
const details = getDepositEventDetails(event);
|
|
2036
2133
|
const fallback = sourceSelectionRef.current;
|
|
2037
2134
|
const chainId = _nullishCoalesce(details.chainId, () => ( fallback.chainId));
|
|
@@ -2376,7 +2473,7 @@ function DepositAddressStep({
|
|
|
2376
2473
|
] }) }),
|
|
2377
2474
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-price-impact-label", children: [
|
|
2378
2475
|
"Max slippage: ",
|
|
2379
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "
|
|
2476
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "0.2%" })
|
|
2380
2477
|
] }),
|
|
2381
2478
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2382
2479
|
Tooltip,
|
|
@@ -2399,6 +2496,27 @@ function DepositAddressStep({
|
|
|
2399
2496
|
"Processing time: ",
|
|
2400
2497
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: "< 1 min" })
|
|
2401
2498
|
] })
|
|
2499
|
+
] }),
|
|
2500
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-price-impact-row", children: [
|
|
2501
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", children: [
|
|
2502
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "circle", { cx: "12", cy: "12", r: "9" }),
|
|
2503
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2504
|
+
"path",
|
|
2505
|
+
{
|
|
2506
|
+
strokeLinecap: "round",
|
|
2507
|
+
strokeLinejoin: "round",
|
|
2508
|
+
d: "M8 12h8M12 8v8"
|
|
2509
|
+
}
|
|
2510
|
+
)
|
|
2511
|
+
] }) }),
|
|
2512
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "rs-price-impact-label", children: [
|
|
2513
|
+
"Max deposit:",
|
|
2514
|
+
" ",
|
|
2515
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "strong", { children: liquidityHelper.kind === "max" ? `${_viem.formatUnits.call(void 0,
|
|
2516
|
+
BigInt(liquidityHelper.maxAmount),
|
|
2517
|
+
liquidityHelper.decimals
|
|
2518
|
+
)} ${liquidityHelper.symbol}` : liquidityHelper.kind === "unlimited" ? "Unlimited" : liquidityHelper.kind === "unavailable" ? "Unavailable" : liquidityHelper.kind === "error" ? "\u2014" : "\u2026" })
|
|
2519
|
+
] })
|
|
2402
2520
|
] })
|
|
2403
2521
|
] }) })
|
|
2404
2522
|
]
|
|
@@ -2422,7 +2540,7 @@ function DepositAddressStep({
|
|
|
2422
2540
|
},
|
|
2423
2541
|
deposit.id
|
|
2424
2542
|
)) }),
|
|
2425
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2543
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXW4M7WDIcjs.PoweredBy, {})
|
|
2426
2544
|
] });
|
|
2427
2545
|
}
|
|
2428
2546
|
DepositAddressStep.displayName = "DepositAddressStep";
|
|
@@ -2453,7 +2571,7 @@ function SolanaTokenSelectStep({
|
|
|
2453
2571
|
setError(null);
|
|
2454
2572
|
const portfolioBySymbol = {};
|
|
2455
2573
|
try {
|
|
2456
|
-
|
|
2574
|
+
_chunkXW4M7WDIcjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:request", {
|
|
2457
2575
|
solanaAddress
|
|
2458
2576
|
});
|
|
2459
2577
|
const portfolio = await service.fetchSolanaPortfolio(solanaAddress);
|
|
@@ -2464,7 +2582,7 @@ function SolanaTokenSelectStep({
|
|
|
2464
2582
|
let parsed = 0n;
|
|
2465
2583
|
try {
|
|
2466
2584
|
parsed = BigInt(t.balance || "0");
|
|
2467
|
-
} catch (
|
|
2585
|
+
} catch (e15) {
|
|
2468
2586
|
parsed = 0n;
|
|
2469
2587
|
}
|
|
2470
2588
|
if (parsed <= 0n) continue;
|
|
@@ -2476,12 +2594,12 @@ function SolanaTokenSelectStep({
|
|
|
2476
2594
|
};
|
|
2477
2595
|
}
|
|
2478
2596
|
}
|
|
2479
|
-
|
|
2597
|
+
_chunkXW4M7WDIcjs.debugLog.call(void 0, debug, "solana-token-select", "portfolio:success", {
|
|
2480
2598
|
symbols: Object.keys(portfolioBySymbol)
|
|
2481
2599
|
});
|
|
2482
2600
|
} catch (err) {
|
|
2483
2601
|
if (!active) return;
|
|
2484
|
-
|
|
2602
|
+
_chunkXW4M7WDIcjs.debugError.call(void 0, debug, "solana-token-select", "portfolio:failure", err, {
|
|
2485
2603
|
solanaAddress
|
|
2486
2604
|
});
|
|
2487
2605
|
setError(
|
|
@@ -2535,7 +2653,7 @@ function SolanaTokenSelectStep({
|
|
|
2535
2653
|
style: { paddingTop: 4, overflow: "auto", maxHeight: 340 },
|
|
2536
2654
|
children: [
|
|
2537
2655
|
loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-loading-state", style: { padding: "40px 12px" }, children: [
|
|
2538
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2656
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXW4M7WDIcjs.Spinner, { className: "rs-text-tertiary" }),
|
|
2539
2657
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-text-sm rs-text-tertiary", children: "Loading balances" })
|
|
2540
2658
|
] }),
|
|
2541
2659
|
!loading && rows.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-empty-state", children: [
|
|
@@ -2572,8 +2690,8 @@ function SolanaTokenSelectStep({
|
|
|
2572
2690
|
try {
|
|
2573
2691
|
const raw = _viem.formatUnits.call(void 0, entry.balance, entry.token.decimals);
|
|
2574
2692
|
const numeric = Number(raw);
|
|
2575
|
-
formattedBalance = Number.isFinite(numeric) ?
|
|
2576
|
-
} catch (
|
|
2693
|
+
formattedBalance = Number.isFinite(numeric) ? _chunkXW4M7WDIcjs.tokenFormatter.format(numeric) : raw;
|
|
2694
|
+
} catch (e16) {
|
|
2577
2695
|
formattedBalance = "...";
|
|
2578
2696
|
}
|
|
2579
2697
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
@@ -2616,7 +2734,7 @@ function SolanaTokenSelectStep({
|
|
|
2616
2734
|
] })
|
|
2617
2735
|
] })
|
|
2618
2736
|
] }),
|
|
2619
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ?
|
|
2737
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-asset-balance", children: entry.balanceUsd > 0 ? _chunkXW4M7WDIcjs.currencyFormatter.format(entry.balanceUsd) : `${formattedBalance} ${entry.token.symbol}` })
|
|
2620
2738
|
]
|
|
2621
2739
|
},
|
|
2622
2740
|
entry.token.symbol
|
|
@@ -2626,7 +2744,7 @@ function SolanaTokenSelectStep({
|
|
|
2626
2744
|
}
|
|
2627
2745
|
),
|
|
2628
2746
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2629
|
-
|
|
2747
|
+
_chunkXW4M7WDIcjs.Button,
|
|
2630
2748
|
{
|
|
2631
2749
|
onClick: () => selectedEntry && onContinue(
|
|
2632
2750
|
selectedEntry.token,
|
|
@@ -2638,7 +2756,7 @@ function SolanaTokenSelectStep({
|
|
|
2638
2756
|
children: "Continue"
|
|
2639
2757
|
}
|
|
2640
2758
|
) }),
|
|
2641
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2759
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXW4M7WDIcjs.PoweredBy, {})
|
|
2642
2760
|
] });
|
|
2643
2761
|
}
|
|
2644
2762
|
|
|
@@ -2668,7 +2786,7 @@ function SolanaAmountStep({
|
|
|
2668
2786
|
}
|
|
2669
2787
|
const price = balanceUsd / balanceUnits;
|
|
2670
2788
|
return price > 0 ? price : null;
|
|
2671
|
-
} catch (
|
|
2789
|
+
} catch (e17) {
|
|
2672
2790
|
return null;
|
|
2673
2791
|
}
|
|
2674
2792
|
}, [isSourceStablecoin, balance, token.decimals, balanceUsd]);
|
|
@@ -2686,8 +2804,8 @@ function SolanaAmountStep({
|
|
|
2686
2804
|
const raw = _viem.formatUnits.call(void 0, balance, token.decimals);
|
|
2687
2805
|
const numeric = Number(raw);
|
|
2688
2806
|
if (!Number.isFinite(numeric)) return raw;
|
|
2689
|
-
return
|
|
2690
|
-
} catch (
|
|
2807
|
+
return _chunkXW4M7WDIcjs.tokenFormatter.format(numeric);
|
|
2808
|
+
} catch (e18) {
|
|
2691
2809
|
return "...";
|
|
2692
2810
|
}
|
|
2693
2811
|
}, [balance, token.decimals]);
|
|
@@ -2698,13 +2816,13 @@ function SolanaAmountStep({
|
|
|
2698
2816
|
if (tokenPriceUsd !== null) return balanceUnits * tokenPriceUsd;
|
|
2699
2817
|
if (Number.isFinite(balanceUsd) && balanceUsd > 0) return balanceUsd;
|
|
2700
2818
|
return null;
|
|
2701
|
-
} catch (
|
|
2819
|
+
} catch (e19) {
|
|
2702
2820
|
return null;
|
|
2703
2821
|
}
|
|
2704
2822
|
}, [balance, token.decimals, tokenPriceUsd, balanceUsd]);
|
|
2705
2823
|
const formattedBalanceUsd = _react.useMemo.call(void 0, () => {
|
|
2706
2824
|
if (computedBalanceUsd === null || computedBalanceUsd <= 0) return null;
|
|
2707
|
-
return
|
|
2825
|
+
return _chunkXW4M7WDIcjs.currencyFormatter.format(computedBalanceUsd);
|
|
2708
2826
|
}, [computedBalanceUsd]);
|
|
2709
2827
|
const spendableBalance = _react.useMemo.call(void 0, () => {
|
|
2710
2828
|
if (!isNativeSol(token)) return balance;
|
|
@@ -2716,7 +2834,7 @@ function SolanaAmountStep({
|
|
|
2716
2834
|
if (!Number.isFinite(spendableUnits) || spendableUnits < 0) return null;
|
|
2717
2835
|
if (tokenPriceUsd !== null) return spendableUnits * tokenPriceUsd;
|
|
2718
2836
|
return null;
|
|
2719
|
-
} catch (
|
|
2837
|
+
} catch (e20) {
|
|
2720
2838
|
return null;
|
|
2721
2839
|
}
|
|
2722
2840
|
}, [spendableBalance, token.decimals, tokenPriceUsd]);
|
|
@@ -2729,13 +2847,13 @@ function SolanaAmountStep({
|
|
|
2729
2847
|
const factor = 10 ** maxDecimals;
|
|
2730
2848
|
const truncated = Math.floor(value * factor) / factor;
|
|
2731
2849
|
const formatted = truncated.toFixed(maxDecimals).replace(/\.?0+$/, "");
|
|
2732
|
-
|
|
2850
|
+
_chunkXW4M7WDIcjs.debugLog.call(void 0, debug, "solana-amount", "amount:preset", {
|
|
2733
2851
|
percentage,
|
|
2734
2852
|
symbol: token.symbol,
|
|
2735
2853
|
formatted
|
|
2736
2854
|
});
|
|
2737
2855
|
setAmount(formatted);
|
|
2738
|
-
} catch (
|
|
2856
|
+
} catch (e21) {
|
|
2739
2857
|
return;
|
|
2740
2858
|
}
|
|
2741
2859
|
if (error) setError(null);
|
|
@@ -2743,7 +2861,7 @@ function SolanaAmountStep({
|
|
|
2743
2861
|
const handleContinue = () => {
|
|
2744
2862
|
const numericAmount = parseFloat(amount);
|
|
2745
2863
|
if (isNaN(numericAmount) || numericAmount <= 0) {
|
|
2746
|
-
|
|
2864
|
+
_chunkXW4M7WDIcjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
|
|
2747
2865
|
amount,
|
|
2748
2866
|
reason: "nan-or-non-positive"
|
|
2749
2867
|
});
|
|
@@ -2755,7 +2873,7 @@ function SolanaAmountStep({
|
|
|
2755
2873
|
const usdValue = numericAmount;
|
|
2756
2874
|
if (_optionalChain([uiConfig, 'optionalAccess', _82 => _82.maxDepositUsd]) && usdValue > uiConfig.maxDepositUsd) {
|
|
2757
2875
|
setError(
|
|
2758
|
-
`Maximum deposit is ${
|
|
2876
|
+
`Maximum deposit is ${_chunkXW4M7WDIcjs.currencyFormatter.format(uiConfig.maxDepositUsd)}`
|
|
2759
2877
|
);
|
|
2760
2878
|
return;
|
|
2761
2879
|
}
|
|
@@ -2769,8 +2887,8 @@ function SolanaAmountStep({
|
|
|
2769
2887
|
let amountInUnits;
|
|
2770
2888
|
try {
|
|
2771
2889
|
amountInUnits = _viem.parseUnits.call(void 0, sourceAmountStr, token.decimals);
|
|
2772
|
-
} catch (
|
|
2773
|
-
|
|
2890
|
+
} catch (e22) {
|
|
2891
|
+
_chunkXW4M7WDIcjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
|
|
2774
2892
|
amount,
|
|
2775
2893
|
sourceAmount: sourceAmountStr,
|
|
2776
2894
|
reason: "parse-units-failed"
|
|
@@ -2780,7 +2898,7 @@ function SolanaAmountStep({
|
|
|
2780
2898
|
}
|
|
2781
2899
|
if (amountInUnits > spendableBalance) {
|
|
2782
2900
|
const isReserveIssue = isNativeSol(token) && amountInUnits <= balance;
|
|
2783
|
-
|
|
2901
|
+
_chunkXW4M7WDIcjs.debugLog.call(void 0, debug, "solana-amount", "amount:invalid", {
|
|
2784
2902
|
amount,
|
|
2785
2903
|
balance: balance.toString(),
|
|
2786
2904
|
spendableBalance: spendableBalance.toString(),
|
|
@@ -2792,7 +2910,7 @@ function SolanaAmountStep({
|
|
|
2792
2910
|
);
|
|
2793
2911
|
return;
|
|
2794
2912
|
}
|
|
2795
|
-
|
|
2913
|
+
_chunkXW4M7WDIcjs.debugLog.call(void 0, debug, "solana-amount", "amount:continue", {
|
|
2796
2914
|
symbol: token.symbol,
|
|
2797
2915
|
inputAmountUsd: amount,
|
|
2798
2916
|
sourceAmount: sourceAmountStr,
|
|
@@ -2861,7 +2979,7 @@ function SolanaAmountStep({
|
|
|
2861
2979
|
)
|
|
2862
2980
|
] }),
|
|
2863
2981
|
_optionalChain([uiConfig, 'optionalAccess', _84 => _84.minDepositUsd]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-minimum", children: [
|
|
2864
|
-
|
|
2982
|
+
_chunkXW4M7WDIcjs.currencyFormatter.format(uiConfig.minDepositUsd),
|
|
2865
2983
|
" minimum deposit"
|
|
2866
2984
|
] }),
|
|
2867
2985
|
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-amount-error", children: [
|
|
@@ -2887,7 +3005,7 @@ function SolanaAmountStep({
|
|
|
2887
3005
|
] })
|
|
2888
3006
|
] }),
|
|
2889
3007
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2890
|
-
|
|
3008
|
+
_chunkXW4M7WDIcjs.Button,
|
|
2891
3009
|
{
|
|
2892
3010
|
onClick: handleContinue,
|
|
2893
3011
|
fullWidth: true,
|
|
@@ -2895,7 +3013,7 @@ function SolanaAmountStep({
|
|
|
2895
3013
|
children: _optionalChain([uiConfig, 'optionalAccess', _85 => _85.minDepositUsd]) && parseFloat(amount) > 0 && parseFloat(amount) < uiConfig.minDepositUsd ? "Update order" : "Continue"
|
|
2896
3014
|
}
|
|
2897
3015
|
) }),
|
|
2898
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3016
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXW4M7WDIcjs.PoweredBy, {})
|
|
2899
3017
|
] });
|
|
2900
3018
|
}
|
|
2901
3019
|
|
|
@@ -2939,7 +3057,7 @@ function SolanaConfirmStep({
|
|
|
2939
3057
|
const receiveAmount = isSameToken ? formattedReceiveAmount : `~ ${formattedReceiveAmount}`;
|
|
2940
3058
|
const handleConfirm = async () => {
|
|
2941
3059
|
if (!solanaProvider) {
|
|
2942
|
-
|
|
3060
|
+
_chunkXW4M7WDIcjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
|
|
2943
3061
|
reason: "missing-provider"
|
|
2944
3062
|
});
|
|
2945
3063
|
setError("Solana wallet not connected");
|
|
@@ -2947,7 +3065,7 @@ function SolanaConfirmStep({
|
|
|
2947
3065
|
}
|
|
2948
3066
|
const parsedAmount = parseFloat(sourceAmount);
|
|
2949
3067
|
if (isNaN(parsedAmount) || parsedAmount <= 0) {
|
|
2950
|
-
|
|
3068
|
+
_chunkXW4M7WDIcjs.debugLog.call(void 0, debug, "solana-confirm", "submit:blocked", {
|
|
2951
3069
|
reason: "invalid-amount",
|
|
2952
3070
|
sourceAmount
|
|
2953
3071
|
});
|
|
@@ -2956,7 +3074,7 @@ function SolanaConfirmStep({
|
|
|
2956
3074
|
}
|
|
2957
3075
|
setError(null);
|
|
2958
3076
|
setIsSubmitting(true);
|
|
2959
|
-
|
|
3077
|
+
_chunkXW4M7WDIcjs.debugLog.call(void 0, debug, "solana-confirm", "submit:start", {
|
|
2960
3078
|
smartAccount,
|
|
2961
3079
|
solanaAddress,
|
|
2962
3080
|
solanaDepositAddress,
|
|
@@ -2966,7 +3084,7 @@ function SolanaConfirmStep({
|
|
|
2966
3084
|
});
|
|
2967
3085
|
try {
|
|
2968
3086
|
const check = await service.checkAccount(smartAccount);
|
|
2969
|
-
|
|
3087
|
+
_chunkXW4M7WDIcjs.debugLog.call(void 0, debug, "solana-confirm", "check:success", {
|
|
2970
3088
|
smartAccount,
|
|
2971
3089
|
isRegistered: check.isRegistered,
|
|
2972
3090
|
targetChain: check.targetChain,
|
|
@@ -2979,7 +3097,7 @@ function SolanaConfirmStep({
|
|
|
2979
3097
|
}
|
|
2980
3098
|
const connection = getSolanaConnection();
|
|
2981
3099
|
const amountUnits = _viem.parseUnits.call(void 0, sourceAmount, token.decimals);
|
|
2982
|
-
|
|
3100
|
+
_chunkXW4M7WDIcjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:start", {
|
|
2983
3101
|
token: token.symbol,
|
|
2984
3102
|
sourceAmount,
|
|
2985
3103
|
amountUnits: amountUnits.toString()
|
|
@@ -2996,7 +3114,7 @@ function SolanaConfirmStep({
|
|
|
2996
3114
|
token.mint,
|
|
2997
3115
|
amountUnits
|
|
2998
3116
|
);
|
|
2999
|
-
|
|
3117
|
+
_chunkXW4M7WDIcjs.debugLog.call(void 0, debug, "solana-confirm", "tx:build:success", {
|
|
3000
3118
|
token: token.symbol,
|
|
3001
3119
|
instructionCount: transaction.instructions.length,
|
|
3002
3120
|
feePayer: _optionalChain([transaction, 'access', _86 => _86.feePayer, 'optionalAccess', _87 => _87.toBase58, 'call', _88 => _88()]),
|
|
@@ -3007,15 +3125,15 @@ function SolanaConfirmStep({
|
|
|
3007
3125
|
connection,
|
|
3008
3126
|
transaction
|
|
3009
3127
|
);
|
|
3010
|
-
|
|
3128
|
+
_chunkXW4M7WDIcjs.debugLog.call(void 0, debug, "solana-confirm", "tx:sent", {
|
|
3011
3129
|
txHash,
|
|
3012
3130
|
amountUnits: amountUnits.toString()
|
|
3013
3131
|
});
|
|
3014
3132
|
onConfirm(txHash, amountUnits.toString());
|
|
3015
3133
|
} catch (err) {
|
|
3016
3134
|
const raw = err instanceof Error ? err.message : "Transfer failed";
|
|
3017
|
-
const message =
|
|
3018
|
-
|
|
3135
|
+
const message = _chunkXW4M7WDIcjs.formatUserError.call(void 0, raw);
|
|
3136
|
+
_chunkXW4M7WDIcjs.debugError.call(void 0, debug, "solana-confirm", "submit:failure", err, {
|
|
3019
3137
|
smartAccount,
|
|
3020
3138
|
token: token.symbol,
|
|
3021
3139
|
sourceAmount
|
|
@@ -3148,7 +3266,7 @@ function SolanaConfirmStep({
|
|
|
3148
3266
|
] })
|
|
3149
3267
|
] }),
|
|
3150
3268
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-step-footer", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3151
|
-
|
|
3269
|
+
_chunkXW4M7WDIcjs.Button,
|
|
3152
3270
|
{
|
|
3153
3271
|
onClick: handleConfirm,
|
|
3154
3272
|
loading: isSubmitting,
|
|
@@ -3157,7 +3275,7 @@ function SolanaConfirmStep({
|
|
|
3157
3275
|
children: "Confirm Order"
|
|
3158
3276
|
}
|
|
3159
3277
|
) }),
|
|
3160
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3278
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXW4M7WDIcjs.PoweredBy, {})
|
|
3161
3279
|
] });
|
|
3162
3280
|
}
|
|
3163
3281
|
|
|
@@ -3209,14 +3327,14 @@ function DepositFlow({
|
|
|
3209
3327
|
onError,
|
|
3210
3328
|
debug
|
|
3211
3329
|
}) {
|
|
3212
|
-
const onStepChangeRef =
|
|
3213
|
-
const onTotalBalanceChangeRef =
|
|
3214
|
-
const onSmartAccountChangeRef =
|
|
3215
|
-
const onEventRef =
|
|
3216
|
-
const onDepositSubmittedRef =
|
|
3217
|
-
const onDepositCompleteRef =
|
|
3218
|
-
const onDepositFailedRef =
|
|
3219
|
-
const onErrorRef =
|
|
3330
|
+
const onStepChangeRef = _chunkXW4M7WDIcjs.useLatestRef.call(void 0, onStepChange);
|
|
3331
|
+
const onTotalBalanceChangeRef = _chunkXW4M7WDIcjs.useLatestRef.call(void 0, onTotalBalanceChange);
|
|
3332
|
+
const onSmartAccountChangeRef = _chunkXW4M7WDIcjs.useLatestRef.call(void 0, onSmartAccountChange);
|
|
3333
|
+
const onEventRef = _chunkXW4M7WDIcjs.useLatestRef.call(void 0, onEvent);
|
|
3334
|
+
const onDepositSubmittedRef = _chunkXW4M7WDIcjs.useLatestRef.call(void 0, onDepositSubmitted);
|
|
3335
|
+
const onDepositCompleteRef = _chunkXW4M7WDIcjs.useLatestRef.call(void 0, onDepositComplete);
|
|
3336
|
+
const onDepositFailedRef = _chunkXW4M7WDIcjs.useLatestRef.call(void 0, onDepositFailed);
|
|
3337
|
+
const onErrorRef = _chunkXW4M7WDIcjs.useLatestRef.call(void 0, onError);
|
|
3220
3338
|
const hasInitialReownSession = Boolean(
|
|
3221
3339
|
enableSolana ? _optionalChain([reownWallet, 'optionalAccess', _90 => _90.isConnected]) || _optionalChain([reownWallet, 'optionalAccess', _91 => _91.address]) : _optionalChain([reownWallet, 'optionalAccess', _92 => _92.address])
|
|
3222
3340
|
);
|
|
@@ -3236,13 +3354,13 @@ function DepositFlow({
|
|
|
3236
3354
|
flowModeRef.current = flowMode;
|
|
3237
3355
|
const logFlow = _react.useCallback.call(void 0,
|
|
3238
3356
|
(message, data) => {
|
|
3239
|
-
|
|
3357
|
+
_chunkXW4M7WDIcjs.debugLog.call(void 0, debug, "deposit-flow", message, data);
|
|
3240
3358
|
},
|
|
3241
3359
|
[debug]
|
|
3242
3360
|
);
|
|
3243
3361
|
const logFlowError = _react.useCallback.call(void 0,
|
|
3244
3362
|
(message, error, data) => {
|
|
3245
|
-
|
|
3363
|
+
_chunkXW4M7WDIcjs.debugError.call(void 0, debug, "deposit-flow", message, error, data);
|
|
3246
3364
|
},
|
|
3247
3365
|
[debug]
|
|
3248
3366
|
);
|
|
@@ -3258,7 +3376,7 @@ function DepositFlow({
|
|
|
3258
3376
|
_viem.formatUnits.call(void 0, BigInt(asset.balance), asset.decimals)
|
|
3259
3377
|
);
|
|
3260
3378
|
if (balanceUnits > 0) return asset.balanceUsd / balanceUnits;
|
|
3261
|
-
} catch (
|
|
3379
|
+
} catch (e23) {
|
|
3262
3380
|
}
|
|
3263
3381
|
}
|
|
3264
3382
|
}
|
|
@@ -3366,7 +3484,7 @@ function DepositFlow({
|
|
|
3366
3484
|
return {
|
|
3367
3485
|
ownerAddress: dappAddress,
|
|
3368
3486
|
walletClient: void 0,
|
|
3369
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
3487
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkXW4M7WDIcjs.getPublicClient.call(void 0, targetChain))),
|
|
3370
3488
|
switchChain: void 0
|
|
3371
3489
|
};
|
|
3372
3490
|
}
|
|
@@ -3375,7 +3493,7 @@ function DepositFlow({
|
|
|
3375
3493
|
return {
|
|
3376
3494
|
ownerAddress: dappWalletClient.account.address,
|
|
3377
3495
|
walletClient: dappWalletClient,
|
|
3378
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
3496
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkXW4M7WDIcjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
3379
3497
|
switchChain: dappSwitchChain
|
|
3380
3498
|
};
|
|
3381
3499
|
}
|
|
@@ -3389,7 +3507,7 @@ function DepositFlow({
|
|
|
3389
3507
|
return {
|
|
3390
3508
|
ownerAddress: dappAddress,
|
|
3391
3509
|
walletClient: void 0,
|
|
3392
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
3510
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkXW4M7WDIcjs.getPublicClient.call(void 0, targetChain))),
|
|
3393
3511
|
switchChain: void 0
|
|
3394
3512
|
};
|
|
3395
3513
|
}
|
|
@@ -3398,7 +3516,7 @@ function DepositFlow({
|
|
|
3398
3516
|
return {
|
|
3399
3517
|
ownerAddress: dappWalletClient.account.address,
|
|
3400
3518
|
walletClient: dappWalletClient,
|
|
3401
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
3519
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkXW4M7WDIcjs.getPublicClient.call(void 0, fallbackChainId))),
|
|
3402
3520
|
switchChain: dappSwitchChain
|
|
3403
3521
|
};
|
|
3404
3522
|
}
|
|
@@ -3406,7 +3524,7 @@ function DepositFlow({
|
|
|
3406
3524
|
return {
|
|
3407
3525
|
ownerAddress: reownWallet.address,
|
|
3408
3526
|
walletClient: reownWallet.walletClient,
|
|
3409
|
-
publicClient: _nullishCoalesce(reownWallet.publicClient, () => (
|
|
3527
|
+
publicClient: _nullishCoalesce(reownWallet.publicClient, () => ( _chunkXW4M7WDIcjs.getPublicClient.call(void 0, targetChain))),
|
|
3410
3528
|
switchChain: reownWallet.switchChain
|
|
3411
3529
|
};
|
|
3412
3530
|
}
|
|
@@ -3444,7 +3562,7 @@ function DepositFlow({
|
|
|
3444
3562
|
return {
|
|
3445
3563
|
ownerAddress: dappAddress,
|
|
3446
3564
|
walletClient: void 0,
|
|
3447
|
-
publicClient: _nullishCoalesce(dappPublicClient, () => (
|
|
3565
|
+
publicClient: _nullishCoalesce(dappPublicClient, () => ( _chunkXW4M7WDIcjs.getPublicClient.call(void 0, targetChain))),
|
|
3448
3566
|
switchChain: void 0
|
|
3449
3567
|
};
|
|
3450
3568
|
}
|
|
@@ -3778,7 +3896,7 @@ function DepositFlow({
|
|
|
3778
3896
|
[defaultAmount, onEvent, totalBalanceUsd]
|
|
3779
3897
|
);
|
|
3780
3898
|
const handleAmountContinue = _react.useCallback.call(void 0,
|
|
3781
|
-
(amount, targetAmount, balance) => {
|
|
3899
|
+
(amount, targetAmount, balance, liquidityWarning) => {
|
|
3782
3900
|
const targetSym = _chunkMUWVDVY4cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
3783
3901
|
const isTargetStable = _chunkMUWVDVY4cjs.isStablecoinSymbol.call(void 0, targetSym);
|
|
3784
3902
|
const targetTokenPriceUsd = isTargetStable ? 1 : getTokenPriceUsd(targetSym);
|
|
@@ -3791,7 +3909,8 @@ function DepositFlow({
|
|
|
3791
3909
|
amount,
|
|
3792
3910
|
targetAmount,
|
|
3793
3911
|
targetTokenPriceUsd,
|
|
3794
|
-
balance
|
|
3912
|
+
balance,
|
|
3913
|
+
liquidityWarning
|
|
3795
3914
|
};
|
|
3796
3915
|
});
|
|
3797
3916
|
},
|
|
@@ -3930,7 +4049,7 @@ function DepositFlow({
|
|
|
3930
4049
|
]);
|
|
3931
4050
|
if (showConnectStep) {
|
|
3932
4051
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rs-modal-body", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3933
|
-
|
|
4052
|
+
_chunkXW4M7WDIcjs.ConnectStep,
|
|
3934
4053
|
{
|
|
3935
4054
|
walletOptions,
|
|
3936
4055
|
selectedWalletId: selectedWalletIdEffective,
|
|
@@ -4116,7 +4235,7 @@ function DepositFlow({
|
|
|
4116
4235
|
) })
|
|
4117
4236
|
] }) : null,
|
|
4118
4237
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4119
|
-
|
|
4238
|
+
_chunkXW4M7WDIcjs.ProcessingStep,
|
|
4120
4239
|
{
|
|
4121
4240
|
smartAccount: step.smartAccount,
|
|
4122
4241
|
txHash: step.txHash,
|
|
@@ -4150,7 +4269,7 @@ function DepositFlow({
|
|
|
4150
4269
|
if (_optionalChain([signerContext, 'access', _162 => _162.publicClient, 'access', _163 => _163.chain, 'optionalAccess', _164 => _164.id]) === chainId) {
|
|
4151
4270
|
return signerContext.publicClient;
|
|
4152
4271
|
}
|
|
4153
|
-
return
|
|
4272
|
+
return _chunkXW4M7WDIcjs.getPublicClient.call(void 0, chainId);
|
|
4154
4273
|
};
|
|
4155
4274
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-body", children: [
|
|
4156
4275
|
step.type === "setup" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -4204,6 +4323,7 @@ function DepositFlow({
|
|
|
4204
4323
|
targetChain,
|
|
4205
4324
|
targetToken,
|
|
4206
4325
|
uiConfig,
|
|
4326
|
+
service,
|
|
4207
4327
|
onContinue: handleAmountContinue,
|
|
4208
4328
|
onCtaClick: (ctaName) => {
|
|
4209
4329
|
const receiveSymbol = _chunkMUWVDVY4cjs.getTokenSymbol.call(void 0, targetToken, targetChain);
|
|
@@ -4232,13 +4352,14 @@ function DepositFlow({
|
|
|
4232
4352
|
targetChain,
|
|
4233
4353
|
targetToken,
|
|
4234
4354
|
switchChain: signerContext.switchChain,
|
|
4355
|
+
liquidityWarning: step.liquidityWarning,
|
|
4235
4356
|
onConfirm: handleDepositSubmitted,
|
|
4236
4357
|
onDepositSubmitted: handleDepositSubmittedCallback,
|
|
4237
4358
|
onError: handleError
|
|
4238
4359
|
}
|
|
4239
4360
|
),
|
|
4240
4361
|
step.type === "processing" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4241
|
-
|
|
4362
|
+
_chunkXW4M7WDIcjs.ProcessingStep,
|
|
4242
4363
|
{
|
|
4243
4364
|
smartAccount: step.smartAccount,
|
|
4244
4365
|
txHash: step.txHash,
|
|
@@ -4288,15 +4409,15 @@ function formatTimestamp2(iso) {
|
|
|
4288
4409
|
month: "short",
|
|
4289
4410
|
day: "numeric"
|
|
4290
4411
|
});
|
|
4291
|
-
} catch (
|
|
4412
|
+
} catch (e24) {
|
|
4292
4413
|
return iso;
|
|
4293
4414
|
}
|
|
4294
4415
|
}
|
|
4295
4416
|
function resolveChainId(value) {
|
|
4296
4417
|
if (value === void 0 || value === null) return null;
|
|
4297
4418
|
if (typeof value === "number") return value;
|
|
4298
|
-
if (
|
|
4299
|
-
const parsed =
|
|
4419
|
+
if (_chunkXW4M7WDIcjs.isSolanaCaip2.call(void 0, value) || value === "solana") return "solana";
|
|
4420
|
+
const parsed = _chunkXW4M7WDIcjs.parseEvmChainId.call(void 0, value);
|
|
4300
4421
|
if (parsed !== null) return parsed;
|
|
4301
4422
|
const num = Number(value);
|
|
4302
4423
|
return Number.isFinite(num) ? num : null;
|
|
@@ -4347,7 +4468,7 @@ function formatAmount(rawAmount, token, chainId) {
|
|
|
4347
4468
|
const trimmed = fracStr.slice(0, 6).replace(/0+$/, "");
|
|
4348
4469
|
if (!trimmed) return whole.toString();
|
|
4349
4470
|
return `${whole}.${trimmed}`;
|
|
4350
|
-
} catch (
|
|
4471
|
+
} catch (e25) {
|
|
4351
4472
|
return rawAmount;
|
|
4352
4473
|
}
|
|
4353
4474
|
}
|
|
@@ -4530,7 +4651,7 @@ DepositHistoryPanel.displayName = "DepositHistoryPanel";
|
|
|
4530
4651
|
// src/DepositModal.tsx
|
|
4531
4652
|
|
|
4532
4653
|
var ReownDepositInner = _react.lazy.call(void 0,
|
|
4533
|
-
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-
|
|
4654
|
+
() => Promise.resolve().then(() => _interopRequireWildcard(require("./DepositModalReown-66DE7NAY.cjs"))).then((m) => ({ default: m.DepositModalReown }))
|
|
4534
4655
|
);
|
|
4535
4656
|
function DepositModal(props) {
|
|
4536
4657
|
const needsReown = !!props.reownAppId;
|
|
@@ -4601,7 +4722,7 @@ function DepositModalInner({
|
|
|
4601
4722
|
debug
|
|
4602
4723
|
}) {
|
|
4603
4724
|
const modalRef = _react.useRef.call(void 0, null);
|
|
4604
|
-
const onReadyRef =
|
|
4725
|
+
const onReadyRef = _chunkXW4M7WDIcjs.useLatestRef.call(void 0, onReady);
|
|
4605
4726
|
const [currentStepIndex, setCurrentStepIndex] = _react.useState.call(void 0, 0);
|
|
4606
4727
|
const [totalBalanceUsd, setTotalBalanceUsd] = _react.useState.call(void 0, null);
|
|
4607
4728
|
const backHandlerRef = _react.useRef.call(void 0, void 0);
|
|
@@ -4618,7 +4739,7 @@ function DepositModalInner({
|
|
|
4618
4739
|
const targetChain = _chunkMUWVDVY4cjs.getChainId.call(void 0, targetChainProp);
|
|
4619
4740
|
const sourceChain = sourceChainProp ? _chunkMUWVDVY4cjs.getChainId.call(void 0, sourceChainProp) : void 0;
|
|
4620
4741
|
const service = _react.useMemo.call(void 0,
|
|
4621
|
-
() =>
|
|
4742
|
+
() => _chunkXW4M7WDIcjs.createDepositService.call(void 0, backendUrl, {
|
|
4622
4743
|
debug,
|
|
4623
4744
|
debugScope: "service:deposit"
|
|
4624
4745
|
}),
|
|
@@ -4626,7 +4747,7 @@ function DepositModalInner({
|
|
|
4626
4747
|
);
|
|
4627
4748
|
_react.useEffect.call(void 0, () => {
|
|
4628
4749
|
if (isOpen && modalRef.current) {
|
|
4629
|
-
|
|
4750
|
+
_chunkXW4M7WDIcjs.applyTheme.call(void 0, modalRef.current, theme);
|
|
4630
4751
|
}
|
|
4631
4752
|
}, [isOpen, theme]);
|
|
4632
4753
|
_react.useEffect.call(void 0, () => {
|
|
@@ -4722,9 +4843,9 @@ function DepositModalInner({
|
|
|
4722
4843
|
fetchHistory();
|
|
4723
4844
|
}
|
|
4724
4845
|
}, [historyOpen, fetchHistory]);
|
|
4725
|
-
const onDepositSubmittedRef =
|
|
4726
|
-
const onDepositCompleteRef =
|
|
4727
|
-
const onDepositFailedRef =
|
|
4846
|
+
const onDepositSubmittedRef = _chunkXW4M7WDIcjs.useLatestRef.call(void 0, onDepositSubmitted);
|
|
4847
|
+
const onDepositCompleteRef = _chunkXW4M7WDIcjs.useLatestRef.call(void 0, onDepositComplete);
|
|
4848
|
+
const onDepositFailedRef = _chunkXW4M7WDIcjs.useLatestRef.call(void 0, onDepositFailed);
|
|
4728
4849
|
const handleDepositSubmitted = _react.useCallback.call(void 0,
|
|
4729
4850
|
(data) => {
|
|
4730
4851
|
_optionalChain([onDepositSubmittedRef, 'access', _172 => _172.current, 'optionalCall', _173 => _173(data)]);
|
|
@@ -4765,7 +4886,7 @@ function DepositModalInner({
|
|
|
4765
4886
|
const title = _nullishCoalesce(_optionalChain([branding, 'optionalAccess', _183 => _183.title]), () => ( "Deposit"));
|
|
4766
4887
|
const canGoBack = currentStepIndex > 0 && currentStepIndex < 4 && backHandlerRef.current !== void 0;
|
|
4767
4888
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4768
|
-
|
|
4889
|
+
_chunkXW4M7WDIcjs.Modal,
|
|
4769
4890
|
{
|
|
4770
4891
|
isOpen,
|
|
4771
4892
|
onClose,
|
|
@@ -4858,7 +4979,7 @@ function DepositModalInner({
|
|
|
4858
4979
|
balance.title,
|
|
4859
4980
|
":"
|
|
4860
4981
|
] }),
|
|
4861
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ?
|
|
4982
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "rs-modal-header-balance-value", children: _nullishCoalesce(balance.amount, () => ( (totalBalanceUsd !== null ? _chunkXW4M7WDIcjs.currencyFormatter.format(totalBalanceUsd) : null))) })
|
|
4862
4983
|
] })
|
|
4863
4984
|
] }),
|
|
4864
4985
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rs-modal-header-nav-right", children: [
|