getNodeList method

Future<List<Node>> getNodeList()

Query the node infos Returns a List<Node> with infos

Implementation

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

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

  if (result.exception?.linkException != null) {
    throw ArchethicConnectionException(
      result.exception!.linkException.toString(),
    );
  }

  return result.parsedData ?? [];
}