Skip to main content

useListingsCount

Hook for getting the total number of listings on a Marketplace contract.

Marketplace V3

Note: this hook is only available for Marketplace contracts.

If you are using Marketplace V3, use useListingsCount or useEnglishAuctionsCount instead.

import { useListingsCount } from "@thirdweb-dev/react";

const { data: listingsCount, isLoading, error } = useListingsCount(contract);

Usage

Provide your marketplace contract as the argument.

import { useContract, useListingsCount } from "@thirdweb-dev/react";

const contractAddress = "{{contract_address}}";

function App() {
const { contract } = useContract(contractAddress, "marketplace");
const { data: listingsCount, isLoading, error } = useListingsCount(contract);
}

Return Value

Return Value

The hook's data property, once loaded, is a BigNumber containing the total number of listings on the contract.

BigNumber | undefined;