I want to call the ownerOf() function on all of the NFT's in a contract. If the address matches the website user address I want to add the tokenID to an array so I can eventually display all nft's owned by the user.
The code below almost works, I think it breaks when ownerOf() returns an error. Also is calling ownerOf() 1000+ times going to timeout or something?
for (let i = 0; i < 1000; i++) {
if(await contract.methods.ownerOf(i).call({ from: window.userAddress }) ===window.userAddress{
list.push(i);
};
}
alert(Owned by this address ${list}
);