-
Notifications
You must be signed in to change notification settings - Fork 8
/
serviceURLManager.ts
38 lines (35 loc) · 1.06 KB
/
serviceURLManager.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import {
GraphQLMonitor,
GridProxyMonitor,
RMBMonitor,
ServiceUrlManager,
TFChainMonitor,
URLManagerOptions,
} from "../src";
const gridproxy = ["http://www.nonexistentgridProxy.com", "http://www.gooogleTF.com", "https://gridproxy.dev.grid.tf/"];
const rmb = ["https://graphql.dev.grid.tf", "wss://relay.dev.grid.tf"];
const graphql = ["https://graphql.dev.grid.tf/graphql"];
const tfChain = ["wss://tfchain.dev.grid.tf/ws", "wss://www.nonExistentChain.com"];
async function checkStacksAvailability<N extends boolean>(services: URLManagerOptions<N>) {
try {
const pickedUrls = await new ServiceUrlManager(services).getAvailableServicesStack();
console.log(pickedUrls);
process.exit(0);
} catch (err) {
console.log(err);
}
}
checkStacksAvailability({
retries: 3,
silent: true,
services: [
{ service: new GridProxyMonitor(), URLs: gridproxy },
{ service: new GraphQLMonitor(), URLs: graphql },
{
service: new RMBMonitor(),
URLs: rmb,
},
{ service: new TFChainMonitor(), URLs: tfChain },
],
timeout: 2,
});