I have this function to stake an ERC721 token, but the user needs to provide the token ID manually. How can I automatically retrieve the first available token ID from the balance of a user that owns multiple tokens, then multiple IDs? Let's say the user might have more than one NFT, for example 1,4,5 so I need to pick the first one (1).
function stakeNFT(uint256 tokenId) public {
require(ownerOf(tokenId) == msg.sender, "You do not own this token ID");
transferFrom(msg.sender, address(this), tokenId);
////Do something
}