mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
Merge branch 'v4' into feature/publish
This commit is contained in:
commit
38ce25225f
@ -7,7 +7,7 @@ import React, {
|
|||||||
useCallback,
|
useCallback,
|
||||||
ReactNode
|
ReactNode
|
||||||
} from 'react'
|
} from 'react'
|
||||||
import { LoggerInstance, Purgatory } from '@oceanprotocol/lib'
|
import { Asset, LoggerInstance, Purgatory } from '@oceanprotocol/lib'
|
||||||
import getAssetPurgatoryData from '@utils/purgatory'
|
import getAssetPurgatoryData from '@utils/purgatory'
|
||||||
import { CancelToken } from 'axios'
|
import { CancelToken } from 'axios'
|
||||||
import { retrieveDDO } from '@utils/aquarius'
|
import { retrieveDDO } from '@utils/aquarius'
|
||||||
@ -110,7 +110,7 @@ function AssetProvider({
|
|||||||
setDID(asset as string)
|
setDID(asset as string)
|
||||||
setTitle(ddo.metadata.name)
|
setTitle(ddo.metadata.name)
|
||||||
setOwner(ddo.nft.owner)
|
setOwner(ddo.nft.owner)
|
||||||
setIsInPurgatory(ddo.isInPurgatory === 'true')
|
setIsInPurgatory(ddo.purgatory.state === true)
|
||||||
await setPurgatory(ddo.id)
|
await setPurgatory(ddo.id)
|
||||||
}
|
}
|
||||||
init()
|
init()
|
||||||
|
@ -14,7 +14,7 @@ import {
|
|||||||
} from '@utils/subgraph'
|
} from '@utils/subgraph'
|
||||||
import { useUserPreferences } from './UserPreferences'
|
import { useUserPreferences } from './UserPreferences'
|
||||||
import { PoolShares_poolShares as PoolShare } from '../@types/apollo/PoolShares'
|
import { PoolShares_poolShares as PoolShare } from '../@types/apollo/PoolShares'
|
||||||
import { LoggerInstance } from '@oceanprotocol/lib'
|
import { Asset, LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import { getDownloadAssets, getPublishedAssets } from '@utils/aquarius'
|
import { getDownloadAssets, getPublishedAssets } from '@utils/aquarius'
|
||||||
import { useSiteMetadata } from '@hooks/useSiteMetadata'
|
import { useSiteMetadata } from '@hooks/useSiteMetadata'
|
||||||
import { accountTruncate } from '@utils/web3'
|
import { accountTruncate } from '@utils/web3'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { LoggerInstance } from '@oceanprotocol/lib'
|
import { Asset, LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { TransactionReceipt } from 'web3-core'
|
import { TransactionReceipt } from 'web3-core'
|
||||||
import { Decimal } from 'decimal.js'
|
import { Decimal } from 'decimal.js'
|
||||||
@ -43,8 +43,8 @@ function usePricing(): UsePricing {
|
|||||||
async function getDTSymbol(ddo: Asset): Promise<string> {
|
async function getDTSymbol(ddo: Asset): Promise<string> {
|
||||||
if (!accountId) return
|
if (!accountId) return
|
||||||
|
|
||||||
const { dataTokenInfo } = ddo
|
const { datatokens } = ddo
|
||||||
return dataTokenInfo.symbol
|
return datatokens[0].symbol
|
||||||
// return dataTokenInfo
|
// return dataTokenInfo
|
||||||
// ? dataTokenInfo.symbol
|
// ? dataTokenInfo.symbol
|
||||||
// : await ocean?.datatokens.getSymbol(dataTokenInfo.address)
|
// : await ocean?.datatokens.getSymbol(dataTokenInfo.address)
|
||||||
@ -52,8 +52,8 @@ function usePricing(): UsePricing {
|
|||||||
|
|
||||||
async function getDTName(ddo: Asset): Promise<string> {
|
async function getDTName(ddo: Asset): Promise<string> {
|
||||||
if (!accountId) return
|
if (!accountId) return
|
||||||
const { dataTokenInfo } = ddo
|
const { datatokens } = ddo
|
||||||
return dataTokenInfo.name
|
return datatokens[0].name
|
||||||
// return dataTokenInfo
|
// return dataTokenInfo
|
||||||
// ? dataTokenInfo.name
|
// ? dataTokenInfo.name
|
||||||
// : await ocean?.datatokens.getName(dataTokenInfo.address)
|
// : await ocean?.datatokens.getName(dataTokenInfo.address)
|
||||||
@ -96,8 +96,8 @@ function usePricing(): UsePricing {
|
|||||||
tokensToMint: string,
|
tokensToMint: string,
|
||||||
ddo: Asset
|
ddo: Asset
|
||||||
): Promise<TransactionReceipt | void> {
|
): Promise<TransactionReceipt | void> {
|
||||||
const { dataTokenInfo } = ddo
|
const { datatokens } = ddo
|
||||||
LoggerInstance.log('mint function', dataTokenInfo.address, accountId)
|
LoggerInstance.log('mint function', datatokens[0].address, accountId)
|
||||||
// const balance = new Decimal(
|
// const balance = new Decimal(
|
||||||
// await ocean.datatokens.balance(dataTokenInfo.address, accountId)
|
// await ocean.datatokens.balance(dataTokenInfo.address, accountId)
|
||||||
// )
|
// )
|
||||||
|
33
src/@types/Asset.d.ts
vendored
33
src/@types/Asset.d.ts
vendored
@ -1,33 +0,0 @@
|
|||||||
interface AssetNft {
|
|
||||||
address: string
|
|
||||||
name: string
|
|
||||||
symbol: string
|
|
||||||
owner: string
|
|
||||||
state: 0 | 1 | 2 | 3 | 4
|
|
||||||
}
|
|
||||||
|
|
||||||
interface AssetDatatoken {
|
|
||||||
name: string
|
|
||||||
symbol: string
|
|
||||||
address: string
|
|
||||||
serviceId: string
|
|
||||||
}
|
|
||||||
|
|
||||||
interface AssetLastEvent {
|
|
||||||
tx: string
|
|
||||||
block: number
|
|
||||||
from: string
|
|
||||||
contract: string
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Asset extends DDO {
|
|
||||||
nft: AssetNft
|
|
||||||
datatokens: AssetDatatoken[]
|
|
||||||
event: AssetLastEvent
|
|
||||||
stats: { consume: number }
|
|
||||||
isInPurgatory: string
|
|
||||||
|
|
||||||
// This is fake and most likely won't be used like this.
|
|
||||||
// Just here so we can continue to have successful builds.
|
|
||||||
dataTokenInfo: AssetDatatoken
|
|
||||||
}
|
|
12
src/@types/DDO/Metadata.d.ts
vendored
12
src/@types/DDO/Metadata.d.ts
vendored
@ -1,12 +0,0 @@
|
|||||||
interface MetadataAlgorithmContainer {
|
|
||||||
entrypoint: string
|
|
||||||
image: string
|
|
||||||
tag: string
|
|
||||||
checksum: string
|
|
||||||
}
|
|
||||||
|
|
||||||
interface MetadataAlgorithm {
|
|
||||||
language?: string
|
|
||||||
version?: string
|
|
||||||
container: MetadataAlgorithmContainer
|
|
||||||
}
|
|
@ -1,4 +1,8 @@
|
|||||||
import { LoggerInstance } from '@oceanprotocol/lib'
|
import {
|
||||||
|
Asset,
|
||||||
|
LoggerInstance,
|
||||||
|
PublisherTrustedAlgorithm
|
||||||
|
} from '@oceanprotocol/lib'
|
||||||
import { AssetSelectionAsset } from '@shared/FormFields/AssetSelection'
|
import { AssetSelectionAsset } from '@shared/FormFields/AssetSelection'
|
||||||
import { PriceList, getAssetsPriceList } from './subgraph'
|
import { PriceList, getAssetsPriceList } from './subgraph'
|
||||||
import axios, { CancelToken, AxiosResponse } from 'axios'
|
import axios, { CancelToken, AxiosResponse } from 'axios'
|
||||||
@ -208,7 +212,7 @@ export async function transformDDOToAssetSelection(
|
|||||||
const didProviderEndpointMap: any = {}
|
const didProviderEndpointMap: any = {}
|
||||||
for (const ddo of ddoList) {
|
for (const ddo of ddoList) {
|
||||||
didList.push(ddo.id)
|
didList.push(ddo.id)
|
||||||
symbolList[ddo.id] = ddo.dataTokenInfo.symbol
|
symbolList[ddo.id] = ddo.datatokens[0].symbol
|
||||||
const algoComputeService = getServiceByName(ddo, 'compute')
|
const algoComputeService = getServiceByName(ddo, 'compute')
|
||||||
algoComputeService?.serviceEndpoint &&
|
algoComputeService?.serviceEndpoint &&
|
||||||
(didProviderEndpointMap[ddo.id] = algoComputeService?.serviceEndpoint)
|
(didProviderEndpointMap[ddo.id] = algoComputeService?.serviceEndpoint)
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
// Account
|
// Account
|
||||||
// } from '@oceanprotocol/lib'
|
// } from '@oceanprotocol/lib'
|
||||||
// import { ComputeJob } from '@oceanprotocol/lib/dist/node/ocean/interfaces/Compute'
|
// import { ComputeJob } from '@oceanprotocol/lib/dist/node/ocean/interfaces/Compute'
|
||||||
|
import { Asset } from '@oceanprotocol/lib'
|
||||||
import { CancelToken } from 'axios'
|
import { CancelToken } from 'axios'
|
||||||
import { gql } from 'urql'
|
import { gql } from 'urql'
|
||||||
import { queryMetadata, getFilterTerm, generateBaseQuery } from './aquarius'
|
import { queryMetadata, getFilterTerm, generateBaseQuery } from './aquarius'
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { Asset, DDO, Service } from '@oceanprotocol/lib'
|
||||||
|
|
||||||
export function getServiceByName(
|
export function getServiceByName(
|
||||||
ddo: Asset | DDO,
|
ddo: Asset | DDO,
|
||||||
name: 'access' | 'compute'
|
name: 'access' | 'compute'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { gql, OperationResult, TypedDocumentNode, OperationContext } from 'urql'
|
import { gql, OperationResult, TypedDocumentNode, OperationContext } from 'urql'
|
||||||
import { LoggerInstance } from '@oceanprotocol/lib'
|
import { Asset, LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import { getUrqlClientInstance } from '@context/UrqlProvider'
|
import { getUrqlClientInstance } from '@context/UrqlProvider'
|
||||||
import { getOceanConfig } from './ocean'
|
import { getOceanConfig } from './ocean'
|
||||||
import {
|
import {
|
||||||
|
@ -4,6 +4,7 @@ import { getAssetsNames } from '@utils/aquarius'
|
|||||||
import styles from './AssetListTitle.module.css'
|
import styles from './AssetListTitle.module.css'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { useSiteMetadata } from '@hooks/useSiteMetadata'
|
import { useSiteMetadata } from '@hooks/useSiteMetadata'
|
||||||
|
import { Asset } from '@oceanprotocol/lib'
|
||||||
|
|
||||||
export default function AssetListTitle({
|
export default function AssetListTitle({
|
||||||
ddo,
|
ddo,
|
||||||
|
@ -7,6 +7,7 @@ import { getAssetsBestPrices, AssetListPrices } from '@utils/subgraph'
|
|||||||
import Loader from '@shared/atoms/Loader'
|
import Loader from '@shared/atoms/Loader'
|
||||||
import { useUserPreferences } from '@context/UserPreferences'
|
import { useUserPreferences } from '@context/UserPreferences'
|
||||||
import { useIsMounted } from '@hooks/useIsMounted'
|
import { useIsMounted } from '@hooks/useIsMounted'
|
||||||
|
import { Asset } from '@oceanprotocol/lib'
|
||||||
|
|
||||||
const cx = classNames.bind(styles)
|
const cx = classNames.bind(styles)
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import AssetType from '@shared/AssetType'
|
|||||||
import NetworkName from '@shared/NetworkName'
|
import NetworkName from '@shared/NetworkName'
|
||||||
import styles from './AssetTeaser.module.css'
|
import styles from './AssetTeaser.module.css'
|
||||||
import { getServiceByName } from '@utils/ddo'
|
import { getServiceByName } from '@utils/ddo'
|
||||||
|
import { Asset } from '@oceanprotocol/lib'
|
||||||
|
|
||||||
declare type AssetTeaserProps = {
|
declare type AssetTeaserProps = {
|
||||||
ddo: Asset
|
ddo: Asset
|
||||||
@ -21,7 +22,7 @@ export default function AssetTeaser({
|
|||||||
noPublisher
|
noPublisher
|
||||||
}: AssetTeaserProps): ReactElement {
|
}: AssetTeaserProps): ReactElement {
|
||||||
const { name, type, description } = ddo.metadata
|
const { name, type, description } = ddo.metadata
|
||||||
const { dataTokenInfo } = ddo
|
const { datatokens } = ddo
|
||||||
const isCompute = Boolean(getServiceByName(ddo, 'compute'))
|
const isCompute = Boolean(getServiceByName(ddo, 'compute'))
|
||||||
const accessType = isCompute ? 'compute' : 'access'
|
const accessType = isCompute ? 'compute' : 'access'
|
||||||
const { owner } = ddo.nft
|
const { owner } = ddo.nft
|
||||||
@ -31,7 +32,7 @@ export default function AssetTeaser({
|
|||||||
<Link href={`/asset/${ddo.id}`}>
|
<Link href={`/asset/${ddo.id}`}>
|
||||||
<a className={styles.link}>
|
<a className={styles.link}>
|
||||||
<header className={styles.header}>
|
<header className={styles.header}>
|
||||||
<div className={styles.symbol}>{dataTokenInfo?.symbol}</div>
|
<div className={styles.symbol}>{datatokens[0]?.symbol}</div>
|
||||||
<Dotdotdot clamp={3}>
|
<Dotdotdot clamp={3}>
|
||||||
<h1 className={styles.title}>{name}</h1>
|
<h1 className={styles.title}>{name}</h1>
|
||||||
</Dotdotdot>
|
</Dotdotdot>
|
||||||
|
@ -13,7 +13,7 @@ import { retrieveDDOListByDIDs } from '@utils/aquarius'
|
|||||||
import { CancelToken } from 'axios'
|
import { CancelToken } from 'axios'
|
||||||
import Title from './Title'
|
import Title from './Title'
|
||||||
import styles from './index.module.css'
|
import styles from './index.module.css'
|
||||||
import { LoggerInstance } from '@oceanprotocol/lib'
|
import { Asset, LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import { useCancelToken } from '@hooks/useCancelToken'
|
import { useCancelToken } from '@hooks/useCancelToken'
|
||||||
|
|
||||||
const REFETCH_INTERVAL = 20000
|
const REFETCH_INTERVAL = 20000
|
||||||
|
@ -5,6 +5,7 @@ import { AssetSelectionAsset } from '@shared/FormFields/AssetSelection'
|
|||||||
import AssetComputeList from '@shared/AssetList/AssetComputeList'
|
import AssetComputeList from '@shared/AssetList/AssetComputeList'
|
||||||
import { useCancelToken } from '@hooks/useCancelToken'
|
import { useCancelToken } from '@hooks/useCancelToken'
|
||||||
import { getServiceByName } from '@utils/ddo'
|
import { getServiceByName } from '@utils/ddo'
|
||||||
|
import { Asset } from '@oceanprotocol/lib'
|
||||||
|
|
||||||
export default function AlgorithmDatasetsListForCompute({
|
export default function AlgorithmDatasetsListForCompute({
|
||||||
ddo,
|
ddo,
|
||||||
|
@ -10,6 +10,7 @@ import { useAsset } from '@context/Asset'
|
|||||||
import { useOcean } from '@context/Ocean'
|
import { useOcean } from '@context/Ocean'
|
||||||
import { useWeb3 } from '@context/Web3'
|
import { useWeb3 } from '@context/Web3'
|
||||||
import content from '../../../../../content/pages/startComputeDataset.json'
|
import content from '../../../../../content/pages/startComputeDataset.json'
|
||||||
|
import { Asset } from '@oceanprotocol/lib'
|
||||||
|
|
||||||
export default function FormStartCompute({
|
export default function FormStartCompute({
|
||||||
algorithms,
|
algorithms,
|
||||||
@ -159,7 +160,7 @@ export default function FormStartCompute({
|
|||||||
}
|
}
|
||||||
hasPreviousOrder={hasPreviousOrder}
|
hasPreviousOrder={hasPreviousOrder}
|
||||||
hasDatatoken={hasDatatoken}
|
hasDatatoken={hasDatatoken}
|
||||||
dtSymbol={ddo?.dataTokenInfo?.symbol}
|
dtSymbol={ddo?.datatokens[0]?.symbol}
|
||||||
dtBalance={dtBalance}
|
dtBalance={dtBalance}
|
||||||
datasetLowPoolLiquidity={datasetLowPoolLiquidity}
|
datasetLowPoolLiquidity={datasetLowPoolLiquidity}
|
||||||
assetTimeout={assetTimeout}
|
assetTimeout={assetTimeout}
|
||||||
|
@ -2,14 +2,16 @@ import React, { useState, ReactElement, useEffect, useCallback } from 'react'
|
|||||||
import {
|
import {
|
||||||
LoggerInstance,
|
LoggerInstance,
|
||||||
ComputeAlgorithm,
|
ComputeAlgorithm,
|
||||||
ComputeOutput
|
ComputeOutput,
|
||||||
|
Asset,
|
||||||
|
DDO,
|
||||||
|
PublisherTrustedAlgorithm
|
||||||
} from '@oceanprotocol/lib'
|
} from '@oceanprotocol/lib'
|
||||||
import { toast } from 'react-toastify'
|
import { toast } from 'react-toastify'
|
||||||
import Price from '@shared/Price'
|
import Price from '@shared/Price'
|
||||||
import FileIcon from '@shared/FileIcon'
|
import FileIcon from '@shared/FileIcon'
|
||||||
import Alert from '@shared/atoms/Alert'
|
import Alert from '@shared/atoms/Alert'
|
||||||
import { useSiteMetadata } from '@hooks/useSiteMetadata'
|
import { useSiteMetadata } from '@hooks/useSiteMetadata'
|
||||||
import { useOcean } from '@context/Ocean'
|
|
||||||
import { useWeb3 } from '@context/Web3'
|
import { useWeb3 } from '@context/Web3'
|
||||||
import { usePricing } from '@hooks/usePricing'
|
import { usePricing } from '@hooks/usePricing'
|
||||||
import { useAsset } from '@context/Asset'
|
import { useAsset } from '@context/Asset'
|
||||||
@ -427,7 +429,7 @@ export default function Compute({
|
|||||||
hasDatatokenSelectedComputeAsset={hasAlgoAssetDatatoken}
|
hasDatatokenSelectedComputeAsset={hasAlgoAssetDatatoken}
|
||||||
oceanSymbol={price ? price.oceanSymbol : ''}
|
oceanSymbol={price ? price.oceanSymbol : ''}
|
||||||
dtSymbolSelectedComputeAsset={
|
dtSymbolSelectedComputeAsset={
|
||||||
selectedAlgorithmAsset?.dataTokenInfo?.symbol
|
selectedAlgorithmAsset?.datatokens[0]?.symbol
|
||||||
}
|
}
|
||||||
dtBalanceSelectedComputeAsset={algorithmDTBalance}
|
dtBalanceSelectedComputeAsset={algorithmDTBalance}
|
||||||
selectedComputeAssetLowPoolLiquidity={!isAlgoConsumablePrice}
|
selectedComputeAssetLowPoolLiquidity={!isAlgoConsumablePrice}
|
||||||
|
@ -17,6 +17,7 @@ import AlgorithmDatasetsListForCompute from './Compute/AlgorithmDatasetsListForC
|
|||||||
import styles from './Consume.module.css'
|
import styles from './Consume.module.css'
|
||||||
import { useIsMounted } from '@hooks/useIsMounted'
|
import { useIsMounted } from '@hooks/useIsMounted'
|
||||||
import { FileMetadata } from '@utils/provider'
|
import { FileMetadata } from '@utils/provider'
|
||||||
|
import { Asset } from '@oceanprotocol/lib'
|
||||||
|
|
||||||
const previousOrderQuery = gql`
|
const previousOrderQuery = gql`
|
||||||
query PreviousOrder($id: String!, $account: String!) {
|
query PreviousOrder($id: String!, $account: String!) {
|
||||||
@ -177,7 +178,7 @@ export default function Consume({
|
|||||||
disabled={isDisabled}
|
disabled={isDisabled}
|
||||||
hasPreviousOrder={hasPreviousOrder}
|
hasPreviousOrder={hasPreviousOrder}
|
||||||
hasDatatoken={hasDatatoken}
|
hasDatatoken={hasDatatoken}
|
||||||
dtSymbol={ddo?.dataTokenInfo?.symbol}
|
dtSymbol={ddo?.datatokens[0]?.symbol}
|
||||||
dtBalance={dtBalance}
|
dtBalance={dtBalance}
|
||||||
datasetLowPoolLiquidity={!isConsumablePrice}
|
datasetLowPoolLiquidity={!isConsumablePrice}
|
||||||
onClick={handleConsume}
|
onClick={handleConsume}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { ReactElement, useState } from 'react'
|
import React, { ReactElement, useState } from 'react'
|
||||||
import { LoggerInstance } from '@oceanprotocol/lib'
|
import { Asset, LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
import { Formik } from 'formik'
|
import { Formik } from 'formik'
|
||||||
import Actions from '../Pool/Actions'
|
import Actions from '../Pool/Actions'
|
||||||
|
@ -11,6 +11,7 @@ import PriceImpact from './PriceImpact'
|
|||||||
import Decimal from 'decimal.js'
|
import Decimal from 'decimal.js'
|
||||||
import { useAsset } from '@context/Asset'
|
import { useAsset } from '@context/Asset'
|
||||||
import { FormTradeData, TradeItem } from './_types'
|
import { FormTradeData, TradeItem } from './_types'
|
||||||
|
import { Asset } from '@oceanprotocol/lib'
|
||||||
|
|
||||||
Decimal.set({ toExpNeg: -18, precision: 18, rounding: 1 })
|
Decimal.set({ toExpNeg: -18, precision: 18, rounding: 1 })
|
||||||
|
|
||||||
@ -41,7 +42,7 @@ export default function Swap({
|
|||||||
})
|
})
|
||||||
const [dtItem, setDtItem] = useState<TradeItem>({
|
const [dtItem, setDtItem] = useState<TradeItem>({
|
||||||
amount: '0',
|
amount: '0',
|
||||||
token: ddo.dataTokenInfo.symbol,
|
token: ddo.datatokens[0].symbol,
|
||||||
maxAmount: '0'
|
maxAmount: '0'
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -126,7 +127,7 @@ export default function Swap({
|
|||||||
|
|
||||||
const switchTokens = () => {
|
const switchTokens = () => {
|
||||||
setFieldValue('type', values.type === 'buy' ? 'sell' : 'buy')
|
setFieldValue('type', values.type === 'buy' ? 'sell' : 'buy')
|
||||||
setCoin(values.type === 'sell' ? 'OCEAN' : ddo.dataTokenInfo.symbol)
|
setCoin(values.type === 'sell' ? 'OCEAN' : ddo.datatokens[0].symbol)
|
||||||
// don't reset form because we don't want to reset type
|
// don't reset form because we don't want to reset type
|
||||||
setFieldValue('datatoken', 0)
|
setFieldValue('datatoken', 0)
|
||||||
setFieldValue('ocean', 0)
|
setFieldValue('ocean', 0)
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
import React, { ReactElement, useState, useEffect } from 'react'
|
import React, { ReactElement, useState, useEffect } from 'react'
|
||||||
import Compute from './Compute'
|
import Compute from './Compute'
|
||||||
import Consume from './Consume'
|
import Consume from './Consume'
|
||||||
import { LoggerInstance } from '@oceanprotocol/lib'
|
import { Asset, LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import Tabs, { TabsItem } from '@shared/atoms/Tabs'
|
import Tabs, { TabsItem } from '@shared/atoms/Tabs'
|
||||||
import { compareAsBN } from '@utils/numbers'
|
import { compareAsBN } from '@utils/numbers'
|
||||||
import Pool from './Pool'
|
import Pool from './Pool'
|
||||||
import Trade from './Trade'
|
import Trade from './Trade'
|
||||||
import { useAsset } from '@context/Asset'
|
import { useAsset } from '@context/Asset'
|
||||||
import { useOcean } from '@context/Ocean'
|
|
||||||
import { useWeb3 } from '@context/Web3'
|
import { useWeb3 } from '@context/Web3'
|
||||||
import Web3Feedback from '@shared/Web3Feedback'
|
import Web3Feedback from '@shared/Web3Feedback'
|
||||||
import { FileMetadata, getFileInfo } from '@utils/provider'
|
import { FileMetadata, getFileInfo } from '@utils/provider'
|
||||||
|
@ -3,6 +3,7 @@ import MetaItem from './MetaItem'
|
|||||||
import styles from './MetaFull.module.css'
|
import styles from './MetaFull.module.css'
|
||||||
import Publisher from '@shared/Publisher'
|
import Publisher from '@shared/Publisher'
|
||||||
import { useAsset } from '@context/Asset'
|
import { useAsset } from '@context/Asset'
|
||||||
|
import { Asset } from '@oceanprotocol/lib'
|
||||||
|
|
||||||
export default function MetaFull({ ddo }: { ddo: Asset }): ReactElement {
|
export default function MetaFull({ ddo }: { ddo: Asset }): ReactElement {
|
||||||
const { isInPurgatory } = useAsset()
|
const { isInPurgatory } = useAsset()
|
||||||
|
@ -8,6 +8,7 @@ import Time from '@shared/atoms/Time'
|
|||||||
import AssetType from '@shared/AssetType'
|
import AssetType from '@shared/AssetType'
|
||||||
import styles from './MetaMain.module.css'
|
import styles from './MetaMain.module.css'
|
||||||
import { getServiceByName } from '@utils/ddo'
|
import { getServiceByName } from '@utils/ddo'
|
||||||
|
import { Asset } from '@oceanprotocol/lib'
|
||||||
|
|
||||||
export default function MetaMain({ ddo }: { ddo: Asset }): ReactElement {
|
export default function MetaMain({ ddo }: { ddo: Asset }): ReactElement {
|
||||||
const { isAssetNetwork } = useAsset()
|
const { isAssetNetwork } = useAsset()
|
||||||
@ -18,8 +19,8 @@ export default function MetaMain({ ddo }: { ddo: Asset }): ReactElement {
|
|||||||
const blockscoutNetworks = [1287, 2021000, 2021001, 44787, 246, 1285]
|
const blockscoutNetworks = [1287, 2021000, 2021001, 44787, 246, 1285]
|
||||||
const isBlockscoutExplorer = blockscoutNetworks.includes(ddo?.chainId)
|
const isBlockscoutExplorer = blockscoutNetworks.includes(ddo?.chainId)
|
||||||
|
|
||||||
const dataTokenName = ddo?.dataTokenInfo?.name
|
const dataTokenName = ddo?.datatokens[0]?.name
|
||||||
const dataTokenSymbol = ddo?.dataTokenInfo?.symbol
|
const dataTokenSymbol = ddo?.datatokens[0]?.symbol
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<aside className={styles.meta}>
|
<aside className={styles.meta}>
|
||||||
@ -45,9 +46,9 @@ export default function MetaMain({ ddo }: { ddo: Asset }): ReactElement {
|
|||||||
<span className={styles.addWrap}>
|
<span className={styles.addWrap}>
|
||||||
<AddToken
|
<AddToken
|
||||||
address={ddo?.services[0].datatokenAddress}
|
address={ddo?.services[0].datatokenAddress}
|
||||||
symbol={(ddo as Asset)?.dataTokenInfo?.symbol}
|
symbol={(ddo as Asset)?.datatokens[0]?.symbol}
|
||||||
logo="https://raw.githubusercontent.com/oceanprotocol/art/main/logo/datatoken.png"
|
logo="https://raw.githubusercontent.com/oceanprotocol/art/main/logo/datatoken.png"
|
||||||
text={`Add ${(ddo as Asset)?.dataTokenInfo?.symbol} to wallet`}
|
text={`Add ${(ddo as Asset)?.datatokens[0]?.symbol} to wallet`}
|
||||||
className={styles.add}
|
className={styles.add}
|
||||||
minimal
|
minimal
|
||||||
/>
|
/>
|
||||||
|
@ -3,6 +3,7 @@ import MetaItem from './MetaItem'
|
|||||||
import styles from './MetaSecondary.module.css'
|
import styles from './MetaSecondary.module.css'
|
||||||
import Tags from '@shared/atoms/Tags'
|
import Tags from '@shared/atoms/Tags'
|
||||||
import Button from '@shared/atoms/Button'
|
import Button from '@shared/atoms/Button'
|
||||||
|
import { Asset } from '@oceanprotocol/lib'
|
||||||
|
|
||||||
const SampleButton = ({ url }: { url: string }) => (
|
const SampleButton = ({ url }: { url: string }) => (
|
||||||
<Button
|
<Button
|
||||||
|
@ -13,6 +13,7 @@ import EditHistory from './EditHistory'
|
|||||||
import styles from './index.module.css'
|
import styles from './index.module.css'
|
||||||
import NetworkName from '@shared/NetworkName'
|
import NetworkName from '@shared/NetworkName'
|
||||||
import content from '../../../../content/purgatory.json'
|
import content from '../../../../content/purgatory.json'
|
||||||
|
import { Asset } from '@oceanprotocol/lib'
|
||||||
|
|
||||||
export default function AssetContent({
|
export default function AssetContent({
|
||||||
ddo,
|
ddo,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { ServiceComputeOptions } from '@oceanprotocol/lib'
|
import { Asset, ServiceComputeOptions } from '@oceanprotocol/lib'
|
||||||
import React, { ReactElement, useEffect, useState } from 'react'
|
import React, { ReactElement, useEffect, useState } from 'react'
|
||||||
// import { transformComputeFormToServiceComputePrivacy } from '@utils/compute'
|
// import { transformComputeFormToServiceComputePrivacy } from '@utils/compute'
|
||||||
import DebugOutput from '@shared/DebugOutput'
|
import DebugOutput from '@shared/DebugOutput'
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { Metadata } from '@oceanprotocol/lib'
|
||||||
import { mapTimeoutStringToSeconds, secondsToString } from '@utils/ddo'
|
import { mapTimeoutStringToSeconds, secondsToString } from '@utils/ddo'
|
||||||
// import { EditableMetadataLinks } from '@oceanprotocol/lib'
|
// import { EditableMetadataLinks } from '@oceanprotocol/lib'
|
||||||
import * as Yup from 'yup'
|
import * as Yup from 'yup'
|
||||||
|
@ -25,8 +25,8 @@ const columns = [
|
|||||||
name: 'Datatoken Symbol',
|
name: 'Datatoken Symbol',
|
||||||
selector: function getAssetRow(row: AssetListPrices) {
|
selector: function getAssetRow(row: AssetListPrices) {
|
||||||
return (
|
return (
|
||||||
<Tooltip content={row.ddo.dataTokenInfo.name}>
|
<Tooltip content={row.ddo.datatokens[0].name}>
|
||||||
{row.ddo.dataTokenInfo.symbol}
|
{row.ddo.datatokens[0].symbol}
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
@ -8,7 +8,7 @@ import {
|
|||||||
queryMetadata
|
queryMetadata
|
||||||
} from '@utils/aquarius'
|
} from '@utils/aquarius'
|
||||||
import { getHighestLiquidityDatatokens } from '@utils/subgraph'
|
import { getHighestLiquidityDatatokens } from '@utils/subgraph'
|
||||||
import { LoggerInstance } from '@oceanprotocol/lib'
|
import { Asset, LoggerInstance } from '@oceanprotocol/lib'
|
||||||
import { useUserPreferences } from '@context/UserPreferences'
|
import { useUserPreferences } from '@context/UserPreferences'
|
||||||
import styles from './index.module.css'
|
import styles from './index.module.css'
|
||||||
import { useIsMounted } from '@hooks/useIsMounted'
|
import { useIsMounted } from '@hooks/useIsMounted'
|
||||||
|
@ -47,7 +47,7 @@ function DetailsAssets({ job }: { job: ComputeJobMetaData }) {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function getAlgoMetadata() {
|
async function getAlgoMetadata() {
|
||||||
const ddo = await retrieveDDO(job.algoDID, newCancelToken())
|
const ddo = await retrieveDDO(job.algoDID, newCancelToken())
|
||||||
setAlgoDtSymbol(ddo.dataTokenInfo.symbol)
|
setAlgoDtSymbol(ddo.datatokens[0].symbol)
|
||||||
setAlgoName(ddo?.metadata.name)
|
setAlgoName(ddo?.metadata.name)
|
||||||
}
|
}
|
||||||
getAlgoMetadata()
|
getAlgoMetadata()
|
||||||
|
@ -19,6 +19,7 @@ import { useProfile } from '@context/Profile'
|
|||||||
import { useCancelToken } from '@hooks/useCancelToken'
|
import { useCancelToken } from '@hooks/useCancelToken'
|
||||||
import { useIsMounted } from '@hooks/useIsMounted'
|
import { useIsMounted } from '@hooks/useIsMounted'
|
||||||
import { useUserPreferences } from '@context/UserPreferences'
|
import { useUserPreferences } from '@context/UserPreferences'
|
||||||
|
import { Asset } from '@oceanprotocol/lib'
|
||||||
|
|
||||||
Decimal.set({ toExpNeg: -18, precision: 18, rounding: 1 })
|
Decimal.set({ toExpNeg: -18, precision: 18, rounding: 1 })
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import { FormPublishData } from '../_types'
|
|||||||
import { useFormikContext } from 'formik'
|
import { useFormikContext } from 'formik'
|
||||||
import { transformPublishFormToDdo } from '../_utils'
|
import { transformPublishFormToDdo } from '../_utils'
|
||||||
import styles from './index.module.css'
|
import styles from './index.module.css'
|
||||||
|
import { DDO } from '@oceanprotocol/lib'
|
||||||
|
|
||||||
export default function Debug(): ReactElement {
|
export default function Debug(): ReactElement {
|
||||||
const { values } = useFormikContext<FormPublishData>()
|
const { values } = useFormikContext<FormPublishData>()
|
||||||
|
@ -4,6 +4,7 @@ import { FormPublishData } from '../_types'
|
|||||||
import { useFormikContext } from 'formik'
|
import { useFormikContext } from 'formik'
|
||||||
import AssetContent from 'src/components/Asset/AssetContent'
|
import AssetContent from 'src/components/Asset/AssetContent'
|
||||||
import { transformPublishFormToDdo } from '../_utils'
|
import { transformPublishFormToDdo } from '../_utils'
|
||||||
|
import { Asset } from '@oceanprotocol/lib'
|
||||||
|
|
||||||
export default function Preview(): ReactElement {
|
export default function Preview(): ReactElement {
|
||||||
const [ddo, setDdo] = useState<Asset>()
|
const [ddo, setDdo] = useState<Asset>()
|
||||||
|
@ -7,6 +7,7 @@ import MetadataFields from './Metadata'
|
|||||||
import ServicesFields from './Services'
|
import ServicesFields from './Services'
|
||||||
import Preview from './Preview'
|
import Preview from './Preview'
|
||||||
import Submission from './Submission'
|
import Submission from './Submission'
|
||||||
|
import { ServiceComputeOptions } from '@oceanprotocol/lib'
|
||||||
|
|
||||||
export const wizardSteps: StepContent[] = [
|
export const wizardSteps: StepContent[] = [
|
||||||
{
|
{
|
||||||
@ -98,6 +99,13 @@ export const initialValues: FormPublishData = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface MetadataAlgorithmContainer {
|
||||||
|
entrypoint: string
|
||||||
|
image: string
|
||||||
|
tag: string
|
||||||
|
checksum: string
|
||||||
|
}
|
||||||
|
|
||||||
export const algorithmContainerPresets: MetadataAlgorithmContainer[] = [
|
export const algorithmContainerPresets: MetadataAlgorithmContainer[] = [
|
||||||
{
|
{
|
||||||
image: 'node',
|
image: 'node',
|
||||||
|
@ -8,7 +8,10 @@ import {
|
|||||||
import { mapTimeoutStringToSeconds } from '@utils/ddo'
|
import { mapTimeoutStringToSeconds } from '@utils/ddo'
|
||||||
import { getEncryptedFiles } from '@utils/provider'
|
import { getEncryptedFiles } from '@utils/provider'
|
||||||
import slugify from 'slugify'
|
import slugify from 'slugify'
|
||||||
import { algorithmContainerPresets } from './_constants'
|
import {
|
||||||
|
algorithmContainerPresets,
|
||||||
|
MetadataAlgorithmContainer
|
||||||
|
} from './_constants'
|
||||||
import { FormPublishData } from './_types'
|
import { FormPublishData } from './_types'
|
||||||
|
|
||||||
export function getFieldContent(
|
export function getFieldContent(
|
||||||
@ -148,6 +151,7 @@ export async function transformPublishFormToDdo(
|
|||||||
const newDdo: DDO = {
|
const newDdo: DDO = {
|
||||||
'@context': ['https://w3id.org/did/v1'],
|
'@context': ['https://w3id.org/did/v1'],
|
||||||
id: did,
|
id: did,
|
||||||
|
nftAddress,
|
||||||
version: '4.0.0',
|
version: '4.0.0',
|
||||||
chainId,
|
chainId,
|
||||||
nftAddress,
|
nftAddress,
|
||||||
|
Loading…
Reference in New Issue
Block a user