diff --git a/Cargo.toml b/Cargo.toml index 5ff6c7e..3dfc823 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sol-trade-sdk" -version = "0.2.13" +version = "0.2.14" edition = "2021" authors = ["William ", "sgxiang ", "wei <1415121722@qq.com>"] repository = "https://github.com/0xfnzero/sol-trade-sdk" diff --git a/README.md b/README.md index ad5dc0d..3d172e4 100755 --- a/README.md +++ b/README.md @@ -31,14 +31,14 @@ Add the dependency to your `Cargo.toml`: ```toml # Add to your Cargo.toml -sol-trade-sdk = { path = "./sol-trade-sdk", version = "0.2.13" } +sol-trade-sdk = { path = "./sol-trade-sdk", version = "0.2.14" } ``` ### Use crates.io ```toml # Add to your Cargo.toml -sol-trade-sdk = "0.2.13" +sol-trade-sdk = "0.2.14" ``` ## Usage Examples diff --git a/README_CN.md b/README_CN.md index 58aaefb..fae21c1 100755 --- a/README_CN.md +++ b/README_CN.md @@ -31,14 +31,14 @@ git clone https://github.com/0xfnzero/sol-trade-sdk ```toml # 添加到您的 Cargo.toml -sol-trade-sdk = { path = "./sol-trade-sdk", version = "0.2.13" } +sol-trade-sdk = { path = "./sol-trade-sdk", version = "0.2.14" } ``` ### 使用 crates.io ```toml # 添加到您的 Cargo.toml -sol-trade-sdk = "0.2.13" +sol-trade-sdk = "0.2.14" ``` ## 使用示例 diff --git a/src/swqos/jito.rs b/src/swqos/jito.rs index a4b45ee..be73870 100755 --- a/src/swqos/jito.rs +++ b/src/swqos/jito.rs @@ -78,11 +78,20 @@ impl JitoClient { ] }))?; - let endpoint = format!("{}/api/v1/transactions?uuid={}", self.endpoint, self.auth_token); - let response_text = self.http_client.post(&endpoint) + let endpoint = if self.auth_token.is_empty() { + format!("{}/api/v1/transactions", self.endpoint) + } else { + format!("{}/api/v1/transactions?uuid={}", self.endpoint, self.auth_token) + }; + let response = if self.auth_token.is_empty() { + self.http_client.post(&endpoint) + } else { + self.http_client.post(&endpoint) + .header("x-jito-auth", &self.auth_token) + }; + let response_text = response .body(request_body) .header("Content-Type", "application/json") - .header("x-jito-auth", &self.auth_token) .send() .await? .text() @@ -120,11 +129,20 @@ impl JitoClient { "id": 1, }); - let endpoint = format!("{}/api/v1/bundles?uuid={}", self.endpoint, self.auth_token); - let response_text = self.http_client.post(&endpoint) + let endpoint = if self.auth_token.is_empty() { + format!("{}/api/v1/bundles", self.endpoint) + } else { + format!("{}/api/v1/bundles?uuid={}", self.endpoint, self.auth_token) + }; + let response = if self.auth_token.is_empty() { + self.http_client.post(&endpoint) + } else { + self.http_client.post(&endpoint) + .header("x-jito-auth", &self.auth_token) + }; + let response_text = response .body(body.to_string()) .header("Content-Type", "application/json") - .header("x-jito-auth", &self.auth_token) .send() .await? .text()