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".
Was this page helpful?