aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app
diff options
context:
space:
mode:
authorBruno <brunobar79@gmail.com>2018-06-11 09:10:22 +0800
committerBruno <brunobar79@gmail.com>2018-06-11 09:10:22 +0800
commitd1880073f678dbdc52e07e62ec66c39eea5062a6 (patch)
tree9c02b9ee29994bd42a17e6681b9bbc88b04bdfd0 /ui/app
parentf6b27fa9eb542c1ac3fabdad9285e1a50baee7dc (diff)
downloadtangerine-wallet-browser-d1880073f678dbdc52e07e62ec66c39eea5062a6.tar
tangerine-wallet-browser-d1880073f678dbdc52e07e62ec66c39eea5062a6.tar.gz
tangerine-wallet-browser-d1880073f678dbdc52e07e62ec66c39eea5062a6.tar.bz2
tangerine-wallet-browser-d1880073f678dbdc52e07e62ec66c39eea5062a6.tar.lz
tangerine-wallet-browser-d1880073f678dbdc52e07e62ec66c39eea5062a6.tar.xz
tangerine-wallet-browser-d1880073f678dbdc52e07e62ec66c39eea5062a6.tar.zst
tangerine-wallet-browser-d1880073f678dbdc52e07e62ec66c39eea5062a6.zip
balances working
Diffstat (limited to 'ui/app')
-rw-r--r--ui/app/components/pages/create-account/connect-hardware.js20
1 files changed, 18 insertions, 2 deletions
diff --git a/ui/app/components/pages/create-account/connect-hardware.js b/ui/app/components/pages/create-account/connect-hardware.js
index 37b7414b3..6f1e03550 100644
--- a/ui/app/components/pages/create-account/connect-hardware.js
+++ b/ui/app/components/pages/create-account/connect-hardware.js
@@ -6,6 +6,7 @@ const actions = require('../../../actions')
const genAccountLink = require('../../../../lib/account-link.js')
const log = require('loglevel')
const { DEFAULT_ROUTE } = require('../../../routes')
+const { formatBalance } = require('../../../util')
class ConnectHardwareForm extends Component {
constructor (props, context) {
@@ -57,10 +58,22 @@ class ConnectHardwareForm extends Component {
})
}
+ getBalance (address) {
+ // Get the balance
+ log.debug('getBalance : ', address)
+ const { accounts } = this.props
+ const balanceValue = accounts && accounts[address] ? accounts[address].balance : ''
+ log.debug('balanceValue : ', balanceValue)
+ const formattedBalance = balanceValue ? formatBalance(balanceValue, 6) : '...'
+ log.debug('formattedBalance : ', formattedBalance)
+ return formattedBalance
+ }
+
renderAccounts () {
if (!this.state.accounts.length) {
return null
}
+
log.debug('ACCOUNTS : ', this.state.accounts)
log.debug('SELECTED?', this.state.selectedAccount)
@@ -70,6 +83,7 @@ class ConnectHardwareForm extends Component {
h('div.hw-account-list__device', {}, ['Trezor - ETH']),
]),
this.state.accounts.map((a, i) => {
+
return h('div.hw-account-list__item', { key: a.address }, [
h('span.hw-account-list__item__index', a.index + 1),
h('div.hw-account-list__item__radio', [
@@ -88,7 +102,7 @@ class ConnectHardwareForm extends Component {
`${a.address.slice(0, 4)}...${a.address.slice(-4)}`
),
]),
- h('span.hw-account-list__item__balance', `${a.balance} ETH`),
+ h('span.hw-account-list__item__balance', `${this.getBalance(a.address)}`),
h(
'a.hw-account-list__item__link',
{
@@ -194,16 +208,18 @@ ConnectHardwareForm.propTypes = {
history: PropTypes.object,
t: PropTypes.func,
network: PropTypes.string,
+ accounts: PropTypes.object,
}
const mapStateToProps = state => {
const {
- metamask: { network, selectedAddress, identities = {} },
+ metamask: { network, selectedAddress, identities = {}, accounts = [] },
} = state
const numberOfExistingAccounts = Object.keys(identities).length
return {
network,
+ accounts,
address: selectedAddress,
numberOfExistingAccounts,
}