diff options
author | Jenny Pollack <jennypollack3@gmail.com> | 2019-03-29 10:18:53 +0800 |
---|---|---|
committer | Jenny Pollack <jennypollack3@gmail.com> | 2019-03-29 10:18:53 +0800 |
commit | 356ef794f22de272b12cb84205da4fc8af463458 (patch) | |
tree | 04d8de45d041d988287a7e9d875b3d6c1da04ba5 | |
parent | 649a1d483a574dcff902708f95b37329a02709a8 (diff) | |
download | tangerine-wallet-browser-356ef794f22de272b12cb84205da4fc8af463458.tar.gz tangerine-wallet-browser-356ef794f22de272b12cb84205da4fc8af463458.tar.zst tangerine-wallet-browser-356ef794f22de272b12cb84205da4fc8af463458.zip |
prevent add duplicates when address is not new
-rw-r--r-- | ui/app/components/app/send/send-footer/send-footer.container.js | 3 | ||||
-rw-r--r-- | ui/app/components/app/send/send-footer/send-footer.utils.js | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/ui/app/components/app/send/send-footer/send-footer.container.js b/ui/app/components/app/send/send-footer/send-footer.container.js index 502159a81..ea3fd7ee4 100644 --- a/ui/app/components/app/send/send-footer/send-footer.container.js +++ b/ui/app/components/app/send/send-footer/send-footer.container.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)) } diff --git a/ui/app/components/app/send/send-footer/send-footer.utils.js b/ui/app/components/app/send/send-footer/send-footer.utils.js index f82ff1e9b..a63316336 100644 --- a/ui/app/components/app/send/send-footer/send-footer.utils.js +++ b/ui/app/components/app/send/send-footer/send-footer.utils.js @@ -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 = { |