fix: maxCjFeeRelInPercent validation

This commit is contained in:
theborakompanioni 2026-05-02 00:22:51 +02:00
parent 3cf02afd16
commit fd819cf8ca
No known key found for this signature in database
GPG key ID: E8070AF0053AAC0D

View file

@ -1,7 +1,7 @@
import type { TFunction } from 'i18next'
import * as yup from 'yup'
import { CJ_FEE_ABS_MAX, CJ_FEE_ABS_MIN, CJ_FEE_REL_MAX, CJ_FEE_REL_MIN } from '@/constants/jam'
import { factorToPercentage, formatSats, isValidInteger } from '@/lib/utils'
import { factorToPercentage, formatSats, isValidInteger, isValidNumber } from '@/lib/utils'
import type { AmountSats } from '@/types/global'
export type CollaboratorFeesFormValues = {
@ -34,7 +34,7 @@ export function createCollaboratorFeesFormSchema({
.required(maxCjFeeAbsoluteMessage),
maxCjFeeRelInPercent: yup
.number()
.transform((value) => (isValidInteger(value) ? value : null))
.transform((value) => (isValidNumber(value) ? value : null))
.min(factorToPercentage(CJ_FEE_REL_MIN), maxCjFeeRelativeMessage)
.max(factorToPercentage(CJ_FEE_REL_MAX), maxCjFeeRelativeMessage)
.required(maxCjFeeRelativeMessage),