@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
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkUHQSFV5Vcjs = require('./chunk-UHQSFV5V.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkYQFH2WSWcjs = require('./chunk-YQFH2WSW.cjs');
|
|
8
|
-
require('./chunk-
|
|
8
|
+
require('./chunk-XW4M7WDI.cjs');
|
|
9
9
|
require('./chunk-MUWVDVY4.cjs');
|
|
10
10
|
|
|
11
11
|
// src/DepositModalReown.tsx
|
|
@@ -32,7 +32,7 @@ function DepositModalWithReown(props) {
|
|
|
32
32
|
reown.disconnect();
|
|
33
33
|
}, [reown.disconnect]);
|
|
34
34
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
35
|
-
|
|
35
|
+
_chunkUHQSFV5Vcjs.DepositModalInner,
|
|
36
36
|
{
|
|
37
37
|
...props,
|
|
38
38
|
reownWallet: reownWithSolana,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DepositModalInner
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7NEVAAPY.mjs";
|
|
4
4
|
import {
|
|
5
5
|
ReownWalletProvider,
|
|
6
6
|
useReownWallet
|
|
7
7
|
} from "./chunk-5YXAQB6A.mjs";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-3CRG5NPG.mjs";
|
|
9
9
|
import "./chunk-SDZKKUCJ.mjs";
|
|
10
10
|
|
|
11
11
|
// src/DepositModalReown.tsx
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk7TEGUTU4cjs = require('./chunk-7TEGUTU4.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkYQFH2WSWcjs = require('./chunk-YQFH2WSW.cjs');
|
|
8
|
-
require('./chunk-
|
|
8
|
+
require('./chunk-XW4M7WDI.cjs');
|
|
9
9
|
require('./chunk-MUWVDVY4.cjs');
|
|
10
10
|
|
|
11
11
|
// src/WithdrawModalReown.tsx
|
|
@@ -20,7 +20,7 @@ function WithdrawModalWithReown(props) {
|
|
|
20
20
|
reown.disconnect();
|
|
21
21
|
}, [reown.disconnect]);
|
|
22
22
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
23
|
-
|
|
23
|
+
_chunk7TEGUTU4cjs.WithdrawModalInner,
|
|
24
24
|
{
|
|
25
25
|
...props,
|
|
26
26
|
reownWallet: reown,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WithdrawModalInner
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TKTOPC2W.mjs";
|
|
4
4
|
import {
|
|
5
5
|
ReownWalletProvider,
|
|
6
6
|
useReownWallet
|
|
7
7
|
} from "./chunk-5YXAQB6A.mjs";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-3CRG5NPG.mjs";
|
|
9
9
|
import "./chunk-SDZKKUCJ.mjs";
|
|
10
10
|
|
|
11
11
|
// src/WithdrawModalReown.tsx
|
|
@@ -703,6 +703,50 @@ function createDepositService(baseUrl, options) {
|
|
|
703
703
|
hasMore: Boolean(nextCursor)
|
|
704
704
|
});
|
|
705
705
|
return { deposits, nextCursor };
|
|
706
|
+
},
|
|
707
|
+
async checkLiquidity(params) {
|
|
708
|
+
const searchParams = new URLSearchParams({
|
|
709
|
+
sourceChainId: String(params.sourceChainId),
|
|
710
|
+
sourceToken: params.sourceToken,
|
|
711
|
+
destinationChainId: String(params.destinationChainId),
|
|
712
|
+
destinationToken: params.destinationToken,
|
|
713
|
+
amount: params.amount
|
|
714
|
+
});
|
|
715
|
+
const url = apiUrl(`/liquidity?${searchParams.toString()}`);
|
|
716
|
+
debugLog(debug, scope, "checkLiquidity:request", {
|
|
717
|
+
url,
|
|
718
|
+
sourceChainId: params.sourceChainId,
|
|
719
|
+
destinationChainId: params.destinationChainId,
|
|
720
|
+
amount: params.amount
|
|
721
|
+
});
|
|
722
|
+
const response = await fetch(url, {
|
|
723
|
+
method: "GET",
|
|
724
|
+
headers: { "Content-Type": "application/json" },
|
|
725
|
+
cache: "no-store"
|
|
726
|
+
});
|
|
727
|
+
if (!response.ok) {
|
|
728
|
+
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
729
|
+
debugError(debug, scope, "checkLiquidity:failed", error, {
|
|
730
|
+
status: response.status
|
|
731
|
+
});
|
|
732
|
+
throw new Error(
|
|
733
|
+
error.error || `Liquidity check failed: ${response.status}`
|
|
734
|
+
);
|
|
735
|
+
}
|
|
736
|
+
const data = await response.json();
|
|
737
|
+
const result = {
|
|
738
|
+
hasLiquidity: data.hasLiquidity === true,
|
|
739
|
+
symbol: typeof data.symbol === "string" ? data.symbol : "",
|
|
740
|
+
decimals: typeof data.decimals === "number" ? data.decimals : 0,
|
|
741
|
+
unlimited: data.unlimited === true,
|
|
742
|
+
maxAmount: typeof data.maxAmount === "string" ? data.maxAmount : null
|
|
743
|
+
};
|
|
744
|
+
debugLog(debug, scope, "checkLiquidity:success", {
|
|
745
|
+
hasLiquidity: result.hasLiquidity,
|
|
746
|
+
unlimited: result.unlimited,
|
|
747
|
+
maxAmount: result.maxAmount
|
|
748
|
+
});
|
|
749
|
+
return result;
|
|
706
750
|
}
|
|
707
751
|
};
|
|
708
752
|
}
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
tokenFormatter,
|
|
29
29
|
txRefsMatch,
|
|
30
30
|
useLatestRef
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-3CRG5NPG.mjs";
|
|
32
32
|
import {
|
|
33
33
|
DEFAULT_BACKEND_URL,
|
|
34
34
|
DEFAULT_SIGNER_ADDRESS,
|
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
|
|
63
63
|
// src/DepositFlow.tsx
|
|
64
64
|
import { useState as useState11, useCallback as useCallback5, useMemo as useMemo6, useEffect as useEffect10, useRef as useRef7 } from "react";
|
|
65
|
-
import { formatUnits as
|
|
65
|
+
import { formatUnits as formatUnits6 } from "viem";
|
|
66
66
|
|
|
67
67
|
// src/components/steps/SetupStep.tsx
|
|
68
68
|
import { useState, useEffect, useRef, useCallback } from "react";
|
|
@@ -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] = useState3("");
|
|
588
589
|
const [balance, setBalance] = useState3(null);
|
|
589
590
|
const [error, setError] = useState3(null);
|
|
590
591
|
const [isSwitching, setIsSwitching] = useState3(false);
|
|
592
|
+
const [isCheckingLiquidity, setIsCheckingLiquidity] = useState3(false);
|
|
591
593
|
const hasAttemptedSwitch = useRef2(false);
|
|
592
594
|
const chainMismatch = Boolean(
|
|
593
595
|
walletClient?.chain?.id && walletClient.chain.id !== asset.chainId
|
|
@@ -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");
|
|
@@ -747,7 +749,34 @@ function AmountStep({
|
|
|
747
749
|
}
|
|
748
750
|
setError(null);
|
|
749
751
|
onCtaClick?.("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 {
|
|
775
|
+
liquidityWarning = { kind: "check-failed" };
|
|
776
|
+
} finally {
|
|
777
|
+
setIsCheckingLiquidity(false);
|
|
778
|
+
}
|
|
779
|
+
onContinue(tokenAmountStr, amount, balance ?? void 0, liquidityWarning);
|
|
751
780
|
};
|
|
752
781
|
return /* @__PURE__ */ jsxs3("div", { className: "rs-step", children: [
|
|
753
782
|
/* @__PURE__ */ jsxs3("div", { className: "rs-step-body", style: { paddingTop: 0 }, children: [
|
|
@@ -945,8 +974,8 @@ function AmountStep({
|
|
|
945
974
|
{
|
|
946
975
|
onClick: handleContinue,
|
|
947
976
|
fullWidth: true,
|
|
948
|
-
disabled: !amount || chainMismatch,
|
|
949
|
-
children: uiConfig?.minDepositUsd && parseFloat(amount) > 0 && parseFloat(amount) < uiConfig.minDepositUsd ? "Update order" : "Continue"
|
|
977
|
+
disabled: !amount || chainMismatch || isCheckingLiquidity,
|
|
978
|
+
children: isCheckingLiquidity ? "Checking liquidity\u2026" : uiConfig?.minDepositUsd && parseFloat(amount) > 0 && parseFloat(amount) < uiConfig.minDepositUsd ? "Update order" : "Continue"
|
|
950
979
|
}
|
|
951
980
|
) }),
|
|
952
981
|
/* @__PURE__ */ jsx3(PoweredBy, {})
|
|
@@ -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
|
|
@@ -1165,6 +1195,19 @@ function ConfirmStep({
|
|
|
1165
1195
|
)
|
|
1166
1196
|
] })
|
|
1167
1197
|
] }),
|
|
1198
|
+
liquidityWarning && (liquidityWarning.kind === "unavailable" || liquidityWarning.kind === "check-failed") && /* @__PURE__ */ jsx4(
|
|
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__ */ jsxs4("div", { className: "rs-alert rs-alert--error", children: [
|
|
1169
1212
|
/* @__PURE__ */ jsx4(
|
|
1170
1213
|
"svg",
|
|
@@ -1203,6 +1246,7 @@ function ConfirmStep({
|
|
|
1203
1246
|
|
|
1204
1247
|
// src/components/steps/DepositAddressStep.tsx
|
|
1205
1248
|
import { useState as useState7, useEffect as useEffect7, useCallback as useCallback4, useRef as useRef6, useMemo as useMemo3 } from "react";
|
|
1249
|
+
import { formatUnits as formatUnits3 } from "viem";
|
|
1206
1250
|
|
|
1207
1251
|
// src/components/ui/QRCode.tsx
|
|
1208
1252
|
import { QRCode as QRCodeCanvas } from "react-qrcode-logo";
|
|
@@ -1949,6 +1993,59 @@ function DepositAddressStep({
|
|
|
1949
1993
|
sourceSymbol: sourceTokenSymbol
|
|
1950
1994
|
};
|
|
1951
1995
|
}, [sourceChainId, sourceTokenSymbol, isSolana]);
|
|
1996
|
+
const [liquidityHelper, setLiquidityHelper] = useState7({
|
|
1997
|
+
kind: "idle"
|
|
1998
|
+
});
|
|
1999
|
+
useEffect7(() => {
|
|
2000
|
+
if (isSolana) {
|
|
2001
|
+
setLiquidityHelper({ kind: "idle" });
|
|
2002
|
+
return;
|
|
2003
|
+
}
|
|
2004
|
+
const sourceTokenAddress = getTokenAddress(
|
|
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
|
useEffect7(() => {
|
|
1954
2051
|
if (!chainDropdownOpen && !tokenDropdownOpen) return;
|
|
@@ -2376,7 +2473,7 @@ function DepositAddressStep({
|
|
|
2376
2473
|
] }) }),
|
|
2377
2474
|
/* @__PURE__ */ jsxs7("span", { className: "rs-price-impact-label", children: [
|
|
2378
2475
|
"Max slippage: ",
|
|
2379
|
-
/* @__PURE__ */ jsx8("strong", { children: "
|
|
2476
|
+
/* @__PURE__ */ jsx8("strong", { children: "0.2%" })
|
|
2380
2477
|
] }),
|
|
2381
2478
|
/* @__PURE__ */ jsx8(
|
|
2382
2479
|
Tooltip,
|
|
@@ -2399,6 +2496,27 @@ function DepositAddressStep({
|
|
|
2399
2496
|
"Processing time: ",
|
|
2400
2497
|
/* @__PURE__ */ jsx8("strong", { children: "< 1 min" })
|
|
2401
2498
|
] })
|
|
2499
|
+
] }),
|
|
2500
|
+
/* @__PURE__ */ jsxs7("div", { className: "rs-price-impact-row", children: [
|
|
2501
|
+
/* @__PURE__ */ jsx8("span", { className: "rs-price-impact-row-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsxs7("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", children: [
|
|
2502
|
+
/* @__PURE__ */ jsx8("circle", { cx: "12", cy: "12", r: "9" }),
|
|
2503
|
+
/* @__PURE__ */ jsx8(
|
|
2504
|
+
"path",
|
|
2505
|
+
{
|
|
2506
|
+
strokeLinecap: "round",
|
|
2507
|
+
strokeLinejoin: "round",
|
|
2508
|
+
d: "M8 12h8M12 8v8"
|
|
2509
|
+
}
|
|
2510
|
+
)
|
|
2511
|
+
] }) }),
|
|
2512
|
+
/* @__PURE__ */ jsxs7("span", { className: "rs-price-impact-label", children: [
|
|
2513
|
+
"Max deposit:",
|
|
2514
|
+
" ",
|
|
2515
|
+
/* @__PURE__ */ jsx8("strong", { children: liquidityHelper.kind === "max" ? `${formatUnits3(
|
|
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
|
]
|
|
@@ -2429,7 +2547,7 @@ DepositAddressStep.displayName = "DepositAddressStep";
|
|
|
2429
2547
|
|
|
2430
2548
|
// src/components/steps/SolanaTokenSelectStep.tsx
|
|
2431
2549
|
import { useState as useState8, useEffect as useEffect8, useMemo as useMemo4 } from "react";
|
|
2432
|
-
import { formatUnits as
|
|
2550
|
+
import { formatUnits as formatUnits4 } from "viem";
|
|
2433
2551
|
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2434
2552
|
function SolanaTokenSelectStep({
|
|
2435
2553
|
solanaAddress,
|
|
@@ -2570,7 +2688,7 @@ function SolanaTokenSelectStep({
|
|
|
2570
2688
|
const chainIcon = getChainIcon("solana");
|
|
2571
2689
|
let formattedBalance;
|
|
2572
2690
|
try {
|
|
2573
|
-
const raw =
|
|
2691
|
+
const raw = formatUnits4(entry.balance, entry.token.decimals);
|
|
2574
2692
|
const numeric = Number(raw);
|
|
2575
2693
|
formattedBalance = Number.isFinite(numeric) ? tokenFormatter.format(numeric) : raw;
|
|
2576
2694
|
} catch {
|
|
@@ -2644,7 +2762,7 @@ function SolanaTokenSelectStep({
|
|
|
2644
2762
|
|
|
2645
2763
|
// src/components/steps/SolanaAmountStep.tsx
|
|
2646
2764
|
import { useEffect as useEffect9, useMemo as useMemo5, useState as useState9 } from "react";
|
|
2647
|
-
import { formatUnits as
|
|
2765
|
+
import { formatUnits as formatUnits5, parseUnits as parseUnits3 } from "viem";
|
|
2648
2766
|
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2649
2767
|
var SOL_FEE_RESERVE_LAMPORTS = 1000000n;
|
|
2650
2768
|
function SolanaAmountStep({
|
|
@@ -2662,7 +2780,7 @@ function SolanaAmountStep({
|
|
|
2662
2780
|
const tokenPriceUsd = useMemo5(() => {
|
|
2663
2781
|
if (isSourceStablecoin) return 1;
|
|
2664
2782
|
try {
|
|
2665
|
-
const balanceUnits = Number(
|
|
2783
|
+
const balanceUnits = Number(formatUnits5(balance, token.decimals));
|
|
2666
2784
|
if (!Number.isFinite(balanceUnits) || balanceUnits <= 0 || balanceUsd <= 0) {
|
|
2667
2785
|
return null;
|
|
2668
2786
|
}
|
|
@@ -2683,7 +2801,7 @@ function SolanaAmountStep({
|
|
|
2683
2801
|
}, [defaultAmount, amount]);
|
|
2684
2802
|
const formattedBalance = useMemo5(() => {
|
|
2685
2803
|
try {
|
|
2686
|
-
const raw =
|
|
2804
|
+
const raw = formatUnits5(balance, token.decimals);
|
|
2687
2805
|
const numeric = Number(raw);
|
|
2688
2806
|
if (!Number.isFinite(numeric)) return raw;
|
|
2689
2807
|
return tokenFormatter.format(numeric);
|
|
@@ -2693,7 +2811,7 @@ function SolanaAmountStep({
|
|
|
2693
2811
|
}, [balance, token.decimals]);
|
|
2694
2812
|
const computedBalanceUsd = useMemo5(() => {
|
|
2695
2813
|
try {
|
|
2696
|
-
const balanceUnits = Number(
|
|
2814
|
+
const balanceUnits = Number(formatUnits5(balance, token.decimals));
|
|
2697
2815
|
if (!Number.isFinite(balanceUnits) || balanceUnits < 0) return null;
|
|
2698
2816
|
if (tokenPriceUsd !== null) return balanceUnits * tokenPriceUsd;
|
|
2699
2817
|
if (Number.isFinite(balanceUsd) && balanceUsd > 0) return balanceUsd;
|
|
@@ -2712,7 +2830,7 @@ function SolanaAmountStep({
|
|
|
2712
2830
|
}, [balance, token]);
|
|
2713
2831
|
const spendableBalanceUsd = useMemo5(() => {
|
|
2714
2832
|
try {
|
|
2715
|
-
const spendableUnits = Number(
|
|
2833
|
+
const spendableUnits = Number(formatUnits5(spendableBalance, token.decimals));
|
|
2716
2834
|
if (!Number.isFinite(spendableUnits) || spendableUnits < 0) return null;
|
|
2717
2835
|
if (tokenPriceUsd !== null) return spendableUnits * tokenPriceUsd;
|
|
2718
2836
|
return null;
|
|
@@ -2722,7 +2840,7 @@ function SolanaAmountStep({
|
|
|
2722
2840
|
}, [spendableBalance, token.decimals, tokenPriceUsd]);
|
|
2723
2841
|
const handlePresetClick = (percentage) => {
|
|
2724
2842
|
try {
|
|
2725
|
-
const spendableUnits = Number(
|
|
2843
|
+
const spendableUnits = Number(formatUnits5(spendableBalance, token.decimals));
|
|
2726
2844
|
if (!Number.isFinite(spendableUnits) || spendableUnits <= 0) return;
|
|
2727
2845
|
const value = isSourceStablecoin || !hasPricing ? spendableUnits * percentage / 100 : (spendableBalanceUsd ?? 0) * percentage / 100;
|
|
2728
2846
|
const maxDecimals = 3;
|
|
@@ -3255,7 +3373,7 @@ function DepositFlow({
|
|
|
3255
3373
|
if (asset.symbol.toLowerCase() === sym && asset.balanceUsd && asset.balance) {
|
|
3256
3374
|
try {
|
|
3257
3375
|
const balanceUnits = Number(
|
|
3258
|
-
|
|
3376
|
+
formatUnits6(BigInt(asset.balance), asset.decimals)
|
|
3259
3377
|
);
|
|
3260
3378
|
if (balanceUnits > 0) return asset.balanceUsd / balanceUnits;
|
|
3261
3379
|
} catch {
|
|
@@ -3778,7 +3896,7 @@ function DepositFlow({
|
|
|
3778
3896
|
[defaultAmount, onEvent, totalBalanceUsd]
|
|
3779
3897
|
);
|
|
3780
3898
|
const handleAmountContinue = useCallback5(
|
|
3781
|
-
(amount, targetAmount, balance) => {
|
|
3899
|
+
(amount, targetAmount, balance, liquidityWarning) => {
|
|
3782
3900
|
const targetSym = getTokenSymbol(targetToken, targetChain);
|
|
3783
3901
|
const isTargetStable = isStablecoinSymbol(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
|
},
|
|
@@ -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 = getTokenSymbol(targetToken, targetChain);
|
|
@@ -4232,6 +4352,7 @@ 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
|
|
@@ -4530,7 +4651,7 @@ DepositHistoryPanel.displayName = "DepositHistoryPanel";
|
|
|
4530
4651
|
// src/DepositModal.tsx
|
|
4531
4652
|
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4532
4653
|
var ReownDepositInner = lazy(
|
|
4533
|
-
() => import("./DepositModalReown-
|
|
4654
|
+
() => import("./DepositModalReown-PROPLCBI.mjs").then((m) => ({ default: m.DepositModalReown }))
|
|
4534
4655
|
);
|
|
4535
4656
|
function DepositModal(props) {
|
|
4536
4657
|
const needsReown = !!props.reownAppId;
|