Skip to content

Instantly share code, notes, and snippets.

@devonwesley
Created November 15, 2017 00:01
Show Gist options
  • Save devonwesley/7893a695b371d7e98c69c4f4c45f7203 to your computer and use it in GitHub Desktop.
Save devonwesley/7893a695b371d7e98c69c4f4c45f7203 to your computer and use it in GitHub Desktop.
Using this to show how to instantiate the web3 object.
if (typeof web3 !== 'undefined') {
web3 = new Web3(web3.currentProvider)
} else {
// set the provider you want from Web3.providers
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment