From 858c0e57007a066fabd40201625e3e6a6ffcbbc6 Mon Sep 17 00:00:00 2001 From: William Date: Sat, 25 Jan 2025 16:01:16 +0800 Subject: [PATCH] fix jito buy --- src/common/logs_subscribe.rs | 10 ++++++---- src/lib.rs | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/common/logs_subscribe.rs b/src/common/logs_subscribe.rs index aa6c8a6..8578e7b 100755 --- a/src/common/logs_subscribe.rs +++ b/src/common/logs_subscribe.rs @@ -12,6 +12,8 @@ use crate::{constants, common::{ logs_data::DexInstruction, logs_events::DexEvent, logs_filters::LogFilter }}; +use super::logs_events::PumpfunEvent; + /// Subscription handle containing task and unsubscribe logic pub struct SubscriptionHandle { pub task: JoinHandle<()>, @@ -37,7 +39,7 @@ pub async fn tokens_subscription( bot_wallet: Option, ) -> Result> where - F: Fn(DexEvent) + Send + Sync + 'static, + F: Fn(PumpfunEvent) + Send + Sync + 'static, { let program_address = constants::accounts::PUMPFUN.to_string(); let logs_filter = RpcTransactionLogsFilter::Mentions(vec![program_address]); @@ -70,13 +72,13 @@ where for instruction in instructions { match instruction { DexInstruction::CreateToken(token_info) => { - callback(DexEvent::NewToken(token_info)); + callback(PumpfunEvent::NewToken(token_info)); } DexInstruction::UserTrade(trade_info) => { - callback(DexEvent::NewUserTrade(trade_info)); + callback(PumpfunEvent::NewUserTrade(trade_info)); } DexInstruction::BotTrade(trade_info) => { - callback(DexEvent::NewBotTrade(trade_info)); + callback(PumpfunEvent::NewBotTrade(trade_info)); } _ => {} } diff --git a/src/lib.rs b/src/lib.rs index 2db6163..16c4bb2 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -23,7 +23,7 @@ use spl_associated_token_account::{ instruction::create_associated_token_account, }; -use common::logs_subscribe; +use common::{logs_events::PumpfunEvent, logs_subscribe}; use common::logs_subscribe::SubscriptionHandle; use common::logs_events::DexEvent; use spl_token::instruction::close_account; @@ -590,7 +590,7 @@ impl PumpFun { bot_wallet: Option, ) -> Result> where - F: Fn(DexEvent) + Send + Sync + 'static, + F: Fn(PumpfunEvent) + Send + Sync + 'static, { logs_subscribe::tokens_subscription(ws_url, commitment, callback, bot_wallet).await }