mirror of https://github.com/embarklabs/embark.git
get blockchain object from event bus
This commit is contained in:
parent
62fad583da
commit
567b0c75b8
|
@ -24,6 +24,10 @@ class BlockchainConnector {
|
|||
cb(self.isWeb3Ready);
|
||||
});
|
||||
|
||||
self.events.setCommandHandler("blockchain:object", (cb) => {
|
||||
cb(self);
|
||||
});
|
||||
|
||||
if (!this.web3) {
|
||||
this.initWeb3();
|
||||
} else {
|
||||
|
|
|
@ -206,7 +206,7 @@ class Engine {
|
|||
events: this.events
|
||||
});
|
||||
|
||||
this.registerModule('deployment', {blockchain: this.blockchain, plugins: this.plugins, onlyCompile: options.onlyCompile});
|
||||
this.registerModule('deployment', {plugins: this.plugins, onlyCompile: options.onlyCompile});
|
||||
|
||||
this.events.on('file-event', function (fileType) {
|
||||
clearTimeout(self.fileTimeout);
|
||||
|
@ -252,7 +252,7 @@ class Engine {
|
|||
});
|
||||
|
||||
const Blockchain = require('../contracts/blockchain.js');
|
||||
this.blockchain = new Blockchain({
|
||||
(new Blockchain({
|
||||
contractsConfig: this.config.contractsConfig,
|
||||
blockchainConfig: this.config.blockchainConfig,
|
||||
events: this.events,
|
||||
|
@ -260,7 +260,7 @@ class Engine {
|
|||
isDev: this.isDev,
|
||||
locale: this.locale,
|
||||
web3: options.web3
|
||||
});
|
||||
})); /*eslint no-new: "off"*/
|
||||
|
||||
this.registerModule('whisper');
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ class ContractDeployer {
|
|||
constructor(options) {
|
||||
const self = this;
|
||||
|
||||
this.blockchain = options.blockchain;
|
||||
this.logger = options.logger;
|
||||
this.events = options.events;
|
||||
this.plugins = options.plugins;
|
||||
|
@ -71,6 +70,13 @@ class ContractDeployer {
|
|||
}
|
||||
|
||||
async.waterfall([
|
||||
function requestBlockchainConnector(callback) {
|
||||
self.events.request("blockchain:object", (blockchain) => {
|
||||
self.blockchain = blockchain;
|
||||
callback();
|
||||
});
|
||||
},
|
||||
|
||||
function _determineArguments(next) {
|
||||
self.determineArguments(params || contract.args, contract, (err, realArgs) => {
|
||||
if (err) {
|
||||
|
|
|
@ -20,7 +20,6 @@ class DeployManager {
|
|||
this.onlyCompile = options.onlyCompile !== undefined ? options.onlyCompile : false;
|
||||
|
||||
this.contractDeployer = new ContractDeployer({
|
||||
blockchain: this.blockchain,
|
||||
logger: this.logger,
|
||||
events: this.events,
|
||||
plugins: this.plugins
|
||||
|
@ -89,6 +88,13 @@ class DeployManager {
|
|||
}
|
||||
|
||||
async.waterfall([
|
||||
function requestBlockchainConnector(callback) {
|
||||
self.events.request("blockchain:object", (blockchain) => {
|
||||
self.blockchain = blockchain;
|
||||
callback();
|
||||
});
|
||||
},
|
||||
|
||||
function buildContracts(callback) {
|
||||
self.events.request("contracts:build", self.deployOnlyOnConfig, (err) => {
|
||||
callback(err);
|
||||
|
|
Loading…
Reference in New Issue