getNearestEndpoints method

Future<List<Endpoint>> getNearestEndpoints()

List the nearest endpoints nodes from the client's IP Returns a List<Endpoint> with infos

Implementation

Future<List<Endpoint>> getNearestEndpoints() async {
  const body = 'query { nearestEndpoints { ip, port } }';

  final result = await _client
      .withLogger(
        'getNearestEndpoints',
      )
      .query(
        QueryOptions(
          document: gql(body),
          parserFn: (json) =>
              NearestEndpointsResponseData.fromJson(json).endpoints,
        ),
      );
  manageLinkException(result);

  return result.parsedData ?? [];
}