Function useCreateDirectListing

  • Create a new direct listing

    Type Parameters

    • TMarketplace extends Marketplace | MarketplaceV3

    Parameters

    • contract: RequiredParam<TMarketplace>

      an instance of a Marketplace contract

    Returns UseMutationResult<TransactionResultWithId, unknown, TMarketplace extends Marketplace
        ? NewDirectListing
        : {
            assetContractAddress: string;
            currencyContractAddress?: string;
            endTimestamp?: number | Date;
            isReservedListing?: boolean;
            pricePerToken: string | number;
            quantity?: string | number | bigint | BigNumber;
            startTimestamp?: number | Date;
            tokenId: (string | number | bigint | BigNumber) & (string | number | bigint | BigNumber | undefined);
        }, unknown>

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

    Example

    const Component = () => {
    const { contract } = useContract("{{contract_address}}");
    const {
    mutate: createDirectListing,
    isLoading,
    error,
    } = useCreateDirectListing(contract);

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

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

    Twfeature

    DirectListings

    See

    Documentation

Generated using TypeDoc