mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-27 21:00:13 +01:00
22 lines
410 B
JavaScript
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,
|
|
}
|