Search code examples
solanasolana-web3js

How to see what NFTs a website visitor has in their Phantom Wallet


I've created some NFTs on the Solana Blockchain and now have them in my Phantom Wallet.

How would I create a website that checks the users' wallet to see which NFTs they have in it, eg to make them available in a web based game I might create?

I can't see any info on this in the Phantom docs but it must be possible since sites like Solsea do this.

Any pointers appreciated!


Solution

  • If you haven't got the user to connect their wallet at this point, I would recommend the anchor wallet library.

    Some relevent resources can be found here for actually retrieving solana nft metadata:

    Get the list of assets associated to a Solana wallet address

    Code sample for parsing metadata for Solana NFT and updating the metadata

    @solana/web3.js Is there an API for ERC721 Metadata?