Manage Apps
This guide explains how to manage Apps on Lens.
Update App Metadata
To update the metadata of an existing app, follow these steps.
You MUST be authenticated as Builder and be owner or admin of the App to update its metadata.
First, construct an App Metadata object with the new content.
- TS/JS
- JSON Schema
Use the @lens-protocol/metadata package to construct a valid AppMetadata object:
Example
import { MetadataAttributeType, app } from "@lens-protocol/metadata";
const metadata = app({ name: "XYZ", tagline: "The next big thing", description: "An app to rule them all", logo: "lens://4f91cab87ab5e4f5066f878b72…", developer: "John Doe <[email protected]>", url: "https://example.com", termsOfService: "https://example.com/terms", privacyPolicy: "https://example.com/privacy", platforms: ["web", "ios", "android"],});
Next, upload the App Metadata object to a public URI.
import { storageClient } from "./storage-client";
const { uri } = await storageClient.uploadAsJson(metadata);
console.log(uri); // e.g., lens://4f91ca…
This example uses Lens Storage to host the Metadata object. See the Lens Metadata Standards guide for more information on hosting Metadata objects.
- TypeScript
- GraphQL
Next, update the app metadata using setAppMetadata action.
Example
import { uri, evmAddress } from "@lens-protocol/client";import { setAppMetadata } from "@lens-protocol/client/actions";
// …
const result = await setAppMetadata(sessionClient, { metadataUri: uri("lens://4f91…"), // the URI with new metadata app: evmAddress('0x1234…')});
- TypeScript
- GraphQL
Finally, handle the result using the adapter for the library of your choice:
See the Transaction Lifecycle guide for more information on how to determine the status of the transaction.
Update App Feeds
To update the custom feeds of an existing app, follow these steps.
You MUST be authenticated as Builder and be owner or admin of the App to update its feeds.
- TypeScript
- GraphQL
First, update the custom feeds in an app using addAppFeeds or removeAppFeeds actions.
- TypeScript
- GraphQL
Then, handle the result using the adapter for the library of your choice:
See the Transaction Lifecycle guide for more information on how to determine the status of the transaction.
Set App Default Feed
To set the default feed for an app, follow these steps.
You MUST be authenticated as Builder and be owner or admin of the App to set its default feed.
- TypeScript
- GraphQL
First, use setDefaultAppFeed action to set the default feed of an app.
- TypeScript
- GraphQL
Then, handle the result using the adapter for the library of your choice:
See the Transaction Lifecycle guide for more information on how to determine the status of the transaction.
Update App Graph
To update the graph of an existing app, follow these steps.
You MUST be authenticated as Builder and be owner or admin of the App to update its graph.
- TypeScript
- GraphQL
First, use setAppGraph action to update or set the graph of an existing app.
- TypeScript
- GraphQL
Then, handle the result using the adapter for the library of your choice:
See the Transaction Lifecycle guide for more information on how to determine the status of the transaction.
App Treasury
To update the treasury of an existing app, follow these steps.
You MUST be authenticated as Builder and be owner or admin of the App to update its treasury.
- TypeScript
- GraphQL
First, use setAppTreasury action to update or set the treasury of an existing app.
Example
import { evmAddress } from "@lens-protocol/client";import { setAppTreasury } from "@lens-protocol/client/actions";
// …
const result = await setAppTreasury(sessionClient, { treasury: evmAddress('0x4567…') app: evmAddress('0x1234…')});
- TypeScript
- GraphQL
Then, handle the result using the adapter for the library of your choice:
See the Transaction Lifecycle guide for more information on how to determine the status of the transaction.
App Sponsorship
To update the sponsorship of an existing app, follow these steps.
You MUST be authenticated as Builder and be owner or admin of the App to update its sponsorship.
- TypeScript
- GraphQL
First, use setAppSponsorship action to update or set the sponsorship of an existing app.
Example
import { evmAddress } from "@lens-protocol/client";import { setAppSponsorship } from "@lens-protocol/client/actions";
// …
const result = await setAppSponsorship(sessionClient, { treasury: evmAddress('0x4567…'), app: evmAddress('0x1234…')});
- TypeScript
- GraphQL
Then, handle the result using the adapter for the library of your choice:
See the Transaction Lifecycle guide for more information on how to determine the status of the transaction.
Access Control
The App contract supports two roles: Owner and Administrator.
Administrators can:
Update the App Metadata
Update the App Rules
Update the App Feeds and Graph
Update the App Treasury
Update the App Sponsorship
The Owner can do everything the administrators can do, plus transfer ownership of the App to another address.
See the Team Management guide for more information on how to manage these roles.