mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
update hooks and publish
This commit is contained in:
parent
a13a54d514
commit
d85be21b87
32
package-lock.json
generated
32
package-lock.json
generated
@ -3608,14 +3608,35 @@
|
||||
}
|
||||
},
|
||||
"@oceanprotocol/react": {
|
||||
"version": "0.0.30",
|
||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/react/-/react-0.0.30.tgz",
|
||||
"integrity": "sha512-qrkKZ8xQ44UDNy3rrtyRZL/Mu8zH57jMT21RL7s67jExy42sB0pF6NvyCJ5NXwCVT5uZgf7+g4E5309Rpdk6/A==",
|
||||
"version": "0.0.31",
|
||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/react/-/react-0.0.31.tgz",
|
||||
"integrity": "sha512-BzgBhP2zjhTT69JkHY64oSTdjGqdQyRByg3jvy4WyuJrqf0r6oTGqTRPQjqT9vWxvQ2qaDZUQgkGLXhnmKYeJw==",
|
||||
"requires": {
|
||||
"@oceanprotocol/lib": "^0.1.10",
|
||||
"@oceanprotocol/lib": "^0.1.11",
|
||||
"axios": "^0.19.2",
|
||||
"decimal.js": "^10.2.0",
|
||||
"web3": "^1.2.11",
|
||||
"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": {
|
||||
@ -10592,8 +10613,7 @@
|
||||
"decimal.js": {
|
||||
"version": "10.2.0",
|
||||
"resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.2.0.tgz",
|
||||
"integrity": "sha512-vDPw+rDgn3bZe1+F/pyEwb1oMG2XTlRVgAa6B4KccTEpYgF8w6eQllVbQcfIJnZyvzFtFpxnpGtx8dd7DJp/Rw==",
|
||||
"dev": true
|
||||
"integrity": "sha512-vDPw+rDgn3bZe1+F/pyEwb1oMG2XTlRVgAa6B4KccTEpYgF8w6eQllVbQcfIJnZyvzFtFpxnpGtx8dd7DJp/Rw=="
|
||||
},
|
||||
"decode-uri-component": {
|
||||
"version": "0.2.0",
|
||||
|
@ -22,7 +22,7 @@
|
||||
"@loadable/component": "^5.13.1",
|
||||
"@oceanprotocol/art": "^3.0.0",
|
||||
"@oceanprotocol/lib": "^0.1.10",
|
||||
"@oceanprotocol/react": "^0.0.30",
|
||||
"@oceanprotocol/react": "^0.0.31",
|
||||
"@oceanprotocol/typographies": "^0.1.0",
|
||||
"@sindresorhus/slugify": "^1.0.0",
|
||||
"@tippyjs/react": "^4.1.0",
|
||||
|
@ -2,21 +2,22 @@ import React, { ReactElement } from 'react'
|
||||
import { useNavigate } from '@reach/router'
|
||||
import { toast } from 'react-toastify'
|
||||
import { Formik } from 'formik'
|
||||
import { usePublish } from '@oceanprotocol/react'
|
||||
import { usePublish, useOcean } from '@oceanprotocol/react'
|
||||
import styles from './index.module.css'
|
||||
import PublishForm from './PublishForm'
|
||||
import Web3Feedback from '../../molecules/Wallet/Feedback'
|
||||
import { FormContent } from '../../../@types/Form'
|
||||
import { initialValues, validationSchema } from '../../../models/FormPublish'
|
||||
import { MetadataPublishForm } from '../../../@types/Metadata'
|
||||
import { transformPublishFormToMetadata } from './utils'
|
||||
import Preview from './Preview'
|
||||
import { MetadataPublishForm } from '../../../@types/MetaData'
|
||||
|
||||
export default function PublishPage({
|
||||
content
|
||||
}: {
|
||||
content: { form: FormContent }
|
||||
}): ReactElement {
|
||||
const { accountId, ocean } = useOcean()
|
||||
const { publish, publishError } = usePublish()
|
||||
const navigate = useNavigate()
|
||||
|
||||
@ -40,10 +41,17 @@ export default function PublishPage({
|
||||
`)
|
||||
|
||||
try {
|
||||
const ddo = await publish(metadata as any, tokensToMint.toString(), [
|
||||
{ serviceType, cost: cost.toString() }
|
||||
])
|
||||
// mpAddress and mpFee are not yet implemented in ocean js so are not uset
|
||||
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) {
|
||||
toast.error(publishError)
|
||||
return null
|
||||
|
Loading…
Reference in New Issue
Block a user