mirror of https://github.com/embarklabs/embark.git
move blockchain connection code to its own module
This commit is contained in:
parent
5fb4a3c8a6
commit
176f6dc84b
|
@ -251,16 +251,10 @@ class Engine {
|
|||
isDev: this.isDev
|
||||
});
|
||||
|
||||
const Blockchain = require('../contracts/blockchain.js');
|
||||
(new Blockchain({
|
||||
contractsConfig: this.config.contractsConfig,
|
||||
blockchainConfig: this.config.blockchainConfig,
|
||||
events: this.events,
|
||||
logger: this.logger,
|
||||
this.registerModule('blockchain_connector', {
|
||||
isDev: this.isDev,
|
||||
locale: this.locale,
|
||||
web3: options.web3
|
||||
})); /*eslint no-new: "off"*/
|
||||
});
|
||||
|
||||
this.registerModule('whisper');
|
||||
}
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
const Web3 = require('web3');
|
||||
const async = require('async');
|
||||
const Provider = require('./provider.js');
|
||||
const utils = require('../utils/utils');
|
||||
const utils = require('../../utils/utils');
|
||||
|
||||
const WEB3_READY = 'web3Ready';
|
||||
|
||||
// TODO: consider another name, this is the blockchain connector
|
||||
class BlockchainConnector {
|
||||
constructor(options) {
|
||||
constructor(embark, options) {
|
||||
const self = this;
|
||||
this.plugins = options.plugins;
|
||||
this.logger = options.logger;
|
||||
this.events = options.events;
|
||||
this.contractsConfig = options.contractsConfig;
|
||||
this.blockchainConfig = options.blockchainConfig;
|
||||
this.logger = embark.logger;
|
||||
this.events = embark.events;
|
||||
this.contractsConfig = embark.config.contractsConfig;
|
||||
this.blockchainConfig = embark.config.blockchainConfig;
|
||||
this.web3 = options.web3;
|
||||
this.isDev = options.isDev;
|
||||
this.web3Endpoint = '';
|
|
@ -1,5 +1,5 @@
|
|||
const async = require('async');
|
||||
const AccountParser = require('../utils/accountParser');
|
||||
const AccountParser = require('../../utils/accountParser');
|
||||
const fundAccount = require('./fundAccount');
|
||||
|
||||
class Provider {
|
|
@ -6,7 +6,8 @@ const constants = require('../constants');
|
|||
const Events = require('../core/events');
|
||||
const cloneDeep = require('clone-deep');
|
||||
const AccountParser = require('../utils/accountParser');
|
||||
const Provider = require('../contracts/provider');
|
||||
// TODO: breaks module isolation; tests need to be refactored to use the engine and avoid this
|
||||
const Provider = require('../modules/blockchain_connector/provider.js');
|
||||
const utils = require('../utils/utils');
|
||||
|
||||
const EmbarkJS = require('embarkjs');
|
||||
|
|
Loading…
Reference in New Issue