Skip to main content

useMakeOffer() function

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

Use this to make an offer on direct or auction listing from your marketplace contract.

Example

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

if (error) {
console.error("failed to make a bid", error);
}

return (
<button
disabled={isLoading}
onClick={() =>
makeOffer({ listingId: 1, pricePerToken: 0.5, quantity: 1 })
}
>
Bid!
</button>
);
};

Signature:

export declare function useMakeOffer(
contract: RequiredParam<Marketplace>,
): import("@tanstack/react-query").UseMutationResult<
Omit<
{
receipt: import("@ethersproject/abstract-provider").TransactionReceipt;
data: () => Promise<unknown>;
},
"data"
>,
unknown,
MakeOfferParams,
unknown
>;

Parameters

ParameterTypeDescription
contractRequiredParam<Marketplace>an instance of a Marketplace contract

Returns:

import("@tanstack/react-query").UseMutationResult<Omit<{ receipt: import("@ethersproject/abstract-provider").TransactionReceipt; data: () => Promise<unknown>; }, "data">, unknown, MakeOfferParams, unknown>

a mutation object that can be used to make a bid on an auction listing