Docs

useMakeBid

Hook for placing a bid on a Marketplace auction listing.

Bids have several important properties:

  • Cannot be canceled once placed.

  • Are automatically refunded if they are outbid.

  • Must be higher than the current highest bid by the percentage defined in the bid buffer.

  • Must be higher than the reserve price (if there is no bid yet).

Example

import { useMakeBid, useContract, Web3Button } from "@thirdweb-dev/react";
function App() {
const { contract } = useContract(contractAddress, "marketplace");
const { mutateAsync: makeBid, isLoading, error } = useMakeBid(contract);
return (
<Web3Button
contractAddress={contractAddress}
action={() =>
makeBid({
listingId: "1", // ID of the listing to bid on. Must be an auction.
bid: "1", // Uses the currencyContractAddress of the listing.
})
}
>
Make Bid
</Web3Button>
);
}

Parameters

Returns

Mutation object to make a bid on an auction listing

const { mutateAsync, isLoading, error } = useMakeBid(contract);

options

The mutation function takes an object as an argument with the following properties:

listingId

The ID of the listing to bid on. Must be an auction type listing. (Use useMakeOffer for direct listings).

If the listing cannot be found, is not an auction, or is not active, the error property will be set.

bid

The amount to bid on the listing. Uses the currencyContractAddress of the listing.

For example, if the listing uses the NATIVE_TOKEN_ADDRESS on Ethereum, the bid amount is the amount of ETH to bid. Can be in the form of a number, string, or BigNumber.

The bid value must be either:

  • Greater than or equal to the reserve price if there is no current bid.

  • Greater than the current highest bid by the percentage defined in the bid buffer.

Use the useNextMinimumBid hook to get the next minimum bid amount required.