import { Metadata, ServiceComputeOptions } from '@oceanprotocol/lib' import { secondsToString } from '@utils/ddo' import { ComputeEditForm, MetadataEditForm } from './_types' export function getInitialValues( metadata: Metadata, timeout: number, price: string ): Partial { return { name: metadata?.name, description: metadata?.description, price, links: metadata?.links as any, files: [{ url: '', type: '' }], timeout: secondsToString(timeout), author: metadata?.author } } export function getComputeSettingsInitialValues({ publisherTrustedAlgorithms, publisherTrustedAlgorithmPublishers }: ServiceComputeOptions): ComputeEditForm { const allowAllPublishedAlgorithms = publisherTrustedAlgorithms === null const publisherTrustedAlgorithmsForForm = allowAllPublishedAlgorithms ? null : publisherTrustedAlgorithms.map((algo) => algo.did) return { allowAllPublishedAlgorithms, publisherTrustedAlgorithms: publisherTrustedAlgorithmsForForm, publisherTrustedAlgorithmPublishers } }