feat: upgrade to v3.3.1 with enhanced error handling

Major changes:
- Bump version from 3.3.0 to 3.3.1
- Update GasFeeStrategy API with min/max data size parameters
- Enhance trade return values with Optional<anyhow::Error> in buy/sell/sell_percent methods
- Fix PumpFun Mayhem mode fee recipient constant bug
- Standardize gas fee strategy parameters across all examples
- Update all examples to handle new triple return value (bool, Signature, Option<Error>)
This commit is contained in:
ysq
2025-11-16 23:46:58 +08:00
parent 5c99a31179
commit bee7f5b78c
23 changed files with 62 additions and 60 deletions
+4 -4
View File
@@ -44,7 +44,7 @@ impl GenericTradeExecutor {
#[async_trait::async_trait]
impl TradeExecutor for GenericTradeExecutor {
async fn swap(&self, params: SwapParams) -> Result<(bool, Signature)> {
async fn swap(&self, params: SwapParams) -> Result<(bool, Signature, Option<anyhow::Error>)> {
let total_start = Instant::now();
// 判断买卖方向
@@ -201,7 +201,7 @@ async fn simulate_transaction(
is_buy: bool,
with_tip: bool,
gas_fee_strategy: GasFeeStrategy,
) -> Result<(bool, Signature)> {
) -> Result<(bool, Signature, Option<anyhow::Error>)> {
use crate::trading::common::build_transaction;
use solana_client::rpc_config::RpcSimulateTransactionConfig;
use solana_commitment_config::CommitmentLevel;
@@ -288,7 +288,7 @@ async fn simulate_transaction(
}
println!("=========================================\n");
return Ok((false, signature));
return Ok((false, signature, Some(anyhow::anyhow!("{:?}", err))));
}
// Simulation succeeded
@@ -308,5 +308,5 @@ async fn simulate_transaction(
println!("============================================\n");
Ok((true, signature))
Ok((true, signature, None))
}