OpenSea mint inconsistently ether tokenID on smart contract ERC-721

79 views Asked by At

How OpenSea check available tokenIDS for SmartContact? Can i mint tokenID inconsistently? Example ID:1 and next ID:600

I ask this question, because I do not understand how OpenSea finds out which tokens are and which are not. Not indefinitely they have an indexer going that from 0 to infinity.

I didn't see any methods in ERC721 to return list all mint tokens. How is work?

1

There are 1 answers

1
Andrew Novikoff On

You can create ERC721 token contract on https://wizard.openzeppelin.com/#erc721 and add an array called e.g. mintedIds[], then add to the mint function mintedIds.push(tokenId);

Also add view returns function that will this array.

After deploying this contract to the testnet you would be able to mint nft manualy and this array will store the IDs that were minted.

If you'll use counters while creating nft contract (optional on wizard) it will automaticaly increment the ID by 1 everytime you mint.