Indexer.getReceivedAttestationUIDCount
getReceivedAttestationUIDCount(address recipient, bytes32 schemaUid) external view returns (uint256) schemaUid로 recipient에게 발급된 attestation 개수를 반환합니다. 저렴한 존재 확인용입니다. getReceivedAttestationUIDs로 페이지네이션하기 전에 먼저 호출합니다. 카운트는 발급만 추적하며 폐기되거나 만료된 attestation도 카운트에 포함되므로, 이 값은 유효성 게이트가 아닌 검색 범위 산정용으로만 사용해야 합니다.
파라미터
| 이름 | 타입 | 필수 | 설명 |
|---|---|---|---|
recipient | address | ✓ | 수신자(subject) 주소입니다. 일반적으로 KYC/KYB 확인 대상이 되는 사용자입니다. |
schemaUid | bytes32 | ✓ | 필터링할 스키마의 32바이트 UID입니다(예: KYC 스키마). |
반환값
타입:
uint256 해당 스키마로 recipient에게 발급된 총 attestation 수입니다. 발급된 적이 없으면 0을 반환합니다.
예제
viem — 존재 확인
// 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
}