The network to get endpoints for.
The type of endpoint to retrieve.
A promise that resolves to an array of endpoints sorted by response time.
import { NETWORK_TYPE, ENDPOINT_TYPE, getEndpointsSorted } from "@akashnetwork/akashjs/build/network";
const displaySortedEndpoints = async () => {
try {
const endpoints = await getEndpointsSorted(NETWORK_TYPE.MAINNET, ENDPOINT_TYPE.RPC);
console.log("Sorted Endpoints:", JSON.stringify(endpoints, null, 2));
} catch (error) {
console.error("Error fetching sorted endpoints:", error);
}
};
displaySortedEndpoints();
Retrieves and sorts endpoints by their health status.