1
0
mirror of https://github.com/oceanprotocol/react-tutorial synced 2024-11-24 19:10:15 +01:00

Merge pull request #1 from oceanprotocol/v2

v2 DDO updates
This commit is contained in:
Matthias Kretschmann 2019-11-20 13:15:13 +01:00 committed by GitHub
commit f37d622fff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 20 deletions

View File

@ -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",

View File

@ -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',

View File

@ -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