mirror of
https://github.com/oceanprotocol/react-tutorial
synced 2024-11-24 19:10:15 +01:00
commit
f37d622fff
11
package.json
11
package.json
@ -3,12 +3,11 @@
|
||||
"version": "1.0.0",
|
||||
"description": "React + squid.js interacting in the most minimal way with Ocean Protocol.",
|
||||
"dependencies": {
|
||||
"@oceanprotocol/keeper-contracts": "0.11.1",
|
||||
"@oceanprotocol/squid": "0.7.2",
|
||||
"react": "^16.9.0",
|
||||
"react-dom": "^16.9.0",
|
||||
"react-scripts": "^3.1.1",
|
||||
"web3": "^1.2.1"
|
||||
"@oceanprotocol/squid": "^1.0.0-beta.6",
|
||||
"react": "^16.12.0",
|
||||
"react-dom": "^16.12.0",
|
||||
"react-scripts": "^3.2.0",
|
||||
"web3": "^1.2.4"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
|
19
src/asset.js
19
src/asset.js
@ -1,8 +1,9 @@
|
||||
const asset = {
|
||||
base: {
|
||||
main: {
|
||||
name: '10 Monkey Species Small',
|
||||
dateCreated: '2012-02-01T10:55:11Z',
|
||||
author: 'Mario',
|
||||
type: 'dataset',
|
||||
license: 'CC0: Public Domain',
|
||||
price: '0',
|
||||
files: [
|
||||
@ -11,7 +12,7 @@ const asset = {
|
||||
contentType: 'application/zip',
|
||||
checksum: '2bf9d229d110d1976cdf85e9f3256c7f',
|
||||
checksumType: 'MD5',
|
||||
contentLength: 12057507,
|
||||
contentLength: '12057507',
|
||||
compression: 'zip',
|
||||
encoding: 'UTF-8',
|
||||
url:
|
||||
@ -22,19 +23,15 @@ const asset = {
|
||||
contentType: 'text/txt',
|
||||
checksum: '354d19c0733c47ef3a6cce5b633116b0',
|
||||
checksumType: 'MD5',
|
||||
contentLength: 928,
|
||||
contentLength: '928',
|
||||
url:
|
||||
'https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/assets/monkey_labels.txt',
|
||||
resourceId: 'test'
|
||||
},
|
||||
{
|
||||
index: 2
|
||||
'https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/assets/monkey_labels.txt'
|
||||
}
|
||||
],
|
||||
checksum: '',
|
||||
]
|
||||
},
|
||||
additionalInformation: {
|
||||
categories: ['image'],
|
||||
tags: ['image data', 'classification', 'animals'],
|
||||
type: 'dataset',
|
||||
description: 'EXAMPLE ONLY ',
|
||||
copyrightHolder: 'Unknown',
|
||||
workExample: 'image path, id, label',
|
||||
|
@ -73,18 +73,18 @@ class App extends Component {
|
||||
// get first asset from search results
|
||||
const consumeAsset = this.state.results[0]
|
||||
// get service we want to execute
|
||||
const service = consumeAsset.findServiceByType('Access')
|
||||
const service = consumeAsset.findServiceByType('access')
|
||||
// order service agreement
|
||||
const agreement = await this.state.ocean.assets.order(
|
||||
consumeAsset.id,
|
||||
service.serviceDefinitionId,
|
||||
service.index,
|
||||
accounts[0]
|
||||
)
|
||||
// consume it
|
||||
await this.state.ocean.assets.consume(
|
||||
agreement,
|
||||
consumeAsset.id,
|
||||
service.serviceDefinitionId,
|
||||
service.index,
|
||||
accounts[0],
|
||||
'',
|
||||
0
|
||||
|
Loading…
Reference in New Issue
Block a user