Skip to content

Commit

Permalink
update docs (ourzora#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
iainnash authored Oct 19, 2021
1 parent eff82ea commit f3db657
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
10 changes: 7 additions & 3 deletions docs/useNFT.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,20 +125,24 @@ type useZNFT = (id: string) => {
data?: NFTDataType; // undefined in error or loading states
}

const contractAddress = 'ZORA_CONTRACT_ADDRESS';

// Example with usage:
const {chainNFT, loading} = useZNFT("2");
const {data, error} = useNFT(contractAddress, "2");
```

Alternatively, the same information can be fetched using the base MediaFetchAgentfor server-side or non-react use:

```ts
import {MediaFetchAgent, Networks} from "@zoralabs/nft-hooks";
import {MediaFetchAgent, FetchStaticData, Networks} from "@zoralabs/nft-hooks";

// Be careful making multiple instances of the fetch agent
// Each instance contains a different request cache.
const fetchAgent = new MediaFetchAgent(Networks.MAINNET);

const contractAddress = 'ZORA_CONTRACT_ADDRESS';

// Get result from the server
const result = await fetchAgent.loadZNFTData("2");
const result = FetchStaticData.fetchNFTData(contractAddress, "2", fetchAgent)
// result type is NFTDataType
```
5 changes: 5 additions & 0 deletions docs/useZNFT.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
## __Deprecated:__
This hook has been deprecated in favor of useNFT


This hook fetches data found on the blockchain from the given zNFT. The only argument for the hook is the NFT id. To fetch data for zNFTs on other networks, use the `NFTFetchConfiguration` wrapper component to set the correct network for loading the NFT data.
The main types are within the result `data.nft` object. This object contains the on-chain NFT data itself. The pricing information can be found in `data.pricing` which corresponds to data on-chain for Zora's perpetual zNFT auctions along with the reserve auction functionality.


```ts
import {useZNFT} from "@zoralabs/nft-hooks";

Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useNFTIndexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type OptionsType = {
};

/**
* Fetches on-chain NFT data and pricing for the given zNFT id
* Fetches on-chain NFT data and pricing for the given NFT id and contract address
*
* @param contractAddress address of the contract, if null and tokenID is passed in, a ZNFT is assumed
* @param tokenId id of NFT to fetch blockchain information for
Expand Down

0 comments on commit f3db657

Please sign in to comment.