3: SDK api reference

WenDevClient Class

Constructor

new WenDevClient(options: WenDevSDKOptions)

Options:

  • connection (Connection): Solana RPC connection

  • commitment (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:

example.ts
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:


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 address

  • lamports: Amount of SOL to spend (in lamports)

Returns: Amount of tokens you will receive (after fees)

Example:


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 address

  • tokens: 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 address

  • tokens: 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:

Returns: Transaction ready to be signed and sent


createSellTransaction(payer: PublicKey, params: SellTokenParams): Promise

Create a transaction to sell tokens.

Parameters:

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:

Returns:

  • tx: Transaction to sign and send

  • tokenKeypair: 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