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

publish updates

This commit is contained in:
Matthias Kretschmann 2020-09-09 14:35:56 +02:00
parent b09e3acb12
commit b154cfc2ac
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 654 additions and 325 deletions

933
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -22,14 +22,14 @@
"@coingecko/cryptoformat": "^0.4.0",
"@loadable/component": "^5.13.1",
"@oceanprotocol/art": "^3.0.0",
"@oceanprotocol/lib": "^0.2.1",
"@oceanprotocol/lib": "^0.2.2",
"@oceanprotocol/react": "^0.0.41",
"@oceanprotocol/typographies": "^0.1.0",
"@sindresorhus/slugify": "^1.0.0",
"@tippyjs/react": "^4.1.0",
"@toruslabs/torus-embed": "^1.8.3",
"@types/classnames": "^2.2.10",
"@vercel/node": "^1.8.1",
"@vercel/node": "^1.8.2",
"@walletconnect/web3-provider": "^1.2.2",
"axios": "^0.20.0",
"classnames": "^2.2.6",
@ -39,18 +39,18 @@
"ethereum-blockies": "github:MyEtherWallet/blockies",
"filesize": "^6.1.0",
"formik": "^2.1.5",
"gatsby": "^2.24.54",
"gatsby": "^2.24.55",
"gatsby-image": "^2.4.17",
"gatsby-plugin-manifest": "^2.4.28",
"gatsby-plugin-react-helmet": "^3.3.10",
"gatsby-plugin-remove-trailing-slashes": "^2.3.11",
"gatsby-plugin-sharp": "^2.6.32",
"gatsby-plugin-sharp": "^2.6.33",
"gatsby-plugin-svgr": "^2.0.2",
"gatsby-plugin-webpack-size": "^1.0.0",
"gatsby-source-filesystem": "^2.3.28",
"gatsby-source-graphql": "^2.7.2",
"gatsby-source-graphql": "^2.7.3",
"gatsby-transformer-json": "^2.4.11",
"gatsby-transformer-remark": "^2.8.33",
"gatsby-transformer-remark": "^2.8.34",
"gatsby-transformer-sharp": "^2.5.14",
"intersection-observer": "^0.11.0",
"is-url-superb": "^4.0.0",
@ -62,7 +62,7 @@
"react-datepicker": "^3.1.3",
"react-dom": "^16.13.1",
"react-dotdotdot": "^1.3.1",
"react-dropzone": "^11.0.3",
"react-dropzone": "^11.1.0",
"react-helmet": "^6.1.0",
"react-markdown": "^4.3.1",
"react-paginate": "^6.4.0",

View File

@ -2,7 +2,7 @@ import React, { ReactElement } from 'react'
import { useNavigate } from '@reach/router'
import { toast } from 'react-toastify'
import { Formik } from 'formik'
import { usePublish, useOcean } from '@oceanprotocol/react'
import { usePublish, useOcean, PriceOptions } from '@oceanprotocol/react'
import styles from './index.module.css'
import PublishForm from './PublishForm'
import Web3Feedback from '../../molecules/Wallet/Feedback'
@ -19,7 +19,6 @@ export default function PublishPage({
content: { form: FormContent }
}): ReactElement {
const { marketFeeAddress, marketFeeAmount } = useSiteMetadata()
const { accountId, ocean } = useOcean()
const { publish, publishError, isLoading, publishStepText } = usePublish()
const navigate = useNavigate()
@ -28,35 +27,18 @@ export default function PublishPage({
resetForm: () => void
): Promise<void> {
const metadata = transformPublishFormToMetadata(values)
const {
tokensToMint,
type,
weightOnDataToken,
liquidityProviderFee
} = values.price
const priceOptions = values.price
const serviceType = values.access === 'Download' ? 'access' : 'compute'
try {
// mpAddress and mpFee are not yet implemented in ocean js so are not uset
// mpAddress and mpFee are not yet implemented in ocean js so are not used
const ddo = await publish(
metadata as any,
tokensToMint.toString(),
serviceType,
marketFeeAddress,
marketFeeAmount
priceOptions,
serviceType
// marketFeeAddress,
// marketFeeAmount
)
switch (type) {
case 'advanced': {
// weight is hardcoded at 9 (90%) and publisher fee at 0.03(this was a random value set by me)
const pool = await ocean.pool.createDTPool(
accountId,
ddo.dataToken,
tokensToMint.toString(),
weightOnDataToken,
liquidityProviderFee
)
}
}
if (publishError) {
toast.error(publishError)