ERC721Enumerable - Add back `_tokensOfOwner()`
See original GitHub issuetokensOfOwner()
was first suggest on #1512 and implemented on #1522 and was removed in a bulk edit that makes me wonder if it was removed accidentally. https://github.com/OpenZeppelin/openzeppelin-contracts/commit/bd0778461da82364aebd2d763bb338795c5f9fa7
This function helps when coding web3 apps. Instead of calling the RPC multiple times to get all NFTs owned by the user, it can be done at once by calling tokensOfOwner()
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Expose tokensOfOwner method on ERC721Enumerable
Hello, I was wondering why the ERC721Enumerable smart contract only exposes a tokenOfOwnerByIndex which returns only one of the owned token ...
Read more >Best way to list all tokens of user in Solidity
The most obvious way is to iterate through all the tokens in the contract and check if the owner of the token is...
Read more >The ERC721 enumerable - Mastering Blockchain ... - O'Reilly
tokenOfOwnerByIndex() : The function returns the tokenId of an NFT that is stored at a particular index of the owner's list of tokens....
Read more >Writing an NFT Collectible Smart Contract - DEV Community
wait() // Get all token IDs of the owner let tokens = await contract.tokensOfOwner(owner.address) console.log("Owner has tokens: ", tokens); } ...
Read more >Ethereum Contract Diff Checker - Etherscan
totalSupply(), "ERC721Enumerable: global index out of bounds"); ... @param tokenId uint256 ID of the token to be added to the tokens list */...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
So, I just tested this, and it works!
I know it is an unbounded loop, but it doesn’t seem to be a problem for a RPC.
For me this can be closed then, unless someone else has anything else to add.