-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathnode.ts
More file actions
34 lines (28 loc) · 769 Bytes
/
node.ts
File metadata and controls
34 lines (28 loc) · 769 Bytes
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
import { ConnectionError } from "@threefold/types";
import { Client } from "../../lib/client";
async function main() {
// create client
const client = new Client(
"wss://tfchain.dev.grid.tf/ws",
`wss://relay.dev.grid.tf/`,
"<mnemonic>",
"test_client",
"sr25519",
5,
);
try {
// connect socket
await client.connect();
// send request
const requestID = await client.send("zos.statistics.get", undefined, 17, 5);
// get response
const response = await client.read(requestID);
// print response
console.log({ response });
} catch (err) {
throw new ConnectionError(`RMB Client connection failed due to ${err}`);
} finally {
client.disconnect();
}
}
main().then(() => console.log("Done."));