Merge pull request #25 from debris/fixed_contract_address
Fixed contract address
This commit is contained in:
commit
19eb84ef91
8337
js/web3.js
8337
js/web3.js
File diff suppressed because one or more lines are too long
|
@ -3,6 +3,7 @@ var fs = require('fs');
|
||||||
var grunt = require('grunt');
|
var grunt = require('grunt');
|
||||||
var readYaml = require('read-yaml');
|
var readYaml = require('read-yaml');
|
||||||
var Config = require('./config/config.js');
|
var Config = require('./config/config.js');
|
||||||
|
var sleep = require('sleep');
|
||||||
|
|
||||||
Deploy = function(env, contractFiles, blockchainConfig, contractsConfig) {
|
Deploy = function(env, contractFiles, blockchainConfig, contractsConfig) {
|
||||||
//this.blockchainConfig = (new Config.Blockchain()).loadConfigFile('config/blockchain.yml').config(env);
|
//this.blockchainConfig = (new Config.Blockchain()).loadConfigFile('config/blockchain.yml').config(env);
|
||||||
|
@ -56,12 +57,10 @@ Deploy.prototype.deploy_contracts = function(env) {
|
||||||
gasPrice: contract.gasPrice
|
gasPrice: contract.gasPrice
|
||||||
});
|
});
|
||||||
|
|
||||||
contractObject["new"].apply(contractObject, contractParams);
|
var transactionHash = contractObject["new"].apply(contractObject, contractParams).transactionHash;
|
||||||
contractAddress = undefined; // TODO;
|
this.deployedContracts[className] = transactionHash;
|
||||||
this.deployedContracts[className] = contractAddress;
|
|
||||||
|
|
||||||
console.log("address is " + contractAddress);
|
console.log("deployed " + className + " with transaction hash " + transactionHash);
|
||||||
console.log("deployed " + className + " at " + contractAddress);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -77,7 +76,16 @@ Deploy.prototype.generate_abi_file = function() {
|
||||||
var contract = this.contractDB[className];
|
var contract = this.contractDB[className];
|
||||||
|
|
||||||
var abi = JSON.stringify(contract.compiled.info.abiDefinition);
|
var abi = JSON.stringify(contract.compiled.info.abiDefinition);
|
||||||
var contractAddress = deployedContract;
|
var transactionHash = deployedContract;
|
||||||
|
|
||||||
|
console.log('trying to obtain ' + className + ' address...');
|
||||||
|
var receipt = null;
|
||||||
|
while ((receipt = web3.eth.getTransactionReceipt(transactionHash)) === null) {
|
||||||
|
sleep.sleep(1);
|
||||||
|
}
|
||||||
|
var contractAddress = receipt.contractAddress;
|
||||||
|
console.log('address is ' + contractAddress);
|
||||||
|
|
||||||
result += "var " + className + "Abi = " + abi + ";";
|
result += "var " + className + "Abi = " + abi + ";";
|
||||||
result += "var " + className + "Contract = web3.eth.contract(" + className + "Abi);";
|
result += "var " + className + "Contract = web3.eth.contract(" + className + "Abi);";
|
||||||
result += "var " + className + " = " + className + "Contract.at('" + contractAddress + "');";
|
result += "var " + className + " = " + className + "Contract.at('" + contractAddress + "');";
|
||||||
|
|
15
package.json
15
package.json
|
@ -25,17 +25,18 @@
|
||||||
"grunt-contrib-uglify": "^0.9.1",
|
"grunt-contrib-uglify": "^0.9.1",
|
||||||
"grunt-contrib-watch": "^0.6.1",
|
"grunt-contrib-watch": "^0.6.1",
|
||||||
"grunt-open": "^0.2.3",
|
"grunt-open": "^0.2.3",
|
||||||
|
"hashmerge": "^1.0.2",
|
||||||
|
"jasmine": "^2.3.1",
|
||||||
"matchdep": "^0.3.0",
|
"matchdep": "^0.3.0",
|
||||||
|
"methodmissing": "^0.0.3",
|
||||||
|
"python": "^0.0.4",
|
||||||
"read-yaml": "^1.0.0",
|
"read-yaml": "^1.0.0",
|
||||||
"shelljs": "^0.5.0",
|
"shelljs": "^0.5.0",
|
||||||
"web3": "^0.5.0",
|
"sleep": "^2.0.0",
|
||||||
"wrench": "^1.5.8",
|
|
||||||
"hashmerge": "^1.0.2",
|
|
||||||
"sync-me": "^0.1.1",
|
"sync-me": "^0.1.1",
|
||||||
"python": "^0.0.4",
|
"toposort": "^0.2.10",
|
||||||
"methodmissing": "^0.0.3",
|
"web3": "^0.8.1",
|
||||||
"jasmine": "^2.3.1",
|
"wrench": "^1.5.8"
|
||||||
"toposort": "^0.2.10"
|
|
||||||
},
|
},
|
||||||
"author": "Iuri Matias <iuri.matias@gmail.com>",
|
"author": "Iuri Matias <iuri.matias@gmail.com>",
|
||||||
"contributors": [],
|
"contributors": [],
|
||||||
|
|
Loading…
Reference in New Issue