react/src/hooks/usePublish
mihaisc 8d16b9e07e
bump lib (#247)
* bump lib

Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>

* updates

Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>
2021-02-26 11:27:49 +02:00
..
DataTokenOptions.ts move to usePricing 2020-10-19 02:47:12 -07:00
README.md publish tweaks 2020-10-19 13:39:14 +02:00
index.ts split flows for Publish and Buy 2020-10-14 01:11:49 -07:00
usePublish.ts bump lib (#247) 2021-02-26 11:27:49 +02:00

README.md

usePublish

Publish data sets and create datatokens for them.

Usage

import React from 'react'
import { useOcean, usePublish } from '@oceanprotocol/react'
import { Metadata } from '@oceanprotocol/lib'

export default function MyComponent() {
  const { ocean, accountId } = useOcean()

  // Publish helpers
  const { publish, publishStep } = usePublish()

  const metadata: MetaData = {
    main: {
      name: 'Asset'
    },
    additionalInformation: {
      description: 'My Cool Asset'
    }
  }

  async function handlePublish() {
    const ddo = await publish(metadata, 'access')
    // Heads Up! You should now create pricing for your data set
    // with the `usePricing()` hook in another step.
  }

  return (
    <div>
      <h1>Publish</h1>

      <p>Your account: {accountId}</p>
      <button onClick={handlePublish}>Publish</button>
    </div>
  )
}