-
Honestly, I'm new to typescript and ethers. I have figured out many other issues and TypeChain has definitely been a huge help. There's one issue that I still haven't figured out, how to register handlers for smart contract events. Can you please write a small snippet on how to do it for ethers-v5? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Right, events in ethers are quite unintuitive... I added this to our example: #572 Btw. TypeChain is part of the ongoing GitCoin matching round. If you enjoy it, please consider donating. https://gitcoin.co/grants/4038/typechain-dksth |
Beta Was this translation helpful? Give feedback.
-
I was looking for how to set a handler but your answer was very helpful. I think this would work: const eventsFilter = dai.filters.Transfer()
dai.on(eventsFilter, (from, to, value) => console.log(`${from} -> ${to} | ${utils.formatEther(value)} DAI`)); I now need to understand the handler lifetime cycle. Thank you so much for answering my question! And thanks for the GitCoin link. I'll share it within my company. |
Beta Was this translation helpful? Give feedback.
Right, events in ethers are quite unintuitive...
I added this to our example: #572
Btw. TypeChain is part of the ongoing GitCoin matching round. If you enjoy it, please consider donating. https://gitcoin.co/grants/4038/typechain-dksth