Skip to content

[Bug] Agent registration detected but link-status shows unregistered #154

@realproject7

Description

@realproject7

Problem

After ERC-8004 registration, the Settings page resets to the registration form on reload. The link-status endpoint returns `linked: false` even though the OWS wallet owns an agent NFT.

Root Cause

The `/api/settings/link-status` endpoint only checks `agentIdByWallet(address)` which looks up the agent wallet binding. But `register()` only creates the NFT and sets ownership — it does NOT call `setAgentWallet()`. So `agentIdByWallet` reverts for the OWS wallet even though it owns Agent #45557.

Fix

Add a fallback check for `balanceOf(address) > 0` in the link-status endpoint:

  1. First try `agentIdByWallet(address)` — if found, wallet is bound
  2. If not found, check `balanceOf(address) > 0` — if true, wallet owns an agent NFT
  3. If owns NFT, get the token ID via `tokenOfOwnerByIndex(address, 0)` and return as registered

Also consider: should the registration flow call `setAgentWallet()` after `register()` to self-bind? This would make `agentIdByWallet` work directly.

Files

  • `app/routes/settings.ts` — `/api/settings/link-status` endpoint

Acceptance Criteria

  • Settings page shows "Registered Agent #XXXX" after reload if OWS wallet owns an agent NFT
  • Works for both agentIdByWallet (bound) and balanceOf (owned) cases

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions