getUtxoInfo method

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

Get utxos

Implementation

Future<UtxoInfo> getUtxoInfo({required String address}) async {
  try {
    var response = await sendMessage(
            formatRequest(method: 'getUtxoInfo', params: [address]))
        .then((Map<String, dynamic> data) {
      if (data.containsKey('result')) {
        return data['result'];
      } else if (data.containsKey('error')) {
        throw NodeException.fromJson(data['error']);
      }
    });

    return UtxoInfo.fromJson(response);
  } on NodeException catch (e) {
    throw NodeException(
        code: e.code, message: '{"getUtxoInfo": "${e.message}"}');
  }
}