Skip to content

Instantly share code, notes, and snippets.

@wissalHaji
Created December 27, 2020 20:51
Show Gist options
  • Save wissalHaji/9352df718e02441baa465fe10d3a2b1f to your computer and use it in GitHub Desktop.
Save wissalHaji/9352df718e02441baa465fe10d3a2b1f to your computer and use it in GitHub Desktop.
const getContract = async (web3) => {
const data = await $.getJSON("./contracts/Greeting.json");
const netId = await web3.eth.net.getId();
const deployedNetwork = data.networks[netId];
const greeting = new web3.eth.Contract(
data.abi,
deployedNetwork && deployedNetwork.address
);
return greeting;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment