diff --git a/src/provider/Provider.ts b/src/provider/Provider.ts index de2517fd..f1c631bf 100644 --- a/src/provider/Provider.ts +++ b/src/provider/Provider.ts @@ -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} */ public async computeStatus( providerUri: string, - signal?: AbortSignal, + consumerAddress: string, jobId?: string, did?: string, - consumerAddress?: string + signal?: AbortSignal ): Promise { - 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 diff --git a/test/integration/ComputeFlow.test.ts b/test/integration/ComputeFlow.test.ts index 27b10295..eb0e9d47 100644 --- a/test/integration/ComputeFlow.test.ts +++ b/test/integration/ComputeFlow.test.ts @@ -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) })