Developer-DAO/pixel-avatars

Enhancement: Indicate when token id is already minted

rasmuscnielsen opened this issue · 1 comments

Ie by adding "Already minted - {TOKEN ID}" to the dropdown of personal tokens.

@briangershon As for this one my thoughts are

  • Tweak the response of useAvatarContract@getAvailableTokens to somehow include mint status. Say an array of objects rather than current array of plain integers
  • As a result the getAvailableTokens would - after fetching the inventory from server - also need to fetch the claim status of the individual tokens before return the response. I imagine the code would be quite similar to what the web server does for the genesis tokens only it might be another method to call on the avatar contract
    // For each token the address owns we need to fetch the actual NFT
    const tokenPromises = [...Array(balance).keys()].map((idx) =>
    contract.tokenOfOwnerByIndex(address, idx)
    )
    return (await Promise.all(tokenPromises)).map((t) => t.toNumber())