I am developing a smart contract which requires users to upload a specific information about their NFTs. I somehow need to verify whether they are the actual owner of that NFT before uploading information about it. Can you advice me how to do that? I saw that I can use APIs of Opensea, Alchemy, etc. But I was wondering is it possible to do it directly inside my smart contract?
I need something like this:
function approve(uint memory _id, address memory _contractAddress) external {
address owner = return Owner(_id, _contractAddress);
require (msg.sender = owner, "not the same owner");
}
A function which takes the NFT contract address and NFT id and returns the owner address. Then I need to compare whether the owner address is equal to the msg.sender. If they are equal then the user who is calling that function is the owner the the queried NFT.
Is that possible at all or I have to use some API?
Similar functionality I have seen in the Metamask wallet where when importing NFTs we need to provide the contract address and token ID and also in lazy.com NFT tracker website.