1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-02 08:20:22 +01:00
docs/content/tutorials/react-publish-data-set-compute.md
2020-05-04 11:20:05 +03:00

1.5 KiB

title description
Publish a Data Set with Compute features Tutorial to add a dataset with compute capabilities to a basic React app.

Requirements

This is a continuation of the React App Setup tutorial, so make sure you have done all the steps described in there.

  1. React App Setup

Open src/Compute.js from your marketplace/ folder.

Define Asset

We will use the same asset as in Publish a Data Set, but we are going to allow only compute features, without the ability to download the asset.

This is achiveable by adding a 'compute' service to the DDO:

GITHUB-EMBED 107d1fa7d0/src/Compute.js jsx 23-27 GITHUB-EMBED

Handle Asset Publishing

Note that ocean.assets.create will define an 'access' service if the services list is missing. Since we are providing this attribute, our asset will have only a 'compute' service and no 'access' service.

GITHUB-EMBED 107d1fa7d0/src/Compute.js jsx 18-40 GITHUB-EMBED

The last thing we need is a button to start our registration inside the render() function:

GITHUB-EMBED 107d1fa7d0/src/Compute.js jsx 143 GITHUB-EMBED

Move on to Publish a Algorithm.