Skip to content

Commit

Permalink
fix: error message if insufficient tokens (#1124)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xKheops authored Oct 23, 2023
1 parent 886f855 commit dd7b70d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions apps/extension/src/ui/domains/SendFunds/useSendFunds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,14 +401,6 @@ const useSendFundsProvider = () => {
if (token && balance && transfer && balance.transferable.planck < transfer.planck)
return { isValid: false, error: t("Insufficient {{symbol}}", { symbol: token.symbol }) }

const txError = evmTransaction?.error || subTransaction?.error
if (txError)
return {
isValid: false,
error: t("Failed to validate transaction"),
errorDetails: (txError as Error)?.message ?? txError?.toString?.() ?? t("Unknown error"),
}

if (
!from ||
!to ||
Expand Down Expand Up @@ -453,6 +445,14 @@ const useSendFundsProvider = () => {
}
}

const txError = evmTransaction?.error || subTransaction?.error
if (txError)
return {
isValid: false,
error: t("Failed to validate transaction"),
errorDetails: (txError as Error)?.message ?? txError?.toString?.() ?? t("Unknown error"),
}

return { isValid: true, error: undefined }
} catch (err) {
log.error("checkIsValid", { err })
Expand Down

0 comments on commit dd7b70d

Please sign in to comment.