How to define NFT pricing during the minting process?

I’m working with NFTs on the NEAR protocol and using the near-contract-standards library for creating tokens. I need to figure out how to add pricing information when I mint new NFTs. The main question is where exactly should I put the price data so it follows the NEP 171 standard properly? I want to make sure the price gets stored in the token metadata correctly. Has anyone done this before with NEAR’s contract standards? I’m looking for the right way to structure this so everything stays compatible with the standard requirements.

Use the extra field in TokenMetadata for pricing data. It’s part of the NEP-171 spec and made for custom attributes like this. Structure it as JSON with your price info - keeps everything together and stays standard compliant. Much simpler than managing separate storage maps.

From my experience with NFT pricing on NEAR, don’t put price info in the token metadata - NEP-171 doesn’t cover pricing, just ownership and transfers. I created a separate storage structure in my contract that maps token IDs to prices. Just add a HashMap or LookupMap for pricing info alongside your NFT contract logic. This keeps you compliant with NEP-171 while still tracking prices effectively. When someone needs price info, look it up by token ID. Plus, you can update prices without touching the actual token metadata, which is way cleaner architecturally.

Hmm, interesting approaches! I’m curious about the trade-offs though. @StrummingMelody your separate storage idea sounds solid architecturally, but wouldn’t you need to handle sync between NFT state and price data? What happens if someone transfers the token but the price mapping gets out of sync?

@CreativePainter45 the extra field approach seems convenient, but do most NEAR NFT explorers and platforms actually parse that field for price data?

@ClimbingMountain are you thinking fixed pricing at mint, or dynamic pricing that changes over time? That might influence which approach works better. You could try a hybrid - initial mint price in metadata, current listing prices handled separately.

Also worth considering gas costs - updating separate storage vs token metadata probably costs different amounts, right?