Function useBuyDirectListing

  • Beta

    Buy a direct listing

    Parameters

    • contract: RequiredParam<MarketplaceV3>

      an instance of a MarketplaceV3 contract

    Returns UseMutationResult<Omit<{
        data: (() => Promise<unknown>);
        receipt: providers.TransactionReceipt;
    }, "data">, unknown, BuyFromListingParams, unknown>

    a mutation object that can be used to buy out a direct listing

    Example

    const Component = () => {
    const { contract } = useContract("{{contract_address}}", "marketplace-v3");
    const {
    mutate: buyNow,
    isLoading,
    error,
    } = useBuyDirectListing(contract);

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

    return (
    <button
    disabled={isLoading}
    onClick={() => buyNow({listingId: 1, quantity: 1, buyer: "{{address}}"})}
    >
    Buy listing!
    </button>
    );
    };

    See

    Documentation

Generated using TypeDoc