0

For instance, I'd like to make the following query:

Return all the addresses that have approved spender x on a particular token

It seems that I can only query for a specific (address, spender) pair on Etherscan.

0

I assume, that you want to query this for particular token, not for all tokens.

  1. Via Web3 API query Ethereum node for all Approval events with _spender equal to x logged by particular token contract.
  2. Extract _owner values from all such events and deduplicate these values. This will give you all addresses that have ever approved anything to x.
  3. Query current allowance these addresses currently have for x to remove addresses that do not have allowance for x anymore.
| improve this answer | |
  • Interesting. How long til I get all events? Can I use infura? – Parker Applebye Aug 4 '19 at 21:51
  • Yes, sure, infura supports such queries. This will be indexed query, so performance should be good unless you have too many Approval events with _spander equal to x. – Mikhail Vladimirov Aug 4 '19 at 22:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.