ss validate boost acts
This commit is contained in:
parent
5f0494de30
commit
d17929f2c5
|
@ -585,17 +585,25 @@ export const amountSchema = object({
|
|||
amount: intValidator.required('required').positive('must be positive')
|
||||
})
|
||||
|
||||
export const boostValidator = intValidator
|
||||
.min(BOOST_MULT, `must be at least ${BOOST_MULT}`).test({
|
||||
name: 'boost',
|
||||
test: async boost => boost % BOOST_MULT === 0,
|
||||
message: `must be divisble be ${BOOST_MULT}`
|
||||
})
|
||||
|
||||
export const boostSchema = object({
|
||||
amount: intValidator
|
||||
.min(BOOST_MULT, `must be at least ${BOOST_MULT}`).test({
|
||||
name: 'boost',
|
||||
test: async boost => boost % BOOST_MULT === 0,
|
||||
message: `must be divisble be ${BOOST_MULT}`
|
||||
})
|
||||
amount: boostValidator.required('required').positive('must be positive')
|
||||
})
|
||||
|
||||
export const actSchema = object({
|
||||
sats: intValidator.required('required').positive('must be positive'),
|
||||
sats: intValidator.required('required').positive('must be positive')
|
||||
.when(['act'], ([act], schema) => {
|
||||
if (act === 'BOOST') {
|
||||
return boostValidator
|
||||
}
|
||||
return schema
|
||||
}),
|
||||
act: string().required('required').oneOf(['TIP', 'DONT_LIKE_THIS', 'BOOST'])
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue