Skip to content

API ReferenceReact provider and hooksFunction

bindOnAccountChanged()

function bindOnAccountChanged(listener): OnAccountChangedHandle;

Binds an event listener to the accountsChanged event of the injected browser wallet (window.ethereum), if it exists.

This is a browser-only utility — it accesses window.ethereum directly. For non-browser environments, use wagmi’s watchAccount or your framework’s account change detection.

Parameters

ParameterTypeDescription
listenerOnAccountChangedListenerThe listener to bind to the event.

Returns

OnAccountChangedHandle

A handle that, when called, unbinds the listener.