generate an abi file compatible with mist and metamask

This commit is contained in:
Iuri Matias 2016-08-09 20:50:12 -04:00
parent 2fbb41b113
commit cf3cfe51ca
1 changed files with 8 additions and 4 deletions

View File

@ -193,16 +193,20 @@ Deploy.prototype.execute_cmds = function(cmds) {
console.log("executing: " + cmd); console.log("executing: " + cmd);
eval(cmd); eval(cmd);
} }
} };
Deploy.prototype.generate_provider_file = function() { Deploy.prototype.generate_provider_file = function() {
var result = ""; var result = "";
result += "var web3 = new Web3();";
result += "web3.setProvider(new web3.providers.HttpProvider('http://" + this.blockchainConfig.rpcHost + ":" + this.blockchainConfig.rpcPort + "'));"; result += "if (typeof web3 !== 'undefined' && typeof Web3 !== 'undefined') {";
result += 'web3 = new Web3(web3.currentProvider);';
result += "} else if (typeof Web3 !== 'undefined') {";
result += 'web3 = new Web3(new Web3.providers.HttpProvider("http://' + this.blockchainConfig.rpcHost + ':' + this.blockchainConfig.rpcPort + '"));';
result += '}';
result += "web3.eth.defaultAccount = web3.eth.accounts[0];"; result += "web3.eth.defaultAccount = web3.eth.accounts[0];";
return result; return result;
} };
Deploy.prototype.generate_abi_file = function() { Deploy.prototype.generate_abi_file = function() {
var result = ""; var result = "";