Rename use_exact_in_instruction to use_exact_sol_amount
More intuitive name that better describes what the flag does. 🤖 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_in_instruction {
|
||||
if params.use_exact_sol_amount {
|
||||
// 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_in_instruction {
|
||||
if params.use_exact_sol_amount {
|
||||
// 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(
|
||||
|
||||
+4
-4
@@ -187,10 +187,10 @@ pub struct TradeBuyParams {
|
||||
pub gas_fee_strategy: GasFeeStrategy,
|
||||
/// Whether to simulate the transaction instead of executing it
|
||||
pub simulate: bool,
|
||||
/// Use exact input instructions (buy_exact_sol_in for PumpFun, buy_exact_quote_in for PumpSwap).
|
||||
/// 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_in_instruction: bool,
|
||||
pub use_exact_sol_amount: bool,
|
||||
}
|
||||
|
||||
/// Parameters for executing sell orders across different DEX protocols
|
||||
@@ -512,7 +512,7 @@ impl TradingClient {
|
||||
fixed_output_amount: params.fixed_output_token_amount,
|
||||
gas_fee_strategy: params.gas_fee_strategy,
|
||||
simulate: params.simulate,
|
||||
use_exact_in_instruction: params.use_exact_in_instruction,
|
||||
use_exact_sol_amount: params.use_exact_sol_amount,
|
||||
};
|
||||
|
||||
// Validate protocol params
|
||||
@@ -622,7 +622,7 @@ impl TradingClient {
|
||||
fixed_output_amount: params.fixed_output_token_amount,
|
||||
gas_fee_strategy: params.gas_fee_strategy,
|
||||
simulate: params.simulate,
|
||||
use_exact_in_instruction: false,
|
||||
use_exact_sol_amount: false,
|
||||
};
|
||||
|
||||
// Validate protocol params
|
||||
|
||||
@@ -67,10 +67,10 @@ pub struct SwapParams {
|
||||
pub fixed_output_amount: Option<u64>,
|
||||
pub gas_fee_strategy: GasFeeStrategy,
|
||||
pub simulate: bool,
|
||||
/// Use exact input instructions (buy_exact_sol_in for PumpFun, buy_exact_quote_in for PumpSwap).
|
||||
/// 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_in_instruction: bool,
|
||||
pub use_exact_sol_amount: bool,
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for SwapParams {
|
||||
|
||||
Reference in New Issue
Block a user