pumpfun-rust-client docs
nirholas / pumpfun-rust-client

pumpfun-rust-client

Rust SDK for the pump bonding curve and PumpSwap (pump_amm) Solana programs: instruction builders, quoting that matches the programs to the lamport, and an RPC client that turns a mint into signed-ready instructions. Tracks pump-rust-client 0.4.0.

Rust 1.89+pump-rust-client 0.4.0Solana
pump-rust-client = { git = "https://github.com/nirholas/pumpfun-rust-client", features = ["client"] }

What it does

Capabilities documented in this repository.

v3 curve trades

buy_v3, buy_exact_quote_in_v3 and sell_v3 builders, with fees left in the curve's buckets and the buyback paid in the trade.

Synthetic migration quotes

buy_quote_bonding_curve_v3_sol_in and _token_out price the buy that empties a curve, including the part bought from the pool the migration will create.

PumpSwap v2 and multi-hop

v2 pool trades, multi_hop_swap route discovery and quoting, and coins quoted in another pump coin.

Signed virtual reserves

PumpSwap quotes price on the vault plus the signed i128 Pool.virtual_quote_reserves and pay sells from the vault less the fee buckets.

Fee sweeps

sweep_creator_fee and sweep_pool_creator_fee builders, prepended automatically where the programs require an empty bucket.

AsyncPumpClient

Fetches every account a trade needs in one round trip, quotes with slippage and returns instructions ready to sign.

Get started

Clone, build and run the unit tests, which check every quote path against the published formulas.

git clone https://github.com/nirholas/pumpfun-rust-client.git
cd pumpfun-rust-client
cargo build --locked
cargo test --locked

Read the full getting started guide

Examples

Quote a v3 buy, then build it.

let s = client.fetch_curve_quote_state(&mint).await?;
let quote = client.sdk().buy_quote_bonding_curve_v3_sol_in(
    &s.global, &s.fee_config, &s.bonding_curve,
    s.mint_supply, s.base_ata_amount,
    LAMPORTS_PER_SOL, 100,
)?;
let (quote, ixs) = client
    .build_buy_exact_quote_in_v3(&user, &mint, LAMPORTS_PER_SOL, 100)
    .await?;

More examples

Reference