diff options
author | Bruno Barbieri <bruno.barbieri@consensys.net> | 2018-10-10 01:25:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-10 01:25:13 +0800 |
commit | 17b9f4c0dbfc5257c83a454f669e410856fedb9c (patch) | |
tree | 8519546920c1dd6caefab426d68ae5c2e9182193 /app/scripts/controllers | |
parent | cd91b45686864c5d38fc95e3a561ca66b36ade7c (diff) | |
parent | 45feb43f306f4b21ef007e0c8897cda384c28fc5 (diff) | |
download | tangerine-wallet-browser-17b9f4c0dbfc5257c83a454f669e410856fedb9c.tar tangerine-wallet-browser-17b9f4c0dbfc5257c83a454f669e410856fedb9c.tar.gz tangerine-wallet-browser-17b9f4c0dbfc5257c83a454f669e410856fedb9c.tar.bz2 tangerine-wallet-browser-17b9f4c0dbfc5257c83a454f669e410856fedb9c.tar.lz tangerine-wallet-browser-17b9f4c0dbfc5257c83a454f669e410856fedb9c.tar.xz tangerine-wallet-browser-17b9f4c0dbfc5257c83a454f669e410856fedb9c.tar.zst tangerine-wallet-browser-17b9f4c0dbfc5257c83a454f669e410856fedb9c.zip |
Merge pull request #5458 from MetaMask/provider-subs
Feature: Subscription support
Diffstat (limited to 'app/scripts/controllers')
-rw-r--r-- | app/scripts/controllers/network/createInfuraClient.js | 10 | ||||
-rw-r--r-- | app/scripts/controllers/network/createJsonRpcClient.js | 4 | ||||
-rw-r--r-- | app/scripts/controllers/network/createLocalhostClient.js | 4 |
3 files changed, 10 insertions, 8 deletions
diff --git a/app/scripts/controllers/network/createInfuraClient.js b/app/scripts/controllers/network/createInfuraClient.js index 41af4d9f9..326bcb355 100644 --- a/app/scripts/controllers/network/createInfuraClient.js +++ b/app/scripts/controllers/network/createInfuraClient.js @@ -1,5 +1,6 @@ const mergeMiddleware = require('json-rpc-engine/src/mergeMiddleware') -const createBlockReEmitMiddleware = require('eth-json-rpc-middleware/block-reemit') +const createBlockReRefMiddleware = require('eth-json-rpc-middleware/block-ref') +const createRetryOnEmptyMiddleware = require('eth-json-rpc-middleware/retryOnEmpty') const createBlockCacheMiddleware = require('eth-json-rpc-middleware/block-cache') const createInflightMiddleware = require('eth-json-rpc-middleware/inflight-cache') const createBlockTrackerInspectorMiddleware = require('eth-json-rpc-middleware/block-tracker-inspector') @@ -11,13 +12,14 @@ module.exports = createInfuraClient function createInfuraClient ({ network }) { const infuraMiddleware = createInfuraMiddleware({ network }) - const blockProvider = providerFromMiddleware(infuraMiddleware) - const blockTracker = new BlockTracker({ provider: blockProvider }) + const infuraProvider = providerFromMiddleware(infuraMiddleware) + const blockTracker = new BlockTracker({ provider: infuraProvider }) const networkMiddleware = mergeMiddleware([ createBlockCacheMiddleware({ blockTracker }), createInflightMiddleware(), - createBlockReEmitMiddleware({ blockTracker, provider: blockProvider }), + createBlockReRefMiddleware({ blockTracker, provider: infuraProvider }), + createRetryOnEmptyMiddleware({ blockTracker, provider: infuraProvider }), createBlockTrackerInspectorMiddleware({ blockTracker }), infuraMiddleware, ]) diff --git a/app/scripts/controllers/network/createJsonRpcClient.js b/app/scripts/controllers/network/createJsonRpcClient.js index 40c353f7f..a8cbf2aaf 100644 --- a/app/scripts/controllers/network/createJsonRpcClient.js +++ b/app/scripts/controllers/network/createJsonRpcClient.js @@ -1,6 +1,6 @@ const mergeMiddleware = require('json-rpc-engine/src/mergeMiddleware') const createFetchMiddleware = require('eth-json-rpc-middleware/fetch') -const createBlockRefMiddleware = require('eth-json-rpc-middleware/block-ref') +const createBlockRefRewriteMiddleware = require('eth-json-rpc-middleware/block-ref-rewrite') const createBlockCacheMiddleware = require('eth-json-rpc-middleware/block-cache') const createInflightMiddleware = require('eth-json-rpc-middleware/inflight-cache') const createBlockTrackerInspectorMiddleware = require('eth-json-rpc-middleware/block-tracker-inspector') @@ -15,7 +15,7 @@ function createJsonRpcClient ({ rpcUrl }) { const blockTracker = new BlockTracker({ provider: blockProvider }) const networkMiddleware = mergeMiddleware([ - createBlockRefMiddleware({ blockTracker }), + createBlockRefRewriteMiddleware({ blockTracker }), createBlockCacheMiddleware({ blockTracker }), createInflightMiddleware(), createBlockTrackerInspectorMiddleware({ blockTracker }), diff --git a/app/scripts/controllers/network/createLocalhostClient.js b/app/scripts/controllers/network/createLocalhostClient.js index fecc512e8..09b1d3c1c 100644 --- a/app/scripts/controllers/network/createLocalhostClient.js +++ b/app/scripts/controllers/network/createLocalhostClient.js @@ -1,6 +1,6 @@ const mergeMiddleware = require('json-rpc-engine/src/mergeMiddleware') const createFetchMiddleware = require('eth-json-rpc-middleware/fetch') -const createBlockRefMiddleware = require('eth-json-rpc-middleware/block-ref') +const createBlockRefRewriteMiddleware = require('eth-json-rpc-middleware/block-ref-rewrite') const createBlockTrackerInspectorMiddleware = require('eth-json-rpc-middleware/block-tracker-inspector') const providerFromMiddleware = require('eth-json-rpc-middleware/providerFromMiddleware') const BlockTracker = require('eth-block-tracker') @@ -13,7 +13,7 @@ function createLocalhostClient () { const blockTracker = new BlockTracker({ provider: blockProvider, pollingInterval: 1000 }) const networkMiddleware = mergeMiddleware([ - createBlockRefMiddleware({ blockTracker }), + createBlockRefRewriteMiddleware({ blockTracker }), createBlockTrackerInspectorMiddleware({ blockTracker }), fetchMiddleware, ]) |