{"size": 549, "ext": "js", "max_stars_repo_path": "client/web3/provider.js", "max_stars_repo_name": "drummonda/Stackathon", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "client/web3/provider.js", "max_issues_repo_name": "drummonda/Stackathon", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "client/web3/provider.js", "max_forks_repo_name": "drummonda/Stackathon", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.875, "max_line_length": 71, "alphanum_fraction": 0.6994535519}
import contract from 'truffle-contract'
import Web3 from "web3"

const provider = () => {
  // If the user has MetaMask:
  if (typeof web3 !== 'undefined') {
    return web3.currentProvider
  } else {
    console.error("You need to install MetaMask for this app to work!")
  }
}

export const eth = new Web3(provider()).eth

export const getInstance = async artifact => {
  const contractObj = contract(artifact)
  contractObj.setProvider(provider());

  const deployed = await contractObj.deployed();
  console.log(deployed);
  return deployed;
}

