useMarketplace
Deprecated
This hook is deprecated and will be removed in a future major version. You should use useContract instead.
- const marketplace = useMarketplace("0x1234...");
+ const marketplace = useContract("0x1234...", "marketplace").contract;
Hook for getting an instance of a Marketplace
contract. This contract is used to support marketplace for purchase and sale of on-chain assets.
function useMarketplace(
contractAddress: RequiredParam<string>,
): undefined | Marketplace;
Parameters
Returns
type ReturnType = undefined | Marketplace;
Example
import { useContract } from '@thirdweb-dev/react'
export default function Component() {
const { contract } = useContract("<YOUR-CONTRACT-ADDRESS>", "marketplace")
// Now you can use the marketplace contract in the rest of the component
// For example, this function will return all the listings on the marketplace
async function getListings() {
const listings = await contract.getAll()
return listings
}
...
}