Missing totalSupply & tokenByIndex in ERC721 (IERC721Enumerable?)

Hi all, I am not an expert in Solidity, trying to learn.

I have an ERC721 contract, and I need to add to it the totalSupply & tokenByIndex method that are part of the IERC721Enumerable.

I made several attempts, but the ABI that is created is without those functions. I found the documentation about how it should be done confusing. As far as I can understand from the docs, ERC721 should already come included with these functions https://docs.openzeppelin.com/contracts/3.x/api/token/erc721#ERC721-totalSupply--

I have seen some code examples that says that I need to use the extensions, like this:

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";

contract MyContract is Ownable, ERC721, ERC721Enumerable{

I tried several examples, but in all attempts, the resulting abi (using truffle compile, in the artifacts/contract/MyContract.sol/MyContract.json file) didn't have the functions.

I tried to create the contract directly as ERC721Enumerable, but getting error:

contract MyContract is Ownable, ERC721Enumerable{

error is Contract should be marked as abstract

What am I doing wroing?

You're looking at the documentation for OpenZeppelin Contracts 3.x, while using 4.x.

Please refer to Contracts Wizard to see how to include enumerability.