Skip to content

fix(nft): return amount as string on /v1/evm/nft/transfers#535

Merged
0237h merged 1 commit into
mainfrom
fix/nft-transfers-amount-uint256
May 13, 2026
Merged

fix(nft): return amount as string on /v1/evm/nft/transfers#535
0237h merged 1 commit into
mainfrom
fix/nft-transfers-amount-uint256

Conversation

@0237h
Copy link
Copy Markdown
Collaborator

@0237h 0237h commented May 12, 2026

Summary

  • 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).
  • Casts amount to a string in SQL and updates the Zod response schema and example accordingly.
  • ERC-721 amounts remain "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

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>
@YaroShkvorets YaroShkvorets temporarily deployed to fix/nft-transfers-amount-uint256 - token-api PR #535 May 12, 2026 20:48 — with Render Destroyed
@0237h 0237h merged commit 10e665f into main May 13, 2026
2 of 3 checks passed
@0237h 0237h deleted the fix/nft-transfers-amount-uint256 branch May 13, 2026 18:30
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