Overzicht
These examples show the SDK shape across supported Quicknode products. They assume you already initialized the SDK as qn from the Snelstart.
Beheer-API
Use the Admin API client to inspect and manage account resources such as endpoints, teams, usage, billing, security, and rate limits.
- Node.js
Python
- Roest
- Ruby
import { QuicknodeSdk } from "@quicknode/sdk";
const qn = QuicknodeSdk.fromEnv();
const endpoints = await qn.admin.getEndpoints({
limit: 20,
sortBy: "created_at",
sortDirection: "desc",
});
for (const endpoint of endpoints.data) {
console.log(endpoint.id, endpoint.name, endpoint.status);
}
import asyncio
from quicknode_sdk import QuicknodeSdk
async def main():
qn = QuicknodeSdk.from_env()
endpoints = await qn.admin.get_endpoints(
limit=20,
sort_by="created_at",
sort_direction="desc",
)
for endpoint in endpoints.data:
print(endpoint.id, endpoint.name, endpoint.status)
asyncio.run(main())
use quicknode_sdk::{admin::GetEndpointsRequest, QuicknodeSdk};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let qn = QuicknodeSdk::from_env()?;
let params = GetEndpointsRequest {
limit: Some(20),
sort_by: Some("created_at".to_string()),
sort_direction: Some("desc".to_string()),
..Default::default()
};
let endpoints = qn.admin.get_endpoints(¶ms).await?;
for endpoint in endpoints.data {
println!("{} {} {}", endpoint.id, endpoint.name, endpoint.status);
}
Ok(())
}
require "json"
require "quicknode_sdk"
qn = QuicknodeSdk::SDK.from_env
endpoints = qn.admin.get_endpoints(
limit: 20,
sort_by: "created_at",
sort_direction: "desc",
)
endpoints["data"].each do |endpoint|
puts "#{endpoint["id"]} #{endpoint["name"]} #{endpoint["status"]}"
end
For the full API surface, see the Admin API docs.
RPC & Tooling Access
You can use the RPC client to send JSON-RPC requests to the account's Tooling Access endpoint; qn.rpc mints and refreshes the session JWT for each call. Enable Tooling Access first with the qn.admin control-plane methods (requires an admin role). Pass netwerk to route a call to a specific network.
- Node.js
Python
- Roest
- Ruby
import { QuicknodeSdk } from "@quicknode/sdk";
const qn = QuicknodeSdk.fromEnv();
// Enable Tooling Access once (idempotent; requires an admin role).
const status = await qn.admin.toolingAccessStatus();
if (!status.enabled) {
await qn.admin.enableToolingAccess();
}
// params defaults to []; pass an array (positional) or object (named).
const blockNumber = await qn.rpc.call("eth_blockNumber");
const balance = await qn.rpc.call("eth_getBalance", ["0xabc...", "latest"]);
console.log(blockNumber, balance);
// Route a call to a specific network by its multichain key.
const slot = await qn.rpc.call("getSlot", [], "solana-mainnet");
console.log(slot);
import asyncio
from quicknode_sdk import QuicknodeSdk
async def main():
qn = QuicknodeSdk.from_env()
# Enable Tooling Access once (idempotent; requires an admin role).
status = await qn.admin.tooling_access_status()
if not status.enabled:
await qn.admin.enable_tooling_access()
block_number = await qn.rpc.call("eth_blockNumber")
balance = await qn.rpc.call("eth_getBalance", ["0xabc...", "latest"])
print(block_number, balance)
# Route a call to a specific network by its multichain key.
slot = await qn.rpc.call("getSlot", network="solana-mainnet")
print(slot)
asyncio.run(main())
use quicknode_sdk::QuicknodeSdk;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let qn = QuicknodeSdk::from_env()?;
// Enable Tooling Access once (idempotent; requires an admin role).
let status = qn.admin.tooling_access_status().await?;
if !status.enabled {
qn.admin.enable_tooling_access().await?;
}
// call(method, params, network, endpoint_url). params is Option; None defaults to [].
let block_number = qn.rpc.call("eth_blockNumber", None, None, None).await?;
let balance = qn
.rpc
.call(
"eth_getBalance",
Some(serde_json::json!(["0xabc...", "latest"])),
None,
None,
)
.await?;
println!("{:?} {:?}", block_number, balance);
Ok(())
}
require "quicknode_sdk"
qn = QuicknodeSdk::SDK.from_env
# Enable Tooling Access once (idempotent; requires an admin role).
status = qn.admin.tooling_access_status
qn.admin.enable_tooling_access unless status["enabled"]
block_number = qn.rpc.call(method: "eth_blockNumber")
balance = qn.rpc.call(method: "eth_getBalance", params: ["0xabc...", "latest"])
puts block_number
puts balance
# Route a call to a specific network by its multichain key.
slot = qn.rpc.call(method: "getSlot", network: "solana-mainnet")
puts slot
Stromen
Use the Streams client to list, inspect, create, update, pause, activate, delete, and test Streams. The example below lists Streams, counts enabled Streams, and dry-runs a filter without changing account state.
- Node.js
Python
- Roest
- Ruby
import { QuicknodeSdk, StreamDataset } from "@quicknode/sdk";
const qn = QuicknodeSdk.fromEnv();
const streams = await qn.streams.listStreams({ limit: 10 });
console.log(`Streams: ${streams.pageInfo.total}`);
const enabled = await qn.streams.getEnabledCount();
console.log(`Enabled Streams: ${enabled.total}`);
const filterFunction = Buffer.from(`
function main(data) {
return data;
}
`).toString("base64");
const result = await qn.streams.testFilter({
network: "ethereum-mainnet",
dataset: StreamDataset.Block,
block: "17811625",
filterFunction,
});
console.log(result.result);
import asyncio
import base64
from quicknode_sdk import QuicknodeSdk
async def main():
qn = QuicknodeSdk.from_env()
streams = await qn.streams.list_streams(limit=10)
print(f"Streams: {streams.page_info.total}")
enabled = await qn.streams.get_enabled_count()
print(f"Enabled Streams: {enabled.total}")
filter_function = base64.b64encode(
b"function main(data) { return data; }"
).decode()
result = await qn.streams.test_filter(
network="ethereum-mainnet",
dataset="block",
block="17811625",
filter_function=filter_function,
)
print(result.result)
asyncio.run(main())
use quicknode_sdk::{
streams::{ListStreamsParams, StreamDataset, TestFilterParams},
QuicknodeSdk,
};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let qn = QuicknodeSdk::from_env()?;
let streams = qn
.streams
.list_streams(&ListStreamsParams {
limit: Some(10),
offset: Some(0),
..Default::default()
})
.await?;
println!("Streams: {}", streams.page_info.total);
let enabled = qn.streams.get_enabled_count(None).await?;
println!("Enabled Streams: {}", enabled.total);
let result = qn
.streams
.test_filter(&TestFilterParams {
network: "ethereum-mainnet".to_string(),
dataset: StreamDataset::Block,
block: "17811625".to_string(),
filter_function: Some(
"ZnVuY3Rpb24gbWFpbihkYXRhKSB7IHJldHVybiBkYXRhOyB9".to_string(),
),
filter_language: None,
address_book_config: None,
})
.await?;
println!("{}", result.result);
Ok(())
}
require "base64"
require "json"
require "quicknode_sdk"
qn = QuicknodeSdk::SDK.from_env
streams = qn.streams.list_streams({ limit: 10, offset: 0 })
puts "Streams: #{streams["pageInfo"]["total"]}"
enabled = qn.streams.get_enabled_count({})
puts "Enabled Streams: #{enabled["total"]}"
filter_function = Base64.strict_encode64("function main(data) { return data; }")
result = qn.streams.test_filter(
network: "ethereum-mainnet",
dataset: "block",
block: "17811625",
filter_function: filter_function,
)
puts result["result"]
For destination options, supported datasets, and request details, see the Streams REST API docs.
Webhooks
Use the Webhooks client to list webhooks, inspect a webhook, create a webhook from a template, pause or activate delivery, and retrieve enabled counts. The example below is read-only.
- Node.js
Python
- Roest
- Ruby
import { QuicknodeSdk } from "@quicknode/sdk";
const qn = QuicknodeSdk.fromEnv();
const webhooks = await qn.webhooks.listWebhooks({
limit: 10,
offset: 0,
});
for (const webhook of webhooks.data) {
console.log(webhook.id, webhook.name, webhook.status);
}
const enabled = await qn.webhooks.getEnabledCount();
console.log(`Enabled webhooks: ${enabled.total}`);
import asyncio
from quicknode_sdk import QuicknodeSdk
async def main():
qn = QuicknodeSdk.from_env()
webhooks = await qn.webhooks.list_webhooks(limit=10, offset=0)
for webhook in webhooks.data:
print(webhook.id, webhook.name, webhook.status)
enabled = await qn.webhooks.get_enabled_count()
print(f"Enabled webhooks: {enabled.total}")
asyncio.run(main())
use quicknode_sdk::{webhooks::GetWebhooksParams, QuicknodeSdk};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let qn = QuicknodeSdk::from_env()?;
let webhooks = qn
.webhooks
.list_webhooks(&GetWebhooksParams {
limit: Some(10),
offset: Some(0),
})
.await?;
for webhook in webhooks.data {
println!("{} {} {}", webhook.id, webhook.name, webhook.status);
}
let enabled = qn.webhooks.get_enabled_count().await?;
println!("Enabled webhooks: {}", enabled.total);
Ok(())
}
require "json"
require "quicknode_sdk"
qn = QuicknodeSdk::SDK.from_env
webhooks = qn.webhooks.list_webhooks({ limit: 10, offset: 0 })
webhooks["data"].each do |webhook|
puts "#{webhook["id"]} #{webhook["name"]} #{webhook["status"]}"
end
enabled = qn.webhooks.get_enabled_count
puts "Enabled webhooks: #{enabled["total"]}"
For template behavior and destination configuration, see the Webhooks REST API docs.
Key-Value-opslag
Use the Key-Value Store client for simple persisted state. Sets store one string value per key. Lists store ordered string collections under one key.
- Node.js
Python
- Roest
- Ruby
import { QuicknodeSdk } from "@quicknode/sdk";
const qn = QuicknodeSdk.fromEnv();
const sets = await qn.kvstore.getSets({ limit: 10 });
console.log(`Sets: ${sets.data.length}`);
if (sets.data.length > 0) {
const set = await qn.kvstore.getSet(sets.data[0].key);
console.log(set.value);
}
const lists = await qn.kvstore.getLists({ limit: 10 });
console.log(`Lists: ${lists.data.keys.length}`);
import asyncio
from quicknode_sdk import QuicknodeSdk
async def main():
qn = QuicknodeSdk.from_env()
sets = await qn.kvstore.get_sets(limit=10)
print(f"Sets: {len(sets.data)}")
if len(sets.data) > 0:
set_value = await qn.kvstore.get_set(sets.data[0].key)
print(set_value.value)
lists = await qn.kvstore.get_lists(limit=10)
print(f"Lists: {len(lists.data.keys)}")
asyncio.run(main())
use quicknode_sdk::{
kvstore::{GetListsParams, GetSetsParams},
QuicknodeSdk,
};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let qn = QuicknodeSdk::from_env()?;
let sets = qn
.kvstore
.get_sets(&GetSetsParams {
limit: Some(10),
cursor: None,
})
.await?;
println!("Sets: {}", sets.data.len());
if let Some(first_set) = sets.data.first() {
let set = qn.kvstore.get_set(&first_set.key).await?;
println!("{}", set.value);
}
let lists = qn
.kvstore
.get_lists(&GetListsParams {
limit: Some(10),
cursor: None,
})
.await?;
println!("Lists: {}", lists.data.keys.len());
Ok(())
}
require "json"
require "quicknode_sdk"
qn = QuicknodeSdk::SDK.from_env
sets = qn.kvstore.get_sets({ limit: 10 })
puts "Sets: #{sets["data"].length}"
unless sets["data"].empty?
set = qn.kvstore.get_set(key: sets["data"][0]["key"])
puts set["value"]
end
lists = qn.kvstore.get_lists({ limit: 10 })
puts "Lists: #{lists["data"]["keys"].length}"
For all list and set operations, see the Key-Value Store REST API docs.
SQL Explorer
Use the SQL Explorer client to run SQL queries against indexed blockchain data and retrieve table schemas.
- Node.js
Python
- Roest
- Ruby
import { QuicknodeSdk } from "@quicknode/sdk";
const qn = QuicknodeSdk.fromEnv();
// Run a SQL query
const result = await qn.sql.query(
"SELECT action_type, user FROM hyperliquid_system_actions LIMIT 3",
"hyperliquid-core-mainnet"
);
console.log(`${result.rows} rows, ${result.credits} credits`);
// Get the schema for a cluster
const schema = await qn.sql.getSchema("hyperliquid-core-mainnet");
console.log(schema);
import asyncio
from quicknode_sdk import QuicknodeSdk
async def main():
qn = QuicknodeSdk.from_env()
# Run a SQL query
result = await qn.sql.query(
"SELECT action_type, user FROM hyperliquid_system_actions LIMIT 3",
"hyperliquid-core-mainnet",
)
print(f"{result.rows} rows, {result.credits} credits")
# Get the schema for a cluster
schema = await qn.sql.get_schema("hyperliquid-core-mainnet")
print(schema)
asyncio.run(main())
use quicknode_sdk::QuicknodeSdk;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let qn = QuicknodeSdk::from_env()?;
// Run a SQL query
let result = qn
.sql
.query(
"SELECT action_type, user FROM hyperliquid_system_actions LIMIT 3",
"hyperliquid-core-mainnet",
)
.await?;
println!("{} rows, {} credits", result.rows, result.credits);
// Get the schema for a cluster
let schema = qn.sql.get_schema("hyperliquid-core-mainnet").await?;
println!("{:?}", schema);
Ok(())
}
require "json"
require "quicknode_sdk"
qn = QuicknodeSdk::SDK.from_env
# Run a SQL query
result = qn.sql.query(
"SELECT action_type, user FROM hyperliquid_system_actions LIMIT 3",
"hyperliquid-core-mainnet",
)
puts "#{result["rows"]} rows, #{result["credits"]} credits"
# Get the schema for a cluster
schema = qn.sql.get_schema("hyperliquid-core-mainnet")
puts schema
For query syntax and available tables, see the SQL Explorer docs.
Agent workflow example
Agents can combine clients in one run. For example, a release automation agent can inspect endpoints, Streams, Webhooks, Key-Value Store state, and query blockchain data before deciding what action to take.
import { QuicknodeSdk } from "@quicknode/sdk";
const qn = QuicknodeSdk.fromEnv();
const endpoints = await qn.admin.getEndpoints({ tagLabels: ["sdk-managed"] });
const streams = await qn.streams.listStreams({ limit: 10 });
const webhooks = await qn.webhooks.listWebhooks({ limit: 10 });
const sets = await qn.kvstore.getSets({ limit: 10 });
const trades = await qn.sql.query(
"SELECT * FROM hyperliquid_trades LIMIT 5",
"hyperliquid-core-mainnet"
);
console.log({
endpoints: endpoints.data.length,
streams: streams.data.length,
webhooks: webhooks.data.length,
sets: sets.data.length,
trades: trades.rows,
});