getUnbondingDelegationsForValidatorsOnly static method

Future<List<UnbondingDelegation>> getUnbondingDelegationsForValidatorsOnly(
  1. TerraRestfulService apiRequester,
  2. String validator, {
  3. PaginationOptions? options,
})

Implementation

static Future<List<UnbondingDelegation>>
    getUnbondingDelegationsForValidatorsOnly(
        TerraRestfulService apiRequester, String validator,
        {PaginationOptions? options}) async {
  String rootPath =
      "${TerraClientConfiguration.blockchainResourcePath}${CosmosBaseConstants.COSMOS_STAKING_VALIDATORS_BASE}/$validator/${CosmosStakingConstants.UNBONDING_DELEGATIONS}";

  // if (options != null)
  // {
  //     rootPath += PaginationOptionExtensions.GetPaginationRules(options);
  // }

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

  throw Exception("");
}