mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
* Free Pricing Option at create Pricing (#621) * Free Pricing Option + env var toggle * Create Pricing step msg * Default 'allowFreePricing' to true temp for review * Fix price 0 on free tab * Attempt fix useSiteMetadata * Fix linting * Feature/free price support consume compute (#654) * Update fetch free price * Feedback change UI remove 0's * update button msg && fix * compute algorithm list show 'Free' instead of '0' * updateMetadata() v3 workaround solution for free pricing (#677) * compute algorithm list show 'Free' instead of '0' * workaround editMetaData free price * utils function for compute & download * `allowFreePricing` default to false
36 lines
1.1 KiB
TypeScript
36 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|free/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 %
|
|
}
|