Last active
August 6, 2021 11:26
-
-
Save percybolmer/e3f28afc77b70c9430548b206a3826c9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
async function connectToSelectedNetwork() { | |
// This will connect to the selected network inside MetaMask | |
const web3 = new Web3(Web3.givenProvider); | |
// Set the ABI of the Built contract so we can interact with it | |
const abi = await getABI(); | |
const address = getContractAddress(); | |
// Make a new instance of the contract by giving the address and abi | |
const devtoken = new web3.Contract(abi, address); | |
// Set the state of the app by passing the contract so we can reach it from other places | |
setDevToken(devtoken); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment