IAgent.getAgentIds

getAgentIds(address wallet, PageRequest pageRequest) external view returns (uint256[] agentIds, PageResponse pageResponse)

Paginated reverse lookup: returns the agent IDs registered to wallet. Maroo's Agent precompile exposes this method because walking IdentityRegistry storage from inside a contract is too expensive — the precompile reads from an x/agent chain-side index that's kept in sync. For everything else (register, attest, metadata), call IdentityRegistry directly.

Parameters

Name Type Required Description
wallet address The owner wallet whose agent IDs you want to enumerate.
pageRequest PageRequest Standard PageRequest struct (key, offset, limit, count_total, reverse). Pass an empty struct for the first page with default limit. Imported from cosmos-evm-contracts/precompiles/common/Types.sol.

Returns

Type: (uint256[] agentIds, PageResponse pageResponse)

agentIds — array of ERC-8004 IdentityRegistry token IDs owned by the wallet. pageResponsenext_key for the next page, plus optional total if count_total was set on the request.

Errors

Code Name Description
InvalidArgsLength InvalidArgsLength Reverts when the call arguments don't match the expected count for this method (internal — should not occur from typed clients).
InvalidAddress InvalidAddress Reverts when wallet is the zero address or otherwise malformed.
InvalidPageRequest InvalidPageRequest Reverts when pageRequest fields are inconsistent (e.g., both key and offset set).

Examples

List agent IDs for a wallet

const AGENT = "0x100000000000000000000000000000000000000A";

const pageRequest = {
  key:         "0x",
  offset:      0n,
  limit:       100n,
  countTotal:  false,
  reverse:     false,
};

const [agentIds, pageResponse] = await publicClient.readContract({
  address: AGENT,
  abi: iAgentAbi,
  functionName: "getAgentIds",
  args: [wallet, pageRequest],
});
// agentIds is uint256[] of ERC-8004 token IDs
ESC
Type to search