diff options
author | kumavis <aaron@kumavis.me> | 2018-01-09 06:57:57 +0800 |
---|---|---|
committer | kumavis <aaron@kumavis.me> | 2018-01-09 06:57:57 +0800 |
commit | ab7701efb35f39e73fcccc2110a754384e23d695 (patch) | |
tree | 7de60dc666d339c2ba058e7ddcd7bc099f4d43cc /app/scripts/controllers | |
parent | 63ae7fb589b43d2af87f31d51f5b5f96669dabe0 (diff) | |
download | tangerine-wallet-browser-ab7701efb35f39e73fcccc2110a754384e23d695.tar.gz tangerine-wallet-browser-ab7701efb35f39e73fcccc2110a754384e23d695.tar.zst tangerine-wallet-browser-ab7701efb35f39e73fcccc2110a754384e23d695.zip |
provider - infura - use infura REST api
Diffstat (limited to 'app/scripts/controllers')
-rw-r--r-- | app/scripts/controllers/network.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/scripts/controllers/network.js b/app/scripts/controllers/network.js index 377ba6eca..a1db8946a 100644 --- a/app/scripts/controllers/network.js +++ b/app/scripts/controllers/network.js @@ -1,6 +1,7 @@ const assert = require('assert') const EventEmitter = require('events') const createMetamaskProvider = require('web3-provider-engine/zero.js') +const SubproviderFromProvider = require('web3-provider-engine/subproviders/web3.js') const createInfuraProvider = require('eth-json-rpc-infura/src/createProvider') const ObservableStore = require('obs-store') const ComposedStore = require('obs-store/lib/composed') @@ -133,15 +134,17 @@ module.exports = class NetworkController extends EventEmitter { _configureInfuraProvider (opts) { log.info('_configureInfuraProvider', opts) - const blockTrackerProvider = createInfuraProvider({ + const infuraProvider = createInfuraProvider({ network: opts.type, }) + const infuraSubprovider = new SubproviderFromProvider(infuraProvider) const providerParams = extend(this._baseProviderParams, { rpcUrl: opts.rpcUrl, engineParams: { pollingInterval: 8000, - blockTrackerProvider, + blockTrackerProvider: infuraProvider, }, + dataSubprovider: infuraSubprovider, }) const provider = createMetamaskProvider(providerParams) this._setProvider(provider) |