A TypeScript-based transaction bundler for PumpSwap DEX that provides efficient transaction bundling with MEV protection through Jito bundles.
- π¦ Transaction bundling with configurable limits
- β‘ Automatic compute budget instructions
- π MEV protection through Jito bundles
- π Transaction size management
- π§Ή Bundle clearing and reset functionality
- βοΈ Configurable parameters
- Node.js v16 or higher
- npm or yarn
- Solana wallet with SOL for transactions
- Helius RPC key
- Jito bundle access
- Clone the repository:
git clone <repository-url>
cd pumpswap-sdk
- Install dependencies:
npm install
- Create a
.env
file in the root directory:
PRIVATE_KEY=your_private_key
HELIUS_RPC_KEY=your_helius_rpc_key
The bundler can be configured with the following parameters:
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
}
Example configuration:
const config: BundleConfig = {
maxTransactions: 4, // Maximum 4 transactions per bundle
tipAmount: 0.0001, // 0.0001 SOL tip
computeUnits: 300000, // 300,000 compute units
computeUnitPrice: 696969 // Price per compute unit
};
- Import and initialize the bundler:
import { PumpSwapBundler } from './src/bundler';
const config: BundleConfig = {
maxTransactions: 4,
tipAmount: 0.0001,
computeUnits: 300000,
computeUnitPrice: 696969
};
const bundler = new PumpSwapBundler(config);
- Add transactions to the bundle:
// Add transactions
bundler.addTransaction(transaction1);
bundler.addTransaction(transaction2);
- Send the bundle:
const uuid = await bundler.sendBundle(poolId, signer);
console.log('Bundle sent with UUID:', uuid);
- Clear the bundle:
bundler.clear();
Adds a transaction to the bundle.
- Throws error if bundle is full
- Automatically adds compute budget instructions
Sends the bundle to the network.
- Returns bundle UUID
- Clears bundle after sending
- Throws error if bundle is empty
Returns current number of transactions in bundle.
Clears all transactions from the bundle.
- Transactions are added to the bundle with size limits
- Each transaction gets compute budget instructions
- Bundle is created and sent through Jito
- MEV protection is applied
- Bundle is cleared after sending
- Transaction limit enforcement
- Compute budget management
- MEV protection
- Error handling for empty bundles
- Automatic bundle clearing
- Make sure you have enough SOL for:
- Transaction fees
- Compute budget
- Validator tips
- Monitor bundle size to avoid limits
- Consider network congestion when setting parameters
- Use appropriate compute units for your transactions
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 buy transaction
const buyTx = await sdk.createBuyTransaction(/* params */);
bundler.addTransaction(buyTx);
// Create sell transaction
const sellTx = await sdk.createSellTransaction(/* params */);
bundler.addTransaction(sellTx);
// Send bundle
const uuid = await bundler.sendBundle(poolId, signer);
console.log('Bundle sent:', uuid);
}
MIT License
-
npm i
-
Paste your private key and Helius RPC key in .env.copy
-
rename it to .env
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();
await pumpswap_sdk.buy(new PublicKey(mint), wallet_1.publicKey, sol_amt); // 0.99 sol
await pumpswap_sdk.sell_percentage(new PublicKey(mint), wallet_1.publicKey, sell_percentage);
await pumpswap_sdk.sell_exactAmount(new PublicKey(mint), wallet_1.publicKey, 1000); // 1000 token
}
import {getPrice} from './pool';
async function main() {
const mint = new PublicKey("your-pumpfun-token-address");
console.log(await getPrice(mint));
}
import {getPumpSwapPool} from './pool';
async function main() {
const mint = new PublicKey("your-pumpfun-token-address");
console.log(await getPumpSwapPool(mint));
}