useAuctionWinner
Hook for getting the winner of an auction for a specific item on a smart contract.
Available to use on smart contracts that implement the Marketplace or MarketplaceV3 standard.
import { useAuctionWinner } from "@thirdweb-dev/react";
Usage
Provide your Marketplace contract and the item id as the arguments.
import { useAuctionWinner, useContract } from "@thirdweb-dev/react";
// Your smart contract address
const contractAddress = "{{contract_address}}";
function App() {
const { contract } = useContract(contractAddress, "marketplace");
const { data, isLoading, error } = useAuctionWinner(
contract,
1, // The listing id of the item that you want to get the auction winner for
);
}
Return Value
The hook's data
property, once loaded, contains the following properties:
string | undefined;
A string containing the address of the auction winner, or undefined if there is no winner.