Skip to content

Conversation

@catalyst17
Copy link
Contributor

@catalyst17 catalyst17 commented Mar 14, 2025

TL;DR

Added a new API endpoint to retrieve token IDs by type for a specific contract address.

What changed?

  • Added a new API endpoint GET /{chainId}/tokens/{address} to retrieve token IDs by type (ERC721 or ERC1155) for a specific token address
  • Created a new TokenIdModel struct to represent token ID data in the response
  • Updated Swagger documentation to include the new endpoint and model
  • Fixed a parameter location in the documentation for the token holders endpoint (changed token_type from path to query parameter)
  • Added serialisation functions for token IDs

How to test?

  1. Start the API server
  2. Make a GET request to /{chainId}/tokens/{address} with the following parameters:
    • token_type: Optional filter for token type (erc721 or erc1155)
    • hide_zero_balances: Boolean to filter out zero balances
    • page and limit: For pagination
  3. Verify the response contains token IDs and their types for the specified token address

Why make this change?

This endpoint allows clients to retrieve all token IDs for a specific token contract address, which is useful for applications that need to display or work with all tokens from a particular collection. The endpoint complements the existing token holders endpoint by providing a different view of the token data.

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@catalyst17 catalyst17 requested a review from a team March 14, 2025 14:58
@catalyst17 catalyst17 marked this pull request as ready for review March 14, 2025 14:58
@catalyst17 catalyst17 merged commit 178b1db into main Mar 14, 2025
5 checks passed
@catalyst17 catalyst17 deleted the feat/tokens-route-for-ids branch March 14, 2025 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants