getUnspents method

Future<List<List<ScripthashUnspent>>> getUnspents(
  1. Iterable<String> scripthashes
)

returns unspents in the same order as scripthashes passed in

Implementation

Future<List<List<ScripthashUnspent>>> getUnspents(
  Iterable<String> scripthashes,
) async {
  var futures = <Future<List<ScripthashUnspent>>>[];
  if (scripthashes.isNotEmpty) {
    peer.withBatch(() {
      for (var scripthash in scripthashes) {
        futures.add(getUnspent(scripthash));
      }
    });
  }
  List<List<ScripthashUnspent>> results =
      await Future.wait<List<ScripthashUnspent>>(futures);
  return results;
}