aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers/balance.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/balance.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/balance.js')
-rw-r--r--app/scripts/controllers/balance.js9
1 files changed, 3 insertions, 6 deletions
diff --git a/app/scripts/controllers/balance.js b/app/scripts/controllers/balance.js
index 0d4ab7d4f..b4e72e751 100644
--- a/app/scripts/controllers/balance.js
+++ b/app/scripts/controllers/balance.js
@@ -1,6 +1,4 @@
const ObservableStore = require('obs-store')
-const normalizeAddress = require('eth-sig-util').normalize
-const extend = require('xtend')
const PendingBalanceCalculator = require('../lib/pending-balance-calculator')
const BN = require('ethereumjs-util').BN
@@ -12,12 +10,11 @@ class BalanceController {
this.ethStore = ethStore
this.txController = txController
- const initState = extend({
+ const initState = {
ethBalance: undefined,
- }, opts.initState)
+ }
this.store = new ObservableStore(initState)
- const { getBalance, getPendingTransactions } = opts
this.balanceCalc = new PendingBalanceCalculator({
getBalance: () => Promise.resolve(this._getBalance()),
getPendingTransactions: this._getPendingTransactions.bind(this),
@@ -46,7 +43,7 @@ class BalanceController {
const balances = store.accounts
const entry = balances[this.address]
const balance = entry.balance
- return balance ? new BN(balance.substring(2), 16) : new BN(0)
+ return balance ? new BN(balance.substring(2), 16) : undefined
}
_getPendingTransactions () {