aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2018-01-13 02:25:36 +0800
committerDan Finlay <dan@danfinlay.com>2018-01-13 02:25:36 +0800
commit7cb66ce4cba446f8149c4a8872dbdfbc53f72f7c (patch)
tree7dea8bfe048aadb4be252f561422245098c288e8
parent4a9dad7c40b97f1e625931d6b57fc9d7fdc5080d (diff)
downloadtangerine-wallet-browser-7cb66ce4cba446f8149c4a8872dbdfbc53f72f7c.tar
tangerine-wallet-browser-7cb66ce4cba446f8149c4a8872dbdfbc53f72f7c.tar.gz
tangerine-wallet-browser-7cb66ce4cba446f8149c4a8872dbdfbc53f72f7c.tar.bz2
tangerine-wallet-browser-7cb66ce4cba446f8149c4a8872dbdfbc53f72f7c.tar.lz
tangerine-wallet-browser-7cb66ce4cba446f8149c4a8872dbdfbc53f72f7c.tar.xz
tangerine-wallet-browser-7cb66ce4cba446f8149c4a8872dbdfbc53f72f7c.tar.zst
tangerine-wallet-browser-7cb66ce4cba446f8149c4a8872dbdfbc53f72f7c.zip
Prefer passing a provider over an ethQuery instance
-rw-r--r--app/scripts/controllers/recent-blocks.js5
-rw-r--r--app/scripts/metamask-controller.js7
2 files changed, 4 insertions, 8 deletions
diff --git a/app/scripts/controllers/recent-blocks.js b/app/scripts/controllers/recent-blocks.js
index c65c2b1c4..4ae3810eb 100644
--- a/app/scripts/controllers/recent-blocks.js
+++ b/app/scripts/controllers/recent-blocks.js
@@ -1,13 +1,14 @@
const ObservableStore = require('obs-store')
const extend = require('xtend')
const BN = require('ethereumjs-util').BN
+const EthQuery = require('eth-query')
class RecentBlocksController {
constructor (opts = {}) {
- const { blockTracker, ethQuery } = opts
+ const { blockTracker, provider } = opts
this.blockTracker = blockTracker
- this.ethQuery = ethQuery
+ this.ethQuery = new EthQuery(provider)
this.historyLength = opts.historyLength || 40
const initState = extend({
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 81d70797a..000e17b9e 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -5,7 +5,6 @@ const Dnode = require('dnode')
const ObservableStore = require('obs-store')
const asStream = require('obs-store/lib/asStream')
const AccountTracker = require('./lib/account-tracker')
-const EthQuery = require('eth-query')
const RpcEngine = require('json-rpc-engine')
const debounce = require('debounce')
const createEngineStream = require('json-rpc-middleware-stream/engineStream')
@@ -94,12 +93,9 @@ module.exports = class MetamaskController extends EventEmitter {
this.provider = this.initializeProvider()
this.blockTracker = this.provider._blockTracker
- // eth data query tools
- this.ethQuery = new EthQuery(this.provider)
-
this.recentBlocksController = new RecentBlocksController({
blockTracker: this.blockTracker,
- ethQuery: this.ethQuery,
+ provider: this.provider,
})
// account tracker watches balances, nonces, and any code at their address.
@@ -142,7 +138,6 @@ module.exports = class MetamaskController extends EventEmitter {
signTransaction: this.keyringController.signTransaction.bind(this.keyringController),
provider: this.provider,
blockTracker: this.blockTracker,
- ethQuery: this.ethQuery,
getGasPrice: this.getGasPrice.bind(this),
})
this.txController.on('newUnapprovedTx', opts.showUnapprovedTx.bind(opts))