1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 12:29:06 +01:00

Make blockTracker an independent param

This commit is contained in:
Dan Finlay 2017-09-25 14:39:22 -07:00
parent d9c92cdbd1
commit 674aac83ce
2 changed files with 6 additions and 3 deletions

View File

@ -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 () {

View File

@ -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()