Merge pull request #473 from embark-framework/refactor_contracts_part3
Refactor contracts part3
This commit is contained in:
commit
2c34477e67
|
@ -1,6 +1,4 @@
|
|||
const program = require('commander');
|
||||
const promptly = require('promptly');
|
||||
const utils = require('./utils/utils.js');
|
||||
const Embark = require('../lib/index');
|
||||
const i18n = require('./i18n/i18n.js');
|
||||
let embark = new Embark;
|
||||
|
@ -50,6 +48,7 @@ class Cmd {
|
|||
.action(function (name, options) {
|
||||
i18n.setOrDetectLocale(options.locale);
|
||||
if (name === undefined) {
|
||||
const promptly = require('promptly');
|
||||
return promptly.prompt(__("Name your app (default is %s):", 'embarkDapp'), {
|
||||
default: "embarkDApp",
|
||||
validator: validateName
|
||||
|
@ -259,6 +258,7 @@ class Cmd {
|
|||
program
|
||||
.action(function (cmd) {
|
||||
console.log((__('unknown command') + ' "%s"').red, cmd);
|
||||
let utils = require('./utils/utils.js');
|
||||
let dictionary = ['new', 'demo', 'build', 'run', 'blockchain', 'simulator', 'test', 'upload', 'version'];
|
||||
let suggestion = utils.proposeAlternative(cmd, dictionary);
|
||||
if (suggestion) {
|
||||
|
|
|
@ -18,7 +18,6 @@ class Blockchain {
|
|||
this.web3 = options.web3;
|
||||
this.locale = options.locale;
|
||||
this.isDev = options.isDev;
|
||||
this.addCheck = options.addCheck;
|
||||
this.web3Endpoint = '';
|
||||
this.isWeb3Ready = false;
|
||||
this.web3StartedInProcess = false;
|
||||
|
@ -111,7 +110,7 @@ class Blockchain {
|
|||
const self = this;
|
||||
const NO_NODE = 'noNode';
|
||||
|
||||
this.addCheck('Ethereum', function (cb) {
|
||||
this.events.request("services:register", 'Ethereum', function (cb) {
|
||||
async.waterfall([
|
||||
function checkNodeConnection(next) {
|
||||
self.assertNodeConnection(true, (err) => {
|
||||
|
|
|
@ -32,7 +32,6 @@ class Engine {
|
|||
}
|
||||
|
||||
init(_options) {
|
||||
let self = this;
|
||||
let options = _options || {};
|
||||
this.events = options.events || this.events || new Events();
|
||||
this.logger = options.logger || new Logger({logLevel: options.logLevel || this.logLevel || 'debug', events: this.events, logFile: this.logFile});
|
||||
|
@ -40,11 +39,6 @@ class Engine {
|
|||
this.config.loadConfigFiles({embarkConfig: this.embarkConfig, interceptLogs: this.interceptLogs});
|
||||
this.plugins = this.config.plugins;
|
||||
|
||||
this.servicesMonitor = new ServicesMonitor({events: this.events, logger: this.logger});
|
||||
this.servicesMonitor.addCheck('embarkVersion', function (cb) {
|
||||
return cb({name: 'Embark ' + self.version, status: 'on'});
|
||||
}, 0);
|
||||
|
||||
if (this.interceptLogs || this.interceptLogs === undefined) {
|
||||
this.doInterceptLogs();
|
||||
}
|
||||
|
@ -76,22 +70,6 @@ class Engine {
|
|||
};
|
||||
}
|
||||
|
||||
startMonitor() {
|
||||
let self = this;
|
||||
if (this.plugins) {
|
||||
// --------
|
||||
// TODO: this only works for services done on startup
|
||||
// --------
|
||||
let servicePlugins = this.plugins.getPluginsFor('serviceChecks');
|
||||
servicePlugins.forEach(function (plugin) {
|
||||
plugin.serviceChecks.forEach(function (pluginCheck) {
|
||||
self.servicesMonitor.addCheck(pluginCheck.checkName, pluginCheck.checkFn, pluginCheck.time);
|
||||
});
|
||||
});
|
||||
}
|
||||
this.servicesMonitor.startMonitor();
|
||||
}
|
||||
|
||||
registerModule(moduleName, options) {
|
||||
this.plugins.loadInternalPlugin(moduleName, options || {});
|
||||
}
|
||||
|
@ -100,6 +78,7 @@ class Engine {
|
|||
let options = _options || {};
|
||||
|
||||
let services = {
|
||||
"serviceMonitor": this.serviceMonitor,
|
||||
"pipeline": this.pipelineService,
|
||||
"codeRunner": this.codeRunnerService,
|
||||
"codeGenerator": this.codeGeneratorService,
|
||||
|
@ -146,6 +125,15 @@ class Engine {
|
|||
});
|
||||
}
|
||||
|
||||
serviceMonitor() {
|
||||
const self = this;
|
||||
this.servicesMonitor = new ServicesMonitor({events: this.events, logger: this.logger, plugins: this.plugins});
|
||||
this.servicesMonitor.addCheck('embarkVersion', function (cb) {
|
||||
return cb({name: 'Embark ' + self.version, status: 'on'});
|
||||
}, 0);
|
||||
this.servicesMonitor.startMonitor();
|
||||
}
|
||||
|
||||
namingSystem(_options) {
|
||||
this.registerModule('ens');
|
||||
}
|
||||
|
@ -257,9 +245,7 @@ class Engine {
|
|||
}
|
||||
|
||||
webServerService() {
|
||||
this.registerModule('webserver', {
|
||||
addCheck: this.servicesMonitor.addCheck.bind(this.servicesMonitor)
|
||||
});
|
||||
this.registerModule('webserver');
|
||||
}
|
||||
|
||||
storageService(_options) {
|
||||
|
@ -281,7 +267,6 @@ class Engine {
|
|||
this.blockchain = new Blockchain({
|
||||
contractsConfig: this.config.contractsConfig,
|
||||
blockchainConfig: this.config.blockchainConfig,
|
||||
addCheck: this.servicesMonitor.addCheck.bind(this.servicesMonitor),
|
||||
events: this.events,
|
||||
logger: this.logger,
|
||||
isDev: this.isDev,
|
||||
|
@ -290,7 +275,6 @@ class Engine {
|
|||
});
|
||||
|
||||
this.registerModule('whisper', {
|
||||
addCheck: this.servicesMonitor.addCheck.bind(this.servicesMonitor),
|
||||
// TODO: this should not be needed and should be deducted from the config instead
|
||||
// the eth provider is not necessary the same as the whisper one
|
||||
web3: this.blockchain.web3
|
||||
|
|
|
@ -120,52 +120,50 @@ Plugin.prototype.interceptLogs = function(context) {
|
|||
// TODO: add deploy provider
|
||||
Plugin.prototype.registerClientWeb3Provider = function(cb) {
|
||||
this.clientWeb3Providers.push(cb);
|
||||
this.pluginTypes.push('clientWeb3Provider');
|
||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
||||
this.addPluginType('clientWeb3Provider');
|
||||
};
|
||||
|
||||
Plugin.prototype.registerContractsGeneration = function(cb) {
|
||||
this.contractsGenerators.push(cb);
|
||||
this.pluginTypes.push('contractGeneration');
|
||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
||||
this.addPluginType('contractGeneration');
|
||||
};
|
||||
|
||||
Plugin.prototype.registerPipeline = function(matcthingFiles, cb) {
|
||||
// TODO: generate error for more than one pipeline per plugin
|
||||
this.pipeline.push({matcthingFiles: matcthingFiles, cb: cb});
|
||||
this.pluginTypes.push('pipeline');
|
||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
||||
this.addPluginType('pipeline');
|
||||
};
|
||||
|
||||
Plugin.prototype.addFileToPipeline = function(file, intendedPath, options) {
|
||||
this.pipelineFiles.push({file: file, intendedPath: intendedPath, options: options});
|
||||
this.pluginTypes.push('pipelineFiles');
|
||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
||||
this.addPluginType('pipelineFiles');
|
||||
};
|
||||
|
||||
Plugin.prototype.addContractFile = function(file) {
|
||||
this.contractsFiles.push(file);
|
||||
this.pluginTypes.push('contractFiles');
|
||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
||||
this.addPluginType('contractFiles');
|
||||
};
|
||||
|
||||
Plugin.prototype.registerConsoleCommand = function(cb) {
|
||||
this.console.push(cb);
|
||||
this.pluginTypes.push('console');
|
||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
||||
this.addPluginType('console');
|
||||
};
|
||||
|
||||
// TODO: this only works for services done on startup
|
||||
Plugin.prototype.registerServiceCheck = function(checkName, checkFn, time) {
|
||||
this.serviceChecks.push({checkName: checkName, checkFn: checkFn, time: time});
|
||||
this.pluginTypes.push('serviceChecks');
|
||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
||||
this.addPluginType('serviceChecks');
|
||||
};
|
||||
|
||||
Plugin.prototype.has = function(pluginType) {
|
||||
return this.pluginTypes.indexOf(pluginType) >= 0;
|
||||
};
|
||||
|
||||
Plugin.prototype.addPluginType = function(pluginType) {
|
||||
this.pluginTypes.push(pluginType);
|
||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
||||
};
|
||||
|
||||
Plugin.prototype.generateProvider = function(args) {
|
||||
return this.clientWeb3Providers.map(function(cb) {
|
||||
return cb.call(this, args);
|
||||
|
@ -180,39 +178,33 @@ Plugin.prototype.generateContracts = function(args) {
|
|||
|
||||
Plugin.prototype.registerContractConfiguration = function(config) {
|
||||
this.contractsConfigs.push(config);
|
||||
this.pluginTypes.push('contractsConfig');
|
||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
||||
this.addPluginType('contractsConfig');
|
||||
};
|
||||
|
||||
Plugin.prototype.registerCompiler = function(extension, cb) {
|
||||
this.compilers.push({extension: extension, cb: cb});
|
||||
this.pluginTypes.push('compilers');
|
||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
||||
this.addPluginType('compilers');
|
||||
};
|
||||
|
||||
Plugin.prototype.registerUploadCommand = function(cmd, cb) {
|
||||
this.uploadCmds.push({cmd: cmd, cb: cb});
|
||||
this.pluginTypes.push('uploadCmds');
|
||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
||||
this.addPluginType('uploadCmds');
|
||||
};
|
||||
|
||||
Plugin.prototype.addCodeToEmbarkJS = function(code) {
|
||||
this.embarkjs_code.push(code);
|
||||
this.pluginTypes.push('embarkjsCode');
|
||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
||||
this.addPluginType('embarkjsCode');
|
||||
};
|
||||
|
||||
Plugin.prototype.addProviderInit = function(providerType, code, initCondition) {
|
||||
this.embarkjs_init_code[providerType] = this.embarkjs_init_code[providerType] || [];
|
||||
this.embarkjs_init_code[providerType].push([code, initCondition]);
|
||||
this.pluginTypes.push('initCode');
|
||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
||||
this.addPluginType('initCode');
|
||||
};
|
||||
|
||||
Plugin.prototype.registerImportFile = function(importName, importLocation) {
|
||||
this.imports.push([importName, importLocation]);
|
||||
this.pluginTypes.push('imports');
|
||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
||||
this.addPluginType('imports');
|
||||
};
|
||||
|
||||
Plugin.prototype.registerActionForEvent = function(eventName, cb) {
|
||||
|
@ -220,8 +212,7 @@ Plugin.prototype.registerActionForEvent = function(eventName, cb) {
|
|||
this.eventActions[eventName] = [];
|
||||
}
|
||||
this.eventActions[eventName].push(cb);
|
||||
this.pluginTypes.push('eventActions');
|
||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
||||
this.addPluginType('eventActions');
|
||||
};
|
||||
|
||||
Plugin.prototype.runFilePipeline = function() {
|
||||
|
|
|
@ -2,12 +2,18 @@ let async = require('../utils/async_extend.js');
|
|||
|
||||
class ServicesMonitor {
|
||||
constructor(options) {
|
||||
const self = this;
|
||||
this.events = options.events;
|
||||
this.logger = options.logger;
|
||||
this.plugins = options.plugins;
|
||||
this.checkList = {};
|
||||
this.checkTimers = {};
|
||||
this.checkState = {};
|
||||
this.working = false;
|
||||
|
||||
self.events.setCommandHandler("services:register", (checkName, checkFn, time) => {
|
||||
self.addCheck(checkName, checkFn, time);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,6 +71,11 @@ ServicesMonitor.prototype.startMonitor = function () {
|
|||
this.working = true;
|
||||
this.logger.trace('startMonitor');
|
||||
|
||||
let servicePlugins = this.plugins.getPluginsProperty('serviceChecks', 'serviceChecks');
|
||||
servicePlugins.forEach(function (pluginCheck) {
|
||||
self.addCheck(pluginCheck.checkName, pluginCheck.checkFn, pluginCheck.time);
|
||||
});
|
||||
|
||||
async.eachObject(this.checkList, function (checkName, check, callback) {
|
||||
self.initCheck(checkName);
|
||||
callback();
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
let async = require('async');
|
||||
let windowSize = require('window-size');
|
||||
|
||||
let Monitor = require('./monitor.js');
|
||||
let Console = require('./console.js');
|
||||
|
@ -11,6 +12,16 @@ class Dashboard {
|
|||
this.version = options.version;
|
||||
this.env = options.env;
|
||||
this.contractsConfig = options.contractsConfig;
|
||||
|
||||
this.events.on('firstDeploymentDone', this.checkWindowSize.bind(this));
|
||||
this.events.on('outputDone', this.checkWindowSize.bind(this));
|
||||
}
|
||||
|
||||
checkWindowSize() {
|
||||
let size = windowSize.get();
|
||||
if (size.height < 40 || size.width < 118) {
|
||||
this.logger.warn(__("tip: you can resize the terminal or disable the dashboard with") + " embark run --nodashboard".bold.underline);
|
||||
}
|
||||
}
|
||||
|
||||
start(done) {
|
||||
|
|
|
@ -161,5 +161,10 @@
|
|||
"Cannot upload: {{platform}} node is not running on {{url}}.": "Cannot upload: {{platform}} node is not running on {{url}}.",
|
||||
"Cannot start {{platform}} node on {{url}}.": "Cannot start {{platform}} node on {{url}}.",
|
||||
"Storage process for swarm ended before the end of this process. Code: 0": "Storage process for swarm ended before the end of this process. Code: 0",
|
||||
"error uploading to swarm": "error uploading to swarm"
|
||||
"error uploading to swarm": "error uploading to swarm",
|
||||
"IPFS node detected": "IPFS node detected",
|
||||
"Ethereum node detected": "Ethereum node detected",
|
||||
"Starting swarm process": "Starting swarm process",
|
||||
"Deployment Done": "Deployment Done",
|
||||
"Name your app (default is %s):": "Name your app (default is %s):"
|
||||
}
|
||||
|
|
12
lib/index.js
12
lib/index.js
|
@ -68,7 +68,6 @@ class Embark {
|
|||
let self = this;
|
||||
self.context = options.context || [constants.contexts.run, constants.contexts.build];
|
||||
let Dashboard = require('./dashboard/dashboard.js');
|
||||
let windowSize = require('window-size');
|
||||
|
||||
let engine = new Engine({
|
||||
env: options.env,
|
||||
|
@ -114,7 +113,7 @@ class Embark {
|
|||
engine.logger.info(__("loaded plugins") + ": " + pluginList.join(", "));
|
||||
}
|
||||
|
||||
engine.startMonitor();
|
||||
engine.startService("serviceMonitor");
|
||||
engine.startService("libraryManager");
|
||||
engine.startService("codeRunner");
|
||||
engine.startService("web3");
|
||||
|
@ -153,11 +152,6 @@ class Embark {
|
|||
engine.logger.info(err.stack);
|
||||
} else {
|
||||
engine.events.emit('firstDeploymentDone');
|
||||
|
||||
let size = windowSize.get();
|
||||
if (size.height < 40 || size.width < 118) {
|
||||
engine.logger.warn(__("tip: you can resize the terminal or disable the dashboard with") + " embark run --nodashboard".bold.underline);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -238,7 +232,7 @@ class Embark {
|
|||
engine.logger.info(__("loaded plugins") + ": " + pluginList.join(", "));
|
||||
}
|
||||
|
||||
engine.startMonitor();
|
||||
engine.startService("serviceMonitor");
|
||||
engine.startService("libraryManager");
|
||||
engine.startService("pipeline");
|
||||
engine.startService("deployment", {onlyCompile: true});
|
||||
|
@ -300,6 +294,7 @@ class Embark {
|
|||
|
||||
function startServices(callback) {
|
||||
|
||||
engine.startService("serviceMonitor");
|
||||
engine.startService("libraryManager");
|
||||
engine.startService("codeRunner");
|
||||
engine.startService("web3");
|
||||
|
@ -307,7 +302,6 @@ class Embark {
|
|||
engine.startService("deployment");
|
||||
engine.startService("storage");
|
||||
engine.startService("codeGenerator");
|
||||
engine.startMonitor();
|
||||
callback();
|
||||
},
|
||||
function setupStoragePlugin(callback){
|
||||
|
|
|
@ -10,11 +10,10 @@ class IPFS {
|
|||
this.logger = embark.logger;
|
||||
this.events = embark.events;
|
||||
this.buildDir = options.buildDir;
|
||||
this.storageConfig = options.storageConfig;
|
||||
this.storageConfig = embark.config.storageConfig;
|
||||
this.host = options.host || this.storageConfig.upload.host;
|
||||
this.port = options.port || this.storageConfig.upload.port;
|
||||
this.protocol = options.protocol || this.storageConfig.upload.protocol;
|
||||
this.addCheck = options.addCheck;
|
||||
this.embark = embark;
|
||||
}
|
||||
|
||||
|
@ -48,11 +47,7 @@ class IPFS {
|
|||
self.logger.info(__('IPFS node is offline') + '..');
|
||||
});
|
||||
|
||||
if (!self.addCheck) {
|
||||
return;
|
||||
}
|
||||
|
||||
self.addCheck('IPFS', function (cb) {
|
||||
self.events.request("services:register", 'IPFS', function (cb) {
|
||||
self.logger.trace("Checking IPFS version...");
|
||||
let url = (self.protocol || 'http') + '://' + self.host + ':' + self.port + '/api/v0/version';
|
||||
if(self.protocol !== 'https'){
|
||||
|
|
|
@ -7,7 +7,6 @@ class SpecialConfigs {
|
|||
this.logger = embark.logger;
|
||||
this.events = embark.events;
|
||||
this.buildDir = options.buildDir;
|
||||
this.addCheck = options.addCheck;
|
||||
this.embark = embark;
|
||||
this.contractsConfig = embark.config.contractsConfig;
|
||||
|
||||
|
|
|
@ -155,13 +155,9 @@ class Storage {
|
|||
this._embark.addProviderInit('storage', code, shouldInit);
|
||||
}
|
||||
|
||||
startStorageProcesses(){
|
||||
let platform = this._storageConfig.upload.provider;
|
||||
let self = this;
|
||||
|
||||
async.waterfall([
|
||||
function checkStorageService(callback){
|
||||
const errorObj = {message: __('Cannot upload: {{platform}} node is not running on {{url}}.', {platform: platform, url: utils.buildUrlFromConfig(self._storageConfig.upload)})};
|
||||
checkStorageService(platform, url, callback) {
|
||||
const self = this;
|
||||
const errorObj = {message: __('Cannot upload: {{platform}} node is not running on {{url}}.', {platform: platform, url: url})};
|
||||
|
||||
// start the upload storage node
|
||||
self._checkStorageEndpoint(platform, function (err) {
|
||||
|
@ -182,32 +178,22 @@ class Storage {
|
|||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
startStorageProcesses(){
|
||||
let platform = this._storageConfig.upload.provider;
|
||||
let self = this;
|
||||
|
||||
async.waterfall([
|
||||
function _checkStorageService(callback){
|
||||
self.checkStorageService(platform, utils.buildUrlFromConfig(self._storageConfig.upload), callback);
|
||||
},
|
||||
function checkDappConnectionStorageService(callback){
|
||||
// start any dappConnection storage nodes
|
||||
self._validDappProviders.forEach(dappConn => {
|
||||
if(!dappConn.provider || dappConn.provider === platform) return; // don't start the process we've just started above
|
||||
|
||||
const errorObj = {message: __('Cannot start {{platform}} node on {{url}}.', {platform: dappConn.provider, url: utils.buildUrlFromConfig(dappConn)})};
|
||||
|
||||
self._checkStorageEndpoint(dappConn.provider, function (err) {
|
||||
if (!err) {
|
||||
return callback();
|
||||
}
|
||||
self._startStorageNode(dappConn.provider, (err) => {
|
||||
if (err) {
|
||||
self._logger.error(err);
|
||||
return callback(errorObj);
|
||||
}
|
||||
// Check endpoint again to see if really did start
|
||||
self._checkStorageEndpoint(dappConn.provider, (err) => {
|
||||
if (err) {
|
||||
return callback(errorObj);
|
||||
}
|
||||
callback();
|
||||
});
|
||||
});
|
||||
});
|
||||
self.checkStorageService(dappConn.provider, utils.buildUrlFromConfig(dappConn), callback);
|
||||
});
|
||||
}
|
||||
]);
|
||||
|
|
|
@ -10,8 +10,9 @@ class Swarm {
|
|||
this.logger = embark.logger;
|
||||
this.events = embark.events;
|
||||
this.buildDir = options.buildDir;
|
||||
this.storageConfig = options.storageConfig;
|
||||
this.addCheck = options.addCheck;
|
||||
this.storageConfig = embark.config.storageConfig;
|
||||
this.host = options.host || this.storageConfig.host;
|
||||
this.port = options.port || this.storageConfig.port;
|
||||
this.embark = embark;
|
||||
|
||||
this.providerUrl = utils.buildUrl(options.protocol || options.storageConfig.upload.protocol, options.host || options.storageConfig.upload.host, options.port || options.storageConfig.upload.port);
|
||||
|
@ -32,7 +33,6 @@ class Swarm {
|
|||
this.embark.registerUploadCommand('swarm', this.upload_swarm.deploy.bind(this.upload_swarm));
|
||||
}
|
||||
|
||||
|
||||
setServiceCheck() {
|
||||
let self = this;
|
||||
|
||||
|
@ -53,12 +53,7 @@ class Swarm {
|
|||
self.logger.info(__('Swarm node is offline...'));
|
||||
});
|
||||
|
||||
if (!this.addCheck) {
|
||||
return;
|
||||
}
|
||||
|
||||
// add check for console
|
||||
this.addCheck('Swarm', function(cb){
|
||||
self.events.request("services:register", 'Swarm', function(cb){
|
||||
self.logger.trace("Checking Swarm availability...");
|
||||
self.bzz.isAvailable().then(result => {
|
||||
return cb({name: "Swarm ", status: result ? 'on':'off'});
|
||||
|
|
|
@ -7,7 +7,6 @@ class WebServer {
|
|||
this.embark = embark;
|
||||
this.logger = embark.logger;
|
||||
this.events = embark.events;
|
||||
this.addCheck = options.addCheck;
|
||||
this.webServerConfig = embark.config.webServerConfig;
|
||||
if (!this.webServerConfig.enabled) {
|
||||
return;
|
||||
|
@ -29,8 +28,7 @@ class WebServer {
|
|||
setServiceCheck() {
|
||||
let url = 'http://' + this.host + ':' + this.port;
|
||||
|
||||
//embark.registerServiceCheck('WebserverService', function (cb) {
|
||||
this.addCheck('Webserver', function (cb) {
|
||||
this.events.request("services:register", 'Webserver', function (cb) {
|
||||
utils.checkIsAvailable(url, function (available) {
|
||||
let devServer = __('Webserver') + ' (' + url + ')';
|
||||
let serverStatus = (available ? 'on' : 'off');
|
||||
|
|
|
@ -4,11 +4,10 @@ let Web3 = require('web3');
|
|||
|
||||
class Whisper {
|
||||
|
||||
constructor(embark, options) {
|
||||
constructor(embark, _options) {
|
||||
this.logger = embark.logger;
|
||||
this.events = embark.events;
|
||||
this.communicationConfig = embark.config.communicationConfig;
|
||||
this.addCheck = options.addCheck;
|
||||
this.web3 = new Web3();
|
||||
this.embark = embark;
|
||||
|
||||
|
@ -26,7 +25,7 @@ class Whisper {
|
|||
|
||||
setServiceCheck() {
|
||||
const self = this;
|
||||
self.addCheck('Whisper', function (cb) {
|
||||
self.events.request("services:register", 'Whisper', function (cb) {
|
||||
if (!self.web3.currentProvider || self.web3.currentProvider.connection.readyState !== 1) {
|
||||
return self.connectToProvider();
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
"dom-helpers": {
|
||||
"version": "3.3.1",
|
||||
"resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-3.3.1.tgz",
|
||||
"integrity": "sha1-/BpOFf/fYN3eA6SAqcD+zoId1KY="
|
||||
"integrity": "sha512-2Sm+JaYn74OiTM2wHvxJOo3roiq/h25Yi69Fqk269cNUwIXsCvATB6CRSFC9Am/20G2b28hGv/+7NiWydIrPvg=="
|
||||
},
|
||||
"dotenv": {
|
||||
"version": "4.0.0",
|
||||
|
@ -229,7 +229,7 @@
|
|||
"node-fetch": {
|
||||
"version": "1.7.3",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz",
|
||||
"integrity": "sha1-mA9vcthSEaU0fGsrwYxbhMPrR+8=",
|
||||
"integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==",
|
||||
"requires": {
|
||||
"encoding": "0.1.12",
|
||||
"is-stream": "1.1.0"
|
||||
|
@ -252,7 +252,7 @@
|
|||
"promise": {
|
||||
"version": "7.3.1",
|
||||
"resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz",
|
||||
"integrity": "sha1-BktyYCsY+Q8pGSuLG8QY/9Hr078=",
|
||||
"integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==",
|
||||
"requires": {
|
||||
"asap": "2.0.6"
|
||||
}
|
||||
|
@ -289,7 +289,7 @@
|
|||
"react-bootstrap": {
|
||||
"version": "0.32.1",
|
||||
"resolved": "https://registry.npmjs.org/react-bootstrap/-/react-bootstrap-0.32.1.tgz",
|
||||
"integrity": "sha1-YGJMG0ijnXc+9szmQhpPM+zBZrs=",
|
||||
"integrity": "sha512-RbfzKUbsukWsToWqGHfCCyMFq9QQI0TznutdyxyJw6dih2NvIne25Mrssg8LZsprqtPpyQi8bN0L0Fx3fUsL8Q==",
|
||||
"requires": {
|
||||
"babel-runtime": "6.26.0",
|
||||
"classnames": "2.2.5",
|
||||
|
@ -319,7 +319,7 @@
|
|||
"react-overlays": {
|
||||
"version": "0.8.3",
|
||||
"resolved": "https://registry.npmjs.org/react-overlays/-/react-overlays-0.8.3.tgz",
|
||||
"integrity": "sha1-+tZe6lskMBzKGSoWn13dsLINOsU=",
|
||||
"integrity": "sha512-h6GT3jgy90PgctleP39Yu3eK1v9vaJAW73GOA/UbN9dJ7aAN4BTZD6793eI1D5U+ukMk17qiqN/wl3diK1Z5LA==",
|
||||
"requires": {
|
||||
"classnames": "2.2.5",
|
||||
"dom-helpers": "3.3.1",
|
||||
|
@ -353,7 +353,7 @@
|
|||
"regenerator-runtime": {
|
||||
"version": "0.11.1",
|
||||
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz",
|
||||
"integrity": "sha1-vgWtf5v30i4Fb5cmzuUBf78Z4uk="
|
||||
"integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg=="
|
||||
},
|
||||
"setimmediate": {
|
||||
"version": "1.0.5",
|
||||
|
@ -412,7 +412,7 @@
|
|||
"zeppelin-solidity": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/zeppelin-solidity/-/zeppelin-solidity-1.8.0.tgz",
|
||||
"integrity": "sha1-BJ/N59rqn8hSEPjG25+M0auKhTo=",
|
||||
"integrity": "sha512-7Mxq6Y7EES0PSLrRF6v0EVYqBVRRo8hFrr7m3jEs69VbbQ5kpANzizeEdbP1/PWKSOmBOg208qP2vSA0FlzFLA==",
|
||||
"requires": {
|
||||
"dotenv": "4.0.0",
|
||||
"ethjs-abi": "0.2.1"
|
||||
|
|
Loading…
Reference in New Issue