refactor: simplify trading API and improve configuration management

- Remove `with_tip` parameter from buy/sell methods, always use tip-enabled transactions
- Fix variable naming inconsistencies (token_amount -> amount_token)
- Add automatic padding logic for buy_tip_fees array to match swqos_configs length
- Update README examples with corrected variable references and API usage
- Fix bug in test_pumpswap() using wrong DexType (PumpFun -> PumpSwap)
- Improve API documentation with clearer parameter descriptions
- Clean up code formatting and remove unnecessary blank lines

Breaking Changes:
- buy() and sell() method signatures changed (removed with_tip parameter)
- Variable naming standardized across codebase
This commit is contained in:
ysq
2025-07-12 20:50:13 +08:00
parent c4bf62be7d
commit 461538ad90
4 changed files with 55 additions and 81 deletions
+1 -9
View File
@@ -91,7 +91,6 @@ async fn test_pumpfun_copy_trade_width_grpc(trade_info: PumpFunTradeEvent) -> An
slippage_basis_points,
recent_blockhash,
None,
false,
Some(Box::new(PumpFunParams {
bonding_curve: Some(Arc::new(bonding_curve.clone())),
})),
@@ -108,7 +107,6 @@ async fn test_pumpfun_copy_trade_width_grpc(trade_info: PumpFunTradeEvent) -> An
slippage_basis_points,
recent_blockhash,
None,
false,
None,
).await?;
@@ -146,7 +144,6 @@ async fn test_pumpfun_sniper_trade_width_shreds(trade_info: PumpFunTradeEvent) -
slippage_basis_points,
recent_blockhash,
None,
false,
Some(Box::new(PumpFunParams {
bonding_curve: Some(Arc::new(bonding_curve.clone())),
})),
@@ -163,7 +160,6 @@ async fn test_pumpfun_sniper_trade_width_shreds(trade_info: PumpFunTradeEvent) -
slippage_basis_points,
recent_blockhash,
None,
false,
None,
).await?;
@@ -183,14 +179,13 @@ async fn test_pumpswap() -> AnyResult<()> {
// Buy tokens
println!("Buying tokens from PumpSwap...");
client.buy(
DexType::PumpFun,
DexType::PumpSwap,
mint_pubkey,
Some(creator),
buy_sol_cost,
slippage_basis_points,
recent_blockhash,
None,
false,
None,
).await?;
@@ -205,7 +200,6 @@ async fn test_pumpswap() -> AnyResult<()> {
slippage_basis_points,
recent_blockhash,
None,
false,
None,
).await?;
@@ -231,7 +225,6 @@ async fn test_bonk() -> Result<(), Box<dyn std::error::Error>> {
slippage_basis_points,
recent_blockhash,
None,
false,
None,
).await?;
@@ -246,7 +239,6 @@ async fn test_bonk() -> Result<(), Box<dyn std::error::Error>> {
slippage_basis_points,
recent_blockhash,
None,
false,
None,
).await?;