Skip to content

Commit

Permalink
Adding restriction (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
henrypalacios authored Nov 13, 2023
1 parent e04f447 commit a5c76d3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/view/CustomContracts/create/CustomContractsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useParseMetadataField } from '@/hooks/useParseMetadataField'
import { DropZone } from '@/view/components/DropZone'
import { DropzoneWrapper } from '@/view/components/DropZone/DropzoneWrapper'
import { useFormInput } from '@/hooks'
import { notEmpty } from '@/utils/inputValidation'
import { notEmpty, maxLength } from '@/utils/inputValidation'
import { onlyAddress } from '@/utils/blockchain'
import { nameWithTimestamp } from '@/utils/generators'
import { useIsOnChain } from '@/hooks/validationForms/useIsOnChain'
Expand Down Expand Up @@ -36,7 +36,10 @@ export function CustomContractsForm({ network, onCreate }: Props) {
const { isOnChain, contractHash } = useIsOnChain()
const formData = {
address: useFormInput<string>('', [notEmpty, onlyAddress, isOnChain]),
name: useFormInput<string>(nameWithTimestamp('custom'), [notEmpty])
name: useFormInput<string>(nameWithTimestamp('custom'), [
notEmpty,
maxLength
])
}
const anyInvalidField: boolean = Object.values(formData).some(
field => (field.required && !field.value) || field.error !== null
Expand Down

0 comments on commit a5c76d3

Please sign in to comment.