From 3223b379b0ffc9a4ecd08d07683da22b086faff1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Leszczyk?= Date: Wed, 18 Dec 2024 14:38:48 +0100 Subject: [PATCH] chore: get rid of maxFromValue --- src/pages/Swap/Swap.tsx | 7 ------- src/pages/Swap/hooks/useSwapStateFunctions.ts | 3 --- 2 files changed, 10 deletions(-) diff --git a/src/pages/Swap/Swap.tsx b/src/pages/Swap/Swap.tsx index 5b88d3d2..94a34f9a 100644 --- a/src/pages/Swap/Swap.tsx +++ b/src/pages/Swap/Swap.tsx @@ -97,7 +97,6 @@ export function Swap() { swapWarning, isReversed, toTokenValue, - maxFromValue, optimalRate, destAmount, } = useSwapStateFunctions(); @@ -128,11 +127,6 @@ export function Swap() { return result; }, [destAmount, destinationInputField, toTokenValue]); - const maxFromAmount = useMemo(() => { - if (isLoading || destinationInputField === 'to') return undefined; - if (destinationInputField === 'from') return maxFromValue ?? 0n; - }, [destinationInputField, isLoading, maxFromValue]); - async function performSwap() { const { amount, @@ -258,7 +252,6 @@ export function Swap() { setIsToTokenSelectOpen(false); }} tokensList={tokensWBalances} - maxAmount={maxFromAmount} skipHandleMaxAmount isOpen={isFromTokenSelectOpen} selectedToken={selectedFromToken} diff --git a/src/pages/Swap/hooks/useSwapStateFunctions.ts b/src/pages/Swap/hooks/useSwapStateFunctions.ts index f82a8f66..1d3c983d 100644 --- a/src/pages/Swap/hooks/useSwapStateFunctions.ts +++ b/src/pages/Swap/hooks/useSwapStateFunctions.ts @@ -39,7 +39,6 @@ export function useSwapStateFunctions() { const [defaultFromValue, setFromDefaultValue] = useState(); const [fromTokenValue, setFromTokenValue] = useState(); const [toTokenValue, setToTokenValue] = useState(); - const [maxFromValue, setMaxFromValue] = useState(); const { setValuesDebouncedSubject, @@ -98,7 +97,6 @@ export function useSwapStateFunctions() { } : AVAX; setSelectedFromToken(historyFromToken); - setMaxFromValue(historyFromToken?.balance); const historyToToken = pageHistory.selectedToToken ? { ...pageHistory.selectedToToken, @@ -336,7 +334,6 @@ export function useSwapStateFunctions() { swapWarning, isReversed, toTokenValue, - maxFromValue, optimalRate, destAmount, getSwapValues,