Skip to main content

useBidBuffer

Hook for determining the current bid buffer on a marketplace contract.

The bid buffer is what percentage higher the next bid must be than the current highest bid.

Available to use on marketplace contracts.

import { useBidBuffer } from "@thirdweb-dev/react";

Usage

Provide your marketplace contract as the first argument, and the listing ID as the second argument.

import { useBidBuffer, useContract } from "@thirdweb-dev/react";

// Your smart contract address
const contractAddress = "{{contract_address}}";
// Listing ID to get the bid buffer for
const listingId = 1;

function App() {
const { contract } = useContract(contractAddress, "marketplace");
const {
data: bidBuffer,
isLoading,
error,
} = useBidBuffer(contract, listingId);

if (error) {
console.error("failed to get bid buffer", error);
}

return (
<div>
<p>The current bid buffer is {bidBuffer?.toString() ?? ""}</p>
</div>
);
}

Return Value

The hook's data property, once loaded, contains the following properties:

bidBuffer: BigNumber;

The bidBuffer value returned is in percentage format. For example, a value of 500 means that the next bid must be 5% higher than the current highest bid.