Skip to content

Conversation

@juanmahidalgo
Copy link
Contributor

Contract Address and ItemId Validation

Overview

Added validation for contract addresses and itemIds in the items handler to catch invalid inputs before they reach the subgraph, preventing unnecessary queries and providing clearer error messages to clients.

Changes

  • Added validateItemsParams function to validate contract addresses and itemIds
  • Created specific error classes (InvalidContractAddressError and InvalidItemIdError) for better error handling
  • Modified the items handler to catch these errors and return appropriate HTTP 400 responses
  • Added comprehensive test coverage for both the validation logic and error handling

Benefits

  • Prevents invalid Ethereum addresses from being sent to the subgraph
  • Catches non-BigInt itemIds early, providing clear error messages
  • Improves error handling and user experience
  • Reduces unnecessary load on the subgraph services

@juanmahidalgo juanmahidalgo merged commit 09993fb into master Apr 16, 2025
1 check passed
@juanmahidalgo juanmahidalgo deleted the feat/items-params-handler branch April 16, 2025 09:24
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.

3 participants