mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
prettier formatting updates
This commit is contained in:
parent
feed5dd2d1
commit
b516e95879
@ -2,8 +2,7 @@ module.exports = {
|
|||||||
client: {
|
client: {
|
||||||
service: {
|
service: {
|
||||||
name: 'ocean',
|
name: 'ocean',
|
||||||
url:
|
url: 'https://subgraph.rinkeby.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph',
|
||||||
'https://subgraph.rinkeby.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph',
|
|
||||||
// optional disable SSL validation check
|
// optional disable SSL validation check
|
||||||
skipSSLValidation: true
|
skipSSLValidation: true
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ export default function InputElement({
|
|||||||
case 'assetSelection':
|
case 'assetSelection':
|
||||||
return (
|
return (
|
||||||
<AssetSelection
|
<AssetSelection
|
||||||
assets={(options as unknown) as AssetSelectionAsset[]}
|
assets={options as unknown as AssetSelectionAsset[]}
|
||||||
{...field}
|
{...field}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
@ -115,7 +115,7 @@ export default function InputElement({
|
|||||||
case 'assetSelectionMultiple':
|
case 'assetSelectionMultiple':
|
||||||
return (
|
return (
|
||||||
<AssetSelection
|
<AssetSelection
|
||||||
assets={(options as unknown) as AssetSelectionAsset[]}
|
assets={options as unknown as AssetSelectionAsset[]}
|
||||||
multiple
|
multiple
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
{...field}
|
{...field}
|
||||||
@ -132,7 +132,7 @@ export default function InputElement({
|
|||||||
return (
|
return (
|
||||||
<BoxSelection
|
<BoxSelection
|
||||||
name={name}
|
name={name}
|
||||||
options={(options as unknown) as BoxSelectionOption[]}
|
options={options as unknown as BoxSelectionOption[]}
|
||||||
{...field}
|
{...field}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
|
@ -11,13 +11,8 @@ import Web3Feedback from './Feedback'
|
|||||||
import styles from './Details.module.css'
|
import styles from './Details.module.css'
|
||||||
|
|
||||||
export default function Details(): ReactElement {
|
export default function Details(): ReactElement {
|
||||||
const {
|
const { web3Provider, web3ProviderInfo, connect, logout, networkData } =
|
||||||
web3Provider,
|
useWeb3()
|
||||||
web3ProviderInfo,
|
|
||||||
connect,
|
|
||||||
logout,
|
|
||||||
networkData
|
|
||||||
} = useWeb3()
|
|
||||||
const { balance, config } = useOcean()
|
const { balance, config } = useOcean()
|
||||||
const { locale } = useUserPreferences()
|
const { locale } = useUserPreferences()
|
||||||
|
|
||||||
|
@ -82,10 +82,8 @@ export default function FormStartCompute({
|
|||||||
const data = useStaticQuery(contentQuery)
|
const data = useStaticQuery(contentQuery)
|
||||||
const content = data.content.edges[0].node.childPagesJson
|
const content = data.content.edges[0].node.childPagesJson
|
||||||
|
|
||||||
const {
|
const { isValid, values }: FormikContextType<{ algorithm: string }> =
|
||||||
isValid,
|
useFormikContext()
|
||||||
values
|
|
||||||
}: FormikContextType<{ algorithm: string }> = useFormikContext()
|
|
||||||
const { price, ddo } = useAsset()
|
const { price, ddo } = useAsset()
|
||||||
const [totalPrice, setTotalPrice] = useState(price?.value)
|
const [totalPrice, setTotalPrice] = useState(price?.value)
|
||||||
|
|
||||||
|
@ -69,15 +69,12 @@ export default function Compute({
|
|||||||
const [isPublished, setIsPublished] = useState(false)
|
const [isPublished, setIsPublished] = useState(false)
|
||||||
const [hasPreviousDatasetOrder, setHasPreviousDatasetOrder] = useState(false)
|
const [hasPreviousDatasetOrder, setHasPreviousDatasetOrder] = useState(false)
|
||||||
const [previousDatasetOrderId, setPreviousDatasetOrderId] = useState<string>()
|
const [previousDatasetOrderId, setPreviousDatasetOrderId] = useState<string>()
|
||||||
const [hasPreviousAlgorithmOrder, setHasPreviousAlgorithmOrder] = useState(
|
const [hasPreviousAlgorithmOrder, setHasPreviousAlgorithmOrder] =
|
||||||
false
|
useState(false)
|
||||||
)
|
|
||||||
const [algorithmDTBalance, setalgorithmDTBalance] = useState<string>()
|
const [algorithmDTBalance, setalgorithmDTBalance] = useState<string>()
|
||||||
const [algorithmPrice, setAlgorithmPrice] = useState<BestPrice>()
|
const [algorithmPrice, setAlgorithmPrice] = useState<BestPrice>()
|
||||||
const [
|
const [previousAlgorithmOrderId, setPreviousAlgorithmOrderId] =
|
||||||
previousAlgorithmOrderId,
|
useState<string>()
|
||||||
setPreviousAlgorithmOrderId
|
|
||||||
] = useState<string>()
|
|
||||||
const [datasetTimeout, setDatasetTimeout] = useState<string>()
|
const [datasetTimeout, setDatasetTimeout] = useState<string>()
|
||||||
const [algorithmTimeout, setAlgorithmTimeout] = useState<string>()
|
const [algorithmTimeout, setAlgorithmTimeout] = useState<string>()
|
||||||
|
|
||||||
|
@ -48,12 +48,8 @@ export default function Consume({
|
|||||||
const [hasPreviousOrder, setHasPreviousOrder] = useState(false)
|
const [hasPreviousOrder, setHasPreviousOrder] = useState(false)
|
||||||
const [previousOrderId, setPreviousOrderId] = useState<string>()
|
const [previousOrderId, setPreviousOrderId] = useState<string>()
|
||||||
const { isInPurgatory, price, type } = useAsset()
|
const { isInPurgatory, price, type } = useAsset()
|
||||||
const {
|
const { buyDT, pricingStepText, pricingError, pricingIsLoading } =
|
||||||
buyDT,
|
usePricing()
|
||||||
pricingStepText,
|
|
||||||
pricingError,
|
|
||||||
pricingIsLoading
|
|
||||||
} = usePricing()
|
|
||||||
const { consumeStepText, consume, consumeError } = useConsume()
|
const { consumeStepText, consume, consumeError } = useConsume()
|
||||||
const [isDisabled, setIsDisabled] = useState(true)
|
const [isDisabled, setIsDisabled] = useState(true)
|
||||||
const [hasDatatoken, setHasDatatoken] = useState(false)
|
const [hasDatatoken, setHasDatatoken] = useState(false)
|
||||||
|
@ -13,10 +13,8 @@ export default function DebugEditCompute({
|
|||||||
ddo: DDO
|
ddo: DDO
|
||||||
}): ReactElement {
|
}): ReactElement {
|
||||||
const { ocean } = useOcean()
|
const { ocean } = useOcean()
|
||||||
const [
|
const [formTransformed, setFormTransformed] =
|
||||||
formTransformed,
|
useState<ServiceComputePrivacy>()
|
||||||
setFormTransformed
|
|
||||||
] = useState<ServiceComputePrivacy>()
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!ocean) return
|
if (!ocean) return
|
||||||
|
@ -29,15 +29,12 @@ export default function FormEditComputeDataset({
|
|||||||
const { accountId } = useWeb3()
|
const { accountId } = useWeb3()
|
||||||
const { ocean, config } = useOcean()
|
const { ocean, config } = useOcean()
|
||||||
const { ddo } = useAsset()
|
const { ddo } = useAsset()
|
||||||
const {
|
const { isValid, values }: FormikContextType<ComputePrivacyForm> =
|
||||||
isValid,
|
useFormikContext()
|
||||||
values
|
|
||||||
}: FormikContextType<ComputePrivacyForm> = useFormikContext()
|
|
||||||
const [allAlgorithms, setAllAlgorithms] = useState<AssetSelectionAsset[]>()
|
const [allAlgorithms, setAllAlgorithms] = useState<AssetSelectionAsset[]>()
|
||||||
|
|
||||||
const { publisherTrustedAlgorithms } = ddo?.findServiceByType(
|
const { publisherTrustedAlgorithms } =
|
||||||
'compute'
|
ddo?.findServiceByType('compute').attributes.main.privacy
|
||||||
).attributes.main.privacy
|
|
||||||
|
|
||||||
async function getAlgorithmList(
|
async function getAlgorithmList(
|
||||||
publisherTrustedAlgorithms: PublisherTrustedAlgorithm[]
|
publisherTrustedAlgorithms: PublisherTrustedAlgorithm[]
|
||||||
|
@ -48,11 +48,8 @@ export default function Output({
|
|||||||
coin: string
|
coin: string
|
||||||
}): ReactElement {
|
}): ReactElement {
|
||||||
const data = useStaticQuery(contentQuery)
|
const data = useStaticQuery(contentQuery)
|
||||||
const {
|
const { help, titleIn, titleOut } =
|
||||||
help,
|
data.content.edges[0].node.childContentJson.pool.add.output
|
||||||
titleIn,
|
|
||||||
titleOut
|
|
||||||
} = data.content.edges[0].node.childContentJson.pool.add.output
|
|
||||||
|
|
||||||
// Connect with form
|
// Connect with form
|
||||||
const { values }: FormikContextType<FormAddLiquidity> = useFormikContext()
|
const { values }: FormikContextType<FormAddLiquidity> = useFormikContext()
|
||||||
|
@ -83,10 +83,8 @@ export default function Pool(): ReactElement {
|
|||||||
const [totalUserLiquidityInOcean, setTotalUserLiquidityInOcean] = useState(0)
|
const [totalUserLiquidityInOcean, setTotalUserLiquidityInOcean] = useState(0)
|
||||||
const [totalLiquidityInOcean, setTotalLiquidityInOcean] = useState(0)
|
const [totalLiquidityInOcean, setTotalLiquidityInOcean] = useState(0)
|
||||||
|
|
||||||
const [
|
const [creatorTotalLiquidityInOcean, setCreatorTotalLiquidityInOcean] =
|
||||||
creatorTotalLiquidityInOcean,
|
useState(0)
|
||||||
setCreatorTotalLiquidityInOcean
|
|
||||||
] = useState(0)
|
|
||||||
const [creatorLiquidity, setCreatorLiquidity] = useState<PoolBalance>()
|
const [creatorLiquidity, setCreatorLiquidity] = useState<PoolBalance>()
|
||||||
const [creatorPoolTokens, setCreatorPoolTokens] = useState<string>()
|
const [creatorPoolTokens, setCreatorPoolTokens] = useState<string>()
|
||||||
const [creatorPoolShare, setCreatorPoolShare] = useState<string>()
|
const [creatorPoolShare, setCreatorPoolShare] = useState<string>()
|
||||||
|
@ -9,10 +9,11 @@ export async function getMaxPercentRemove(
|
|||||||
poolAddress
|
poolAddress
|
||||||
)
|
)
|
||||||
|
|
||||||
const amountMaxPoolShares = await ocean.pool.getPoolSharesRequiredToRemoveOcean(
|
const amountMaxPoolShares =
|
||||||
poolAddress,
|
await ocean.pool.getPoolSharesRequiredToRemoveOcean(
|
||||||
amountMaxOcean
|
poolAddress,
|
||||||
)
|
amountMaxOcean
|
||||||
|
)
|
||||||
|
|
||||||
let amountMaxPercent = `${Math.floor(
|
let amountMaxPercent = `${Math.floor(
|
||||||
(Number(amountMaxPoolShares) / Number(poolTokens)) * 100
|
(Number(amountMaxPoolShares) / Number(poolTokens)) * 100
|
||||||
|
@ -6,10 +6,8 @@ import styles from './Slippage.module.css'
|
|||||||
|
|
||||||
export default function Slippage(): ReactElement {
|
export default function Slippage(): ReactElement {
|
||||||
// Connect with form
|
// Connect with form
|
||||||
const {
|
const { setFieldValue, values }: FormikContextType<FormTradeData> =
|
||||||
setFieldValue,
|
useFormikContext()
|
||||||
values
|
|
||||||
}: FormikContextType<FormTradeData> = useFormikContext()
|
|
||||||
|
|
||||||
function handleChange(e: ChangeEvent<HTMLSelectElement>) {
|
function handleChange(e: ChangeEvent<HTMLSelectElement>) {
|
||||||
setFieldValue('slippage', e.target.value)
|
setFieldValue('slippage', e.target.value)
|
||||||
|
@ -8,8 +8,8 @@ export default function MetaFull(): ReactElement {
|
|||||||
const { ddo, metadata, isInPurgatory, type } = useAsset()
|
const { ddo, metadata, isInPurgatory, type } = useAsset()
|
||||||
|
|
||||||
function DockerImage() {
|
function DockerImage() {
|
||||||
const algorithmContainer = ddo.findServiceByType('metadata').attributes.main
|
const algorithmContainer =
|
||||||
.algorithm.container
|
ddo.findServiceByType('metadata').attributes.main.algorithm.container
|
||||||
const { image } = algorithmContainer
|
const { image } = algorithmContainer
|
||||||
const { tag } = algorithmContainer
|
const { tag } = algorithmContainer
|
||||||
return <span>{`${image}:${tag}`}</span>
|
return <span>{`${image}:${tag}`}</span>
|
||||||
|
@ -25,13 +25,8 @@ export default function FormPricing({
|
|||||||
|
|
||||||
// Connect with form
|
// Connect with form
|
||||||
const { values, setFieldValue, submitForm } = useFormikContext()
|
const { values, setFieldValue, submitForm } = useFormikContext()
|
||||||
const {
|
const { price, oceanAmount, weightOnOcean, weightOnDataToken, type } =
|
||||||
price,
|
values as PriceOptionsMarket
|
||||||
oceanAmount,
|
|
||||||
weightOnOcean,
|
|
||||||
weightOnDataToken,
|
|
||||||
type
|
|
||||||
} = values as PriceOptionsMarket
|
|
||||||
|
|
||||||
// Switch type value upon tab change
|
// Switch type value upon tab change
|
||||||
function handleTabChange(tabName: string) {
|
function handleTabChange(tabName: string) {
|
||||||
|
@ -57,12 +57,8 @@ export default function Pricing({ ddo }: { ddo: DDO }): ReactElement {
|
|||||||
const [showPricing, setShowPricing] = useState(false)
|
const [showPricing, setShowPricing] = useState(false)
|
||||||
const [success, setSuccess] = useState<string>()
|
const [success, setSuccess] = useState<string>()
|
||||||
|
|
||||||
const {
|
const { createPricing, pricingIsLoading, pricingError, pricingStepText } =
|
||||||
createPricing,
|
usePricing()
|
||||||
pricingIsLoading,
|
|
||||||
pricingError,
|
|
||||||
pricingStepText
|
|
||||||
} = usePricing()
|
|
||||||
|
|
||||||
const hasFeedback = pricingIsLoading || typeof success !== 'undefined'
|
const hasFeedback = pricingIsLoading || typeof success !== 'undefined'
|
||||||
|
|
||||||
|
@ -92,9 +92,8 @@ export default function PublishPage({
|
|||||||
.initialValues as MetadataPublishFormDataset)) ||
|
.initialValues as MetadataPublishFormDataset)) ||
|
||||||
initialValues
|
initialValues
|
||||||
)
|
)
|
||||||
const [publishType, setPublishType] = useState<MetadataMain['type']>(
|
const [publishType, setPublishType] =
|
||||||
'dataset'
|
useState<MetadataMain['type']>('dataset')
|
||||||
)
|
|
||||||
const hasFeedback = isLoading || error || success
|
const hasFeedback = isLoading || error || success
|
||||||
|
|
||||||
const emptyAlgoDT = Object.values(algoInitialValues.dataTokenOptions).every(
|
const emptyAlgoDT = Object.values(algoInitialValues.dataTokenOptions).every(
|
||||||
@ -137,7 +136,7 @@ export default function PublishPage({
|
|||||||
)
|
)
|
||||||
|
|
||||||
const ddo = await publish(
|
const ddo = await publish(
|
||||||
(metadata as unknown) as Metadata,
|
metadata as unknown as Metadata,
|
||||||
serviceType,
|
serviceType,
|
||||||
values.dataTokenOptions,
|
values.dataTokenOptions,
|
||||||
timeout
|
timeout
|
||||||
@ -186,7 +185,7 @@ export default function PublishPage({
|
|||||||
Logger.log('Publish algorithm with ', metadata, values.dataTokenOptions)
|
Logger.log('Publish algorithm with ', metadata, values.dataTokenOptions)
|
||||||
|
|
||||||
const ddo = await publish(
|
const ddo = await publish(
|
||||||
(metadata as unknown) as Metadata,
|
metadata as unknown as Metadata,
|
||||||
values.algorithmPrivacy === true ? 'compute' : 'access',
|
values.algorithmPrivacy === true ? 'compute' : 'access',
|
||||||
values.dataTokenOptions,
|
values.dataTokenOptions,
|
||||||
timeout
|
timeout
|
||||||
|
@ -36,8 +36,9 @@ export default function FilterPrice({
|
|||||||
async function handleSelectedFilter(isSelected: boolean, value: string) {
|
async function handleSelectedFilter(isSelected: boolean, value: string) {
|
||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
if (serviceSelections.length > 1) {
|
if (serviceSelections.length > 1) {
|
||||||
const otherValue = serviceFilterItems.find((p) => p.value !== value)
|
const otherValue = serviceFilterItems.find(
|
||||||
.value
|
(p) => p.value !== value
|
||||||
|
).value
|
||||||
await applyServiceFilter(otherValue)
|
await applyServiceFilter(otherValue)
|
||||||
setServiceSelections([otherValue])
|
setServiceSelections([otherValue])
|
||||||
} else {
|
} else {
|
||||||
|
@ -27,7 +27,8 @@ export const FilterByTypeOptions = {
|
|||||||
Data: 'dataset',
|
Data: 'dataset',
|
||||||
Algorithm: 'algorithm'
|
Algorithm: 'algorithm'
|
||||||
} as const
|
} as const
|
||||||
type FilterByTypeOptions = typeof FilterByTypeOptions[keyof typeof FilterByTypeOptions]
|
type FilterByTypeOptions =
|
||||||
|
typeof FilterByTypeOptions[keyof typeof FilterByTypeOptions]
|
||||||
|
|
||||||
function addTypeFilterToQuery(sortTerm: string, typeFilter: string): string {
|
function addTypeFilterToQuery(sortTerm: string, typeFilter: string): string {
|
||||||
sortTerm = typeFilter
|
sortTerm = typeFilter
|
||||||
|
@ -202,13 +202,8 @@ function usePricing(): UsePricing {
|
|||||||
|
|
||||||
if (!ocean || !accountId || !dtSymbol) return
|
if (!ocean || !accountId || !dtSymbol) return
|
||||||
|
|
||||||
const {
|
const { type, oceanAmount, price, weightOnDataToken, swapFee } =
|
||||||
type,
|
priceOptions
|
||||||
oceanAmount,
|
|
||||||
price,
|
|
||||||
weightOnDataToken,
|
|
||||||
swapFee
|
|
||||||
} = priceOptions
|
|
||||||
|
|
||||||
let { dtAmount } = priceOptions
|
let { dtAmount } = priceOptions
|
||||||
const isPool = type === 'dynamic'
|
const isPool = type === 'dynamic'
|
||||||
|
@ -69,13 +69,14 @@ function usePublish(): UsePublish {
|
|||||||
switch (serviceType) {
|
switch (serviceType) {
|
||||||
case 'access': {
|
case 'access': {
|
||||||
if (!timeout) timeout = 0
|
if (!timeout) timeout = 0
|
||||||
const accessService = await ocean.assets.createAccessServiceAttributes(
|
const accessService =
|
||||||
account,
|
await ocean.assets.createAccessServiceAttributes(
|
||||||
price,
|
account,
|
||||||
publishedDate,
|
price,
|
||||||
timeout,
|
publishedDate,
|
||||||
providerUri
|
timeout,
|
||||||
)
|
providerUri
|
||||||
|
)
|
||||||
Logger.log('access service created', accessService)
|
Logger.log('access service created', accessService)
|
||||||
services.push(accessService)
|
services.push(accessService)
|
||||||
break
|
break
|
||||||
|
@ -2,37 +2,38 @@ import { MetadataPublishFormAlgorithm } from '../@types/MetaData'
|
|||||||
import { File as FileMetadata } from '@oceanprotocol/lib'
|
import { File as FileMetadata } from '@oceanprotocol/lib'
|
||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
|
|
||||||
export const validationSchema: Yup.SchemaOf<MetadataPublishFormAlgorithm> = Yup.object()
|
export const validationSchema: Yup.SchemaOf<MetadataPublishFormAlgorithm> =
|
||||||
.shape({
|
Yup.object()
|
||||||
// ---- required fields ----
|
.shape({
|
||||||
name: Yup.string()
|
// ---- required fields ----
|
||||||
.min(4, (param) => `Title must be at least ${param.min} characters`)
|
name: Yup.string()
|
||||||
.required('Required'),
|
.min(4, (param) => `Title must be at least ${param.min} characters`)
|
||||||
description: Yup.string().min(10).required('Required'),
|
.required('Required'),
|
||||||
files: Yup.array<FileMetadata>().required('Required').nullable(),
|
description: Yup.string().min(10).required('Required'),
|
||||||
timeout: Yup.string().required('Required'),
|
files: Yup.array<FileMetadata>().required('Required').nullable(),
|
||||||
dataTokenOptions: Yup.object()
|
timeout: Yup.string().required('Required'),
|
||||||
.shape({
|
dataTokenOptions: Yup.object()
|
||||||
name: Yup.string(),
|
.shape({
|
||||||
symbol: Yup.string()
|
name: Yup.string(),
|
||||||
})
|
symbol: Yup.string()
|
||||||
.required('Required'),
|
})
|
||||||
dockerImage: Yup.string()
|
.required('Required'),
|
||||||
.matches(/node:latest|python:latest|custom image/g, {
|
dockerImage: Yup.string()
|
||||||
excludeEmptyString: true
|
.matches(/node:latest|python:latest|custom image/g, {
|
||||||
})
|
excludeEmptyString: true
|
||||||
.required('Required'),
|
})
|
||||||
image: Yup.string().required('Required'),
|
.required('Required'),
|
||||||
containerTag: Yup.string().required('Required'),
|
image: Yup.string().required('Required'),
|
||||||
entrypoint: Yup.string().required('Required'),
|
containerTag: Yup.string().required('Required'),
|
||||||
author: Yup.string().required('Required'),
|
entrypoint: Yup.string().required('Required'),
|
||||||
termsAndConditions: Yup.boolean().required('Required'),
|
author: Yup.string().required('Required'),
|
||||||
// ---- optional fields ----
|
termsAndConditions: Yup.boolean().required('Required'),
|
||||||
algorithmPrivacy: Yup.boolean().nullable(),
|
// ---- optional fields ----
|
||||||
tags: Yup.string().nullable(),
|
algorithmPrivacy: Yup.boolean().nullable(),
|
||||||
links: Yup.array<FileMetadata[]>().nullable()
|
tags: Yup.string().nullable(),
|
||||||
})
|
links: Yup.array<FileMetadata[]>().nullable()
|
||||||
.defined()
|
})
|
||||||
|
.defined()
|
||||||
|
|
||||||
export const initialValues: Partial<MetadataPublishFormAlgorithm> = {
|
export const initialValues: Partial<MetadataPublishFormAlgorithm> = {
|
||||||
name: '',
|
name: '',
|
||||||
|
@ -6,12 +6,11 @@ export interface ComputePrivacyForm {
|
|||||||
publisherTrustedAlgorithms: string[]
|
publisherTrustedAlgorithms: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export const validationSchema: Yup.SchemaOf<ComputePrivacyForm> = Yup.object().shape(
|
export const validationSchema: Yup.SchemaOf<ComputePrivacyForm> =
|
||||||
{
|
Yup.object().shape({
|
||||||
allowAllPublishedAlgorithms: Yup.boolean().nullable(),
|
allowAllPublishedAlgorithms: Yup.boolean().nullable(),
|
||||||
publisherTrustedAlgorithms: Yup.array().nullable()
|
publisherTrustedAlgorithms: Yup.array().nullable()
|
||||||
}
|
})
|
||||||
)
|
|
||||||
|
|
||||||
export function getInitialValues(
|
export function getInitialValues(
|
||||||
compute: ServiceComputePrivacy
|
compute: ServiceComputePrivacy
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { PriceOptionsMarket } from '../@types/MetaData'
|
import { PriceOptionsMarket } from '../@types/MetaData'
|
||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
|
|
||||||
export const validationSchema: Yup.SchemaOf<PriceOptionsMarket> = Yup.object().shape(
|
export const validationSchema: Yup.SchemaOf<PriceOptionsMarket> =
|
||||||
{
|
Yup.object().shape({
|
||||||
price: Yup.number()
|
price: Yup.number()
|
||||||
.min(1, (param) => `Must be more or equal to ${param.min}`)
|
.min(1, (param) => `Must be more or equal to ${param.min}`)
|
||||||
.required('Required'),
|
.required('Required'),
|
||||||
@ -22,8 +22,7 @@ export const validationSchema: Yup.SchemaOf<PriceOptionsMarket> = Yup.object().s
|
|||||||
.max(10, 'Maximum is 10%')
|
.max(10, 'Maximum is 10%')
|
||||||
.required('Required')
|
.required('Required')
|
||||||
.nullable()
|
.nullable()
|
||||||
}
|
})
|
||||||
)
|
|
||||||
|
|
||||||
export const initialValues: PriceOptionsMarket = {
|
export const initialValues: PriceOptionsMarket = {
|
||||||
price: 1,
|
price: 1,
|
||||||
|
@ -2,34 +2,35 @@ import { MetadataPublishFormDataset } from '../@types/MetaData'
|
|||||||
import { File as FileMetadata } from '@oceanprotocol/lib'
|
import { File as FileMetadata } from '@oceanprotocol/lib'
|
||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
|
|
||||||
export const validationSchema: Yup.SchemaOf<MetadataPublishFormDataset> = Yup.object()
|
export const validationSchema: Yup.SchemaOf<MetadataPublishFormDataset> =
|
||||||
.shape({
|
Yup.object()
|
||||||
// ---- required fields ----
|
.shape({
|
||||||
name: Yup.string()
|
// ---- required fields ----
|
||||||
.min(4, (param) => `Title must be at least ${param.min} characters`)
|
name: Yup.string()
|
||||||
.required('Required'),
|
.min(4, (param) => `Title must be at least ${param.min} characters`)
|
||||||
author: Yup.string().required('Required'),
|
.required('Required'),
|
||||||
dataTokenOptions: Yup.object()
|
author: Yup.string().required('Required'),
|
||||||
.shape({
|
dataTokenOptions: Yup.object()
|
||||||
name: Yup.string(),
|
.shape({
|
||||||
symbol: Yup.string()
|
name: Yup.string(),
|
||||||
})
|
symbol: Yup.string()
|
||||||
.required('Required'),
|
})
|
||||||
files: Yup.array<FileMetadata>()
|
.required('Required'),
|
||||||
.required('Enter a valid URL and click "ADD FILE"')
|
files: Yup.array<FileMetadata>()
|
||||||
.nullable(),
|
.required('Enter a valid URL and click "ADD FILE"')
|
||||||
description: Yup.string().min(10).required('Required'),
|
.nullable(),
|
||||||
timeout: Yup.string().required('Required'),
|
description: Yup.string().min(10).required('Required'),
|
||||||
access: Yup.string()
|
timeout: Yup.string().required('Required'),
|
||||||
.matches(/Compute|Download/g, { excludeEmptyString: true })
|
access: Yup.string()
|
||||||
.required('Required'),
|
.matches(/Compute|Download/g, { excludeEmptyString: true })
|
||||||
termsAndConditions: Yup.boolean().required('Required'),
|
.required('Required'),
|
||||||
|
termsAndConditions: Yup.boolean().required('Required'),
|
||||||
|
|
||||||
// ---- optional fields ----
|
// ---- optional fields ----
|
||||||
tags: Yup.string().nullable(),
|
tags: Yup.string().nullable(),
|
||||||
links: Yup.array<FileMetadata[]>().nullable()
|
links: Yup.array<FileMetadata[]>().nullable()
|
||||||
})
|
})
|
||||||
.defined()
|
.defined()
|
||||||
|
|
||||||
export const initialValues: Partial<MetadataPublishFormDataset> = {
|
export const initialValues: Partial<MetadataPublishFormDataset> = {
|
||||||
name: '',
|
name: '',
|
||||||
|
@ -6,11 +6,8 @@ import { Helmet } from 'react-helmet'
|
|||||||
import Button from '../components/atoms/Button'
|
import Button from '../components/atoms/Button'
|
||||||
|
|
||||||
export default function PageGatsby404(props: PageProps): ReactElement {
|
export default function PageGatsby404(props: PageProps): ReactElement {
|
||||||
const {
|
const { title, description, actions } = (props.data as any).content.edges[0]
|
||||||
title,
|
.node.childPagesJson
|
||||||
description,
|
|
||||||
actions
|
|
||||||
} = (props.data as any).content.edges[0].node.childPagesJson
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -122,7 +122,7 @@ function AssetProvider({
|
|||||||
|
|
||||||
// Get metadata from DDO
|
// Get metadata from DDO
|
||||||
const { attributes } = ddo.findServiceByType('metadata')
|
const { attributes } = ddo.findServiceByType('metadata')
|
||||||
setMetadata((attributes as unknown) as MetadataMarket)
|
setMetadata(attributes as unknown as MetadataMarket)
|
||||||
setTitle(attributes?.main.name)
|
setTitle(attributes?.main.name)
|
||||||
setType(attributes.main.type)
|
setType(attributes.main.type)
|
||||||
setOwner(ddo.publicKey[0].owner)
|
setOwner(ddo.publicKey[0].owner)
|
||||||
|
@ -51,9 +51,8 @@ function OceanProvider({
|
|||||||
eth: undefined,
|
eth: undefined,
|
||||||
ocean: undefined
|
ocean: undefined
|
||||||
})
|
})
|
||||||
const [config, setConfig] = useState<ConfigHelperConfig | Config>(
|
const [config, setConfig] =
|
||||||
initialConfig
|
useState<ConfigHelperConfig | Config>(initialConfig)
|
||||||
)
|
|
||||||
const [loading, setLoading] = useState<boolean>()
|
const [loading, setLoading] = useState<boolean>()
|
||||||
|
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
|
@ -13,9 +13,10 @@ export async function createTrustedAlgorithmList(
|
|||||||
const trustedAlgorithms = []
|
const trustedAlgorithms = []
|
||||||
|
|
||||||
for (const selectedAlgorithm of selectedAlgorithms) {
|
for (const selectedAlgorithm of selectedAlgorithms) {
|
||||||
const trustedAlgorithm = await ocean.compute.createPublisherTrustedAlgorithmfromDID(
|
const trustedAlgorithm =
|
||||||
selectedAlgorithm
|
await ocean.compute.createPublisherTrustedAlgorithmfromDID(
|
||||||
)
|
selectedAlgorithm
|
||||||
|
)
|
||||||
trustedAlgorithms.push(trustedAlgorithm)
|
trustedAlgorithms.push(trustedAlgorithm)
|
||||||
}
|
}
|
||||||
return trustedAlgorithms
|
return trustedAlgorithms
|
||||||
|
@ -28,9 +28,9 @@ export const computeFeedback: { [key in number]: string } = {
|
|||||||
2: '3/3 Access granted. Starting job...'
|
2: '3/3 Access granted. Starting job...'
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCreatePricingPoolFeedback(
|
export function getCreatePricingPoolFeedback(dtSymbol: string): {
|
||||||
dtSymbol: string
|
[key: number]: string
|
||||||
): { [key: number]: string } {
|
} {
|
||||||
return {
|
return {
|
||||||
99: `Minting ${dtSymbol} ...`,
|
99: `Minting ${dtSymbol} ...`,
|
||||||
0: 'Creating pool ...',
|
0: 'Creating pool ...',
|
||||||
@ -41,9 +41,9 @@ export function getCreatePricingPoolFeedback(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCreatePricingExchangeFeedback(
|
export function getCreatePricingExchangeFeedback(dtSymbol: string): {
|
||||||
dtSymbol: string
|
[key: number]: string
|
||||||
): { [key: number]: string } {
|
} {
|
||||||
return {
|
return {
|
||||||
99: `Minting ${dtSymbol} ...`,
|
99: `Minting ${dtSymbol} ...`,
|
||||||
0: 'Creating exchange ...',
|
0: 'Creating exchange ...',
|
||||||
|
@ -127,10 +127,8 @@ export async function getPreviousOrders(
|
|||||||
id: id,
|
id: id,
|
||||||
account: account
|
account: account
|
||||||
}
|
}
|
||||||
const fetchedPreviousOrders: ApolloQueryResult<AssetPreviousOrder> = await fetchData(
|
const fetchedPreviousOrders: ApolloQueryResult<AssetPreviousOrder> =
|
||||||
PreviousOrderQuery,
|
await fetchData(PreviousOrderQuery, variables)
|
||||||
variables
|
|
||||||
)
|
|
||||||
if (fetchedPreviousOrders.data?.tokenOrders?.length === 0) return null
|
if (fetchedPreviousOrders.data?.tokenOrders?.length === 0) return null
|
||||||
if (assetTimeout === '0') {
|
if (assetTimeout === '0') {
|
||||||
return fetchedPreviousOrders?.data?.tokenOrders[0]?.tx
|
return fetchedPreviousOrders?.data?.tokenOrders[0]?.tx
|
||||||
|
@ -5,8 +5,7 @@ const ddo: Partial<DDO> = {
|
|||||||
id: 'did:op:7b4e90b05ec243dbaaca2a503fdde119706577f9645b45b9ab65cf2c3970f757',
|
id: 'did:op:7b4e90b05ec243dbaaca2a503fdde119706577f9645b45b9ab65cf2c3970f757',
|
||||||
publicKey: [
|
publicKey: [
|
||||||
{
|
{
|
||||||
id:
|
id: 'did:op:7b4e90b05ec243dbaaca2a503fdde119706577f9645b45b9ab65cf2c3970f757',
|
||||||
'did:op:7b4e90b05ec243dbaaca2a503fdde119706577f9645b45b9ab65cf2c3970f757',
|
|
||||||
type: 'EthereumECDSAKey',
|
type: 'EthereumECDSAKey',
|
||||||
owner: '0x4D156A2ef69ffdDC55838176C6712C90f60a2285'
|
owner: '0x4D156A2ef69ffdDC55838176C6712C90f60a2285'
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user