useOffers
Hook for getting all of the offers made on a direct listing on a Marketplace contract.
import { useOffers } from "@thirdweb-dev/react";
const { data: offers, isLoading, error } = useOffers(contract, listingId);
Usage
Provide your Marketplace contract from the
useContract
hook and the listingId
of the listing you want to get the offers for as
arguments to the hook.
import { useOffers, useContract } from "@thirdweb-dev/react";
// Your smart contract address
const contractAddress = "{{contract_address}}";
// The listing ID you want to fetch offers for
const listingId = "{{listing_id}}";
function App() {
const { contract } = useContract(contractAddress, "marketplace");
const { data: offers, isLoading, error } = useOffers(contract, listingId);
}