Release sol-trade-sdk v4.0.16
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "sol-trade-sdk"
|
name = "sol-trade-sdk"
|
||||||
version = "4.0.15"
|
version = "4.0.16"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = [
|
authors = [
|
||||||
"William <byteblock6@gmail.com>",
|
"William <byteblock6@gmail.com>",
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ This SDK is available in multiple languages:
|
|||||||
|
|
||||||
## 🔖 Current Release
|
## 🔖 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.
|
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
|
```toml
|
||||||
# Add to your Cargo.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
|
### Use crates.io
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
# Add to your Cargo.toml
|
# Add to your Cargo.toml
|
||||||
sol-trade-sdk = "4.0.15"
|
sol-trade-sdk = "4.0.16"
|
||||||
```
|
```
|
||||||
|
|
||||||
## 🛠️ Usage Examples
|
## 🛠️ Usage Examples
|
||||||
|
|||||||
+3
-3
@@ -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、账户或余额数据。
|
本版本刷新 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
|
```toml
|
||||||
# 添加到您的 Cargo.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
|
### 使用 crates.io
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
# 添加到您的 Cargo.toml
|
# 添加到您的 Cargo.toml
|
||||||
sol-trade-sdk = "4.0.15"
|
sol-trade-sdk = "4.0.16"
|
||||||
```
|
```
|
||||||
|
|
||||||
## 🛠️ 使用示例
|
## 🛠️ 使用示例
|
||||||
|
|||||||
@@ -1180,6 +1180,23 @@ mod tests {
|
|||||||
assert_eq!(ix.accounts.len(), 18);
|
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(¶ms).unwrap().pop().unwrap();
|
||||||
|
assert_eq!(
|
||||||
|
&ix.data[..8],
|
||||||
|
crate::instruction::utils::pumpfun::BUY_EXACT_SOL_IN_DISCRIMINATOR
|
||||||
|
);
|
||||||
|
assert_eq!(ix.accounts.len(), 18);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn pumpfun_v2_usdc_buy_rejects_sol_input() {
|
fn pumpfun_v2_usdc_buy_rejects_sol_input() {
|
||||||
let mut params = swap_params_for_buy(pump_mint(), TOKEN_PROGRAM);
|
let mut params = swap_params_for_buy(pump_mint(), TOKEN_PROGRAM);
|
||||||
|
|||||||
@@ -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(
|
pub fn immediate_sell(
|
||||||
creator_vault: Pubkey,
|
creator_vault: Pubkey,
|
||||||
token_program: Pubkey,
|
token_program: Pubkey,
|
||||||
@@ -320,7 +329,7 @@ impl PumpFunParams {
|
|||||||
close_token_account_when_sell: None,
|
close_token_account_when_sell: None,
|
||||||
token_program: mint_account.owner,
|
token_program: mint_account.owner,
|
||||||
fee_recipient: Pubkey::default(),
|
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
|
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
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user