mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
fixes
This commit is contained in:
parent
bd831c2c61
commit
8cfbd4024c
@ -5,6 +5,7 @@ import { DDO } from '../ddo/DDO'
|
|||||||
import { SubscribablePromise } from '../utils'
|
import { SubscribablePromise } from '../utils'
|
||||||
import { OrderProgressStep } from './utils/ServiceUtils'
|
import { OrderProgressStep } from './utils/ServiceUtils'
|
||||||
import { DID } from '../squid'
|
import { DID } from '../squid'
|
||||||
|
import {ServiceCompute} from '../ddo/Service'
|
||||||
|
|
||||||
export const ComputeJobStatus = Object.freeze({
|
export const ComputeJobStatus = Object.freeze({
|
||||||
Started: 10,
|
Started: 10,
|
||||||
@ -262,12 +263,17 @@ export class OceanCompute extends Instantiable {
|
|||||||
return computeJobsList[0] as ComputeJob
|
return computeJobsList[0] as ComputeJob
|
||||||
}
|
}
|
||||||
|
|
||||||
public async create_compute_service_attributes(consumerAccount: Account,price: string,datePublished: string){
|
public async create_compute_service_attributes(
|
||||||
|
consumerAccount: Account,
|
||||||
|
price: string,
|
||||||
|
datePublished: string
|
||||||
|
): Promise<ServiceCompute> {
|
||||||
const { templates } = this.ocean.keeper
|
const { templates } = this.ocean.keeper
|
||||||
const serviceAgreementTemplate = await templates.escrowComputeExecutionTemplate.getServiceAgreementTemplate()
|
const serviceAgreementTemplate = await templates.escrowComputeExecutionTemplate.getServiceAgreementTemplate()
|
||||||
const name = 'dataAssetComputingServiceAgreement'
|
const name = 'dataAssetComputingServiceAgreement'
|
||||||
const service = {
|
return {
|
||||||
type: 'compute',
|
type: 'compute',
|
||||||
|
index: 3,
|
||||||
serviceEndpoint: this.ocean.brizo.getComputeEndpoint(),
|
serviceEndpoint: this.ocean.brizo.getComputeEndpoint(),
|
||||||
templateId: templates.escrowComputeExecutionTemplate.getId(),
|
templateId: templates.escrowComputeExecutionTemplate.getId(),
|
||||||
attributes: {
|
attributes: {
|
||||||
@ -280,6 +286,6 @@ export class OceanCompute extends Instantiable {
|
|||||||
},
|
},
|
||||||
serviceAgreementTemplate
|
serviceAgreementTemplate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(service)
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,8 @@ import { assert } from 'chai'
|
|||||||
|
|
||||||
import { config } from '../config'
|
import { config } from '../config'
|
||||||
import { Ocean, Account, DDO, MetaData, ComputeJobStatus, Config } from '../../../src'
|
import { Ocean, Account, DDO, MetaData, ComputeJobStatus, Config } from '../../../src'
|
||||||
import { getMetadata, createComputeService } from '../utils'
|
import { getMetadata} from '../utils'
|
||||||
|
import { ServiceCompute } from '../../../src/ddo/Service'
|
||||||
|
|
||||||
|
|
||||||
const metadataAsset = getMetadata()
|
const metadataAsset = getMetadata()
|
||||||
@ -38,7 +39,7 @@ describe('Compute', () => {
|
|||||||
|
|
||||||
it('should publish a dataset with a compute service object', async () => {
|
it('should publish a dataset with a compute service object', async () => {
|
||||||
const stepsAsset = []
|
const stepsAsset = []
|
||||||
const computeService= await ocean.compute.create_compute_service_attributes(account,"1000",metadataAsset.main.datePublished)
|
computeService= await ocean.compute.create_compute_service_attributes(account,"1000",metadataAsset.main.datePublished)
|
||||||
dataset = await ocean.assets
|
dataset = await ocean.assets
|
||||||
.create(metadataAsset as MetaData, account, [computeService])
|
.create(metadataAsset as MetaData, account, [computeService])
|
||||||
.next(step => stepsAsset.push(step))
|
.next(step => stepsAsset.push(step))
|
||||||
|
Loading…
Reference in New Issue
Block a user