Docs

Marketplace

When using the Marketplace smart contract, additional top-level functionality is available to use.

To access the top-level functionality, provide the marketplace contract type when creating the contract instance:

Contract contract = sdk.GetContract("0x...");
Marketplace marketplace = contract.marketplace;

Auction - CancelListing

Cancel a listing that you made.

Note: Auction listings cannot be canceled if a bid has been made.

var data = await marketplace.auction.CancelListing("{{listing_id}}");

Auction - CreateListing

List an NFT for sale in an auction listing on the marketplace.

var data = await marketplace.auction.CreateListing(new NewAuctionListing() {
assetContractAddress = "{{contract_address}}",
tokenId = "0",
startTimestamp = DateTime.Now.Ticks,
buyoutPricePerToken = "{{price}}",
listingDurationInSeconds = 86400,
quantity = 1,
});

Auction - ExecuteSale

Close the auction for both buyer and seller.

This means that the NFT is transferred to the buyer, and the seller is paid the amount of the winning bid.

var data = await marketplace.auction.ExecuteSale("{{listing_id}}");

Auction - GetListing

Get the details of a listing using the listing ID.

var data = await marketplace.auction.GetListing("{{listing_id}}");

Auction - GetMinimumNextBid

Get the value that the next bid must be in order to be accepted.

  • If there is no current bid, this value is the reserve price.
  • If there is a current bid, this value is the current bid plus the bid buffer.
var data = await marketplace.auction.GetMinimumNextBid("{{listing_id}}");

Auction - GetWinner

Get the address that won an auction after an auction has ended.

var data = await marketplace.auction.GetWinner("{{listing_id}}");

Auction - GetWinningBid

Get the current highest bid of an active auction.

var data = await marketplace.auction.GetWinningBid("{{listing_id}}");

Direct - CancelListing

Cancel a direct listing you created.

Direct listings can be canceled at any time, unless a buyout has already occurred.

var data = await marketplace.direct.CancelListing("{{listing_id}}");

Direct - CreateListing

List an NFT for sale on the marketplace for direct purchase.

var data = await marketplace.direct.CreateListing(new NewDirectListing()
{
assetContractAddress = "{{contract_address}}",
tokenId = "{{token_id}}",
startTimestamp = DateTime.Now.Ticks,
listingDurationInSeconds = 86400,
quantity = 1,
currencyContractAddress = "{{contract_address}}",
reservePricePerToken = "{{reserve_price}}",
buyoutPricePerToken = "{{buyout_price}}"
});

Direct - GetActiveOffer

Get an active offer on a listing from a specific wallet address, if there is one.

var data = await marketplace.direct.GetActiveOffer("{{listing_id}}", "{{wallet_address}}");

Direct - GetListing

Get a direct listing by its ID.

var data = await marketplace.direct.GetListing("{{listing_id}}");

GetActiveListings

Get all active listings on the marketplace, both direct and auction listings.

An active listing means it can be bought or bid on.

var data = await marketplace.GetActiveListings();

GetAllListings

Get all the listings on the marketplace, including inactive ones.

var data = await marketplace.GetAllListings();

GetOffers

Get all the offers made on a listing.

var data = await marketplace.GetOffers("{{listing_id}}");

MakeOffer

Create a new bid on an auction listing or a new offer on a direct listing.

var data = await marketplace.MakeOffer("{{listing_id}}", "{{price}}", 1);