diff --git a/src/@utils/provider.ts b/src/@utils/provider.ts index 9f65b8910..4cfc0fd74 100644 --- a/src/@utils/provider.ts +++ b/src/@utils/provider.ts @@ -5,13 +5,6 @@ import { ProviderInstance } from '@oceanprotocol/lib' -export interface FileInfo { - index: number - valid: boolean - contentType: string - contentLength: string -} - export async function getEncryptedFiles( files: FileMetadata[], providerUrl: string @@ -41,13 +34,13 @@ export async function getFileInfo( url: string, providerUrl: string, cancelToken: CancelToken -): Promise { +): Promise { try { // TODO: what was the point of this? // if (url instanceof DID) postBody = { did: url.getDid() } // else postBody = { url } const postBody = { url, type: 'url' } - const response: AxiosResponse = await axios.post( + const response: AxiosResponse = await axios.post( `${providerUrl}/api/services/fileinfo`, postBody, { cancelToken } diff --git a/src/components/@shared/FileIcon/index.tsx b/src/components/@shared/FileIcon/index.tsx index 40748ad7b..5d2874ce7 100644 --- a/src/components/@shared/FileIcon/index.tsx +++ b/src/components/@shared/FileIcon/index.tsx @@ -4,7 +4,7 @@ import classNames from 'classnames/bind' import cleanupContentType from '@utils/cleanupContentType' import styles from './index.module.css' import Loader from '@shared/atoms/Loader' -import { FileMetadata } from '@utils/provider' +import { FileMetadata } from '@oceanprotocol/lib' const cx = classNames.bind(styles) diff --git a/src/components/@shared/FormFields/FilesInput/Info.tsx b/src/components/@shared/FormFields/FilesInput/Info.tsx index 12a6603d5..9b85ffb79 100644 --- a/src/components/@shared/FormFields/FilesInput/Info.tsx +++ b/src/components/@shared/FormFields/FilesInput/Info.tsx @@ -2,7 +2,7 @@ import React, { ReactElement } from 'react' import { prettySize } from './utils' import cleanupContentType from '@utils/cleanupContentType' import styles from './Info.module.css' -import { FileMetadata } from '@utils/provider' +import { FileMetadata } from '@oceanprotocol/lib' export default function FileInfo({ file, @@ -13,7 +13,7 @@ export default function FileInfo({ }): ReactElement { return (
-

{(file as any).url}

+

{file.url}

  • ✓ URL confirmed
  • {file.contentLength &&
  • {prettySize(+file.contentLength)}
  • } diff --git a/src/components/Asset/AssetActions/Compute/index.tsx b/src/components/Asset/AssetActions/Compute/index.tsx index 70ede8cb3..773a5c05e 100644 --- a/src/components/Asset/AssetActions/Compute/index.tsx +++ b/src/components/Asset/AssetActions/Compute/index.tsx @@ -5,7 +5,8 @@ import { ComputeOutput, Asset, DDO, - PublisherTrustedAlgorithm + PublisherTrustedAlgorithm, + FileMetadata } from '@oceanprotocol/lib' import { toast } from 'react-toastify' import Price from '@shared/Price' @@ -14,7 +15,6 @@ import Alert from '@shared/atoms/Alert' import { useSiteMetadata } from '@hooks/useSiteMetadata' import { useWeb3 } from '@context/Web3' import { usePricing } from '@hooks/usePricing' -import { useAsset } from '@context/Asset' import { generateBaseQuery, getFilterTerm, @@ -36,7 +36,6 @@ import ComputeJobs from '../../../Profile/History/ComputeJobs' import { useCancelToken } from '@hooks/useCancelToken' import { useIsMounted } from '@hooks/useIsMounted' import { SortTermOptions } from '../../../../@types/aquarius/SearchQuery' -import { FileMetadata } from '@utils/provider' export default function Compute({ ddo, diff --git a/src/components/Asset/AssetActions/Consume.tsx b/src/components/Asset/AssetActions/Consume.tsx index 6271afb44..c35e187d0 100644 --- a/src/components/Asset/AssetActions/Consume.tsx +++ b/src/components/Asset/AssetActions/Consume.tsx @@ -16,8 +16,7 @@ import { secondsToString } from '@utils/ddo' import AlgorithmDatasetsListForCompute from './Compute/AlgorithmDatasetsListForCompute' import styles from './Consume.module.css' import { useIsMounted } from '@hooks/useIsMounted' -import { FileMetadata } from '@utils/provider' -import { Asset } from '@oceanprotocol/lib' +import { Asset, FileMetadata } from '@oceanprotocol/lib' const previousOrderQuery = gql` query PreviousOrder($id: String!, $account: String!) { diff --git a/src/components/Asset/AssetActions/index.tsx b/src/components/Asset/AssetActions/index.tsx index 8ea0d0c9a..6c83fd734 100644 --- a/src/components/Asset/AssetActions/index.tsx +++ b/src/components/Asset/AssetActions/index.tsx @@ -1,7 +1,7 @@ import React, { ReactElement, useState, useEffect } from 'react' import Compute from './Compute' import Consume from './Consume' -import { Asset, LoggerInstance } from '@oceanprotocol/lib' +import { Asset, FileMetadata, LoggerInstance } from '@oceanprotocol/lib' import Tabs, { TabsItem } from '@shared/atoms/Tabs' import { compareAsBN } from '@utils/numbers' import Pool from './Pool' @@ -9,7 +9,7 @@ import Trade from './Trade' import { useAsset } from '@context/Asset' import { useWeb3 } from '@context/Web3' import Web3Feedback from '@shared/Web3Feedback' -import { FileMetadata, getFileInfo } from '@utils/provider' +import { getFileInfo } from '@utils/provider' import { getOceanConfig } from '@utils/ocean' import { useCancelToken } from '@hooks/useCancelToken' import { useIsMounted } from '@hooks/useIsMounted' diff --git a/src/components/Publish/_utils.ts b/src/components/Publish/_utils.ts index b588dc0d4..21c0ec815 100644 --- a/src/components/Publish/_utils.ts +++ b/src/components/Publish/_utils.ts @@ -154,7 +154,6 @@ export async function transformPublishFormToDdo( nftAddress, version: '4.0.0', chainId, - nftAddress, metadata: newMetadata, services: [newService] // Only added for DDO preview, reflecting Asset response,