import { Avalanche } from "@avalanche-sdk/chainkit";
const avalanche = new Avalanche({
network: "mainnet",
});
async function run() {
const result = await avalanche.metrics.networks.getStakingMetrics({
metric: "validatorCount",
startTimestamp: 1689541049,
endTimestamp: 1689800249,
pageSize: 10,
});
for await (const page of result) {
console.log(page);
}
}
run();{
"results": [
{
"value": 123,
"timestamp": 123
}
],
"nextPageToken": "<string>"
}Gets staking metrics for a given subnet.
import { Avalanche } from "@avalanche-sdk/chainkit";
const avalanche = new Avalanche({
network: "mainnet",
});
async function run() {
const result = await avalanche.metrics.networks.getStakingMetrics({
metric: "validatorCount",
startTimestamp: 1689541049,
endTimestamp: 1689800249,
pageSize: 10,
});
for await (const page of result) {
console.log(page);
}
}
run();{
"results": [
{
"value": 123,
"timestamp": 123
}
],
"nextPageToken": "<string>"
}Which network level metric to fetch.
delegatorCount, delegatorWeight, validatorCount, validatorWeight Either mainnet or testnet/fuji.
mainnet, fuji, testnet Query param for retrieving items after a specific timestamp.
x >= 0Query param for retrieving items before a specific timestamp.
x >= 0A page token, received from a previous list call. Provide this to retrieve the subsequent page.
The maximum number of items to return. The minimum page size is 1. The maximum pageSize is 2160.
1 <= x <= 2160Was this page helpful?