Skip to content

listBlocks

listBlocks retrieves a paginated list of blocks from the blockchain.

Usage

import { createKontorIndexerClient, http, signet } from '@kontor/kontor-sdk'
 
export const indexerClient = createKontorIndexerClient({
  chain: signet,
  transport: http()
})
 
const blocks = await indexerClient.listBlocks({
  limit: 10,
  offset: 0
})

With Cursor-Based Pagination

import { createKontorIndexerClient, http, signet } from '@kontor/kontor-sdk'
 
export const indexerClient = createKontorIndexerClient({
  chain: signet,
  transport: http()
})
 
const blocks = await indexerClient.listBlocks({
  cursor: 1000000,
  limit: 50,
  order: 'desc'
})

With Filtering

import { createKontorIndexerClient, http, signet } from '@kontor/kontor-sdk'
 
export const indexerClient = createKontorIndexerClient({
  chain: signet,
  transport: http()
})
 
const blocks = await indexerClient.listBlocks({
  limit: 20,
  relevant: true,
  order: 'asc'
})