Skip to content

fix: normalize tokenStandard to uppercase in getAssetItemType#1964

Closed
qsysvcore wants to merge 1 commit intoProjectOpenSea:mainfrom
qsysvcore:fix/token-standard-case-sensitivity
Closed

fix: normalize tokenStandard to uppercase in getAssetItemType#1964
qsysvcore wants to merge 1 commit intoProjectOpenSea:mainfrom
qsysvcore:fix/token-standard-case-sensitivity

Conversation

@qsysvcore
Copy link
Copy Markdown

Problem

The getAssetItemType function in src/utils/protocol.ts uses a switch statement with uppercase token standard strings ("ERC20", "ERC721", "ERC1155"), but doesn't normalize the input. When the API returns token standards in lowercase or mixed case (e.g., "erc721", "Erc721"), the function incorrectly throws "Unknown schema name" error.

Fix

Added tokenStandard.toUpperCase() normalization at the beginning of the function to ensure case-insensitive matching.

Why this is safe

  • The change is minimal (1 line added)
  • It makes the function more robust against API responses with different casing
  • Aligns with existing patterns in the codebase (e.g., src/sdk/orders.ts uses toUpperCase() when calling this function)
  • No breaking changes - all existing valid inputs continue to work
  • The TokenStandard type already defines the values in uppercase, so this ensures runtime values match the type definitions

@ryanio
Copy link
Copy Markdown
Collaborator

ryanio commented Apr 7, 2026

Thanks for this contribution! We've recreated this fix in our internal monorepo and it will be included in the next release sync. Closing this PR as the change will ship from the internal repo — appreciate you flagging it!

@ryanio ryanio closed this Apr 7, 2026
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.

2 participants