Skip to content
Advertisement

How to speed up token balance on multiple contracts

I’m using ethers to call balanceOf method on all contracts to check if user has any balance there, if not, the token will not show up in his dashboard, but it takes a lot of time, is there a more finesse way to achieve the same goal?

my code:

JavaScript

Advertisement

Answer

You can use Multicall contract for small wins. A proper solution is indexers like TheGraph that continuously read the blockchain and keep the data available indexed.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement