From f9b1e7a530c21a4e37464772b83fe803204e0076 Mon Sep 17 00:00:00 2001 From: mihaisc Date: Wed, 19 Aug 2020 17:33:07 +0300 Subject: [PATCH] added bestPrice, updated example,readme --- README.md | 14 ++------------ example/src/MetadataExample.tsx | 15 ++------------- src/hooks/useMetadata/useMetadata.ts | 5 +++++ 3 files changed, 9 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index aa095e2..4605133 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ export default function MyComponent() { const { ocean, web3, account } = useOcean() // Get metadata for this asset - const { title, metadata, isLoaded, getBestPrice } = useMetadata(did) + const { title, metadata, bestPrice } = useMetadata(did) const [price, setPrice] = useState() // publish asset @@ -73,16 +73,6 @@ export default function MyComponent() { // consume asset const { consume, consumeStep } = useConsume() - useEffect(() => { - async function init(): Promise { - if (isLoaded) { - const price = await getBestPrice() - setPrice(price) - } - } - init() - }, [isLoaded]) - async function handleDownload() { await consume(did) } @@ -90,7 +80,7 @@ export default function MyComponent() { return (

{title}

-

Price: {price}

+

Price: {bestPrice}

Your account: {account}