mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fix account-tracker references
This commit is contained in:
parent
f9d2f523c6
commit
f01b0a818b
@ -5,9 +5,9 @@ const BN = require('ethereumjs-util').BN
|
||||
class BalanceController {
|
||||
|
||||
constructor (opts = {}) {
|
||||
const { address, ethStore, txController } = opts
|
||||
const { address, accountTracker, txController } = opts
|
||||
this.address = address
|
||||
this.ethStore = ethStore
|
||||
this.accountTracker = accountTracker
|
||||
this.txController = txController
|
||||
|
||||
const initState = {
|
||||
@ -39,7 +39,7 @@ class BalanceController {
|
||||
}
|
||||
|
||||
_getBalance () {
|
||||
const store = this.ethStore.getState()
|
||||
const store = this.accountTracker.getState()
|
||||
const balances = store.accounts
|
||||
const entry = balances[this.address]
|
||||
const balance = entry.balance
|
||||
|
@ -5,8 +5,8 @@ const BalanceController = require('./balance')
|
||||
class ComputedbalancesController {
|
||||
|
||||
constructor (opts = {}) {
|
||||
const { ethStore, txController } = opts
|
||||
this.ethStore = ethStore
|
||||
const { accountTracker, txController } = opts
|
||||
this.accountTracker = accountTracker
|
||||
this.txController = txController
|
||||
|
||||
const initState = extend({
|
||||
@ -25,9 +25,9 @@ class ComputedbalancesController {
|
||||
}
|
||||
|
||||
_initBalanceUpdating () {
|
||||
const store = this.ethStore.getState()
|
||||
const store = this.accountTracker.getState()
|
||||
this.addAnyAccountsFromStore(store)
|
||||
this.ethStore.subscribe(this.addAnyAccountsFromStore.bind(this))
|
||||
this.accountTracker.subscribe(this.addAnyAccountsFromStore.bind(this))
|
||||
}
|
||||
|
||||
addAnyAccountsFromStore(store) {
|
||||
@ -48,7 +48,7 @@ class ComputedbalancesController {
|
||||
trackAddress (address) {
|
||||
let updater = new BalanceController({
|
||||
address,
|
||||
ethStore: this.ethStore,
|
||||
accountTracker: this.accountTracker,
|
||||
txController: this.txController,
|
||||
})
|
||||
updater.store.subscribe((accountBalance) => {
|
||||
|
@ -35,7 +35,7 @@ class KeyringController extends EventEmitter {
|
||||
keyrings: [],
|
||||
identities: {},
|
||||
})
|
||||
this.ethStore = opts.ethStore
|
||||
this.accountTracker = opts.accountTracker
|
||||
this.encryptor = encryptor
|
||||
this.keyrings = []
|
||||
this.getNetwork = opts.getNetwork
|
||||
@ -338,7 +338,7 @@ class KeyringController extends EventEmitter {
|
||||
//
|
||||
// Initializes the provided account array
|
||||
// Gives them numerically incremented nicknames,
|
||||
// and adds them to the ethStore for regular balance checking.
|
||||
// and adds them to the accountTracker for regular balance checking.
|
||||
setupAccounts (accounts) {
|
||||
return this.getAccounts()
|
||||
.then((loadedAccounts) => {
|
||||
@ -361,7 +361,7 @@ class KeyringController extends EventEmitter {
|
||||
throw new Error('Problem loading account.')
|
||||
}
|
||||
const address = normalizeAddress(account)
|
||||
this.ethStore.addAccount(address)
|
||||
this.accountTracker.addAccount(address)
|
||||
return this.createNickname(address)
|
||||
}
|
||||
|
||||
@ -567,12 +567,12 @@ class KeyringController extends EventEmitter {
|
||||
clearKeyrings () {
|
||||
let accounts
|
||||
try {
|
||||
accounts = Object.keys(this.ethStore.getState())
|
||||
accounts = Object.keys(this.accountTracker.getState())
|
||||
} catch (e) {
|
||||
accounts = []
|
||||
}
|
||||
accounts.forEach((address) => {
|
||||
this.ethStore.removeAccount(address)
|
||||
this.accountTracker.removeAccount(address)
|
||||
})
|
||||
|
||||
// clear keyrings from memory
|
||||
|
Loading…
Reference in New Issue
Block a user