diff --git a/lib/core/engine.js b/lib/core/engine.js index cfe5a7589..a99127d8b 100644 --- a/lib/core/engine.js +++ b/lib/core/engine.js @@ -251,6 +251,13 @@ class Engine { contractsManager: this.contractsManager, onlyCompile: options.onlyCompile }); + if (!options.web3) { + // Web3 object might have been modified + self.events.once('engine-ready', () => { + self.deployManager.web3 = self.web3; + }); + } + this.events.on('file-event', function (fileType) { clearTimeout(self.fileTimeout); @@ -323,7 +330,17 @@ class Engine { }); } + stopWeb3Service() { + this.servicesMonitor.stopCheck('Ethereum'); + if (this.provider) { + this.provider.stop(); + } + this.web3 = null; + } + startBlockchainNode() { + self.isRunningBlockchain = true; + this.blockchainProcess = new ProcessLauncher({ modulePath: utils.joinPath(__dirname, '../cmds/blockchain/blockchainProcess.js'), logger: this.logger, @@ -340,6 +357,12 @@ class Engine { locale: this.locale } }); + + // TODO use event from process to know when node is ready + setTimeout(() => { + // Wait a couple seconds for process to start + this.startService("web3"); + }, 2000); } libraryManagerService(_options) { diff --git a/lib/i18n/locales/en.json b/lib/i18n/locales/en.json index 41b2d113f..08f5bee35 100644 --- a/lib/i18n/locales/en.json +++ b/lib/i18n/locales/en.json @@ -117,5 +117,6 @@ "finished building DApp and deploying to": "finished building DApp and deploying to", "Type": "Type", "to see the list of available commands": "to see the list of available commands", - "instantiated js-ipfs object configured to the current environment (available if ipfs is enabled)": "instantiated js-ipfs object configured to the current environment (available if ipfs is enabled)" -} \ No newline at end of file + "instantiated js-ipfs object configured to the current environment (available if ipfs is enabled)": "instantiated js-ipfs object configured to the current environment (available if ipfs is enabled)", + "reset done!": "reset done!" +} diff --git a/lib/index.js b/lib/index.js index 357a2a10f..7a37807f0 100644 --- a/lib/index.js +++ b/lib/index.js @@ -151,7 +151,7 @@ class Embark { engine.logger.info(__("Ready").underline); engine.events.emit("status", __("Ready").green); }); - engine.events.on('engine-ready', function () { + engine.events.once('engine-ready', function () { engine.deployManager.deployContracts(function (err) { engine.startService("fileWatcher"); if (options.runWebserver) { @@ -217,8 +217,10 @@ class Embark { callback(); }, function deploy(callback) { - engine.deployManager.deployContracts(function (err) { - callback(err); + engine.events.once('engine-ready', function () { + engine.deployManager.deployContracts(function (err) { + callback(err); + }); }); } ], function (err, _result) {