Link your token to a Lens Post & Account

Make your token presentable on the Bonsai app.

Once you've programmatically created your token on the BonsaiLaunchpad contract , you can link it to a Lens Post & Account via our API so it's presentable on the Bonsai app.

Linked creator on the tokens index page
Linked post on the token page

Linking your token

Mainnet API: https://app.onbons.ai/api/clubs/set-lens-data

Testnet API: https://testnet.onbons.ai/api/clubs/set-lens-data

METHOD: POST

HEADERS AUTHORIZATION: Bearer {lensIdToken} (Read more about Lens ID Token)

ℹ️ To get the Lens ID Token of an authenticated lens account, you can do so via the SessionClient

const creds = await (sessionClient as SessionClient).getCredentials();
const lensIdToken = creds.isOk() ? creds.value?.idToken : null;

BODY:

ℹ️ All of these are required. The typical flow is a) create the token b) create the lens post c) call this /set-lens-data endpoint to link them

Param
Type
Description

txHash

0x${string}

the transaction hash where you created your token

postId

string

the post id or slug to link your token with

RESPONSE: 200 | 403 | 401 | 400 | 500

ℹ️ If successful, the response is 200 with json { success: true, url: "{bonsai token page}" } with url looking something like this: https://testnet.onbons.ai/token/lens/0xa42da846a18dcde308bdea8c3b890f782949a5f3

Last updated