Skip to content

Overhaul ERC-8004 agent integration#584

Merged
realproject7 merged 2 commits intomainfrom
task/583-erc8004-overhaul
Mar 27, 2026
Merged

Overhaul ERC-8004 agent integration#584
realproject7 merged 2 commits intomainfrom
task/583-erc8004-overhaul

Conversation

@realproject7
Copy link
Copy Markdown
Owner

Summary

Fixes #583

  • CRITICAL fix: Wallet binding deadline reduced from 3600s (1 hour) to 300s (5 minutes) to match contract's max deadline enforcement
  • ABI additions: getAgentWallet, unsetAgentWallet, setAgentURI, setMetadata, getMetadata, ownerOf, balanceOf, tokenOfOwnerByIndex, plus URIUpdated and MetadataSet events
  • Existing agent detection: On /agents page load, checks both agentIdByWallet() (bound agent wallet) and balanceOf() + tokenOfOwnerByIndex() (NFT owner) to detect registered agents
  • Owner vs agent wallet distinction: Owner wallets that hold the AGENT NFT but have a separate bound wallet now correctly see their agent in Dashboard and Management UI
  • New AgentManage component: View agent info, update URI metadata, change/unset agent wallet — all with correct 5-minute EIP-712 deadlines
  • Registration guard: Existing agents see management UI instead of registration form; tab label changes from "Register" to "Manage"

Test plan

  • Verify wallet binding uses 300s deadline (was 3600s)
  • Connect an owner wallet that holds an AGENT NFT → should see "Manage" tab with agent info
  • Connect a bound agent wallet → should see management UI with "agentWallet" role
  • Connect an unregistered wallet → should see registration form
  • Test Update URI flow (owner only)
  • Test Change Agent Wallet flow (EIP-712 sign + submit)
  • Test Unset Agent Wallet button
  • Dashboard shows storylines for both owner and agent wallet connections
  • Build passes (tsc --noEmit clean)

🤖 Generated with Claude Code

Fix critical bug: wallet binding deadline from 3600s to 300s (contract
enforces max 5 minutes). Add missing ABI entries (getAgentWallet,
unsetAgentWallet, setAgentURI, setMetadata, ownerOf, balanceOf,
tokenOfOwnerByIndex). Detect existing agents on page load via
agentIdByWallet + balanceOf, distinguish owner vs agent wallet roles.
New AgentManage component for existing agents: view info, update URI,
change/unset agent wallet. Dashboard now handles both owner and agent
wallet connections.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
plotlink Ignored Ignored Mar 27, 2026 9:44am

Request Review

Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: REQUEST CHANGES

Summary

The critical deadline fix is in place, but two owner/external-agent flows are still incorrect. They both break scenarios that issue #583 explicitly calls out.

Findings

  • [high] Owner dashboards still lose storylines after unsetAgentWallet() or any transfer-reset to the zero address.
    • File: src/components/AgentDashboard.tsx:55
    • Suggestion: treat 0x0000000000000000000000000000000000000000 as "no bound wallet" and fall back to the owner wallet for storyline lookup so owner-connected dashboards keep working.
  • [medium] Existing agents registered from other ERC-8004 apps will not show their current metadata in the new management UI.
    • File: src/components/AgentManage.tsx:93
    • Suggestion: resolve the agentURI by scheme (data:, https://, ipfs://, etc.) and parse the fetched payload, instead of calling JSON.parse() directly on the URI string.

Decision

Request changes. The PR is close, but these two paths still violate the issue requirements for owner dashboards and cross-app existing-agent management.

Dashboard: fall back to owner address when getAgentWallet returns zero
address (after unset/transfer), instead of querying 0x000...000.

AgentManage: handle https://, ipfs://, and data: URIs from agents
registered via other apps, not just raw JSON stored in the URI field.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Summary

The follow-up fixes address the two blocking issues from my previous review. Owner dashboards now fall back correctly when the bound wallet is unset, and the management UI can resolve non-JSON ERC-8004 URIs from other apps.

Findings

  • No blocking issues found in the updated changes.

Decision

Approve. The PR now satisfies issue #583's critical deadline fix, existing-agent detection, owner-vs-agent wallet handling, and management UI requirements.

@realproject7 realproject7 merged commit c7ffc3a into main Mar 27, 2026
5 checks passed
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.

Overhaul ERC-8004 agent integration — detection, management, deadline fix

2 participants