Pump.fun Solana Program SDK
Overview
The Pump.fun Solana Program SDK is a Rust library that provides an interface for interacting with the Pump.fun Solana program. Pump.fun is a Solana-based marketplace enabling users to create and distribute their own tokens, primarily memecoins.
Installation
Add this crate to your project using cargo:
Usage
The main entry point is the PumpFun struct which provides methods for interacting with the program:
Note: The SDK automatically creates Associated Token Accounts (ATAs) when needed during buy transactions. No manual ATA creation is required.
Local Development
For local development and testing, you can use the included test validator script:
# Navigate to the scripts directory
# Run the test validator
# Or with custom options
This script automatically downloads and configures a Solana test validator with the Pump.fun program and all required dependencies.
use ;
use ;
use Arc;
# block_on
Features
- Create new tokens with metadata and custom image
- Buy tokens using SOL with automatic ATA creation
- Sell tokens for SOL with slippage protection
- Query global and bonding curve state
- Calculate prices, fees and slippage
- Priority fee support for faster transactions
- IPFS metadata storage
Feature Flags
The SDK provides several feature flags that can be enabled or disabled based on your requirements:
-
create-ata: Enabled by default. Automatically creates Associated Token Accounts (ATAs) when needed during token purchases. Disable this if you want to handle ATA creation manually. -
close-ata: Enabled by default. Automatically closes unused ATAs after selling all tokens, helping to reclaim rent. Disable to keep ATAs open after selling. -
versioned-tx: Disabled by default. Enables support for Versioned Transactions with Address Lookup Tables (ALTs), which are useful for complex transactions with many accounts. When enabled, the SDK usesVersionedTransactioninstead of legacyTransaction.
To customize feature flags in your Cargo.toml:
# Use default features (create-ata and close-ata enabled)
= "4.0.0"
# Disable all default features
= { = "4.0.0", = false }
# Custom selection of features
= { = "4.0.0", = false, = ["versioned-tx"] }
Architecture
The SDK is organized into several modules:
accounts: Account structs for deserializing on-chain statecommon: Common utility functions and typesconstants: Program constants like seeds and public keyserror: Custom error types for error handlinginstructions: Transaction instruction buildersutils: Helper functions and utilities
The main PumpFun struct provides high-level methods that abstract away the complexity of:
- Managing Program Derived Addresses (PDAs)
- Constructing and signing transactions
- Handling account lookups and deserialization
- Calculating prices, fees and slippage
- IPFS metadata uploads
- Priority fee configuration
- Associated Token Account management
Contributing
We welcome contributions! Please submit a pull request or open an issue to discuss any changes.
License
This project is licensed under either of the following licenses, at your option:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Disclaimer
This software is provided "as is," without warranty of any kind, express or implied. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software.
Use at your own risk. The authors take no responsibility for any harm or damage caused by the use of this software. Users are responsible for ensuring the suitability and safety of this software for their specific use cases.
By using this software, you acknowledge that you have read, understood, and agree to this disclaimer.