From fc566e076667f58e021640f0496c9d4ead534784 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Fri, 24 Apr 2020 18:01:06 +0200 Subject: [PATCH] add basic specs --- README.md | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e40c39a..fd54ff9 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,8 @@ import { OceanProvider } from '@oceanprotocol/react' export default function MyApp({ children }: { children: any }) { // TODO: setup web3 first + // or fallback to injected providers by default + // so it works with any browser wallet out of the box return ( @@ -41,7 +43,7 @@ const oceanConfig: OceanConfig = { } export default function MyComponent() { - // Initialize, get existing, or reinitalize Ocean + // Initialize, get existing, or reinitialize Ocean const { ocean, account } = useOcean(oceanConfig) // consume asset @@ -62,4 +64,37 @@ export default function MyComponent() { ) } +``` + +### Specs + +#### `useOcean()` + +```tsx +interface UseOcean { + ocean: Ocean + account: string + balance: { ocean: string, eth: string } + status: OceanConnectionStatus +} + +const result: UseOcean = useOcean(config: OceanConfig) +``` + + +#### `useConsume()` + +```tsx +interface ConsumeOptions { + ocean: Ocean +} + +interface UseConsume { + consumeAsset: (ddo: DDO, account: string) => void + isLoading: boolean + step: number + error: string | undefined +} + +const result: UseConsume = useConsume(options: ConsumeOptions) ``` \ No newline at end of file