useWinningBid

Hook for getting the winning bid of an auction listing on a Marketplace contract.

Example

import { useContract, useWinningBid } from "@thirdweb-dev/react";
function App() {
const { contract } = useContract(contractAddress, "marketplace");
const { data, isLoading, error } = useWinningBid(
contract,
listingId,
);
}
function useWinningBid(
contract: RequiredParam<Marketplace>,
listingId: RequiredParam<BigNumberish>,
): UseQueryResult<undefined | Offer, unknown>;

Parameters

Instance of a marketplace contract

Type

let contract: RequiredParam<Marketplace>;

The ID of the listing to get the winning bid for. If the listing cannot be found, is not an auction listing, or is not active, the error property will be set.

Type

let listingId: RequiredParam<BigNumberish>;

Returns

let returnType: UseQueryResult<undefined | Offer, unknown>;

Query result object that includes the Offer that is winning the auction The hook's data property, once loaded, is an object of type Offer , or undefined if no winning bid exists.

{
// The id of the listing.
listingId: BigNumberish;
// The address of the buyer who made the offer.
buyerAddress: string;
// The quantity of tokens to be bought.
quantityDesired: BigNumberish;
// The amount of coins offered per token.
pricePerToken: BigNumber;
// The `CurrencyValue` of the listing. Useful for displaying the price information.
currencyValue: CurrencyValue;
// The currency contract address of the offer token.
currencyContractAddress: string;
} | undefined;