Skip to main content

useCreateDirectListing() function

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

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

Example

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

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

return (
<button
disabled={isLoading}
onClick={() => createDirectListing(directListingData)}
>
Create Direct Listing!
</button>
);
};

Signature:

export declare function useCreateDirectListing(
contract: RequiredParam<Marketplace>,
): import("@tanstack/react-query").UseMutationResult<
import("@thirdweb-dev/sdk/dist/browser").TransactionResultWithId<never>,
unknown,
NewDirectListing,
unknown
>;

Parameters

ParameterTypeDescription
contractRequiredParam<Marketplace>an instance of a Marketplace contract

Returns:

import("@tanstack/react-query").UseMutationResult<import("@thirdweb-dev/sdk/dist/browser").TransactionResultWithId<never>, unknown, NewDirectListing, unknown>

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