useActiveListings
Hook for fetching all active listings from a Marketplace contract. "Active" means the listing is not canceled, expired, or sold.
Marketplace V3
Note: This hook is only for Marketplace contracts.
For Marketplace V3 contracts, use useValidDirectListings or useValidEnglishAuctions instead.
import { useActiveListings } from "@thirdweb-dev/react";
const { data, isLoading, error } = useActiveListings(contract);
Usage
Provide your marketplace contract as the argument to the hook.
The returned data
contains both kinds of listings; auctions and direct.
import { useActiveListings, useContract } from "@thirdweb-dev/react";
// Your smart contract address
const contractAddress = "{{contract_address}}";
function App() {
const { contract } = useContract(contractAddress, "marketplace");
const { data, isLoading, error } = useActiveListings(contract);
}