Skip to content

Commit

Permalink
chore: bump add docs for getEASAttestations (#126)
Browse files Browse the repository at this point in the history
alvaroraminelli authored Feb 22, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 452eedd commit 311b027
Showing 5 changed files with 87 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/stale-waves-wink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@coinbase/onchainkit': minor
---

- **feat**: added initial version of `getEASAttestations`, which helps getting the user attestations from the Ethereum Attetation Service (EAS).
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -68,6 +68,8 @@ OnchainKit offers three themes packed with React components and TypeScript utili
- Components:
- [`<Avatar />`](https://onchainkit.xyz/identitykit/avatar)
- [`<Name />`](https://onchainkit.xyz/identitykit/name)
- Utilities:
- [`getEASAttestations`](https://onchainkit.xyz/identitykit/get-eas-attestations)

- [XMTP Kit](https://onchainkit.xyz/xmtpkit/introduction)
- Utilities:
68 changes: 68 additions & 0 deletions site/docs/pages/identitykit/get-eas-attestations.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# getEASAttestations

The `getEASAttestations` 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.

## Usage

```ts
import { getEASAttestations } from '@coinbase/onchainkit';
import { base } from 'viem/chains';

const attestations = await getEASAttestations({
'0x1234567890abcdef1234567890abcdef12345678',
base,
{
// Optional schemas to filter the attestations.
schemas: ['0x1801901fabd0e6189356b4fb52bb0ab855276d84f7ec140839fbd1f6801ca065'],
},
});

console.log(attestations);
```

## Returns

```ts
// Array of EAS Attestation objects
type GetEASAttestationsResponse = EASAttestation[];

type EASAttestation = {
attester: EASAttesterAddress; // the attester who created the attestation.
decodedDataJson: string; // The attestation data decoded to JSON.
expirationTime: number; // The Unix timestamp when the attestation expires (0 for no expiration).
id: string; // The unique identifier of the attestation.
recipient: Address; // The Ethereum address of the recipient of the attestation.
revocationTime: number; // The Unix timestamp when the attestation was revoked, if applicable.
revoked: boolean; // A boolean indicating whether the attestation is revocable or not.
schemaId: EASSchemaUid; // The schema identifier associated with the attestation.
time: number; // The Unix timestamp when the attestation was created.
};

type EASAttesterAddress = Address;

type EASSchemaUid = Address;

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

## Parameters

```ts
// Address - Ethereum address for which attestations are being queried
address: Address;

// Chain - The blockchain of interest
chain: Chain;

// Optional filtering options for the attestations query
type GetEASAttestationsOptions = {
schemas?: EASSchemaUid[]; // Schema IDs to filter attestations
revoked?: boolean; // Filter for revoked attestations (default: false)
expirationTime?: number; // Unix timestamp to filter based on expiration time (default: current time)
limit?: number; // Maximum number of attestations to return (default: 10)
};

type EASSchemaUid = Address;

type Address = `0x${string}`;
```
4 changes: 3 additions & 1 deletion site/docs/pages/identitykit/introduction.mdx
Original file line number Diff line number Diff line change
@@ -11,5 +11,7 @@ It provides a set of tools to resolve Ethereum addresses to ENS names, and more.
To assist you in engaging with onchain Identity, here is the Identity Kit which includes:

- Components:
- [`<Address />`](/identitykit/avatar): A component to display an Ethereum address.
- [`<Avatar />`](/identitykit/avatar): A component to display an ENS avatar.
- [`<Name />`](/identitykit/name): A component to display an ENS name.
- Utilities:
- [`getEASAttestations`](/identitykit/get-eas-attestations): A function to fetche EAS attestations.
9 changes: 9 additions & 0 deletions site/sidebar.ts
Original file line number Diff line number Diff line change
@@ -84,6 +84,15 @@ export const sidebar = [
},
],
},
{
text: 'Utilities',
items: [
{
text: 'getEASAttestations',
link: '/identitykit/get-eas-attestations',
},
],
},
{
text: 'Types',
link: '/identitykit/types',

0 comments on commit 311b027

Please sign in to comment.