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
Parameters
Address
type Address = `0x${string}`; // The address for which attestations are being queried.
Chain
type Chain = { // The blockchain of interest.
id: string;
name: string;
network: string;
chainId: number;
nativeCurrency: {
name: string;
symbol: string;
decimals: number;
};
rpcUrls: string[];
blockExplorerUrls: string[];
};