Open antonyhudson opened 5 years ago
I'm also facing the same issue
And how did you fix it?
The problem is account returned from metamask was null. To avoid this issue, Add this line after ethereum.enable(); when creating web3 object.
Hi @malavancs
Can you explain more about this?
ethereum.enable();
Some other browser has reported Uncaught ReferenceError: ethereum is not defined
but it work on chrome.
where ..
The problem is account returned from metamask was null. To avoid this issue, Add this line after ethereum.enable(); when creating web3 object.
where to add etherreum.enable()
@Vignesh1010
On index.js
initWeb3: function() { // TODO: refactor conditional if (typeof web3 !== 'undefined') { // If a web3 instance is already provided by Meta Mask. App.web3Provider = web3.currentProvider;
etherreum.enable(); web3 = new Web3(web3.currentProvider); } else { // Specify default instance if no web3 instance provided App.web3Provider = new Web3.providers.HttpProvider('http://localhost:7545'); etherreum.enable(); web3 = new Web3(App.web3Provider); }
etherreum.enable();
This has worked in my case. Thanks @vignesh1010
I am not able to see candidates, despite using ethereum.enable(). What are other possible causes for this?
initWeb3: function() { // TODO: refactor conditional if (typeof web3 !== 'undefined') { // If a web3 instance is already provided by Meta Mask. App.web3Provider = web3.currentProvider; ethereum.enable(); web3 = new Web3(web3.currentProvider); } else { // Specify default instance if no web3 instance provided App.web3Provider = new Web3.providers.HttpProvider('http://localhost:7545'); ethereum.enable(); web3 = new Web3(App.web3Provider); } return App.initContract(); },
etherreum.enable();
This has worked in my case. Thanks @vignesh1010
Btw It was me to thank :(
That's all i can see... cant define the problem... help please
Check for console logs. Make sure you've added
initWeb3: function() {
// TODO: refactor conditional
if (typeof web3 !== 'undefined') {
// If a web3 instance is already provided by Meta Mask.
App.web3Provider = web3.currentProvider;
etherreum.enable();
web3 = new Web3(web3.currentProvider);
} else {
// Specify default instance if no web3 instance provided
App.web3Provider = new Web3.providers.HttpProvider('http://localhost:7545');
etherreum.enable();
web3 = new Web3(App.web3Provider);
}
I had a similar issue, caused by web3.eth.getCoinbase returning null account, I solved following these steps:
For those who etherreum.enable(); doesn't work, try window.ethereum.enable(); it worked for me.
What may be the problem, restarting the browser does not help?