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:
parent
d9c92cdbd1
commit
674aac83ce
@ -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…
Reference in New Issue
Block a user