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

bump ocean.js & react hooks (#327)

* bump ocean.js

* adapt changes

* bump @oceanprotocol/react

* edit metadata tweaks
This commit is contained in:
Matthias Kretschmann 2021-01-19 14:34:52 +01:00 committed by GitHub
parent 07f30108a7
commit b3b2ea9777
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 18 deletions

14
package-lock.json generated
View File

@ -3736,9 +3736,9 @@
"integrity": "sha512-yoGk4kpTy9E06OWusd3Fa/W3yjmFNKND/I92YtmrMnX0i3gm/kom/Z7XrRiAHVC8JVnM9Q79FojGLd2eOL4opg=="
},
"@oceanprotocol/lib": {
"version": "0.9.21",
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.9.21.tgz",
"integrity": "sha512-Bo+xJeFXOMfqof0GA5B07wWkBJ9S/v646zrUGuVIZ7nmwnGR8ba5Sr3lznpz7JIvmIpSNsKkXXWwwsRtZeeA1w==",
"version": "0.10.0",
"resolved": "https://registry.npmjs.org/@oceanprotocol/lib/-/lib-0.10.0.tgz",
"integrity": "sha512-ibsdyCS3ROUMShznaSvThHuTaGxKXCMedZfkvkFY1iFJvUL8HgJ0V6kRINNZDamj8AxLjEI1uV1QA3UTB8qkJA==",
"requires": {
"@ethereum-navigator/navigator": "^0.5.2",
"@oceanprotocol/contracts": "^0.5.8",
@ -3760,11 +3760,11 @@
}
},
"@oceanprotocol/react": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/@oceanprotocol/react/-/react-0.4.1.tgz",
"integrity": "sha512-nPrmtv0nKLsXshxoOHN4ls2Cy7R3xchkqNJhNt5DPKGTj7YnMZvqa1UAoYB+5tqUNPC/irZc2+RsyHbyuhPqcg==",
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/@oceanprotocol/react/-/react-0.5.0.tgz",
"integrity": "sha512-T+osx49SHebBC0j0HR62uXRhB2GoYnxHSbQiEdVxlLp/D4s0ey4GzNkVSNi0Dr4GuVZyactJuF3JfUbKhzuJZg==",
"requires": {
"@oceanprotocol/lib": "^0.9.21",
"@oceanprotocol/lib": "^0.10.0",
"axios": "^0.21.1",
"decimal.js": "^10.2.1",
"web3": "1.3.1",

View File

@ -24,8 +24,8 @@
"@coingecko/cryptoformat": "^0.4.2",
"@loadable/component": "^5.14.1",
"@oceanprotocol/art": "^3.0.0",
"@oceanprotocol/lib": "^0.9.21",
"@oceanprotocol/react": "^0.4.1",
"@oceanprotocol/lib": "^0.10.0",
"@oceanprotocol/react": "^0.5.0",
"@oceanprotocol/typographies": "^0.1.0",
"@sindresorhus/slugify": "^1.0.0",
"@tippyjs/react": "^4.2.0",

View File

@ -55,8 +55,8 @@ export default function Edit({
const content = data.content.edges[0].node.childPagesJson
const { debug } = useUserPreferences()
const { ocean, account } = useOcean()
const { did, metadata, ddo, refreshDdo } = useAsset()
const { ocean, accountId } = useOcean()
const { metadata, ddo, refreshDdo } = useAsset()
const [success, setSuccess] = useState<string>()
const [error, setError] = useState<string>()
@ -67,14 +67,17 @@ export default function Edit({
resetForm: () => void
) {
try {
const ddo = await ocean.assets.editMetadata(
did,
{ title: values.name, description: values.description },
account
)
// Construct new DDO with new values
const newDdo = await ocean.assets.editMetadata(ddo, {
title: values.name,
description: values.description
})
// Update DDO on-chain
const tx = await ocean.assets.updateMetadata(newDdo, accountId)
// Edit failed
if (!ddo) {
if (!newDdo || !tx) {
setError(content.form.error)
Logger.error(content.form.error)
return

View File

@ -75,7 +75,7 @@ export default function ComputeJobs(): ReactElement {
useEffect(() => {
async function getTitle(did: string) {
const ddo = await ocean.metadatacache.retrieveDDO(did)
const ddo = await ocean.metadataCache.retrieveDDO(did)
const metadata = ddo.findServiceByType('metadata')
return metadata.attributes.main.name
}