1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00

add ocean.compute.result

This commit is contained in:
Matthias Kretschmann 2020-01-21 15:13:02 +01:00
parent 5bad5fa9ec
commit 04aa6d6700
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -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<ComputeJobStatus>} Returns the status
* @return {Promise<ComputeJobStatus[]>} 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<DDO>} Returns the DDO of the result asset.
*/
public async result(
consumerAccount: Account,
agreementId: string,
jobId: string
): Promise<DDO> {
const status = await this.ocean.brizo.computeService(
'get',
agreementId,
consumerAccount,
jobId
)
return status[0].ddo ? status[0].ddo : null
}
}