Indexer.getReceivedAttestationUIDs

getReceivedAttestationUIDs(
  address recipient,
  bytes32 schemaUid,
  uint256 start,
  uint256 length,
  bool reverseOrder
) external view returns (bytes32[] memory)

Paginated reverse-lookup: returns up to length attestation UIDs issued to recipient under schemaUid. Use reverseOrder = true to start from the most recent. Each returned UID feeds EAS.getAttestation(uid) to fetch the actual struct and check revocation/expiration.

Parameters

Name Type Required Description
recipient address ✓ The recipient (subject) address.
schemaUid bytes32 ✓ The schema UID to filter by.
start uint256 ✓ Zero-based offset into the indexer's list. Pass 0 for the first page.
length uint256 ✓ Maximum number of UIDs to return. The Indexer caps very large requests internally; in practice 50-100 per call is fine.
reverseOrder bool ✓ true to traverse from the most recent attestation to the oldest. Most UI use cases want this.

Returns

Type: bytes32[]

Array of attestation UIDs. Empty array if no attestations match.

Examples

viem — most recent 5 attestations

This finds any valid attestation among the five newest. PCL's EAS_POLICY is stricter: it reads only the newest indexed one, so a revoked or expired newest attestation fails the policy even when an older one is valid.

import { parseAbi } from "viem";

const easAbi = parseAbi([
  "struct Attestation { bytes32 uid; bytes32 schema; uint64 time; uint64 expirationTime; uint64 revocationTime; bytes32 refUID; address recipient; address attester; bool revocable; bytes data; }",
  "function getAttestation(bytes32 uid) view returns (Attestation)",
]);
const indexerAbi = parseAbi([
  "function getReceivedAttestationUIDCount(address recipient, bytes32 schemaUID) view returns (uint256)",
  "function getReceivedAttestationUIDs(address recipient, bytes32 schemaUID, uint256 start, uint256 length, bool reverseOrder) view returns (bytes32[])",
]);

const INDEXER = "0x1000000000000000000000000000000000000008";

const uids = await publicClient.readContract({
  address: INDEXER,
  abi: indexerAbi,
  functionName: "getReceivedAttestationUIDs",
  args: [recipient, schemaUid, 0n, 5n, true],
});

// Then look up each one to validate
const attestations = await Promise.all(
  uids.map((uid) =>
    publicClient.readContract({
      address: EAS,
      abi: easAbi,
      functionName: "getAttestation",
      args: [uid],
    })
  )
);
const valid = attestations.find(
  (a) => a.revocationTime === 0n && (a.expirationTime === 0n || a.expirationTime > now)
);
ESC
Type to search