feat: upgrade to v0.3.1 with enhanced PumpFun event parser

This commit is contained in:
ysq
2025-08-13 23:48:02 +08:00
parent aee8921ad5
commit 89f4a85a11
5 changed files with 44 additions and 14 deletions
@@ -66,14 +66,7 @@ pub struct PumpFunTradeEvent {
pub total_claimed_tokens: u64,
pub current_sol_volume: u64,
pub last_update_timestamp: i64,
#[borsh(skip)]
pub bonding_curve: Pubkey,
#[borsh(skip)]
pub associated_bonding_curve: Pubkey,
#[borsh(skip)]
pub associated_user: Pubkey,
#[borsh(skip)]
pub creator_vault: Pubkey,
#[borsh(skip)]
pub max_sol_cost: u64,
#[borsh(skip)]
@@ -84,6 +77,31 @@ pub struct PumpFunTradeEvent {
pub is_bot: bool,
#[borsh(skip)]
pub is_dev_create_token_trade: bool, // 是否是dev创建token的交易
#[borsh(skip)]
pub global: Pubkey,
// #[borsh(skip)]
// pub fee_recipient: Pubkey,
// #[borsh(skip)]
// pub mint: Pubkey,
#[borsh(skip)]
pub bonding_curve: Pubkey,
#[borsh(skip)]
pub associated_bonding_curve: Pubkey,
#[borsh(skip)]
pub associated_user: Pubkey,
// #[borsh(skip)]
// pub user: Pubkey,
#[borsh(skip)]
pub system_program: Pubkey,
#[borsh(skip)]
pub token_program: Pubkey,
#[borsh(skip)]
pub creator_vault: Pubkey,
#[borsh(skip)]
pub event_authority: Pubkey,
#[borsh(skip)]
pub program: Pubkey,
#[borsh(skip)]
pub global_volume_accumulator: Pubkey,
#[borsh(skip)]
@@ -183,13 +183,18 @@ impl PumpFunEventParser {
metadata.set_id(format!("{}-{}-{}-{}", metadata.signature, accounts[2], accounts[6], true));
Some(Box::new(PumpFunTradeEvent {
metadata,
global: accounts[0],
fee_recipient: accounts[1],
mint: accounts[2],
bonding_curve: accounts[3],
associated_bonding_curve: accounts[4],
associated_user: accounts[5],
user: accounts[6],
system_program: accounts[7],
token_program: accounts[8],
creator_vault: accounts[9],
event_authority: accounts[10],
program: accounts[11],
global_volume_accumulator: accounts[12],
user_volume_accumulator: accounts[13],
max_sol_cost,
@@ -215,13 +220,20 @@ impl PumpFunEventParser {
.set_id(format!("{}-{}-{}-{}", metadata.signature, accounts[2], accounts[6], false));
Some(Box::new(PumpFunTradeEvent {
metadata,
global: accounts[0],
fee_recipient: accounts[1],
mint: accounts[2],
bonding_curve: accounts[3],
associated_bonding_curve: accounts[4],
associated_user: accounts[5],
user: accounts[6],
creator_vault: accounts[9],
system_program: accounts[7],
creator_vault: accounts[8],
token_program: accounts[9],
event_authority: accounts[10],
program: accounts[11],
global_volume_accumulator: *accounts.get(12).unwrap_or(&Pubkey::default()),
user_volume_accumulator: *accounts.get(13).unwrap_or(&Pubkey::default()),
min_sol_output,
amount,
is_buy: false,