getUtxoInfo method

Future<List<Utxo>> getUtxoInfo({
  1. required String address,
})

Implementation

Future<List<Utxo>> getUtxoInfo({required String address}) async {
  Uri urlEndpoint = api('address/utxos', {'addresses': address});

  // Await the http get response, then decode the json-formatted response.
  try {
    var response = await client.get(urlEndpoint);
    List<dynamic> _utxos = response[0]['utxos'] as List<dynamic>;
    List<Utxo> utxos = [];
    _utxos.forEach((element) {
      utxos.add(Utxo.fromJson(element));
    });

    return utxos;
  } catch (e) {
    return [];
  }
}