diff --git a/src/ocean/OceanCompute.ts b/src/ocean/OceanCompute.ts index 3d22611..4bf943d 100644 --- a/src/ocean/OceanCompute.ts +++ b/src/ocean/OceanCompute.ts @@ -144,7 +144,7 @@ export class OceanCompute extends Instantiable { * @param {Account} consumerAccount The account of the consumer ordering the service. * @param {string} agreementId The service agreement ID. * @param {string} jobId The ID of the compute job to be stopped - * @return {Promise} Returns the status + * @return {Promise} Returns the status */ public async status( consumerAccount: Account, @@ -160,4 +160,26 @@ export class OceanCompute extends Instantiable { return status } + + /** + * Returns the final result of a specific compute job published as an asset. + * @param {string} agreementId The service agreement ID. + * @param {Account} consumerAccount The account of the consumer ordering the service. + * @param {string} jobId The ID of the compute job to be stopped. + * @return {Promise} Returns the DDO of the result asset. + */ + public async result( + consumerAccount: Account, + agreementId: string, + jobId: string + ): Promise { + const status = await this.ocean.brizo.computeService( + 'get', + agreementId, + consumerAccount, + jobId + ) + + return status[0].ddo ? status[0].ddo : null + } }