mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Remove KNOWN_ADDRESS_ERROR from error objects (#6578)
* Remove KNOWN_ADDRESS_ERROR from error objects * Update test comments
This commit is contained in:
parent
7df7f709bf
commit
0497d209b2
@ -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 }
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user