Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

find many NFTs by their symbol #111

Open
alanpilloud opened this issue Dec 12, 2021 · 2 comments
Open

find many NFTs by their symbol #111

alanpilloud opened this issue Dec 12, 2021 · 2 comments
Labels

Comments

@alanpilloud
Copy link

Is your feature request related to a problem? Please describe.
I need to retrieve the NFT's in a collection. I think that I can do this using the symbol.

Here is what I unsuccesfuly tried:

  const symbol = "POP"
  const symbolBytes = bs58.encode(Buffer.from(symbol))
  const nfts = await programs.metadata.MetadataProgram.getProgramAccounts(
    connection,
    {
      filters: [
        {
          memcmp: {
            offset:
              1 + // key
              32 + // update auth
              32 + // mint
              4 + // name string length
              32 + // name
              4 + // uri string length
              200 + // uri
              4, // symbol string length
            bytes: symbolBytes,
          },
        },
      ],
    }
  )

It returns an empty list.

Describe the solution you'd like
Maybe we could enhance the findMany method to use the search by symbol.
I could contribute with a PR if I understand what my above issue is.

Describe alternatives you've considered
I did not found any other idea about how I can accomplish this task at the moment. Maybe there is a better idea ?

Additional context
I am building a NFT marketplace, that's why I need to retrieve a list of NFTs by collection.

@aheckmann aheckmann moved this to Triage in Metaplex Dec 15, 2021
@alanpilloud
Copy link
Author

At the moment, I managed to target the main creator using findMany from the Metadata program. It works but I fear that it might be imprecise on some collections.

@pguardiario
Copy link

Can you show how you did that? I'm getting fetch errors when I try it that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Triage
Development

No branches or pull requests

2 participants