useMinimumNextBid
Hook for getting the minimum next bid for a given listing on a smart contract.
Available to use on smart contracts that implement the Marketplace or MarketplaceV3 standard.
import { useMinimumNextBid } from "@thirdweb-dev/react";
Usage
Provide your Marketplace contract as the argument, as well as the listing ID.
import { useMinimumNextBid, useContract, Web3Button } from "@thirdweb-dev/react";
// Your smart contract address
const contractAddress = "{{contract_address}}";
function App() {
const { contract } = useContract(contractAddress);
const { data: minimumNextBid, isLoading, error } = useMinimumNextBid(
contract,
"{{listing_id}}"
);
if (error) {
console.error("failed to get minimum next bid", error);
}
return (
<Web3Button
contractAddress={contractAddress}
action={() =>
// TODO: Call bid action
}
>
Bid {minimumNextBid.displayValue} {minimumNextBid.symbol}
</Web3Button>
);
}
Return Values
The hook returns an object with the following properties:
Property | Type | Description |
---|---|---|
symbol | string | The currency symbol of the next minimum bid |
value | BigNumber | The raw value of the next minimum bid |
name | string | The name of the currency |
decimals | number | The number of decimals for the currency |
displayValue | string | The formatted value of the next minimum bid, with the correct number of decimal points and correct currency symbol. This is the value that you should display to the user (e.g. "10.00 ETH" or "500.00 DAI" ) |