mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Made some requested changes
This commit is contained in:
parent
f128240e7f
commit
40f1d08684
@ -16,7 +16,7 @@ class BalanceController {
|
|||||||
this.store = new ObservableStore(initState)
|
this.store = new ObservableStore(initState)
|
||||||
|
|
||||||
this.balanceCalc = new PendingBalanceCalculator({
|
this.balanceCalc = new PendingBalanceCalculator({
|
||||||
getBalance: () => Promise.resolve(this._getBalance()),
|
getBalance: () => this._getBalance(),
|
||||||
getPendingTransactions: this._getPendingTransactions.bind(this),
|
getPendingTransactions: this._getPendingTransactions.bind(this),
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -35,24 +35,24 @@ class BalanceController {
|
|||||||
this.txController.on('submitted', update)
|
this.txController.on('submitted', update)
|
||||||
this.txController.on('confirmed', update)
|
this.txController.on('confirmed', update)
|
||||||
this.txController.on('failed', update)
|
this.txController.on('failed', update)
|
||||||
|
this.accountTracker.subscribe(update)
|
||||||
this.txController.blockTracker.on('block', update)
|
this.txController.blockTracker.on('block', update)
|
||||||
}
|
}
|
||||||
|
|
||||||
_getBalance () {
|
async _getBalance () {
|
||||||
const store = this.accountTracker.getState()
|
const { accounts } = this.accountTracker.getState()
|
||||||
const balances = store.accounts
|
const entry = accounts[this.address]
|
||||||
const entry = balances[this.address]
|
|
||||||
const balance = entry.balance
|
const balance = entry.balance
|
||||||
return balance ? new BN(balance.substring(2), 16) : undefined
|
return balance ? new BN(balance.substring(2), 16) : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
_getPendingTransactions () {
|
async _getPendingTransactions () {
|
||||||
const pending = this.txController.getFilteredTxList({
|
const pending = this.txController.getFilteredTxList({
|
||||||
from: this.address,
|
from: this.address,
|
||||||
status: 'submitted',
|
status: 'submitted',
|
||||||
err: undefined,
|
err: undefined,
|
||||||
})
|
})
|
||||||
return Promise.resolve(pending)
|
return pending
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user