How can I track tokens transactions of a list of wallets in the bsc network?
I think about using websocket and filter function. I think it's possible to use the topics
as a part of the filter parameters and reflect only the Transfer
event to/from watched address, so that my app doesn't have to handle unnecessary data.
But I'm doing something wrong and don't know how to correctly give list of wallets (or at least only one wallet) as a parameter to my filter function. How to do that?
And I have problems with getting data from Transfer
event as I don't know how to decode a HexBytes
type. I saw web3.js functions for it but nothing with web3.py.
address_list = ['0x67fdE6D04a82689a59E5188f9B572CBeF53D4763', '...', '...']
web3 = Web3(Web3.WebsocketProvider('wss://bsc.getblock.io/mainnet/?api_key=your_api_key'))
web3_filter = web3.eth.filter({'topics': address_list})
while True:
for event in web3_filter.get_new_entries():
print(web3.toJSON(web3.eth.wait_for_transaction_receipt(event).logs))