add new blockchain event

This commit is contained in:
Jonathan Rainville 2018-07-13 16:41:15 -04:00 committed by Iuri Matias
parent 1b55af3cb7
commit 1c881274b1
1 changed files with 5 additions and 2 deletions

View File

@ -184,7 +184,7 @@ class Blockchain {
const self = this; const self = this;
this.events.setCommandHandler("blockchain:defaultAccount:get", function(cb) { this.events.setCommandHandler("blockchain:defaultAccount:get", function(cb) {
cb(self.defaultAccount); cb(self.defaultAccount());
}); });
this.events.setCommandHandler("blockchain:defaultAccount:set", function(account, cb) { this.events.setCommandHandler("blockchain:defaultAccount:set", function(account, cb) {
@ -200,6 +200,9 @@ class Blockchain {
self.getGasPrice(cb); self.getGasPrice(cb);
}); });
this.events.setCommandHandler("blockchain:contract:create", function(params, cb) {
cb(self.ContractObject(params));
});
} }
defaultAccount() { defaultAccount() {
@ -227,7 +230,7 @@ class Blockchain {
} }
ContractObject(params) { ContractObject(params) {
return new this.web3.eth.Contract(params.abi); return new this.web3.eth.Contract(params.abi, params.address);
} }
deployContractObject(contractObject, params) { deployContractObject(contractObject, params) {