mirror of https://github.com/embarklabs/embark.git
web3.js 0.8.1, fixed obtaining contract addresses
This commit is contained in:
parent
b6d22f1a3f
commit
13e33dd192
|
@ -10,7 +10,7 @@
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"homepage": "",
|
"homepage": "",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"embark-framework": "/Users/iurimatias/Projects/embark-framework",
|
"embark-framework": "/Users/marekkotewicz/ethereum/embark-framework",
|
||||||
"grunt-contrib-clean": "^0.6.0",
|
"grunt-contrib-clean": "^0.6.0",
|
||||||
"grunt-contrib-coffee": "^0.13.0",
|
"grunt-contrib-coffee": "^0.13.0",
|
||||||
"grunt-contrib-concat": "^0.5.1",
|
"grunt-contrib-concat": "^0.5.1",
|
||||||
|
|
8339
js/web3.js
8339
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