Make use_exact_sol_amount optional with true default for PumpFun/PumpSwap

- Change use_exact_sol_amount from bool to Option<bool>
- Default to true (via unwrap_or) for PumpFun and PumpSwap DEXes
- Option is ignored for other DEXes (Raydium, Bonk, Meteora)
- Update all examples to use None (which defaults to true for applicable DEXes)
- Update README documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
vibes
2026-01-06 11:53:09 +00:00
co-authored by Claude Opus 4.5
parent ea22d48919
commit c7f694e9a0
20 changed files with 31 additions and 9 deletions
+5 -4
View File
@@ -188,9 +188,10 @@ pub struct TradeBuyParams {
/// Whether to simulate the transaction instead of executing it
pub simulate: bool,
/// Use exact SOL amount instructions (buy_exact_sol_in for PumpFun, buy_exact_quote_in for PumpSwap).
/// When true, the exact SOL/quote amount is spent and slippage is applied to output tokens.
/// When false (default), uses regular buy instruction where slippage is applied to SOL/quote input.
pub use_exact_sol_amount: bool,
/// When Some(true) or None (default), the exact SOL/quote amount is spent and slippage is applied to output tokens.
/// When Some(false), uses regular buy instruction where slippage is applied to SOL/quote input.
/// This option only applies to PumpFun and PumpSwap DEXes; it is ignored for other DEXes.
pub use_exact_sol_amount: Option<bool>,
}
/// Parameters for executing sell orders across different DEX protocols
@@ -622,7 +623,7 @@ impl TradingClient {
fixed_output_amount: params.fixed_output_token_amount,
gas_fee_strategy: params.gas_fee_strategy,
simulate: params.simulate,
use_exact_sol_amount: false,
use_exact_sol_amount: None,
};
// Validate protocol params