import { AaveConditionType, ServiceAaveCredit, TxParameters } from '../keeper'; import { Account } from '../sdk'; import { BigNumber } from 'ethers'; import { ERCType, NeverminedNFTType, AssetPrice, Babysig } from '../models'; export interface Authentication { type: string; publicKey: string; } export interface Provider { type: string; description: string; environment: { cluster: { type: string; url: string; }; supportedContainers: { image: string; tag: string; checksum: string; }[]; supportedServers: { serverId: string; serverType: string; price: string; cpu: string; gpu: string; memory: string; disk: string; maxExecutionTime: number; }[]; }; } export interface StageInput { index: number; id: string; } export interface StageTransformation { id: string; } export interface StageOutput { metadataUrl: string; accessProxyUrl: string; metadata: MetaDataMain; } export interface Stage { index: number; stageType?: string; input: StageInput[]; transformation: StageTransformation; output: StageOutput; } export interface Workflow { coordinationType: 'argo' | 'fl-coordinator' | 'bacalhau'; stages: Stage[]; } export interface Algorithm { language: string; format?: string; version?: string; entrypoint: string; requirements: { requirement?: string; version?: string; container?: any; }; } export interface ServiceDefinition { auth: { type: string; user?: string; password?: string; token?: string; }; endpoints: { index: number; url: string; method: string; contentTypes: string[]; }; } export interface ServiceMetadata { spec?: string; specChecksum?: string; definition: ServiceDefinition; } export interface MetaDataFile { name?: string; url: string; index?: number; contentType: string; checksum?: string; checksumType?: string; contentLength?: string; resourceId?: string; encoding?: string; compression?: string; encryption?: 'dtp'; } export interface MetaDataMain { name: string; type: 'dataset' | 'algorithm' | 'compute' | 'workflow' | 'compute' | 'other'; dateCreated: string; datePublished?: string; author: string; license: string; files?: MetaDataFile[]; encryptedService?: any; workflow?: Workflow; algorithm?: Algorithm; service?: Service; ercType?: ERCType; nftType?: NeverminedNFTType; isDTP?: boolean; } export interface Curation { rating: number; numVotes: number; schema?: string; isListed?: boolean; } export interface AdditionalInformation { description?: string; copyrightHolder?: string; workExample?: string; links?: { [name: string]: string; }[]; inLanguage?: string; categories?: string[]; tags?: string[]; updateFrequency?: string; structuredMarkup?: { uri: string; mediaType: string; }[]; customData?: { [key: string]: any; }; poseidonHash?: string; providerKey?: { x: string; y: string; }; priceHighestDenomination?: number; } export interface MetaData { userId?: string; main: MetaDataMain; encryptedFiles?: string; additionalInformation?: AdditionalInformation; curation?: Curation; } export interface PublicKey { id: string; type: 'Ed25519VerificationKey2018' | 'RsaVerificationKey2018' | 'EdDsaSAPublicKeySecp256k1' | 'EthereumECDSAKey'; owner: string; publicKeyPem?: string; publicKeyBase58?: string; publicKeyHex?: string; } export interface NvmConfig { userId: string; appId: string; versions: NvmConfigVersions[]; } export declare enum ImmutableBackends { Filecoin = "filecoin", IPFS = "ipfs" } export interface NvmConfigVersions { id: number; updated: string; checksum: string; immutableUrl?: string; immutableBackend?: ImmutableBackends; } export type ConditionType = 'lockPayment' | 'escrowPayment' | 'nftHolder' | 'transferNFT' | AaveConditionType; export type ServiceType = 'authorization' | 'metadata' | 'access' | 'compute' | 'workflow' | 'nft-access' | 'nft-sales' | 'aave-credit' | 'nft-sales-proof'; export declare const serviceIndex: { authorization: number; metadata: number; access: number; 'access-proof': number; compute: number; workflow: number; 'nft-access': number; 'nft-sales': number; 'nft721-access': number; 'nft721-sales': number; 'aave-credit': number; 'nft-access-proof': number; 'nft-sales-proof': number; 'nft721-access-proof': number; 'nft721-sales-proof': number; }; export interface ServiceCommon { type: ServiceType; index: number; serviceEndpoint?: string; templateId?: string; attributes: any & { main: { [key: string]: any; }; }; } export type Priced = { attributes: { main: { price: string; }; additionalInformation: { priceHighestDenomination: number; }; }; }; export interface Proof { type: string; created: string; creator: string; signatureValue: string; checksum: any; } export interface ServiceAuthorization extends ServiceCommon { type: 'authorization'; service: 'None' | 'RSAES-OAEP'; } export interface ServiceMetadata extends ServiceCommon { type: 'metadata'; attributes: MetaData; } export interface ServiceAccess extends ServiceCommon, Priced { type: 'access'; templateId?: string; attributes: { main: { creator: string; name: string; datePublished: string; price: string; timeout: number; }; serviceAgreementTemplate?: ServiceAgreementTemplate; additionalInformation: { description: string; priceHighestDenomination: number; }; }; } export interface ServiceCompute extends ServiceCommon, Priced { type: 'compute'; templateId?: string; attributes: { main: { creator: string; name: string; datePublished: string; price: string; timeout: number; }; serviceAgreementTemplate?: ServiceAgreementTemplate; additionalInformation: { description: string; priceHighestDenomination: number; }; }; } export interface ServiceNFTAccess extends ServiceCommon { type: 'nft-access'; templateId?: string; attributes: { main: { ercType: ERCType; nftType: NeverminedNFTType; creator: string; name: string; datePublished: string; timeout: number; }; serviceAgreementTemplate?: ServiceAgreementTemplate; additionalInformation: { description: string; }; }; } export interface ServiceNFTSales extends ServiceCommon, Priced { type: 'nft-sales'; templateId?: string; attributes: { main: { ercType: ERCType; nftType: NeverminedNFTType; creator: string; name: string; datePublished: string; price: string; timeout: number; }; serviceAgreementTemplate?: ServiceAgreementTemplate; additionalInformation: { description: string; priceHighestDenomination: number; }; }; } export interface ServiceSecondary extends Service { agreementId: string; did: string; } export type Service = T extends 'authorization' ? ServiceAuthorization : T extends 'metadata' ? ServiceMetadata : T extends 'nft-access' ? ServiceNFTAccess : T extends 'nft-sales' ? ServiceNFTSales : T extends 'access' ? ServiceAccess : T extends 'compute' ? ServiceCompute : T extends 'aave-credit' ? ServiceAaveCredit : T extends 'default' ? ServiceCommon : ServiceCommon; export interface ValidationParams { agreement_id: string; did: string; consumer_address?: string; buyer?: string; babysig?: Babysig; nft_amount?: BigNumber; nft_holder?: string; } export interface ServicePlugin { createService(publisher: Account, metadata: MetaData, assetPrice?: AssetPrice, erc20TokenAddress?: string, priced?: boolean): Promise; process(params: ValidationParams, from: Account, txparams?: TxParameters): Promise; accept(params: ValidationParams): Promise; } export interface ServiceAgreementTemplateParameter { name: string; type: string; value: string | number | string[]; } export interface ServiceAgreementTemplateEvent { name: string; actorType: string; handler: { moduleName: string; functionName: string; version: string; }; } export interface ServiceAgreementTemplateCondition { name: string; timelock: number; timeout: number; contractName: string; functionName: string; parameters: ServiceAgreementTemplateParameter[]; events: ServiceAgreementTemplateEvent[]; } export interface ServiceAgreementTemplate { contractName: string; events: ServiceAgreementTemplateEvent[]; fulfillmentOrder: string[]; conditionDependency: { [condition: string]: string[]; }; conditions: ServiceAgreementTemplateCondition[]; }