Gettings Started

This guide will help you get started with the Lens API and SDKs.


React SDK

The Lens React SDK is a collection of React Hooks for both web and React Native applications. It's the simplest way to interact with the Lens API and build decentralized applications on Lens Network.

The Lens React SDK is currently in development and will be released soon.

TypeScript SDK

The Lens TypeScript SDK is a low-level API client for interacting with the Lens API. It provides a ligthweight abstraction over the bare GraphQL API and is suitable for server-to-server communication or very bespoke client-side integrations where the Lens React SDK is not suitable.

The Lens TypeScript SDK is currently in development and will be released soon.

GraphQL API

The Lens API utilizes GraphQL, a query language for APIs that allows clients to precisely request the data they need, leading to more efficient data retrieval. GraphQL queries are executed using a type system defined for your data. It is written in rust so it is blazing fast.

Environments

The API links below act as API endpoints as well as playgrounds for testing queries.

NetworkURL
Lens Network Sepolia TestnetComing this week
Lens Network MainnetComing soon

GraphQL Clients

Below are examples of how to interact with the Lens API using different GraphQL clients.

The URQL client is a lightweight and flexible GraphQL client that can be used in both web and mobile applications.

urql.ts
import { gql, Client, cacheExchange, fetchExchange } from "urql";
const ENDPOINT = "<coming-this-week>";
const client = new Client({  url: ENDPOINT,  exchanges: [cacheExchange, fetchExchange],});
const result = await client.query(gql`  query {    posts(request: { pageSize: TEN }) {      items {        id        author {          username        }        metadata {          ... on TextOnlyMetadata {            content          }        }      }      pageInfo {        prev        next      }    }  }`);
console.log(result);