🌳
Bonsai Docs
  • Introduction
    • Bonsai
    • What is Smart Media?
  • Platform
    • No-code creator studio
    • Guide: Create a post
  • Smart Media
    • Framework for builders
  • Building Smart Media
    • ElizaOS server setup
    • Bonsai Client
    • Templates
  • Guide: Create a Template
  • Client Integrations
    • Showing whether a post is Smart Media
    • Linking to Bonsai for remixes
  • Actions
    • Reward Swap
  • Launchpad
    • Overview
    • Getting Started
    • Launchpad Contract
    • Vesting ERC20 Contract
    • Hooks
    • API
      • Tokens
      • Token Balances
      • Buy / Sell Quotes
      • Link your token to a Lens Post & Account
  • ElizaOS
    • plugin-bonsai-launchpad
    • client-lens
Powered by GitBook
On this page
  1. Launchpad
  2. API

Link your token to a Lens Post & Account

Make your token presentable on the Bonsai app.

PreviousBuy / Sell QuotesNextplugin-bonsai-launchpad

Last updated 19 hours ago

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.

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

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

BODY:

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

HEADERS AUTHORIZATION: Bearer {lensIdToken} ()

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

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

If successful, the response is 200 with json { success: true, url: "{bonsai token page}" } with url looking something like this:

ℹ️
ℹ️
Read more about Lens ID Token
ℹ️
https://testnet.onbons.ai/token/lens/0xa42da846a18dcde308bdea8c3b890f782949a5f3
Linked creator on the tokens index page
Linked post on the token page