1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-02 16:25:37 +01:00
docs/content/tutorials/react-publish-data-set-compute.md
2020-06-03 02:30:38 +02: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.