Make blockTracker an independent param

feature/default_network_editable
Dan Finlay 7 years ago
parent d9c92cdbd1
commit 674aac83ce
  1. 5
      app/scripts/controllers/balance.js
  2. 4
      app/scripts/controllers/computed-balances.js

@ -5,10 +5,11 @@ const BN = require('ethereumjs-util').BN
class BalanceController {
constructor (opts = {}) {
const { address, accountTracker, txController } = opts
const { address, accountTracker, txController, blockTracker } = opts
this.address = address
this.accountTracker = accountTracker
this.txController = txController
this.blockTracker = blockTracker
const initState = {
ethBalance: undefined,
@ -36,7 +37,7 @@ class BalanceController {
this.txController.on('confirmed', update)
this.txController.on('failed', update)
this.accountTracker.subscribe(update)
this.txController.blockTracker.on('block', update)
this.blockTracker.on('block', update)
}
async _getBalance () {

@ -5,9 +5,10 @@ const BalanceController = require('./balance')
class ComputedbalancesController {
constructor (opts = {}) {
const { accountTracker, txController } = opts
const { accountTracker, txController, blockTracker } = opts
this.accountTracker = accountTracker
this.txController = txController
this.blockTracker = blockTracker
const initState = extend({
computedBalances: {},
@ -50,6 +51,7 @@ class ComputedbalancesController {
address,
accountTracker: this.accountTracker,
txController: this.txController,
blockTracker: this.blockTracker,
})
updater.store.subscribe((accountBalance) => {
let newState = this.store.getState()

Loading…
Cancel
Save