getValidatorSet method

Future<List<TendermintValidators>> getValidatorSet({
  1. double? height,
})

Implementation

Future<List<TendermintValidators>> getValidatorSet({double? height}) async {
  String ht = height != null
      ? "${CosmosBaseConstants.COSMOS_TENDERMINT_VALIDATOR_SETS_BASE}/$height"
      : CosmosBaseConstants.COSMOS_TENDERMINT_VALIDATOR_SETS_LATEST;

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

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

  throw Exception("");
}