useEnglishAuction
Hook to get an english auction listing from a Marketplace V3 contract.
Marketplace
Note: This hook is only for Marketplace V3 contracts.
For Marketplace contracts, use useListing instead.
import { useEnglishAuction } from "@thirdweb-dev/react";
const { data, isLoading, error } = useEnglishAuction(contract, listingId);
Usage
Provide your Marketplace V3 contract instance and the listing ID as arguments to the hook.
import { useEnglishAuction, useContract } from "@thirdweb-dev/react";
// Your smart contract address
const contractAddress = "{{contract_address}}";
// The auction id you want to check
const listingId = "{{auction_id}}";
function App() {
const { contract } = useContract(contractAddress, "marketplace-v3");
const {
data: englishAuction,
isLoading,
error,
} = useEnglishAuction(contract, listingId);
}
Configuration
listingId (required)
listingId (required)
The ID of the listing to get.
If the listing with this ID cannot be found (or is not an auction), the error
property will be set.
import { useEnglishAuction, useContract } from "@thirdweb-dev/react";
// Your smart contract address
const contractAddress = "{{contract_address}}";
// The auction id you want to check
const listingId = "{{listing_id}}";
function App() {
const { contract } = useContract(contractAddress, "marketplace-v3");
const {
data: englishAuction,
isLoading,
error,
} = useEnglishAuction(contract, listingId);
}
```
</div>
</details>
## Return Value
<details>
<summary>Return Value</summary>
<div>
The hook's `data` property, once loaded, will be an `EnglishAuction` object, containing the following properties:
```ts
{
/**
* The id of the auction
*/
id: string;
/**
* The address of the creator of auction.
*/
creatorAddress: string;
/**
* The address of the asset being auctioned.
*/
assetContractAddress: string;
/**
* The ID of the token to auction.
*/
tokenId: string;
/**
* The quantity of tokens to include in the auction.
*
* For ERC721s, this value should always be 1 (and will be forced internally regardless of what is passed here).
*/
quantity: string;
/**
* The address of the currency to accept for the auction.
*/
currencyContractAddress: string;
/**
* The minimum price that a bid must be in order to be accepted.
*/
minimumBidAmount: string;
/**
* The `CurrencyValue` of the minimum bid amount.
* Useful for displaying the price information.
*/
minimumBidCurrencyValue: CurrencyValue;
/**
* The buyout price of the auction.
*/
buyoutBidAmount: string;
/**
* The `CurrencyValue` of the buyout price.
* Useful for displaying the price information.
*/
buyoutCurrencyValue: CurrencyValue;
/**
* This is a buffer e.g. x seconds.
*
* If a new winning bid is made less than x seconds before expirationTimestamp, the
* expirationTimestamp is increased by x seconds.
*/
timeBufferInSeconds: number;
/**
* This is a buffer in basis points e.g. x%.
*
* To be considered as a new winning bid, a bid must be at least x% greater than
* the current winning bid.
*/
bidBufferBps: number;
/**
* The start time of the auction.
*/
startTimeInSeconds: number;
/**
* The end time of the auction.
*/
endTimeInSeconds: number;
/**
* The asset being auctioned.
*/
asset: NFTMetadata;
/**
* Whether the listing is CREATED, COMPLETED, or CANCELLED.
*/
status: Status;
}