mirror of
https://github.com/oceanprotocol/react-tutorial
synced 2024-12-22 09:13:14 +01:00
update
This commit is contained in:
parent
303ed00df2
commit
0ca13d408f
@ -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)
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user