npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

raydium-core-sdk-v1

v1.0.0

Published

Professional SDK for Raydium AMM operations on Solana including swaps, liquidity management, and pool analytics

Downloads

8

Readme

Raydium Core SDK v1

Professional SDK for Raydium AMM (Automated Market Maker) operations on Solana blockchain.

Installation

npm install raydium-core-sdk-v1

Features

  • 🔄 Swap Tokens - Execute token swaps through Raydium pools
  • 💧 Liquidity Management - Add and remove liquidity from pools
  • 📊 Pool Analytics - Get detailed pool information and metrics
  • 🧮 Swap Calculations - Calculate swap output amounts
  • 🎯 Best Route Finding - Find optimal swap routes
  • 💰 Price Impact Estimation - Analyze price impact for swaps
  • 📈 Quote Generation - Get accurate swap quotes with slippage
  • Gas Estimation - Estimate transaction fees
  • 🔍 Pool Discovery - Find pools between tokens
  • 📉 LP Share Calculation - Calculate liquidity provider share
  • 🛡️ Validation - Validate pool addresses and data
  • 🚀 TypeScript Support - Full TypeScript definitions

Usage

Swap Tokens

const RaydiumSDK = require('raydium-core-sdk-v1');

const instruction = RaydiumSDK.createSwapInstruction({
    fromTokenMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
    toTokenMint: 'So11111111111111111111111111111111111111112',
    fromAmount: 1000000, // 1 USDC
    minOutAmount: 950000,
    userPubkey: 'YourPublicKeyHere',
    poolAddress: '58oQChx4yWmvKdwLLZzBi4ChoCc2fqCUWBkwMihLYQo2'
});

console.log(instruction);

Get Swap Quote

const quote = RaydiumSDK.getSwapQuote({
    fromMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
    toMint: 'So11111111111111111111111111111111111111112',
    amount: 1000000, // 1 USDC
    slippageBps: 50 // 0.5%
});

console.log(quote);
// {
//   outputAmount: 9800000,
//   minOutAmount: 9755000,
//   priceImpact: '2.45%',
//   impactLevel: 'LOW',
//   fee: 0.0025,
//   route: ['58oQChx4yWmvKdwLLZzBi4ChoCc2fqCUWBkwMihLYQo2']
// }

Add Liquidity

const addLiqInstruction = RaydiumSDK.addLiquidity({
    poolAddress: '58oQChx4yWmvKdwLLZzBi4ChoCc2fqCUWBkwMihLYQo2',
    tokenAAmount: 1000000, // 1 USDC
    tokenBAmount: 5000000000, // 5 SOL
    userPubkey: 'YourPublicKeyHere',
    tokenAAddress: 'TokenAATAPubkey',
    tokenBAddress: 'TokenBATAPubkey',
    minLPAmount: 0
});

console.log(addLiqInstruction);

Calculate Swap Output

const outputAmount = RaydiumSDK.calculateSwapOutput({
    inputAmount: 1000000, // 1 USDC
    reserveIn: 10000000, // Pool reserves
    reserveOut: 50000000000,
    fee: 0.0025 // 0.25%
});

console.log(outputAmount); // Calculated output amount

Get Pool Information

const poolInfo = RaydiumSDK.getPoolInfo('58oQChx4yWmvKdwLLZzBi4ChoCc2fqCUWBkwMihLYQo2');

console.log(poolInfo);
// {
//   address: '58oQChx4yWmvKdwLLZzBi4ChoCc2fqCUWBkwMihLYQo2',
//   tokenA: { mint: '...', reserve: ..., decimals: 6 },
//   tokenB: { mint: '...', reserve: ..., decimals: 9 },
//   fee: 0.0025,
//   totalSupply: ...
// }

Estimate Price Impact

const impact = RaydiumSDK.estimatePriceImpact({
    inputAmount: 5000000, // Large swap
    reserveIn: 10000000,
    reserveOut: 50000000000,
    fee: 0.0025
});

console.log(impact);
// {
//   priceImpact: '8.5%',
//   impactLevel: 'HIGH',
//   outputAmount: 2250000000,
//   effectivePrice: 0.45,
//   spotPrice: 0.5
// }

Find Best Route

const route = RaydiumSDK.findBestRoute(
    'TokenA_MintAddress',
    'TokenB_MintAddress'
);

console.log(route); // Array of pools to route through

API Reference

Core Functions

createSwapInstruction(params)

Create a swap instruction for Raydium pool.

Parameters:

  • fromTokenMint - Source token mint
  • toTokenMint - Destination token mint
  • fromAmount - Amount to swap
  • minOutAmount - Minimum output amount
  • userPubkey - User's public key
  • poolAddress - Raydium pool address

calculateSwapOutput(params)

Calculate output amount for a swap using AMM formula.

getSwapQuote(params)

Get comprehensive swap quote with slippage protection.

addLiquidity(params)

Create instruction to add liquidity to pool.

removeLiquidity(params)

Create instruction to remove liquidity from pool.

findBestRoute(fromMint, toMint)

Find optimal route between two tokens.

estimatePriceImpact(params)

Analyze price impact for a swap.

getPoolInfo(poolAddress)

Get detailed information about a Raydium pool.

calculateLPShare(params)

Calculate liquidity provider's share of pool.

findPool(mintA, mintB)

Find pool between two token mints.

estimateGasFees()

Estimate gas fees for different operations.

isValidPoolAddress(address)

Validate Raydium pool address.

calculateConstantProduct(reserves)

Calculate pool's constant product K.

Requirements

  • Node.js >= 14.0.0

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

For issues and questions, please visit our GitHub Issues.