Skip to content

Commit

Permalink
Merge pull request #379 from tangem/bugfix/AND-5295_utxo-tx-amount-ca…
Browse files Browse the repository at this point in the history
…lculation

AND-5295 utxo history amount calculation
  • Loading branch information
kozarezvlad authored Nov 17, 2023
2 parents 973a27f + 2dd3da3 commit ec35479
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,13 @@ internal class BitcoinTransactionHistoryProvider(
outputs + fee
} else {
val outputs = tx.vout
.find { it.addresses?.contains(walletAddress) == true}
?.value.toBigDecimalOrDefault()
.filter { it.addresses?.contains(walletAddress) == true }
.map { it.value.toBigDecimalOrDefault() }
.sumOf { it }
val inputs = tx.vin
.find { it.addresses?.contains(walletAddress) == true }
?.value.toBigDecimalOrDefault()
.filter { it.addresses?.contains(walletAddress) == true }
.map { it.value.toBigDecimalOrDefault() }
.sumOf { it }
outputs - inputs
}

Expand Down

0 comments on commit ec35479

Please sign in to comment.