getAddressBalance
This method obtains the token balance for an address on the chains passed as parameters.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
input | [ChainAddressTokenInput!]! | Yes | List of address token balance queries with chain name, token and address. |
ChainAddressTokenInput Fields
| Name | Type | Required | Description |
|---|---|---|---|
chain | String! | Yes | Chain ID. |
address | String! | Yes | The address to query balance for. |
token | String! | Yes | The token address. Use native for the chain’s native token balance. |
chain
Type: Chain!
Allowed Values: A chain ID from the list of supported chains.
[!NOTE] This query only gets current balances, so it works on all the supported chains.
address
Type: String!
Allowed Values: Any address to query the balance for.
token
Type: String!
Allowed Values: native or any token address/name.
Response
| Field | Type | Description |
|---|---|---|
chain | String | The chain ID. |
address | String | The queried address. |
token | String | The queried token. |
balance | String | The balance of the address for the queried token. |
error | String | Error message if query failed. |
Query Example
Query
query GetAddressBalance($input: [ChainAddressTokenInput!]!) {
getAddressBalance(input: $input) {
chain
address
token
balance
error
}
}Variables
{
"input": [
{
"address": "7VHUFJHWu2CuExkJcJrzhQPJ2oygupTWkL2A2For4BmE",
"chain": "CHAIN_SOLANA_MAINNET",
"token": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
},
{
"address": "0xF977814e90dA44bFA03b6295A0616a897441aceC",
"chain": "CHAIN_0X1",
"token": "0xdac17f958d2ee523a2206206994597c13d831ec7"
},
{
"address": "0xF977814e90dA44bFA03b6295A0616a897441aceC",
"chain": "CHAIN_0X1",
"token": "native"
},
{
"address": "7VHUFJHWu2CuExkJcJrzhQPJ2oygupTWkL2A2For4BmE",
"chain": "CHAIN_SOLANA_MAINNET",
"token": "native"
},
{
"address": "noble1w79dl6rw5w4wrv2ptpjmalt867jtls5qmgpmqj",
"chain": "CHAIN_NOBLE_1",
"token": "USDC"
}
]
}Curl
curl -X POST https://your-api-endpoint/graphql \
-H "Content-Type: application/json" \
-d '{
"query": "query GetAddressBalance($input: [ChainAddressTokenInput!]!) { getAddressBalance(input: $input) { chain address token balance error } }",
"variables": {
"input": [
{ "address": "0xF977814e90dA44bFA03b6295A0616a897441aceC", "chain": "CHAIN_0X1", "token": "native" },
{ "address": "7VHUFJHWu2CuExkJcJrzhQPJ2oygupTWkL2A2For4BmE", "chain": "CHAIN_SOLANA_MAINNET", "token": "native" },
{ "address": "noble1w79dl6rw5w4wrv2ptpjmalt867jtls5qmgpmqj", "chain": "CHAIN_NOBLE_1", "token": "USDC" }
]
}
}'Response Example
{
"data": {
"getAddressBalance": [
{
"chain": "CHAIN_SOLANA_MAINNET",
"address": "7VHUFJHWu2CuExkJcJrzhQPJ2oygupTWkL2A2For4BmE",
"token": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"balance": "688058125.129652",
"error": null
},
{
"chain": "CHAIN_0X1",
"address": "0xF977814e90dA44bFA03b6295A0616a897441aceC",
"token": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"balance": "19474530513.868",
"error": null
},
{
"chain": "CHAIN_0X1",
"address": "0xF977814e90dA44bFA03b6295A0616a897441aceC",
"token": "native",
"balance": "688622.3968901488",
"error": null
},
{
"chain": "CHAIN_SOLANA_MAINNET",
"address": "7VHUFJHWu2CuExkJcJrzhQPJ2oygupTWkL2A2For4BmE",
"token": "native",
"balance": "832.561787038",
"error": null
},
{
"chain": "CHAIN_NOBLE_1",
"address": "noble1w79dl6rw5w4wrv2ptpjmalt867jtls5qmgpmqj",
"token": "USDC",
"balance": "499.843374",
"error": null
}
]
}
}