/** * Identity Client for ERC-8004 * Handles agent registration and identity management */ import { BlockchainAdapter } from './adapters/types'; import { MetadataEntry, AgentRegistrationFile } from './types'; export declare class IdentityClient { private adapter; private contractAddress; constructor(adapter: BlockchainAdapter, contractAddress: string); /** * Register a new agent with no URI (URI can be set later) * Spec: function register() returns (uint256 agentId) */ register(): Promise<{ agentId: bigint; txHash: string; }>; /** * Register a new agent with a token URI * Spec: function register(string tokenURI) returns (uint256 agentId) * @param tokenURI - URI pointing to agent registration file (MAY use ipfs://, https://, etc.) */ registerWithURI(tokenURI: string): Promise<{ agentId: bigint; txHash: string; }>; /** * Register a new agent with URI and optional on-chain metadata * Spec: function register(string tokenURI, MetadataEntry[] calldata metadata) returns (uint256 agentId) * @param tokenURI - URI pointing to agent registration file * @param metadata - OPTIONAL on-chain metadata entries */ registerWithMetadata(tokenURI: string, metadata?: MetadataEntry[]): Promise<{ agentId: bigint; txHash: string; }>; /** * Get the token URI for an agent * Spec: Standard ERC-721 tokenURI function * @param agentId - The agent's ID * @returns URI string (MAY be ipfs://, https://, etc.) */ getTokenURI(agentId: bigint): Promise; /** * Set the token URI for an agent * Note: This is an implementation-specific extension (not in base spec). * Assumes implementation exposes setAgentURI with owner/operator checks. * @param agentId - The agent's ID * @param uri - New URI string */ setAgentURI(agentId: bigint, uri: string): Promise<{ txHash: string; }>; /** * Get the owner of an agent * Spec: Standard ERC-721 ownerOf function * @param agentId - The agent's ID */ getOwner(agentId: bigint): Promise; /** * Get the agent wallet address * @param agentId - The agent's ID * @returns The agent wallet address (zero address if not set) */ getAgentWallet(agentId: bigint): Promise; /** * Set the agent wallet address (requires EIP-712 signature from new wallet) * @param agentId - The agent's ID * @param newWallet - The new wallet address * @param deadline - Unix timestamp deadline (must be within 5 minutes) * @param signature - EIP-712 signature from the new wallet */ setAgentWallet(agentId: bigint, newWallet: string, deadline: bigint, signature: string): Promise<{ txHash: string; }>; /** * Create EIP-712 signature for setAgentWallet * The new wallet must sign this to prove ownership * @param agentId - The agent's ID * @param newWallet - The new wallet address * @param ownerAddress - The current owner address * @param deadline - Unix timestamp deadline (must be within 5 minutes of current time) */ signAgentWalletChange(agentId: bigint, newWallet: string, ownerAddress: string, deadline: bigint): Promise; /** * Transfer an agent to a new owner * Note: This clears the agentWallet on transfer for security * @param from - Current owner address * @param to - New owner address * @param agentId - The agent's ID */ transferFrom(from: string, to: string, agentId: bigint): Promise<{ txHash: string; }>; /** * Get on-chain metadata for an agent * Spec: function getMetadata(uint256 agentId, string key) returns (bytes) * @param agentId - The agent's ID * @param key - Metadata key * @returns Metadata value as string (decoded from bytes) */ getMetadata(agentId: bigint, key: string): Promise; /** * Set on-chain metadata for an agent * Spec: function setMetadata(uint256 agentId, string key, bytes value) * @param agentId - The agent's ID * @param key - Metadata key * @param value - Metadata value (will be converted to bytes) */ setMetadata(agentId: bigint, key: string, value: string): Promise<{ txHash: string; }>; /** * Fetch and parse the agent registration file from the token URI * This is a convenience function that fetches the URI and parses it * Note: Does not validate - spec says ERC-8004 cannot cryptographically guarantee * that advertised capabilities are functional * @param agentId - The agent's ID */ getRegistrationFile(agentId: bigint): Promise; /** * Helper: Extract agentId from transaction receipt * Looks for the Registered event which contains the agentId */ private extractAgentIdFromReceipt; /** * Helper: Convert string to bytes (adapter-agnostic) */ private stringToBytes; /** * Helper: Convert bytes to string (adapter-agnostic) */ private bytesToString; } //# sourceMappingURL=IdentityClient.d.ts.map