getBlockInfo method

Future<BlockContainer> getBlockInfo({
  1. int? height,
})

Implementation

Future<BlockContainer> getBlockInfo({int? height}) async {
  String ht = height != null
      ? "${CosmosBaseConstants.COSMOS_TENDERMINT_BLOCKS}/$height"
      : CosmosBaseConstants.COSMOS_TENDERMINT_BLOCKS_LATEST;

  var rootPath = "${TerraClientConfiguration.blockchainResourcePath}$ht";

  var response = await apiRequester.getAsync<BlockContainer>(rootPath);
  if (response.successful!) {
    return BlockContainer.fromJson(response.result!);
  }

  throw Exception("");
}