validation
This commit is contained in:
parent
5532fbdb0f
commit
54bf1197e2
2 changed files with 20 additions and 2 deletions
|
|
@ -1190,6 +1190,20 @@ module.exports = async (
|
|||
})
|
||||
}
|
||||
|
||||
if (!isARealUsableNumber(feeLimit)) {
|
||||
return res.status(400).json({
|
||||
field: 'feeLimit',
|
||||
errorMessage: 'Not an usable number'
|
||||
})
|
||||
}
|
||||
|
||||
if (feeLimit < 1) {
|
||||
return res.status(400).json({
|
||||
field: 'feeLimit',
|
||||
errorMessage: 'Must be 1 or greater.'
|
||||
})
|
||||
}
|
||||
|
||||
return res
|
||||
.status(200)
|
||||
.json(await GunActions.sendSpontaneousPayment(to, amt, memo, feeLimit))
|
||||
|
|
|
|||
|
|
@ -284,7 +284,9 @@ const sendPaymentV2Keysend = params => {
|
|||
} = params
|
||||
|
||||
if (!isValidSendPaymentKeysendParams(params)) {
|
||||
throw new TypeError('Invalid SendPaymentKeysendParams')
|
||||
throw new TypeError(
|
||||
`Invalid SendPaymentKeysendParams: ${JSON.stringify(params)}`
|
||||
)
|
||||
}
|
||||
|
||||
const preimage = Crypto.randomBytes(32)
|
||||
|
|
@ -321,7 +323,9 @@ const sendPaymentV2Invoice = params => {
|
|||
} = params
|
||||
|
||||
if (!isValidSendPaymentInvoiceParams(params)) {
|
||||
throw new TypeError('Invalid SendPaymentInvoiceParams')
|
||||
throw new TypeError(
|
||||
`Invalid SendPaymentInvoiceParams: ${JSON.stringify(params)}`
|
||||
)
|
||||
}
|
||||
|
||||
return sendPaymentV2({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue