Skip to content

feat: agent-aware view on the NFT detail page#608

Merged
davidecarpini merged 1 commit into
mainfrom
feat/agent-nft-view
Jul 1, 2026
Merged

feat: agent-aware view on the NFT detail page#608
davidecarpini merged 1 commit into
mainfrom
feat/agent-nft-view

Conversation

@Agilulfo1820

@Agilulfo1820 Agilulfo1820 commented Jul 1, 2026

Copy link
Copy Markdown
Member

What

Adds an agent-aware view to the existing NFT detail page (/nft/[contractAddress]/[tokenId]). When a token's metadata is a VeChain agent-marketplace ERC-8004 registration file, the page renders a tabbed agent profile — Overview · Services · Statistics · Quality · Feedback · Metadata — modelled on 8004scan.io. Any other NFT renders exactly as before.

Registrazione.schermo.2026-07-01.alle.17.03.13.mov

Why

The agent marketplace mints a soulbound NFT per agent (e.g. 0x271eb84c5095db823d76f87e10bb19016b117073 on testnet). Users following an agent link had no way to view it on the explorer. The generic NFT page already existed; this makes it agent-aware.

How

Detection keys off the tokenURI JSON's type marker https://eips.ethereum.org/EIPS/eip-8004#registration-v1. Everything is read on-chain / from the metadata the token points at — no dependency on the marketplace backend API:

  • Registration file (tokenURI) → Overview, Services, Metadata
  • A2A AgentCard — a separate document fetched from the registration file's A2A service endpoint (.../agent-card.json) → Services (skills, capabilities, I/O modes)
  • AgentRegistry.getAgent (the NFT contract is the registry; tokenId == agentId) → creator, status
  • ReputationRegistry (address taken from the registration file's reputationRegistry) getClientsgetSummary / readAllFeedback → Statistics, Quality, Feedback

Reputation-backed tabs render clean empty states when no feedback exists yet.

Key files

  • services/agent-nft/{schemas,hooks}.ts — Zod schemas, detection (isAgentRegistration), useAgentRegistration / useAgentCard, CAIP-10 helper
  • services/thor/tokens/{agent-registry,reputation-registry}.ts — on-chain reads
  • app/[locale]/nft/[contractAddress]/[tokenId]/components/agent/**AgentNftView + tabs
  • NftDetailPageContent.tsx — branches on detection
  • i18n/languages/*.json — new keys across all 11 locales

Testing

ts-check, lint, knip, prettier, 234 tests (incl. 11 new schema/detection/A2A/CAIP tests), and production build all pass locally.

⚠️ Prerequisite (marketplace-side, not this PR)

The deployed testnet contract's tokenURI (and the A2A/avatar endpoints) currently resolve to http://localhost:3001 / :3000, so agent metadata is not publicly fetchable yet. This code is correct and will render live once the marketplace serves those from a public origin. View with ?network=testnet.

🤖 Generated with Claude Code

Detect agent-marketplace NFTs (ERC-8004 registration files) on the existing
/nft/[contractAddress]/[tokenId] page and render a tabbed agent view:
Overview, Services, Statistics, Quality, Feedback, and Metadata. Non-agent
NFTs are unaffected.

Detection keys off the tokenURI JSON's `type` marker
(https://eips.ethereum.org/EIPS/eip-8004#registration-v1). All data is read
on-chain / from the metadata the token points at:

- Registration file (tokenURI) -> Overview, Services, Metadata
- A2A AgentCard, fetched from the registration file's `A2A` service endpoint
  (.../agent-card.json) -> Services (skills, capabilities, modes)
- AgentRegistry.getAgent (the NFT contract == the registry, tokenId == agentId)
  -> creator, status
- ReputationRegistry (address taken from the registration file) getClients /
  getSummary / readAllFeedback -> Statistics, Quality, Feedback

Reputation-backed tabs degrade to empty states when no feedback exists.
Adds i18n keys across all 11 locales and unit tests for the schema, detection,
A2A endpoint resolution, and CAIP-10 address parsing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

Block explorer – Preview

Name Status Preview Updated (UTC)
block-explorer-preview 🗑️ Destroyed (656c8fb) Preview deleted 2026-07-01 15:46:26

Preview environment destroyed after PR was closed

@Agilulfo1820
Agilulfo1820 requested review from daithihearn and davidecarpini and removed request for daithihearn July 1, 2026 15:04
@Agilulfo1820 Agilulfo1820 added the increment:minor PR adds functionality in a backwards compatible manner label Jul 1, 2026
@davidecarpini
davidecarpini merged commit 498ded9 into main Jul 1, 2026
15 of 16 checks passed
@davidecarpini
davidecarpini deleted the feat/agent-nft-view branch July 1, 2026 15:44
@davidecarpini
davidecarpini deployed to preview-pr-608 July 1, 2026 15:44 — with GitHub Actions Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

increment:minor PR adds functionality in a backwards compatible manner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants