Skip to main content

Marketplace

Calls

acceptOffer

Accepts an offer on a token Caller must be token owner

Namespace

api.tx.marketplace.acceptOffer

Type

function acceptOffer(
offer_id: u64
)

auctionNft

Auction a bundle of tokens on the open market to the highest bidder

  • Tokens must be from the same collection

  • Tokens with individual royalties schedules cannot be sold in bundles

Caller must be the token owner

  • payment_asset fungible asset Id to receive payment with

  • reserve_price winning bid must be over this threshold

  • duration length of the auction (in blocks), uses default duration if unspecified

Namespace

api.tx.marketplace.auctionNft

Type

function auctionNft(
collection_id: u32,
serial_numbers: Vec<u32>,
payment_asset: u32,
reserve_price: u128,
duration: Option<u32>,
marketplace_id: Option<u32>
)

bid

Place a bid on an open auction

  • amount to bid (in the seller's requested payment asset)

Namespace

api.tx.marketplace.bid

Type

function bid(
listing_id: u128,
amount: u128
)

buy

Buy a token listing for its specified price

Namespace

api.tx.marketplace.buy

Type

function buy(
listing_id: u128
)

cancelOffer

Cancels an offer on a token Caller must be the offer buyer

Namespace

api.tx.marketplace.cancelOffer

Type

function cancelOffer(
offer_id: u64
)

cancelSale

Close a sale or auction returning tokens Requires no successful bids have been made for an auction. Caller must be the listed seller

Namespace

api.tx.marketplace.cancelSale

Type

function cancelSale(
listing_id: u128
)

makeSimpleOffer

Create an offer on a token Locks funds until offer is accepted, rejected or cancelled An offer can't be made on a token currently in an auction (This follows the behaviour of Opensea and forces the buyer to bid rather than create an offer)

Namespace

api.tx.marketplace.makeSimpleOffer

Type

function makeSimpleOffer(
token_id: (u32,u32),
amount: u128,
asset_id: u32,
marketplace_id: Option<u32>
)

registerMarketplace

Flag an account as a marketplace

marketplace_account - if specified, this account will be registered entitlement - Permill, percentage of sales to go to the marketplace If no marketplace is specified the caller will be registered

Namespace

api.tx.marketplace.registerMarketplace

Type

function registerMarketplace(
marketplace_account: Option<SeedPrimitivesSignatureAccountId20>,
entitlement: Permill
)

sellNft

Sell a bundle of tokens at a fixed price

  • Tokens must be from the same collection

  • Tokens with individual royalties schedules cannot be sold with this method

buyer optionally, the account to receive the NFT. If unspecified, then any account may purchase asset_id fungible asset Id to receive as payment for the NFT fixed_price ask price duration listing duration time in blocks from now Caller must be the token owner

Namespace

api.tx.marketplace.sellNft

Type

function sellNft(
collection_id: u32,
serial_numbers: Vec<u32>,
buyer: Option<SeedPrimitivesSignatureAccountId20>,
payment_asset: u32,
fixed_price: u128,
duration: Option<u32>,
marketplace_id: Option<u32>
)

setFeeTo

Set the FeeTo account This operation requires root access

Namespace

api.tx.marketplace.setFeeTo

Type

function setFeeTo(
fee_to: Option<SeedPrimitivesSignatureAccountId20>
)

updateFixedPrice

Update fixed price for a single token sale

listing_id id of the fixed price listing new_price new fixed price Caller must be the token owner

Namespace

api.tx.marketplace.updateFixedPrice

Type

function updateFixedPrice(
listing_id: u128,
new_price: u128
)

Storage

feeTo

The pallet id for the tx fee pot

Namespace

api.query.marketplace.feeTo

Type

function feeTo(

): Option<SeedPrimitivesSignatureAccountId20>

listingEndSchedule

Block numbers where listings will close. Value is true if at block number listing_id is scheduled to close.

Namespace

api.query.marketplace.listingEndSchedule

Type

function listingEndSchedule(
u32,
u128
): Option<bool>

listings

NFT sale/auction listings keyed by listing id

Namespace

api.query.marketplace.listings

Type

function listings(
u128
): Option<PalletMarketplaceListing>

listingWinningBid

Winning bids on open listings.

Namespace

api.query.marketplace.listingWinningBid

Type

function listingWinningBid(
u128
): Option<(SeedPrimitivesSignatureAccountId20,u128)>

nextListingId

The next available listing Id

Namespace

api.query.marketplace.nextListingId

Type

function nextListingId(

): u128

nextMarketplaceId

The next available marketplace id

Namespace

api.query.marketplace.nextMarketplaceId

Type

function nextMarketplaceId(

): u32

nextOfferId

The next available offer_id

Namespace

api.query.marketplace.nextOfferId

Type

function nextOfferId(

): u64

offers

Map from offer_id to the information related to the offer

Namespace

api.query.marketplace.offers

Type

function offers(
u64
): Option<PalletMarketplaceOfferType>

openCollectionListings

Map from collection to any open listings

Namespace

api.query.marketplace.openCollectionListings

Type

function openCollectionListings(
u32,
u128
): Option<bool>

registeredMarketplaces

Map from marketplace account_id to royalties schedule

Namespace

api.query.marketplace.registeredMarketplaces

Type

function registeredMarketplaces(
u32
): Option<PalletMarketplaceMarketplace>

tokenOffers

Maps from token_id to a vector of offer_ids on that token

Namespace

api.query.marketplace.tokenOffers

Type

function tokenOffers(
(u32,u32)
): Option<Vec<u64>>

Events

AuctionClose

An auction has closed without selling

Namespace

api.events.marketplace.AuctionClose

Type

type AuctionClose = {
collection_id: u32,
listing_id: u128,
reason: PalletMarketplaceAuctionClosureReason
}

AuctionOpen

An auction has opened

Namespace

api.events.marketplace.AuctionOpen

Type

type AuctionOpen = {
collection_id: u32,
serial_numbers: Vec<u32>,
payment_asset: u32,
reserve_price: u128,
listing_id: u128,
marketplace_id: Option<u32>,
seller: SeedPrimitivesSignatureAccountId20
}

AuctionSold

An auction has sold

Namespace

api.events.marketplace.AuctionSold

Type

type AuctionSold = {
collection_id: u32,
listing_id: u128,
payment_asset: u32,
hammer_price: u128,
winner: SeedPrimitivesSignatureAccountId20
}

Bid

A new highest bid was placed

Namespace

api.events.marketplace.Bid

Type

type Bid = {
collection_id: u32,
serial_numbers: Vec<u32>,
listing_id: u128,
amount: u128,
bidder: SeedPrimitivesSignatureAccountId20
}

FeeToSet

The network fee receiver address has been updated

Namespace

api.events.marketplace.FeeToSet

Type

type FeeToSet = {
account: Option<SeedPrimitivesSignatureAccountId20>
}

FixedPriceSaleClose

A fixed price sale has closed without selling

Namespace

api.events.marketplace.FixedPriceSaleClose

Type

type FixedPriceSaleClose = {
collection_id: u32,
serial_numbers: Vec<u32>,
listing_id: u128,
reason: PalletMarketplaceFixedPriceClosureReason
}

FixedPriceSaleComplete

A fixed price sale has completed

Namespace

api.events.marketplace.FixedPriceSaleComplete

Type

type FixedPriceSaleComplete = {
collection_id: u32,
serial_numbers: Vec<u32>,
listing_id: u128,
price: u128,
payment_asset: u32,
buyer: SeedPrimitivesSignatureAccountId20,
seller: SeedPrimitivesSignatureAccountId20
}

FixedPriceSaleList

A fixed price sale has been listed

Namespace

api.events.marketplace.FixedPriceSaleList

Type

type FixedPriceSaleList = {
collection_id: u32,
serial_numbers: Vec<u32>,
listing_id: u128,
marketplace_id: Option<u32>,
price: u128,
payment_asset: u32,
seller: SeedPrimitivesSignatureAccountId20
}

FixedPriceSalePriceUpdate

A fixed price sale has had its price updated

Namespace

api.events.marketplace.FixedPriceSalePriceUpdate

Type

type FixedPriceSalePriceUpdate = {
collection_id: u32,
serial_numbers: Vec<u32>,
listing_id: u128,
new_price: u128
}

MarketplaceRegister

An account has been registered as a marketplace

Namespace

api.events.marketplace.MarketplaceRegister

Type

type MarketplaceRegister = {
account: SeedPrimitivesSignatureAccountId20,
entitlement: Permill,
marketplace_id: u32
}

Offer

An offer has been made on an NFT

Namespace

api.events.marketplace.Offer

Type

type Offer = {
offer_id: u64,
amount: u128,
asset_id: u32,
marketplace_id: Option<u32>,
buyer: SeedPrimitivesSignatureAccountId20
}

OfferAccept

An offer has been accepted

Namespace

api.events.marketplace.OfferAccept

Type

type OfferAccept = {
offer_id: u64,
token_id: (u32,u32),
amount: u128,
asset_id: u32
}

OfferCancel

An offer has been cancelled

Namespace

api.events.marketplace.OfferCancel

Type

type OfferCancel = {
offer_id: u64,
token_id: (u32,u32)
}

Errors

BidTooLow

Auction bid was lower than reserve or current highest bid

Namespace

api.errors.marketplace.BidTooLow

InvalidMetadataPath

The metadata path is invalid (non-utf8 or empty)

Namespace

api.errors.marketplace.InvalidMetadataPath

InvalidOffer

No offer exists for the given OfferId

Namespace

api.errors.marketplace.InvalidOffer

IsTokenOwner

The caller owns the token and can't make an offer

Namespace

api.errors.marketplace.IsTokenOwner

MarketplaceNotRegistered

The account_id hasn't been registered as a marketplace

Namespace

api.errors.marketplace.MarketplaceNotRegistered

MaxOffersReached

The maximum number of offers on this token has been reached

Namespace

api.errors.marketplace.MaxOffersReached

MixedBundleSale

Selling tokens from different collection is not allowed

Namespace

api.errors.marketplace.MixedBundleSale

NoAvailableIds

No more Ids are available, they've been exhausted

Namespace

api.errors.marketplace.NoAvailableIds

NoCollectionFound

The collection does not exist

Namespace

api.errors.marketplace.NoCollectionFound

NotBuyer

The caller is not the specified buyer

Namespace

api.errors.marketplace.NotBuyer

NotCollectionOwner

Origin is not the collection owner and is not permitted to perform the operation

Namespace

api.errors.marketplace.NotCollectionOwner

NotForAuction

The token is not listed for auction sale

Namespace

api.errors.marketplace.NotForAuction

NotForFixedPriceSale

The token is not listed for fixed price sale

Namespace

api.errors.marketplace.NotForFixedPriceSale

NoToken

The token does not exist

Namespace

api.errors.marketplace.NoToken

NotSeller

The caller is not the seller of the NFT

Namespace

api.errors.marketplace.NotSeller

NotTokenOwner

Origin does not own the NFT

Namespace

api.errors.marketplace.NotTokenOwner

RoyaltiesInvalid

Total royalties would exceed 100% of sale or an empty vec is supplied

Namespace

api.errors.marketplace.RoyaltiesInvalid

TokenLocked

Cannot operate on a listed NFT

Namespace

api.errors.marketplace.TokenLocked

TokenNotListed

The token is not listed for sale

Namespace

api.errors.marketplace.TokenNotListed

TokenOnAuction

Cannot make an offer on a token up for auction

Namespace

api.errors.marketplace.TokenOnAuction

ZeroOffer

Offer amount needs to be greater than 0

Namespace

api.errors.marketplace.ZeroOffer

Constants

defaultFeeTo

The default account which collects network fees from marketplace sales

Namespace

api.consts.marketplace.defaultFeeTo

Type

type defaultFeeTo = Option<FrameSupportPalletId>

defaultListingDuration

Default auction / sale length in blocks

Namespace

api.consts.marketplace.defaultListingDuration

Type

type defaultListingDuration = u32

palletId

This pallet's Id, used for deriving a sovereign account ID

Namespace

api.consts.marketplace.palletId

Type

type palletId = FrameSupportPalletId