1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-16 02:04:54 +01:00

update hooks and publish

This commit is contained in:
mihaisc 2020-08-05 12:22:39 +03:00
parent a13a54d514
commit d85be21b87
3 changed files with 40 additions and 12 deletions

32
package-lock.json generated
View File

@ -3608,14 +3608,35 @@
} }
}, },
"@oceanprotocol/react": { "@oceanprotocol/react": {
"version": "0.0.30", "version": "0.0.31",
"resolved": "https://registry.npmjs.org/@oceanprotocol/react/-/react-0.0.30.tgz", "resolved": "https://registry.npmjs.org/@oceanprotocol/react/-/react-0.0.31.tgz",
"integrity": "sha512-qrkKZ8xQ44UDNy3rrtyRZL/Mu8zH57jMT21RL7s67jExy42sB0pF6NvyCJ5NXwCVT5uZgf7+g4E5309Rpdk6/A==", "integrity": "sha512-BzgBhP2zjhTT69JkHY64oSTdjGqdQyRByg3jvy4WyuJrqf0r6oTGqTRPQjqT9vWxvQ2qaDZUQgkGLXhnmKYeJw==",
"requires": { "requires": {
"@oceanprotocol/lib": "^0.1.10", "@oceanprotocol/lib": "^0.1.11",
"axios": "^0.19.2", "axios": "^0.19.2",
"decimal.js": "^10.2.0",
"web3": "^1.2.11", "web3": "^1.2.11",
"web3modal": "^1.9.0" "web3modal": "^1.9.0"
},
"dependencies": {
"@oceanprotocol/lib": {
"version": "0.1.11",
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.1.11.tgz",
"integrity": "sha512-DvsCWOACxNlsNpGWdbHhKsN2Lj+/B0UAp6l2/29fywFZnFp0mjywKFbhVEY25PGaHZIUG+7YZ0Eot615tKpNjw==",
"requires": {
"@ethereum-navigator/navigator": "^0.5.0",
"@oceanprotocol/contracts": "^0.3.1",
"bignumber.js": "^9.0.0",
"decimal.js": "^10.2.0",
"fs": "0.0.1-security",
"node-fetch": "^2.6.0",
"save-file": "^2.3.1",
"uuid": "^8.2.0",
"web3": "^1.2.9",
"web3-eth-contract": "^1.2.9",
"whatwg-url": "^8.0.0"
}
}
} }
}, },
"@oceanprotocol/typographies": { "@oceanprotocol/typographies": {
@ -10592,8 +10613,7 @@
"decimal.js": { "decimal.js": {
"version": "10.2.0", "version": "10.2.0",
"resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.2.0.tgz", "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.2.0.tgz",
"integrity": "sha512-vDPw+rDgn3bZe1+F/pyEwb1oMG2XTlRVgAa6B4KccTEpYgF8w6eQllVbQcfIJnZyvzFtFpxnpGtx8dd7DJp/Rw==", "integrity": "sha512-vDPw+rDgn3bZe1+F/pyEwb1oMG2XTlRVgAa6B4KccTEpYgF8w6eQllVbQcfIJnZyvzFtFpxnpGtx8dd7DJp/Rw=="
"dev": true
}, },
"decode-uri-component": { "decode-uri-component": {
"version": "0.2.0", "version": "0.2.0",

View File

@ -22,7 +22,7 @@
"@loadable/component": "^5.13.1", "@loadable/component": "^5.13.1",
"@oceanprotocol/art": "^3.0.0", "@oceanprotocol/art": "^3.0.0",
"@oceanprotocol/lib": "^0.1.10", "@oceanprotocol/lib": "^0.1.10",
"@oceanprotocol/react": "^0.0.30", "@oceanprotocol/react": "^0.0.31",
"@oceanprotocol/typographies": "^0.1.0", "@oceanprotocol/typographies": "^0.1.0",
"@sindresorhus/slugify": "^1.0.0", "@sindresorhus/slugify": "^1.0.0",
"@tippyjs/react": "^4.1.0", "@tippyjs/react": "^4.1.0",

View File

@ -2,21 +2,22 @@ import React, { ReactElement } from 'react'
import { useNavigate } from '@reach/router' import { useNavigate } from '@reach/router'
import { toast } from 'react-toastify' import { toast } from 'react-toastify'
import { Formik } from 'formik' import { Formik } from 'formik'
import { usePublish } from '@oceanprotocol/react' import { usePublish, useOcean } from '@oceanprotocol/react'
import styles from './index.module.css' import styles from './index.module.css'
import PublishForm from './PublishForm' import PublishForm from './PublishForm'
import Web3Feedback from '../../molecules/Wallet/Feedback' import Web3Feedback from '../../molecules/Wallet/Feedback'
import { FormContent } from '../../../@types/Form' import { FormContent } from '../../../@types/Form'
import { initialValues, validationSchema } from '../../../models/FormPublish' import { initialValues, validationSchema } from '../../../models/FormPublish'
import { MetadataPublishForm } from '../../../@types/Metadata'
import { transformPublishFormToMetadata } from './utils' import { transformPublishFormToMetadata } from './utils'
import Preview from './Preview' import Preview from './Preview'
import { MetadataPublishForm } from '../../../@types/MetaData'
export default function PublishPage({ export default function PublishPage({
content content
}: { }: {
content: { form: FormContent } content: { form: FormContent }
}): ReactElement { }): ReactElement {
const { accountId, ocean } = useOcean()
const { publish, publishError } = usePublish() const { publish, publishError } = usePublish()
const navigate = useNavigate() const navigate = useNavigate()
@ -40,10 +41,17 @@ export default function PublishPage({
`) `)
try { try {
const ddo = await publish(metadata as any, tokensToMint.toString(), [ // mpAddress and mpFee are not yet implemented in ocean js so are not uset
{ serviceType, cost: cost.toString() } const ddo = await publish(metadata as any, tokensToMint.toString(), serviceType, '','')
])
// create pool for the data token, this is the advanced flow , currently hardcoded
const pool = ocean.pool.createDTPool(
accountId,
ddo.dataToken,
tokensToMint.toString(),
'9',
'0.03'
)
if (publishError) { if (publishError) {
toast.error(publishError) toast.error(publishError)
return null return null