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:
parent
ea9bceb092
commit
4157e1e473
@ -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
|
||||
|
@ -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)
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user