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

Commit

Permalink
🐛 Fix balance validation logic (#2023)
Browse files Browse the repository at this point in the history
  • Loading branch information
sameersubudhi authored Feb 19, 2024
1 parent 68a16b0 commit e5e8011
Showing 1 changed file with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -316,17 +316,11 @@ const validateTransactionParams = async transaction => {

if (transaction.params.tokenID) {
const senderAddress = getLisk32AddressFromPublicKey(transaction.senderPublicKey);
const {
data: { extraCommandFees },
} = await getTokenConstants();
const {
data: [balanceInfo],
} = await getTokenBalances({ address: senderAddress, tokenID: transaction.params.tokenID });

if (
BigInt(balanceInfo.availableBalance) <
BigInt(transaction.params.amount) + BigInt(extraCommandFees.userAccountInitializationFee)
) {
if (BigInt(balanceInfo.availableBalance) < BigInt(transaction.params.amount)) {
throw new ValidationException(
`${senderAddress} has insufficient balance for ${transaction.params.tokenID} to send the transaction.`,
);
Expand Down

0 comments on commit e5e8011

Please sign in to comment.