Discussions
ankr_getAccountBalance returns wrong ETH price in chain optimism
9 months ago by amm
I tried to run this ankr_getAccountBalance method for get account balance in optimism chain but got wrong ETH price in the result
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
{
"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)