What's the equivalent of web3.eth.subscribe('logs' #3301
Answered
by
ricmoo
BravoNatalie
asked this question in
Q&A
-
What's the ethers.js equivalent of the example below? var subscription = web3.eth.subscribe('logs', {
address: '0x123456..',
topics: ['0x12345...']
}, function(error, result){
if (!error)
console.log(result);
}); ps.: I'm not interested in listening to the events of a specific contract. My goal is to listen for all events to a specific contract and filter for one transaction's internal event. |
Beta Was this translation helpful? Give feedback.
Answered by
ricmoo
Aug 22, 2022
Replies: 1 comment 1 reply
-
The closest would be If you have the contract ABI, you can more simply use the |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
BravoNatalie
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The closest would be
provider.on({ address, topics }, (log) => { … });
. I’m not sure whaterror
would mean in that context though.If you have the contract ABI, you can more simply use the
contract.on
API which will do the parsing and some other heavy lifting for you. :)