Skip to main content

useCreateAuctionListing() function

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

Use this to create a new Auction Listing on your marketplace contract.

Example

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

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

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

Signature:

export declare function useCreateAuctionListing<
TMarketplace extends Marketplace | MarketplaceV3,
>(
contract: RequiredParam<TMarketplace>,
): import("@tanstack/react-query").UseMutationResult<
import("@thirdweb-dev/sdk").TransactionResultWithId<never>,
unknown,
TMarketplace extends Marketplace
? NewAuctionListing
: {
startTimestamp?: Date | undefined;
quantity?: string | number | bigint | BigNumber | undefined;
bidBufferBps?: string | number | bigint | BigNumber | undefined;
endTimestamp?: Date | undefined;
timeBufferInSeconds?: string | number | bigint | BigNumber | undefined;
currencyContractAddress?: string | undefined;
tokenId: string | number | bigint | BigNumber;
minimumBidAmount: string | number;
buyoutBidAmount: string | number;
assetContractAddress: string;
},
unknown
>;

Parameters

ParameterTypeDescription
contractRequiredParam<TMarketplace>an instance of a Marketplace contract

Returns:

import("@tanstack/react-query").UseMutationResult<import("@thirdweb-dev/sdk").TransactionResultWithId<never>, unknown, TMarketplace extends Marketplace ? NewAuctionListing : { startTimestamp?: Date | undefined; quantity?: string | number | bigint | BigNumber | undefined; bidBufferBps?: string | number | bigint | BigNumber | undefined; endTimestamp?: Date | undefined; timeBufferInSeconds?: string | number | bigint | BigNumber | undefined; currencyContractAddress?: string | undefined; tokenId: string | number | bigint | BigNumber; minimumBidAmount: string | number; buyoutBidAmount: string | number; assetContractAddress: string; }, unknown>

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