An Avalanche Client with access to all sub-clients. AvalancheClient
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
// Access different chain clients
const pChainClient = client.pChain
const xChainClient = client.xChain
const cChainClient = client.cChain
// Access API clients
const adminClient = client.admin
const infoClient = client.info
const healthClient = client.health
const indexPChainBlockClient = client.indexPChainBlock
// Get the latest block number
const blockNumber = await client.pChain.getBlockNumber()
// Get base fee
const baseFee = await client.getBaseFee()
Creates an Avalanche Client with a given transport configured for a Chain.
The Avalanche Client is an interface to interact with the Avalanche network through various JSON-RPC API methods. It provides access to multiple sub-clients for different chains and APIs: