refactor: optimize AccountMeta creation with lazy static constants

- Consolidate protocol constants to unified module
- Pre-build AccountMeta objects using once_cell::Lazy
- Reduce instruction building overhead across all DEX protocols
- Improve code maintainability and performance
This commit is contained in:
ysq
2025-09-07 21:36:57 +08:00
parent 51253c7aaf
commit 544e65318d
17 changed files with 323 additions and 185 deletions
+2 -1
View File
@@ -138,7 +138,8 @@ async fn raydium_cpmm_copy_trade_with_grpc(trade_info: RaydiumCpmmSwapEvent) ->
println!("Testing Raydium_cpmm trading...");
let client = create_solana_trade_client().await?;
let mint_pubkey = if trade_info.input_token_mint == accounts::WSOL_TOKEN_ACCOUNT {
let mint_pubkey = if trade_info.input_token_mint == sol_trade_sdk::constants::WSOL_TOKEN_ACCOUNT
{
trade_info.output_token_mint
} else {
trade_info.input_token_mint