Skip to main content

useMakeBid() function

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

Use this to place a bid on an auction listing from your marketplace contract.

Example

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

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

return (
<button
disabled={isLoading}
onClick={() => makeBid({ listingId: 1, bid: 2 })}
>
Bid!
</button>
);
};

Signature:

export declare function useMakeBid(
contract: RequiredParam<Marketplace>,
): import("@tanstack/react-query").UseMutationResult<
Omit<
{
receipt: import("@ethersproject/abstract-provider").TransactionReceipt;
data: () => Promise<unknown>;
},
"data"
>,
unknown,
MakeBidParams,
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, MakeBidParams, unknown>

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