mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
Merge branch 'main' into feature/compute
This commit is contained in:
commit
202d690fd5
@ -28,10 +28,15 @@ export default function Price({
|
|||||||
conversion={conversion}
|
conversion={conversion}
|
||||||
type={price.type}
|
type={price.type}
|
||||||
/>
|
/>
|
||||||
) : !price || price?.value === 0 ? (
|
) : !price || !price.address || price.address === '' ? (
|
||||||
<div className={styles.empty}>
|
<div className={styles.empty}>
|
||||||
No price found{' '}
|
No price set{' '}
|
||||||
<Tooltip content="We could not find a pool for this data set, which can have multiple reasons. Is your wallet connected to the correct network?" />
|
<Tooltip content="No pricing mechanism has been set on this asset yet." />
|
||||||
|
</div>
|
||||||
|
) : price.isConsumable !== 'true' ? (
|
||||||
|
<div className={styles.empty}>
|
||||||
|
Low liquidity{' '}
|
||||||
|
<Tooltip content="This pool does not have enough liquidity for using this data set." />
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<Loader message="Retrieving price..." />
|
<Loader message="Retrieving price..." />
|
||||||
|
@ -2,7 +2,7 @@ import { DDO } from '@oceanprotocol/lib'
|
|||||||
import { useOcean } from '@oceanprotocol/react'
|
import { useOcean } from '@oceanprotocol/react'
|
||||||
import { Link } from 'gatsby'
|
import { Link } from 'gatsby'
|
||||||
import React, { ReactElement, useEffect, useState } from 'react'
|
import React, { ReactElement, useEffect, useState } from 'react'
|
||||||
import { retrieveDDO } from '../../utils/aquarius'
|
import { retrieveDDO, getAssetsNames } from '../../utils/aquarius'
|
||||||
import styles from './AssetListTitle.module.css'
|
import styles from './AssetListTitle.module.css'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
@ -28,15 +28,16 @@ export default function AssetListTitle({
|
|||||||
|
|
||||||
const source = axios.CancelToken.source()
|
const source = axios.CancelToken.source()
|
||||||
|
|
||||||
async function getDDO() {
|
async function getAssetName() {
|
||||||
const ddo = await retrieveDDO(did, config.metadataCacheUri, source.token)
|
const title = await getAssetsNames(
|
||||||
|
[did],
|
||||||
if (!ddo) return
|
config.metadataCacheUri,
|
||||||
const { attributes } = ddo.findServiceByType('metadata')
|
source.token
|
||||||
setAssetTitle(attributes.main.name)
|
)
|
||||||
|
setAssetTitle(title[did])
|
||||||
}
|
}
|
||||||
|
|
||||||
!ddo && did && getDDO()
|
!ddo && did && getAssetName()
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
console.log('canceled?')
|
console.log('canceled?')
|
||||||
|
@ -158,13 +158,7 @@ export default function Consume({
|
|||||||
<File file={file} />
|
<File file={file} />
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.pricewrapper}>
|
<div className={styles.pricewrapper}>
|
||||||
{isConsumable ? (
|
<Price ddo={ddo} conversion />
|
||||||
<Price ddo={ddo} conversion />
|
|
||||||
) : (
|
|
||||||
<div className={styles.help}>
|
|
||||||
There is not enough liquidity in the pool to buy this data set.
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{!isInPurgatory && <PurchaseButton />}
|
{!isInPurgatory && <PurchaseButton />}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -73,3 +73,27 @@ export async function retrieveDDO(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getAssetsNames(
|
||||||
|
didList: string[] | DID[],
|
||||||
|
metadataCacheUri: string,
|
||||||
|
cancelToken: CancelToken
|
||||||
|
): Promise<Record<string, string>> {
|
||||||
|
try {
|
||||||
|
const response: AxiosResponse<Record<string, string>> = await axios.post(
|
||||||
|
`${metadataCacheUri}/api/v1/aquarius/assets/names`,
|
||||||
|
{
|
||||||
|
didList,
|
||||||
|
cancelToken
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if (!response || response.status !== 200 || !response.data) return
|
||||||
|
return response.data
|
||||||
|
} catch (error) {
|
||||||
|
if (axios.isCancel(error)) {
|
||||||
|
Logger.log(error.message)
|
||||||
|
} else {
|
||||||
|
Logger.error(error.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -5,7 +5,7 @@ import { Logger } from '@oceanprotocol/lib'
|
|||||||
|
|
||||||
// https://docs.3box.io/api/rest-api
|
// https://docs.3box.io/api/rest-api
|
||||||
const apiUri = 'https://3box.oceanprotocol.com'
|
const apiUri = 'https://3box.oceanprotocol.com'
|
||||||
const ipfsUrl = 'https://ipfs.oceanprotocol.com'
|
const ipfsUrl = 'https://dweb.link'
|
||||||
|
|
||||||
function decodeProof(proofJWT: string) {
|
function decodeProof(proofJWT: string) {
|
||||||
if (!proofJWT) return
|
if (!proofJWT) return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user