feat: Pump.fun mayhem_mode, Solana 3.1.12, TradeConfig builder alignment

- PumpFunParams::from_trade/from_dev_trade: add mayhem_mode Option; infer Mayhem
  via is_mayhem_fee_recipient when None (fixes fee recipient / NotAuthorized 6000
  when AMM protocol fee pubkey is used).
- Add is_mayhem_fee_recipient and is_amm_fee_recipient helpers in pumpfun utils.
- Bump solana-* crates to 3.1.12; align tonic/prost; use solana-message for
  AddressLookupTableAccount; add solana-system-interface 3.0.
- Update examples and latency script for new PumpFunParams signature.
- SWQoS and transaction builder adjustments for dependency changes.

Made-with: Cursor
This commit is contained in:
0xfnzero
2026-04-11 18:43:18 +08:00
parent 8f2f99f3d9
commit 4b451af5ff
24 changed files with 272 additions and 77 deletions
+14 -14
View File
@@ -1,8 +1,5 @@
use crate::common::SolanaRpcClient;
use solana_hash::Hash;
use solana_nonce::state::State;
use solana_nonce::versions::Versions;
use solana_sdk::account_utils::StateMut;
use solana_sdk::pubkey::Pubkey;
use tracing::error;
@@ -21,18 +18,21 @@ pub async fn fetch_nonce_info(
nonce_account: Pubkey,
) -> Option<DurableNonceInfo> {
match rpc.get_account(&nonce_account).await {
Ok(account) => match account.state() {
Ok(Versions::Current(state)) => {
if let State::Initialized(data) = *state {
let blockhash = data.durable_nonce.as_hash();
return Some(DurableNonceInfo {
nonce_account: Some(nonce_account),
current_nonce: Some(*blockhash),
});
}
Ok(account) => {
// Parse nonce account manually: first 4 bytes is version, then 4 bytes authority type
// For initialized nonce: version=0, authority_type=0, then authority (32 bytes), then blockhash (32 bytes), then fee_calculator
if account.data.len() >= 80 {
// Skip version (4) + authority_type (4) + authority (32) = 40 bytes
// Then blockhash is at offset 40
let blockhash_bytes: [u8; 32] = account.data[40..72].try_into().ok()?;
return Some(DurableNonceInfo {
nonce_account: Some(nonce_account),
current_nonce: Some(Hash::from(blockhash_bytes)),
});
} else {
error!("Nonce account data too short");
}
_ => (),
},
}
Err(e) => {
error!("Failed to get nonce account information: {:?}", e);
}