From d0c65a693595b0f69e351424760325ea6c44c5c2 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 26 Oct 2020 15:15:01 +0100 Subject: [PATCH 1/8] price refactor --- .../Pricing/FormPricing/Dynamic.tsx | 8 ++++ .../Pricing/FormPricing/Fixed.module.css | 45 ------------------- .../Pricing/FormPricing/Fixed.tsx | 36 +-------------- .../Pricing/FormPricing/Price.module.css | 44 ++++++++++++++++++ .../Pricing/FormPricing/Price.tsx | 37 +++++++++++++++ .../organisms/AssetContent/index.tsx | 3 +- 6 files changed, 93 insertions(+), 80 deletions(-) create mode 100644 src/components/organisms/AssetContent/Pricing/FormPricing/Price.module.css create mode 100644 src/components/organisms/AssetContent/Pricing/FormPricing/Price.tsx diff --git a/src/components/organisms/AssetContent/Pricing/FormPricing/Dynamic.tsx b/src/components/organisms/AssetContent/Pricing/FormPricing/Dynamic.tsx index bedc0be8f..88a4ec6f3 100644 --- a/src/components/organisms/AssetContent/Pricing/FormPricing/Dynamic.tsx +++ b/src/components/organisms/AssetContent/Pricing/FormPricing/Dynamic.tsx @@ -12,6 +12,8 @@ import stylesIndex from './index.module.css' import { useFormikContext } from 'formik' import { PriceOptionsMarket } from '../../../../../@types/MetaData' import { DDO } from '@oceanprotocol/lib' +import Fixed from './Fixed' +import Price from './Price' export default function Dynamic({ ddo, @@ -68,6 +70,12 @@ export default function Dynamic({ +

+ Price +

+ + +

Datatoken Liquidity Pool

diff --git a/src/components/organisms/AssetContent/Pricing/FormPricing/Fixed.module.css b/src/components/organisms/AssetContent/Pricing/FormPricing/Fixed.module.css index 9cfadcde8..c96e35d5a 100644 --- a/src/components/organisms/AssetContent/Pricing/FormPricing/Fixed.module.css +++ b/src/components/organisms/AssetContent/Pricing/FormPricing/Fixed.module.css @@ -1,48 +1,3 @@ .fixed { composes: content from './index.module.css'; } - -.form { - position: relative; -} - -@media (min-width: 55rem) { - .form { - max-width: 12rem; - margin-left: auto; - } -} - -.grid { - margin-left: -2rem; - margin-right: -2rem; - padding-top: var(--spacer); - display: grid; - gap: var(--spacer); - grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); - justify-content: center; - background: var(--brand-grey-dimmed); - border-top: 1px solid var(--brand-grey-lighter); - border-bottom: 1px solid var(--brand-grey-lighter); -} - -.fixed label { - display: none; -} - -.datatoken { - margin-top: calc(var(--spacer) / 2); - color: var(--color-secondary); - font-size: var(--font-size-small); - font-weight: var(--font-weight-bold); -} - -.datatoken h4 { - font-size: var(--font-size-base); - color: var(--color-secondary); - margin: 0; -} - -.datatoken strong { - color: var(--brand-grey-dark); -} diff --git a/src/components/organisms/AssetContent/Pricing/FormPricing/Fixed.tsx b/src/components/organisms/AssetContent/Pricing/FormPricing/Fixed.tsx index 2fcf55ad1..33d6c2e71 100644 --- a/src/components/organisms/AssetContent/Pricing/FormPricing/Fixed.tsx +++ b/src/components/organisms/AssetContent/Pricing/FormPricing/Fixed.tsx @@ -2,12 +2,8 @@ import React, { ReactElement } from 'react' import stylesIndex from './index.module.css' import styles from './Fixed.module.css' import FormHelp from '../../../../atoms/Input/Help' -import Conversion from '../../../../atoms/Price/Conversion' -import { useField } from 'formik' -import Input from '../../../../atoms/Input' -import Error from './Error' import { DDO } from '@oceanprotocol/lib' -import { usePricing } from '@oceanprotocol/react' +import Price from './Price' export default function Fixed({ ddo, @@ -16,38 +12,10 @@ export default function Fixed({ ddo: DDO content: any }): ReactElement { - const [field, meta] = useField('price') - const { dtName, dtSymbol } = usePricing(ddo) - return (
{content.info} - -
-
- - } - /> - -
-
-

- = 1 {dtName} — {dtSymbol} -

-
-
+
) } diff --git a/src/components/organisms/AssetContent/Pricing/FormPricing/Price.module.css b/src/components/organisms/AssetContent/Pricing/FormPricing/Price.module.css new file mode 100644 index 000000000..a93ba553f --- /dev/null +++ b/src/components/organisms/AssetContent/Pricing/FormPricing/Price.module.css @@ -0,0 +1,44 @@ +.form { + position: relative; +} + +@media (min-width: 55rem) { + .form { + max-width: 12rem; + margin-left: auto; + } +} + +.grid { + margin-left: -2rem; + margin-right: -2rem; + padding-top: var(--spacer); + display: grid; + gap: var(--spacer); + grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); + justify-content: center; + background: var(--brand-grey-dimmed); + border-top: 1px solid var(--brand-grey-lighter); + border-bottom: 1px solid var(--brand-grey-lighter); +} + +.fixed label { + display: none; +} + +.datatoken { + margin-top: calc(var(--spacer) / 2); + color: var(--color-secondary); + font-size: var(--font-size-small); + font-weight: var(--font-weight-bold); +} + +.datatoken h4 { + font-size: var(--font-size-base); + color: var(--color-secondary); + margin: 0; +} + +.datatoken strong { + color: var(--brand-grey-dark); +} diff --git a/src/components/organisms/AssetContent/Pricing/FormPricing/Price.tsx b/src/components/organisms/AssetContent/Pricing/FormPricing/Price.tsx new file mode 100644 index 000000000..96ee2eb7c --- /dev/null +++ b/src/components/organisms/AssetContent/Pricing/FormPricing/Price.tsx @@ -0,0 +1,37 @@ +import { usePricing } from '@oceanprotocol/react' +import Conversion from '../../../../atoms/Price/Conversion' +import { useField } from 'formik' +import React, { ReactElement } from 'react' +import Input from '../../../../atoms/Input' +import styles from './Price.module.css' +import Error from './Error' +import { DDO } from '@oceanprotocol/lib' + +export default function Price({ ddo }: { ddo: DDO }): ReactElement { + const [field, meta] = useField('price') + const { dtName, dtSymbol } = usePricing(ddo) + + return ( +
+
+ + } + /> + +
+
+

+ = 1 {dtName} — {dtSymbol} +

+
+
+ ) +} diff --git a/src/components/organisms/AssetContent/index.tsx b/src/components/organisms/AssetContent/index.tsx index 3d3419c12..a9c3f2dc5 100644 --- a/src/components/organisms/AssetContent/index.tsx +++ b/src/components/organisms/AssetContent/index.tsx @@ -30,7 +30,8 @@ export default function AssetContent({ const isOwner = accountId === ddo.publicKey[0].owner const hasNoPrice = ddo.price.type === '' - const showPricing = isOwner && hasNoPrice + // TODO: JUST FOR DEBUGGING + const showPricing = true || (isOwner && hasNoPrice) return (
From c3b4bcec669a3d83a82e5a4595938bc8fe28d647 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 26 Oct 2020 15:19:08 +0100 Subject: [PATCH 2/8] new value: oceanAmount --- src/@types/MetaData.d.ts | 1 + .../organisms/AssetContent/Pricing/FormPricing/Dynamic.tsx | 2 +- .../organisms/AssetContent/Pricing/FormPricing/index.tsx | 6 +++--- src/models/FormPricing.ts | 6 +++++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/@types/MetaData.d.ts b/src/@types/MetaData.d.ts index 0c550d974..8c3ef5567 100644 --- a/src/@types/MetaData.d.ts +++ b/src/@types/MetaData.d.ts @@ -21,6 +21,7 @@ export interface MetadataMarket extends Metadata { export interface PriceOptionsMarket extends PriceOptions { // easier to keep this as number for Yup input validation swapFee: number + oceanAmount: number } export interface MetadataPublishForm { diff --git a/src/components/organisms/AssetContent/Pricing/FormPricing/Dynamic.tsx b/src/components/organisms/AssetContent/Pricing/FormPricing/Dynamic.tsx index 88a4ec6f3..f861db580 100644 --- a/src/components/organisms/AssetContent/Pricing/FormPricing/Dynamic.tsx +++ b/src/components/organisms/AssetContent/Pricing/FormPricing/Dynamic.tsx @@ -82,7 +82,7 @@ export default function Dynamic({
diff --git a/src/components/organisms/AssetContent/Pricing/FormPricing/index.tsx b/src/components/organisms/AssetContent/Pricing/FormPricing/index.tsx index 811494574..287a5c2bb 100644 --- a/src/components/organisms/AssetContent/Pricing/FormPricing/index.tsx +++ b/src/components/organisms/AssetContent/Pricing/FormPricing/index.tsx @@ -23,7 +23,7 @@ export default function FormPricing({ // Connect with form const { values, setFieldValue, submitForm } = useFormikContext() - const { price, weightOnDataToken, type } = values as PriceOptionsMarket + const { oceanAmount, weightOnDataToken, type } = values as PriceOptionsMarket // Switch type value upon tab change function handleTabChange(tabName: string) { @@ -33,9 +33,9 @@ export default function FormPricing({ // Always update everything when price value changes useEffect(() => { - const dtAmount = Number(price) * Number(weightOnDataToken) + const dtAmount = Number(oceanAmount) * Number(weightOnDataToken) setFieldValue('dtAmount', dtAmount) - }, [price, weightOnDataToken]) + }, [oceanAmount, weightOnDataToken]) const tabs = [ { diff --git a/src/models/FormPricing.ts b/src/models/FormPricing.ts index 5964b2531..32db8011a 100644 --- a/src/models/FormPricing.ts +++ b/src/models/FormPricing.ts @@ -4,6 +4,9 @@ import * as Yup from 'yup' export const validationSchema = Yup.object().shape({ price: Yup.number().min(1, 'Must be greater than 0').required('Required'), dtAmount: Yup.number().min(1, 'Must be greater than 0').required('Required'), + oceanAmount: Yup.number() + .min(1, 'Must be greater than 0') + .required('Required'), type: Yup.string() .matches(/fixed|dynamic/g) .required('Required'), @@ -18,7 +21,8 @@ export const validationSchema = Yup.object().shape({ export const initialValues: PriceOptionsMarket = { price: 1, type: 'dynamic', - dtAmount: 1, + dtAmount: 9, + oceanAmount: 1, weightOnDataToken: '9', // 90% on data token swapFee: 0.1 // in % } From 8a8484deb3cd0d5f93c429df018382a1732a4c75 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 26 Oct 2020 15:56:52 +0100 Subject: [PATCH 3/8] bump libraries --- package-lock.json | 42 +++++++++++-------- package.json | 6 +-- src/@types/MetaData.d.ts | 1 - .../Pricing/FormPricing/index.tsx | 12 +++++- 4 files changed, 38 insertions(+), 23 deletions(-) diff --git a/package-lock.json b/package-lock.json index cb49b17b2..c719f4f7a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3850,9 +3850,9 @@ "integrity": "sha512-p0oOHXr60hXZuLNsQ/PsOQtCfia79thm7MjPxTrnnBvD+csJoHzARYMB0IFj/KTw6U5vLXODgjJAn8x6QksLwg==" }, "@oceanprotocol/lib": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.8.0.tgz", - "integrity": "sha512-FZALOw3LMAPo2US+YjJv5Fkz7IDS9m89PZzF7uKZKYT8V3xB/m0PV91vV1pEPC0eVWk3Sl1IXyT0L3ASFEUjvg==", + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.9.0.tgz", + "integrity": "sha512-BI00ZXTdGXJZNTJhwtqsnXjKtlcl1PXB18e26aCo5g1VT9S19urPLT04k9Zkz4k+3HepSc5QdOu+yo47MS1I7g==", "requires": { "@ethereum-navigator/navigator": "^0.5.0", "@oceanprotocol/contracts": "^0.5.7", @@ -3867,12 +3867,12 @@ } }, "@oceanprotocol/react": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/@oceanprotocol/react/-/react-0.3.8.tgz", - "integrity": "sha512-cbijintJy5Cg5/FFhLNfgIgmxRHCDZnv9zoMOeQJE28fwG/jOAkU+r3G4OK0EvFm9BXDsBxqoZxOO6Eb1EpV6w==", + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@oceanprotocol/react/-/react-0.3.9.tgz", + "integrity": "sha512-qsaQVSQtHL+5QoknrVuJOdRr2mQ+2An368yNYzsMbxaAKp6HJ7b3p9bfqV0WQqaMA10GqTyfUi1GUJq630h9DA==", "requires": { - "@oceanprotocol/lib": "^0.8.0", - "axios": "^0.20.0", + "@oceanprotocol/lib": "^0.9.0", + "axios": "^0.21.0", "decimal.js": "^10.2.1", "web3": "^1.3.0", "web3modal": "^1.9.1" @@ -9105,9 +9105,9 @@ "integrity": "sha512-5P0QZ6J5xGikH780pghEdbEKijCTrruK9KxtPZCFWUpef0f6GipO+xEZ5GKCb020mmqgbiNO6TcA55CriL784Q==" }, "axios": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.20.0.tgz", - "integrity": "sha512-ANA4rr2BDcmmAQLOKft2fufrtuvlqR+cXNNinUmvfeSNCOF98PZL+7M/v1zIdGo7OLjEA9J2gXJL+j4zGsl0bA==", + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.0.tgz", + "integrity": "sha512-fmkJBknJKoZwem3/IKSSLpkdNXZeBu5Q7GA/aRsr2btgrptmSCxi2oFjZHqGdK9DoTil9PIHlPIZw2EcRJXRvw==", "requires": { "follow-redirects": "^1.10.0" } @@ -17246,6 +17246,14 @@ "color-convert": "^2.0.1" } }, + "axios": { + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.20.0.tgz", + "integrity": "sha512-ANA4rr2BDcmmAQLOKft2fufrtuvlqR+cXNNinUmvfeSNCOF98PZL+7M/v1zIdGo7OLjEA9J2gXJL+j4zGsl0bA==", + "requires": { + "follow-redirects": "^1.10.0" + } + }, "cacheable-request": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-2.1.4.tgz", @@ -34833,9 +34841,9 @@ }, "dependencies": { "@types/node": { - "version": "12.19.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.19.0.tgz", - "integrity": "sha512-4BVAE9yp5DU3ISqBInsaRp9J474HWNaNVs8eZ1Far3dI1MwS3Wk0EvBRMM4xBh3Oz+c05hUgJmcbtAVmG8bv7w==" + "version": "12.19.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.19.1.tgz", + "integrity": "sha512-/xaVmBBjOGh55WCqumLAHXU9VhjGtmyTGqJzFBXRWZzByOXI5JAJNx9xPVGEsNizrNwcec92fQMj458MWfjN1A==" } } }, @@ -35033,9 +35041,9 @@ }, "dependencies": { "@types/node": { - "version": "12.19.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.19.0.tgz", - "integrity": "sha512-4BVAE9yp5DU3ISqBInsaRp9J474HWNaNVs8eZ1Far3dI1MwS3Wk0EvBRMM4xBh3Oz+c05hUgJmcbtAVmG8bv7w==" + "version": "12.19.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.19.1.tgz", + "integrity": "sha512-/xaVmBBjOGh55WCqumLAHXU9VhjGtmyTGqJzFBXRWZzByOXI5JAJNx9xPVGEsNizrNwcec92fQMj458MWfjN1A==" } } }, diff --git a/package.json b/package.json index 3a0c1f7ca..ecab63a4c 100644 --- a/package.json +++ b/package.json @@ -22,8 +22,8 @@ "@coingecko/cryptoformat": "^0.4.2", "@loadable/component": "5.13.1", "@oceanprotocol/art": "^3.0.0", - "@oceanprotocol/lib": "^0.8.0", - "@oceanprotocol/react": "^0.3.8", + "@oceanprotocol/lib": "^0.9.0", + "@oceanprotocol/react": "^0.3.9", "@oceanprotocol/typographies": "^0.1.0", "@sindresorhus/slugify": "^1.0.0", "@tippyjs/react": "^4.2.0", @@ -31,7 +31,7 @@ "@types/classnames": "^2.2.10", "@vercel/node": "^1.8.4", "@walletconnect/web3-provider": "^1.3.1", - "axios": "^0.20.0", + "axios": "^0.21.0", "classnames": "^2.2.6", "date-fns": "^2.16.1", "decimal.js": "^10.2.1", diff --git a/src/@types/MetaData.d.ts b/src/@types/MetaData.d.ts index 8c3ef5567..0c550d974 100644 --- a/src/@types/MetaData.d.ts +++ b/src/@types/MetaData.d.ts @@ -21,7 +21,6 @@ export interface MetadataMarket extends Metadata { export interface PriceOptionsMarket extends PriceOptions { // easier to keep this as number for Yup input validation swapFee: number - oceanAmount: number } export interface MetadataPublishForm { diff --git a/src/components/organisms/AssetContent/Pricing/FormPricing/index.tsx b/src/components/organisms/AssetContent/Pricing/FormPricing/index.tsx index 287a5c2bb..ab774600d 100644 --- a/src/components/organisms/AssetContent/Pricing/FormPricing/index.tsx +++ b/src/components/organisms/AssetContent/Pricing/FormPricing/index.tsx @@ -23,7 +23,12 @@ export default function FormPricing({ // Connect with form const { values, setFieldValue, submitForm } = useFormikContext() - const { oceanAmount, weightOnDataToken, type } = values as PriceOptionsMarket + const { + price, + oceanAmount, + weightOnDataToken, + type + } = values as PriceOptionsMarket // Switch type value upon tab change function handleTabChange(tabName: string) { @@ -33,7 +38,10 @@ export default function FormPricing({ // Always update everything when price value changes useEffect(() => { - const dtAmount = Number(oceanAmount) * Number(weightOnDataToken) + const dtAmount = + (Number(oceanAmount) / Number(weightOnOcean) / price) * + Number(weightOnDataToken) + setFieldValue('dtAmount', dtAmount) }, [oceanAmount, weightOnDataToken]) From 04e8352dd0d3f63a11f3370fb418cffae948e337 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 26 Oct 2020 16:00:19 +0100 Subject: [PATCH 4/8] calculations --- .../organisms/AssetContent/Pricing/FormPricing/index.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/organisms/AssetContent/Pricing/FormPricing/index.tsx b/src/components/organisms/AssetContent/Pricing/FormPricing/index.tsx index ab774600d..0d6da505a 100644 --- a/src/components/organisms/AssetContent/Pricing/FormPricing/index.tsx +++ b/src/components/organisms/AssetContent/Pricing/FormPricing/index.tsx @@ -38,12 +38,13 @@ export default function FormPricing({ // Always update everything when price value changes useEffect(() => { + // with `weightOnDataToken` we assume it's measured against 1 OCEAN + const weightOnOcean = 1 const dtAmount = - (Number(oceanAmount) / Number(weightOnOcean) / price) * - Number(weightOnDataToken) + (Number(oceanAmount) / weightOnOcean / price) * Number(weightOnDataToken) setFieldValue('dtAmount', dtAmount) - }, [oceanAmount, weightOnDataToken]) + }, [price, oceanAmount, weightOnDataToken]) const tabs = [ { From ef335ff8500b62ad7172af518a32ce997a94226b Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 26 Oct 2020 16:40:18 +0100 Subject: [PATCH 5/8] introduce weightOnOcean --- src/@types/MetaData.d.ts | 1 + .../AssetContent/Pricing/FormPricing/Dynamic.tsx | 8 ++++++-- .../organisms/AssetContent/Pricing/FormPricing/index.tsx | 8 ++++---- src/models/FormPricing.ts | 4 +++- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/@types/MetaData.d.ts b/src/@types/MetaData.d.ts index 0c550d974..16109a8de 100644 --- a/src/@types/MetaData.d.ts +++ b/src/@types/MetaData.d.ts @@ -19,6 +19,7 @@ export interface MetadataMarket extends Metadata { } export interface PriceOptionsMarket extends PriceOptions { + weightOnOcean: string // easier to keep this as number for Yup input validation swapFee: number } diff --git a/src/components/organisms/AssetContent/Pricing/FormPricing/Dynamic.tsx b/src/components/organisms/AssetContent/Pricing/FormPricing/Dynamic.tsx index f861db580..d9ef17c47 100644 --- a/src/components/organisms/AssetContent/Pricing/FormPricing/Dynamic.tsx +++ b/src/components/organisms/AssetContent/Pricing/FormPricing/Dynamic.tsx @@ -27,7 +27,11 @@ export default function Dynamic({ // Connect with form const { values } = useFormikContext() - const { price, weightOnDataToken } = values as PriceOptionsMarket + const { + price, + weightOnDataToken, + weightOnOcean + } = values as PriceOptionsMarket const [error, setError] = useState() @@ -84,7 +88,7 @@ export default function Dynamic({ { - // with `weightOnDataToken` we assume it's measured against 1 OCEAN - const weightOnOcean = 1 const dtAmount = - (Number(oceanAmount) / weightOnOcean / price) * Number(weightOnDataToken) + (Number(oceanAmount) / Number(weightOnOcean) / price) * + Number(weightOnDataToken) setFieldValue('dtAmount', dtAmount) - }, [price, oceanAmount, weightOnDataToken]) + }, [price, oceanAmount, weightOnOcean, weightOnDataToken]) const tabs = [ { diff --git a/src/models/FormPricing.ts b/src/models/FormPricing.ts index 32db8011a..6d3c7e33d 100644 --- a/src/models/FormPricing.ts +++ b/src/models/FormPricing.ts @@ -11,6 +11,7 @@ export const validationSchema = Yup.object().shape({ .matches(/fixed|dynamic/g) .required('Required'), weightOnDataToken: Yup.string().required('Required'), + weightOnOcean: Yup.string().required('Required'), swapFee: Yup.number() .min(0.1, 'Must be more or equal to 0.1') .max(10, 'Maximum is 10%') @@ -23,6 +24,7 @@ export const initialValues: PriceOptionsMarket = { type: 'dynamic', dtAmount: 9, oceanAmount: 1, - weightOnDataToken: '9', // 90% on data token + weightOnOcean: '1', // 10% on OCEAN + weightOnDataToken: '9', // 90% on datatoken swapFee: 0.1 // in % } From a064e951c9d40a0a21b632161fdab342d8323376 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 26 Oct 2020 17:00:31 +0100 Subject: [PATCH 6/8] enforce min dtAmount --- src/models/FormPricing.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/models/FormPricing.ts b/src/models/FormPricing.ts index 6d3c7e33d..faf794eb5 100644 --- a/src/models/FormPricing.ts +++ b/src/models/FormPricing.ts @@ -2,8 +2,8 @@ import { PriceOptionsMarket } from '../@types/MetaData' import * as Yup from 'yup' export const validationSchema = Yup.object().shape({ - price: Yup.number().min(1, 'Must be greater than 0').required('Required'), - dtAmount: Yup.number().min(1, 'Must be greater than 0').required('Required'), + price: Yup.number().min(1, 'Must be greater than 1').required('Required'), + dtAmount: Yup.number().min(9, 'Must be greater than 9').required('Required'), oceanAmount: Yup.number() .min(1, 'Must be greater than 0') .required('Required'), From 9dda9eadf8f823b5f618029fd054dbe07ceb4693 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 26 Oct 2020 17:08:37 +0100 Subject: [PATCH 7/8] fee fix --- .../organisms/AssetContent/Pricing/FormPricing/Fees.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/organisms/AssetContent/Pricing/FormPricing/Fees.tsx b/src/components/organisms/AssetContent/Pricing/FormPricing/Fees.tsx index 3195c8367..bab7da623 100644 --- a/src/components/organisms/AssetContent/Pricing/FormPricing/Fees.tsx +++ b/src/components/organisms/AssetContent/Pricing/FormPricing/Fees.tsx @@ -49,7 +49,7 @@ export default function Fees({ type="number" postfix="%" min="0.1" - max="0.9" + max="10" step="0.1" small {...field} From 0b5e7f27d28a22adc21ba0802ba0365018bafd13 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 26 Oct 2020 17:41:27 +0100 Subject: [PATCH 8/8] remove debug --- src/components/organisms/AssetContent/index.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/organisms/AssetContent/index.tsx b/src/components/organisms/AssetContent/index.tsx index a9c3f2dc5..3d3419c12 100644 --- a/src/components/organisms/AssetContent/index.tsx +++ b/src/components/organisms/AssetContent/index.tsx @@ -30,8 +30,7 @@ export default function AssetContent({ const isOwner = accountId === ddo.publicKey[0].owner const hasNoPrice = ddo.price.type === '' - // TODO: JUST FOR DEBUGGING - const showPricing = true || (isOwner && hasNoPrice) + const showPricing = isOwner && hasNoPrice return (