Implementing NFT Sales Listing in Mobile Applications
To list an NFT for sale, two operations must be executed: granting the marketplace permission to manage the token (approve or setApprovalForAll) and creating the listing. These are two separate transactions—meaning two gas expenditures and two user confirmations. The UX should guide users through this seamlessly.
setApprovalForAll vs approve
setApprovalForAll(marketplaceAddress, true) — a single permission for all tokens in the collection. The user approves once, then can list any NFT from that collection without requiring repeat approval.
approve(marketplaceAddress, tokenId) — permission for a specific token. More secure, but each listing requires a separate transaction.
Recommended UX: on the first listing from a collection, propose setApprovalForAll with an explanation: "Approve once for the entire collection to avoid paying gas on each sale." Users must understand the implications.
// iOS — checking approval before listing
func checkApproval(nftContract: EthereumAddress, owner: EthereumAddress) async -> Bool {
let erc721 = ERC721(web3: web3, provider: web3.provider, address: nftContract)
return (try? await erc721.getApproved(tokenId: tokenId) == marketplaceAddress)
?? (try? await erc721.isApprovedForAll(owner: owner, operator: marketplaceAddress))
?? false
}
Listing Form
Minimum required fields: price (in ETH or ERC-20 token), optional listing deadline. Display the calculated net amount the seller receives accounting for fees directly in the form: netAmount = price * (1 - platformFee - royalty).
// Android — calculating seller's net amount
data class ListingFeeBreakdown(
val grossPrice: BigDecimal,
val platformFeePercent: BigDecimal,
val royaltyPercent: BigDecimal
) {
val platformFeeAmount get() = grossPrice * platformFeePercent / BigDecimal(100)
val royaltyAmount get() = grossPrice * royaltyPercent / BigDecimal(100)
val sellerReceives get() = grossPrice - platformFeeAmount - royaltyAmount
}
Royalty is sourced from ERC2981.royaltyInfo(tokenId, price). Display a line "Creator Royalty: X%" — this is important for transparency.
Listing Creation Flow
- Check approval → if not granted, send
approve/setApprovalForAll - Wait for approval confirmation
- Send
listItem(nftAddress, tokenId, price, deadline) - After confirmation — NFT appears in the catalog
Each step includes a progress indicator. If the user closes the app after step 1, on next launch check the already-granted approval and offer to continue from step 3.
Changing Price and Delisting
updateListing(nftAddress, tokenId, newPrice) — a single transaction without requiring repeat approval.
cancelListing(nftAddress, tokenId) — removes the listing. After confirmation — NFT disappears from the catalog. Important: display the "Delist" button only when the listing is actually active (verified on-chain or via indexer).
Timeline: 3–5 days: listing form with fee breakdown, approve + list flow with checkpoints, updating and canceling listings.







