I'm trying to get all the NFTs in a collection that a wallet owns, but I only achieved get all the NFTs of a collection, or all the NFTs of a wallet (multi collections).
import { useConnection, useWallet } from "@solana/wallet-adapter-react"
import { Metaplex, walletAdapterIdentity } from "@metaplex-foundation/js"
...
const walletAdapter = useWallet()
const { connection } = useConnection()
const metaplex = Metaplex.make(connection).use(walletAdapterIdentity(walletAdapter))
// Get all NFTs of my collection
const candyMachine = await metaplex
.candyMachinesV2()
.findByAddress({ address: new PublicKey(candyMachineAddress) })
// Get all NFTs of wallet (My collection and others)
const walletNFTs = await metaplex
.nfts()
.findAllByOwner({ owner: wallet.publicKey })
Is this filter possible? I was exploring Metaplex SDK, but I didn't find this type of filter.
Thanks!