Compare commits

...

1 Commits

Author SHA1 Message Date
0xfnzero e5e58bef89 Release sol-trade-sdk v4.0.16 2026-06-06 12:31:08 +08:00
5 changed files with 63 additions and 8 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "sol-trade-sdk"
version = "4.0.15"
version = "4.0.16"
edition = "2021"
authors = [
"William <byteblock6@gmail.com>",
+3 -3
View File
@@ -81,7 +81,7 @@ This SDK is available in multiple languages:
## 🔖 Current Release
**Rust crate:** `sol-trade-sdk = "4.0.15"`
**Rust crate:** `sol-trade-sdk = "4.0.16"`
This release refreshes PumpFun V2 and USDC quote-pool handling, keeps the default RPC submit lane active alongside SWQoS lanes, restores the fast-submit result window to 5 seconds, and aligns Raydium CPMM fixed-output swaps with the on-chain `swap_base_out` instruction. Trade execution requires a caller-supplied `recent_blockhash` or durable nonce; hot-path execution does not query RPC for blockhash, account, or balance data.
@@ -115,14 +115,14 @@ Add the dependency to your `Cargo.toml`:
```toml
# Add to your Cargo.toml
sol-trade-sdk = { path = "./sol-trade-sdk", version = "4.0.15" }
sol-trade-sdk = { path = "./sol-trade-sdk", version = "4.0.16" }
```
### Use crates.io
```toml
# Add to your Cargo.toml
sol-trade-sdk = "4.0.15"
sol-trade-sdk = "4.0.16"
```
## 🛠️ Usage Examples
+3 -3
View File
@@ -81,7 +81,7 @@
## 🔖 当前版本
**Rust crate:** `sol-trade-sdk = "4.0.15"`
**Rust crate:** `sol-trade-sdk = "4.0.16"`
本版本刷新 PumpFun V2 与 USDC quote 池处理逻辑,确保默认 RPC 提交通道会和 SWQoS 通道一起发出,快速提交结果等待窗口恢复为 5 秒,并将 Raydium CPMM fixed-output 交易对齐到链上 `swap_base_out` 指令。交易执行必须由调用方传入 `recent_blockhash` 或 durable nonce;热路径不会查询 RPC 获取 blockhash、账户或余额数据。
@@ -115,14 +115,14 @@ git clone https://github.com/0xfnzero/sol-trade-sdk
```toml
# 添加到您的 Cargo.toml
sol-trade-sdk = { path = "./sol-trade-sdk", version = "4.0.15" }
sol-trade-sdk = { path = "./sol-trade-sdk", version = "4.0.16" }
```
### 使用 crates.io
```toml
# 添加到您的 Cargo.toml
sol-trade-sdk = "4.0.15"
sol-trade-sdk = "4.0.16"
```
## 🛠️ 使用示例
+17
View File
@@ -1180,6 +1180,23 @@ mod tests {
assert_eq!(ix.accounts.len(), 18);
}
#[test]
fn pumpfun_rpc_sol_sentinel_quote_mint_selects_v1() {
let mut params = swap_params_for_buy(pump_mint(), TOKEN_PROGRAM);
params.create_output_mint_ata = false;
if let DexParamEnum::PumpFun(protocol_params) = &mut params.protocol_params {
protocol_params.quote_mint = crate::constants::SOL_TOKEN_ACCOUNT;
assert_eq!(protocol_params.quote_mint, crate::constants::SOL_TOKEN_ACCOUNT);
}
let ix = build_buy(&params).unwrap().pop().unwrap();
assert_eq!(
&ix.data[..8],
crate::instruction::utils::pumpfun::BUY_EXACT_SOL_IN_DISCRIMINATOR
);
assert_eq!(ix.accounts.len(), 18);
}
#[test]
fn pumpfun_v2_usdc_buy_rejects_sol_input() {
let mut params = swap_params_for_buy(pump_mint(), TOKEN_PROGRAM);
+39 -1
View File
@@ -57,6 +57,15 @@ impl PumpFunParams {
}
}
#[inline]
fn quote_mint_for_rpc_return(quote_mint: Pubkey) -> Pubkey {
if quote_mint == Pubkey::default() || quote_mint == crate::constants::SOL_TOKEN_ACCOUNT {
crate::constants::SOL_TOKEN_ACCOUNT
} else {
BondingCurveAccount::normalize_quote_mint(quote_mint)
}
}
pub fn immediate_sell(
creator_vault: Pubkey,
token_program: Pubkey,
@@ -320,7 +329,7 @@ impl PumpFunParams {
close_token_account_when_sell: None,
token_program: mint_account.owner,
fee_recipient: Pubkey::default(),
quote_mint: Self::quote_mint_for_layout(quote_mint),
quote_mint: Self::quote_mint_for_rpc_return(quote_mint),
})
}
@@ -395,3 +404,32 @@ impl PumpFunParams {
self
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn rpc_return_quote_mint_normalizes_legacy_sol_to_sol_sentinel() {
assert_eq!(
PumpFunParams::quote_mint_for_rpc_return(Pubkey::default()),
crate::constants::SOL_TOKEN_ACCOUNT
);
assert_eq!(
PumpFunParams::quote_mint_for_rpc_return(crate::constants::SOL_TOKEN_ACCOUNT),
crate::constants::SOL_TOKEN_ACCOUNT
);
}
#[test]
fn rpc_return_quote_mint_keeps_real_quote_mints() {
assert_eq!(
PumpFunParams::quote_mint_for_rpc_return(crate::constants::USDC_TOKEN_ACCOUNT),
crate::constants::USDC_TOKEN_ACCOUNT
);
assert_eq!(
PumpFunParams::quote_mint_for_rpc_return(crate::constants::WSOL_TOKEN_ACCOUNT),
crate::constants::WSOL_TOKEN_ACCOUNT
);
}
}