From 4f1b266271f358baa2a749db0af535d1ac4427a5 Mon Sep 17 00:00:00 2001 From: Luiz Estacio Date: Fri, 24 Jun 2022 17:00:48 -0300 Subject: [PATCH] test: fix disable button if gas is 0 --- packages/app/src/systems/Swap/pages/SwapPage.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/app/src/systems/Swap/pages/SwapPage.tsx b/packages/app/src/systems/Swap/pages/SwapPage.tsx index 04b7ddf4..9268872f 100644 --- a/packages/app/src/systems/Swap/pages/SwapPage.tsx +++ b/packages/app/src/systems/Swap/pages/SwapPage.tsx @@ -103,15 +103,18 @@ export function SwapPage() { txCost, }); - const shouldDisableSwap = - isLoading || validationState !== ValidationStateEnum.Swap; + const shouldDisableSwap = !!( + isLoading || + validationState !== ValidationStateEnum.Swap || + !txCost.total || + txCost.error + ); const btnText = getValidationText(validationState, swapState); const { mutate: swap, isLoading: isSwapping } = useMutation( async () => { if (!swapState) return; - if (!txCost?.gas || txCost.error) return; setHasSwapped(false); const res = await swapTokens(contract, swapState, txCost); return res;