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:
@@ -118,7 +118,7 @@ impl InstructionBuilder for PumpFunInstructionBuilder {
|
||||
}
|
||||
|
||||
let mut buy_data = [0u8; 24];
|
||||
if params.use_exact_sol_amount {
|
||||
if params.use_exact_sol_amount.unwrap_or(true) {
|
||||
// buy_exact_sol_in(spendable_sol_in: u64, min_tokens_out: u64)
|
||||
// Spend exactly the input SOL amount, get at least min_tokens_out
|
||||
let min_tokens_out = calculate_with_slippage_sell(
|
||||
|
||||
@@ -187,7 +187,7 @@ impl InstructionBuilder for PumpSwapInstructionBuilder {
|
||||
// Create instruction data
|
||||
let mut data = [0u8; 24];
|
||||
if quote_is_wsol_or_usdc {
|
||||
if params.use_exact_sol_amount {
|
||||
if params.use_exact_sol_amount.unwrap_or(true) {
|
||||
// buy_exact_quote_in(spendable_quote_in: u64, min_base_amount_out: u64)
|
||||
// Spend exactly the input SOL/quote amount, get at least min_base_amount_out
|
||||
let min_base_amount_out = crate::utils::calc::common::calculate_with_slippage_sell(
|
||||
|
||||
Reference in New Issue
Block a user