prevent add duplicates when address is not new

feature/default_network_editable
Jenny Pollack 6 years ago
parent 649a1d483a
commit 356ef794f2
  1. 3
      ui/app/components/app/send/send-footer/send-footer.container.js
  2. 2
      ui/app/components/app/send/send-footer/send-footer.utils.js

@ -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))
}

@ -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 = {

Loading…
Cancel
Save