Hooks
useWalletConnectorEvent
Summary
The useWalletConnectorEvent
hook is used for handling events from a WalletConnector
or an array of WalletConnectors
. This hook allows you to specify an event to listen to and a handler function that will be called whenever the event is emitted. The handler will receive the event arguments followed by the instance of the WalletConnector
that emitted the event.
Parameter | Type | Description |
---|---|---|
eventEmitters | WalletConnector or WalletConnector[] | The WalletConnector instance(s) to attach the event listener to. If an array is provided, the event listener is attached to all provided connectors. |
eventName | string | The name of the event to listen for. |
handler | function | The callback function to execute when the event is emitted. The arguments to the callback are the arguments emitted with the event, followed by the WalletConnector instance that emitted the event. |
Example
Listen to primary wallet connector account changed
Listen to all wallets connectors for the disconnect event
Was this page helpful?