1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-06-30 21:52:06 +02:00

tutorial updates

This commit is contained in:
Matthias Kretschmann 2019-04-16 18:14:00 +02:00
parent 38f2779935
commit 9b52bdf31b
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 35 additions and 16 deletions

View File

@ -101,7 +101,8 @@ const asset = {
contentLength: 12057507,
compression: 'zip',
encoding: 'UTF-8',
url: 'https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/assets/training.zip'
url:
'https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/assets/training.zip'
},
{
index: 1,
@ -109,12 +110,13 @@ const asset = {
checksum: '354d19c0733c47ef3a6cce5b633116b0',
checksumType: 'MD5',
contentLength: 928,
url: 'https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/assets/monkey_labels.txt'
url:
'https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/assets/monkey_labels.txt',
resourceId: 'test'
},
{
index: 2
},
}
],
checksum: '',
categories: ['image'],
@ -162,18 +164,25 @@ class App extends Component {
parityUri: 'http://localhost:8545',
secretStoreUri: 'http://localhost:12001'
})
console.log('Finished loading contracts!')
console.log('Finished loading contracts.')
}
async submitAsset() {
const accounts = await this.ocean.accounts.list()
const ddo = await this.ocean.assets.create(asset, accounts[0])
alert('Asset successfully submitted: ', JSON.stringify(ddo))
console.log('Asset successfully submitted.')
console.log(ddo)
alert(
'Asset successfully submitted. Look into your console to see the response DDO object.'
)
}
async retrieveAssets() {
this.dbAssets = await this.ocean.assets.search('10 Monkey Species Small')
console.log(this.dbAssets)
alert(
'Asset successfully retrieved. Look into your console to see the search response.'
)
}
async consumeAsset() {

View File

@ -90,10 +90,14 @@ Now that we have an asset to submit, we need a function to handle it. Just befor
```js
async submitAsset() {
const accounts = await this.ocean.accounts.list()
const ddo = await this.ocean.assets.create(asset, accounts[0])
alert('Asset successfully submitted: ', JSON.stringify(ddo))
}
const accounts = await this.ocean.accounts.list()
const ddo = await this.ocean.assets.create(asset, accounts[0])
console.log('Asset successfully submitted.')
console.log(ddo)
alert(
'Asset successfully submitted. Look into your console to see the response DDO object.'
)
}
```
The last thing we need is a button to start our registration inside the render function just after `<h1>Marketplace app</h1>`:
@ -138,7 +142,8 @@ const asset = {
contentLength: 12057507,
compression: 'zip',
encoding: 'UTF-8',
url: 'https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/assets/training.zip'
url:
'https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/assets/training.zip'
},
{
index: 1,
@ -146,12 +151,13 @@ const asset = {
checksum: '354d19c0733c47ef3a6cce5b633116b0',
checksumType: 'MD5',
contentLength: 928,
url: 'https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/assets/monkey_labels.txt'
url:
'https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/assets/monkey_labels.txt',
resourceId: 'test'
},
{
index: 2
},
}
],
checksum: '',
categories: ['image'],
@ -199,13 +205,17 @@ class App extends Component {
parityUri: 'http://localhost:8545',
secretStoreUri: 'http://localhost:12001'
})
console.log('Finished loading contracts!')
console.log('Finished loading contracts.')
}
async submitAsset() {
const accounts = await this.ocean.accounts.list()
const ddo = await this.ocean.assets.create(asset, accounts[0])
alert('Asset successfully submitted: ', JSON.stringify(ddo))
console.log('Asset successfully submitted.')
console.log(ddo)
alert(
'Asset successfully submitted. Look into your console to see the response DDO object.'
)
}
render() {

View File

@ -34,7 +34,7 @@ This will create a folder named `marketplace` with a boilerplate React app. Go i
```bash
cd marketplace/
npm install @oceanprotocol/squid@0.5.5 web3
npm install @oceanprotocol/squid@0.5.5
```
At this point you can already run `npm start` which starts the app in your browser at [localhost:3000](http://localhost:3000):
@ -128,7 +128,7 @@ class App extends Component {
parityUri: 'http://localhost:8545',
secretStoreUri: 'http://localhost:12001'
})
console.log('Finished loading contracts!')
console.log('Finished loading contracts.')
}
render() {