Skip to content

Commit

Permalink
fix: amount calculation for unusual txs
Browse files Browse the repository at this point in the history
  • Loading branch information
mahnunchik committed Oct 3, 2024
1 parent f01056e commit eb594b8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/TxTransformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ export default class TxTransformer {
changeAddress = undefined;
} else {
incoming = false;
amount = new Amount(-1n * value - totalFee, this.#wallet.crypto.decimals);
if (-1n * value >= totalFee) {
amount = new Amount(-1n * value - totalFee, this.#wallet.crypto.decimals);
} else {
amount = new Amount(-1n * value, this.#wallet.crypto.decimals);
}
to = tx.vout[0].scriptPubKey.addresses[0];
}
let status;
Expand Down

0 comments on commit eb594b8

Please # to comment.