diff --git a/src/components/Asset/AssetContent/MetaFull.tsx b/src/components/Asset/AssetContent/MetaFull.tsx index d6dabd1d1..f2bbeaea9 100644 --- a/src/components/Asset/AssetContent/MetaFull.tsx +++ b/src/components/Asset/AssetContent/MetaFull.tsx @@ -1,12 +1,31 @@ -import React, { ReactElement } from 'react' +import React, { ReactElement, useState, useEffect } from 'react' import MetaItem from './MetaItem' import styles from './MetaFull.module.css' import Publisher from '@shared/Publisher' import { useAsset } from '@context/Asset' -import { Asset } from '@oceanprotocol/lib' +import { useWeb3 } from '@context/Web3' +import { Asset, Datatoken } from '@oceanprotocol/lib' export default function MetaFull({ ddo }: { ddo: Asset }): ReactElement { + const [paymentCollector, setPaymentCollector] = useState() const { isInPurgatory } = useAsset() + const { web3 } = useWeb3() + + useEffect(() => { + async function getInitialPaymentCollector() { + let paymentCollector + try { + const datatoken = new Datatoken(web3) + paymentCollector = await datatoken.getPaymentCollector( + ddo.datatokens[0].address + ) + setPaymentCollector(paymentCollector) + } catch (error) { + console.error(error) + } + } + getInitialPaymentCollector() + }, [ddo, web3]) function DockerImage() { const containerInfo = ddo?.metadata?.algorithm?.container @@ -23,6 +42,12 @@ export default function MetaFull({ ddo }: { ddo: Asset }): ReactElement { title="Owner" content={} /> + {paymentCollector !== ddo?.nft?.owner && ( + } + /> + )} {ddo?.metadata?.type === 'algorithm' && ddo?.metadata?.algorithm && ( } />