getNodeList method

Future<List<Node>> getNodeList()

Query the node infos

Returns a List<Node> with infos

Implementation

Future<List<Node>> getNodeList() async {
  const methodName = 'getNodeList';
  return withRetry(
    actionName: methodName,
    action: () async {
      const body =
          'query {nodes {authorized available averageAvailability firstPublicKey geoPatch ip lastPublicKey networkPatch port rewardAddress authorizationDate enrollmentDate}}';

      final result = await _client
          .withLogger(
            methodName,
          )
          .query(
            QueryOptions(
              document: gql(body),
              parserFn: (json) => NodesResponseData.fromJson(json).nodes!,
            ),
          );
      manageLinkException(result);

      return result.parsedData ?? [];
    },
    maxRetries: maxRetries,
    retryDelay: retryDelay,
  );
}