1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-24 12:23:39 +02:00
metamask-extension/ui/app/components/send/send-content/send-to-row/send-to-row.utils.js

20 lines
412 B
JavaScript
Raw Normal View History

const {
REQUIRED_ERROR,
INVALID_RECIPIENT_ADDRESS_ERROR,
} = require('../../send.constants')
2018-04-07 00:29:51 +02:00
const { isValidAddress } = require('../../../../util')
function getToErrorObject (to, toError = null) {
2018-04-07 00:29:51 +02:00
if (!to) {
toError = REQUIRED_ERROR
} else if (!isValidAddress(to) && !toError) {
toError = INVALID_RECIPIENT_ADDRESS_ERROR
2018-04-07 00:29:51 +02:00
}
2018-04-07 00:29:51 +02:00
return { to: toError }
}
module.exports = {
getToErrorObject,
2018-04-07 00:29:51 +02:00
}