The client to use. AvalancheCoreClient
The block ID and encoding format. GetBlockParameters
The block data. GetBlockReturnType
import { createAvalancheCoreClient } from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
import { getBlock } from '@avalanche-sdk/client/methods/xChain'
const client = createAvalancheCoreClient({
chain: avalanche,
transport: {
type: "http",
url: "<url>",
},
})
const block = await getBlock(client, {
blockID: "d7WYmb8VeZNHsny3EJCwMm6QA37s1EHwMxw1Y71V3FqPZ5EFG",
encoding: "hex"
})
Get a block by its ID.