Avalanche SDK Client
    Preparing search index...

    Function getBlockByHeight

    • Type Parameters

      • chain extends undefined | Chain

      Parameters

      Returns Promise<PChainBlockType>

      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"
      })