How to get tokenBalance for an address?

Hi there.
Etherscan’s API offers a getTokenBalance call:
https://api.etherscan.io/api?module=account&action=tokenbalance&contractaddress=0x57d90b64a1a57749b0f932f1a3395792e12e7055&address=0xe04f27eb70e025b78871a2ad7eabe85e61212761&tag=latest&apikey=YourApiKeyToken

Does Infura? I have not been able to locate.
Thank you.

Hey Tucker, it can be done using the eth_call method if the token’s contract includes a function to check the balance of an address. You will need to include the encoded contract function and parameters in the “data” field.

You can use https://abi.hashex.org/# to encode the function and parameters and test it out.

1 Like