Discussions
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.
```json json
{
"jsonrpc": "2.0",
"method": "ankr_getCurrencies",
"params": {
"blockchain": "avalanche_fuji"
},
"id": 2
}
```
returns
```json
{
"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?
Posted by null 16 days ago
API returns error "we can't execute this request"
```Text json
{
"jsonrpc": "2.0",
"error": {
"code": 0,
"message": "we can't execute this request"
},
"id": null
}
```
<br>
I am using Ankr pro API. I tried with both SDK and Curl. The problem seems to be caused by your API server
Posted by Jane 16 days ago
ankr_getAccountBalance returns wrong ETH price in chain optimism
I tried to run this ankr_getAccountBalance method for get account balance in optimism chain but got wrong ETH price in the result
```curl
curl --request POST \
--url 'https://rpc.ankr.com/multichain/79258ce7f7ee046decc3b5292a24eb4bf7c910d7e39b691384c7ce0cfb839a01/?ankr_getAccountBalance=' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "ankr_getAccountBalance",
"params": {
"blockchain": [
"optimism"
],
"walletAddress": "0x8D53B8DEad212d0D6a5Eb42FcB2E7ae02135bBE6"
},
"id": 1
}
'
```
This is result returned
```curl
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"totalBalanceUsd": "3.079760680144404025",
"totalCount": 1,
"assets": [
{
"blockchain": "optimism",
"tokenName": "Ether",
"tokenSymbol": "ETH",
"tokenDecimals": 18,
"tokenType": "NATIVE",
"holderAddress": "0x8d53b8dead212d0d6a5eb42fcb2e7ae02135bbe6",
"balance": "0.00089391",
"balanceRawInteger": "893910000000000",
"balanceUsd": "3.079760680144404025",
"tokenPrice": "3.928929827952243552",
"thumbnail": "https://ankrscan.io/assets/blockchains/eth.svg"
}
],
"syncStatus": {
"timestamp": 1711506603,
"lag": "-54s",
"status": "synced"
}
}
}
```
As you can see the field "tokenPrice": "3.928929827952243552", its a wrong ETH price, the correct ETH price should be 3599 at this request time (you can check it here <https://gyazo.com/f700b3d1fa72f39938b0c681a00d38d3>)
Posted by amm 29 days ago
Is it impossible to get earlier price data?
Hi,
I get price data using a request
POST <https://rpc.ankr.com/multichain/79258ce7f7ee046decc3b5292a24eb4bf7c910d7e39b691384c7ce0cfb839a01>
req:
{"id":1,"jsonrpc":"2.0","method":"ankr_getTokenPriceHistory","params":{"blockchain":"eth","contractAddress":"0xB8c77482e45F1F44dE1745F52C74426C631bDD52", "interval":86400, "limit":1000}}
In response, I receive data for at least 1684320971 to the current time. Is it possible to get earlier data than 1684320971?
Posted by Vlad G 3 months ago
ankr_getTokenTransfers
pageToken 参数的详解
Posted by w 5 months ago
The ankr_getCurrencies method return null
When i set the blockchain for base, zksync_era, polygon_zkevm. The http response return currencies is null
pls help me. and btw, does have a plan to support linea chain?
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"currencies": null
}
}
Posted by Fury 7 months ago
ankr_getTokenPriceHistory returns empty
I am getting no results for many tokens that I tried to get the historical token price
Request
```
{
"jsonrpc": "2.0",
"method": "ankr_getTokenPriceHistory",
"params": {
"blockchain": "eth",
"contractAddress": "0x85F17Cf997934a597031b2E18a9aB6ebD4B9f6a4",
"fromTimestamp": 1673164570
},
"id": 34234
}
```
REsponse:
```
{
"jsonrpc": "2.0",
"id": 34234,
"result": {
"quotes": []
}
}
```
Kindly provide a solution for that
Posted by Abid Jamal 8 months ago
what is the way show me all transactions internal by my address?
i cant see any api to get all transactions internal by my address, let me know the way to get it.
Posted by Dustin 9 months ago
Item asset tokenUrl is empty when i get api getNFTsByOwner
I sure Item asset tokenUrl have data
link Opensea: <https://opensea.io/assets/matic/0xc8076f6e5505bdb47c3030748c65efb088ea0fd8/49>
i use me TBA address ('0xdAb940e908321dBbAD39B1894b25e14aE88FA038') call api getNFTsByOwner. Then In data asset tokenUrl is empity
Posted by DienCong 9 months ago
how can get lastest Token Transfers includes native token?
function nkr_getTokenTransfers get transactions lastest but dont includes native token
Posted by dustin 9 months ago