Skip to content

Commit

Permalink
prevent add duplicates when address is not new
Browse files Browse the repository at this point in the history
  • Loading branch information
jennypollack committed Mar 29, 2019
1 parent 649a1d4 commit 356ef79
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,10 @@ function mapDispatchToProps (dispatch) {

return dispatch(updateTransaction(editingTx))
},

addToAddressBookIfNew: (newAddress, toAccounts, nickname = '') => {
const hexPrefixedAddress = ethUtil.addHexPrefix(newAddress)
if (addressIsNew(toAccounts)) {
if (addressIsNew(toAccounts, hexPrefixedAddress)) {
// TODO: nickname, i.e. addToAddressBook(recipient, nickname)
dispatch(addToAddressBook(hexPrefixedAddress, nickname))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function constructUpdatedTx ({
}

function addressIsNew (toAccounts, newAddress) {
return !toAccounts.find(({ address }) => newAddress === address)
return !toAccounts.find(({ address }) => (newAddress === address || newAddress.toLowerCase() === address))
}

module.exports = {
Expand Down

0 comments on commit 356ef79

Please sign in to comment.