Native network balances (ie. ETH, MATIC, etc.)
Fetch native network balance (aka ETH on Ethereum, MATIC on Polygon, AVAX on Avalanche, BNB on BSC, etc.)
Sequence Indexer GetEtherBalance
Method:
- Request: POST /rpc/Indexer/GetEtherBalance
- Content-Type: application/json
- Body (in JSON):
accountAddress
(string) -- the wallet account address
Example: GetEtherBalance
MATIC balance of a wallet account address on Polygon
- curl
- Javascript / Typescript
- Go
- Other
curl -X POST -H "Content-Type: application/json" https://polygon-indexer.sequence.app/rpc/Indexer/GetEtherBalance -d '{ "accountAddress": "0x8e3E38fe7367dd3b52D1e281E4e8400447C8d8B9" }'
// Works in both a Webapp (browser) or Node.js:
import { SequenceIndexerClient } from '@0xsequence/indexer'
const indexer = new SequenceIndexerClient('https://polygon-indexer.sequence.app')
// try any account address you'd like :)
const accountAddress = '0xabc...'
// query Sequence Indexer for the MATIC balance on Polygon
const balance = await indexer.getEtherBalance({
accountAddress: accountAddress,
})
console.log('tokens in your account:', tokenBalances)
import (
"context"
"fmt"
"log"
"net/http"
"github.com/0xsequence/go-sequence/indexer"
)
func GetTokenBalances(accountAddress string) {
seqIndexer := indexer.NewIndexerClient("https://polygon-indexer.sequence.app", http.DefaultClient)
includeMetadata := true
tokenBalances, _, err := seqIndexer.GetTokenBalances(context.Background(), &accountAddress, nil, &includeMetadata, nil)
if err != nil {
log.Fatal(err)
}
fmt.Println("tokenBalances:", tokenBalances)
}
Please contact our team for assistance with integrations to another target.