This commit is contained in:
alexcos20 2020-03-30 19:06:26 +03:00
parent 303ed00df2
commit 0ca13d408f
2 changed files with 3 additions and 30 deletions

View File

@ -1,7 +1,7 @@
import React, { useState } from 'react'
import asset from './asset'
import { assetAlgo, createComputeService, rawAlgoMeta } from './asset-compute'
import { assetAlgo, rawAlgoMeta } from './asset-compute'
export default function Compute({ ocean, web3 }) {
const [ddoAssetId, setDdoAssetId] = useState('')
@ -20,8 +20,7 @@ export default function Compute({ ocean, web3 }) {
const accounts = await ocean.accounts.list()
console.log('Publishing asset.')
const service = await createComputeService(
ocean,
const service = await ocean.compute.createComputeServiceAttributes(
accounts[0],
'0',
'2020-03-10T10:00:00Z'
@ -78,7 +77,7 @@ export default function Compute({ ocean, web3 }) {
accounts[0],
agreement,
algorithmId,
encodeURIComponent(JSON.stringify(algorithmMeta)),
algorithmMeta,
computeOutput
)
setJobId(status.jobId)

View File

@ -42,29 +42,3 @@ export const rawAlgoMeta = {
tag: '10'
}
}
export async function createComputeService(
ocean,
publisher,
price,
datePublished
) {
const { templates } = ocean.keeper
const serviceAgreementTemplate = await templates.escrowComputeExecutionTemplate.getServiceAgreementTemplate()
const name = 'dataAssetComputingServiceAgreement'
return {
type: 'compute',
serviceEndpoint: ocean.brizo.getComputeEndpoint(),
templateId: templates.escrowComputeExecutionTemplate.getId(),
attributes: {
main: {
creator: publisher.getId(),
datePublished,
price,
timeout: 3600,
name
},
serviceAgreementTemplate
}
}
}