From da28f40889a7673ccb4cfc410066b557fb5cb7c6 Mon Sep 17 00:00:00 2001 From: ysq Date: Wed, 17 Sep 2025 00:26:51 +0800 Subject: [PATCH] feat: v1.0.1 - add custom compute unit limit support Add custom_cu_limit parameter to parallel trading functions, allowing users to override default compute unit limits for both buy and sell operations. --- Cargo.toml | 2 +- README.md | 4 ++-- README_CN.md | 4 ++-- src/trading/core/parallel.rs | 9 ++++++++- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b35b4dd..38f918e 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sol-trade-sdk" -version = "1.0.0" +version = "1.0.1" edition = "2021" authors = [ "William ", diff --git a/README.md b/README.md index 39ed699..c18e8fd 100644 --- a/README.md +++ b/README.md @@ -87,14 +87,14 @@ Add the dependency to your `Cargo.toml`: ```toml # Add to your Cargo.toml -sol-trade-sdk = { path = "./sol-trade-sdk", version = "1.0.0" } +sol-trade-sdk = { path = "./sol-trade-sdk", version = "1.0.1" } ``` ### Use crates.io ```toml # Add to your Cargo.toml -sol-trade-sdk = "1.0.0" +sol-trade-sdk = "1.0.1" ``` ## 🛠️ Usage Examples diff --git a/README_CN.md b/README_CN.md index a191f77..6953b1c 100755 --- a/README_CN.md +++ b/README_CN.md @@ -87,14 +87,14 @@ git clone https://github.com/0xfnzero/sol-trade-sdk ```toml # 添加到您的 Cargo.toml -sol-trade-sdk = { path = "./sol-trade-sdk", version = "1.0.0" } +sol-trade-sdk = { path = "./sol-trade-sdk", version = "1.0.1" } ``` ### 使用 crates.io ```toml # 添加到您的 Cargo.toml -sol-trade-sdk = "1.0.0" +sol-trade-sdk = "1.0.1" ``` ## 🛠️ 使用示例 diff --git a/src/trading/core/parallel.rs b/src/trading/core/parallel.rs index 9ec16c6..0d2122a 100755 --- a/src/trading/core/parallel.rs +++ b/src/trading/core/parallel.rs @@ -31,6 +31,7 @@ pub async fn buy_parallel_execute( true, params.wait_transaction_confirmed, true, + params.custom_cu_limit, ) .await } @@ -52,6 +53,7 @@ pub async fn sell_parallel_execute( false, params.wait_transaction_confirmed, params.with_tip, + params.custom_cu_limit, ) .await } @@ -69,6 +71,7 @@ async fn parallel_execute( is_buy: bool, wait_transaction_confirmed: bool, with_tip: bool, + custom_cu_limit: Option, ) -> Result { if swqos_settings.is_empty() { return Err(anyhow!("swqos_settings is empty")); @@ -101,9 +104,13 @@ async fn parallel_execute( let swqos_client = swqos_client.clone(); let buy_tip_fee = swqos_settings[i].buy_tip_fee; let sell_tip_fee = swqos_settings[i].sell_tip_fee; - let unit_limit = swqos_settings[i].unit_limit; + let mut unit_limit = swqos_settings[i].unit_limit; let unit_price = swqos_settings[i].unit_price; + if let Some(custom_cu_limit) = custom_cu_limit { + unit_limit = custom_cu_limit; + } + let handle = tokio::spawn(async move { core_affinity::set_for_current(core_id);