The client to use to make the request AvalancheCoreClient
The block height and encoding format GetBlockByHeightParameters
The block data. GetBlockByHeightReturnType
import { createAvalancheCoreClient } from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
import { getBlockByHeight } from '@avalanche-sdk/client/methods/pChain'
const client = createAvalancheCoreClient({
chain: avalanche,
transport: {
type: "http",
url: "<url>",
},
})
const block = await getBlockByHeight(client, {
height: 1000001,
encoding: "hex"
})
Get a block by its height.