validation

This commit is contained in:
Daniel Lugo 2020-08-21 14:16:39 -04:00
parent 079c13c9a1
commit f17102de9e

View file

@ -1174,6 +1174,22 @@ module.exports = async (
}) })
} }
const amount = Number(amt)
if (!isARealUsableNumber(amount)) {
return res.status(400).json({
field: 'amt',
errorMessage: 'Not an usable number'
})
}
if (amount < 1) {
return res.status(400).json({
field: 'amt',
errorMessage: 'Must be 1 or greater.'
})
}
return res return res
.status(200) .status(200)
.json(await GunActions.sendSpontaneousPayment(to, amt, memo, feeLimit)) .json(await GunActions.sendSpontaneousPayment(to, amt, memo, feeLimit))