getValidator method

Future<Validator> getValidator(
  1. String validator
)

Implementation

Future<Validator> getValidator(String validator) async {
  String rootPath =
      "${TerraClientConfiguration.blockchainResourcePath}${CosmosBaseConstants.COSMOS_STAKING_VALIDATORS_BASE}/$validator";

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

  throw Exception("");
}