1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00

update compute status query and jsdoc (#1361)

This commit is contained in:
Bogdan Fazakas 2022-03-29 17:40:01 +03:00 committed by GitHub
parent ea9bceb092
commit 4157e1e473
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 17 deletions

View File

@ -528,26 +528,21 @@ export class Provider {
}
}
/** Get status for a specific jobId/documentId/owner.
* @param {string} did
* @param {string} consumerAddress
* @param {string} providerUri
* @param {Web3} web3
/** Get compute status for a specific jobId/documentId/owner.
* @param {string} providerUri The URI of the provider we want to query
* @param {string} consumerAddress The consumer ethereum address
* @param {string} jobId The ID of a compute job.
* @param {string} did The ID of the asset
* @param {AbortSignal} signal abort signal
* @param {string} jobId
* @return {Promise<ComputeJob | ComputeJob[]>}
*/
public async computeStatus(
providerUri: string,
signal?: AbortSignal,
consumerAddress: string,
jobId?: string,
did?: string,
consumerAddress?: string
signal?: AbortSignal
): Promise<ComputeJob | ComputeJob[]> {
if (!jobId && !did && !consumerAddress) {
throw new Error('You need at least one of jobId, did, consumerAddress')
}
const providerEndpoints = await this.getEndpoints(providerUri)
const serviceEndpoints = await this.getServiceEndpoints(
providerUri,
@ -557,8 +552,8 @@ export class Provider {
? this.getEndpointURL(serviceEndpoints, 'computeStatus').urlPath
: null
let url = '?documentId=' + noZeroX(did)
url += (consumerAddress && `&consumerAddress=${consumerAddress}`) || ''
let url = `?consumerAddress=${consumerAddress}`
url += (did && `&documentId=${noZeroX(did)}`) || ''
url += (jobId && `&jobId=${jobId}`) || ''
if (!computeStatusUrl) return null

View File

@ -338,10 +338,9 @@ describe('Simple compute tests', async () => {
assert(computeJobs, 'Cannot start compute job')
const jobStatus = await ProviderInstance.computeStatus(
providerUrl,
null,
consumerAccount,
computeJobs[0].jobId,
resolvedDDOAsset.id,
consumerAccount
resolvedDDOAsset.id
)
assert(jobStatus)
})