import { Avalanche } from "@avalanche-sdk/chainkit";
const avalanche = new Avalanche({
chainId: "43114",
});
async function run() {
const result = await avalanche.data.evm.blocks.listLatest({
pageSize: 10,
});
for await (const page of result) {
console.log(page);
}
}
run();{
"blocks": [
{
"chainId": "<string>",
"blockNumber": "<string>",
"blockTimestamp": 123,
"blockHash": "<string>",
"txCount": 123,
"baseFee": "<string>",
"gasUsed": "<string>",
"gasLimit": "<string>",
"gasCost": "<string>",
"parentHash": "<string>",
"feesSpent": "<string>",
"cumulativeTransactions": "<string>"
}
],
"nextPageToken": "<string>"
}Lists the latest indexed blocks on the EVM-compatible chain sorted in descending order by block timestamp.
import { Avalanche } from "@avalanche-sdk/chainkit";
const avalanche = new Avalanche({
chainId: "43114",
});
async function run() {
const result = await avalanche.data.evm.blocks.listLatest({
pageSize: 10,
});
for await (const page of result) {
console.log(page);
}
}
run();{
"blocks": [
{
"chainId": "<string>",
"blockNumber": "<string>",
"blockTimestamp": 123,
"blockHash": "<string>",
"txCount": 123,
"baseFee": "<string>",
"gasUsed": "<string>",
"gasLimit": "<string>",
"gasCost": "<string>",
"parentHash": "<string>",
"feesSpent": "<string>",
"cumulativeTransactions": "<string>"
}
],
"nextPageToken": "<string>"
}Api keys provide higher access to rate limits. To obtain an api key, sign up for an account at https://avacloud.io/.
A supported evm chain id or blockchain id. Use the /chains endpoint to get a list of supported chain ids.
A 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 100.
1 <= x <= 100Was this page helpful?