aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-09-08 12:26:25 +0800
committerkumavis <aaron@kumavis.me>2017-09-08 12:26:25 +0800
commit9d4c02e57f2b147759d979d8a6c051aa008cdff0 (patch)
tree2fdc1b9455ab34cd1718e428a1b2a83573b9b1c2
parent0e8e655fdb9b65df151f23ede74807025226ab66 (diff)
downloadtangerine-wallet-browser-9d4c02e57f2b147759d979d8a6c051aa008cdff0.tar
tangerine-wallet-browser-9d4c02e57f2b147759d979d8a6c051aa008cdff0.tar.gz
tangerine-wallet-browser-9d4c02e57f2b147759d979d8a6c051aa008cdff0.tar.bz2
tangerine-wallet-browser-9d4c02e57f2b147759d979d8a6c051aa008cdff0.tar.lz
tangerine-wallet-browser-9d4c02e57f2b147759d979d8a6c051aa008cdff0.tar.xz
tangerine-wallet-browser-9d4c02e57f2b147759d979d8a6c051aa008cdff0.tar.zst
tangerine-wallet-browser-9d4c02e57f2b147759d979d8a6c051aa008cdff0.zip
metamask - add jsonrpc filter middleware on per-connection engine
-rw-r--r--app/scripts/metamask-controller.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 1a6732338..735fc4af0 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -8,6 +8,7 @@ const EthStore = require('./lib/eth-store')
const EthQuery = require('eth-query')
const RpcEngine = require('json-rpc-engine')
const createEngineStream = require('json-rpc-middleware-stream/engineStream')
+const createFilterMiddleware = require('eth-json-rpc-filters')
const setupMultiplex = require('./lib/stream-utils.js').setupMultiplex
const KeyringController = require('./keyring-controller')
const NetworkController = require('./controllers/network')
@@ -78,12 +79,13 @@ module.exports = class MetamaskController extends EventEmitter {
// rpc provider
this.provider = this.initializeProvider()
+ this.blockTracker = this.provider
// eth data query tools
this.ethQuery = new EthQuery(this.provider)
this.ethStore = new EthStore({
provider: this.provider,
- blockTracker: this.provider,
+ blockTracker: this.blockTracker,
})
// key mgmt
@@ -110,7 +112,7 @@ module.exports = class MetamaskController extends EventEmitter {
getNetwork: this.networkController.getNetworkState.bind(this),
signTransaction: this.keyringController.signTransaction.bind(this.keyringController),
provider: this.provider,
- blockTracker: this.provider,
+ blockTracker: this.blockTracker,
ethQuery: this.ethQuery,
ethStore: this.ethStore,
})
@@ -387,6 +389,10 @@ module.exports = class MetamaskController extends EventEmitter {
const engine = new RpcEngine()
engine.push(originMiddleware)
engine.push(loggerMiddleware)
+ engine.push(createFilterMiddleware({
+ provider: this.provider,
+ blockTracker: this.blockTracker,
+ }))
engine.push(createProviderMiddleware({ provider: this.provider }))
// setup connection