Avalanche SDK Client
    Preparing search index...

    Function getBlock

    • Type Parameters

      • chain extends undefined | Chain

      Parameters

      • client: { extend: <const client extends { [key: string]: unknown }>(fn: (client: { extend: ... }) => client) => { [K in (...) | (...) | (...)]: (...)[(...)] } }

        The client to use. AvalancheCoreClient

      • params: GetBlockParameters

        The block ID and encoding format GetBlockParameters

      Returns Promise<PChainBlockType>

      The block data. GetBlockReturnType

      import { createAvalancheCoreClient } from '@avalanche-sdk/client'
      import { avalanche } from '@avalanche-sdk/client/chains'
      import { getBlock } from '@avalanche-sdk/client/methods/pChain'

      const client = createAvalancheCoreClient({
      chain: avalanche,
      transport: {
      type: "http",
      url: "<url>",
      },
      })

      const block = await getBlock(client, {
      blockID: "d7WYmb8VeZNHsny3EJCwMm6QA37s1EHwMxw1Y71V3FqPZ5EFG",
      encoding: "hex"
      })