diff --git a/src/components/organisms/AssetActions/Compute/index.tsx b/src/components/organisms/AssetActions/Compute/index.tsx index aa7fa2bd2..80c392e85 100644 --- a/src/components/organisms/AssetActions/Compute/index.tsx +++ b/src/components/organisms/AssetActions/Compute/index.tsx @@ -54,7 +54,7 @@ export default function Compute({ dtBalance: string file: FileMetadata }): ReactElement { - const { marketFeeAddress } = useSiteMetadata() + const { appConfig } = useSiteMetadata() const { accountId } = useWeb3() const { ocean, account, config } = useOcean() const { price, type, ddo } = useAsset() @@ -296,7 +296,7 @@ export default function Compute({ ddo.id, computeService.index, computeAlgorithm, - marketFeeAddress, + appConfig.marketFeeAddress, undefined, false ) @@ -316,7 +316,7 @@ export default function Compute({ serviceAlgo.type, accountId, serviceAlgo.index, - marketFeeAddress, + appConfig.marketFeeAddress, undefined, false ) diff --git a/src/components/organisms/AssetActions/Consume.tsx b/src/components/organisms/AssetActions/Consume.tsx index 30ba32d08..034a89899 100644 --- a/src/components/organisms/AssetActions/Consume.tsx +++ b/src/components/organisms/AssetActions/Consume.tsx @@ -44,7 +44,7 @@ export default function Consume({ }): ReactElement { const { accountId } = useWeb3() const { ocean } = useOcean() - const { marketFeeAddress } = useSiteMetadata() + const { appConfig } = useSiteMetadata() const [hasPreviousOrder, setHasPreviousOrder] = useState(false) const [previousOrderId, setPreviousOrderId] = useState() const { isInPurgatory, price, type } = useAsset() @@ -131,7 +131,7 @@ export default function Consume({ ddo.id, ddo.dataToken, 'access', - marketFeeAddress, + appConfig.marketFeeAddress, previousOrderId ) setHasPreviousOrder(true) diff --git a/src/hooks/useSiteMetadata.ts b/src/hooks/useSiteMetadata.ts index 3abf2bbd4..0db181ea0 100644 --- a/src/hooks/useSiteMetadata.ts +++ b/src/hooks/useSiteMetadata.ts @@ -1,5 +1,35 @@ import { useStaticQuery, graphql } from 'gatsby' +interface UseSiteMetadata { + siteTitle: string + siteTagline: string + siteUrl: string + siteIcon: string + siteImage: { childImageSharp: { original: { src: string } } } + copyright: string + menu: { + name: string + link: string + }[] + warning: { + main: string + polygonPublish: string + } + announcement: { + main: string + polygon: string + } + appConfig: { + infuraProjectId: string + network: string + marketFeeAddress: string + currencies: string[] + portisId: string + allowFixedPricing: string + allowDynamicPricing: string + } +} + const query = graphql` query { site { @@ -53,10 +83,10 @@ const query = graphql` } ` -export function useSiteMetadata() { +export function useSiteMetadata(): UseSiteMetadata { const data = useStaticQuery(query) - const siteMeta = { + const siteMeta: UseSiteMetadata = { ...data.siteImage.edges[0].node.childContentJson.site, ...data.site.siteMetadata }