SDK Reference
The LaunchpadSDK class is the primary interface for interacting with the LaunchRobin protocol from TypeScript/JavaScript applications. It supports both Node.js and browser environments.
Setup
import { LaunchpadSDK } from "robin-launch";
import { ethers } from "ethers";
const provider = new ethers.JsonRpcProvider("https://rpc.testnet.chain.robinhood.com");
const signer = await provider.getSigner(); // browser wallet
const sdk = new LaunchpadSDK({
provider,
signer, // optional, required for writes
configKey: "bullion-launchpad", // or 0x... platformId
platformConfigAddress: "0x...",
factoryAddress: "0x...",
registryAddress: "0x...",
liquidityManagerAddress: "0x...",
uniswapV4AdapterAddress: "0x...",
uniswapV4RouterAddress: "0x...",
});Read Methods
getPlatformBranding()
Returns the platform's branding profile (name, logo, social links, description).
const b = await sdk.getPlatformBranding();
// { name, logoUri, website, twitter, telegram, discord, docUrl, supportUrl, description }getPlatformFees()
Returns the platform's fee configuration.
const f = await sdk.getPlatformFees();
// { creationFee: "0.001", tradingFeeBps: 125, lpFee: 5000, creatorShareBps: 500 }getPlatformStats()
Returns on-chain statistics for the active platform.
const s = await sdk.getPlatformStats();
// { totalTokens, graduatedTokens, tradingVolume, totalFees, ... }getProtocolStats()
Returns protocol-wide aggregated stats across all platforms.
getFilteredLaunches(options?)
Returns token launches with sorting and filtering. Uses the indexer if available, falls back to on-chain queries.
const tokens = await sdk.getFilteredLaunches({
sortBy: "volume", // "bump" | "graduation" | "marketCap" | "creationTime" | "volume"
sortOrder: "desc",
graduated: false,
search: "pepe",
platformId: "0x...",
});
// Each token: { token, name, symbol, creator, reserveTarget,
// realEthReserves, tokensSold, marketCap, totalVolume,
// currentPrice, graduated, poolId, creationTimestamp, ... }getToken(tokenAddress)
Returns detailed info for a single token. Tries indexer first, falls back on-chain.
const t = await sdk.getToken("0x...");
// { token, creator, bondingCurve, poolId, reserveTarget,
// realEthReserves, tokensSold, marketCap, creationTimestamp,
// graduated, platformId, configVersion }getFullTokenDetails(tokenAddress)
Like getToken but also returns metadata (name, symbol, description, imageUri, social links) and computed fields (totalVolume, currentPrice, fees).
getTokenPrice(tokenAddress)
Returns the current per-token price in ETH. Tries indexer first.
getTokenVolume(tokenAddress)
Returns cumulative trading volume in ETH.
getTokenVolumeWindows(tokenAddress)
Returns volume breakdown by time window.
const w = await sdk.getTokenVolumeWindows("0x...");
// { vol30m: "1.5", vol6h: "12.3", vol12h: "28.7", vol24h: "45.1" }getTokenCandlesticks(tokenAddress, intervalSeconds)
Returns OHLCV candlestick data grouped by time interval. Scans historical trade events.
const candles = await sdk.getTokenCandlesticks("0x...", 300); // 5-minute
// [{ time, open, high, low, close, volume }, ...]getTradeHistory(tokenAddress, startBlock?)
Returns all buy/sell events for a token, sorted by timestamp. Tries indexer first.
getGraduationProgress(tokenAddress)
Returns 0-100 percentage progress toward graduation.
getCreatorTokens(creatorAddress)
Returns array of token addresses created by a wallet.
getAllPlatforms()
Returns all registered platforms with branding, fees, and stats. Note: owner is always empty (managed via AccessControl). Use getPlatforms() for owner info.
getAccruedFees()
Returns accrued fee balances for the connected wallet.
const fees = await sdk.getAccruedFees();
// { protocolFees: "12.5", platformFees: "3.2", creatorFees: "0.15" }
// creatorFees requires a signer; returns "0.0" otherwisequoteBuy(tokenAddress, ethIn)
Returns estimated tokens received and fee for a buy. Falls back to local computation from indexer data.
const q = await sdk.quoteBuy("0x...", "0.1");
// { tokensOutOrEthOut: "500000.0", fee: "0.000125" }quoteSell(tokenAddress, tokensIn)
Returns estimated ETH received and fee for a sell.
Write Methods (require signer)
createToken(metadata)
Deploys a new meme token with bonding curve. Supports initial buy and custom graduation target.
const result = await sdk.createToken({
name: "Pepe Coin",
symbol: "PEPE",
description: "The OG meme coin",
imageUri: "https://example.com/pepe.png",
website: "https://pepe.com",
twitter: "https://x.com/pepe",
telegram: "https://t.me/pepe",
discord: "https://discord.gg/pepe",
initialBuyEth: "0.5", // optional — buy tokens in same tx
minTokensOut: "1000000", // optional — slippage protection
reserveTargetEth: "10", // optional — 0 = platform default
});
// { tokenAddress, launchAddress, transactionHash }buy(tokenAddress, ethAmount, minTokensOut?, deadlineSeconds?)
Buy tokens from the bonding curve with ETH.
const txHash = await sdk.buy("0x...", "0.1", "500000");sell(tokenAddress, tokenAmount, minEthOut?, deadlineSeconds?)
Sell tokens back to the bonding curve. Automatically approves token spending if needed.
const txHash = await sdk.sell("0x...", "10000", "0.01");claimCreatorFees()
Claims accumulated creator rewards across all launched tokens. Returns transaction hash.
claimPlatformFees(platformId?)
Claims platform fees. Only callable by platform treasury or owner. Defaults to SDK's configured platform.
claimProtocolFees()
Claims protocol fees. Only callable by protocol treasury address. Anyone can trigger — funds always go to protocolTreasury.
harvestDEXFees(tokenAddress)
Harvests accrued DEX fees from a graduated token's Uniswap v4 pool.
Event Watching
watchTrades(tokenAddress, callback)
Listens for Buy and Sell events on a specific token. Returns a cleanup function.
const cleanup = sdk.watchTrades("0x...", (event) => {
console.log(event.type, event.args);
// event.type: "Buy" | "Sell"
// Buy args: { token, buyer, ethIn, tokensOut, fee, currentPrice, timestamp }
// Sell args: { token, seller, tokensIn, ethOut, fee, currentPrice, timestamp }
});
// Later: cleanup();watchNewTokens(callback)
Listens for TokenCreated events from the Factory. Returns a cleanup function.
Indexer Methods
These methods require the indexer to be running. They throw if the indexer is not configured for the connected chain.
getTrending(timeWindow?, limit?)
const trending = await sdk.getTrending("24h", 20);
// PaginatedResponse<IndexerToken>getRecent(graduated?, limit?)
searchTokens(query, limit?)
getLeaderboard(sortBy?, timeWindow?, limit?)
const lb = await sdk.getLeaderboard("volume", "24h", 50);getGlobalStats()
getPlatforms()
getPlatform(id)
Types
SDKConfig
interface SDKConfig {
provider: ethers.Provider;
signer?: ethers.Signer;
configKey?: string; // platform name or 0x... platformId
platformConfigAddress?: string;
factoryAddress?: string;
registryAddress?: string;
liquidityManagerAddress?: string;
uniswapV4AdapterAddress?: string;
}LaunchMetadata
interface LaunchMetadata {
name: string;
symbol: string;
description: string;
imageUri: string;
website: string;
twitter: string;
telegram: string;
discord: string;
initialBuyEth?: string; // ETH amount for atomic initial buy
minTokensOut?: string; // min tokens from initial buy
reserveTargetEth?: string; // 0 = platform default
}LaunchInfo
interface LaunchInfo {
token: string;
creator: string;
bondingCurve: string;
poolId: string;
reserveTarget: string;
realEthReserves: string;
tokensSold: string;
marketCap: string;
creationTimestamp: number;
graduated: boolean;
platformId: string;
configVersion: number;
}Constants
import { CHAIN_ID, CONTRACT_ADDRESSES, getAddressesForChain, getIndexerUrl } from "robin-launch/constants";
CHAIN_ID.LOCAL // 31337
CHAIN_ID.TESTNET // 46630
CHAIN_ID.MAINNET // 4663
const addr = getAddressesForChain(46630);
// {
// PLATFORM_CONFIG, UNISWAP_V4_ADAPTER, LIQUIDITY_MANAGER,
// FACTORY, REGISTRY, POOL_MANAGER, DEFAULT_PLATFORM_ID
// }