aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2019-04-05 11:13:51 +0800
committerGitHub <noreply@github.com>2019-04-05 11:13:51 +0800
commitd610dfa8701869463a28ed4cc1e3085dadb7827c (patch)
tree0fa9b56779f8a029ea343e9c6e0f7e0abfde0b3b /app/scripts
parent98a2fb43fb371584d3cd6730958f0f3d17fc0d12 (diff)
parent89693a23151d4ff37295f14b04d7c64297d842c5 (diff)
downloadtangerine-wallet-browser-d610dfa8701869463a28ed4cc1e3085dadb7827c.tar
tangerine-wallet-browser-d610dfa8701869463a28ed4cc1e3085dadb7827c.tar.gz
tangerine-wallet-browser-d610dfa8701869463a28ed4cc1e3085dadb7827c.tar.bz2
tangerine-wallet-browser-d610dfa8701869463a28ed4cc1e3085dadb7827c.tar.lz
tangerine-wallet-browser-d610dfa8701869463a28ed4cc1e3085dadb7827c.tar.xz
tangerine-wallet-browser-d610dfa8701869463a28ed4cc1e3085dadb7827c.tar.zst
tangerine-wallet-browser-d610dfa8701869463a28ed4cc1e3085dadb7827c.zip
Merge pull request #6401 from MetaMask/provider-error-fix
metamask-controller - use improved provider-as-middleware utility
Diffstat (limited to 'app/scripts')
-rw-r--r--app/scripts/lib/createProviderMiddleware.js16
-rw-r--r--app/scripts/metamask-controller.js4
2 files changed, 2 insertions, 18 deletions
diff --git a/app/scripts/lib/createProviderMiddleware.js b/app/scripts/lib/createProviderMiddleware.js
deleted file mode 100644
index 8a939ba4e..000000000
--- a/app/scripts/lib/createProviderMiddleware.js
+++ /dev/null
@@ -1,16 +0,0 @@
-module.exports = createProviderMiddleware
-
-/**
- * Forwards an HTTP request to the current Web3 provider
- *
- * @param {{ provider: Object }} config Configuration containing current Web3 provider
- */
-function createProviderMiddleware ({ provider }) {
- return (req, res, next, end) => {
- provider.sendAsync(req, (err, _res) => {
- if (err) return end(err)
- res.result = _res.result
- end()
- })
- }
-}
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 4108ed4c0..d2a55acaa 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -18,7 +18,7 @@ const createFilterMiddleware = require('eth-json-rpc-filters')
const createSubscriptionManager = require('eth-json-rpc-filters/subscriptionManager')
const createOriginMiddleware = require('./lib/createOriginMiddleware')
const createLoggerMiddleware = require('./lib/createLoggerMiddleware')
-const createProviderMiddleware = require('./lib/createProviderMiddleware')
+const providerAsMiddleware = require('eth-json-rpc-middleware/providerAsMiddleware')
const {setupMultiplex} = require('./lib/stream-utils.js')
const KeyringController = require('eth-keyring-controller')
const NetworkController = require('./controllers/network')
@@ -1373,7 +1373,7 @@ module.exports = class MetamaskController extends EventEmitter {
// watch asset
engine.push(this.preferencesController.requestWatchAsset.bind(this.preferencesController))
// forward to metamask primary provider
- engine.push(createProviderMiddleware({ provider }))
+ engine.push(providerAsMiddleware(provider))
// setup connection
const providerStream = createEngineStream({ engine })