Skip to main content

Events

Subscribe with ethereum.on(eventName, handler) and unsubscribe with ethereum.removeListener.

Emitted events

EventPayloadWhen
accountsChangedstring[]Approved accounts change, or access is revoked ([])
chainChangedhex chainId stringActive network changes
networkChangeddecimal chain ID stringSame as chainChanged (MetaMask-compatible legacy)
listen.js
ethereum.on("accountsChanged", (accounts) => {
if (accounts.length === 0) {
// User disconnected this origin
}
});

ethereum.on("chainChanged", (chainId) => {
// Reload or update UI for the new chain
});

Bifrost suppresses duplicate events when the payload matches the last returned eth_accounts / eth_chainId / net_version value.

Provider API surface

The injected provider supports on and removeListener. It does not expose once or removeAllListeners.

References