useCancelEnglishAuction
Hook for canceling an english auction on a MarketplaceV3 contract.
Note: English auctions cannot be canceled if a bid has been placed.
Marketplace V3
Note: This hook is only for Marketplace V3 contracts.
For Marketplace contracts, use useCancelListing instead.
import { useCancelEnglishAuction } from "@thirdweb-dev/react";
const { mutateAsync, isLoading, error } = useCancelEnglishAuction(contract);
Usage
Provide your marketplace v3 contract as the argument.
Then, provide the ID of the listing you want to cancel to the mutation.
import {
useCancelEnglishAuction,
useContract,
Web3Button,
} from "@thirdweb-dev/react";
// Your smart contract address
const contractAddress = "{{contract_address}}";
// The ID of the listing you want to cancel
const listingId = "{{listing_id}}";
function App() {
const { contract } = useContract(contractAddress, "marketplace-v3");
const {
mutateAsync: cancelEnglishAuction,
isLoading,
error,
} = useCancelEnglishAuction(contract);
return (
<Web3Button
contractAddress={contractAddress}
action={() => cancelEnglishAuction(listingId)}
>
Cancel English Auction
</Web3Button>
);
}