Function useBuyNow

  • Beta

    Buy out an auction listing

    Parameters

    • contract: RequiredParam<Marketplace>

      an instance of a Marketplace contract

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

    a mutation object that can be used to buy out an auction listing

    Example

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

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

    return (
    <button
    disabled={isLoading}
    onClick={() => buyNow({listingId: 1, type: ListingType.Auction})}
    >
    Buy listing!
    </button>
    );
    };

    See

    Documentation

Generated using TypeDoc