diff options
author | Kevin Serrano <kevgagser@gmail.com> | 2017-01-04 01:28:53 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-04 01:28:53 +0800 |
commit | b13c54682b75aaceba1ef37a4d97669f57e448a9 (patch) | |
tree | e81657c2671e25fbbba9e9bc3a62828269c38da5 /ui/app/accounts | |
parent | fa3e708f34fce523601c39b3131bdbe858d2f85f (diff) | |
parent | fe61fcb0fcbee05724b77f9729660c9f692a0cb1 (diff) | |
download | tangerine-wallet-browser-b13c54682b75aaceba1ef37a4d97669f57e448a9.tar tangerine-wallet-browser-b13c54682b75aaceba1ef37a4d97669f57e448a9.tar.gz tangerine-wallet-browser-b13c54682b75aaceba1ef37a4d97669f57e448a9.tar.bz2 tangerine-wallet-browser-b13c54682b75aaceba1ef37a4d97669f57e448a9.tar.lz tangerine-wallet-browser-b13c54682b75aaceba1ef37a4d97669f57e448a9.tar.xz tangerine-wallet-browser-b13c54682b75aaceba1ef37a4d97669f57e448a9.tar.zst tangerine-wallet-browser-b13c54682b75aaceba1ef37a4d97669f57e448a9.zip |
Merge pull request #958 from MetaMask/i897-ReplayProtection
Add replay protection
Diffstat (limited to 'ui/app/accounts')
-rw-r--r-- | ui/app/accounts/account-list-item.js | 20 | ||||
-rw-r--r-- | ui/app/accounts/index.js | 14 |
2 files changed, 26 insertions, 8 deletions
diff --git a/ui/app/accounts/account-list-item.js b/ui/app/accounts/account-list-item.js index ef7b749e4..16019c88a 100644 --- a/ui/app/accounts/account-list-item.js +++ b/ui/app/accounts/account-list-item.js @@ -15,19 +15,21 @@ function AccountListItem () { } AccountListItem.prototype.render = function () { - const identity = this.props.identity - var isSelected = this.props.selectedAccount === identity.address - var account = this.props.accounts[identity.address] + const { identity, selectedAccount, accounts, onShowDetail } = this.props + + const isSelected = selectedAccount === identity.address + const account = accounts[identity.address] const selectedClass = isSelected ? '.selected' : '' return ( h(`.accounts-list-option.flex-row.flex-space-between.pointer.hover-white${selectedClass}`, { key: `account-panel-${identity.address}`, - onClick: (event) => this.props.onShowDetail(identity.address, event), + onClick: (event) => onShowDetail(identity.address, event), }, [ h('.identicon-wrapper.flex-column.flex-center.select-none', [ this.pendingOrNot(), + this.indicateIfLoose(), h(Identicon, { address: identity.address, imageify: true, @@ -48,7 +50,7 @@ AccountListItem.prototype.render = function () { }, }, ethUtil.toChecksumAddress(identity.address)), h(EthBalance, { - value: account.balance, + value: account && account.balance, style: { lineHeight: '7px', marginTop: '10px', @@ -70,6 +72,14 @@ AccountListItem.prototype.render = function () { ) } +AccountListItem.prototype.indicateIfLoose = function () { + try { // Sometimes keyrings aren't loaded yet: + const type = this.props.keyring.type + const isLoose = type !== 'HD Key Tree' + return isLoose ? h('.keyring-label', 'LOOSE') : null + } catch (e) { return } +} + AccountListItem.prototype.pendingOrNot = function () { const pending = this.props.pending if (pending.length === 0) return null diff --git a/ui/app/accounts/index.js b/ui/app/accounts/index.js index fcb3a7b0f..edb15eafe 100644 --- a/ui/app/accounts/index.js +++ b/ui/app/accounts/index.js @@ -22,6 +22,7 @@ function mapStateToProps (state) { selectedAccount: state.metamask.selectedAccount, scrollToBottom: state.appState.scrollToBottom, pending, + keyrings: state.metamask.keyrings, } } @@ -31,9 +32,10 @@ function AccountsScreen () { } AccountsScreen.prototype.render = function () { - var state = this.props - var identityList = valuesFor(state.identities) - var unconfTxList = valuesFor(state.unconfTxs) + const props = this.props + const { keyrings } = props + const identityList = valuesFor(props.identities) + const unconfTxList = valuesFor(props.unconfTxs) return ( @@ -69,6 +71,11 @@ AccountsScreen.prototype.render = function () { } }) + const simpleAddress = identity.address.substring(2).toLowerCase() + const keyring = keyrings.find((kr) => { + return kr.accounts.includes(simpleAddress) + }) + return h(AccountListItem, { key: `acct-panel-${identity.address}`, identity, @@ -76,6 +83,7 @@ AccountsScreen.prototype.render = function () { accounts: this.props.accounts, onShowDetail: this.onShowDetail.bind(this), pending, + keyring, }) }), |