Skip to main content

useMarketplace() function

Warning: This API is now obsolete.

This hook is deprecated and will be removed in a future major version. You should use instead.

- const marketplace = await sdk.useMarketplace("0x1234...");
+ const marketplace = await sdk.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.

Example

import { useMarketplace } from '@thirdweb-dev/react'

export default function Component() {
const marketplace = useMarketplace("<YOUR-CONTRACT-ADDRESS>")

// 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 marketplace.getAll()
return listings
}

...
}

Signature:

export declare function useMarketplace(
contractAddress: RequiredParam<string>,
): import("@thirdweb-dev/sdk").Marketplace | undefined;

Parameters

ParameterTypeDescription
contractAddressRequiredParam<string>the address of the Marketplace contract, found in your thirdweb dashboard

Returns:

import("@thirdweb-dev/sdk").Marketplace | undefined