remove web3 dependency from deploy tracker; use request instead to get block
This commit is contained in:
parent
68c277cad1
commit
78f64945ab
|
@ -13,7 +13,7 @@ class Blockchain {
|
|||
this.initWeb3();
|
||||
}
|
||||
this.registerServiceCheck();
|
||||
this.registerAccountRequests();
|
||||
this.registerRequests();
|
||||
}
|
||||
|
||||
initWeb3() {
|
||||
|
@ -57,7 +57,7 @@ class Blockchain {
|
|||
});
|
||||
}
|
||||
|
||||
registerAccountRequests() {
|
||||
registerRequests() {
|
||||
const self = this;
|
||||
|
||||
this.events.setCommandHandler("blockchain:defaultAccount:get", function(cb) {
|
||||
|
@ -68,6 +68,11 @@ class Blockchain {
|
|||
self.setDefaultAccount(account);
|
||||
cb();
|
||||
});
|
||||
|
||||
this.events.setCommandHandler("blockchain:block:byNumber", function(blockNumber, cb) {
|
||||
self.getBlock(blockNumber, cb);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
defaultAccount() {
|
||||
|
|
|
@ -26,7 +26,7 @@ class Deploy {
|
|||
|
||||
initTracker(cb) {
|
||||
this.deployTracker = new DeployTracker({
|
||||
logger: this.logger, chainConfig: this.chainConfig, blockchain: this.blockchain, env: this.env
|
||||
logger: this.logger, chainConfig: this.chainConfig, env: this.env, events: this.events
|
||||
}, cb);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,16 +5,16 @@ class DeployTracker {
|
|||
constructor(options, cb) {
|
||||
const self = this;
|
||||
this.logger = options.logger;
|
||||
this.events = options.events;
|
||||
this.env = options.env;
|
||||
this.chainConfig = options.chainConfig;
|
||||
this.blockchain = options.blockchain;
|
||||
|
||||
if (this.chainConfig === false) {
|
||||
this.currentChain = {contracts: []};
|
||||
return cb();
|
||||
}
|
||||
|
||||
this.blockchain.getBlock(0, function(err, block) {
|
||||
this.events.request("blockchain:block:byNumber", 0, function(_err, block) {
|
||||
let chainId = block.hash;
|
||||
|
||||
if (self.chainConfig[chainId] === undefined) {
|
||||
|
@ -26,10 +26,6 @@ class DeployTracker {
|
|||
self.currentChain.name = self.env;
|
||||
cb();
|
||||
});
|
||||
|
||||
// TODO: add other params
|
||||
//this.currentChain.networkId = "";
|
||||
//this.currentChain.networkType = "custom"
|
||||
}
|
||||
|
||||
loadConfig(config) {
|
||||
|
|
Loading…
Reference in New Issue