tronprotocol / tronweb

Javascript API Library for interacting with the TRON Network
MIT License
419 stars 271 forks source link

Listening to events in v6 #541

Open 0xmarvin42 opened 1 month ago

0xmarvin42 commented 1 month ago

Event#watch() is removed. contract.someEvent().watch() is no longer supported.

How should I listen to events? I can call getEventsByBlockNumber once in a while, but I'd like to be able to respond to events right away

start940315 commented 1 month ago

Just call getEventsByBlockNumber every second (or 3 seconds, make the time you want). This is what watch method used to do.

FlamesX-128 commented 2 weeks ago

What was the reason for the removal of the .watch() method? I believe it would be more convenient to have a default method to watch contracts.