1

I am creating a dapp which interacts with Metamask on the browser. Metamask is injecting by default the 0.20.x version (deprecating soon) and I am trying to figure out how to inject 1.x version of web3 instead to Metamask. My code as follows:

Getting a minified version of web3 1.x version to include as script

<script language="javascript" type="text/javascript" src="jslibs/web3.min.js"></script> 
async initProvider() { if (ethereum) { this.web3Provider = ethereum; ethereum.enable(); web3 = new Web3(ethereum); this.account = web3.eth.accounts[0]; console.log(web3.version); } else { console.log("Please install Metamask to continue."); } 

When I console.log the web3 version, it is still returning version 0.20.x to me. Any ideas why?

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.