web3-arduino
web3-arduino copied to clipboard
Listen to Contract events
Hi,
I'm wondering if it's possible to use this library to listen to events triggered by the smart contract.
https://github.com/ethereum/wiki/wiki/JavaScript-API#contract-events
I could not find it in the examples.
Thanks,
Tim
You might want to read the code and see how to listen for changes
@publu I did that and could not find the implementation. So I might have missed it, or it's not implemented yet.
I do understand that the contract event listener requires a websocket connection which I'm not even sure if it's supported on the ESP32.
Just polling could also do the trick. If we could implement the contract.getPastEvents
function we can kindof work around the websockets. Not as nice because the http provider is deprecated in the latest web3 version. But for the ESP32 it's probably the best solution.
Sorry for my late reply. This is not implemented yet, but I'd like to implement it asap. Sorry for slow speed of development :(
No problem! At the moment I'm working with the NodeJS web3 version on the Raspberry Pi. But I would love to implement it on my ESP32. Unfortunately my knowledge of C is not that great, otherwise I would've helped you with the development. However I might be able to test the implementation when It's done 😃