Indexer.getReceivedAttestationUIDCount

getReceivedAttestationUIDCount(
  address recipient,
  bytes32 schemaUid
) external view returns (uint256)

Returns the number of attestations issued to recipient under schemaUid. A cheap existence check — call this before paginating with getReceivedAttestationUIDs. The count tracks issuance only; revoked or expired attestations still increment it, so use the count as a search bound rather than a validity gate.

Parameters

Name Type Required Description
recipient address ✓ The recipient (subject) address — typically the user being checked for KYC/KYB.
schemaUid bytes32 ✓ The 32-byte UID of the schema you're filtering by (e.g., the KYC schema).

Returns

Type: uint256

Total attestations ever issued to recipient under that schema. Returns 0 if none.

Examples

viem — existence check

import { parseAbi } from "viem";

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[])",
]);

// Indexer canonical preinstall address: 0x1000000000000000000000000000000000000008
const INDEXER = "0x1000000000000000000000000000000000000008";

const count = await publicClient.readContract({
  address: INDEXER,
  abi: indexerAbi,
  functionName: "getReceivedAttestationUIDCount",
  args: [recipient, schemaUid],
});

if (count === 0n) {
  // user has never been attested under this schema — trigger KYC onboarding
}
ESC
Type to search