9d2c0f3c63
* Bump prettier from 2.2.1 to 2.3.0 Bumps [prettier](https://github.com/prettier/prettier) from 2.2.1 to 2.3.0. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.2.1...2.3.0) Signed-off-by: dependabot[bot] <support@github.com> * prettier updates Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Matthias Kretschmann <m@kretschmann.io> |
||
---|---|---|
.. | ||
DataTokenOptions.ts | ||
README.md | ||
index.ts | ||
usePublish.ts |
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>
)
}