mirror of
https://github.com/oceanprotocol/react.git
synced 2025-01-03 18:35:18 +01:00
move web3 to provider level, switch hook params
This commit is contained in:
parent
7310bcafc9
commit
00722a4358
12
README.md
12
README.md
@ -17,8 +17,10 @@ import React from 'react'
|
||||
import { OceanProvider } from '@oceanprotocol/react'
|
||||
|
||||
export default function MyApp({ children }: { children: any }) {
|
||||
// TODO: setup web3 first
|
||||
|
||||
return (
|
||||
<OceanProvider>
|
||||
<OceanProvider web3={web3}>
|
||||
<h1>My App</h1>
|
||||
{children}
|
||||
</OceanProvider>
|
||||
@ -39,17 +41,15 @@ const oceanConfig: OceanConfig = {
|
||||
}
|
||||
|
||||
export default function MyComponent() {
|
||||
// TODO: setup web3 first
|
||||
|
||||
// Initialize, get existing, or reinitalize Ocean
|
||||
const { ocean, account } = useOcean(web3, oceanConfig)
|
||||
const { ocean, account } = useOcean(oceanConfig)
|
||||
|
||||
// consume asset
|
||||
const { consumeAsset, isLoading, step } = useConsume(ocean, account)
|
||||
const { consumeAsset, isLoading, step } = useConsume(ocean)
|
||||
|
||||
async function handleClick() {
|
||||
const ddo = 'did:op:0x000000000'
|
||||
await consumeAsset(ddo)
|
||||
await consumeAsset(ddo, account)
|
||||
}
|
||||
|
||||
return (
|
||||
|
Loading…
Reference in New Issue
Block a user