1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-27 21:00:13 +01:00
metamask-extension/ui/app/components/send_/send-content/send-to-row/send-to-row.utils.js

22 lines
410 B
JavaScript

const {
REQUIRED_ERROR,
INVALID_RECIPIENT_ADDRESS_ERROR,
} = require('../../send.constants')
const { isValidAddress } = require('../../../../util')
function getToErrorObject (to) {
let toError = null
if (!to) {
toError = REQUIRED_ERROR
} else if (!isValidAddress(to)) {
toError = INVALID_RECIPIENT_ADDRESS_ERROR
}
return { to: toError }
}
module.exports = {
getToErrorObject,
}