Do smart contracts have events now that I can set up listeners for or do I need to poll the chain manually to get data about them?
There are no events right now on NEAR but you could do the following https://github.com/near-examples/erc-20-token/blob/master/contract/events.ts and in Rust https://github.com/near/docs/issues/362
Instead of native events we have a way to poll for changes in the contract's state. For example the events above for fungible tokens are implemented by using that.
Polling for events can be done via RPC https://docs.near.org/docs/api/rpc-experimental#example-of-data-changes and also we are finishing the indexing infrastructure so can later just run indexing node that will provide all this events (https://github.com/nearprotocol/nearcore/pull/2651)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With