How to get the total value in $ of an address

For now, the only solution I found was getting all the balances and converting the prices of the ERC20 held.
Whilst being pretty costly in terms of performance and overall speed, it works.
However, I didn’t find a way to get the $ price of the native token of a chain. Is there a method for that?

Besides that, are you guys planning on adding Optimism to supported chains for the evm API?
Seems this isn’t an option there:

Hey @SachaH,

For native tokens, they are usually not stored directly in LPs of DEX. Instead, they are stored as a wrapped token, such as WETH, WBNB, WMATIC, etc. So you can try to get those wrapped token addresses and input the address and its chain to get the native token price.

And yes, Optimism will be added sometime in the near future :raised_hands:

Hope this helps, let me know if you have any other questions :grinning_face_with_smiling_eyes:

Thanks a lot!

I had another question: I’m trying to get the number of transactions a contract has performed since its existence any idea on how to do that programmatically?
I’ve tried using the API routes which allowed me to get transactions and it doesn’t send me back the total field as specified in the documentation.

What i’m trying to get is that info which is displayed on scanner.

you can get the total if you use disable_total parameter set to false

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.