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 🙏

© 2025 – Pkg Stats / Ryan Hefner

solana-dexfi-core

v1.3.3

Published

Professional DEX and DeFi utilities for Solana with Birdseye integration for token analytics, liquidity analysis, and yield farming

Downloads

112

Readme

Solana DEX/FI Core

Professional DEX and DeFi utilities for Solana with Birdseye integration for token analytics, liquidity analysis, and yield farming.

Installation

npm install solana-dexfi-core

Features

  • 🔍 Birdseye Integration - Token price, security, and metadata from Birdseye
  • 💧 DEX Analysis - Find best pools, calculate swap rates, liquidity data
  • 🌾 DeFi Utilities - APY calculation, yield farming, impermanent loss
  • Jito Integration - Bundle creation, tip calculation, inclusion estimation
  • 🔗 Solana RPC - Get latest blockhash from Solana blockchain
  • 🛡️ Security Analysis - Token security scoring and risk assessment
  • 📊 Comprehensive Token Analysis - All-in-one token analysis
  • 🎯 Optimal Swap Routing - Find best routes across DEXes
  • 💰 Position Monitoring - Track positions with PnL analysis
  • Price Impact Analysis - Estimate price impact for swaps
  • 🔐 Protocol Risk Assessment - Evaluate protocol risks
  • 📈 APY Calculations - Calculate yields for different strategies
  • 🌊 Liquidity Analysis - Pool liquidity and TVL data
  • 🚀 TypeScript Support - Full TypeScript definitions
  • 📦 Individual Function Exports - Import only what you need

Usage

Initialize with Birdseye

const SolanaDEXFICore = require('solana-dexfi-core');

// Initialize with Birdseye API key
const dexfi = new SolanaDEXFICore('your-birdseye-api-key');

// Analyze a token
const analysis = await dexfi.analyzeToken('TokenAddress...');
console.log(analysis);
// {
//   token: { price, marketCap, volume24h, ... },
//   security: { riskLevel, securityScore, ... },
//   liquidity: { totalPools, totalLiquidity, ... },
//   summary: { verdict, recommendation }
// }

Get Token Price (Birdseye)

const price = await dexfi.birdseye.getTokenPrice('TokenAddress');
console.log(price);
// { price: 150.25, priceChange24h: 5.2, marketCap: ... }

Find Best DEX for Swap

const bestRoute = await dexfi.getOptimalSwapRoute({
    fromToken: 'TokenA_Address',
    toToken: 'TokenB_Address',
    amount: 1000000
});

console.log(bestRoute);
// {
//   recommended: { dex: 'Raydium', estimatedOutput: ..., priceImpact: '2.5%' },
//   alternatives: [ ... ]
// }

Get DEX Pools

const pools = await dexfi.DEX.getTokenPools('TokenAddress');
console.log(pools);
// [{ dex: 'Raydium', pool: '...', liquidity: ..., volume24h: ... }, ...]

Calculate APY

const apy = dexfi.DeFi.calculateAPY({
    fees24h: 5000,
    tvl: 1000000,
    period: 365
});

console.log(apy); // 182.5% APY

Get Yield Farming Opportunities

const opportunities = await dexfi.DeFi.getFarmingOpportunities({
    minAPY: 10,
    maxRisk: 'MEDIUM'
});

console.log(opportunities);
// [{ protocol: 'Solend', apy: 8.5, risk: 'LOW', ... }, ...]

Calculate Impermanent Loss

const il = dexfi.DeFi.calculateImpermanentLoss({
    priceRatio: 1.5, // Token doubled in price
    timeDays: 30
});

console.log(il);
// {
//   impermanentLoss: '5.72',
//   priceChangePercent: '50.00',
//   recommendation: 'MEDIUM'
// }

Monitor Position

const position = await dexfi.monitorPosition({
    tokenAddress: 'TokenAddress',
    amount: 100,
    entryPrice: 1.0
});

console.log(position);
// {
//   position: { ... },
//   pnl: { percent: '5.23', usd: '5.23', recommendation: 'Hold' },
//   alerts: [...]
// }

API Reference

