diff --git a/app.config.js b/app.config.js index 567b1ec7d..af79fd06f 100644 --- a/app.config.js +++ b/app.config.js @@ -20,5 +20,8 @@ module.exports = { // Main, Rinkeby, Kovan // networks: [1, 4, 42], networks: [4], - infuraProjectId: process.env.GATSBY_INFURA_PROJECT_ID || 'xxx' + infuraProjectId: process.env.GATSBY_INFURA_PROJECT_ID || 'xxx', + marketAddress: + process.env.GATSBY_MARKET_ADDRESS || + '0x36A7f3383A63279cDaF4DfC0F3ABc07d90252C6b' } diff --git a/src/components/pages/Publish/PublishForm.tsx b/src/components/pages/Publish/PublishForm.tsx index 1b85602c3..b345b99d7 100644 --- a/src/components/pages/Publish/PublishForm.tsx +++ b/src/components/pages/Publish/PublishForm.tsx @@ -18,6 +18,7 @@ import { MetadataPublishForm, MetadataMarket } from '../../../@types/Metadata' import AssetModel from '../../../models/Asset' import { File as FileMetadata } from '@oceanprotocol/lib/dist/node/ddo/interfaces/File' import web3Utils from 'web3-utils' +import { useSiteMetadata } from '../../../hooks/useSiteMetadata' const validationSchema = Yup.object().shape({ // ---- required fields ---- @@ -58,6 +59,7 @@ export default function PublishForm({ const { ocean, account } = useOcean() const { publish } = usePublish() const navigate = useNavigate() + const { marketAddress } = useSiteMetadata() async function handleSubmit(values: MetadataPublishForm) { const submittingToast = toast.info('submitting asset') @@ -69,17 +71,17 @@ export default function PublishForm({ `) const metadata = transformPublishFormToMetadata(values) + const cost = web3Utils.toWei(values.cost) + const tokensToMint = '4' // how to know this? console.log(` Transformed metadata values: ---------------------- ${metadata} + Cost: ${cost} + Tokens to mint: ${tokensToMint} `) - const tokensToMint = '4' // how to know this? - const marketAddress = '0x4D156A2ef69ffdDC55838176C6712C90f60a2285' // what is this? - const cost = `${web3Utils.toWei(values.cost)}` - try { const ddo = await publish( metadata as any, diff --git a/src/hooks/useSiteMetadata.ts b/src/hooks/useSiteMetadata.ts index 1e8b6d3b1..be7ba45d7 100644 --- a/src/hooks/useSiteMetadata.ts +++ b/src/hooks/useSiteMetadata.ts @@ -16,6 +16,7 @@ const query = graphql` appConfig { infuraProjectId networks + marketAddress oceanConfig { factoryAddress metadataStoreUri