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

getNftsForContract totally broken #208

Closed
S1nPur1ty opened this issue Dec 1, 2022 · 2 comments
Closed

getNftsForContract totally broken #208

S1nPur1ty opened this issue Dec 1, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@S1nPur1ty
Copy link

S1nPur1ty commented Dec 1, 2022

[REQUIRED] Environment

  • Browser version: Chrome (latest)
  • Alchemy SDK version: 2.2.3

[REQUIRED] Describe the problem

The endpoint for requesting Contract NFTs getNFTsForCollection is not working properly. No matter what I do, I get demo response in return. Changing the contractAddress value doesn't reveal the real data. The limit option property is changed to pageSize, but it is also limited to max 100 NFT Metadata. The pageKey option property isn't documented on the page (instead you get to see startToken which looks like deprecated): https://docs.alchemy.com/reference/getnftsforcollection.

How to reproduce:

https://eth-mainnet.g.alchemy.com/nft/v2/YOUR_API_KEY/getNFTsForCollection?contractAddress=0x60E4d786628Fea6478F785A6d7e704777c86a7c6

Response:
{"nfts":[{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000000"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000001"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000002"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000003"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000004"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000005"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000006"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000007"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000008"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000009"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000000a"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000000b"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000000c"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000000d"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000000e"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000000f"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000010"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000011"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000012"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000013"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000014"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000015"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000016"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000017"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000018"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000019"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000001a"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000001b"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000001c"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000001d"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000001e"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000001f"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000020"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000021"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000022"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000023"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000024"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000025"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000026"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000027"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000028"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000029"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000002a"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000002b"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000002c"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000002d"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000002e"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000002f"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000030"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000031"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000032"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000033"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000034"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000035"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000036"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000037"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000038"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000039"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000003a"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000003b"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000003c"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000003d"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000003e"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000003f"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000040"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000041"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000042"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000043"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000044"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000045"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000046"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000047"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000048"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000049"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000004a"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000004b"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000004c"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000004d"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000004e"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000004f"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000050"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000051"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000052"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000053"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000054"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000055"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000056"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000057"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000058"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000059"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000005a"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000005b"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000005c"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000005d"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000005e"}},{"id":{"tokenId":"0x000000000000000000000000000000000000000000000000000000000000005f"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000060"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000061"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000062"}},{"id":{"tokenId":"0x0000000000000000000000000000000000000000000000000000000000000063"}}],"nextToken":"0x0000000000000000000000000000000000000000000000000000000000000064"}

@S1nPur1ty S1nPur1ty added the bug Something isn't working label Dec 1, 2022
@thestriver
Copy link

Hi @S1nPur1ty,

Are you still facing this issue?
I think there has been a mixup due to the renaming of getNFTsForCollection to getNftsForContract on alchemy-sdk. That's been mentioned in the docs now.

If you try Alchemy's composer tool getNFTsForCollection function and the curl request getNFTsForCollection:https://docs.alchemy.com/reference/getnftsforcollection without specifying metadata as true, it will only return the token ids of the specified collection address.

curl --request GET \
     --url 'https://eth-mainnet.g.alchemy.com/nft/v2/docs-demo/getNFTsForCollection?contractAddress=0xe785E82358879F061BC3dcAC6f0444462D4b5330&withMetadata=true' \
     --header 'accept: application/json'

Whereas with the equivalent alchemy-sdk getNftsForContract, all the information, including metadata, is returned at the same time.

I hope this answers your issue.

@thebrianchen
Copy link
Member

@thestriver Thanks for answering the question. The SDK has renamed some of the API names, but the next version of the NFT API endpoints will bring the naming conventions back to the same standard. I'm going to close this issue since it's working as intended, but feel free to ask any other questions you may have!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants