fetchBlockBody method
Returns a FetchBlockBodyRes object for the block at the given blockId.
blockIdBytes is an List of bytes representing the block ID to retrieve
blockIdString is an String representing the block ID to retrieve
options is an CallOptions for runtime options with RPC
Throws an Exception if block ID validation fails or an error occurs during the RPC request.
Implementation
Future<FetchBlockBodyRes> fetchBlockBody({
List<int> blockIdBytes = const [],
String blockIdString = "",
CallOptions? options,
}) async {
if (blockIdBytes.isEmpty && blockIdString.isEmpty) {
throw Exception(ErrorMessages.missingBlockId);
}
final FetchBlockBodyReq request = FetchBlockBodyReq(
blockId: blockIdBytes.isNotEmpty ? getBlockIdFromList(blockIdBytes) : getBlockIdFromString(blockIdString));
final FetchBlockBodyRes response = await nodeStub.fetchBlockBody(
request,
options: options,
);
return response;
}