getLeaderSchedule RPC Method
Parameters
u64
string
Loading...
object
object
Loading...
commitment
string
Loading...
identity
string
Loading...
Returns
result
Loading...
Request
curl https://docs-demo.solana-devnet.quiknode.pro/ \
-X POST \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","id":1, "method":"getLeaderSchedule"}'require "uri"
require "json"
require "net/http"
url = URI("https://docs-demo.solana-mainnet.quiknode.pro/")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"jsonrpc": "2.0",
"id": 1,
"method": "getLeaderSchedule"
})
response = https.request(request)
puts response.read_body
import { createSolanaRpc } from "@solana/kit";
(async () => {
const solanaRpc = createSolanaRpc("https://docs-demo.solana-mainnet.quiknode.pro/");
try {
const slot = await solanaRpc.getSlot().send();
const leaderSchedule = await solanaRpc.getLeaderSchedule(slot).send();
console.log(leaderSchedule);
} catch (error) {
console.error("Error fetching leader schedule:", error);
}
})();const web3 = require("@solana/web3.js");
(async () => {
const solana = new web3.Connection("https://docs-demo.solana-mainnet.quiknode.pro/");
console.log(await solana.getLeaderSchedule());
})();
from solana.rpc.api import Client
solana_client = Client("https://docs-demo.solana-mainnet.quiknode.pro/")
print(solana_client.get_leader_schedule())use reqwest::header;
use reqwest::Client;
use std::error::Error;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let mut headers = header::HeaderMap::new();
headers.insert("Content-Type", "application/json".parse().unwrap());
let client = Client::new();
let json_data = r#"
{
"jsonrpc": "2.0",
"id": 1,
"method": "getLeaderSchedule"
}
"#;
let response = client
.post("https://docs-demo.solana-mainnet.quiknode.pro/")
.headers(headers)
.body(json_data)
.send()
.await?;
let body = response.text().await?;
println!("{}", body);
Ok(())
}Response
{
"jsonrpc": "2.0",
"result": {
"4Qkev8aNZcqFNSRhQzwyLMFSsi94jHqE8WNVTJzTP99F": [
0,
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,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63
]
},
"id": 1
}Don't have an account yet?
Create your QuickNode endpoint in seconds and start building
Get started for free