From 1192730e222e9a67400b812bcd290ed47588a270 Mon Sep 17 00:00:00 2001 From: ysq Date: Sun, 14 Sep 2025 23:28:45 +0800 Subject: [PATCH] feat: upgrade to v0.6.12 --- Cargo.toml | 4 ++-- README.md | 4 ++-- README_CN.md | 4 ++-- src/trading/common/transaction_builder.rs | 18 +++++++++--------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c05f4ba..a66e07e 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sol-trade-sdk" -version = "0.6.11" +version = "0.6.12" edition = "2021" authors = [ "William ", @@ -37,7 +37,7 @@ members = [ crate-type = ["cdylib", "rlib"] [dependencies] -solana-streamer-sdk = "0.4.9" +solana-streamer-sdk = "0.4.10" solana-sdk = "2.3.0" solana-client = "2.3.6" solana-program = "2.3.0" diff --git a/README.md b/README.md index 170d719..b5ecb83 100644 --- a/README.md +++ b/README.md @@ -90,14 +90,14 @@ Add the dependency to your `Cargo.toml`: ```toml # Add to your Cargo.toml -sol-trade-sdk = { path = "./sol-trade-sdk", version = "0.6.11" } +sol-trade-sdk = { path = "./sol-trade-sdk", version = "0.6.12" } ``` ### Use crates.io ```toml # Add to your Cargo.toml -sol-trade-sdk = "0.6.11" +sol-trade-sdk = "0.6.12" ``` ## 🛠️ Usage Examples diff --git a/README_CN.md b/README_CN.md index db7c7c2..5f02d06 100755 --- a/README_CN.md +++ b/README_CN.md @@ -89,14 +89,14 @@ git clone https://github.com/0xfnzero/sol-trade-sdk ```toml # 添加到您的 Cargo.toml -sol-trade-sdk = { path = "./sol-trade-sdk", version = "0.6.11" } +sol-trade-sdk = { path = "./sol-trade-sdk", version = "0.6.12" } ``` ### 使用 crates.io ```toml # 添加到您的 Cargo.toml -sol-trade-sdk = "0.6.11" +sol-trade-sdk = "0.6.12" ``` ## 🛠️ 使用示例 diff --git a/src/trading/common/transaction_builder.rs b/src/trading/common/transaction_builder.rs index a39cc55..bf2029f 100755 --- a/src/trading/common/transaction_builder.rs +++ b/src/trading/common/transaction_builder.rs @@ -42,6 +42,15 @@ pub async fn build_transaction( } } + // Add tip transfer instruction + if with_tip && tip_amount > 0.0 { + instructions.push(transfer( + &payer.pubkey(), + tip_account, + sol_str_to_lamports(tip_amount.to_string().as_str()).unwrap_or(0), + )); + } + // Add compute budget instructions instructions.extend(compute_budget_instructions( priority_fee, @@ -53,15 +62,6 @@ pub async fn build_transaction( // Add business instructions instructions.extend(business_instructions); - // Add tip transfer instruction - if with_tip && tip_amount > 0.0 { - instructions.push(transfer( - &payer.pubkey(), - tip_account, - sol_str_to_lamports(tip_amount.to_string().as_str()).unwrap_or(0), - )); - } - // Get blockhash for transaction let blockhash = if is_buy { get_transaction_blockhash(recent_blockhash) } else { recent_blockhash };