mirror of
https://github.com/oceanprotocol/react-tutorial
synced 2024-11-22 01:36:58 +01:00
consistency fixes
This commit is contained in:
parent
8b724ea9e7
commit
303ed00df2
@ -1,7 +1,7 @@
|
|||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
|
|
||||||
import { asset } from './asset'
|
import asset from './asset'
|
||||||
import { algoAsset, createComputeService, rawAlgoMeta } from './asset-compute'
|
import { assetAlgo, createComputeService, rawAlgoMeta } from './asset-compute'
|
||||||
|
|
||||||
export default function Compute({ ocean, web3 }) {
|
export default function Compute({ ocean, web3 }) {
|
||||||
const [ddoAssetId, setDdoAssetId] = useState('')
|
const [ddoAssetId, setDdoAssetId] = useState('')
|
||||||
@ -45,7 +45,7 @@ export default function Compute({ ocean, web3 }) {
|
|||||||
const accounts = await ocean.accounts.list()
|
const accounts = await ocean.accounts.list()
|
||||||
console.log('Publishing algo.')
|
console.log('Publishing algo.')
|
||||||
|
|
||||||
const ddoAlgorithmNew = await ocean.assets.create(algoAsset, accounts[0])
|
const ddoAlgorithmNew = await ocean.assets.create(assetAlgo, accounts[0])
|
||||||
console.log(ddoAlgorithmNew)
|
console.log(ddoAlgorithmNew)
|
||||||
console.log('Algo asset successfully submitted.')
|
console.log('Algo asset successfully submitted.')
|
||||||
// keep track of this registered asset for consumption later on
|
// keep track of this registered asset for consumption later on
|
||||||
@ -59,7 +59,7 @@ export default function Compute({ ocean, web3 }) {
|
|||||||
async function startCompute(algorithmId, algorithmMeta) {
|
async function startCompute(algorithmId, algorithmMeta) {
|
||||||
try {
|
try {
|
||||||
const accounts = await ocean.accounts.list()
|
const accounts = await ocean.accounts.list()
|
||||||
const ComputeOutput = {
|
const computeOutput = {
|
||||||
publishAlgorithmLog: publishLogState,
|
publishAlgorithmLog: publishLogState,
|
||||||
publishOutput: publishOutputState,
|
publishOutput: publishOutputState,
|
||||||
brizoAddress: ocean.config.brizoAddress,
|
brizoAddress: ocean.config.brizoAddress,
|
||||||
@ -69,7 +69,7 @@ export default function Compute({ ocean, web3 }) {
|
|||||||
owner: accounts[0].getId(),
|
owner: accounts[0].getId(),
|
||||||
secretStoreUri: ocean.config.secretStoreUri
|
secretStoreUri: ocean.config.secretStoreUri
|
||||||
}
|
}
|
||||||
console.log(ComputeOutput)
|
console.log(computeOutput)
|
||||||
// order the compute service
|
// order the compute service
|
||||||
const agreement = await ocean.compute.order(accounts[0], ddoAssetId)
|
const agreement = await ocean.compute.order(accounts[0], ddoAssetId)
|
||||||
setAgreementId(agreement)
|
setAgreementId(agreement)
|
||||||
@ -79,7 +79,7 @@ export default function Compute({ ocean, web3 }) {
|
|||||||
agreement,
|
agreement,
|
||||||
algorithmId,
|
algorithmId,
|
||||||
encodeURIComponent(JSON.stringify(algorithmMeta)),
|
encodeURIComponent(JSON.stringify(algorithmMeta)),
|
||||||
ComputeOutput
|
computeOutput
|
||||||
)
|
)
|
||||||
setJobId(status.jobId)
|
setJobId(status.jobId)
|
||||||
console.log(status)
|
console.log(status)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export const algoAsset = {
|
export const assetAlgo = {
|
||||||
main: {
|
main: {
|
||||||
name: 'My great algo',
|
name: 'My great algo',
|
||||||
dateCreated: '2012-02-01T10:55:11Z',
|
dateCreated: '2012-02-01T10:55:11Z',
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
export const asset = {
|
const asset = {
|
||||||
main: {
|
main: {
|
||||||
name: '10 Monkey Species Small',
|
name: '10 Monkey Species Small',
|
||||||
dateCreated: '2012-02-01T10:55:11Z',
|
dateCreated: '2012-02-01T10:55:11Z',
|
||||||
@ -50,3 +50,5 @@ export const asset = {
|
|||||||
inLanguage: 'en'
|
inLanguage: 'en'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default asset
|
||||||
|
@ -2,7 +2,7 @@ import React, { Component } from 'react'
|
|||||||
import ReactDOM from 'react-dom'
|
import ReactDOM from 'react-dom'
|
||||||
import { Ocean } from '@oceanprotocol/squid'
|
import { Ocean } from '@oceanprotocol/squid'
|
||||||
import Web3 from 'web3'
|
import Web3 from 'web3'
|
||||||
import { asset } from './asset'
|
import asset from './asset'
|
||||||
import Compute from './Compute'
|
import Compute from './Compute'
|
||||||
|
|
||||||
let web3
|
let web3
|
||||||
|
Loading…
Reference in New Issue
Block a user