diff --git a/ui/app/helpers/utils/util.js b/ui/app/helpers/utils/util.js index 42c88e8d6..64c11a135 100644 --- a/ui/app/helpers/utils/util.js +++ b/ui/app/helpers/utils/util.js @@ -83,6 +83,9 @@ export function isValidAddress(address) { return false; } const prefixed = addHexPrefix(address); + if (!isHex(prefixed)) { + return false; + } return ( (isAllOneCase(prefixed.slice(2)) && ethUtil.isValidAddress(prefixed)) || ethUtil.isValidChecksumAddress(prefixed) diff --git a/ui/app/pages/send/send-content/add-recipient/add-recipient.js b/ui/app/pages/send/send-content/add-recipient/add-recipient.js index a0e05c73c..3ba0077c7 100644 --- a/ui/app/pages/send/send-content/add-recipient/add-recipient.js +++ b/ui/app/pages/send/send-content/add-recipient/add-recipient.js @@ -22,7 +22,7 @@ export function getToErrorObject(to, sendTokenAddress, chainId) { let toError = null; if (!to) { toError = REQUIRED_ERROR; - } else if (!isValidAddress(to)) { + } else if (!isValidAddress(to) && !isValidDomainName(to)) { toError = isDefaultMetaMaskChain(chainId) ? INVALID_RECIPIENT_ADDRESS_ERROR : INVALID_RECIPIENT_ADDRESS_NOT_ETH_NETWORK_ERROR; diff --git a/ui/app/pages/send/send-content/add-recipient/ens-input.component.js b/ui/app/pages/send/send-content/add-recipient/ens-input.component.js index f984f13d8..7d210080f 100644 --- a/ui/app/pages/send/send-content/add-recipient/ens-input.component.js +++ b/ui/app/pages/send/send-content/add-recipient/ens-input.component.js @@ -314,7 +314,7 @@ export default class EnsInput extends Component { } if (ensFailure) { - return ; + return ; } if (ensResolution && ensResolution !== ZERO_ADDRESS) {