1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00
This commit is contained in:
Matthias Kretschmann 2020-07-16 15:00:18 +02:00
parent 393daa9269
commit a0e092ed64
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 5 additions and 28 deletions

View File

@ -13,3 +13,4 @@ GATSBY_FACTORY_ADDRESS='0xxxx'
#GATSBY_PROVIDER_URI='https://provider.rinkeby.v3.dev-ocean.com' #GATSBY_PROVIDER_URI='https://provider.rinkeby.v3.dev-ocean.com'
#GATSBY_FACTORY_ADDRESS='0xB9d406D24B310A7D821D0b782a36909e8c925471' #GATSBY_FACTORY_ADDRESS='0xB9d406D24B310A7D821D0b782a36909e8c925471'
#GATSBY_OCEAN_TOKEN_ADDRESS='0x8967BCF84170c91B0d24D4302C2376283b0B3a07' #GATSBY_OCEAN_TOKEN_ADDRESS='0x8967BCF84170c91B0d24D4302C2376283b0B3a07'
#GATSBY_MARKET_ADDRESS='xxx'

View File

@ -23,5 +23,5 @@ module.exports = {
infuraProjectId: process.env.GATSBY_INFURA_PROJECT_ID || 'xxx', infuraProjectId: process.env.GATSBY_INFURA_PROJECT_ID || 'xxx',
marketAddress: marketAddress:
process.env.GATSBY_MARKET_ADDRESS || process.env.GATSBY_MARKET_ADDRESS ||
'0x36A7f3383A63279cDaF4DfC0F3ABc07d90252C6b' '0x903322C7E45A60d7c8C3EA236c5beA9Af86310c7'
} }

View File

@ -1,23 +1,16 @@
import React, { ReactElement } from 'react' import React, { ReactElement } from 'react'
import * as Yup from 'yup' import * as Yup from 'yup'
import { useNavigate } from '@reach/router' import { useNavigate } from '@reach/router'
import { toStringNoMS } from '../../../utils'
import { toast } from 'react-toastify' import { toast } from 'react-toastify'
import styles from './PublishForm.module.css' import styles from './PublishForm.module.css'
import { useOcean, usePublish } from '@oceanprotocol/react' import { useOcean, usePublish } from '@oceanprotocol/react'
import {
Service,
ServiceCompute
} from '@oceanprotocol/lib/dist/node/ddo/interfaces/Service'
import { Formik, Form as FormFormik, Field } from 'formik' import { Formik, Form as FormFormik, Field } from 'formik'
import Input from '../../atoms/Input' import Input from '../../atoms/Input'
import Button from '../../atoms/Button' import Button from '../../atoms/Button'
import { transformPublishFormToMetadata } from './utils' import { transformPublishFormToMetadata } from './utils'
import { FormContent, FormFieldProps } from '../../../@types/Form' import { FormContent, FormFieldProps } from '../../../@types/Form'
import { MetadataPublishForm, MetadataMarket } from '../../../@types/Metadata' import { MetadataPublishForm } from '../../../@types/Metadata'
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 { useSiteMetadata } from '../../../hooks/useSiteMetadata' import { useSiteMetadata } from '../../../hooks/useSiteMetadata'
const validationSchema = Yup.object().shape<MetadataPublishForm>({ const validationSchema = Yup.object().shape<MetadataPublishForm>({
@ -71,14 +64,13 @@ 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? const tokensToMint = '4' // how to know this?
console.log(` console.log(`
Transformed metadata values: Transformed metadata values:
---------------------- ----------------------
${metadata} ${metadata}
Cost: ${cost} Cost: ${values.cost}
Tokens to mint: ${tokensToMint} Tokens to mint: ${tokensToMint}
`) `)
@ -87,7 +79,7 @@ export default function PublishForm({
metadata as any, metadata as any,
tokensToMint, tokensToMint,
marketAddress, marketAddress,
cost values.cost
) )
// User feedback and redirect to new asset detail page // User feedback and redirect to new asset detail page
@ -97,22 +89,6 @@ export default function PublishForm({
} catch (error) { } catch (error) {
console.error(error.message) console.error(error.message)
} }
// if services array stays empty, the default access service
// will be created by squid-js
// let services: Service[] = []
// if (metadata.additionalInformation.access === 'Compute') {
// const computeService: ServiceCompute = await ocean.compute.createComputeServiceAttributes(
// account,
// metadata.main.price,
// // Note: a hack without consequences.
// // Will make metadata.main.datePublished (automatically created by MetadataStore)
// // go out of sync with this service.main.datePublished.
// toStringNoMS(new Date(Date.now()))
// )
// services = [computeService]
// }
} }
return ( return (