getRedelegations method

Future<List<RedelegationResponseJSON>> getRedelegations(
  1. String delegator,
  2. String? validatorSrc,
  3. String? validatorDst
)

Implementation

Future<List<RedelegationResponseJSON>> getRedelegations(
    String delegator, String? validatorSrc, String? validatorDst) async {
  String rootPath =
      "${TerraClientConfiguration.blockchainResourcePath}${CosmosBaseConstants.COSMOS_STAKING_DELEGATORS_BASE}/$delegator/${CosmosStakingConstants.REDELEGATIONS}?src_validator_addr=$validatorSrc&dst_validator_addr=$validatorDst";
  // 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.redelegation_responses;
  }

  throw Exception("");
}