aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib
diff options
context:
space:
mode:
authorFrankie <frankie.diamond@gmail.com>2017-05-24 08:36:11 +0800
committerGitHub <noreply@github.com>2017-05-24 08:36:11 +0800
commit97ea7454b353acb8f87dac087eeae61f945325d7 (patch)
treeb1ed4d382b3008fe3271b0c10a8f6dab41b6ee9f /app/scripts/lib
parentc1239608a62a4283d138b1a6586653ac791eb655 (diff)
parent9c316664de2eb82bdd10ab9cd6fa0a33f5185e20 (diff)
downloadtangerine-wallet-browser-97ea7454b353acb8f87dac087eeae61f945325d7.tar
tangerine-wallet-browser-97ea7454b353acb8f87dac087eeae61f945325d7.tar.gz
tangerine-wallet-browser-97ea7454b353acb8f87dac087eeae61f945325d7.tar.bz2
tangerine-wallet-browser-97ea7454b353acb8f87dac087eeae61f945325d7.tar.lz
tangerine-wallet-browser-97ea7454b353acb8f87dac087eeae61f945325d7.tar.xz
tangerine-wallet-browser-97ea7454b353acb8f87dac087eeae61f945325d7.tar.zst
tangerine-wallet-browser-97ea7454b353acb8f87dac087eeae61f945325d7.zip
Merge branch 'master' into networkController
Diffstat (limited to 'app/scripts/lib')
-rw-r--r--app/scripts/lib/inpage-provider.js22
1 files changed, 17 insertions, 5 deletions
diff --git a/app/scripts/lib/inpage-provider.js b/app/scripts/lib/inpage-provider.js
index e5e398e24..e54f547bd 100644
--- a/app/scripts/lib/inpage-provider.js
+++ b/app/scripts/lib/inpage-provider.js
@@ -1,5 +1,7 @@
const pipe = require('pump')
-const StreamProvider = require('web3-stream-provider')
+const ProviderEngine = require('web3-provider-engine')
+const FilterSubprovider = require('web3-provider-engine/subproviders/filters')
+const StreamSubprovider = require('web3-provider-engine/subproviders/stream')
const LocalStorageStore = require('obs-store')
const ObjectMultiplex = require('./obj-multiplex')
const createRandomId = require('./random-id')
@@ -27,14 +29,24 @@ function MetamaskInpageProvider (connectionStream) {
)
// connect to async provider
- const asyncProvider = self.asyncProvider = new StreamProvider()
+ const engine = new ProviderEngine()
+
+ const filterSubprovider = new FilterSubprovider()
+ engine.addProvider(filterSubprovider)
+
+ const streamSubprovider = new StreamSubprovider()
+ engine.addProvider(streamSubprovider)
+
pipe(
- asyncProvider,
+ streamSubprovider,
multiStream.createStream('provider'),
- asyncProvider,
+ streamSubprovider,
(err) => logStreamDisconnectWarning('MetaMask RpcProvider', err)
)
+ // start polling
+ engine.start()
+
self.idMap = {}
// handle sendAsync requests via asyncProvider
self.sendAsync = function (payload, cb) {
@@ -46,7 +58,7 @@ function MetamaskInpageProvider (connectionStream) {
return message
})
// forward to asyncProvider
- asyncProvider.sendAsync(request, function (err, res) {
+ engine.sendAsync(request, function (err, res) {
if (err) return cb(err)
// transform messages to original ids
eachJsonMessage(res, (message) => {