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

configurable marketAddress

This commit is contained in:
Matthias Kretschmann 2020-07-16 14:54:12 +02:00
parent 6a12ea77a4
commit 393daa9269
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 11 additions and 5 deletions

View File

@ -20,5 +20,8 @@ module.exports = {
// Main, Rinkeby, Kovan // Main, Rinkeby, Kovan
// networks: [1, 4, 42], // networks: [1, 4, 42],
networks: [4], 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'
} }

View File

@ -18,6 +18,7 @@ import { MetadataPublishForm, MetadataMarket } from '../../../@types/Metadata'
import AssetModel from '../../../models/Asset' import AssetModel from '../../../models/Asset'
import { File as FileMetadata } from '@oceanprotocol/lib/dist/node/ddo/interfaces/File' import { File as FileMetadata } from '@oceanprotocol/lib/dist/node/ddo/interfaces/File'
import web3Utils from 'web3-utils' import web3Utils from 'web3-utils'
import { useSiteMetadata } from '../../../hooks/useSiteMetadata'
const validationSchema = Yup.object().shape<MetadataPublishForm>({ const validationSchema = Yup.object().shape<MetadataPublishForm>({
// ---- required fields ---- // ---- required fields ----
@ -58,6 +59,7 @@ export default function PublishForm({
const { ocean, account } = useOcean() const { ocean, account } = useOcean()
const { publish } = usePublish() const { publish } = usePublish()
const navigate = useNavigate() const navigate = useNavigate()
const { marketAddress } = useSiteMetadata()
async function handleSubmit(values: MetadataPublishForm) { async function handleSubmit(values: MetadataPublishForm) {
const submittingToast = toast.info('submitting asset') const submittingToast = toast.info('submitting asset')
@ -69,17 +71,17 @@ export default function PublishForm({
`) `)
const metadata = transformPublishFormToMetadata(values) const metadata = transformPublishFormToMetadata(values)
const cost = web3Utils.toWei(values.cost)
const tokensToMint = '4' // how to know this?
console.log(` console.log(`
Transformed metadata values: Transformed metadata values:
---------------------- ----------------------
${metadata} ${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 { try {
const ddo = await publish( const ddo = await publish(
metadata as any, metadata as any,

View File

@ -16,6 +16,7 @@ const query = graphql`
appConfig { appConfig {
infuraProjectId infuraProjectId
networks networks
marketAddress
oceanConfig { oceanConfig {
factoryAddress factoryAddress
metadataStoreUri metadataStoreUri