BirdseyeAPI

  • getTokenPrice(tokenAddress) - Get token price data
  • getTokenMetadata(tokenAddress) - Get token metadata
  • getTokenHolders(tokenAddress, options) - Get token holders
  • getTokenTransactions(tokenAddress, options) - Get transactions
  • getTokenSecurity(tokenAddress) - Get security analysis

DEXUtils

  • getTokenPools(tokenAddress) - Get available pools for token
  • findBestDEX(params) - Find best DEX for swap
  • calculateSwapRate(params) - Calculate swap rate
  • getLiquidityData(poolAddress) - Get liquidity data
  • estimateSwapGas(params) - Estimate gas for swap

DeFiUtils

  • calculateAPY(params) - Calculate Annual Percentage Yield
  • getFarmingOpportunities(options) - Get yield farming opportunities
  • calculateImpermanentLoss(params) - Calculate IL
  • getProtocolRisk(protocol) - Get protocol risk assessment
  • calculateLiquidationPrice(params) - Calculate liquidation price

JitoUtils (Individual Function Exports Available)

  • createBundle(transactions, options) - Create Jito bundle for transactions
  • calculateTip(params) - Calculate Jito tip for bundle
  • estimateInclusion(params) - Estimate bundle inclusion probability
  • optimizeBundle(bundle, options) - Optimize bundle for Jito
  • calculateOptimalParameters(params) - Calculate optimal Jito parameters
  • monitorBundle(bundleId) - Monitor bundle status
  • getMEVProtectionInfo() - Get MEV protection information

Jito Endpoint Functions (Individual Exports)

  • getJitoEndpoints() - Get all Jito endpoints
  • getJitoEndpointByRegion(region) - Get endpoint by region
  • getRandomJitoEndpoint() - Get random endpoint for load balancing
  • executeJitoTx(serializedTransactions, options) - Execute Jito transactions
  • JITO_ENDPOINTS - Array of 5 Jito endpoints

Solana RPC Functions (Individual Exports)

  • getLatestBlockhash(endpoint) - Get latest blockhash from Solana

SolanaDEXFICore

  • analyzeToken(tokenAddress) - Comprehensive token analysis
  • getOptimalSwapRoute(params) - Get optimal swap route
  • monitorPosition(params) - Monitor token position
  • calculatePriceImpact(params) - Calculate price impact

Individual Function Usage

You can import individual functions without importing the whole SDK:

const { 
    createBundle, 
    calculateTip, 
    estimateInclusion,
    getLatestBlockhash,
    getJitoEndpoints,
    getJitoEndpointByRegion,
    getRandomJitoEndpoint,
    JITO_ENDPOINTS
} = require('solana-dexfi-core');

// Create Jito bundle
const bundle = createBundle([
    { signature: 'tx1', amount: 1000 },
    { signature: 'tx2', amount: 2000 }
]);

// Calculate Jito tip
const tip = calculateTip({ bundleSize: 5, networkLoad: 'normal' });

// Estimate inclusion probability
const inclusion = estimateInclusion({
    tipAmount: 0.001,
    networkLoad: 'normal',
    priority: 'high'
});

// Get latest blockhash from Solana
const blockhash = await getLatestBlockhash('https://api.mainnet-beta.solana.com');
console.log(blockhash.blockhash);

// Execute Jito transactions
const { executeJitoTx } = require('solana-dexfi-core');
const success = await executeJitoTx([
    'serializedTx1', // base58 encoded transaction
    'serializedTx2'
], {
    useAllEndpoints: true, // Send to all 5 endpoints
    endpoints: getJitoEndpoints() // Custom endpoints
});
console.log(success); // true if at least one endpoint accepted

// Get all Jito endpoints
const allEndpoints = getJitoEndpoints();
console.log(allEndpoints); // Array of 5 endpoints

// Get Jito endpoint by region
const amsterdamEndpoint = getJitoEndpointByRegion('amsterdam');
console.log(amsterdamEndpoint); // Amsterdam endpoint

// Get random Jito endpoint
const randomEndpoint = getRandomJitoEndpoint();
console.log(randomEndpoint); // Random endpoint for load balancing

// Use endpoints array directly
console.log(JITO_ENDPOINTS); // All 5 endpoints

Requirements

  • Node.js >= 14.0.0
  • Birdseye API key (optional but recommended)

License

MIT

Contributing

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

Support

For issues and questions, please visit our GitHub Issues.