mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
update compute.start interface.
This commit is contained in:
parent
3179a23375
commit
7a47201ca4
@ -53,17 +53,22 @@ export class Compute extends Instantiable {
|
||||
|
||||
/**
|
||||
* Start the execution of a compute job.
|
||||
* @param {Account} consumerAccount The account of the consumer ordering the service.
|
||||
* @param {string} did Decentralized identifer for the asset
|
||||
* @param {string} txId
|
||||
* @param {string} tokenAddress
|
||||
* @param {Account} consumerAccount The account of the consumer ordering the service.
|
||||
* @param {string} algorithmDid The DID of the algorithm asset (of type `algorithm`) to run on the asset.
|
||||
* @param {MetaData} algorithmMeta Metadata about the algorithm being run if `algorithm` is being used. This is ignored when `algorithmDid` is specified.
|
||||
* @param {Output} output Define algorithm output publishing. Publishing the result of a compute job is turned off by default.
|
||||
* @return {Promise<ComputeJob>} Returns compute job ID under status.jobId
|
||||
*/
|
||||
public async start(
|
||||
consumerAccount: Account,
|
||||
did: string,
|
||||
txId: string,
|
||||
tokenAddress: string,
|
||||
consumerAccount: Account,
|
||||
algorithmDid?: string,
|
||||
algorithmTokenAddress?: string,
|
||||
algorithmMeta?: MetadataAlgorithm,
|
||||
output?: Output
|
||||
): Promise<ComputeJob> {
|
||||
|
@ -121,7 +121,7 @@ describe('Marketplace flow', () => {
|
||||
assert(computeService.attributes.main.cost === price)
|
||||
})
|
||||
|
||||
it('Bob buys datatokens from open market and order a compute service', async () => {
|
||||
it('Bob gets datatokens from Alice to be able to try the compute service', async () => {
|
||||
const dTamount = 20
|
||||
await datatoken
|
||||
.transfer(tokenAddress, bob.getId(), dTamount, alice.getId())
|
||||
@ -131,7 +131,40 @@ describe('Marketplace flow', () => {
|
||||
})
|
||||
})
|
||||
|
||||
// it('Bob starts compute job', async () => {})
|
||||
it('Bob starts compute job', async () => {
|
||||
// TODO
|
||||
const algorithmMeta = {
|
||||
|
||||
}
|
||||
// TODO
|
||||
const output = {
|
||||
|
||||
}
|
||||
|
||||
await ocean.assets
|
||||
.order(ddo.id, computeService.type, bob.getId())
|
||||
.then(async (res: string) => {
|
||||
res = JSON.parse(res)
|
||||
return await datatoken.transfer(
|
||||
res['dataToken'],
|
||||
res['to'],
|
||||
res['numTokens'],
|
||||
res['from']
|
||||
)
|
||||
})
|
||||
.then(async (tx) => {
|
||||
await ocean.compute.start(
|
||||
ddo.id,
|
||||
tx.transactionHash,
|
||||
tokenAddress,
|
||||
bob,
|
||||
algorithmMeta,
|
||||
output
|
||||
|
||||
)
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
// it('Bob gets the compute job status', async () => {})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user