3: SDK api reference
WenDevClient Class
Constructor
new WenDevClient(options: WenDevSDKOptions)Options:
connection(Connection): Solana RPC connectioncommitment(optional): 'processed' | 'confirmed' | 'finalized'
Methods
getPoolState(bondingCurve: PublicKey): Promise
Get the pool state for a token by its bonding curve (pool state) address.
Parameters:
bondingCurve: Token mint address or pool state address
Returns: Complete pool state with all reserves and configuration
Example:
const poolState = await wendev.getPoolState(tokenMint);
console.log('Status:', poolState.status);
console.log('Real Quote:', poolState.real_quote.toString());decodePoolState(poolStateAddress: PublicKey): Promise
Decode pool state directly from a pool state account address.
Parameters:
poolStateAddress: The pool state account address
Returns: Decoded pool state
getTokenInfo(tokenMint: PublicKey): Promise
Get comprehensive token information including decimals, supply, and migration status.
Returns:
{
mint: PublicKey;
decimals: number;
supply: BN;
bondingCurve: PublicKey;
isMigrated: boolean;
creator: PublicKey;
}getTokensForLamports(tokenMint: PublicKey, lamports: BN): Promise
Calculate how many tokens you will receive when buying with a given amount of SOL.
Parameters:
tokenMint: Token mint addresslamports: Amount of SOL to spend (in lamports)
Returns: Amount of tokens you will receive (after fees)
Example:
const lamports = new BN(1_000_000_000); // 1 SOL
const tokens = await wendev.getTokensForLamports(tokenMint, lamports);
console.log('Tokens received:', tokens.toString());getLamportsForTokens(tokenMint: PublicKey, tokens: BN): Promise
Calculate how much SOL you need to buy a specific amount of tokens (inverse calculation).
Parameters:
tokenMint: Token mint addresstokens: Amount of tokens you want to buy
Returns: Amount of SOL needed (in lamports, including fees)
getExpectedLamportsForTokens(tokenMint: PublicKey, tokens: BN): Promise
Calculate how much SOL you will receive when selling tokens.
Parameters:
tokenMint: Token mint addresstokens: Amount of tokens to sell
Returns: Amount of SOL you will receive (in lamports, after fees)
createBuyTransaction(payer: PublicKey, params: BuyTokenParams): Promise
Create a transaction to buy tokens.
Parameters:
{
tokenMint: PublicKey;
amountIn: BN; // Amount of SOL to spend (lamports)
slippage?: number; // Slippage in basis points (default: 100 = 1%)
}Returns: Transaction ready to be signed and sent
createSellTransaction(payer: PublicKey, params: SellTokenParams): Promise
Create a transaction to sell tokens.
Parameters:
{
tokenMint: PublicKey;
amountIn: BN; // Amount of tokens to sell
slippage?: number; // Slippage in basis points (default: 100 = 1%)
}Returns: Transaction ready to be signed and sent
createTokenCreationTransaction(payer: PublicKey, params: CreateTokenParams): Promise<{ tx: Transaction; tokenKeypair: Keypair }>
Create a transaction to launch a new token on Wen.dev.
Parameters:
{
vanityMint?: Keypair; // Optional vanity mint keypair
metadata: {
name: string;
symbol: string;
image: string; // Image URL
description?: string;
socials: {
twitter?: string;
telegram?: string;
website?: string;
};
};
}Returns:
tx: Transaction to sign and sendtokenKeypair: Token mint keypair (must sign transaction with both payer and tokenKeypair)
isMigrated(tokenMint: PublicKey): Promise
Check if a token has been migrated to AMM.
Returns: true if migrated to AMM, false if still in bonding curve phase
getConfig(): WenDevConfig
Get current SDK configuration.
updateConfig(config: Partial): void
Update SDK configuration.
getConnection(): Connection
Get the Solana connection instance.
getPlatformConfigKey(): PublicKey
Get platform configuration key.
getAMMConfigKey(): PublicKey
Get AMM configuration key.
Last updated
