getBlocksWithLimit RPC Method
Please note that for this RPC method, block range limits are set to 5 for Free Trial plans and 1005 for all paid accounts.
Parameter
start_slot
Zeichenkette
ERFORDERLICH
Wird geladen...
Grenzwert
Zeichenkette
ERFORDERLICH
Wird geladen...
Objekt
Objekt
Wird geladen...
commitment
Zeichenkette
Wird geladen...
finalized
Zeichenkette
Wird geladen...
confirmed
Zeichenkette
Wird geladen...
Rücksendungen
Ergebnis
Wird geladen...
Anfrage
1curl https://docs-demo.solana-mainnet.quiknode.pro/ \2-X POST \3-H "Content-Type: application/json" \4-d $'5{6"jsonrpc": "2.0",7"id":1,8"method":"getBlocksWithLimit",9"params":[5, 3]10}11'
1curl https://docs-demo.solana-mainnet.quiknode.pro/ \2-X POST \3-H "Content-Type: application/json" \4-d $'5{6"jsonrpc": "2.0",7"id":1,8"method":"getBlocksWithLimit",9"params":[5, 3]10}11'
1require "uri"2require "json"3require „net/http“45url = URI("https://docs-demo.solana-mainnet.quiknode.pro/")67https = Net::HTTP.new(url.host, URL.Port)8https.use_ssl = true910Anfrage = Netto::HTTP::POST.new(URL)11Anfrage[„Content-Type“] = „application/json“12Anfrage.Inhalt = JSON.dump({13„jsonrpc“: "2.0",14„id“: 1,15"method": "getBlocksWithLimit",16„params“: [175,18319]20})2122Antwort = https.Anfrage(Anfrage)23gibt die Antwort aus.read_body24
1require "uri"2require "json"3require „net/http“45url = URI("https://docs-demo.solana-mainnet.quiknode.pro/")67https = Net::HTTP.new(url.host, URL.Port)8https.use_ssl = true910Anfrage = Netto::HTTP::POST.new(URL)11Anfrage[„Content-Type“] = „application/json“12Anfrage.Inhalt = JSON.dump({13„jsonrpc“: "2.0",14„id“: 1,15"method": "getBlocksWithLimit",16„params“: [175,18319]20})2122Antwort = https.Anfrage(Anfrage)23gibt die Antwort aus.read_body24
1import { createSolanaRpc } from "@solana/kit";23(async () => {4const solanaRpc = createSolanaRpc("https://docs-demo.solana-mainnet.quiknode.pro/");56try {7const blocks = await solanaRpc.getBlocksWithLimit(BigInt(5), 3).send();8console.log(blocks);9} catch (error) {10console.error("Error fetching blocks with limit:", error);11}12})();
1import { createSolanaRpc } from "@solana/kit";23(async () => {4const solanaRpc = createSolanaRpc("https://docs-demo.solana-mainnet.quiknode.pro/");56try {7const blocks = await solanaRpc.getBlocksWithLimit(BigInt(5), 3).send();8console.log(blocks);9} catch (error) {10console.error("Error fetching blocks with limit:", error);11}12})();
1// not currently supported by solanaJS2const axios = require("axios");3(() => {4const config = {5headers: {6"Content-Type": "application/json",7},8};9const data = {10jsonrpc: "2.0",11id: 1,12method: "getBlocksWithLimit",13params: [5, 3],14};15axios16.post("https://docs-demo.solana-mainnet.quiknode.pro/", data, config)17.then(function (response) {18// handle success19console.log(response.data);20})21.catch((err) => {22// handle error23console.log(err);24});25})();26
1// not currently supported by solanaJS2const axios = require("axios");3(() => {4const config = {5headers: {6"Content-Type": "application/json",7},8};9const data = {10jsonrpc: "2.0",11id: 1,12method: "getBlocksWithLimit",13params: [5, 3],14};15axios16.post("https://docs-demo.solana-mainnet.quiknode.pro/", data, config)17.then(function (response) {18// handle success19console.log(response.data);20})21.catch((err) => {22// handle error23console.log(err);24});25})();26
1from jsonrpcclient import request, parse, Ok2import logging3import requests4response = requests.post("https://docs-demo.solana-mainnet.quiknode.pro/",json=request("getBlocksWithLimit", params=[5,3]))5parsed = parse(response.json())6if isinstance(parsed, Ok):7print(parsed.result)8sonst:9logging.error(parsed.message)10
1from jsonrpcclient import request, parse, Ok2import logging3import requests4response = requests.post("https://docs-demo.solana-mainnet.quiknode.pro/",json=request("getBlocksWithLimit", params=[5,3]))5parsed = parse(response.json())6if isinstance(parsed, Ok):7print(parsed.result)8sonst:9logging.error(parsed.message)10
1use reqwest::header;2use reqwest::Client;3use std::error::Error;45#[tokio::main]6async fn main() -> Result<(), Box<dyn Error>> {7let mut headers = header::HeaderMap::new();8headers.insert("Content-Type", "application/json".parse().unwrap());910let client = Client::new();11let json_data = r#"12{13"jsonrpc": "2.0",14"id": 1,15"method": "getBlocksWithLimit",16"params": [175,18319]20}21"#;22let response = client23.post("https://docs-demo.solana-mainnet.quiknode.pro/")24.headers(headers)25.body(json_data)26.send()27.await?;2829let body = response.text().await?;30println!("{}", body);3132Ok(())33}34
1use reqwest::header;2use reqwest::Client;3use std::error::Error;45#[tokio::main]6async fn main() -> Result<(), Box<dyn Error>> {7let mut headers = header::HeaderMap::new();8headers.insert("Content-Type", "application/json".parse().unwrap());910let client = Client::new();11let json_data = r#"12{13"jsonrpc": "2.0",14"id": 1,15"method": "getBlocksWithLimit",16"params": [175,18319]20}21"#;22let response = client23.post("https://docs-demo.solana-mainnet.quiknode.pro/")24.headers(headers)25.body(json_data)26.send()27.await?;2829let body = response.text().await?;30println!("{}", body);3132Ok(())33}34
Antwort
1{2„jsonrpc“: "2.0",3„Ergebnis“: [45,56,677],8„id“: 19}
1{2„jsonrpc“: "2.0",3„Ergebnis“: [45,56,677],8„id“: 19}
Haben Sie noch kein Konto?
Erstellen Sie Ihren Quicknode-Endpunkt in Sekundenschnelle und legen Sie los
Kostenlos loslegen