getAccountBalanceWithAdress method

Future<String> getAccountBalanceWithAdress(
  1. String adress, [
  2. bool testNetwork = true
])

Implementation

Future<String> getAccountBalanceWithAdress(String adress,
    [bool testNetwork = true]) async {
  final utxos = await getUTXOs(address: adress, testNetwork: testNetwork);
  int satoshis = 0;

  for (var utxo in utxos) {
    satoshis += utxo["value"] as int;
  }

  final bitcoinAmount =
      BitcoinFormatter.satoshiToBitcoin(satoshis.toString());
  return bitcoinAmount;
}