PatrickAlphaC / nextjs-nft-marketplace-thegraph-fcc

39 stars 33 forks source link

Update the buyer address #10

Open alymurtazamemon opened 1 year ago

alymurtazamemon commented 1 year ago

In the graphql repo code we are saving this address for the buyer:

activeItem.buyer = Address.fromString("0x0000000000000000000000000000000000000000")

Due to that, this GraphQL query returns nothing:

  {
      activeItems(first: 5, where: { buyer: "0x00000000" }) {
          id
          buyer
          seller
          nftAddress
          tokenId
          price
      }
  }

I have updated this to both these files graphExample.js & subgraphQueries.js

const GET_ACTIVE_ITEMS = gql`
    {
        activeItems(first: 5, where: { buyer: "0x0000000000000000000000000000000000000000" }) {
            id
            buyer
            seller
            nftAddress
            tokenId
            price
        }
    }
`
alymurtazamemon commented 1 year ago

@PatrickAlphaC

PatrickAlphaC commented 1 year ago

Are you sure this new version returns results?

alymurtazamemon commented 1 year ago

@PatrickAlphaC Yes! At the start, I tried to query with 8 zeros buyer address but it did not returned anything, then when I removed the where clause from the query I found that buyer address that we were passing to where clasue was wrong and after updating to this full zeros address it was working fine that is why I sent the pull request to update it.

alymurtazamemon commented 1 year ago

@PatrickAlphaC people are facing issues due to this, here you can see link

PatrickAlphaC commented 1 year ago

Ok... it feels weird. I remember testing it as is and it was working. Did the graph maybe update?

alymurtazamemon commented 1 year ago

@PatrickAlphaC No Graph not updated, the thing is in the video you were not creating the buyer address as mentioned in my first post above. But now we are sending the buyer's address to the graph as this 0x0000000000000000000000000000000000000000, so for that reason for the query we need to use the same address otherwise, it will not return the results.

When I was stuck on that problem, I first check on the graph dashboard without passing any filter and then realize that the buyer address that we are using for a filter is different than what we are passing.

psyljz commented 1 year ago

@PatrickAlphaC I solved the same issue in the same way. Here is my query code.

        activeItems(first: 5, where: { buyer: "0x000000000000000000000000000000000000dead" }) {
            id
            buyer
            seller
            nftAddress
            tokenId
            prcie
        }
Edu-BS commented 1 year ago

I have the same issue, the full null address solve it.

Nlferu commented 1 year ago

@alymurtazamemon

Thank you so much for this!