feat: link tokenId in ERC-721 Transfer events to the token page#610
Merged
Conversation
In a transaction's decoded events, an ERC-721 `Transfer` now renders its
tokenId as a link to /nft/{contract}/{tokenId}, so you can navigate from a
transfer straight to the token.
ERC-721 is told apart from ERC-20 purely from the decoded ABI: the ERC-721
`Transfer` tokenId is indexed (3 indexed params) whereas the ERC-20 `value`
is not — no extra chain call needed. ParamRows gains an optional per-row
`href` so a value can render as a link; the emitter address + tokenId form
the network-aware target.
Adds a unit test covering ERC-721 vs ERC-20 vs non-Transfer discrimination.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Block explorer – Preview
Preview environment destroyed after PR was closed |
ERC-20 and ERC-721 Transfer share one signature hash, differing only in indexed layout. Without a verified ABI the fallback decoders (b32/selector) picked the ERC-20 shape, reading the tokenId from the empty data as `value` => "N/A", so the tokenId (and thus the token link) never appeared. A Transfer log with 4 topics is unambiguously ERC-721 (from/to/tokenId all indexed), so decode it deterministically with the ERC-721 fragment before the ambiguous fallbacks. This makes the tokenId render (and become a link). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
davidecarpini
approved these changes
Jul 14, 2026
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.
What & why
Follow-up to #609. In a transaction's decoded events, an ERC-721
Transfernow renders itstokenIdas a link to/nft/{contract}/{tokenId}, so you can navigate from a transfer straight to the token page. Closes the last gap in the NFT ⇄ contract ⇄ transaction navigation loop.How
TransfertokenIdis indexed (3 indexed params), whereas the ERC-20valueis not. No extra chain call.ParamRows(shared by input-data and event rendering) gains an optional per-rowhref; when present the value renders as a link. Only the tokenId row of a detected ERC-721Transfergets one.useNetworkAwareHref) and built from the event's emitter address + tokenId.Notes
bigint→ decimal string), matching the NFT page'stokenIdroute validation (/^\d+$/).Transfer. ERC-1155 (TransferSingle/TransferBatch) is out of scope — its ids aren't indexed and the token page is ERC-721.Validation
New unit test covers ERC-721 vs ERC-20 vs non-Transfer discrimination. Full suite (238 tests),
ts-check,lint,knip,prettierall pass.