getActiveValidatorsPage method

Future<ValidatorPage> getActiveValidatorsPage({
  1. int? epochId,
  2. int first = 50,
  3. String? after,
})

One page of active validators for the current epoch.

Implementation

Future<ValidatorPage> getActiveValidatorsPage({
  int? epochId,
  int first = 50,
  String? after,
}) async {
  _checkPageSize(first);
  final data = await executeData(
    _activeValidatorsOperation,
    generated.Variables$Query$ActiveValidators(
      epochId: epochId,
      first: first,
      after: after,
    ),
  );
  final connection = _required(
    data.epoch?.validatorSet?.activeValidators,
    'ActiveValidators.epoch.validatorSet.activeValidators',
  );
  return ValidatorPage(
    validators: connection.nodes
        .map(
          (node) => ValidatorInfo._fromJson(node.contents?.json ?? const {}),
        )
        .toList(),
    hasNextPage: connection.pageInfo.hasNextPage,
    endCursor: connection.pageInfo.endCursor,
  );
}