0

I'm using react and javascript. For whatever reason, I've tried a few methods and it doesn't seem to be opening metamask.

await window.ethereum.enable();

and

window.web3 = new Web3(web3.currentProvider);

But in the second instance it has no clue what web3 is.

1
import Web3 from 'web3';

At the top of the file and then during a componentwillmount or whatnot, these lines...

window.web3 = new Web3(window.ethereum);
await window.ethereum.enable();
| improve this answer | |

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.