JSPM

solana-token-transaction-monitor

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q14203F
  • License MIT

Monitor and parse all transactions for a specific SPL token across all DEXs on Solana

Package Exports

  • solana-token-transaction-monitor
  • solana-token-transaction-monitor/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (solana-token-transaction-monitor) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Solana Token Transaction Monitor

A powerful npm package for monitoring and parsing ALL transactions for a specific SPL token across all DEXs on Solana in real-time.

🚀 Features

  • Universal DEX Support: Monitor transactions on PumpFun, Raydium, Orca, Jupiter, and all other DEXs
  • Real-time Streaming: Uses Triton gRPC for live transaction monitoring
  • Accurate Parsing: Specialized parsers for PumpFun with fallback for other DEXs
  • Transaction Database: Built-in SQLite storage with automatic cleanup
  • Type Detection: Automatically identifies BUY/SELL transactions
  • SOL Amount Calculation: Accurate SOL amounts with fee consideration
  • TypeScript Support: Fully typed for better DX
  • Easy Integration: Simple API for quick integration

📦 Installation

npm install solana-token-transaction-monitor

🛠 Usage

Option 1: Using TransactionParser (with SQLite storage)

import transactionParser from 'solana-token-transaction-monitor/parse_transactions';

// Start tracking a token
const tokenMint = 'your_token_mint_address_here';
await transactionParser.startTracking(
  tokenMint,
  'https://grpc.fra.shyft.to', // optional, can use env vars
  'your_api_token' // optional, can use env vars
);

// Get stored transactions
const transactions = await transactionParser.getTransactions(tokenMint, 50);

// Stop tracking
transactionParser.stopTracking();

Option 2: Using TokenMonitor directly

import { TokenMonitor } from 'solana-token-transaction-monitor';

const monitor = new TokenMonitor({
  grpcUrl: process.env.GRPC_URL || 'https://grpc.fra.shyft.to',
  xToken: process.env.X_TOKEN,
  targetMint: 'your_token_mint_address',
  onTransaction: (txInfo, signature, tx) => {
    console.log(`
      Type: ${txInfo.type} (${txInfo.type === 'BUY' ? '🟢' : '🔴'})
      DEX: ${txInfo.dex}
      User: ${txInfo.user}
      Token Amount: ${txInfo.tokenAmount}
      SOL Amount: ${txInfo.solAmount}
      Signature: ${signature}
      Solscan: https://solscan.io/tx/${signature}
    `);
  },
  onError: (error) => {
    console.error('Monitor error:', error);
  }
});

// Start monitoring
await monitor.start();

// Stop monitoring
monitor.stop();

📊 Transaction Info Object

interface TransactionInfo {
  type: string;         // 'BUY', 'SELL', or 'SWAP'
  dex: string;          // 'PUMP FUN', 'RAYDIUM V4', etc.
  user: string;         // Wallet address
  mint: string;         // Token mint address
  tokenAmount: number;  // Amount of tokens traded
  solAmount: number;    // Amount of SOL traded
  success: boolean;     // Transaction success status
}

🔧 Environment Variables

Create a .env file:

# Triton gRPC URL - get from https://triton.one/
GRPC_URL=your_grpc_url_here

# Triton API Token - get from https://triton.one/
X_TOKEN=your_api_token_here

💾 Database Schema

When using TransactionParser, transactions are stored in SQLite:

CREATE TABLE transactions (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  token_mint TEXT NOT NULL,
  wallet TEXT NOT NULL,
  type TEXT NOT NULL,
  sol_amount REAL NOT NULL,
  tx_hash TEXT NOT NULL,
  timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
)

🏦 Supported DEXs

  • PumpFun (with specialized event parsing)
  • Raydium V4
  • Orca Whirlpool
  • Jupiter V4
  • DFlow
  • And all other SPL token DEXs

📈 Accuracy

  • PumpFun: Uses event parsing for maximum accuracy
  • Other DEXs: Analyzes balance changes with fee consideration
  • Transaction Types: Automatically detects BUY/SELL based on token flow
  • SOL Amounts: Multiple calculation methods with fallbacks

🔗 API Reference

TransactionParser

  • startTracking(mintAddress, grpcUrl?, xToken?): Start monitoring a token
  • stopTracking(): Stop current monitoring
  • getTransactions(tokenMint, limit): Get stored transactions
  • close(): Clean up resources

TokenMonitor

  • constructor(options): Create monitor instance
  • start(): Begin monitoring
  • stop(): Stop monitoring

📝 License

MIT