Skip to main content

useDirectListingsCount

Hook to get the total number of direct listings on a Marketplace V3 contract.

Marketplace

Note: This hook is only for Marketplace V3 contracts.

For Marketplace contracts, use useListingsCount instead.

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

const { data, isLoading, error } = useDirectListingsCount(contract);

Usage

Provide your Marketplace V3 contract instance as an argument to the hook.

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

// Your smart contract address
const contractAddress = "{{contract_address}}";

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

Return Value

Return Value

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

BigNumber;