Skip to main content

useCancelListing() function

This feature is currently in beta and may change based on feedback that we receive.

Use this to cancel a listing on your marketplace contract.

Example

const Component = () => {
const {
mutate: cancelListing,
isLoading,
error,
} = useCancelListing(">>YourMarketplaceContractInstance<<");

if (error) {
console.error("failed to cancel auction listing", error);
}

return (
<button disabled={isLoading} onClick={() => cancelListing()}>
Create Auction Listing!
</button>
);
};

Signature:

export declare function useCancelListing(
contract: RequiredParam<Marketplace>,
): import("@tanstack/react-query").UseMutationResult<
| Omit<
{
receipt: import("@ethersproject/abstract-provider").TransactionReceipt;
data: () => Promise<unknown>;
},
"data"
>
| undefined,
unknown,
Pick<AuctionListing | DirectListing, "id" | "type">,
unknown
>;

Parameters

ParameterTypeDescription
contractRequiredParam<Marketplace>an instance of a Marketplace contract

Returns:

import("@tanstack/react-query").UseMutationResult<Omit<{ receipt: import("@ethersproject/abstract-provider").TransactionReceipt; data: () => Promise<unknown>; }, "data"> | undefined, unknown, Pick<AuctionListing | DirectListing, "id" | "type">, unknown>

a mutation object that can be used to create a new auction listing