GraphemeNFT / rarible-scaffold

MIT License
0 stars 0 forks source link

filter items at contract level #77

Open dcsan opened 2 years ago

dcsan commented 2 years ago

we only want to fetch either letters / words on different APIs since we're getting extra info on each one, filtering at contract level would seem to make sense

can you add a param for type somehow (enum? string?)

currently we just use the balance and keep going through all an owners tokens.

so maybe tokenOfOwnerByIndex(address, tokenIndex); needs to take a type param?

  useEffect(() => {
    const updateYourCollectibles = async () => {
      const collectibleUpdate = [];
      for (let tokenIndex = 0; tokenIndex < balance; tokenIndex++) {
        const graphemeContract = readContracts.YourCollectible  // inside or it will run b4 we have contract
        console.group('updateYourCollectibles: ', tokenIndex)
        try {
          // console.log("toeknIndex:", tokenIndex);
          const ownerToken = await graphemeContract.tokenOfOwnerByIndex(address, tokenIndex);
          // console.log("ownerToken:", ownerToken);
dcsan commented 2 years ago

50

keepRunning commented 2 years ago

We can keep seperate mappings, but its all too memory intensive and hacky. Deperating the contracts is better for this case.