feat: PumpSwap/PumpFun improvements, align with pump-public-docs, sync IDL

- Re-apply PumpSwap pool lookup, lib/utils/seed changes (no Fastlane)
- pump-public-docs: Mayhem fee recipient at index 11 use WSOL ATA; random mayhem fee recipients (PumpSwap + PumpFun); Pool decode 244 bytes
- Sync idl (pump.json, pump_amm.json, pump_fees.json) from pump-fun/pump-public-docs

Made-with: Cursor
This commit is contained in:
Wood
2026-03-06 15:18:04 +08:00
parent 07487c06cb
commit 7e2860d8de
12 changed files with 1470 additions and 149 deletions
+26 -2
View File
@@ -2,7 +2,11 @@ use solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer, transaction
use solana_system_interface::instruction::transfer;
use crate::common::{
fast_fn::get_associated_token_address_with_program_id_fast, spl_token::close_account,
fast_fn::{
get_associated_token_address_with_program_id_fast,
get_associated_token_address_with_program_id_fast_use_seed,
},
spl_token::close_account,
SolanaRpcClient,
};
use anyhow::anyhow;
@@ -36,10 +40,30 @@ pub async fn get_token_balance(
payer: &Pubkey,
mint: &Pubkey,
) -> Result<u64, anyhow::Error> {
let ata = crate::common::fast_fn::get_associated_token_address_with_program_id_fast(
get_token_balance_with_options(
rpc,
payer,
mint,
&crate::constants::TOKEN_PROGRAM,
false,
)
.await
}
/// 使用与交易指令一致的 ATA 推导(可选 seed)查询余额;卖出/余额查询应与买入使用同一 ATA 地址。
#[inline]
pub async fn get_token_balance_with_options(
rpc: &SolanaRpcClient,
payer: &Pubkey,
mint: &Pubkey,
token_program: &Pubkey,
use_seed: bool,
) -> Result<u64, anyhow::Error> {
let ata = get_associated_token_address_with_program_id_fast_use_seed(
payer,
mint,
token_program,
use_seed,
);
let balance = rpc.get_token_account_balance(&ata).await?;
let balance_u64 =