mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
Checking if payment collector address is valid using form validation
This commit is contained in:
parent
11cf51d85b
commit
cbdc81b836
@ -1,5 +1,6 @@
|
|||||||
import { FileInfo } from '@oceanprotocol/lib'
|
import { FileInfo } from '@oceanprotocol/lib'
|
||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
|
import web3 from 'web3'
|
||||||
|
|
||||||
export const validationSchema = Yup.object().shape({
|
export const validationSchema = Yup.object().shape({
|
||||||
name: Yup.string()
|
name: Yup.string()
|
||||||
@ -41,7 +42,14 @@ export const validationSchema = Yup.object().shape({
|
|||||||
.nullable(),
|
.nullable(),
|
||||||
timeout: Yup.string().required('Required'),
|
timeout: Yup.string().required('Required'),
|
||||||
author: Yup.string().nullable(),
|
author: Yup.string().nullable(),
|
||||||
tags: Yup.array<string[]>().nullable()
|
tags: Yup.array<string[]>().nullable(),
|
||||||
|
paymentCollector: Yup.string().test(
|
||||||
|
'ValidAddress',
|
||||||
|
'Must be a valid Ethereum Address.',
|
||||||
|
(value) => {
|
||||||
|
return web3.utils.isAddress(value)
|
||||||
|
}
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
export const computeSettingsValidationSchema = Yup.object().shape({
|
export const computeSettingsValidationSchema = Yup.object().shape({
|
||||||
|
Loading…
Reference in New Issue
Block a user