GetBalanceParameters The addresses to get the balance of
The balance information. GetBalanceReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const balance = await client.pChain.getBalance({
addresses: ["P-custom18jma8ppw3nhx5r4ap8clazz0dps7rv5u9xde7p"]
})
Get a block by its ID.
GetBlockParameters The block ID and encoding format
The block data. GetBlockReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const block = await client.pChain.getBlock({
blockID: "d7WYmb8VeZNHsny3EJCwMm6QA37s1EHwMxw1Y71V3FqPZ5EFG",
encoding: "hex"
})
Get a block by its height.
GetBlockByHeightParameters The block height and encoding format
The block data. GetBlockByHeightReturnType
Get all the blockchains that exist (excluding the P-Chain).
The list of blockchains. GetBlockchainsReturnType
Get the status of a blockchain.
GetBlockchainStatusParameters The blockchain ID
The blockchain status. GetBlockchainStatusReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const status = await client.pChain.getBlockchainStatus({
blockchainID: "11111111111111111111111111111111LpoYY"
})
Get the current supply of an asset.
GetCurrentSupplyParameters The asset ID
The current supply. GetCurrentSupplyReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const supply = await client.pChain.getCurrentSupply({
assetID: "FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z"
})
Get the current validators of the specified Subnet.
GetCurrentValidatorsParameters The subnet ID
The current validators. GetCurrentValidatorsReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const validators = await client.pChain.getCurrentValidators({
subnetID: "11111111111111111111111111111111LpoYY"
})
Get the fee configuration for the P-Chain.
The fee configuration. GetFeeConfigReturnType
Get the current fee state of the P-Chain.
The fee state. GetFeeStateReturnType
Get the height of the last accepted block.
The current height. GetHeightReturnType
Get the L1 validator information.
GetL1ValidatorParameters The validator node ID
The L1 validator information. GetL1ValidatorReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const validator = await client.pChain.getL1Validator({
nodeID: "NodeID-111111111111111111111111111111111111111"
})
Get the minimum stake amount for a subnet.
GetMinStakeParameters The subnet ID
The minimum stake amount. GetMinStakeReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const minStake = await client.pChain.getMinStake({
subnetID: "11111111111111111111111111111111LpoYY"
})
Get the proposed height of the P-Chain.
The proposed height. GetProposedHeightReturnType
Get the reward UTXOs for a transaction.
GetRewardUTXOsParameters The transaction ID and encoding
The reward UTXOs. GetRewardUTXOsReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const rewardUTXOs = await client.pChain.getRewardUTXOs({
txID: "11111111111111111111111111111111LpoYY",
encoding: "hex"
})
Get the stake amount for a set of addresses.
GetStakeParameters The addresses and subnet ID
The stake amount. GetStakeReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const stake = await client.pChain.getStake({
addresses: ["P-custom18jma8ppw3nhx5r4ap8clazz0dps7rv5u9xde7p"],
subnetID: "11111111111111111111111111111111LpoYY"
})
Get the staking asset ID for a subnet.
GetStakingAssetIDParameters The subnet ID
The staking asset ID. GetStakingAssetIDReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const stakingAssetID = await client.pChain.getStakingAssetID({
subnetID: "11111111111111111111111111111111LpoYY"
})
Get information about a subnet.
GetSubnetParameters The subnet ID
The subnet information. GetSubnetReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const subnet = await client.pChain.getSubnet({
subnetID: "11111111111111111111111111111111LpoYY"
})
Get all subnets.
GetSubnetsParameters Optional parameters
The list of subnets. GetSubnetsReturnType
Get the current timestamp of the P-Chain.
The current timestamp. GetTimestampReturnType
Get the total stake amount for a subnet.
GetTotalStakeParameters The subnet ID
The total stake amount. GetTotalStakeReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const totalStake = await client.pChain.getTotalStake({
subnetID: "11111111111111111111111111111111LpoYY"
})
Get a transaction by its ID.
GetTxParameters The transaction ID and encoding
The transaction data. GetTxReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const tx = await client.pChain.getTx({
txID: "11111111111111111111111111111111LpoYY",
encoding: "hex"
})
Get the status of a transaction.
GetTxStatusParameters The transaction ID
The transaction status. GetTxStatusReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const status = await client.pChain.getTxStatus({
txID: "11111111111111111111111111111111LpoYY"
})
Get the UTXOs for a set of addresses.
GetUTXOsParameters The addresses and source chain
The UTXOs. GetUTXOsReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const utxos = await client.pChain.getUTXOs({
addresses: ["P-custom18jma8ppw3nhx5r4ap8clazz0dps7rv5u9xde7p"],
sourceChain: "X"
})
Get the validators at a specific height.
GetValidatorsAtParameters The height and subnet ID
The validators at that height. GetValidatorsAtReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const validators = await client.pChain.getValidatorsAt({
height: 1000001,
subnetID: "11111111111111111111111111111111LpoYY"
})
Issue a transaction to the Platform Chain.
IssueTxParameters The transaction bytes and encoding
The transaction ID. IssueTxReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const txID = await client.pChain.issueTx({
tx: "0x00000009de31b4d8b22991d51aa6aa1fc733f23a851a8c9400000000000186a0000000005f041280000000005f9ca900000030390000000000000001fceda8f90fcb5d30614b99d79fc4baa29307762668f16eb0259a57c2d3b78c875c86ec2045792d4df2d926c40f829196e0bb97ee697af71f5b0a966dabff749634c8b729855e937715b0e44303fd1014daedc752006011b730",
encoding: "hex"
})
Sample validators from the specified Subnet.
SampleValidatorsParameters The number of validators to sample and subnet ID
The sampled validators. SampleValidatorsReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const validators = await client.pChain.sampleValidators({
size: 2,
subnetID: "11111111111111111111111111111111LpoYY"
})
Get the Subnet that validates a given blockchain.
ValidatedByParameters The blockchain ID
The subnet ID. ValidatedByReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const subnetID = await client.pChain.validatedBy({
blockchainID: "11111111111111111111111111111111LpoYY"
})
Get the IDs of the blockchains a Subnet validates.
ValidatesParameters The subnet ID
The blockchain IDs. ValidatesReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const blockchainIDs = await client.pChain.validates({
subnetID: "11111111111111111111111111111111LpoYY"
})
Get the balance of AVAX controlled by a given address.