aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2016-07-15 05:38:54 +0800
committerGitHub <noreply@github.com>2016-07-15 05:38:54 +0800
commite18dc1d65d2422f2d06a0effe81154f82d3c34d5 (patch)
treef29f783accff0729dab4c557fcb1802be1868de8 /ui
parentf84992fa33369d9dc5923c26a61c5369793fc550 (diff)
parent3b80a043ee711bbc12ec55265e7c024c9145e75d (diff)
downloadtangerine-wallet-browser-e18dc1d65d2422f2d06a0effe81154f82d3c34d5.tar.gz
tangerine-wallet-browser-e18dc1d65d2422f2d06a0effe81154f82d3c34d5.tar.zst
tangerine-wallet-browser-e18dc1d65d2422f2d06a0effe81154f82d3c34d5.zip
Merge branch 'master' into legal-beagal
Diffstat (limited to 'ui')
-rw-r--r--ui/app/components/eth-balance.js4
-rw-r--r--ui/app/components/pending-tx-details.js15
-rw-r--r--ui/app/components/transaction-list-item.js1
-rw-r--r--ui/app/util.js8
4 files changed, 16 insertions, 12 deletions
diff --git a/ui/app/components/eth-balance.js b/ui/app/components/eth-balance.js
index 5f99a3e48..612ef7779 100644
--- a/ui/app/components/eth-balance.js
+++ b/ui/app/components/eth-balance.js
@@ -15,7 +15,7 @@ EthBalanceComponent.prototype.render = function () {
var state = this.props
var style = state.style
- const value = formatBalance(state.value)
+ const value = formatBalance(state.value, 6)
var width = state.width
return (
@@ -35,7 +35,7 @@ EthBalanceComponent.prototype.render = function () {
}
EthBalanceComponent.prototype.renderBalance = function (value, state) {
if (value === 'None') return value
- var balanceObj = generateBalanceObject(value, 1)
+ var balanceObj = generateBalanceObject(value, state.shorten ? 1 : 3)
var balance
if (state.shorten) {
diff --git a/ui/app/components/pending-tx-details.js b/ui/app/components/pending-tx-details.js
index 9a06ad09e..a6f72a89b 100644
--- a/ui/app/components/pending-tx-details.js
+++ b/ui/app/components/pending-tx-details.js
@@ -11,9 +11,6 @@ const nameForAddress = require('../../lib/contract-namer')
const ethUtil = require('ethereumjs-util')
const BN = ethUtil.BN
-const baseGasFee = new BN('21000', 10)
-const gasCost = new BN('4a817c800', 16)
-const baseFeeHex = baseGasFee.mul(gasCost).toString(16)
module.exports = PendingTxDetails
@@ -33,9 +30,11 @@ PTXP.render = function () {
var identity = props.identities[address] || { address: address }
var balance = props.accounts[address].balance
- var gasCost = ethUtil.stripHexPrefix(txParams.gas || baseFeeHex)
- var txValue = ethUtil.stripHexPrefix(txParams.value || '0x0')
- var maxCost = ((new BN(txValue, 16)).add(new BN(gasCost, 16))).toString(16)
+ var gasCost = new BN(ethUtil.stripHexPrefix(txParams.gas || txData.estimatedGas), 16)
+ var gasPrice = new BN(ethUtil.stripHexPrefix(txParams.gasPrice || '0x4a817c800'), 16)
+ var txFee = gasCost.mul(gasPrice)
+ var txValue = new BN(ethUtil.stripHexPrefix(txParams.value || '0x0'), 16)
+ var maxCost = txValue.add(txFee)
var dataLength = txParams.data ? (txParams.data.length - 2) / 2 : 0
var imageify = props.imageifyIdenticons === undefined ? true : props.imageifyIdenticons
@@ -112,7 +111,7 @@ PTXP.render = function () {
h('.cell.row', [
h('.cell.label', 'Max Transaction Fee'),
- h('.cell.value', formatBalance(gasCost)),
+ h('.cell.value', formatBalance(txFee.toString(16))),
]),
h('.cell.row', {
@@ -130,7 +129,7 @@ PTXP.render = function () {
},
}, [
h(EtherBalance, {
- value: maxCost,
+ value: maxCost.toString(16),
inline: true,
labelColor: 'black',
fontSize: '16px',
diff --git a/ui/app/components/transaction-list-item.js b/ui/app/components/transaction-list-item.js
index 2314c7107..78867fca4 100644
--- a/ui/app/components/transaction-list-item.js
+++ b/ui/app/components/transaction-list-item.js
@@ -75,6 +75,7 @@ TransactionListItem.prototype.render = function () {
value: txParams.value,
width: '55px',
shorten: true,
+ style: {fontSize: '15px'},
}) : h('.flex-column'),
])
)
diff --git a/ui/app/util.js b/ui/app/util.js
index c04612455..a08006077 100644
--- a/ui/app/util.js
+++ b/ui/app/util.js
@@ -122,7 +122,11 @@ function generateBalanceObject (formattedBalance, decimalsToKeep = 1) {
var afterDecimal = balance.split('.')[1]
var shortBalance = shortenBalance(balance, decimalsToKeep)
- if (beforeDecimal === '0' && afterDecimal.substr(0, 5) === '00000') { balance = '<1.0e-5' }
+ if (beforeDecimal === '0' && afterDecimal.substr(0, 5) === '00000') {
+ balance = '<1.0e-5'
+ } else if (beforeDecimal !== '0') {
+ balance = `${beforeDecimal}.${afterDecimal.slice(0, decimalsToKeep)}`
+ }
return { balance, label, shortBalance }
}
@@ -141,7 +145,7 @@ function shortenBalance (balance, decimalsToKeep = 1) {
truncatedValue = (convertedBalance * Math.pow(10, exponent)).toFixed(decimalsToKeep)
return `<${truncatedValue}e-${exponent}`
} else {
- return balance
+ return convertedBalance.toFixed(decimalsToKeep)
}
}