aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers/balances.js
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2017-09-14 06:02:05 +0800
committerDan Finlay <dan@danfinlay.com>2017-09-14 06:06:04 +0800
commita01921758b25d151cfb1c47d7235f59291c29945 (patch)
treef9453bd23f37c14267a6497befb9f6c15cb70da2 /app/scripts/controllers/balances.js
parent0ba649317592efced339980a729213876bc25a81 (diff)
downloadtangerine-wallet-browser-a01921758b25d151cfb1c47d7235f59291c29945.tar
tangerine-wallet-browser-a01921758b25d151cfb1c47d7235f59291c29945.tar.gz
tangerine-wallet-browser-a01921758b25d151cfb1c47d7235f59291c29945.tar.bz2
tangerine-wallet-browser-a01921758b25d151cfb1c47d7235f59291c29945.tar.lz
tangerine-wallet-browser-a01921758b25d151cfb1c47d7235f59291c29945.tar.xz
tangerine-wallet-browser-a01921758b25d151cfb1c47d7235f59291c29945.tar.zst
tangerine-wallet-browser-a01921758b25d151cfb1c47d7235f59291c29945.zip
Add computed balance to account detail view
Diffstat (limited to 'app/scripts/controllers/balances.js')
-rw-r--r--app/scripts/controllers/balances.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/scripts/controllers/balances.js b/app/scripts/controllers/balances.js
index cf3c8a757..89c2ca95d 100644
--- a/app/scripts/controllers/balances.js
+++ b/app/scripts/controllers/balances.js
@@ -1,5 +1,4 @@
const ObservableStore = require('obs-store')
-const normalizeAddress = require('eth-sig-util').normalize
const extend = require('xtend')
const BalanceController = require('./balance')
@@ -14,10 +13,17 @@ class BalancesController {
computedBalances: {},
}, opts.initState)
this.store = new ObservableStore(initState)
+ this.balances = {}
this._initBalanceUpdating()
}
+ updateAllBalances () {
+ for (let address in this.balances) {
+ this.balances[address].updateBalance()
+ }
+ }
+
_initBalanceUpdating () {
const store = this.ethStore.getState()
this.addAnyAccountsFromStore(store)
@@ -50,6 +56,7 @@ class BalancesController {
newState.computedBalances[address] = accountBalance
this.store.updateState(newState)
})
+ this.balances[address] = updater
updater.updateBalance()
}
}