Discussions

Ask a Question
Back to All

Getting ERC-20 token balances on testnets

I'm hoping to use the Advanced API to get balances for ERC-20 tokens. But when I tried it with the Avalanche Fuji and Polygon Mumbai testnets, calling ankr_getAccountBalance only shows the native token for each chain. And calling ankr_getCurrencies always returns null for both chains. e.g.

{
  "jsonrpc": "2.0",
  "method": "ankr_getCurrencies",
  "params": {
    "blockchain": "avalanche_fuji"
  },
  "id": 2
}

returns

{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "currencies": null,
    "syncStatus": {
      "timestamp": 0,
      "lag": "-0s",
      "status": "synced"
    }
  }
}

Am I missing something, or are ERC-20 tokens only supported on mainnet chains?