From 8622107c356f57caa865fa4bc0fa856e2dae6118 Mon Sep 17 00:00:00 2001 From: Gianfranco Date: Thu, 23 Jan 2025 11:37:14 -0300 Subject: [PATCH] do not show insufficient balance, max withdrawal error if wallet is not connected --- src/pages/swap/index.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/swap/index.tsx b/src/pages/swap/index.tsx index 71d3aa38..302cbc6b 100644 --- a/src/pages/swap/index.tsx +++ b/src/pages/swap/index.tsx @@ -65,7 +65,7 @@ export const SwapPage = () => { const feeComparisonRef = useRef(null); const pendulumNode = usePendulumNode(); const [api, setApi] = useState(null); - const { address } = useVortexAccount(); + const { isDisconnected, address } = useVortexAccount(); const [initializeFailedMessage, setInitializeFailedMessage] = useState(null); const [apiInitializeFailed, setApiInitializeFailed] = useState(false); const [_, setIsReady] = useState(false); @@ -253,6 +253,8 @@ export const SwapPage = () => { ); function getCurrentErrorMessage() { + if (isDisconnected) return; + if (typeof userInputTokenBalance === 'string') { if (Big(userInputTokenBalance).lt(fromAmount ?? 0) && walletAccount) { trackEvent({ event: 'form_error', error_message: 'insufficient_balance' });