Expand description
Rust SDK for the PumpSwap (pump-amm) AMM on Solana.
Build buy / sell / create-pool / withdraw / creator-fee-distribution
instructions, derive pool and fee PDAs, simulate or submit swaps via an
RpcClient, and
bundle through Jito.
The instruction layouts target the current pump-amm IDL: Buy uses 23
accounts (with coin_creator_vault_*, volume accumulators, fee config,
fee program), Sell uses 21. All non-input accounts are derived internally
from PoolInfo + user.
§Quickstart
use std::sync::Arc;
use solana_client::nonblocking::rpc_client::RpcClient;
use solana_sdk::commitment_config::CommitmentConfig;
use solana_sdk::pubkey::Pubkey;
use std::str::FromStr;
use pump_swap_sdk::{load_pool, PumpSwapClient};
let rpc = Arc::new(RpcClient::new_with_commitment(
rpc_url.to_string(),
CommitmentConfig::confirmed(),
));
let pool_info = load_pool(&Pubkey::from_str(pool)?, &rpc).await?;
let client = PumpSwapClient::new(rpc);
let (base, quote) = client.fetch_pool_reserves(&pool_info).await?;
println!("reserves: base={}, quote={}", base, quote);Re-exports§
pub use client::PumpSwapClient;pub use client::get_token_balance;pub use constants::BUYBACK_FEE_RECIPIENTS;pub use constants::EVENT_AUTHORITY;pub use constants::FEE_PROGRAM;pub use constants::GLOBAL_CONFIG;pub use constants::GLOBAL_VOLUME_ACCUMULATOR;pub use constants::PROTOCOL_FEE_RECIPIENTS;pub use constants::PUMP_CREATOR_VAULT;pub use constants::PUMP_SWAP_PROGRAM_ID;pub use constants::PUMPFUN_EVENT_AUTHORITY;pub use constants::PUMPFUN_PROGRAM;pub use constants::WRAPPED_SOL_MINT;pub use instruction::BuyExactQuoteInInstruction;pub use instruction::BuyInstruction;pub use instruction::ClaimCashbackInstruction;pub use instruction::CreatePoolInstruction;pub use instruction::DepositInstruction;pub use instruction::SellInstruction;pub use instruction::WithdrawInstruction;pub use instruction::create_pool_instruction;pub use instruction::distribute_creator_fees_instruction;pub use instruction::make_buy_exact_quote_in_instruction;pub use instruction::make_buy_instruction;pub use instruction::make_claim_cashback_instruction;pub use instruction::make_deposit_instruction;pub use instruction::make_sell_instruction;pub use instruction::transfer_creator_fees_to_pump_instruction;pub use instruction::withdraw_instruction;pub use math::buy_amount_out;pub use math::calc_amount_out;pub use math::sell_amount_out;pub use state::Pool;pub use state::PoolInfo;pub use util::JitoPool;pub use util::calc_lp_mint_pda;pub use util::calc_pool_pda;pub use util::calc_user_pool_token_account;pub use util::clone_keypairs;pub use util::create_ata_token_or_not;pub use util::create_ata_token_or_not_with_program;pub use util::fee_config_pda;pub use util::find_coin_creator_vault_ata;pub use util::find_user_vol_accumulator;pub use util::gen_pubkey_with_seed;pub use util::load_pool;pub use util::load_pool_with_token_program;pub use util::pick_buyback_fee_recipient;pub use util::pick_protocol_fee_recipient;pub use util::pool_v2_pda;pub use util::send_bundle_with_retry;pub use util::send_jito_bundle;pub use util::user_volume_accumulator_quote_ata;