I’m working on an NFT contract using AssemblyScript for the NEAR platform. I’ve followed the NFT guidelines and implemented the required methods, but my NFT isn’t appearing in the NEAR wallet’s Collectibles tab. I minted a test token on testnet and the transaction was successful, yet the NFT is still missing. Could someone please point out what might be wrong?
Here’s a code snippet from my contract:
class NFTContract {
tokenOwners: PersistentMap<string, string[]> = new PersistentMap('token_owners');
tokenDetails: PersistentMap<string, NFTToken> = new PersistentMap('token_details');
tokenMetadata: PersistentMap<string, NFTMetadata> = new PersistentMap('token_metadata');
getOwnerTokens(owner: string): NFTToken[] {
const ids = this.tokenOwners.get(owner, []);
return ids.map(id => this.tokenDetails.getSome(id));
}
createToken(id: string, metadata: NFTMetadata, owner: string): void {
const token = new NFTToken(id, metadata, owner);
this.tokenOwners.set(owner, [id]);
this.tokenDetails.set(id, token);
this.tokenMetadata.set(id, metadata);
}
}
Any suggestions on what might be causing this issue? Thanks!
I’ve encountered a similar issue before. The problem likely lies in your metadata structure. NEAR wallet requires specific metadata fields to display NFTs correctly. Ensure you’re including ‘title’, ‘description’, and most importantly, ‘media’ in your NFTMetadata.
Additionally, check if you’ve implemented the nft_metadata method in your contract. This method should return the contract-level metadata, including the ‘spec’ field set to ‘nft-1.0.0’.
Lastly, verify that your createToken function is emitting the correct events. The NEAR wallet listens for these events to update its display. Without proper event emission, the wallet might not recognize newly minted tokens.
If these suggestions don’t resolve the issue, consider using NEAR’s NFT viewer tool to debug your contract’s metadata output. It can help pinpoint any discrepancies in your implementation.
hey there creativePainter45! i’ve been playing around with nfts on near too and ran into similar hiccups. have you double-checked your contract’s metadata? sometimes the wallet can be picky about that stuff.
what about the ‘nft_tokens_for_owner’ method? that’s super important for the wallet to fetch and display your nfts. did you implement it? it should return an array of tokens owned by a specific account.
also, just curious - what kind of nft art are you creating? sounds like an exciting project! 
oh, and don’t forget to give your contract some time to sync with the wallet. sometimes it takes a bit for everything to show up. keep us posted on how it goes!