computeBalanceFromUTXOs function

BigInt computeBalanceFromUTXOs({
  1. required Iterable<UTXOTransaction> txList,
})

Implementation

BigInt computeBalanceFromUTXOs({
  required Iterable<UTXOTransaction> txList,
}) {
  BigInt balance = BigInt.zero;
  for (final tx in txList) {
    for (final ElectrumOutput output in tx.outputs) {
      if (output.spent == false && output.belongsToUs == true) {
        balance += output.value;
      }
    }
  }
  return balance;
}