Merge pull request #216 from poanetwork/metamask-legacy-account-switcher
(Fix) Remove subscriber for legacy MetaMask account switcher event
This commit is contained in:
commit
0d04cebeb5
|
@ -37,6 +37,7 @@ export default async function getWeb3(netId = defaultNetId, onAccountChange) {
|
|||
console.error('Unlock your wallet')
|
||||
}
|
||||
|
||||
if (web3.currentProvider.publicConfigStore) {
|
||||
let currentAccount = defaultAccount ? defaultAccount.toLowerCase() : ''
|
||||
web3.currentProvider.publicConfigStore.on('update', function(obj) {
|
||||
const account = obj.selectedAddress
|
||||
|
@ -45,6 +46,7 @@ export default async function getWeb3(netId = defaultNetId, onAccountChange) {
|
|||
onAccountChange(account)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const web3NetId = await web3.eth.net.getId()
|
||||
if (web3NetId === netId) {
|
||||
|
|
Loading…
Reference in New Issue