move getBlock to blockchain module

This commit is contained in:
Iuri Matias 2018-05-18 18:50:20 -04:00 committed by Jonathan Rainville
parent 1547a115a4
commit 84dcfca254
3 changed files with 7 additions and 3 deletions

View File

@ -86,6 +86,10 @@ class Blockchain {
this.web3.eth.getCode(address, cb); this.web3.eth.getCode(address, cb);
} }
getBlock(blockNumber, cb) {
this.web3.eth.getBlock(blockNumber, cb);
}
} }
module.exports = Blockchain; module.exports = Blockchain;

View File

@ -26,7 +26,7 @@ class Deploy {
initTracker(cb) { initTracker(cb) {
this.deployTracker = new DeployTracker({ this.deployTracker = new DeployTracker({
logger: this.logger, chainConfig: this.chainConfig, web3: this.web3, env: this.env logger: this.logger, chainConfig: this.chainConfig, blockchain: this.blockchain, env: this.env
}, cb); }, cb);
} }

View File

@ -7,14 +7,14 @@ class DeployTracker {
this.logger = options.logger; this.logger = options.logger;
this.env = options.env; this.env = options.env;
this.chainConfig = options.chainConfig; this.chainConfig = options.chainConfig;
this.web3 = options.web3; this.blockchain = options.blockchain;
if (this.chainConfig === false) { if (this.chainConfig === false) {
this.currentChain = {contracts: []}; this.currentChain = {contracts: []};
return cb(); return cb();
} }
this.web3.eth.getBlock(0, function(err, block) { this.blockchain.getBlock(0, function(err, block) {
let chainId = block.hash; let chainId = block.hash;
if (self.chainConfig[chainId] === undefined) { if (self.chainConfig[chainId] === undefined) {