GetContainerByIDParameters The container ID and encoding
The container details. GetContainerByIDReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const container = await client.indexPChainBlock.getContainerByID({
id: "6fXf5hncR8LXvwtM8iezFQBpK5cubV6y1dWgpJCcNyzGB1EzY",
encoding: "hex"
})
Get container by index.
GetContainerByIndexParameters The index and encoding
The container details. GetContainerByIndexReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const container = await client.indexPChainBlock.getContainerByIndex({
index: 1,
encoding: "hex"
})
Get a range of containers by their indices.
GetContainerRangeParameters The start index, end index, and encoding
The container details. GetContainerRangeReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const containers = await client.indexPChainBlock.getContainerRange({
startIndex: 0,
endIndex: 10,
encoding: "hex"
})
Get the index of a container by its ID.
GetIndexParameters The container ID and encoding
The container index. GetIndexReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const index = await client.indexPChainBlock.getIndex({
id: "6fXf5hncR8LXvwtM8iezFQBpK5cubV6y1dWgpJCcNyzGB1EzY",
encoding: "hex"
})
Get the last accepted container.
GetLastAcceptedParameters The encoding
The last accepted container. GetLastAcceptedReturnType
Check if a container is accepted.
IsAcceptedParameters The container ID and encoding
Whether the container is accepted. IsAcceptedReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const isAccepted = await client.indexPChainBlock.isAccepted({
id: "6fXf5hncR8LXvwtM8iezFQBpK5cubV6y1dWgpJCcNyzGB1EzY",
encoding: "hex"
})
Get container by ID.