mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-12 14:54:57 +00:00
81e798c89c
Addons - New chain initialization and genesis management - Option to choose client to use - Option to "ping forever" for Geth - Creation and unlock of accounts at client's start - Utility to fund accounts with ethers - Miner settings inside the ethereum client - Workaround to CORS problem: origin is now http://embark - Several double callback's checks Updates - Boilerplate, templates, configuration files and demo stuff - Messages and i18n strings - Tests Fixes - Geth client now uses miner.gastarget instead of the deprecated targetGasLimit - Workaround for shh_version with Parity Reworks of other PRs into the new code - Included delayed proxy - Send ready only when the proxy is started - Start HTTP and WS proxies individually - Async setupProxy - Fixed datadir for GethMiner
53 lines
1.4 KiB
JavaScript
53 lines
1.4 KiB
JavaScript
const ProcessWrapper = require('../../core/processes/processWrapper');
|
|
const BlockchainClient = require('./blockchain');
|
|
const i18n = require('../../core/i18n/i18n.js');
|
|
const constants = require('../../constants');
|
|
|
|
let blockchainProcess;
|
|
|
|
class BlockchainProcess extends ProcessWrapper {
|
|
constructor(options) {
|
|
super();
|
|
this.blockchainConfig = options.blockchainConfig;
|
|
this.client = options.client;
|
|
this.env = options.env;
|
|
this.isDev = options.isDev;
|
|
|
|
i18n.setOrDetectLocale(options.locale);
|
|
|
|
this.blockchainConfig.silent = true;
|
|
this.blockchain = BlockchainClient(
|
|
this.blockchainConfig,
|
|
this.client,
|
|
this.env,
|
|
this.blockchainReady.bind(this),
|
|
this.blockchainExit.bind(this)
|
|
);
|
|
|
|
this.blockchain.run();
|
|
}
|
|
|
|
blockchainReady() {
|
|
blockchainProcess.send({result: constants.blockchain.blockchainReady});
|
|
}
|
|
|
|
blockchainExit() {
|
|
// tell our parent process that ethereum client has exited
|
|
blockchainProcess.send({result: constants.blockchain.blockchainExit});
|
|
}
|
|
|
|
kill() {
|
|
this.blockchain.kill();
|
|
}
|
|
}
|
|
|
|
process.on('message', (msg) => {
|
|
if (msg === 'exit') {
|
|
return blockchainProcess.kill();
|
|
}
|
|
if (msg.action === constants.blockchain.init) {
|
|
blockchainProcess = new BlockchainProcess(msg.options);
|
|
return blockchainProcess.send({result: constants.blockchain.initiated});
|
|
}
|
|
});
|