Currently, there are a few stateful things to consider when interacting with this API:

  1. What is the current network?

You can get it by requesting: ethereum.request({ method: 'eth_chainId' })

  1. What is the current account?

You can get it by requesting: ethereum.request({ method: 'eth_account' })

Also, Zerion wallet provider emits the following events when a user changes network or account:

  • accountsChanged will be emitted whenever the user's exposed account address changes.
ethereum.on('accountsChanged', handler: (accounts: Array<string>) => void);
  • chainChanged **will be** emitted whenever the currently connected chain changes.
ethereum.on('chainChanged', handler: (chainId: string) => void);