useAuctionWinner

Hook for getting the winner of an auction (or english auction) on a Marketplace or MarketplaceV3 contract.

Example

import { useAuctionWinner, useContract } from "@thirdweb-dev/react";
function App() {
const { contract } = useContract(contractAddress, "marketplace");
const { data, isLoading, error } = useAuctionWinner(
contract,
listingId, // The listing id of the item that you want to get the auction winner for
);
}
function useAuctionWinner(
contract: RequiredParam<Marketplace | MarketplaceV3>,
listingId: RequiredParam<BigNumberish>,
): UseQueryResult<string, unknown>;

Parameters

Instance of a Marketplace or MarketplaceV3 contract

Type

let contract: RequiredParam<Marketplace | MarketplaceV3>;

The listing ID of the item that you want to get the auction winner for.

The listing must be an auction (or english auction) listing, the hook will populate the error property if it is not.

Type

let listingId: RequiredParam<BigNumberish>;

Returns

let returnType: UseQueryResult<string, unknown>;

The hook's data property, once loaded, contains a string representing the address of the auction winner, or undefined if there is no winner.