A TypeScript SDK for interacting with PumpSwap DEX, featuring a sniper bot and transaction bundler with MEV protection.
- π Buy and sell tokens
- π° Price fetching
- π Pool information
- β‘ Fast transaction execution
- π Real-time transaction monitoring
- β‘ Fast buy/sell execution
- π― Configurable entry/exit points
- π° Stop loss and take profit
- βοΈ Price impact monitoring
- π Slippage protection
- π Concurrent trade management
- π¦ Transaction bundling with configurable limits
- β‘ Automatic compute budget instructions
- π MEV protection through Jito bundles
- π Transaction size management
- π§Ή Bundle clearing and reset functionality
- Node.js v16 or higher
- npm or yarn
- Solana wallet with SOL for transactions
- Helius RPC key
- Jito bundle access (for bundler)
import { wallet_1 } from "./constants";
import { PumpSwapSDK } from './pumpswap';
async function main() {
const mint = "your-pumpfun-token-address";
const sol_amt = 0.99; // buy 1 SOL worth of token using WSOL
const sell_percentage = 0.5; // sell 50% of the token
const pumpswap_sdk = new PumpSwapSDK();
// Buy tokens
await pumpswap_sdk.buy(new PublicKey(mint), wallet_1.publicKey, sol_amt);
// Sell percentage of tokens
await pumpswap_sdk.sell_percentage(new PublicKey(mint), wallet_1.publicKey, sell_percentage);
// Sell exact amount of tokens
await pumpswap_sdk.sell_exactAmount(new PublicKey(mint), wallet_1.publicKey, 1000);
}
import { getPrice, getPumpSwapPool } from './pool';
async function main() {
const mint = new PublicKey("your-pumpfun-token-address");
// Get token price
console.log(await getPrice(mint));
// Get pool information
console.log(await getPumpSwapPool(mint));
}
import { PumpSwapSniper } from './src/sniper-bot';
async function main() {
const config = {
tokenMint: "YOUR_TOKEN_MINT_ADDRESS",
buyAmount: 0.1, // 0.1 SOL
sellPercentage: 50, // Sell 50%
maxSlippage: 5, // 5% max slippage
buyDelayMs: 1000, // 1 second delay
sellDelayMs: 5000, // 5 second delay
minPriceImpact: 1, // 1% minimum price impact
maxPriceImpact: 10, // 10% maximum price impact
maxConcurrentTrades: 3, // Maximum 3 concurrent trades
stopLossPercentage: 10, // 10% stop loss
takeProfitPercentage: 20 // 20% take profit
};
const sniper = new PumpSwapSniper(config);
await sniper.start();
}
import { PumpSwapBundler } from './src/bundler';
import { PumpSwapSDK } from './src/pumpswap';
async function main() {
// Initialize bundler
const bundler = new PumpSwapBundler({
maxTransactions: 4,
tipAmount: 0.0001,
computeUnits: 300000,
computeUnitPrice: 696969
});
// Initialize PumpSwap SDK
const sdk = new PumpSwapSDK();
// Create and add transactions
const buyTx = await sdk.createBuyTransaction(/* params */);
bundler.addTransaction(buyTx);
const sellTx = await sdk.createSellTransaction(/* params */);
bundler.addTransaction(sellTx);
// Send bundle
const uuid = await bundler.sendBundle(poolId, signer);
console.log('Bundle sent:', uuid);
}
interface SniperConfig {
tokenMint: string; // Token to snipe
buyAmount: number; // Amount of SOL to buy with
sellPercentage: number; // Percentage to sell at (0-100)
maxSlippage: number; // Maximum allowed slippage (%)
buyDelayMs: number; // Delay before buying (ms)
sellDelayMs: number; // Delay before selling (ms)
minPriceImpact: number; // Minimum price impact to trigger buy
maxPriceImpact: number; // Maximum price impact to trigger buy
maxConcurrentTrades: number; // Maximum concurrent trades
stopLossPercentage: number; // Stop loss percentage
takeProfitPercentage: number; // Take profit percentage
}
interface BundleConfig {
maxTransactions: number; // Maximum transactions per bundle
tipAmount: number; // Amount to tip validators
computeUnits: number; // Compute units for transactions
computeUnitPrice: number; // Price per compute unit
}
- Transaction monitoring and validation
- Price impact checks
- Slippage protection
- Stop loss mechanisms
- Concurrent trade limiting
- Error handling and recovery
- MEV protection through Jito bundles
- Make sure you have enough SOL for:
- Transaction fees
- Compute budget
- Validator tips
- Monitor transaction sizes and limits
- Consider network congestion when setting parameters
- Use appropriate compute units for your transactions
- Always test with small amounts first