fetchBlockHeader method

Future<FetchBlockHeaderRes> fetchBlockHeader({
  1. required int blockId,
  2. CallOptions? options,
})

Returns a FetchBlockHeaderRes object for the block at the given blockId.

blockId is an int representing the block ID to retrieve

options is an CallOptions for runtime options with RPC

Throws an Exception if an error occurs during the RPC request.

Implementation

Future<FetchBlockHeaderRes> fetchBlockHeader({
  required int blockId,
  CallOptions? options,
}) async {
  final FetchBlockHeaderReq request = FetchBlockHeaderReq(
    blockId: getBlockIdFromInt(blockId),
  );
  final FetchBlockHeaderRes response = await nodeStub.fetchBlockHeader(
    request,
    options: options,
  );
  return response;
}