Skip to main content

Read Identity

tip

Install the GraphQL packages before starting this section.

In this section, we'll help you write a simple query to read a user's identity in the social graph.

  1. Initialize the GraphQL client:

Initialize the GraphQL Client

/src/queries/GetIdentity.tsx
const client = new GraphQLClient(CYBERCONNECT_ENDPOINT);
  1. Write a query to get the domain, followerCount, and followingCount of the user with address:
/src/queries/GetIdentity.tsx
export const GET_IDENTITY = gql`
query($address: String!) {
identity(address: $address) {
domain
followerCount
followingCount
}
}
`;

Make sure to check out the full list of fields available in the CyberConnect API.

Sandbox

You can write your own query in the Playground or experiment with our code in the sandbox below!