Docs

useExecuteAuctionSale

Hook for executing a sale of an auction listing on a Marketplace contract.

Triggers a new sale, transferring the NFT(s) to the buyer and the funds to the seller.

A sale must be executed when an auction ends, and the auction has a winning bid that was below the buyout price. This means the auction has finished, and the highest bidder has won the auction. Any wallet can now execute the sale, transferring the NFT(s) to the buyer and the funds to the seller.

Example

import {
useExecuteAuctionSale,
useContract,
Web3Button,
} from "@thirdweb-dev/react";
function App() {
const { contract } = useContract(contractAddress, "marketplace");
const {
mutateAsync: executeAuctionSale,
isLoading,
error,
} = useExecuteAuctionSale(contract);
return (
<Web3Button
contractAddress={contractAddress}
action={() =>
executeAuctionSale({
// The listingId of the auction to execute
listingId: "{{listing_id}}",
})
}
>
Execute Auction Sale
</Web3Button>
);
}

Parameters

Returns

Mutation object to accept an offer on a direct listing

const { mutateAsync, isLoading, error } =
useExecuteAuctionSale(contract);

options

The mutation function accepts an object as argument with the following properties:

listingId

The ID of the auction listing to execute the sale on. If the listing cannot be found, is not an auction, or is not ready to be executed, the error property will be set.