useValidDirectListings
Hook to get a list of valid direct listings from a Marketplace V3 contract.
A listing is considered valid if the:
- Seller still owns the NFT
- Listing has not expired (time is before
endTimeInSeconds
) - Listing has not been canceled
- Listing has not been bought out (all
quantity
of the NFTs have not been purchased)
Marketplace
Note: This hook is only for Marketplace V3 contracts.
For Marketplace contracts, use useActiveListings instead.
import { useValidDirectListings } from "@thirdweb-dev/react";
const { data, isLoading, error } = useValidDirectListings(contract, filter);
Usage
To get all valid direct listings, provide your Marketplace V3 contract instance and an optional filter object to the hook.
import { useValidDirectListings, useContract } from "@thirdweb-dev/react";
// Your smart contract address
const contractAddress = "{{contract_address}}";
function App() {
const { contract } = useContract(contractAddress, "marketplace-v3");
const {
data: directListings,
isLoading,
error,
} = useValidDirectListings(contract);
}