1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-15 09:44:53 +01:00
market/src/models/FormPricing.ts
Matthias Kretschmann b2f1af6e87
package updates and fixes (#296)
* package updates and fixes

* yup update for edit form
2020-12-10 15:28:46 +01:00

37 lines
1.1 KiB
TypeScript

import { PriceOptionsMarket } from '../@types/MetaData'
import * as Yup from 'yup'
export const validationSchema: Yup.SchemaOf<PriceOptionsMarket> = Yup.object().shape(
{
price: Yup.number()
.min(1, (param) => `Must be more or equal to ${param.min}`)
.required('Required'),
dtAmount: Yup.number()
.min(9, (param) => `Must be more or equal to ${param.min}`)
.required('Required'),
oceanAmount: Yup.number()
.min(21, (param) => `Must be more or equal to ${param.min}`)
.required('Required'),
type: Yup.string()
.matches(/fixed|dynamic/g, { excludeEmptyString: true })
.required('Required'),
weightOnDataToken: Yup.string().required('Required'),
weightOnOcean: Yup.string().required('Required'),
swapFee: Yup.number()
.min(0.1, (param) => `Must be more or equal to ${param.min}`)
.max(10, 'Maximum is 10%')
.required('Required')
.nullable()
}
)
export const initialValues: PriceOptionsMarket = {
price: 1,
type: 'dynamic',
dtAmount: 9,
oceanAmount: 21,
weightOnOcean: '7', // 70% on OCEAN
weightOnDataToken: '3', // 30% on datatoken
swapFee: 0.1 // in %
}