I'm trying to build an ERC721 contract using the default OpenZeppelin 4.x ERC721URIStorage implementation. In the documentation at this URL (https://docs.openzeppelin.com/contracts/4.x/erc721) you can find the following text:
The ERC721URIStorage contract is an implementation of ERC721 that includes all standard extensions (IERC721Metadata and IERC721Enumerable).
Now, if you check the IERC721Enumerable interface documentation here (https://docs.openzeppelin.com/contracts/4.x/api/token/erc721#IERC721Enumerable) you can see that there is a tokenOfOwnerByIndex function but unfortunately it is not available at the OpenZeppelin ERC712URIStorage implementation as it was supposed to according to documentation.
Am I missing something or is OpenZeppelin documentation wrong?
Here is the code:
// contracts/GameItem.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract GameItem is ERC721URIStorage {
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
constructor() ERC721("GameItem", "ITM") {}
function awardItem(address player, string memory tokenURI)
public
returns (uint256)
{
_tokenIds.increment();
uint256 newItemId = _tokenIds.current();
_mint(player, newItemId);
_setTokenURI(newItemId, tokenURI);
return newItemId;
}
}