import { Avalanche } from "@avalanche-sdk/chainkit";
const avalanche = new Avalanche({
network: "mainnet",
});
async function run() {
const result = await avalanche.data.primaryNetwork.balances.listByAddresses({
blockTimestamp: 1599696000,
addresses: "avax1h2ccj9f5ay5acl6tyn9mwmw32p8wref8vl8ctg",
blockchainId: "p-chain",
});
console.log(result);
}
run();{
"balances": {
"unlockedUnstaked": [
{
"assetId": "<string>",
"name": "<string>",
"symbol": "<string>",
"denomination": 123,
"type": "secp256k1",
"amount": "<string>",
"utxoCount": 123
}
],
"unlockedStaked": [
{
"assetId": "<string>",
"name": "<string>",
"symbol": "<string>",
"denomination": 123,
"type": "secp256k1",
"amount": "<string>",
"utxoCount": 123
}
],
"lockedPlatform": [
{
"assetId": "<string>",
"name": "<string>",
"symbol": "<string>",
"denomination": 123,
"type": "secp256k1",
"amount": "<string>",
"utxoCount": 123
}
],
"lockedStakeable": [
{
"assetId": "<string>",
"name": "<string>",
"symbol": "<string>",
"denomination": 123,
"type": "secp256k1",
"amount": "<string>",
"utxoCount": 123
}
],
"lockedStaked": [
{
"assetId": "<string>",
"name": "<string>",
"symbol": "<string>",
"denomination": 123,
"type": "secp256k1",
"amount": "<string>",
"utxoCount": 123
}
],
"pendingStaked": [
{
"assetId": "<string>",
"name": "<string>",
"symbol": "<string>",
"denomination": 123,
"type": "secp256k1",
"amount": "<string>",
"utxoCount": 123
}
],
"atomicMemoryUnlocked": [
{
"assetId": "<string>",
"name": "<string>",
"symbol": "<string>",
"denomination": 123,
"type": "secp256k1",
"amount": "<string>",
"utxoCount": 123,
"sharedWithChainId": "<string>",
"status": "<string>"
}
],
"atomicMemoryLocked": [
{
"assetId": "<string>",
"name": "<string>",
"symbol": "<string>",
"denomination": 123,
"type": "secp256k1",
"amount": "<string>",
"utxoCount": 123,
"sharedWithChainId": "<string>",
"status": "<string>"
}
]
},
"chainInfo": {
"chainName": "p-chain",
"network": "mainnet"
}
}Gets primary network balances for one of the Primary Network chains for the supplied addresses.
C-Chain balances returned are only the shared atomic memory balance. For EVM balance, use the /v1/chains/:chainId/addresses/:addressId/balances:getNative endpoint.
import { Avalanche } from "@avalanche-sdk/chainkit";
const avalanche = new Avalanche({
network: "mainnet",
});
async function run() {
const result = await avalanche.data.primaryNetwork.balances.listByAddresses({
blockTimestamp: 1599696000,
addresses: "avax1h2ccj9f5ay5acl6tyn9mwmw32p8wref8vl8ctg",
blockchainId: "p-chain",
});
console.log(result);
}
run();{
"balances": {
"unlockedUnstaked": [
{
"assetId": "<string>",
"name": "<string>",
"symbol": "<string>",
"denomination": 123,
"type": "secp256k1",
"amount": "<string>",
"utxoCount": 123
}
],
"unlockedStaked": [
{
"assetId": "<string>",
"name": "<string>",
"symbol": "<string>",
"denomination": 123,
"type": "secp256k1",
"amount": "<string>",
"utxoCount": 123
}
],
"lockedPlatform": [
{
"assetId": "<string>",
"name": "<string>",
"symbol": "<string>",
"denomination": 123,
"type": "secp256k1",
"amount": "<string>",
"utxoCount": 123
}
],
"lockedStakeable": [
{
"assetId": "<string>",
"name": "<string>",
"symbol": "<string>",
"denomination": 123,
"type": "secp256k1",
"amount": "<string>",
"utxoCount": 123
}
],
"lockedStaked": [
{
"assetId": "<string>",
"name": "<string>",
"symbol": "<string>",
"denomination": 123,
"type": "secp256k1",
"amount": "<string>",
"utxoCount": 123
}
],
"pendingStaked": [
{
"assetId": "<string>",
"name": "<string>",
"symbol": "<string>",
"denomination": 123,
"type": "secp256k1",
"amount": "<string>",
"utxoCount": 123
}
],
"atomicMemoryUnlocked": [
{
"assetId": "<string>",
"name": "<string>",
"symbol": "<string>",
"denomination": 123,
"type": "secp256k1",
"amount": "<string>",
"utxoCount": 123,
"sharedWithChainId": "<string>",
"status": "<string>"
}
],
"atomicMemoryLocked": [
{
"assetId": "<string>",
"name": "<string>",
"symbol": "<string>",
"denomination": 123,
"type": "secp256k1",
"amount": "<string>",
"utxoCount": 123,
"sharedWithChainId": "<string>",
"status": "<string>"
}
]
},
"chainInfo": {
"chainName": "p-chain",
"network": "mainnet"
}
}Api keys provide higher access to rate limits. To obtain an api key, sign up for an account at https://avacloud.io/.
A primary network blockchain id or alias.
11111111111111111111111111111111LpoYY, 2oYMBNV4eNHyqk2fjjV5nVQLDbtmNJzq5s3qs3Lo6ftnC6FByM, 2JVSBoinj9C2J33VntvzYtVJNZdN2NKiwwKjcumHUWEb5DbBrm, 2q9e4r6Mu3U68nU1fYjgbR6JvwrRx36CohpAX5UQxse55x1Q5, yH8D7ThNJkxmtkuv2jgBa4P1Rn3Qpr4pPr7QYNfcdoS6k6HWp, p-chain, x-chain, c-chain Either mainnet or testnet/fuji.
mainnet, fuji, testnet An epoch timestamp in seconds. Balance will be calculated at this timestamp.
A comma separated list of X-Chain or P-Chain wallet addresses, starting with "avax"/"fuji", "P-avax"/"P-fuji" or "X-avax"/"X-fuji".
Successful response
Show child attributes
A list of objects containing P-chain Asset basic info, amount, and utxo count of that Asset ID. Denotes the amount of unstaked Avax that is consumable by any transaction.
Show child attributes
Unique ID for an asset.
Name of this asset.
Symbol for this asset (max 4 characters).
Denomination of this asset to represent fungibility.
Type of asset like SECP256K1 or NFT.
secp256k1, nft Amount of the asset.
A list of objects containing P-chain Asset basic info, amount, and utxo count of that Asset ID. Denotes the amount of staked Avax that is consumable by any transaction when the staking period ends.
Show child attributes
Unique ID for an asset.
Name of this asset.
Symbol for this asset (max 4 characters).
Denomination of this asset to represent fungibility.
Type of asset like SECP256K1 or NFT.
secp256k1, nft Amount of the asset.
A list of objects containing P-chain Asset basic info, amount, and utxo count of that Asset ID. Denotes the amount of unstaked Avax that is locked at the platform level and not consumable by any transaction at the current time.
Show child attributes
Unique ID for an asset.
Name of this asset.
Symbol for this asset (max 4 characters).
Denomination of this asset to represent fungibility.
Type of asset like SECP256K1 or NFT.
secp256k1, nft Amount of the asset.
A list of objects containing P-chain Asset basic info, amount, and utxo count of that Asset ID. Denotes the amount of unstaked Avax that is locked at the platform level and only consumeable for staking transactions.
Show child attributes
Unique ID for an asset.
Name of this asset.
Symbol for this asset (max 4 characters).
Denomination of this asset to represent fungibility.
Type of asset like SECP256K1 or NFT.
secp256k1, nft Amount of the asset.
A list of objects containing P-chain Asset basic info, amount, and utxo count of that Asset ID. Denotes the amount of staked Avax that will be locked when the staking period ends.
Show child attributes
Unique ID for an asset.
Name of this asset.
Symbol for this asset (max 4 characters).
Denomination of this asset to represent fungibility.
Type of asset like SECP256K1 or NFT.
secp256k1, nft Amount of the asset.
A list of objects containing P-chain Asset basic info, amount, and utxo count of that Asset ID. Denotes the amount of staked Avax whose staking period has not yet started.
Show child attributes
Unique ID for an asset.
Name of this asset.
Symbol for this asset (max 4 characters).
Denomination of this asset to represent fungibility.
Type of asset like SECP256K1 or NFT.
secp256k1, nft Amount of the asset.
A list of objects containing P-chain Asset basic info, amount and utxo count of that Asset ID. Denotes the amount of unlocked Avax in the atomic memory between P-Chain and other chain.
Show child attributes
Unique ID for an asset.
Name of this asset.
Symbol for this asset (max 4 characters).
Denomination of this asset to represent fungibility.
Type of asset like SECP256K1 or NFT.
secp256k1, nft Amount of the asset.
A list of objects containing P-chain Asset basic info, amount and utxo count of that Asset ID. Denotes the amount of locked Avax in the atomic memory between P-Chain and other chain.
Show child attributes
Unique ID for an asset.
Name of this asset.
Symbol for this asset (max 4 characters).
Denomination of this asset to represent fungibility.
Type of asset like SECP256K1 or NFT.
secp256k1, nft Amount of the asset.
Was this page helpful?