Proper approach of listening solidity events in NestJS

Viewed 50

I am developing dApp. I am using NestJS and I have written contracts in solidity.

There are few events emitted from solidity. I need to listen to those events in NestJS. My code to listen to solidity events is

contract.on('EventName', async(val, event)=>{
// do something
})

What is the appropriate way to listen to events in NestJS? Right now I am trying to place event listening code in onModuleInit but wanted to confirm if there are any other better approach to do this.

0 Answers
Related