solana-sdk-tools
v1.0.4
Published
Professional token scanner & trading automation for Solana - Pump.fun, Raydium, copy trading, anti-rug protection
Maintainers
Readme
🎬 Demo
╔═══════════════════════════════════════════════════════════════════╗
║ 🚀 Solana SDK Tools - Token Scanner v1.0.2 ║
╠═══════════════════════════════════════════════════════════════════╣
║ ✓ Pump.fun Scanner ✓ Auto Take-Profit ║
║ ✓ Raydium Scanner ✓ Auto Stop-Loss ║
║ ✓ Moonshot Scanner ✓ Trailing Stop ║
║ ✓ Copy Trading ✓ DCA Strategies ║
║ ✓ Anti-Rug Protection ✓ Discord/Telegram Alerts ║
╚═══════════════════════════════════════════════════════════════════╝
[14:55:49] ✓ Connected to RPC | Wallet: 7xK...3mN | Balance: 2.50 SOL
[14:55:50] ✓ Scanners active: Pump.fun, Raydium, Moonshot
[14:55:51] 🔍 Watching for opportunities...
[14:56:23] 🚀 NEW TOKEN: $ALPHA
Liquidity: $15,420 | MCap: $62,000 | Safety: 91/100
→ Executing buy: 0.1 SOL...
[14:56:24] ✅ BUY SUCCESS | TX: 4nXb...9kPq
[15:12:45] 📈 TAKE PROFIT HIT: $ALPHA +127%
→ Selling 50% position...
[15:12:46] ✅ SELL SUCCESS | Profit: +0.127 SOL✨ Why Solana SDK Tools?
| Feature | Solana SDK Tools | Others | |---------|------------------|--------| | 🔍 Multi-DEX Scanner | ✅ Pump.fun, Raydium, Moonshot | Limited | | 🛡️ Anti-Rug Protection | ✅ Built-in | Usually paid | | 📊 Take Profit/Stop Loss | ✅ Multi-target | Basic | | 👀 Copy Trading | ✅ Any wallet | Premium only | | 📉 Trailing Stop | ✅ Configurable | Rare | | 💰 DCA Strategies | ✅ Automated | Manual | | 📄 Paper Trading | ✅ Risk-free testing | Rare | | 🔔 Discord Webhooks | ✅ Real-time alerts | Often missing | | 🤖 Telegram Bot | ✅ Full control | Premium only | | 🐳 Docker Support | ✅ Production ready | Often missing | | 🎨 TypeScript | ✅ Fully typed | Often JS | | 🧪 Tested | ✅ 100% unit tests | Rarely | | 💵 Price | Free & Open Source | $50-500/mo |
🎯 Features
🔍 Token Scanner
- Multi-Platform Monitoring - Pump.fun, Raydium, Moonshot
- Real-time Detection - WebSocket streams for instant alerts
- Smart Filtering - Liquidity, market cap, holder requirements
- Blacklist/Whitelist - Control exactly what you scan
🌙 Moonshot Scanner (NEW!)
import { MoonshotScanner } from 'solana-sdk-tools';
const scanner = new MoonshotScanner(config);
scanner.onNewToken((token) => {
console.log(`New token: ${token.symbol}`);
console.log(`Liquidity: $${token.liquidity}`);
console.log(`Market Cap: $${token.marketCap}`);
});
await scanner.start();🛡️ Anti-Rug Protection
- Mint Authority Check - Detect unlimited supply tokens
- Freeze Authority Check - Avoid freezable tokens
- Holder Distribution - Flag concentrated holdings
- LP Analysis - Check liquidity locks & burns
- Safety Score - Automated risk assessment (0-100)
📊 Trading Strategies
- Take Profit - Multi-target profit taking (e.g., 25% at 2x, 50% at 5x)
- Stop Loss - Automatic exit on drawdown
- Trailing Stop - Lock in profits as price rises
- DCA - Dollar-cost average into dips
👀 Copy Trading
- Wallet Tracking - Monitor any Solana wallet
- Configurable Multiplier - Trade smaller/larger than copied wallet
- Buy & Sell Copying - Choose what to mirror
- Max Position Size - Risk management per trade
🔔 Discord Webhooks (NEW!)
Real-time notifications to your Discord server:
import { DiscordNotifier } from 'solana-sdk-tools';
const discord = new DiscordNotifier({
webhookUrl: process.env.DISCORD_WEBHOOK_URL,
enabled: true,
});
// Token detected notification
await discord.tokenDetected(token, {
liquidity: 5000,
marketCap: 50000,
safetyScore: 85,
});
// Trade notifications
await discord.buyExecuted({ token, amount: 0.5, signature: '...' });
await discord.sellExecuted({ token, amount: 1.5, pnl: 0.5, pnlPercent: 50 });
// PnL updates
await discord.pnlUpdate(positions);
// Alerts
await discord.alert('Rug Detected', 'Token XYZ has suspicious activity', 'warning');🤖 Telegram Bot Control (NEW!)
Full bot control via Telegram commands:
| Command | Description |
|---------|-------------|
| /start | Start the bot |
| /status | Bot status & settings |
| /balance | Wallet balance |
| /positions | Active positions |
| /pnl | Profit & Loss summary |
| /buy <token> <amount> | Buy token |
| /sell <token> <percent> | Sell token |
| /stop | Stop the bot |
| /resume | Resume the bot |
import { TelegramBot } from 'solana-sdk-tools';
const telegram = new TelegramBot({
botToken: process.env.TELEGRAM_BOT_TOKEN,
allowedUsers: ['123456789'], // Your Telegram user ID
});
telegram.setCallbacks({
getState: () => botState,
executeBuy: (mint, amount) => trading.buy(mint, amount),
executeSell: (mint, percent) => trading.sell(mint, percent),
});
await telegram.start();📄 Paper Trading (NEW!)
Test strategies without risking real funds:
import { PaperTradingEngine } from 'solana-sdk-tools';
const paper = new PaperTradingEngine(config);
// Simulated buy
const buyResult = await paper.buy('TokenMint123', 0.5, 'TEST');
// Simulated sell
const sellResult = await paper.sell('TokenMint123', 100);
// Get portfolio summary
const summary = await paper.getPortfolioSummary();
console.log(`Total PnL: ${summary.totalPnl} SOL`);
// Get statistics
const stats = paper.getStats();
console.log(`Win rate: ${stats.winRate}%`);
// Export trades
const json = paper.exportTrades();🚀 Quick Start
Get up and running in 2 minutes:
# 1. Clone the repository
git clone https://github.com/DebuggingMax/solana-sdk-tools.git
cd solana-sdk-tools
# 2. Install dependencies
npm install
# 3. Copy and configure settings
cp config/settings.example.json config/settings.json
cp .env.example .env
# 4. Edit settings.json with your wallet private key
# IMPORTANT: Use a fresh wallet for trading!
# 5. Build and run
npm run build
npm start🐳 Docker
Quick Start with Docker
# Build and run with Docker Compose
docker-compose up -d bot
# View logs
docker-compose logs -f bot
# Stop
docker-compose downDevelopment Mode
docker-compose --profile dev up devWith Redis Cache
docker-compose up -dWith Monitoring (Prometheus + Grafana)
docker-compose --profile monitoring up -dBuild Manually
# Build image
docker build -t solana-sdk-tools .
# Run container
docker run -d \
--name solana-bot \
-v $(pwd)/config/settings.json:/app/config/settings.json:ro \
-e RPC_URL=https://your-rpc.com \
solana-sdk-tools╔═══════════════════════════════════════════════════════════════╗
║ ║
║ ███████╗ ██████╗ ██╗ █████╗ ███╗ ██╗ █████╗ ║
║ ██╔════╝██╔═══██╗██║ ██╔══██╗████╗ ██║██╔══██╗ ║
║ ███████╗██║ ██║██║ ███████║██╔██╗ ██║███████║ ║
║ ╚════██║██║ ██║██║ ██╔══██║██║╚██╗██║██╔══██║ ║
║ ███████║╚██████╔╝███████╗██║ ██║██║ ╚████║██║ ██║ ║
║ ╚══════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝ ║
║ ║
║ 🚀 SDK Tools - Token Scanner EDITION v1.0.0 ║
╚═══════════════════════════════════════════════════════════════╝
[2024-02-24 12:00:00] [Main] ✓: Connected to RPC
[2024-02-24 12:00:00] [Main] ✓: Wallet: 7Fc...9Xg9
[2024-02-24 12:00:00] [Main] ✓: Balance: 1.5000 SOL
[2024-02-24 12:00:01] [Main] ✓: Bot initialized successfully!
════════════════════════════════════════════════════════════════
Scanner ✓ ON
└─ Pump.fun ✓ ON
└─ Raydium ✓ ON
└─ Moonshot ✓ ON
└─ Anti-Rug ✓ ON
Take Profit ✓ ON
Stop Loss ✓ ON
Trailing Stop ✗ OFF
Discord Webhooks ✓ ON
Telegram Bot ✓ ON
Paper Trading ✗ OFF
════════════════════════════════════════════════════════════════
🚀 Bot is running! Watching for opportunities...🧪 Testing
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:coverage⚙️ Configuration
Environment Variables (.env)
# Wallet
PRIVATE_KEY=your_base58_private_key
# RPC
RPC_URL=https://api.mainnet-beta.solana.com
RPC_WS_URL=wss://api.mainnet-beta.solana.com
# Paper Trading
PAPER_TRADING=false
PAPER_TRADING_BALANCE=10
# Discord Notifications
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...
DISCORD_USER_ID=123456789
# Telegram Bot
TELEGRAM_BOT_TOKEN=123456:ABC-DEF...
TELEGRAM_CHAT_ID=987654321
TELEGRAM_ALLOWED_USERS=123456789,987654321
# Redis (optional)
REDIS_URL=redis://localhost:6379settings.json
{
"wallet": {
"privateKey": "YOUR_BASE58_PRIVATE_KEY"
},
"scanner": {
"enabled": true,
"platforms": {
"launchpad": true,
"raydium": true,
"moonshot": true
},
"buyAmount": 0.1,
"minLiquidity": 5000,
"maxMarketCap": 100000
},
"strategies": {
"takeProfit": {
"enabled": true,
"targets": [
{ "percent": 50, "sellPercent": 25 },
{ "percent": 100, "sellPercent": 25 },
{ "percent": 200, "sellPercent": 50 }
]
},
"stopLoss": {
"enabled": true,
"percent": 30
}
},
"notifications": {
"discord": {
"enabled": true,
"webhookUrl": "https://discord.com/api/webhooks/..."
},
"telegram": {
"enabled": true,
"botToken": "123456:ABC..."
}
}
}| Setting | Type | Default | Description |
|---------|------|---------|-------------|
| wallet.privateKey | string | - | Base58 encoded private key |
| rpc.url | string | mainnet | Solana RPC endpoint |
| scanner.buyAmount | number | 0.1 | SOL amount per trade |
| scanner.minLiquidity | number | 5000 | Min liquidity in USD |
| scanner.maxMarketCap | number | 100000 | Max market cap in USD |
| scanner.platforms.moonshot | boolean | false | Enable Moonshot scanner |
| strategies.takeProfit.targets | array | - | Profit targets |
| strategies.stopLoss.percent | number | 30 | Stop loss percentage |
| filters.avoidMintable | boolean | true | Skip mintable tokens |
| filters.avoidFreezable | boolean | true | Skip freezable tokens |
| trading.paperTrading | boolean | false | Enable paper trading |
📈 Trading Strategies
Take Profit Example
"takeProfit": {
"enabled": true,
"targets": [
{ "percent": 100, "sellPercent": 50 }, // At 2x, sell 50%
{ "percent": 300, "sellPercent": 100 } // At 4x, sell remaining
]
}Trailing Stop Example
"trailingStop": {
"enabled": true,
"activateAt": 50, // Activate after 50% gain
"trailPercent": 20 // Sell if drops 20% from high
}Copy Trading Example
"copyTrading": {
"enabled": true,
"wallets": [
{
"address": "WALLET_TO_COPY",
"label": "Smart Money",
"copyBuys": true,
"copySells": true,
"multiplier": 0.5, // Trade 50% of their size
"maxSolPerTrade": 0.2 // Max 0.2 SOL per trade
}
]
}💻 CLI Usage
# Start the bot
npm start
# Start in development mode
npm run dev
# Start with paper trading
PAPER_TRADING=true npm start
# Start with debug logging
DEBUG=true npm start
# Build for production
npm run build
# Run tests
npm test📚 Code Examples
Basic Scanner Setup
import { scanner, TradingEngine, StrategyEngine, loadConfig } from 'solana-sdk-tools';
const config = loadConfig();
const trading = new TradingEngine(wallet, config);
const strategies = new StrategyEngine(trading, config);
const tokenScanner = new scanner(trading, strategies, config);
await tokenScanner.start();Manual Trading
import { TradingEngine, WalletManager, loadConfig } from 'solana-sdk-tools';
const config = loadConfig();
const wallet = new WalletManager(config);
const trading = new TradingEngine(wallet, config);
// Buy 0.5 SOL worth of a token
const buyResult = await trading.buy('TokenMintAddress', 0.5);
console.log(`Buy signature: ${buyResult.signature}`);
// Sell 50% of position
const sellResult = await trading.sell('TokenMintAddress', 50);
console.log(`Sell signature: ${sellResult.signature}`);With Discord Notifications
import { TradingEngine, DiscordNotifier } from 'solana-sdk-tools';
const discord = new DiscordNotifier({
webhookUrl: process.env.DISCORD_WEBHOOK_URL,
});
// After successful buy
const result = await trading.buy(tokenMint, 0.5);
if (result.success) {
await discord.buyExecuted({
token: { mint: tokenMint, symbol: 'TOKEN' },
amount: 0.5,
signature: result.signature,
});
}Paper Trading Mode
import { PaperTradingEngine, loadConfig } from 'solana-sdk-tools';
const config = loadConfig();
const paper = new PaperTradingEngine(config);
// Test a strategy
await paper.buy('TestToken', 1, 'TEST');
// Check portfolio
const summary = await paper.getPortfolioSummary();
console.log(`Balance: ${summary.balance} SOL`);
console.log(`Positions: ${summary.positions.length}`);
console.log(`Total PnL: ${summary.totalPnl} SOL`);
// Export for analysis
const trades = paper.exportTrades();
fs.writeFileSync('trades.json', trades);Full Integration Example
import {
scanner,
TradingEngine,
StrategyEngine,
WalletManager,
DiscordNotifier,
TelegramBot,
PaperTradingEngine,
loadConfig,
} from 'solana-sdk-tools';
async function main() {
const config = loadConfig();
// Initialize components
const wallet = new WalletManager(config);
const trading = new TradingEngine(wallet, config);
const strategies = new StrategyEngine(trading, config);
// Paper trading (optional)
const paperTrading = process.env.PAPER_TRADING === 'true'
? new PaperTradingEngine(config)
: null;
// Discord notifications
const discord = new DiscordNotifier({
webhookUrl: process.env.DISCORD_WEBHOOK_URL,
});
// Telegram bot
const telegram = new TelegramBot({
botToken: process.env.TELEGRAM_BOT_TOKEN,
});
telegram.setCallbacks({
getState: () => ({
isRunning: true,
walletAddress: wallet.getAddress(),
balance: wallet.getBalance(),
positions: strategies.getPositions(),
totalPnl: strategies.getTotalPnl(),
tradesCount: { buys: 10, sells: 8 },
}),
executeBuy: (mint, amount) => trading.buy(mint, amount),
executeSell: (mint, percent) => trading.sell(mint, percent),
});
// Start everything
await telegram.start();
const tokenScanner = new scanner(trading, strategies, config);
tokenScanner.onNewToken(async (token) => {
await discord.tokenDetected(token);
});
await tokenScanner.start();
console.log('🚀 Bot is running!');
}
main().catch(console.error);🔒 Security Best Practices
⚠️ IMPORTANT: Never use your main wallet!
- Create a dedicated trading wallet with only the funds you're willing to risk
- Use a fresh private key - never your main Solana wallet
- Set conservative limits - start with small
buyAmountvalues - Use a premium RPC - Helius, QuickNode, or Triton for reliability
- Monitor regularly - check positions and adjust settings
- Use paper trading first - test strategies without real funds
- Keep your
.envsecure - never commit to version control
🏗️ Project Structure
solana-sdk-tools/
├── src/
│ ├── index.ts # Main entry point
│ ├── scanner/ # Token detection
│ │ ├── index.ts # Scanner orchestrator
│ │ ├── launchpad.ts # Pump.fun scanner
│ │ ├── raydium.ts # Raydium scanner
│ │ └── moonshot.ts # Moonshot scanner (NEW)
│ ├── trading/ # Trade execution
│ │ ├── index.ts # Trading engine
│ │ └── paper.ts # Paper trading (NEW)
│ ├── notifications/ # Alerts (NEW)
│ │ ├── index.ts
│ │ └── discord.ts # Discord webhooks
│ ├── telegram/ # Telegram bot (NEW)
│ │ └── bot.ts
│ ├── strategies/ # TP/SL/Trailing/DCA
│ ├── analysis/ # Anti-rug checks
│ ├── copy/ # Wallet tracking
│ ├── wallet/ # Wallet management
│ ├── config/ # Config loader
│ └── utils/ # Helpers & logger
├── tests/ # Unit tests
│ ├── config.test.ts
│ ├── security.test.ts
│ ├── moonshot.test.ts # (NEW)
│ ├── discord.test.ts # (NEW)
│ ├── paper-trading.test.ts # (NEW)
│ ├── telegram.test.ts # (NEW)
│ └── utils.test.ts
├── config/
│ └── settings.example.json
├── Dockerfile # (NEW)
├── docker-compose.yml # (NEW)
└── .env.example🤝 Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
💬 Community & Support
- Discord: Join MaxLabs Community
- Issues: GitHub Issues
- Discussions: GitHub Discussions
📜 License
MIT License - See LICENSE for details.
⚠️ Disclaimer
This software is provided "as-is" for educational and development purposes. Trading cryptocurrencies involves substantial risk of loss. The authors are not responsible for any financial losses incurred through use of this software.
Not financial advice. DYOR. Only risk what you can afford to lose.
📚 Examples
See solana-sdk-examples for trading strategies and use cases.
