I'm using Infura as my provider. From what I've read online, it seems that using a websocket with infura instead of http is the first step to being able to hear events however I only get an empty list when I retrieve all the latest events
I have a script that causes the contract to emit an event every 20 seconds.
This is what I'm using to test hearing events
events = contract_ws.events.Transfer.createFilter(fromBlock="latest", toBlock="pending").get_all_entries() if (len(events) != 0): break else: print("Not yet.") time.sleep(3)
But it never breaks out of the loop so therefore never hears an event. What am I missing?
I'm using the web3py library but I don't think that'll effect the solution.