mirror of
https://github.com/oceanprotocol/react.git
synced 2025-02-14 21:10:38 +01:00
update example
This commit is contained in:
parent
d0d7866ad9
commit
803c5f9717
@ -9,7 +9,7 @@ import { useState } from 'react'
|
|||||||
import { useEffect } from 'react'
|
import { useEffect } from 'react'
|
||||||
|
|
||||||
export function ConsumeDdo() {
|
export function ConsumeDdo() {
|
||||||
const { ocean } = useOcean()
|
const { ocean, accountId } = useOcean()
|
||||||
const { consumeStepText, consume, consumeError } = useConsume()
|
const { consumeStepText, consume, consumeError } = useConsume()
|
||||||
const { compute, computeStepText } = useCompute()
|
const { compute, computeStepText } = useCompute()
|
||||||
const [did, setDid] = useState<string | undefined>()
|
const [did, setDid] = useState<string | undefined>()
|
||||||
@ -22,7 +22,8 @@ export function ConsumeDdo() {
|
|||||||
if (!did) return
|
if (!did) return
|
||||||
const ddo = await ocean.assets.resolve(did)
|
const ddo = await ocean.assets.resolve(did)
|
||||||
|
|
||||||
await consume(did, ddo.dataToken, 'access')
|
// use own accountId for marketFeeAddress for testing purposes
|
||||||
|
await consume(did, ddo.dataToken, 'access', accountId)
|
||||||
}
|
}
|
||||||
|
|
||||||
const computeDid = async () => {
|
const computeDid = async () => {
|
||||||
|
@ -14,13 +14,13 @@ export default function MyComponent() {
|
|||||||
const { accountId } = useOcean()
|
const { accountId } = useOcean()
|
||||||
|
|
||||||
// Get metadata for this asset
|
// Get metadata for this asset
|
||||||
const { title, price } = useMetadata(did)
|
const { title, price, ddo } = useMetadata(did)
|
||||||
|
|
||||||
// Consume helpers
|
// Consume helpers
|
||||||
const { consume, consumeStep } = useConsume()
|
const { consume, consumeStep } = useConsume()
|
||||||
|
|
||||||
async function handleDownload() {
|
async function handleDownload() {
|
||||||
await consume(did)
|
await consume(did, ddo.dataToken, 'access')
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user