From 91cc554978a8b93c23ffb02b3242ab1c9212584a Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Thu, 26 Jul 2018 12:58:25 -0400 Subject: [PATCH] cleanup --- lib/contracts/blockchain.js | 15 --------------- lib/core/events.js | 1 + lib/modules/deployment/index.js | 18 +++++++++--------- lib/modules/graph/index.js | 1 + 4 files changed, 11 insertions(+), 24 deletions(-) diff --git a/lib/contracts/blockchain.js b/lib/contracts/blockchain.js index 578356753..9bb9f2e25 100644 --- a/lib/contracts/blockchain.js +++ b/lib/contracts/blockchain.js @@ -20,8 +20,6 @@ class Blockchain { this.web3StartedInProcess = false; self.events.setCommandHandler("blockchain:web3:isReady", (cb) => { - console.dir("geting state of web3"); - console.dir(self.isWeb3Ready.toString()); cb(self.isWeb3Ready); }); @@ -44,7 +42,6 @@ class Blockchain { if (this.contractsConfig.deployment.type !== "rpc" && this.contractsConfig.deployment.type !== "ws") { const message = __("contracts config error: unknown deployment type %s", this.contractsConfig.deployment.type); this.logger.error(message); - //return cb(message); } const protocol = (this.contractsConfig.deployment.type === "rpc") ? this.contractsConfig.deployment.protocol : 'ws'; @@ -63,17 +60,11 @@ class Blockchain { this.provider = new Provider(providerOptions); self.events.request("processes:launch", "blockchain", () => { - console.dir("======> blockchain launched!"); - console.dir("starting web3 provider"); self.provider.startWeb3Provider(() => { - console.dir("funding accounts"); self.provider.fundAccounts(() => { - console.dir("registering web3 object"); self.isWeb3Ready = true; self.events.emit(WEB3_READY); self.registerWeb3Object(); - - //self.events.emit("check:backOnline:Ethereum"); }); }); }); @@ -96,14 +87,11 @@ class Blockchain { } onReady(callback) { - console.dir("======> onReady!!"); - console.dir("this.isWeb3Ready: " + this.isWeb3Ready.toString()); if (this.isWeb3Ready) { return callback(); } this.events.once(WEB3_READY, () => { - console.dir("got event triggered"); callback(); }); } @@ -145,7 +133,6 @@ class Blockchain { if (err && err !== NO_NODE) { return cb(err); } - console.dir(statusObj); cb(statusObj); }); }, 5000, 'off'); @@ -197,10 +184,8 @@ class Blockchain { } getGasPrice(cb) { - console.dir("geting gas price"); const self = this; this.onReady(() => { - console.dir("it's ready, getting gas price"); self.web3.eth.getGasPrice(cb); }); } diff --git a/lib/core/events.js b/lib/core/events.js index d513f07a2..5a3ab0a8f 100644 --- a/lib/core/events.js +++ b/lib/core/events.js @@ -11,6 +11,7 @@ function log(eventType, eventName) { if (['end', 'prefinish', 'error', 'new', 'demo', 'block', 'version'].indexOf(eventName) >= 0) { return; } + // prevents infinite loop when printing events if (eventType.indexOf("log") >= 0) { return; } diff --git a/lib/modules/deployment/index.js b/lib/modules/deployment/index.js index 12b4d00bf..2772b984e 100644 --- a/lib/modules/deployment/index.js +++ b/lib/modules/deployment/index.js @@ -86,15 +86,15 @@ class DeployManager { return callback(); }, - // TODO: could be implemented as an event (beforeDeployAll) - function checkIsConnectedToBlockchain(callback) { - callback(); - //self.blockchain.onReady(() => { - // self.blockchain.assertNodeConnection((err) => { - // callback(err); - // }); - //}); - }, + //// TODO: could be implemented as an event (beforeDeployAll) + //function checkIsConnectedToBlockchain(callback) { + // callback(); + // //self.blockchain.onReady(() => { + // // self.blockchain.assertNodeConnection((err) => { + // // callback(err); + // // }); + // //}); + //}, // TODO: this can be done on the fly or as part of the initialization function determineDefaultAccount(callback) { diff --git a/lib/modules/graph/index.js b/lib/modules/graph/index.js index cc29ee1f5..9f4ff0fce 100644 --- a/lib/modules/graph/index.js +++ b/lib/modules/graph/index.js @@ -2,6 +2,7 @@ const async = require('async'); const Viz = require('viz.js'); const fs = require('fs'); +// TODO: refactor this class to use the plugin api and not refeneences directly class GraphGenerator { constructor(embark, _options) { const self = this;