refactor: unify trading parameters and add USD1 token pool support
- Merge BuyParams and SellParams into unified SwapParams structure - Add USD1 token pool support with related constants and configurations - Refactor trade executor by combining buy_with_tip and sell_with_tip into swap method - Update all protocol instruction builders to support new parameter structure - Standardize ATA creation/closing parameter naming conventions - Update example code to use new API interfaces - Optimize trading logic with automatic direction detection based on input token type
This commit is contained in:
@@ -694,7 +694,7 @@ async fn handle_buy_bonk(
|
||||
println!(" Slippage: {}%", slippage.unwrap());
|
||||
}
|
||||
let mint_pubkey = Pubkey::from_str(mint)?;
|
||||
let param = BonkParams::from_mint_by_rpc(&client.rpc, &mint_pubkey).await?;
|
||||
let param = BonkParams::from_mint_by_rpc(&client.rpc, &mint_pubkey, false).await?;
|
||||
let recent_blockhash = client.rpc.get_latest_blockhash().await?;
|
||||
let sol_lamports = sol_str_to_lamports(sol_amount.to_string().as_str()).unwrap();
|
||||
|
||||
@@ -1059,7 +1059,7 @@ async fn handle_sell_bonk(
|
||||
}
|
||||
let client = initialize_real_client().await?;
|
||||
let mint_pubkey = Pubkey::from_str(mint)?;
|
||||
let param = BonkParams::from_mint_by_rpc(&client.rpc, &mint_pubkey).await?;
|
||||
let param = BonkParams::from_mint_by_rpc(&client.rpc, &mint_pubkey, false).await?;
|
||||
let recent_blockhash = client.rpc.get_latest_blockhash().await?;
|
||||
|
||||
let sell_params = TradeSellParams {
|
||||
|
||||
Reference in New Issue
Block a user