Help & Support

Fetch Apps

This guide will show you how to fetch App data in different ways.

Lens App data has a rich structure that includes the following information:

  • Addresses of the primitives contracts

  • App Metadata content

  • Time of creation

  • Owner of the App

To illustrate how to fetch apps, we will use the following fragments:

fragment App on App {  address  graphAddress  sponsorshipAddress  defaultFeedAddress  namespaceAddress  treasuryAddress  verificationEnabled  createdAt  metadata {    ...AppMetadata  }  owner}

Get an App

Use the fetchApp action to fetch a single App by address or by transaction hash.

import { evmAddress } from "@lens-protocol/client";import { fetchApp } from "@lens-protocol/client/actions";
import { client } from "./client";
const result = await fetchApp(client, {  app: evmAddress("0x1234…"),});
if (result.isErr()) {  return console.error(result.error);}
const app = result.value;

List Apps

Use the paginated fetchApps action to fetch a list of Apps based on the provided filters.

import { fetchApps } from "@lens-protocol/client/actions";
import { client } from "./client";
const result = await fetchApps(client, {  filter:{    searchQuery: "Lens",  }});
if (result.isErr()) {  return console.error(result.error);}
// items: Array<App>const { items, pageInfo } = result.value;

See the Pagination guide for more information on how to handle paginated results.

List App Users

Use the paginated fetchAppUsers action to fetch a list of users using an App based on the provided filters.

import { evmAddress } from "@lens-protocol/client";import { fetchAppUsers } from "@lens-protocol/client/actions";
import { client } from "./client";
const result = await fetchAppUsers(client, {  app: evmAddress("0x1234…"),});
if (result.isErr()) {  return console.error(result.error);}
// items: Array<AppUser>: [{account: Account, lastActiveOn: Date, firstLoginOn: Date}, ...]const { items, pageInfo } = result.value;

See the Pagination guide for more information on how to handle paginated results.

List App Feeds

Use the paginated fetchAppFeeds action to fetch a list of feeds using an App.

import { evmAddress } from "@lens-protocol/client";import { fetchAppFeeds } from "@lens-protocol/client/actions";
import { client } from "./client";
const result = await fetchAppFeeds(client, {  app: evmAddress("0x1234…"),});
if (result.isErr()) {  return console.error(result.error);}
// items: Array<Feed>: [{feed: evmAddress, timestamp: Date}, ...]const { items, pageInfo } = result.value;

See the Pagination guide for more information on how to handle paginated results.

List App Groups

Use the paginated fetchAppGroups action to fetch a list of groups using an App.

import { evmAddress } from "@lens-protocol/client";import { fetchAppGroups } from "@lens-protocol/client/actions";
import { client } from "./client";
const result = await fetchAppGroups(client, {  app: evmAddress("0x1234…"),});
if (result.isErr()) {  return console.error(result.error);}
// items: Array<Group>const { items, pageInfo } = result.value;

See the Pagination guide for more information on how to handle paginated results.

List App Signers

Use the paginated fetchAppSigners action to fetch list of signers assigned to an App.

import { evmAddress } from "@lens-protocol/client";import { fetchAppSigners } from "@lens-protocol/client/actions";
import { client } from "./client";
const result = await fetchAppSigners(client, {  app: evmAddress("0x1234…"),});
if (result.isErr()) {  return console.error(result.error);}
// items: Array<AppSigner>: [{signer: evmAddress, timestamp: Date}, ...]const { items, pageInfo } = result.value;

See the Pagination guide for more information on how to handle paginated results.