From 8cfbd4024c1298defc3deb1830b73e94b4488496 Mon Sep 17 00:00:00 2001 From: alexcos20 Date: Tue, 10 Mar 2020 13:57:17 +0200 Subject: [PATCH] fixes --- src/ocean/OceanCompute.ts | 14 ++++++++++---- test/integration/ocean/Compute.test.ts | 5 +++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/ocean/OceanCompute.ts b/src/ocean/OceanCompute.ts index 3bdb72a..e096715 100644 --- a/src/ocean/OceanCompute.ts +++ b/src/ocean/OceanCompute.ts @@ -5,6 +5,7 @@ import { DDO } from '../ddo/DDO' import { SubscribablePromise } from '../utils' import { OrderProgressStep } from './utils/ServiceUtils' import { DID } from '../squid' +import {ServiceCompute} from '../ddo/Service' export const ComputeJobStatus = Object.freeze({ Started: 10, @@ -262,12 +263,17 @@ export class OceanCompute extends Instantiable { return computeJobsList[0] as ComputeJob } - public async create_compute_service_attributes(consumerAccount: Account,price: string,datePublished: string){ + public async create_compute_service_attributes( + consumerAccount: Account, + price: string, + datePublished: string + ): Promise { const { templates } = this.ocean.keeper const serviceAgreementTemplate = await templates.escrowComputeExecutionTemplate.getServiceAgreementTemplate() const name = 'dataAssetComputingServiceAgreement' - const service = { + return { type: 'compute', + index: 3, serviceEndpoint: this.ocean.brizo.getComputeEndpoint(), templateId: templates.escrowComputeExecutionTemplate.getId(), attributes: { @@ -280,6 +286,6 @@ export class OceanCompute extends Instantiable { }, serviceAgreementTemplate } - } - return(service) + } + } } diff --git a/test/integration/ocean/Compute.test.ts b/test/integration/ocean/Compute.test.ts index 47b690b..d920778 100644 --- a/test/integration/ocean/Compute.test.ts +++ b/test/integration/ocean/Compute.test.ts @@ -2,7 +2,8 @@ import { assert } from 'chai' import { config } from '../config' import { Ocean, Account, DDO, MetaData, ComputeJobStatus, Config } from '../../../src' -import { getMetadata, createComputeService } from '../utils' +import { getMetadata} from '../utils' +import { ServiceCompute } from '../../../src/ddo/Service' const metadataAsset = getMetadata() @@ -38,7 +39,7 @@ describe('Compute', () => { it('should publish a dataset with a compute service object', async () => { const stepsAsset = [] - const computeService= await ocean.compute.create_compute_service_attributes(account,"1000",metadataAsset.main.datePublished) + computeService= await ocean.compute.create_compute_service_attributes(account,"1000",metadataAsset.main.datePublished) dataset = await ocean.assets .create(metadataAsset as MetaData, account, [computeService]) .next(step => stepsAsset.push(step))