Token balances APIs
In the following examples, we're going to use the GetTokenBalancesSummary and
GetTokenBalancesDetails methods from Sequence Indexer Gateway.
GetTokenBalancesSummary
- Request: POST /rpc/IndexerGateway/GetTokenBalancesSummary
- Content-Type: application/json
- Body (in JSON):
chainIds([]int - optional) -- return results only for the chains that match the given ID.networks([]string - optional) -- return results only for the chains that match the given names.filter(object - optional) -- query filters.accountAddresses([]string)contractStatus(VERIFIED | UNVERIFIED | ALL)contractWhitelist([]string)contractBlacklist([]string)omitNativeBalances(bool)
omitMetadata(boolean - optional - default: false)
GetTokenBalancesDetails
- Request: POST /rpc/IndexerGateway/GetTokenBalancesDetails
- Content-Type: application/json
- Body (in JSON):
chainIds([]int - optional) -- return results only for the chains that match the given ID.networks([]string - optional) -- return results only for the chains that match the given names.filter(object - optional) -- query filters.accountAddresses([]string)contractStatus(VERIFIED | UNVERIFIED | ALL)contractWhitelist([]string)contractBlacklist([]string)omitNativeBalances(bool)
omitMetadata(boolean - optional - default: false)
Get the summary of balances of verified tokens on specific networks
Example: Get the summary of all verified token balances for a specific account
on mainnet and polygon
Curl
curl -X POST \
-H "Content-Type: application/json" \
-H "X-Access-Key: AQAAAAAAAF_JvPALhBthL7VGn6jV0YDqaFY" \
https://indexer.sequence.app/rpc/IndexerGateway/GetTokenBalancesSummary \
-d '{
"networks": [
"polygon",
"mainnet"
],
"filter": {
"accountAddresses": [
"0x8e3E38fe7367dd3b52D1e281E4e8400447C8d8B9"
]
}
}'Get balance details of specific contracts on all networks
Example: Get the balance details of the USDC contracts on Arbitrum, Polygon and Mainne
Curl
curl -X POST \
-H "Content-Type: application/json" \
-H "X-Access-Key: AQAAAAAAAF_JvPALhBthL7VGn6jV0YDqaFY" \
https://indexer.sequence.app/rpc/IndexerGateway/GetTokenBalancesDetails \
-d '{
"networks": [
"arbitrum",
"polygon",
"mainnet"
],
"filter": {
"accountAddresses": [
"0x8e3E38fe7367dd3b52D1e281E4e8400447C8d8B9"
],
"contractWhitelist": [
"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
"0xaf88d065e77c8cc2239327c5edb3a432268e5831"
]
}
}'