Marketplace & Listings
The MarketplaceSDK and ListingSDK manage the Akita NFT marketplace. Sellers list NFTs at a set price, and buyers purchase them through the marketplace contract.
Concepts
Section titled “Concepts”Marketplace
Section titled “Marketplace”The marketplace is a factory contract that creates individual listing contracts for each NFT sale. It enforces:
- Double-sided fees — Both the platform facilitating the listing and the platform facilitating the purchase can take fees, enabling cross-platform commerce where NFTs listed on one marketplace can be purchased through another
- Royalties — Decentralized royalties via MetaMerkles, verified on-chain through merkle proofs
- Composable listings — Multiple assets can be bundled in a single listing
Listings
Section titled “Listings”Each listing is its own contract instance containing the NFT and sale terms.
Initialization
Section titled “Initialization”import { MarketplaceSDK } from '@akta/sdk/marketplace'
const marketplace = new MarketplaceSDK({ algorand })
// Interact with a specific listingconst listing = marketplace.getListing({ appId: listingAppId })For write operations, configure defaultSender and defaultSigner in factoryParams, or pass sender and signer to each method call.
Listing an NFT
Section titled “Listing an NFT”const listing = await marketplace.list({ asset: nftAssetId, amount: 1n, name: 'My NFT', proof: merkleProof, price: 10_000_000n, // 10 ALGO paymentAsset: 0n, // Accept ALGO expiration: 0n, // No expiry reservedFor: ALGORAND_ZERO_ADDRESS_STRING, // Open to anyone gateId: 0n, // No gate marketplace: marketplaceAddr,})marketplace.list() returns a ListingSDK for the newly-created listing. For existing listings, use marketplace.getListing({ appId }).
Reading and Updating Listings
Section titled “Reading and Updating Listings”ListingSDK is used for listing-specific reads and seller price updates.
const listing = marketplace.getListing({ appId: listingAppId })
const state = await listing.state()console.log(state.price, state.paymentAsset, state.seller)
const expired = await listing.isExpired()const reserved = await listing.isReserved()
await listing.changePrice({ price: 12_000_000n, // 12 ALGO})Purchasing
Section titled “Purchasing”Buyers send payment to the listing contract, which distributes funds to the seller, royalty recipients, the listing platform, the purchasing platform, and the DAO treasury.
Purchase listings through MarketplaceSDK. For ALGO listings, the SDK reads the listing price and creates the payment transaction automatically.
await marketplace.purchase({ listingAppId, marketplace: purchasingMarketplaceAddr,})For ASA-denominated listings, pass isAsa: true with the payment asset and amount from the listing state.
const listing = marketplace.getListing({ appId: listingAppId })const state = await listing.state()
await marketplace.purchase({ listingAppId, marketplace: purchasingMarketplaceAddr, isAsa: true, paymentAsset: state.paymentAsset, paymentAmount: state.price,})Gated listings can also include a gateTxn from the relevant gate SDK.
Cancelling Listings
Section titled “Cancelling Listings”Sellers can delist their NFTs at any time, returning the asset to their wallet.
await marketplace.delist({ appId: listingAppId,})Only the seller can delist. Purchases and cancellations are routed through MarketplaceSDK; use ListingSDK for state reads, expiration checks, reservation checks, and price changes.
Marketplace operations through a wallet use the MarketplacePlugin. See Wallet Plugins.