One way to do it is to get all SPL token accounts
and then parse the accounts where the mint meets the NFT requirements
for Solana (total supply 1, no mint authority)
You can use Solana JSON RPC to retrieve all token accounts
alternatively, you can use @solana/web3
Connection
import {Connection, PublicKey} from '@solana/web3'
import { getMint } from "@solana/spl-token";
const connection = new Connection('https://api.devnet.solana.com')
const ownerAddress = new PublicKey('<YourAddress>')
// get token accounts
const token_accounts
= await connection.getParsedTokenAccountsByOwner(ownerAddress,{programId:<TOKEN_PROGRAM_ID>})
// parse token accounts one by one
// 1 - get mint using getMint(..)
// 2 - get Token total supply using connection.getTokenSupply(..)
// 3 - get mint authority using connection.getAccountInfo(..)
// 4 - check if the user balance is equal to 1 otherwise it's an empty token account. Use connection.getBalance(..)
// 5 - do mint checks that I specified.
This is a low-level implementation. You can refere to this code if you want an easier way.
@solana/web3
, but not the metaplex wrapper library because it's noted as experimental in the docs. (I know that everybody uses it anyways, but these are my employers requirements, not mine)