From 008694daf813e75b8c33b13e973d960a94ed60b3 Mon Sep 17 00:00:00 2001 From: wood Date: Fri, 12 Sep 2025 04:29:47 +0800 Subject: [PATCH] fix swqos tips index errors --- src/lib.rs | 1 + src/trading/core/parallel.rs | 8 +++++++- src/trading/core/params.rs | 12 ++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 4a8a57b..5703888 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -295,6 +295,7 @@ impl SolanaTrade { create_wsol_ata, close_wsol_ata, }; + if custom_priority_fee.is_some() { sell_params.priority_fee = Arc::new(custom_priority_fee.unwrap()); } diff --git a/src/trading/core/parallel.rs b/src/trading/core/parallel.rs index a023c5e..27ff195 100755 --- a/src/trading/core/parallel.rs +++ b/src/trading/core/parallel.rs @@ -110,7 +110,13 @@ async fn parallel_execute( let tip_account_str = swqos_client.get_tip_account()?; let tip_account = Arc::new(Pubkey::from_str(&tip_account_str).unwrap_or_default()); - let tip_amount = if with_tip { priority_fee.buy_tip_fees[i] } else { 0.0 }; + + let tip_amount = if priority_fee.buy_tip_fees.len() > i { + priority_fee.buy_tip_fees[i] + } else { + priority_fee.buy_tip_fees[0] + }; + let tip_amount = if with_tip { tip_amount } else { 0.0 }; let transaction = build_transaction( payer, diff --git a/src/trading/core/params.rs b/src/trading/core/params.rs index 99a85e0..1d4814c 100755 --- a/src/trading/core/params.rs +++ b/src/trading/core/params.rs @@ -58,6 +58,18 @@ pub struct SellParams { pub close_wsol_ata: bool, } +impl std::fmt::Debug for BuyParams { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "BuyParams: {:?}", self) + } +} + +impl std::fmt::Debug for SellParams { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "SellParams: {:?}", self) + } +} + /// PumpFun protocol specific parameters /// Configuration parameters specific to PumpFun trading protocol #[derive(Clone)]