From 52420c3cad46995c5aafd4c8192b128e23075e2e Mon Sep 17 00:00:00 2001 From: david Date: Thu, 9 Apr 2026 14:34:00 +0200 Subject: [PATCH] fix: lookup registry NFT at script address, not wallet The registry NFT is locked at the registry script address with the 10 AP3X deposit, not in the agent's wallet. Use getUtxoByUnit to find it on-chain regardless of address. Co-Authored-By: Claude Sonnet 4.6 --- src/vector/governance.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/vector/governance.ts b/src/vector/governance.ts index 2f80918..a45d6ca 100644 --- a/src/vector/governance.ts +++ b/src/vector/governance.ts @@ -610,12 +610,14 @@ Each batch UTxO holds ~30 AP3X for adoption rewards.`, ]); // Find agent's registry NFT UTxO for DID validation (CIP-31 reference input) + // The NFT lives at the registry script address (locked with deposit), not the wallet const nftUnit = AGENT_REGISTRY_POLICY + agentDid; - const walletUtxos = await lucid.wallet().getUtxos(); - const nftUtxo = walletUtxos.find(u => u.assets[nftUnit] === 1n); - if (!nftUtxo) { + let nftUtxo; + try { + nftUtxo = await provider.getUtxoByUnit(nftUnit); + } catch { throw new Error( - `Agent registry NFT not found in wallet. Expected token: ${AGENT_REGISTRY_POLICY.slice(0, 12)}...${agentDid.slice(0, 12)}... ` + + `Agent registry NFT not found on-chain. Expected token: ${AGENT_REGISTRY_POLICY.slice(0, 12)}...${agentDid.slice(0, 12)}... ` + `The agent may need to re-register with vector_register_agent.` ); }