Prepare for metamask breaking changes (#341)

This commit is contained in:
Gerardo Nardelli 2020-05-26 16:36:22 -03:00 committed by GitHub
parent 3b368ce644
commit d6e39f34af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -32,6 +32,12 @@ const getWeb3 = () => {
// Request account access // Request account access
await ethereum.enable() await ethereum.enable()
await processWeb3(web3, resolve, reject) await processWeb3(web3, resolve, reject)
// In the next metamask version it will stop reloading the page on network change.
// Instead this new event will be triggered.
ethereum.on('chainChanged', function() {
window.location.reload()
})
} catch (error) { } catch (error) {
console.log(error) console.log(error)
const errorMsg = `Wallet account rejected by user. You need to unlock your wallet. const errorMsg = `Wallet account rejected by user. You need to unlock your wallet.