Skip to content

getAttestations

The getAttestations function fetches attestations for a specified address and blockchain in Ethereum Attestation Service (EAS). It allows optional filtering based on schema IDs, revocation status, expiration time, and the number of attestations to return.

In the example, we use the Coinbase Verified Account schema ID.

Usage

code
import { getAttestations } from '@coinbase/onchainkit/identity';
import { base } from 'viem/chains';
 
const COINBASE_VERIFIED_ACCOUNT_SCHEMA_ID =
  '0xf8b05c79f090979bf4a80270aba232dff11a10d9ca55c4f88de95317970f0de9';
 
const address = '0x1234567890abcdef1234567890abcdef12345678';
const attestationsOptions = {
  schemas: [COINBASE_VERIFIED_ACCOUNT_SCHEMA_ID],
};
 
const attestations = await getAttestations(address, base, attestationsOptions);

Returns

Promise<Attestation[]>

Parameters

Address

type Address = `0x${string}`;

Chain

type Chain = {
  id: string;
  name: string;
  network: string;
  chainId: number;
  nativeCurrency: {
    name: string;
    symbol: string;
    decimals: number;
  };
  rpcUrls: string[];
  blockExplorerUrls: string[];
};

GetAttestationsOptions

GetAttestationsOptions