Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
test: fix disable button if gas is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
luizstacio committed Jun 24, 2022
1 parent 6a37e3c commit 4f1b266
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/app/src/systems/Swap/pages/SwapPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4f1b266

Please sign in to comment.