useScaffoldWatchContractEvent
Use this hook to subscribe to events emitted by your smart contract, and receive real-time updates when these events are emitted.
Use this hook to subscribe to events emitted by your smart contract, and receive real-time updates when these events are emitted.
ts
This example subscribes to the GreetingChange
event emitted by the YourContract
smart contract and logs the parameters from the event to the console when it’s emitted.
This hook is a wrapper around wagmi’s useWatchContractEvent.
Configuration
It is recommended to setState
using updater
function
in the onLogs
function to avoid problems due to caching.