diff --git a/src/ocean/Compute.ts b/src/ocean/Compute.ts index 2b62c5e4..ae05e0a0 100644 --- a/src/ocean/Compute.ts +++ b/src/ocean/Compute.ts @@ -53,17 +53,22 @@ export class Compute extends Instantiable { /** * Start the execution of a compute job. - * @param {Account} consumerAccount The account of the consumer ordering the service. * @param {string} did Decentralized identifer for the asset + * @param {string} txId + * @param {string} tokenAddress + * @param {Account} consumerAccount The account of the consumer ordering the service. * @param {string} algorithmDid The DID of the algorithm asset (of type `algorithm`) to run on the asset. * @param {MetaData} algorithmMeta Metadata about the algorithm being run if `algorithm` is being used. This is ignored when `algorithmDid` is specified. * @param {Output} output Define algorithm output publishing. Publishing the result of a compute job is turned off by default. * @return {Promise} Returns compute job ID under status.jobId */ public async start( - consumerAccount: Account, did: string, + txId: string, + tokenAddress: string, + consumerAccount: Account, algorithmDid?: string, + algorithmTokenAddress?: string, algorithmMeta?: MetadataAlgorithm, output?: Output ): Promise { diff --git a/test/integration/ComputeFlow.test.ts b/test/integration/ComputeFlow.test.ts index c13ddbca..ccc0b9df 100644 --- a/test/integration/ComputeFlow.test.ts +++ b/test/integration/ComputeFlow.test.ts @@ -121,7 +121,7 @@ describe('Marketplace flow', () => { assert(computeService.attributes.main.cost === price) }) - it('Bob buys datatokens from open market and order a compute service', async () => { + it('Bob gets datatokens from Alice to be able to try the compute service', async () => { const dTamount = 20 await datatoken .transfer(tokenAddress, bob.getId(), dTamount, alice.getId()) @@ -131,7 +131,40 @@ describe('Marketplace flow', () => { }) }) - // it('Bob starts compute job', async () => {}) + it('Bob starts compute job', async () => { + // TODO + const algorithmMeta = { + + } + // TODO + const output = { + + } + + await ocean.assets + .order(ddo.id, computeService.type, bob.getId()) + .then(async (res: string) => { + res = JSON.parse(res) + return await datatoken.transfer( + res['dataToken'], + res['to'], + res['numTokens'], + res['from'] + ) + }) + .then(async (tx) => { + await ocean.compute.start( + ddo.id, + tx.transactionHash, + tokenAddress, + bob, + algorithmMeta, + output + + ) + }) + + }) // it('Bob gets the compute job status', async () => {})