getAssetBalances method

Future<List<ScripthashAssetBalances>> getAssetBalances(
  1. List<String> scripthashes
)

returns balances in the same order as scripthashes passed in

Implementation

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