mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-26 19:49:26 +01:00
tutorial updates
This commit is contained in:
parent
38f2779935
commit
9b52bdf31b
@ -101,7 +101,8 @@ const asset = {
|
|||||||
contentLength: 12057507,
|
contentLength: 12057507,
|
||||||
compression: 'zip',
|
compression: 'zip',
|
||||||
encoding: 'UTF-8',
|
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,
|
index: 1,
|
||||||
@ -109,12 +110,13 @@ const asset = {
|
|||||||
checksum: '354d19c0733c47ef3a6cce5b633116b0',
|
checksum: '354d19c0733c47ef3a6cce5b633116b0',
|
||||||
checksumType: 'MD5',
|
checksumType: 'MD5',
|
||||||
contentLength: 928,
|
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'
|
resourceId: 'test'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
index: 2
|
index: 2
|
||||||
},
|
}
|
||||||
],
|
],
|
||||||
checksum: '',
|
checksum: '',
|
||||||
categories: ['image'],
|
categories: ['image'],
|
||||||
@ -162,18 +164,25 @@ class App extends Component {
|
|||||||
parityUri: 'http://localhost:8545',
|
parityUri: 'http://localhost:8545',
|
||||||
secretStoreUri: 'http://localhost:12001'
|
secretStoreUri: 'http://localhost:12001'
|
||||||
})
|
})
|
||||||
console.log('Finished loading contracts!')
|
console.log('Finished loading contracts.')
|
||||||
}
|
}
|
||||||
|
|
||||||
async submitAsset() {
|
async submitAsset() {
|
||||||
const accounts = await this.ocean.accounts.list()
|
const accounts = await this.ocean.accounts.list()
|
||||||
const ddo = await this.ocean.assets.create(asset, accounts[0])
|
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() {
|
async retrieveAssets() {
|
||||||
this.dbAssets = await this.ocean.assets.search('10 Monkey Species Small')
|
this.dbAssets = await this.ocean.assets.search('10 Monkey Species Small')
|
||||||
console.log(this.dbAssets)
|
console.log(this.dbAssets)
|
||||||
|
alert(
|
||||||
|
'Asset successfully retrieved. Look into your console to see the search response.'
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
async consumeAsset() {
|
async consumeAsset() {
|
||||||
|
@ -90,10 +90,14 @@ Now that we have an asset to submit, we need a function to handle it. Just befor
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
async submitAsset() {
|
async submitAsset() {
|
||||||
const accounts = await this.ocean.accounts.list()
|
const accounts = await this.ocean.accounts.list()
|
||||||
const ddo = await this.ocean.assets.create(asset, accounts[0])
|
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.'
|
||||||
|
)
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The last thing we need is a button to start our registration inside the render function just after `<h1>Marketplace app</h1>`:
|
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,
|
contentLength: 12057507,
|
||||||
compression: 'zip',
|
compression: 'zip',
|
||||||
encoding: 'UTF-8',
|
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,
|
index: 1,
|
||||||
@ -146,12 +151,13 @@ const asset = {
|
|||||||
checksum: '354d19c0733c47ef3a6cce5b633116b0',
|
checksum: '354d19c0733c47ef3a6cce5b633116b0',
|
||||||
checksumType: 'MD5',
|
checksumType: 'MD5',
|
||||||
contentLength: 928,
|
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'
|
resourceId: 'test'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
index: 2
|
index: 2
|
||||||
},
|
}
|
||||||
],
|
],
|
||||||
checksum: '',
|
checksum: '',
|
||||||
categories: ['image'],
|
categories: ['image'],
|
||||||
@ -199,13 +205,17 @@ class App extends Component {
|
|||||||
parityUri: 'http://localhost:8545',
|
parityUri: 'http://localhost:8545',
|
||||||
secretStoreUri: 'http://localhost:12001'
|
secretStoreUri: 'http://localhost:12001'
|
||||||
})
|
})
|
||||||
console.log('Finished loading contracts!')
|
console.log('Finished loading contracts.')
|
||||||
}
|
}
|
||||||
|
|
||||||
async submitAsset() {
|
async submitAsset() {
|
||||||
const accounts = await this.ocean.accounts.list()
|
const accounts = await this.ocean.accounts.list()
|
||||||
const ddo = await this.ocean.assets.create(asset, accounts[0])
|
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() {
|
render() {
|
||||||
|
@ -34,7 +34,7 @@ This will create a folder named `marketplace` with a boilerplate React app. Go i
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd marketplace/
|
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):
|
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',
|
parityUri: 'http://localhost:8545',
|
||||||
secretStoreUri: 'http://localhost:12001'
|
secretStoreUri: 'http://localhost:12001'
|
||||||
})
|
})
|
||||||
console.log('Finished loading contracts!')
|
console.log('Finished loading contracts.')
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
Loading…
Reference in New Issue
Block a user