aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorThomas Huang <tmashuang@users.noreply.github.com>2019-07-13 01:58:19 +0800
committerGitHub <noreply@github.com>2019-07-13 01:58:19 +0800
commit96a12a627ec14850155420e041f3bd55e3dce71a (patch)
tree07909b87d2eed412d63e90afb51d4e54a27c8c53 /app
parent9be7fd39ba8aa368902a738898b191fba00b01af (diff)
parent1c19ce91a421134a41f1e14a60196d8da0e778f0 (diff)
downloadtangerine-wallet-browser-96a12a627ec14850155420e041f3bd55e3dce71a.tar
tangerine-wallet-browser-96a12a627ec14850155420e041f3bd55e3dce71a.tar.gz
tangerine-wallet-browser-96a12a627ec14850155420e041f3bd55e3dce71a.tar.bz2
tangerine-wallet-browser-96a12a627ec14850155420e041f3bd55e3dce71a.tar.lz
tangerine-wallet-browser-96a12a627ec14850155420e041f3bd55e3dce71a.tar.xz
tangerine-wallet-browser-96a12a627ec14850155420e041f3bd55e3dce71a.tar.zst
tangerine-wallet-browser-96a12a627ec14850155420e041f3bd55e3dce71a.zip
Merge pull request #6832 from MetaMask/master-rebased
Master rebased
Diffstat (limited to 'app')
-rw-r--r--app/manifest.json2
-rw-r--r--app/scripts/controllers/network/createLocalhostClient.js18
2 files changed, 19 insertions, 1 deletions
diff --git a/app/manifest.json b/app/manifest.json
index d09407373..8639577bb 100644
--- a/app/manifest.json
+++ b/app/manifest.json
@@ -1,7 +1,7 @@
{
"name": "__MSG_appName__",
"short_name": "__MSG_appName__",
- "version": "6.7.1",
+ "version": "6.7.2",
"manifest_version": 2,
"author": "https://metamask.io",
"description": "__MSG_appDescription__",
diff --git a/app/scripts/controllers/network/createLocalhostClient.js b/app/scripts/controllers/network/createLocalhostClient.js
index 09b1d3c1c..3a435e5d0 100644
--- a/app/scripts/controllers/network/createLocalhostClient.js
+++ b/app/scripts/controllers/network/createLocalhostClient.js
@@ -2,9 +2,12 @@ const mergeMiddleware = require('json-rpc-engine/src/mergeMiddleware')
const createFetchMiddleware = require('eth-json-rpc-middleware/fetch')
const createBlockRefRewriteMiddleware = require('eth-json-rpc-middleware/block-ref-rewrite')
const createBlockTrackerInspectorMiddleware = require('eth-json-rpc-middleware/block-tracker-inspector')
+const createAsyncMiddleware = require('json-rpc-engine/src/createAsyncMiddleware')
const providerFromMiddleware = require('eth-json-rpc-middleware/providerFromMiddleware')
const BlockTracker = require('eth-block-tracker')
+const inTest = process.env.IN_TEST === 'true'
+
module.exports = createLocalhostClient
function createLocalhostClient () {
@@ -13,9 +16,24 @@ function createLocalhostClient () {
const blockTracker = new BlockTracker({ provider: blockProvider, pollingInterval: 1000 })
const networkMiddleware = mergeMiddleware([
+ createEstimateGasMiddleware(),
createBlockRefRewriteMiddleware({ blockTracker }),
createBlockTrackerInspectorMiddleware({ blockTracker }),
fetchMiddleware,
])
return { networkMiddleware, blockTracker }
}
+
+function delay (time) {
+ return new Promise(resolve => setTimeout(resolve, time))
+}
+
+
+function createEstimateGasMiddleware () {
+ return createAsyncMiddleware(async (req, _, next) => {
+ if (req.method === 'eth_estimateGas' && inTest) {
+ await delay(2000)
+ }
+ return next()
+ })
+}