getDelegations method
Implementation
Future<List<Delegation>> getDelegations(
{String delegator = "",
String validator = "",
PaginationOptions? options}) async {
if (delegator.isNotEmpty && validator.isNotEmpty) {
return (await DelegationHelper.getDelegationsForAllValuesReady(
apiRequester, delegator, validator,
options: options))
.map((w) => Delegation.fromJSON(w))
.toList();
} else if (delegator.isNotEmpty && validator.isEmpty) {
return (await DelegationHelper.getDelegationsForDelegatorsOnly(
apiRequester, delegator,
options: options))
.map((w) => Delegation.fromJSON(w))
.toList();
} else if (delegator.isEmpty && validator.isNotEmpty) {
return (await DelegationHelper.getDelegationsForValidatorsOnly(
apiRequester, validator,
options: options))
.map((w) => Delegation.fromJSON(w))
.toList();
}
throw Exception("arguments delegator and validator cannot both be empty");
}