fix(nft): return amount as string on /v1/evm/nft/transfers#535
Merged
Conversation
The underlying erc1155_transfers.amount column is UInt256. The endpoint previously declared and serialized amount as a JSON number, silently losing precision for any value above Number.MAX_SAFE_INTEGER (2^53). On mainnet alone, hundreds of thousands of transfers fall in that range. Cast amount to a string in SQL and update the Zod response schema and example accordingly. ERC-721 amounts remain "1" — values < 2^53 round trip safely either way, so this is a non-breaking precision fix for the long tail. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
erc1155_transfers.amountcolumn isUInt256. The endpoint previously declared and serializedamountas a JSON number, silently losing precision for any value aboveNumber.MAX_SAFE_INTEGER(2^53).amountto a string in SQL and updates the Zod response schema and example accordingly."1"— values below 2^53 round-trip safely either way, so this is a precision fix for the long tail rather than a behavioural change for typical NFTs.Related to the audit in #524.
🤖 Generated with Claude Code