2

Is there any reason why ethereum.enable() would not open the metamask console?
It was working briefly and now I cannot get any response from it.

0

I am having the same issue. And when I stay at "web3": "0.20.5" it works but with the latest it doesn't, i.e. 1.0.0-beta.46 or 1.0.0-beta.51.

Can you share a code snippet? And have you seen this post and implemented the changes?: https://medium.com/metamask/https-medium-com-metamask-breaking-change-injecting-web3-7722797916a8.

window.addEventListener('load', async () => {
    // Modern dapp browsers...
    if (window.ethereum) {
        window.web3 = new Web3(ethereum);
        try {
            // Request account access if needed
            await ethereum.enable();
            // Acccounts now exposed
            web3.eth.sendTransaction({/* ... */});
        } catch (error) {
            // User denied account access...
        }
    }
    // Legacy dapp browsers...
    else if (window.web3) {
        window.web3 = new Web3(web3.currentProvider);
        // Acccounts always exposed
        web3.eth.sendTransaction({/* ... */});
    }
    // Non-dapp browsers...
    else {
        console.log('Non-Ethereum browser detected. You should consider trying MetaMask!');
    }
});
0

I just needed to reload Metamask and everything started functioning as expected.

0

Let's try! I'm using web3 v1.0.0-beta.55

let ethereum = window.ethereum;
let web3 = window.web3;
if (typeof ethereum !== 'undefined') {
 await ethereum.enable();
 web3 = new Web3(ethereum);
} else if (typeof web3 !== 'undefined') {
 web3 = new Web3(web3.currentProvider);
} else {
 web3 = new Web3(new Web3.providers.HttpProvider(process.env.WEB3_PROVIDER));
}
0

It's happening to me after you logout from MetaMask. For now, the only way to reactivate ethereum.enable is to close Chrome, and launch it once again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.