ethers.js
ethers.js copied to clipboard
contract.on(event, ...) returns event happened prior ?
Ethers Version
5.6.9
Search Terms
event listening
Describe the Problem
I am trying to use the contract.on(event,...) to watch event happening and is expecting it to be only future events. But it seems that somehow it returns the event since contract deployment.
Is my understanding wrong about this ?
Code Snippet
No response
Contract ABI
No response
Errors
No response
Environment
No response
Environment (Other)
No response
~This should not happen generally. Can you provide which environment are you using? e.g. ganache, hardhat, geth and on which network mainnet, testnet.~
Edit: just noticed that its a known issue https://github.com/ethers-io/ethers.js/pull/3094#issuecomment-1190741714
Related to https://github.com/ethers-io/ethers.js/pull/3094 ?
@osis My guess is yes. The fix will be going out tomorrow; you can try with 5.7 once it is released. :)
thanks for the info, I was running geth node but on a private POA network which creates block on demand, when there is new txn (i.e. basically the same as a dev network but is shared/synced between different machines).
will try out 5.7 when it is out