diff --git a/src/@types/DDO/Credentials.d.ts b/src/@types/DDO/Credentials.d.ts deleted file mode 100644 index bebe34a9d..000000000 --- a/src/@types/DDO/Credentials.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -interface Credential { - type: string - values: string[] -} - -interface Credentials { - allow: Credential[] - deny: Credential[] -} diff --git a/src/@types/DDO/Metadata.d.ts b/src/@types/DDO/Metadata.d.ts index 4ab62ec36..9ebdc3a22 100644 --- a/src/@types/DDO/Metadata.d.ts +++ b/src/@types/DDO/Metadata.d.ts @@ -10,19 +10,3 @@ interface MetadataAlgorithm { version?: string container: MetadataAlgorithmContainer } - -interface Metadata { - created: string - updated: string - name: string - description: string - type: 'dataset' | 'algorithm' | string - author: string - license: string - links?: string[] - tags?: string[] - copyrightHolder?: string - contentLanguage?: string - algorithm?: MetadataAlgorithm - additionalInformation?: any -} diff --git a/src/@types/DDO/Services.d.ts b/src/@types/DDO/Services.d.ts deleted file mode 100644 index 01848e511..000000000 --- a/src/@types/DDO/Services.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -interface PublisherTrustedAlgorithm { - did: string - filesChecksum: string - containerSectionChecksum: string -} - -interface ServiceComputeOptions { - namespace: string - cpu?: number - gpu?: number - gpuType?: string - memory?: string - volumeSize?: string - allowRawAlgorithm: boolean - allowNetworkAccess: boolean - publisherTrustedAlgorithmPublishers: string[] - publisherTrustedAlgorithms: PublisherTrustedAlgorithm[] -} - -interface Service { - id: string - type: 'access' | 'compute' | string - files: string - datatokenAddress: string - serviceEndpoint: string - timeout: number - name?: string - description?: string - compute?: ServiceComputeOptions -} diff --git a/src/@types/DDO/index.d.ts b/src/@types/DDO/index.d.ts deleted file mode 100644 index 7069761d2..000000000 --- a/src/@types/DDO/index.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -// DDO spec -interface DDO { - '@context': string[] - id: string - version: string - chainId: number - metadata: Metadata - services: Service[] - credentials?: Credentials -} diff --git a/src/components/Publish/_types.ts b/src/components/Publish/_types.ts index 94cd42eae..74cca835b 100644 --- a/src/components/Publish/_types.ts +++ b/src/components/Publish/_types.ts @@ -1,3 +1,4 @@ +import { ServiceComputeOptions } from '@oceanprotocol/lib' import { DataTokenOptions } from '@utils/datatokens' import { NftOptions } from '@utils/nft' import { ReactElement } from 'react' @@ -28,7 +29,7 @@ export interface FormPublishData { } metadata: { nft: NftOptions - type: 'Dataset' | 'Algorithm' | string + type: 'dataset' | 'algorithm' name: string description: string author: string diff --git a/src/components/Publish/_utils.ts b/src/components/Publish/_utils.ts index 540838721..8af629b98 100644 --- a/src/components/Publish/_utils.ts +++ b/src/components/Publish/_utils.ts @@ -1,4 +1,4 @@ -import { generateDid } from '@oceanprotocol/lib' +import { DDO, generateDid, Metadata, Service } from '@oceanprotocol/lib' import { mapTimeoutStringToSeconds } from '@utils/ddo' import { getEncryptedFiles } from '@utils/provider' import slugify from 'slugify' @@ -127,6 +127,7 @@ export async function transformPublishFormToDdo( files[0].valid && (await getEncryptedFiles(file, providerUrl.url)) + // TODO: fix id const newService: Service = { id: 'notAnId', type: access, @@ -144,6 +145,7 @@ export async function transformPublishFormToDdo( id: did, version: '4.0.0', chainId, + nftAddress, metadata: newMetadata, services: [newService] // Only added for DDO preview, reflecting Asset response,