refactor: unify transaction building and execution architecture

- Remove redundant transaction builder functions and merge into single build_transaction()
- Simplify compute budget manager with unified add_compute_budget_instructions()
- Consolidate trade executor interface by removing separate buy/sell methods
- Unify BuyParams/SellParams usage, remove *WithTipParams structs
- Streamline parallel execution logic and remove TradeType parameter
- Delete obsolete files: address_lookup.rs, tip_cache.rs
- Clean up nonce manager by removing unused is_using_nonce() function

This refactoring reduces code duplication and provides a cleaner, more maintainable API
for transaction building and execution across all trading protocols.
This commit is contained in:
ysq
2025-09-07 17:22:58 +08:00
parent 6e04458659
commit 90fcd5ca01
15 changed files with 176 additions and 1069 deletions
+4 -9
View File
@@ -6,6 +6,7 @@ use std::{
},
};
use sol_trade_sdk::solana_streamer_sdk::match_event;
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::protocols::pumpfun::parser::PUMPFUN_PROGRAM_ID;
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::protocols::pumpfun::PumpFunTradeEvent;
use sol_trade_sdk::solana_streamer_sdk::streaming::event_parser::{Protocol, UnifiedEvent};
@@ -13,9 +14,6 @@ use sol_trade_sdk::solana_streamer_sdk::streaming::yellowstone_grpc::{
AccountFilter, TransactionFilter,
};
use sol_trade_sdk::solana_streamer_sdk::streaming::YellowstoneGrpc;
use sol_trade_sdk::{
common::address_lookup::get_address_lookup_table, solana_streamer_sdk::match_event,
};
use sol_trade_sdk::{
common::address_lookup_cache::AddressLookupTableCache,
solana_streamer_sdk::streaming::event_parser::common::EventType,
@@ -109,13 +107,10 @@ async fn setup_lookup_table_cache(
client: Arc<SolanaRpcClient>,
lookup_table_address: Pubkey,
) -> AnyResult<()> {
let lookup_table = get_address_lookup_table(client, &lookup_table_address)
.await
.map_err(|e| anyhow::anyhow!("Failed to get address lookup table: {}", e))?;
AddressLookupTableCache::get_instance()
.add_or_update_table(lookup_table_address, Some(lookup_table));
.set_address_lookup_table(client, &lookup_table_address)
.await
.map_err(|e| anyhow::anyhow!("Failed to set address lookup table: {}", e))?;
Ok(())
}