Skip to content
Permalink
Browse files

Merge pull request MetaMask#4509 from whymarrh/wallet-view-assertion

Add explicit selectedAddress assertion to the wallet view
  • Loading branch information...
kumavis committed Jun 5, 2018
2 parents 5b3af34 + 665ac86 commit c2e3194dbf4e2a3fd2bdffb3300ec0cd822dc78e
Showing with 7 additions and 5 deletions.
  1. +7 −5 ui/app/components/wallet-view.js
@@ -36,7 +36,6 @@ function mapStateToProps (state) {
tokens: state.metamask.tokens,
keyrings: state.metamask.keyrings,
selectedAddress: selectors.getSelectedAddress(state),
selectedIdentity: selectors.getSelectedIdentity(state),
selectedAccount: selectors.getSelectedAccount(state),
selectedTokenAddress: state.metamask.selectedTokenAddress,
}
@@ -99,21 +98,24 @@ WalletView.prototype.render = function () {
const {
responsiveDisplayClassname,
selectedAddress,
selectedIdentity,
keyrings,
showAccountDetailModal,
sidebarOpen,
hideSidebar,
history,
identities,
} = this.props
// temporary logs + fake extra wallets
// console.log('walletview, selectedAccount:', selectedAccount)

const checksummedAddress = checksumAddress(selectedAddress)

if (!selectedAddress) {
throw new Error('selectedAddress should not be ' + String(selectedAddress))
}

const keyring = keyrings.find((kr) => {
return kr.accounts.includes(selectedAddress) ||
kr.accounts.includes(selectedIdentity.address)
return kr.accounts.includes(selectedAddress)
})

const type = keyring.type
@@ -145,7 +147,7 @@ WalletView.prototype.render = function () {
h('span.account-name', {
style: {},
}, [
selectedIdentity.name,
identities[selectedAddress].name,
]),

h('button.btn-clear.wallet-view__details-button.allcaps', this.context.t('details')),

0 comments on commit c2e3194

Please sign in to comment.
You can’t perform that action at this time.