aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2017-09-26 05:36:49 +0800
committerDan Finlay <dan@danfinlay.com>2017-09-26 05:36:49 +0800
commit8cd7329c91b047ef15c81b164075ea6c1d15b0df (patch)
treed51ed2a85a45ac23dbfb3595f4c8c13850be3b58 /app
parent40f1d0868401662c42f6a031549c9b023427ccef (diff)
downloadtangerine-wallet-browser-8cd7329c91b047ef15c81b164075ea6c1d15b0df.tar
tangerine-wallet-browser-8cd7329c91b047ef15c81b164075ea6c1d15b0df.tar.gz
tangerine-wallet-browser-8cd7329c91b047ef15c81b164075ea6c1d15b0df.tar.bz2
tangerine-wallet-browser-8cd7329c91b047ef15c81b164075ea6c1d15b0df.tar.lz
tangerine-wallet-browser-8cd7329c91b047ef15c81b164075ea6c1d15b0df.tar.xz
tangerine-wallet-browser-8cd7329c91b047ef15c81b164075ea6c1d15b0df.tar.zst
tangerine-wallet-browser-8cd7329c91b047ef15c81b164075ea6c1d15b0df.zip
Implemented feedback
Diffstat (limited to 'app')
-rw-r--r--app/scripts/controllers/balance.js4
-rw-r--r--app/scripts/lib/pending-balance-calculator.js8
2 files changed, 5 insertions, 7 deletions
diff --git a/app/scripts/controllers/balance.js b/app/scripts/controllers/balance.js
index 840b7abc3..9b2566852 100644
--- a/app/scripts/controllers/balance.js
+++ b/app/scripts/controllers/balance.js
@@ -20,7 +20,7 @@ class BalanceController {
getPendingTransactions: this._getPendingTransactions.bind(this),
})
- this.registerUpdates()
+ this._registerUpdates()
}
async updateBalance () {
@@ -30,7 +30,7 @@ class BalanceController {
})
}
- registerUpdates () {
+ _registerUpdates () {
const update = this.updateBalance.bind(this)
this.txController.on('submitted', update)
this.txController.on('confirmed', update)
diff --git a/app/scripts/lib/pending-balance-calculator.js b/app/scripts/lib/pending-balance-calculator.js
index c66bffbbb..cea642f1a 100644
--- a/app/scripts/lib/pending-balance-calculator.js
+++ b/app/scripts/lib/pending-balance-calculator.js
@@ -19,19 +19,17 @@ class PendingBalanceCalculator {
this.getPendingTransactions(),
])
- const balance = results[0]
- const pending = results[1]
-
+ const [ balance, pending ] = results
if (!balance) return undefined
const pendingValue = pending.reduce((total, tx) => {
- return total.add(this.valueFor(tx))
+ return total.add(this.calculateMaxCost(tx))
}, new BN(0))
return `0x${balance.sub(pendingValue).toString(16)}`
}
- valueFor (tx) {
+ calculateMaxCost (tx) {
const txValue = tx.txParams.value
const value = this.hexToBn(txValue)
const gasPrice = this.hexToBn(tx.txParams.gasPrice)