1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

more precise parameter name

This commit is contained in:
Matthias Kretschmann 2020-08-05 16:22:51 +02:00
parent 5d11416137
commit 88496489c7
Signed by: m
GPG Key ID: 606EEEF3C479A91F
4 changed files with 8 additions and 8 deletions

View File

@ -25,7 +25,7 @@ export interface MetadataPublishForm {
price: {
tokensToMint: number
type: 'simple' | 'advanced' | string
weight: string
weightOnDataToken: string
ownerFee: string
}
access: 'Download' | 'Compute' | string

View File

@ -8,7 +8,7 @@ import { useField } from 'formik'
export default function Price(props: InputProps): ReactElement {
const [field, meta, helpers] = useField(props)
const { weight } = field.value
const { weightOnDataToken } = field.value
const [ocean, setOcean] = useState('1')
const [tokensToMint, setTokensToMint] = useState<number>()
@ -24,7 +24,7 @@ export default function Price(props: InputProps): ReactElement {
// Always update everything when ocean changes
useEffect(() => {
const tokensToMint = Number(ocean) * Number(weight)
const tokensToMint = Number(ocean) * Number(weightOnDataToken)
setTokensToMint(tokensToMint)
console.log(field.value)
helpers.setValue({ ...field.value, tokensToMint })
@ -41,7 +41,7 @@ export default function Price(props: InputProps): ReactElement {
<Advanced
ocean={ocean}
tokensToMint={tokensToMint}
weightOnDataToken={weight}
weightOnDataToken={weightOnDataToken}
onChange={handleOceanChange}
/>
)

View File

@ -34,7 +34,7 @@ export default function PublishPage({
`)
const metadata = transformPublishFormToMetadata(values)
const { tokensToMint, type, weight, ownerFee } = values.price
const { tokensToMint, type, weightOnDataToken, ownerFee } = values.price
const serviceType = values.access === 'Download' ? 'access' : 'compute'
console.log(`
@ -60,7 +60,7 @@ export default function PublishPage({
accountId,
ddo.dataToken,
tokensToMint.toString(),
weight,
weightOnDataToken,
ownerFee
)
}

View File

@ -11,7 +11,7 @@ export const validationSchema = Yup.object().shape<MetadataPublishForm>({
type: Yup.string()
.matches(/simple|advanced/g)
.required('Required'),
weight: Yup.string().required('Required'),
weightOnDataToken: Yup.string().required('Required'),
ownerFee: Yup.string()
}),
files: Yup.array<FileMetadata>().required('Required').nullable(),
@ -34,7 +34,7 @@ export const initialValues: MetadataPublishForm = {
price: {
type: 'simple',
tokensToMint: 1,
weight: '9', // 90% on data token
weightOnDataToken: '9', // 90% on data token
ownerFee: '0.03' // in %
},
files: undefined,