1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

add pricing to publish

This commit is contained in:
Jernej Pregelj 2019-07-23 16:02:58 +02:00 committed by Matthias Kretschmann
parent 105dcbc8cf
commit 74075fab08
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 17 additions and 2 deletions

View File

@ -53,3 +53,4 @@ REACT_APP_BRIZO_ADDRESS="0x0474ed05ba757dde575dfaaaa267d9e7f3643abc"
# REACT_APP_BRIZO_ADDRESS="0x00bd138abd70e2f00903268f3db08f2d25677c9e"
REACT_APP_REPORT_EMAIL="test@example.com"
REACT_APP_ALLOW_PRICING="true"

View File

@ -28,3 +28,4 @@ export const faucetUri =
//
export const verbose = true
export const analyticsId = 'UA-60614729-11'
export const allowPricing = process.env.REACT_APP_ALLOW_PRICING || 'false'

View File

@ -1,5 +1,6 @@
import React, { ChangeEvent, Component, FormEvent } from 'react'
import { Logger } from '@oceanprotocol/squid'
import Web3 from 'web3'
import Route from '../../components/templates/Route'
import Form from '../../components/atoms/Form/Form'
import AssetModel from '../../models/AssetModel'
@ -7,7 +8,7 @@ import { User, Market } from '../../context'
import Step from './Step'
import Progress from './Progress'
import ReactGA from 'react-ga'
import { allowPricing } from '../../config'
import { steps } from '../../data/form-publish.json'
import Content from '../../components/atoms/Content'
import { File } from './Files'
@ -36,6 +37,16 @@ interface PublishState {
validationStatus?: any
}
if(allowPricing){
(steps as any)[0].fields['price'] = {
label: "Price",
placeholder: "Price in Ocean tokens",
type: "string",
required: true,
help: "Enter the price of assets in Ocean tokens."
}
}
class Publish extends Component<{}, PublishState> {
public static contextType = User
@ -281,12 +292,14 @@ class Publish extends Component<{}, PublishState> {
license: this.state.license,
copyrightHolder: this.state.copyrightHolder,
files,
price: this.state.price,
price: allowPricing ? Web3.utils.toWei(this.state.price, 'ether') : this.state.price,
type: this.state.type,
categories: [this.state.categories]
})
}
console.log(newAsset)
try {
const asset = await this.context.ocean.assets
.create(newAsset, account[0])