getSlot
Returns current slot
Usage Examples
TypeScript (Fetch)
1const response = await fetch("http://[IP_ADDRESS]:[PORT]", {
2 method: "POST",
3 headers: {
4 "Content-Type": "application/json",
5 },
6 body: JSON.stringify({
7 jsonrpc: "2.0",
8 id: 1,
9 method: "getSlot",
10 params: [] // Add relevant parameters here
11 }),
12});
13
14const data = await response.json();
15console.log(data);Python (Requests)
1import requests
2import json
3
4url = "http://[IP_ADDRESS]:[PORT]"
5payload = json.dumps({
6 "jsonrpc": "2.0",
7 "id": 1,
8 "method": "getSlot",
9 "params": [] # Add relevant parameters here
10})
11headers = {
12 'Content-Type': 'application/json'
13}
14
15response = requests.request("POST", url, headers=headers, data=payload)
16print(response.text)Rust (reqwest)
1use reqwest::Client;
2use serde_json::json;
3
4#[tokio::main]
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6 let client = Client::new();
7 let res = client.post("http://[IP_ADDRESS]:[PORT]")
8 .json(&json!({
9 "jsonrpc": "2.0",
10 "id": 1,
11 "method": "getSlot",
12 "params": [] // Add relevant parameters here
13 }))
14 .send()
15 .await?
16 .text()
17 .await?;
18
19 println!("{}", res);
20 Ok(())
21}