getNearestEndpoints method
List the nearest endpoints nodes from the client's IP
Implementation
Future<List<Endpoint>> getNearestEndpoints() async {
const methodName = 'getNearestEndpoints';
return withRetry(
actionName: methodName,
action: () async {
const body = 'query { nearestEndpoints { ip, port } }';
final result = await _client
.withLogger(
methodName,
)
.query(
QueryOptions(
document: gql(body),
parserFn: (json) =>
NearestEndpointsResponseData.fromJson(json).endpoints,
),
);
manageLinkException(result);
return result.parsedData ?? [];
},
maxRetries: maxRetries,
retryDelay: retryDelay,
);
}