Last active
April 2, 2018 22:13
-
-
Save rib3ye/b1fb89fc561bcaa1afce893f4786f641 to your computer and use it in GitHub Desktop.
A Sublime Text autocomplete snippet for creating a web3 instance
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
<snippet> | |
<content> | |
window.addEventListener('load', function() { | |
if (typeof web3 !== 'undefined') { | |
web3 = new Web3(web.currentProvider); | |
} else { | |
web3 = new Web3(new Web3.providers.HttpProvider("${1:http://127.0.0.1:7545}")); //Ganache Default | |
} | |
web3.eth.defaultAccount = web3.eth.accounts[0]; | |
var ${2:ContractName} = web3.eth.contract(${3:abi}); | |
var ${4:ContractObj} = ${2:ContractName}.at('${5:contactAddress}'); | |
console.log(${4:ContractObj}); | |
} | |
</content> | |
<tabTrigger>web3</tabTrigger> | |
</snippet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment