{"size": 499, "ext": "js", "max_stars_repo_path": "try/library/ethereum/init.js", "max_stars_repo_name": "gdsoumya/AtomicSwap", "max_stars_repo_stars_event_min_datetime": "2020-09-25T22:48:35.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-24T01:16:52.000Z", "max_issues_repo_path": "try/library/ethereum/init.js", "max_issues_repo_name": "gdsoumya/AtomicSwap", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "try/library/ethereum/init.js", "max_forks_repo_name": "gdsoumya/AtomicSwap", "max_forks_repo_forks_event_min_datetime": "2021-01-18T22:05:31.000Z", "max_forks_repo_forks_event_max_datetime": "2021-01-18T22:05:31.000Z"}
{"max_stars_count": 6, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 31.1875, "max_line_length": 69, "alphanum_fraction": 0.7174348697}
const Web3 = require("web3");
const store = require("./store");
const config = require("../../globalConfig.json");

//Infura HttpProvider Endpoint
module.exports = (rpc, key) => {
  const web3 = new Web3(new Web3.providers.HttpProvider(rpc));
  store.keyStore = web3.eth.accounts.privateKeyToAccount(key);
  store.keyStore.privateKey = store.keyStore.privateKey.substring(2);
  store.contract = new web3.eth.Contract(
    config.ethereum.abi,
    config.ethereum.contractAddr
  );
  return web3;
};
