GET
/
v2
/
networks
/
{network}
/
metrics
/
{metric}
import { AvaCloudSDK } from "@avalabs/avacloud-sdk";

const avaCloudSDK = new AvaCloudSDK({
  chainId: "43114",
  network: "mainnet",
});

async function run() {
  const result = await avaCloudSDK.metrics.chain.metrics.getStakingMetrics({
    metric: "validatorCount",
    startTimestamp: 1689541049,
    endTimestamp: 1689800249,
    network: "mainnet",
  });

  for await (const page of result) {
    // Handle the page
    console.log(page);
  }
}

run();
{
  "nextPageToken": "<string>",
  "results": [
    {
      "value": 123,
      "timestamp": 123
    }
  ]
}

Path Parameters

metric
enum<string>
required

Which network level metric to fetch.

Available options:
delegatorCount,
delegatorWeight,
validatorCount,
validatorWeight
network
enum<string>
required

Either mainnet or testnet/fuji.

Available options:
mainnet,
fuji,
testnet,
devnet

Query Parameters

startTimestamp
integer

Query param for retrieving items after a specific timestamp.

Required range: x > 0
endTimestamp
integer

Query param for retrieving items before a specific timestamp.

Required range: x > 0
pageToken
string

A page token, received from a previous list call. Provide this to retrieve the subsequent page.

pageSize
integer
default:
100

The maximum number of items to return. The minimum page size is 1. The maximum pageSize is 2160.

Required range: 1 < x < 2160
subnetId
any

The subnet ID to filter by. If not provided, then all subnets will be returned.

Response

200
application/json
Successful response
results
object[]
required

Array of current metrics values at different timestamps.

nextPageToken
string

A token, which can be sent as pageToken to retrieve the next page. If this field is omitted or empty, there are no subsequent pages.