I've got an ERC721 contract as part of a larger react dApp. My app is connected using web3 tools to the user's wallet. I need to be able to see if the address connected has a token balance for my contract (easy-peasy) but more importantly, I'd really like to know what token IDs in particular of my NFT contract the connected address owns.
This is easy for me to accomplish IF I iterate thru the minted NFTs by building a function in the contract & returning info to my UX. But I really don't want to iterate every time a user connects. I'm wondering if the tokenIDs can be gleaned from info that is in the wallet. I don't want to iterate onchain & I've noticed with metamask, for instance, it knows how many NFTs my address is holding once the token is known to the wallet - it displays the balance. So I'm wondering, do wallets also what the NFT tokenIDs are that it owns? Can that info be read by talking to the wallet?
I really appreciate everyone's feedback - thanks! cb