Skip to main content

Marketplace class

Create your own whitelabel marketplace that enables users to buy and sell any digital assets.

Example

import { ThirdwebSDK } from "@thirdweb-dev/sdk";

const sdk = new ThirdwebSDK("{{chainName}}");
const contract = sdk.getMarketplace("{{contract_address}}");

Constructors

ConstructorModifiersDescription
(constructor)(network, address, storage, options, abi, contractWrapper)Constructs a new instance of the Marketplace class

Properties

PropertyModifiersTypeDescription
abitypeof ABI
auctionMarketplaceAuctionAuctions
contractRolesstaticreadonly ["admin", "lister", "asset"]
directMarketplaceDirectDirect listings
encoderContractEncoder<MarketplaceContract>
estimatorGasCostEstimator<MarketplaceContract>
eventsContractEvents<MarketplaceContract>
metadataContractMetadata<MarketplaceContract, typeof MarketplaceContractSchema>
platformFeesContractPlatformFee<MarketplaceContract>
rolesContractRoles<MarketplaceContract, typeof Marketplace.contractRoles[number]>

Methods

MethodModifiersDescription
allowListingFromAnyAsset()Allow listings from any NFT contract
allowListingFromSpecificAssetOnly(contractAddress)Restrict listing NFTs only from the specified NFT contract address. It is possible to allow listing from multiple contract addresses.
buyoutListing(listingId, quantityDesired, receiver)Purchase NFTs
getActiveListings(filter)Get all active listings
getAddress()
getAllListings(filter)Get all the listings
getBidBufferBps()Get the buffer in basis points between offers
getListing(listingId)Convenience function to get either a direct or auction listing
getOffers(listingId)Get all the offers for a listing
getTimeBufferInSeconds()get the buffer time in seconds between offers
getTotalCount()Get the total number of Listings
isRestrictedToListerRoleOnly()Get whether listing is restricted only to addresses with the Lister role
onNetworkUpdated(network)
setBidBufferBps(bufferBps)Set the Auction bid buffer
setTimeBufferInSeconds(bufferInSeconds)Set the Auction Time buffer:

Signature:

export declare class Marketplace implements UpdateableNetwork

Implements: UpdateableNetwork