LaunchLab TypeScript SDK
TypeScript SDK for interacting with LaunchLab bonding curves.
Getting started
This SDK offers tools and functions for interacting with LaunchLab bonding curves. It allows developers to effortlessly build platform config and bonding curves with custom settings and fee structures. SDK: https://github.com/raydium-io/raydium-sdk-V2/tree/master/src/raydium/launchpad Demo implementation: https://github.com/raydium-io/raydium-sdk-V2-demo/tree/master/src/launchpad CPI is also available: https://github.com/raydium-io/raydium-cpi/tree/master/programs/launch-cpi Mainnet program: LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj Devnet program: LanD8FpTBBvzZFXjTxsAoipkFsxPUCDB4qAqKxYDiNP
Installation
$ yarn add @raydium-io/raydium-sdk-v2
Initialization
import {
TxVersion,
DEV_LAUNCHPAD_PROGRAM,
printSimulate,
getPdaLaunchpadPoolId,
Curve,
PlatformConfig,
LAUNCHPAD_PROGRAM,
} from '@raydium-io/raydium-sdk-v2'
import { initSdk } from '../config'
import BN from 'bn.js'
import { PublicKey } from '@solana/web3.js'
import { NATIVE_MINT } from '@solana/spl-token'
import Decimal from 'decimal.js'
Walkthrough
App developers can create a platform config -eg. createPlatform.ts. -that allows them to define their fees on the bonding curves
feeRate
and set the distribution for revenue sharing post migration to a CP-Swap PoolmigrateCpLockNftScale
between the platformplatformScale
, the creatorcreatorScale
, and fees compounded in the poolburnScale
. Both the feeRate and platformScale parameters are expressed in bps * 100. NB: platformConfigs can only get updated once per epoch using the function updatePlatformConfig.Users can create tokens and a bonding curve using the function createLaunchpad - eg. createMint.ts -. Users can freely set token parameters and metadata, the supply, amount sold, and quote raised.
Users can buy and sell using the dedicated functions. The shareFeeRate, shareFeeReceiver third-party trade fees.
Once the threshold of
total_quote_fund_raising
is attained, its status changes to 1 (migrate), trading stops on the bonding curve, and the pool migrates to an AMM pool, or CP-swap pool, depending on its migrate type.
Key parameters
platformID
, pubkey from an existing platform.platformFeeRate
fees charged by the platform on the bonding curves in bps * 100, defined inplatformConfig.
cpConfigId
determines the fee tier for the pool post bonding curves if migrating to a 'cpmm' pool. Config Ids for mainnet are available here: https://api-v3.raydium.io/main/cpmm-config The config Id for devnet is '9zSzfkYy6awexsHvmggeH36pfVUdDGyCcwmjT3AQPBj6'migrateCpLockNftScale
the distribution of the revenue sharing between creators, platform, and compounded in the pool in bps * 100, defined inplatformConfig
/migrateType
==='amm'
or'cpmm'
determines if the bonding curves migrate to the AMMv4 or the Cpmm program. Only the Cpmm program allows for revenue sharing post-migration.supply
total amount of tokens minted, min = 10000000.totalSellA
total amount of tokens sold on the bonding curves, min = 20%.totalLockedAmount
total amount of token vesting, max = 30%. The amount of tokens provided on the pool at migration can be deduced from the two previous parameters; it needs to be ≥ 20% of the supply.decimals
number of decimals for the tokenA (base asset).cliffPeriod
is the number of seconds after migration before vesting starts.unlockPeriod
is the number of seconds for which locked tokens will be vesting. - NB:startTime
cannot be passed by users, the start time will be the migration block_stamp.totalFundRaisingB
is the total amount of quote tokens to raise on the bonding curve.amountB
(buyAmount)amount of tokenB spent alongside the curve initialization to buy tokenA.
Claiming Fees and vested tokens
Platform fees can be claimed by the platform owner using the ClaimPlatformFee function - demo. The function collects all pending fees from the bonding curves.
To enable vesting, the token creator needs to create the vesting accounts for any number of accounts using the function createVesting - demo.
Recipients of vested tokens can claim vested tokens at any time after the cliff using claimVesting - demo.
Last updated
Was this helpful?