Hi guys, how can i get an array of nft ids owned by an address in ERC721, i have:

mapping(address => uint256[]) _tokenList

function getList() public view onlyOwner returns(uint256[] memory)

Don’t know how to implement this function, Thanks in advance for your help

Jul 29, 2022, 3:19 PM
return _tokenList[user]
Jul 29, 2022, 3:21 PM
Tried but returns empty array, and i minted 5 nfts
Jul 29, 2022, 3:22 PM
the array isn't empty?
Jul 29, 2022, 3:22 PM
function getListNFT( address user ) public view onlyOwner returns ( uint256[] memory ) {
return _tokenList[user];
}
something like that?
Jul 29, 2022, 3:25 PM
yes
Jul 29, 2022, 3:30 PM
does not work, returns empty array.. :(
Jul 29, 2022, 3:36 PM
that's why I asked, is the array empty?
Jul 29, 2022, 3:37 PM
Yes it is
Jul 29, 2022, 3:41 PM
wtf
are you filling the array?
Jul 29, 2022, 3:42 PM
I'm not, but why it returning empty array tho
Jul 29, 2022, 3:43 PM
ahah
Jul 29, 2022, 3:44 PM
No, I didn't explain myself or maybe I didn't understand, I said that the function returns an empty array, despite having minted 5 nft. It is not very clear to me where I should fill the array, in the mint function?
Jul 29, 2022, 3:52 PM
can you show where you fill the array?
Jul 29, 2022, 4:10 PM
solved, thanks the same
Jul 29, 2022, 4:32 PM
so you need someone to do your job
Jul 29, 2022, 4:45 PM

© 2024 Draquery.com All rights reserved.