wip fixes
This commit is contained in:
parent
8c6e6112c4
commit
15ba457f60
|
@ -1,6 +1,12 @@
|
|||
const ProviderEngine = require('embark-web3-provider-engine');
|
||||
const RpcSubprovider = require('embark-web3-provider-engine/subproviders/rpc');
|
||||
const WsSubprovider = require('embark-web3-provider-engine/subproviders/websocket');
|
||||
const CacheSubprovider = require('embark-web3-provider-engine/subproviders/cache.js');
|
||||
const FixtureSubprovider = require('embark-web3-provider-engine/subproviders/fixture.js');
|
||||
const FilterSubprovider = require('embark-web3-provider-engine/subproviders/filters.js');
|
||||
const VmSubprovider = require('embark-web3-provider-engine/subproviders/vm.js');
|
||||
const NonceSubprovider = require('embark-web3-provider-engine/subproviders/nonce-tracker.js');
|
||||
const SubscriptionSubprovider = require('embark-web3-provider-engine/subproviders/subscriptions');
|
||||
const async = require('async');
|
||||
const AccountParser = require('./accountParser');
|
||||
const fundAccount = require('./fundAccount');
|
||||
|
@ -23,12 +29,20 @@ class Provider {
|
|||
startWeb3Provider(callback) {
|
||||
const self = this;
|
||||
|
||||
// cache layer
|
||||
// self.addProvider(new CacheSubprovider())
|
||||
|
||||
// self.addProvider(new NonceSubprovider())
|
||||
|
||||
if (this.type === 'rpc') {
|
||||
self.engine.addProvider(new RpcSubprovider({
|
||||
rpcUrl: self.web3Endpoint
|
||||
}));
|
||||
} else if (this.type === 'ws') {
|
||||
self.engine.addProvider(new WsSubprovider({
|
||||
//self.engine.addProvider(new WsSubprovider({
|
||||
console.log('USing ws');
|
||||
self.addProvider(new SubscriptionSubprovider());
|
||||
self.addProvider(new WsSubprovider({
|
||||
rpcUrl: self.web3Endpoint,
|
||||
origin: this.blockchainConfig.wsOrigins.split(',')[0]
|
||||
}));
|
||||
|
@ -37,6 +51,7 @@ class Provider {
|
|||
}
|
||||
|
||||
|
||||
|
||||
// network connectivity error
|
||||
self.engine.on('error', (err) => {
|
||||
// report connectivity errors
|
||||
|
@ -44,7 +59,18 @@ class Provider {
|
|||
});
|
||||
|
||||
self.engine.start();
|
||||
self.web3.setProvider(self);
|
||||
//self.on('error', (err) => {
|
||||
// console.log('ERR', JSON.stringify(err));
|
||||
// // report connectivity errors as trace due to polling
|
||||
// self.logger.trace('web3 provider error: ', err);
|
||||
// self.logger.trace('stopping web3 provider due to error');
|
||||
|
||||
// // prevent continuous polling errors
|
||||
// self.stop();
|
||||
//});
|
||||
|
||||
//self.web3.setProvider(self);
|
||||
//self.start();
|
||||
|
||||
self.accounts = AccountParser.parseAccountsConfig(self.accountsConfig, self.web3, self.logger);
|
||||
self.addresses = [];
|
||||
|
|
|
@ -46,12 +46,13 @@ var Blockchain = function(options) {
|
|||
whisper: (this.blockchainConfig.whisper === undefined) || this.blockchainConfig.whisper,
|
||||
maxpeers: ((this.blockchainConfig.maxpeers === 0) ? 0 : (this.blockchainConfig.maxpeers || 25)),
|
||||
bootnodes: this.blockchainConfig.bootnodes || "",
|
||||
rpcApi: (this.blockchainConfig.rpcApi || ['eth', 'web3', 'net', 'debug']),
|
||||
rpcApi: (this.blockchainConfig.rpcApi || ['eth', 'web3', 'net', 'debug', 'pubsub']),
|
||||
wsRPC: (this.blockchainConfig.wsRPC === undefined) || this.blockchainConfig.wsRPC,
|
||||
wsHost: dockerHostSwap(this.blockchainConfig.wsHost) || defaultHost,
|
||||
wsPort: this.blockchainConfig.wsPort || 8546,
|
||||
wsOrigins: this.blockchainConfig.wsOrigins || false,
|
||||
wsApi: (this.blockchainConfig.wsApi || defaultWsApi),
|
||||
// wsApi: (this.blockchainConfig.wsApi || ['eth', 'web3', 'net', 'shh', 'debug']),
|
||||
vmdebug: this.blockchainConfig.vmdebug || false,
|
||||
targetGasLimit: this.blockchainConfig.targetGasLimit || false,
|
||||
syncMode: this.blockchainConfig.syncMode,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
|
||||
"default": {
|
||||
"enabled": true,
|
||||
"rpcHost": "localhost",
|
||||
|
|
|
@ -4,6 +4,11 @@ let accounts;
|
|||
const Utils = require('embarkjs').Utils;
|
||||
|
||||
config({
|
||||
deployment: {
|
||||
type: 'ws',
|
||||
host: 'localhost',
|
||||
port: '8546'
|
||||
},
|
||||
contracts: {
|
||||
"SimpleStorage": {
|
||||
args: [100],
|
||||
|
|
Loading…
Reference in New Issue