From bd8df8771556804bf9b0ef10f484bd8deeec23d8 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 7 Sep 2020 16:42:56 +0200 Subject: [PATCH] add usePublish docs example --- src/hooks/usePublish/README.md | 48 ++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/hooks/usePublish/README.md diff --git a/src/hooks/usePublish/README.md b/src/hooks/usePublish/README.md new file mode 100644 index 0000000..5898abf --- /dev/null +++ b/src/hooks/usePublish/README.md @@ -0,0 +1,48 @@ +# `usePublish` + +Publish data sets, and create data tokens and liquidity pools for them. + +## Usage + +```tsx +import React from 'react' +import { useOcean, usePublish } from '@oceanprotocol/react' +import { Metadata } from '@oceanprotocol/lib' + +export default function MyComponent() { + const { accountId } = useOcean() + + // Publish helpers + const { publish, publishStep } = usePublish() + + const metadata: MetaData = { + main: { + name: 'Asset' + }, + additionalInformation: { + description: 'My Cool Asset' + } + } + + const priceOptions = { + price: 10, + tokensToMint: 10, + type: 'fixed', + weightOnDataToken: '', + liquidityProviderFee: '' + } + + async function handlePublish() { + const ddo = await publish(metadata, priceOptions, 'access') + } + + return ( +
+

Publish

+ +

Your account: {accountId}

+ +
+ ) +} +```