getNearestEndpoints method

Future<List<Endpoint>> getNearestEndpoints()

List the nearest endpoints nodes from the client's IP

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 ?? [];
}