start web3 service so getGasPrice is available
This commit is contained in:
parent
b363873da2
commit
01277f6014
43
lib/index.js
43
lib/index.js
|
@ -6,17 +6,17 @@ require('colors');
|
||||||
// Override process.chdir so that we have a partial-implementation PWD for Windows
|
// Override process.chdir so that we have a partial-implementation PWD for Windows
|
||||||
const realChdir = process.chdir;
|
const realChdir = process.chdir;
|
||||||
process.chdir = (...args) => {
|
process.chdir = (...args) => {
|
||||||
if (!process.env.PWD) {
|
if (!process.env.PWD) {
|
||||||
process.env.PWD = process.cwd();
|
process.env.PWD = process.cwd();
|
||||||
}
|
}
|
||||||
realChdir(...args);
|
realChdir(...args);
|
||||||
};
|
};
|
||||||
|
|
||||||
let version = require('../package.json').version;
|
let version = require('../package.json').version;
|
||||||
|
|
||||||
class Embark {
|
class Embark {
|
||||||
|
|
||||||
constructor (options) {
|
constructor(options) {
|
||||||
this.version = version;
|
this.version = version;
|
||||||
this.options = options || {};
|
this.options = options || {};
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ class Embark {
|
||||||
this.context = options.context || [constants.contexts.simulator, constants.contexts.blockchain];
|
this.context = options.context || [constants.contexts.simulator, constants.contexts.blockchain];
|
||||||
let Simulator = require('./cmds/simulator.js');
|
let Simulator = require('./cmds/simulator.js');
|
||||||
let simulator = new Simulator({
|
let simulator = new Simulator({
|
||||||
blockchainConfig: this.config.blockchainConfig,
|
blockchainConfig: this.config.blockchainConfig,
|
||||||
logger: this.logger
|
logger: this.logger
|
||||||
});
|
});
|
||||||
simulator.run(options);
|
simulator.run(options);
|
||||||
|
@ -129,7 +129,7 @@ class Embark {
|
||||||
engine.events.on('check:backOnline:Ethereum', function () {
|
engine.events.on('check:backOnline:Ethereum', function () {
|
||||||
engine.logger.info(__('Ethereum node detected') + '..');
|
engine.logger.info(__('Ethereum node detected') + '..');
|
||||||
engine.config.reloadConfig();
|
engine.config.reloadConfig();
|
||||||
engine.events.request('deploy:contracts', function(err) {
|
engine.events.request('deploy:contracts', function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ class Embark {
|
||||||
callback();
|
callback();
|
||||||
},
|
},
|
||||||
function deploy(callback) {
|
function deploy(callback) {
|
||||||
engine.events.request('deploy:contracts', function(err) {
|
engine.events.request('deploy:contracts', function (err) {
|
||||||
callback(err);
|
callback(err);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -227,7 +227,7 @@ class Embark {
|
||||||
graph(options) {
|
graph(options) {
|
||||||
this.context = options.context || [constants.contexts.graph];
|
this.context = options.context || [constants.contexts.graph];
|
||||||
options.onlyCompile = true;
|
options.onlyCompile = true;
|
||||||
|
|
||||||
const Engine = require('./core/engine.js');
|
const Engine = require('./core/engine.js');
|
||||||
const engine = new Engine({
|
const engine = new Engine({
|
||||||
env: options.env,
|
env: options.env,
|
||||||
|
@ -239,8 +239,7 @@ class Embark {
|
||||||
});
|
});
|
||||||
engine.init();
|
engine.init();
|
||||||
|
|
||||||
async.parallel([
|
async.waterfall([
|
||||||
|
|
||||||
function (callback) {
|
function (callback) {
|
||||||
let pluginList = engine.plugins.listPlugins();
|
let pluginList = engine.plugins.listPlugins();
|
||||||
if (pluginList.length > 0) {
|
if (pluginList.length > 0) {
|
||||||
|
@ -251,14 +250,12 @@ class Embark {
|
||||||
engine.startService("libraryManager");
|
engine.startService("libraryManager");
|
||||||
engine.startService("pipeline");
|
engine.startService("pipeline");
|
||||||
engine.startService("deployment", {onlyCompile: true});
|
engine.startService("deployment", {onlyCompile: true});
|
||||||
|
engine.startService("web3");
|
||||||
engine.startService("codeGenerator");
|
engine.startService("codeGenerator");
|
||||||
|
|
||||||
engine.events.request('deploy:contracts', function(err) {
|
engine.events.request('deploy:contracts', callback);
|
||||||
callback(err);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
], (err, _result) => {
|
], (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
engine.logger.error(err.message);
|
engine.logger.error(err.message);
|
||||||
engine.logger.info(err.stack);
|
engine.logger.info(err.stack);
|
||||||
|
@ -320,7 +317,7 @@ class Embark {
|
||||||
engine.startService("codeGenerator");
|
engine.startService("codeGenerator");
|
||||||
callback();
|
callback();
|
||||||
},
|
},
|
||||||
function setupStoragePlugin(callback){
|
function setupStoragePlugin(callback) {
|
||||||
let pluginList = engine.plugins.listPlugins();
|
let pluginList = engine.plugins.listPlugins();
|
||||||
if (pluginList.length > 0) {
|
if (pluginList.length > 0) {
|
||||||
engine.logger.info(__("loaded plugins") + ": " + pluginList.join(", "));
|
engine.logger.info(__("loaded plugins") + ": " + pluginList.join(", "));
|
||||||
|
@ -344,15 +341,15 @@ class Embark {
|
||||||
function deploy(callback) {
|
function deploy(callback) {
|
||||||
engine.events.on('outputDone', function () {
|
engine.events.on('outputDone', function () {
|
||||||
cmdPlugin.uploadCmds[0].cb()
|
cmdPlugin.uploadCmds[0].cb()
|
||||||
.then((success) => {
|
.then((success) => {
|
||||||
callback(null, success);
|
callback(null, success);
|
||||||
})
|
})
|
||||||
.catch(callback);
|
.catch(callback);
|
||||||
});
|
});
|
||||||
|
|
||||||
engine.events.request('deploy:contracts', function(err) {
|
engine.events.request('deploy:contracts', function (err) {
|
||||||
engine.logger.info(__("finished deploying").underline);
|
engine.logger.info(__("finished deploying").underline);
|
||||||
if(err){
|
if (err) {
|
||||||
callback(err);
|
callback(err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue