This repository was archived by the owner on Mar 5, 2025. It is now read-only.
  
  
  
  
  
Description
Is there an existing issue for this?
Current Behavior
Currently the user have to use await to fetch the subscription object before listening to it.
(await myContract.events.MyEvent()).on('data', console.log)Expected Behavior
Logically this can be avoid that will make it consistent with the 1.x. We can throw error event if it fails to subscribe.
myContract.events.MyEvent().on('data', console.log).on('error', console.error); or
myContract.events.MyEvent().on('data', console.log).catch(console.error); Steps to Reproduce
Mentioned in example above.
Web3.js Version
4.x
Environment
- Operating System:
- Browser:
- Node.js Version:
- NPM Version:
Anything Else?
To make this work, we have to refactor the subscription manager. It's trivial change but not complex.