Skip to content
This repository has been archived by the owner on Jul 15, 2022. It is now read-only.

[Celo integration] Fix amount calculation in send max when fees exceed spendable amount #1900

Merged
merged 1 commit into from
Apr 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/families/celo/js-getTransactionStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ const getTransactionStatus = async (

const estimatedFees = transaction.fees || new BigNumber(0);

const amount = useAllAmount
let amount = useAllAmount
? account.spendableBalance.minus(estimatedFees)
: new BigNumber(transaction.amount);

if (amount.lt(0)) amount = new BigNumber(0);

if (amount.lte(0) && !transaction.useAllAmount) {
errors.amount = new AmountRequired();
}
Expand Down