aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-05-17 12:08:19 +0800
committerkumavis <aaron@kumavis.me>2018-05-17 12:08:19 +0800
commitb6eff15bd25ca30ba8a746eff2beec1c820b8855 (patch)
treeb32ef90ab273342b64af6e7467fb11e881d114cb
parent088d7930e0895ef1802823c5fc843dd1c19b9661 (diff)
downloadtangerine-wallet-browser-b6eff15bd25ca30ba8a746eff2beec1c820b8855.tar
tangerine-wallet-browser-b6eff15bd25ca30ba8a746eff2beec1c820b8855.tar.gz
tangerine-wallet-browser-b6eff15bd25ca30ba8a746eff2beec1c820b8855.tar.bz2
tangerine-wallet-browser-b6eff15bd25ca30ba8a746eff2beec1c820b8855.tar.lz
tangerine-wallet-browser-b6eff15bd25ca30ba8a746eff2beec1c820b8855.tar.xz
tangerine-wallet-browser-b6eff15bd25ca30ba8a746eff2beec1c820b8855.tar.zst
tangerine-wallet-browser-b6eff15bd25ca30ba8a746eff2beec1c820b8855.zip
lint fix
-rw-r--r--app/scripts/controllers/network/createInfuraClient.js7
-rw-r--r--app/scripts/controllers/network/createJsonRpcClient.js6
-rw-r--r--app/scripts/controllers/network/createLocalhostClient.js4
-rw-r--r--app/scripts/controllers/network/createMetamaskMiddleware.js6
-rw-r--r--app/scripts/controllers/network/network.js8
5 files changed, 18 insertions, 13 deletions
diff --git a/app/scripts/controllers/network/createInfuraClient.js b/app/scripts/controllers/network/createInfuraClient.js
index e346f4bcb..528be80ce 100644
--- a/app/scripts/controllers/network/createInfuraClient.js
+++ b/app/scripts/controllers/network/createInfuraClient.js
@@ -1,12 +1,15 @@
const mergeMiddleware = require('json-rpc-engine/src/mergeMiddleware')
const createAsyncMiddleware = require('json-rpc-engine/src/createAsyncMiddleware')
const createBlockRefMiddleware = require('eth-json-rpc-middleware/block-ref')
-const createBlockRefMiddleware = require('eth-json-rpc-middleware/block-cache')
+const createBlockCacheMiddleware = require('eth-json-rpc-middleware/block-cache')
+const createInflightMiddleware = require('eth-json-rpc-middleware/inflight')
+const providerFromMiddleware = require('eth-json-rpc-middleware/providerFromMiddleware')
+const createInfuraMiddleware = require('eth-json-rpc-infura')
const BlockTracker = require('eth-block-tracker')
module.exports = createInfuraClient
-function createInfuraClient({ network }) {
+function createInfuraClient ({ network }) {
const infuraMiddleware = createInfuraMiddleware({ network })
const blockProvider = providerFromMiddleware(infuraMiddleware)
const blockTracker = new BlockTracker({ provider: blockProvider })
diff --git a/app/scripts/controllers/network/createJsonRpcClient.js b/app/scripts/controllers/network/createJsonRpcClient.js
index 5a8e85c23..f8b67aa26 100644
--- a/app/scripts/controllers/network/createJsonRpcClient.js
+++ b/app/scripts/controllers/network/createJsonRpcClient.js
@@ -2,12 +2,14 @@ const mergeMiddleware = require('json-rpc-engine/src/mergeMiddleware')
const createAsyncMiddleware = require('json-rpc-engine/src/createAsyncMiddleware')
const createFetchMiddleware = require('eth-json-rpc-middleware/fetch')
const createBlockRefMiddleware = require('eth-json-rpc-middleware/block-ref')
-const createBlockRefMiddleware = require('eth-json-rpc-middleware/block-cache')
+const createBlockCacheMiddleware = require('eth-json-rpc-middleware/block-cache')
+const createInflightMiddleware = require('eth-json-rpc-middleware/inflight')
+const providerFromMiddleware = require('eth-json-rpc-middleware/providerFromMiddleware')
const BlockTracker = require('eth-block-tracker')
module.exports = createJsonRpcClient
-function createJsonRpcClient({ rpcUrl }) {
+function createJsonRpcClient ({ rpcUrl }) {
const fetchMiddleware = createFetchMiddleware({ rpcUrl })
const blockProvider = providerFromMiddleware(fetchMiddleware)
const blockTracker = new BlockTracker({ provider: blockProvider })
diff --git a/app/scripts/controllers/network/createLocalhostClient.js b/app/scripts/controllers/network/createLocalhostClient.js
index 404415532..990dc6a95 100644
--- a/app/scripts/controllers/network/createLocalhostClient.js
+++ b/app/scripts/controllers/network/createLocalhostClient.js
@@ -2,12 +2,12 @@ const mergeMiddleware = require('json-rpc-engine/src/mergeMiddleware')
const createAsyncMiddleware = require('json-rpc-engine/src/createAsyncMiddleware')
const createFetchMiddleware = require('eth-json-rpc-middleware/fetch')
const createBlockRefMiddleware = require('eth-json-rpc-middleware/block-ref')
-const createBlockRefMiddleware = require('eth-json-rpc-middleware/block-cache')
+const providerFromMiddleware = require('eth-json-rpc-middleware/providerFromMiddleware')
const BlockTracker = require('eth-block-tracker')
module.exports = createLocalhostClient
-function createLocalhostClient() {
+function createLocalhostClient () {
const fetchMiddleware = createFetchMiddleware({ rpcUrl: 'http://localhost:8545/' })
const blockProvider = providerFromMiddleware(fetchMiddleware)
const blockTracker = new BlockTracker({ provider: blockProvider, pollingInterval: 1000 })
diff --git a/app/scripts/controllers/network/createMetamaskMiddleware.js b/app/scripts/controllers/network/createMetamaskMiddleware.js
index 1974c231d..7dbd90d7f 100644
--- a/app/scripts/controllers/network/createMetamaskMiddleware.js
+++ b/app/scripts/controllers/network/createMetamaskMiddleware.js
@@ -5,14 +5,14 @@ const createWalletSubprovider = require('eth-json-rpc-middleware/wallet')
module.exports = createMetamaskMiddleware
-function createMetamaskMiddleware({
+function createMetamaskMiddleware ({
version,
getAccounts,
processTransaction,
processEthSignMessage,
processTypedMessage,
processPersonalMessage,
- getPendingNonce
+ getPendingNonce,
}) {
const metamaskMiddleware = mergeMiddleware([
createScaffoldMiddleware({
@@ -28,7 +28,7 @@ function createMetamaskMiddleware({
processPersonalMessage,
}),
createPendingNonceMiddleware({ getPendingNonce }),
- })
+ ])
return metamaskMiddleware
}
diff --git a/app/scripts/controllers/network/network.js b/app/scripts/controllers/network/network.js
index c882c7d75..a8c45a79c 100644
--- a/app/scripts/controllers/network/network.js
+++ b/app/scripts/controllers/network/network.js
@@ -2,8 +2,9 @@ const assert = require('assert')
const EventEmitter = require('events')
const ObservableStore = require('obs-store')
const ComposedStore = require('obs-store/lib/composed')
-const extend = require('xtend')
const EthQuery = require('eth-query')
+const JsonRpcEngine = require('json-rpc-engine')
+const providerFromEngine = require('eth-json-rpc-middle/providerFromEngine')
const log = require('loglevel')
const createMetamaskMiddleware = require('./createMetamaskMiddleware')
const createInfuraClient = require('./createInfuraClient')
@@ -19,7 +20,6 @@ const {
MAINNET,
LOCALHOST,
} = require('./enums')
-const LOCALHOST_RPC_URL = 'http://localhost:8545'
const INFURA_PROVIDER_TYPES = [ROPSTEN, RINKEBY, KOVAN, MAINNET]
const env = process.env.METAMASK_ENV
@@ -58,7 +58,7 @@ module.exports = class NetworkController extends EventEmitter {
}
// return the proxies so the references will always be good
- getProviderAndBlockTracker() {
+ getProviderAndBlockTracker () {
const provider = this._providerProxy
const blockTracker = this._blockTracker
return { provider, blockTracker }
@@ -135,7 +135,7 @@ module.exports = class NetworkController extends EventEmitter {
} else if (type === LOCALHOST) {
this._configureLocalhostProvider()
// url-based rpc endpoints
- } else if (type === 'rpc'){
+ } else if (type === 'rpc') {
this._configureStandardProvider({ rpcUrl: rpcTarget })
} else {
throw new Error(`NetworkController - _configureProvider - unknown type "${type}"`)