Skip to content

Commit

Permalink
fix: Fix network status field (#306)
Browse files Browse the repository at this point in the history
The network status field would show the `networkId` on load (in
decimal), but after switching chains it would show the `chainId`
(in hex). It now shows the `networkId` in all cases.

This means re-introducing the deprecated `networkChanged` event
listener, but this listener is still something we want to be able to
test.
  • Loading branch information
Gudahtt authored Mar 29, 2024
1 parent af6e149 commit 3169ae9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ const closeProvider = () => {
if (isMetaMaskInstalled()) {
provider.removeListener('chainChanged', handleNewChain);
provider.removeListener('chainChanged', handleEIP1559Support);
provider.removeListener('chainChanged', handleNewNetwork);
provider.removeListener('networkChanged', handleNewNetwork);
provider.removeListener('accountsChanged', handleNewAccounts);
provider.removeListener('accountsChanged', handleEIP1559Support);
}
Expand All @@ -785,7 +785,7 @@ const initializeProvider = async () => {

provider.on('chainChanged', handleNewChain);
provider.on('chainChanged', handleEIP1559Support);
provider.on('chainChanged', handleNewNetwork);
provider.on('networkChanged', handleNewNetwork);
provider.on('accountsChanged', handleNewAccounts);
provider.on('accountsChanged', handleEIP1559Support);

Expand Down

0 comments on commit 3169ae9

Please sign in to comment.