Skip to content

keidev-sol/Pumpswap-Migration-Bundler-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pumpfun to Pumpswap Migration Bundler

An automated Solana bot that bundles and executes token migration transactions from Pumpfun to Pumpswap using Jito bundles for optimal transaction sequencing and execution speed.

Overview

This bot automates the process of buying tokens on Pumpfun and migrating them to Pumpswap in a single atomic transaction bundle. By leveraging Jito's transaction bundling service, it ensures that both the buy and migration operations execute together, providing better transaction reliability and reduced risk of front-running.

Features

  • Atomic Bundling: Executes buy and migration as a single bundle using Jito
  • Transaction Reliability: Ensures buy and migrate operations succeed or fail together
  • MEV Protection: Uses Jito tip accounts for priority block inclusion
  • Type-Safe: Built with TypeScript and Anchor program types
  • Modular Architecture: Clean separation of concerns with organized code structure

How It Works

  1. Buy Transaction: Creates a transaction to purchase tokens on Pumpfun's bonding curve
  2. Migration Transaction: Generates a transaction to migrate tokens from Pumpfun to Pumpswap
  3. Bundle Creation: Packages both transactions with a Jito tip into a single bundle
  4. Execution: Sends the bundle to Jito for atomic execution on Solana

The bot ensures that both operations either succeed together or fail together, preventing partial executions that could leave tokens in an undesirable state.

Project Structure

├── config/              # Configuration and constants
│   ├── constants.ts    # Environment variables and settings
│   └── index.ts        # Config exports
├── src/
│   ├── lib/            # Transaction builders
│   │   ├── pumpfun.ts  # Pumpfun transaction creation
│   │   ├── swap.ts     # Pumpswap transaction creation
│   │   └── index.ts    # Library exports
│   └── bundler/        # Jito bundling logic
│       └── index.ts    # Bundle sending functionality
├── contracts/          # Program IDLs and types
│   ├── pumpfun-idl.json
│   ├── pumpswap-idl.json
│   └── *.ts            # TypeScript type definitions
├── utils/              # Utility functions
│   ├── utils.ts        # Helper functions
│   └── index.ts        # Utils exports
├── index.ts            # Main entry point
└── package.json        # Dependencies

Setup

Prerequisites

  • Node.js 18+ and npm
  • Solana CLI tools
  • Environment variables configured

Installation

npm install

Configuration

Create a .env file with the following variables:

# Wallet
PRIVATE_KEY=your_base58_encoded_private_key

# RPC Endpoints
RPC_ENDPOINT=https://your-rpc-endpoint
RPC_WEBSOCKET_ENDPOINT=wss://your-websocket-endpoint

# Token Configuration
TOKEN_MINT=token_mint_address_to_migrate

# Optional Configuration
JITO_TIP=0.001
FEE_RECIPIENT=CebN5WGQ4jvEPvsVU4EoHEpgzq1VV7AbicfhtPY2dH3w

# Pumpswap Configuration (required if using swap functions)
GLOBAL_CONFIG=global_config_address
PROTOCOL_FEE_RECIPIENT=protocol_fee_recipient_address
PUMP_AMM_PROGRAM_ID=pump_amm_program_id

Contract Files

Ensure the following files are present in the contracts/ directory:

  • pumpfun-idl.json - Pumpfun program IDL
  • pumpswap-idl.json - Pumpswap program IDL
  • pumpfun-types.ts - TypeScript types for Pumpfun
  • pumpswap-types.ts - TypeScript types for Pumpswap
  • pumpswap.ts - Pumpswap program type definitions

Usage

Run the migration bundler:

npm start

The bot will:

  1. Connect to the specified RPC endpoint
  2. Verify the bonding curve pool exists
  3. Create buy and migration transactions
  4. Bundle them with a Jito tip
  5. Send the bundle for execution

Key Components

Transaction Builders (src/lib/)

  • Pumpfun Operations: Create buy and migrate transactions for Pumpfun tokens
  • Pumpswap Operations: Create buy/sell transactions for Pumpswap AMM (available but not used in main flow)

Bundler (src/bundler/)

Handles Jito bundle creation and submission, ensuring transactions are sent as atomic units.

Configuration (config/)

Centralized configuration management with environment variable handling and type-safe constants.

Architecture Decisions

  • Modular Design: Separates transaction building, bundling, and configuration for maintainability
  • Type Safety: Uses Anchor-generated types for program interactions
  • Error Handling: Comprehensive error handling with null checks and transaction validation
  • Jito Integration: Leverages Jito for reliable transaction bundling and MEV protection

Security Considerations

  • Private keys should never be committed to version control
  • Use environment variables or secure key management systems
  • Review all transactions before execution in production
  • Ensure sufficient SOL balance for fees and Jito tips

Dependencies

Key dependencies include:

  • @solana/web3.js - Solana JavaScript SDK
  • @coral-xyz/anchor - Anchor framework for Solana programs
  • jito-ts - Jito transaction bundling SDK
  • @solana/spl-token - SPL token program utilities

Contact

About

Automated Solana bot for migrating tokens from Pumpfun to Pumpswap using Jito bundles.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors