Created
October 15, 2018 07:23
-
-
Save DavidVotrubec/13174517311c57529363770c4aea5192 to your computer and use it in GitHub Desktop.
Instance of web3 with provider from web3 injected by MetaMask
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Web3 from 'web3'; | |
// We are assumming that the user has installed the Metamask browser extension | |
// and we are using Provider from the injected instance of web3 | |
// to create instance of Web3 of our desired version | |
// See https://www.udemy.com/ethereum-and-solidity-the-complete-developers-guide/learn/v4/t/lecture/9020582?start=0 for more details | |
// This way we can simply import preconfigured instance of web3 | |
const web3 = new Web3(window.web3.currentProvider); | |
export default web3; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment