d9cd8154b7f81078761bf5dccf108bf3d1cbbbe0
PumpFun Rust SDK
A comprehensive Rust SDK for seamless interaction with the PumpFun Solana program. This SDK provides a robust set of tools and interfaces to integrate PumpFun functionality into your applications.
Explanation
- Add
create, buy, sellfor pump.fun. - Add
logs_subscribeto subscribe the logs of the PumpFun program. - Add
yellowstone grpcto subscribe the logs of the PumpFun program. - Add
jitoto send transaction with Jito. - Add
nextblockto send transaction with nextblock. - Add
0slotto send transaction with 0slot. - Submit a transaction using Jito, Nextblock, and 0slot simultaneously; the fastest one will succeed, while the others will fail.
Usage
logs subscription for token create and trade transaction
// create grpc client
let grpc_url = "http://127.0.0.1:10000";
let client = YellowstoneGrpc::new(grpc_url);
// Define callback function
let callback = |event: PumpfunEvent| {
match event {
PumpfunEvent::NewToken(token_info) => {
println!("Received new token event: {:?}", token_info);
},
PumpfunEvent::NewDevTrade(trade_info) => {
println!("Received dev trade event: {:?}", trade_info);
},
PumpfunEvent::NewUserTrade(trade_info) => {
println!("Received new trade event: {:?}", trade_info);
},
PumpfunEvent::NewBotTrade(trade_info) => {
println!("Received new bot trade event: {:?}", trade_info);
}
PumpfunEvent::Error(err) => {
println!("Received error: {}", err);
}
}
};
let payer_keypair = Keypair::from_base58_string("your private key");
let client = GrpcClient::get_instance();
client.subscribe_pumpfun(callback, Some(payer_keypair.pubkey())).await?;
pumpfun Create, Buy, Sell
let payer = Keypair::from_base58_string(&settings.dex.payer.clone());
let cluster = Cluster::new(
rpc_url.clone(),
jito_url.clone(),
nextblock_url.clone(),
nextblock_auth_token.clone(),
zeroslot_url.clone(),
zeroslot_auth_token.clone(),
priority_fee,
CommitmentConfig::processed(),
use_jito,
use_nextblock,
use_zeroslot,
);
// create pumpfun instance
let pumpfun = PumpFun::new(Arc::new(payer), &cluster).await;
// Mint keypair
let mint_pubkey: Keypair = Keypair::new();
// buy token with tip
pumpfun.buy_with_tip(mint_pubkey, 10000, None).await?;
// sell token by percent with tip
pumpfun.sell_by_percent_with_tip(mint_pubkey, 100, None).await?;
Description
Rust SDK for low-latency Solana DEX trading bots with PumpFun, PumpSwap, Bonk, Raydium, Meteora, Jito, and SWQoS submit lanes.
0xfnzeroarbitragebonkcopy-tradingfnzerojito-bundlemeteoramevpumpfunpumpfun-sdkpumpswapraydiumraydium-swaprustsniper-botsolanasolana-botsolana-tradeswqostrading-bot
Readme
MIT
3.1 MiB
Languages
Rust
99.1%
Shell
0.9%