diff --git a/package-lock.json b/package-lock.json index 05e0ec46d..85a448650 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 2b1c34a6b..d39aa1b42 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/components/organisms/AssetActions/Edit/index.tsx b/src/components/organisms/AssetActions/Edit/index.tsx index b3e1d3e74..6dad1f1c2 100644 --- a/src/components/organisms/AssetActions/Edit/index.tsx +++ b/src/components/organisms/AssetActions/Edit/index.tsx @@ -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() const [error, setError] = useState() @@ -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 diff --git a/src/components/pages/History/ComputeJobs.tsx b/src/components/pages/History/ComputeJobs.tsx index 6789cb6cb..6f14d3750 100644 --- a/src/components/pages/History/ComputeJobs.tsx +++ b/src/components/pages/History/ComputeJobs.tsx @@ -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 }