The SDK provides a set of hooks that you can use to get the marketplace data. Here is the list of hooks provided by the SDK:
useAllNftsInCollection
This hook returns all the NFTs in a collection. You can use this hook to get all the NFTs in a collection.
import { Networks, useAllNftsInCollection } from'@lyncworld/fuel-marketplace';const { fetching,data,error } =useAllNftsInCollection({ network:Networks.Testnet,// Select from "NFT" or "SEMI_FT" according to actual token standard nftStandard:'SEMI_FT',// Replace this demo contract address with actual contract address contractAddress:'0x...',});
This hook returns all the collections whose at least one token is listed on the marketplace.
import { Networks, useCollections } from'@lyncworld/fuel-marketplace';const { fetching,data,error } =useCollections({ network:Networks.Testnet,// You can pass the limit to get the top N collections or remove it to get all collections limit:10,});
This hook returns all the tokens listed on the marketplace for buying.
import { Networks, useListings } from'@lyncworld/fuel-marketplace';const { fetching,data,error } =useListings({ network:Networks.Testnet,// You can pass the limit to get the top N listings or remove it to get all listings limit:10,});
This hook return all the listing details of a specific token by its contract address, token standard, and token ID.
import { Networks, useNft } from'@lyncworld/fuel-marketplace';const { fetching,data,error } =useNft({ network:Networks.Testnet,// Select from "NFT" or "SEMI_FT" according to actual token standard nftStandard:'SEMI_FT',// Replace this demo contract address with actual contract address of the token contractAddress:'0x...',// Replace this demo token id with actual token id (or sub id) of the token tokenId:'0x...',// You can pass the limit to get the top N listing or remove it to get all the listing of the token limit:10,});