EIP-1193 Event Listen Methods

The BrowserProvider allows dApps to listen for important state changes in the wallet using an event system, compliant with EIP-1193.

dApp developers should subscribe to these events using provider.on(eventName, listener) and clean up listeners using provider.removeListener(eventName, listener).

Event
When Emitted
Payload (Data)

accountsChanged

Fired when the list of accounts available to the dApp changes. This occurs in two scenarios: 1. The user changes their active (selected) account in the wallet UI. 2. The user revokes permission for one or more accounts from the dApp in the wallet settings.

accounts: string[]On active account switch: The array will typically contain the single new active address: ['NEW_ADDRESS']On permission change: The array will contain the remaining permitted accounts: ['REMAINING', ...] or [] (if all permissions are revoked).(Convention: The first account, accounts[0], is always considered the selected account on wallet.)

disconnect

Fired when the dApp becomes disconnected from the wallet. This only occurs when the user revokes permission for the entire site from the wallet settings (i.e., revokes all account permissions at once). (Note: This event does not fire when only individual accounts are disconnected; accountsChanged handles that.)

Object: { message: string, code: number } An object that conforms to the ProviderRpcError interface. Example:{ message: "Fact Wallet: The user...", code: 4900 }

chainChanged

Fired when the user changes the active network in the wallet UI.

chainId: string The new network's chain ID (e.g., 'mitum-mainnet').

Last updated