blocks method

Future<List<BlockInfo>> blocks(
  1. int startHeight,
  2. int endHeight
)

Get a range of blocks

Returns blocks from startHeight to endHeight inclusive

Implementation

Future<List<pb.BlockInfo>> blocks(int startHeight, int endHeight) async {
  if (startHeight < 0 || endHeight < startHeight) {
    throw ValidationException('Invalid block height range');
  }

  final data = await _proxy.get('/blocks/$startHeight/$endHeight');
  final blocks = pb.Blocks()..mergeFromBuffer(data);
  return blocks.blocks.toList();
}