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.
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "sol-trade-sdk"
|
||||
version = "1.0.0"
|
||||
version = "1.0.1"
|
||||
edition = "2021"
|
||||
authors = [
|
||||
"William <byteblock6@gmail.com>",
|
||||
|
||||
@@ -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
|
||||
|
||||
+2
-2
@@ -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"
|
||||
```
|
||||
|
||||
## 🛠️ 使用示例
|
||||
|
||||
@@ -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<u32>,
|
||||
) -> Result<Signature> {
|
||||
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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user