block method

Future<BlockResponse> block(
  1. String hashOrHeight
)

Get a block by hash or height

hashOrHeight can be:

  • Block hash as hex string (64 characters)
  • Block height as integer (as string)

Implementation

Future<BlockResponse> block(String hashOrHeight) async {
  if (hashOrHeight.isEmpty) {
    throw ValidationException('Hash or height cannot be empty');
  }

  final data = await _proxy.get('/block/$hashOrHeight');
  final block = pb.Block()..mergeFromBuffer(data);
  return block;
}