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 {
|
class BalanceController {
|
||||||
|
|
||||||
constructor (opts = {}) {
|
constructor (opts = {}) {
|
||||||
const { address, ethStore, txController } = opts
|
const { address, accountTracker, txController } = opts
|
||||||
this.address = address
|
this.address = address
|
||||||
this.ethStore = ethStore
|
this.accountTracker = accountTracker
|
||||||
this.txController = txController
|
this.txController = txController
|
||||||
|
|
||||||
const initState = {
|
const initState = {
|
||||||
@ -39,7 +39,7 @@ class BalanceController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_getBalance () {
|
_getBalance () {
|
||||||
const store = this.ethStore.getState()
|
const store = this.accountTracker.getState()
|
||||||
const balances = store.accounts
|
const balances = store.accounts
|
||||||
const entry = balances[this.address]
|
const entry = balances[this.address]
|
||||||
const balance = entry.balance
|
const balance = entry.balance
|
||||||
|
@ -5,8 +5,8 @@ const BalanceController = require('./balance')
|
|||||||
class ComputedbalancesController {
|
class ComputedbalancesController {
|
||||||
|
|
||||||
constructor (opts = {}) {
|
constructor (opts = {}) {
|
||||||
const { ethStore, txController } = opts
|
const { accountTracker, txController } = opts
|
||||||
this.ethStore = ethStore
|
this.accountTracker = accountTracker
|
||||||
this.txController = txController
|
this.txController = txController
|
||||||
|
|
||||||
const initState = extend({
|
const initState = extend({
|
||||||
@ -25,9 +25,9 @@ class ComputedbalancesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_initBalanceUpdating () {
|
_initBalanceUpdating () {
|
||||||
const store = this.ethStore.getState()
|
const store = this.accountTracker.getState()
|
||||||
this.addAnyAccountsFromStore(store)
|
this.addAnyAccountsFromStore(store)
|
||||||
this.ethStore.subscribe(this.addAnyAccountsFromStore.bind(this))
|
this.accountTracker.subscribe(this.addAnyAccountsFromStore.bind(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
addAnyAccountsFromStore(store) {
|
addAnyAccountsFromStore(store) {
|
||||||
@ -48,7 +48,7 @@ class ComputedbalancesController {
|
|||||||
trackAddress (address) {
|
trackAddress (address) {
|
||||||
let updater = new BalanceController({
|
let updater = new BalanceController({
|
||||||
address,
|
address,
|
||||||
ethStore: this.ethStore,
|
accountTracker: this.accountTracker,
|
||||||
txController: this.txController,
|
txController: this.txController,
|
||||||
})
|
})
|
||||||
updater.store.subscribe((accountBalance) => {
|
updater.store.subscribe((accountBalance) => {
|
||||||
|
@ -35,7 +35,7 @@ class KeyringController extends EventEmitter {
|
|||||||
keyrings: [],
|
keyrings: [],
|
||||||
identities: {},
|
identities: {},
|
||||||
})
|
})
|
||||||
this.ethStore = opts.ethStore
|
this.accountTracker = opts.accountTracker
|
||||||
this.encryptor = encryptor
|
this.encryptor = encryptor
|
||||||
this.keyrings = []
|
this.keyrings = []
|
||||||
this.getNetwork = opts.getNetwork
|
this.getNetwork = opts.getNetwork
|
||||||
@ -338,7 +338,7 @@ class KeyringController extends EventEmitter {
|
|||||||
//
|
//
|
||||||
// Initializes the provided account array
|
// Initializes the provided account array
|
||||||
// Gives them numerically incremented nicknames,
|
// 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) {
|
setupAccounts (accounts) {
|
||||||
return this.getAccounts()
|
return this.getAccounts()
|
||||||
.then((loadedAccounts) => {
|
.then((loadedAccounts) => {
|
||||||
@ -361,7 +361,7 @@ class KeyringController extends EventEmitter {
|
|||||||
throw new Error('Problem loading account.')
|
throw new Error('Problem loading account.')
|
||||||
}
|
}
|
||||||
const address = normalizeAddress(account)
|
const address = normalizeAddress(account)
|
||||||
this.ethStore.addAccount(address)
|
this.accountTracker.addAccount(address)
|
||||||
return this.createNickname(address)
|
return this.createNickname(address)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -567,12 +567,12 @@ class KeyringController extends EventEmitter {
|
|||||||
clearKeyrings () {
|
clearKeyrings () {
|
||||||
let accounts
|
let accounts
|
||||||
try {
|
try {
|
||||||
accounts = Object.keys(this.ethStore.getState())
|
accounts = Object.keys(this.accountTracker.getState())
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
accounts = []
|
accounts = []
|
||||||
}
|
}
|
||||||
accounts.forEach((address) => {
|
accounts.forEach((address) => {
|
||||||
this.ethStore.removeAccount(address)
|
this.accountTracker.removeAccount(address)
|
||||||
})
|
})
|
||||||
|
|
||||||
// clear keyrings from memory
|
// clear keyrings from memory
|
||||||
|
Loading…
Reference in New Issue
Block a user