getValidators method

Future<List<Validator>> getValidators()

Implementation

Future<List<Validator>> getValidators() async {
  String rootPath =
      "${TerraClientConfiguration.blockchainResourcePath}${CosmosBaseConstants.COSMOS_STAKING_VALIDATORS_BASE}";
  // if (options != null)
  // {
  //     rootPath += PaginationOptionExtensions.GetPaginationRules(options);
  // }

  var response = await apiRequester.getAsync<StakingCommonJson>(rootPath);
  if (response.successful!) {
    var result = StakingCommonJson.fromJson(response.result!);
    return result.validators.map((w) => Validator.fromJSON(w)).toList();
  }

  throw Exception("");
}