diff options
author | Chi Kei Chan <chikeichan@gmail.com> | 2019-05-09 01:34:56 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-09 01:34:56 +0800 |
commit | 0497d209b2adb4ac026a54159069fd44aaace9f7 (patch) | |
tree | be0ae45185c04fb19eebd56dc31a51a82c5b4da2 | |
parent | 7df7f709bfb25099e7ea6607dd765c21cb242d4d (diff) | |
download | tangerine-wallet-browser-0497d209b2adb4ac026a54159069fd44aaace9f7.tar tangerine-wallet-browser-0497d209b2adb4ac026a54159069fd44aaace9f7.tar.gz tangerine-wallet-browser-0497d209b2adb4ac026a54159069fd44aaace9f7.tar.bz2 tangerine-wallet-browser-0497d209b2adb4ac026a54159069fd44aaace9f7.tar.lz tangerine-wallet-browser-0497d209b2adb4ac026a54159069fd44aaace9f7.tar.xz tangerine-wallet-browser-0497d209b2adb4ac026a54159069fd44aaace9f7.tar.zst tangerine-wallet-browser-0497d209b2adb4ac026a54159069fd44aaace9f7.zip |
Remove KNOWN_ADDRESS_ERROR from error objects (#6578)
* Remove KNOWN_ADDRESS_ERROR from error objects
* Update test comments
-rw-r--r-- | ui/app/pages/send/send-content/send-to-row/send-to-row.utils.js | 3 | ||||
-rw-r--r-- | ui/app/pages/send/send-content/send-to-row/tests/send-to-row-utils.test.js | 10 |
2 files changed, 6 insertions, 7 deletions
diff --git a/ui/app/pages/send/send-content/send-to-row/send-to-row.utils.js b/ui/app/pages/send/send-content/send-to-row/send-to-row.utils.js index d0a43f086..200a2e26a 100644 --- a/ui/app/pages/send/send-content/send-to-row/send-to-row.utils.js +++ b/ui/app/pages/send/send-content/send-to-row/send-to-row.utils.js @@ -17,9 +17,8 @@ function getToErrorObject (to, toError = null, hasHexData = false, tokens = [], } } else if (!isValidAddress(to, network) && !toError) { toError = isEthNetwork(network) ? INVALID_RECIPIENT_ADDRESS_ERROR : INVALID_RECIPIENT_ADDRESS_NOT_ETH_NETWORK_ERROR - } else if (selectedToken && (ethUtil.toChecksumAddress(to) in contractMap || checkExistingAddresses(to, tokens))) { - toError = KNOWN_RECIPIENT_ADDRESS_ERROR } + return { to: toError } } diff --git a/ui/app/pages/send/send-content/send-to-row/tests/send-to-row-utils.test.js b/ui/app/pages/send/send-content/send-to-row/tests/send-to-row-utils.test.js index f29f5efec..f8a6dd96f 100644 --- a/ui/app/pages/send/send-content/send-to-row/tests/send-to-row-utils.test.js +++ b/ui/app/pages/send/send-content/send-to-row/tests/send-to-row-utils.test.js @@ -55,9 +55,9 @@ describe('send-to-row utils', () => { }) }) - it('should return a known address recipient if to is truthy but part of state tokens', () => { + it('should return null if to is truthy but part of state tokens', () => { assert.deepEqual(getToErrorObject('0xabc123', undefined, false, [{'address': '0xabc123'}], {'address': '0xabc123'}), { - to: KNOWN_RECIPIENT_ADDRESS_ERROR, + to: null, }) }) @@ -67,14 +67,14 @@ describe('send-to-row utils', () => { }) }) - it('should return a known address recipient if to is truthy but part of contract metadata', () => { + it('should return null if to is truthy but part of contract metadata', () => { assert.deepEqual(getToErrorObject('0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359', undefined, false, [{'address': '0xabc123'}], {'address': '0xabc123'}), { - to: KNOWN_RECIPIENT_ADDRESS_ERROR, + to: null, }) }) it('should null if to is truthy part of contract metadata but selectedToken falsy', () => { assert.deepEqual(getToErrorObject('0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359', undefined, false, [{'address': '0xabc123'}], {'address': '0xabc123'}), { - to: KNOWN_RECIPIENT_ADDRESS_ERROR, + to: null, }) }) }) |