mirror of
https://github.com/0xfnzero/solana-streamer.git
synced 2026-08-15 01:48:05 +00:00
Release solana-streamer-sdk v1.4.11
This commit is contained in:
@@ -254,6 +254,14 @@ fn push_streamer_event_sdk_grpc_types(t: &EventType, out: &mut Vec<SdkGrpcEventT
|
||||
St::NonceAccount => out.push(Sdk::NonceAccount),
|
||||
St::AccountPumpFunGlobal => out.push(Sdk::AccountPumpFunGlobal),
|
||||
St::AccountPumpFunBondingCurve => out.push(Sdk::AccountPumpFunBondingCurve),
|
||||
St::AccountPumpFunFeeConfig => out.push(Sdk::AccountPumpFunFeeConfig),
|
||||
St::AccountPumpFunSharingConfig => out.push(Sdk::AccountPumpFunSharingConfig),
|
||||
St::AccountPumpFunGlobalVolumeAccumulator => {
|
||||
out.push(Sdk::AccountPumpFunGlobalVolumeAccumulator)
|
||||
}
|
||||
St::AccountPumpFunUserVolumeAccumulator => {
|
||||
out.push(Sdk::AccountPumpFunUserVolumeAccumulator)
|
||||
}
|
||||
St::AccountPumpSwapGlobalConfig => out.push(Sdk::AccountPumpSwapGlobalConfig),
|
||||
St::AccountPumpSwapPool => out.push(Sdk::AccountPumpSwapPool),
|
||||
_ => return false,
|
||||
@@ -641,6 +649,11 @@ mod tests {
|
||||
EventType::TokenInfo,
|
||||
EventType::NonceAccount,
|
||||
EventType::AccountPumpFunGlobal,
|
||||
EventType::AccountPumpFunBondingCurve,
|
||||
EventType::AccountPumpFunFeeConfig,
|
||||
EventType::AccountPumpFunSharingConfig,
|
||||
EventType::AccountPumpFunGlobalVolumeAccumulator,
|
||||
EventType::AccountPumpFunUserVolumeAccumulator,
|
||||
EventType::AccountPumpSwapGlobalConfig,
|
||||
EventType::AccountPumpSwapPool,
|
||||
];
|
||||
|
||||
@@ -178,6 +178,10 @@ pub enum EventType {
|
||||
AccountBonkVestingRecord,
|
||||
AccountPumpFunBondingCurve,
|
||||
AccountPumpFunGlobal,
|
||||
AccountPumpFunFeeConfig,
|
||||
AccountPumpFunSharingConfig,
|
||||
AccountPumpFunGlobalVolumeAccumulator,
|
||||
AccountPumpFunUserVolumeAccumulator,
|
||||
AccountRaydiumClmmAmmConfig,
|
||||
AccountRaydiumClmmPoolState,
|
||||
AccountRaydiumClmmTickArrayState,
|
||||
@@ -206,6 +210,10 @@ pub const ACCOUNT_EVENT_TYPES: &[EventType] = &[
|
||||
EventType::AccountBonkVestingRecord,
|
||||
EventType::AccountPumpFunBondingCurve,
|
||||
EventType::AccountPumpFunGlobal,
|
||||
EventType::AccountPumpFunFeeConfig,
|
||||
EventType::AccountPumpFunSharingConfig,
|
||||
EventType::AccountPumpFunGlobalVolumeAccumulator,
|
||||
EventType::AccountPumpFunUserVolumeAccumulator,
|
||||
EventType::AccountRaydiumClmmAmmConfig,
|
||||
EventType::AccountRaydiumClmmPoolState,
|
||||
EventType::AccountRaydiumClmmTickArrayState,
|
||||
|
||||
@@ -15,6 +15,20 @@ fn fill_u64(to: &mut u64, from: u64) {
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn fill_i64(to: &mut i64, from: i64) {
|
||||
if *to == 0 && from != 0 {
|
||||
*to = from;
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn fill_string(to: &mut String, from: String) {
|
||||
if to.is_empty() && !from.is_empty() {
|
||||
*to = from;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn merge(instruction_event: &mut DexEvent, cpi_log_event: DexEvent) {
|
||||
match instruction_event {
|
||||
// PumpFun events
|
||||
@@ -108,6 +122,9 @@ pub fn merge(instruction_event: &mut DexEvent, cpi_log_event: DexEvent) {
|
||||
},
|
||||
DexEvent::PumpFunCreateTokenEvent(e) => match cpi_log_event {
|
||||
DexEvent::PumpFunCreateV2TokenEvent(cpie) => {
|
||||
fill_string(&mut e.name, cpie.name);
|
||||
fill_string(&mut e.symbol, cpie.symbol);
|
||||
fill_string(&mut e.uri, cpie.uri);
|
||||
if cpie.mint != solana_sdk::pubkey::Pubkey::default() {
|
||||
e.mint = cpie.mint;
|
||||
}
|
||||
@@ -138,13 +155,37 @@ pub fn merge(instruction_event: &mut DexEvent, cpi_log_event: DexEvent) {
|
||||
if cpie.token_program != solana_sdk::pubkey::Pubkey::default() {
|
||||
e.token_program = cpie.token_program;
|
||||
}
|
||||
e.is_mayhem_mode = cpie.is_mayhem_mode;
|
||||
e.is_cashback_enabled = cpie.is_cashback_enabled;
|
||||
fill_pubkey(&mut e.quote_mint, cpie.quote_mint);
|
||||
fill_u64(&mut e.virtual_quote_reserves, cpie.virtual_quote_reserves);
|
||||
e.is_mayhem_mode |= cpie.is_mayhem_mode;
|
||||
e.is_cashback_enabled |= cpie.is_cashback_enabled;
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
DexEvent::PumpFunCreateV2TokenEvent(e) => match cpi_log_event {
|
||||
DexEvent::PumpFunCreateTokenEvent(cpie) => {
|
||||
fill_string(&mut e.name, cpie.name);
|
||||
fill_string(&mut e.symbol, cpie.symbol);
|
||||
fill_string(&mut e.uri, cpie.uri);
|
||||
fill_pubkey(&mut e.mint, cpie.mint);
|
||||
fill_pubkey(&mut e.bonding_curve, cpie.bonding_curve);
|
||||
fill_pubkey(&mut e.user, cpie.user);
|
||||
fill_pubkey(&mut e.creator, cpie.creator);
|
||||
fill_i64(&mut e.timestamp, cpie.timestamp);
|
||||
fill_u64(&mut e.virtual_token_reserves, cpie.virtual_token_reserves);
|
||||
fill_u64(&mut e.virtual_sol_reserves, cpie.virtual_sol_reserves);
|
||||
fill_u64(&mut e.real_token_reserves, cpie.real_token_reserves);
|
||||
fill_u64(&mut e.token_total_supply, cpie.token_total_supply);
|
||||
fill_pubkey(&mut e.token_program, cpie.token_program);
|
||||
fill_pubkey(&mut e.quote_mint, cpie.quote_mint);
|
||||
fill_u64(&mut e.virtual_quote_reserves, cpie.virtual_quote_reserves);
|
||||
e.is_mayhem_mode |= cpie.is_mayhem_mode;
|
||||
e.is_cashback_enabled |= cpie.is_cashback_enabled;
|
||||
}
|
||||
DexEvent::PumpFunCreateV2TokenEvent(cpie) => {
|
||||
fill_string(&mut e.name, cpie.name);
|
||||
fill_string(&mut e.symbol, cpie.symbol);
|
||||
fill_string(&mut e.uri, cpie.uri);
|
||||
if cpie.mint != solana_sdk::pubkey::Pubkey::default() {
|
||||
e.mint = cpie.mint;
|
||||
}
|
||||
@@ -175,8 +216,10 @@ pub fn merge(instruction_event: &mut DexEvent, cpi_log_event: DexEvent) {
|
||||
if cpie.token_program != solana_sdk::pubkey::Pubkey::default() {
|
||||
e.token_program = cpie.token_program;
|
||||
}
|
||||
e.is_mayhem_mode = cpie.is_mayhem_mode;
|
||||
e.is_cashback_enabled = cpie.is_cashback_enabled;
|
||||
fill_pubkey(&mut e.quote_mint, cpie.quote_mint);
|
||||
fill_u64(&mut e.virtual_quote_reserves, cpie.virtual_quote_reserves);
|
||||
e.is_mayhem_mode |= cpie.is_mayhem_mode;
|
||||
e.is_cashback_enabled |= cpie.is_cashback_enabled;
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
@@ -795,7 +838,7 @@ mod tests {
|
||||
let shareholder = Pubkey::new_unique();
|
||||
|
||||
let mut instruction_event = DexEvent::PumpFunTradeEvent(PumpFunTradeEvent {
|
||||
ix_name: "buy_exact_quote_in_v2".to_string(),
|
||||
ix_name: "buy_exact_quote_in".to_string(),
|
||||
quote_mint,
|
||||
spendable_quote_in: 500,
|
||||
min_tokens_out: 600,
|
||||
@@ -823,7 +866,7 @@ mod tests {
|
||||
DexEvent::PumpFunTradeEvent(t) => {
|
||||
assert_eq!(t.sol_amount, 500);
|
||||
assert_eq!(t.token_amount, 600);
|
||||
assert_eq!(t.ix_name, "buy_exact_quote_in_v2");
|
||||
assert_eq!(t.ix_name, "buy_exact_quote_in");
|
||||
assert_eq!(t.quote_mint, quote_mint);
|
||||
assert_eq!(t.spendable_quote_in, 500);
|
||||
assert_eq!(t.min_tokens_out, 600);
|
||||
|
||||
@@ -55,6 +55,10 @@ pub enum DexEvent {
|
||||
PumpFunMigrateBondingCurveCreatorEvent(PumpFunMigrateBondingCurveCreatorEvent),
|
||||
PumpFunBondingCurveAccountEvent(PumpFunBondingCurveAccountEvent),
|
||||
PumpFunGlobalAccountEvent(PumpFunGlobalAccountEvent),
|
||||
PumpFunFeeConfigAccountEvent(PumpFunFeeConfigAccountEvent),
|
||||
PumpFunSharingConfigAccountEvent(PumpFunSharingConfigAccountEvent),
|
||||
PumpFunGlobalVolumeAccumulatorAccountEvent(PumpFunGlobalVolumeAccumulatorAccountEvent),
|
||||
PumpFunUserVolumeAccumulatorAccountEvent(PumpFunUserVolumeAccumulatorAccountEvent),
|
||||
|
||||
// PumpSwap events
|
||||
PumpSwapBuyEvent(PumpSwapBuyEvent),
|
||||
@@ -185,6 +189,10 @@ impl_dex_event_metadata!(
|
||||
PumpFunMigrateBondingCurveCreatorEvent,
|
||||
PumpFunBondingCurveAccountEvent,
|
||||
PumpFunGlobalAccountEvent,
|
||||
PumpFunFeeConfigAccountEvent,
|
||||
PumpFunSharingConfigAccountEvent,
|
||||
PumpFunGlobalVolumeAccumulatorAccountEvent,
|
||||
PumpFunUserVolumeAccumulatorAccountEvent,
|
||||
// PumpSwap events
|
||||
PumpSwapBuyEvent,
|
||||
PumpSwapSellEvent,
|
||||
|
||||
@@ -29,6 +29,10 @@ pub struct PumpFunCreateTokenEvent {
|
||||
#[borsh(skip)]
|
||||
pub is_cashback_enabled: bool,
|
||||
#[borsh(skip)]
|
||||
pub quote_mint: Pubkey,
|
||||
#[borsh(skip)]
|
||||
pub virtual_quote_reserves: u64,
|
||||
#[borsh(skip)]
|
||||
pub mint_authority: Pubkey,
|
||||
#[borsh(skip)]
|
||||
pub associated_bonding_curve: Pubkey,
|
||||
@@ -72,6 +76,10 @@ pub struct PumpFunCreateV2TokenEvent {
|
||||
/// Whether cashback is enabled (IDL CreateEvent.is_cashback_enabled)
|
||||
pub is_cashback_enabled: bool,
|
||||
#[borsh(skip)]
|
||||
pub quote_mint: Pubkey,
|
||||
#[borsh(skip)]
|
||||
pub virtual_quote_reserves: u64,
|
||||
#[borsh(skip)]
|
||||
pub mint_authority: Pubkey,
|
||||
#[borsh(skip)]
|
||||
pub associated_bonding_curve: Pubkey,
|
||||
@@ -448,6 +456,95 @@ pub struct PumpFunGlobalAccountEvent {
|
||||
pub global: Global,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct PumpFunFeeConfigAccountEvent {
|
||||
pub metadata: EventMetadata,
|
||||
pub pubkey: Pubkey,
|
||||
pub executable: bool,
|
||||
pub lamports: u64,
|
||||
pub owner: Pubkey,
|
||||
pub rent_epoch: u64,
|
||||
pub fee_config: PumpFunFeeConfig,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct PumpFunFeeConfig {
|
||||
pub bump: u8,
|
||||
pub admin: Pubkey,
|
||||
pub flat_fees: PumpFeesFees,
|
||||
pub fee_tiers: Vec<PumpFeesFeeTier>,
|
||||
pub stable_fee_tiers: Vec<PumpFeesFeeTier>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct PumpFunSharingConfigAccountEvent {
|
||||
pub metadata: EventMetadata,
|
||||
pub pubkey: Pubkey,
|
||||
pub executable: bool,
|
||||
pub lamports: u64,
|
||||
pub owner: Pubkey,
|
||||
pub rent_epoch: u64,
|
||||
pub sharing_config: PumpFunSharingConfig,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct PumpFunSharingConfig {
|
||||
pub bump: u8,
|
||||
pub version: u8,
|
||||
pub status: PumpFeesConfigStatus,
|
||||
pub mint: Pubkey,
|
||||
pub admin: Pubkey,
|
||||
pub admin_revoked: bool,
|
||||
pub shareholders: Vec<PumpFeesShareholder>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct PumpFunGlobalVolumeAccumulatorAccountEvent {
|
||||
pub metadata: EventMetadata,
|
||||
pub pubkey: Pubkey,
|
||||
pub executable: bool,
|
||||
pub lamports: u64,
|
||||
pub owner: Pubkey,
|
||||
pub rent_epoch: u64,
|
||||
pub global_volume_accumulator: PumpFunGlobalVolumeAccumulator,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct PumpFunGlobalVolumeAccumulator {
|
||||
pub start_time: i64,
|
||||
pub end_time: i64,
|
||||
pub seconds_in_a_day: i64,
|
||||
pub mint: Pubkey,
|
||||
pub total_token_supply: [u64; 30],
|
||||
pub sol_volumes: [u64; 30],
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct PumpFunUserVolumeAccumulatorAccountEvent {
|
||||
pub metadata: EventMetadata,
|
||||
pub pubkey: Pubkey,
|
||||
pub executable: bool,
|
||||
pub lamports: u64,
|
||||
pub owner: Pubkey,
|
||||
pub rent_epoch: u64,
|
||||
pub user_volume_accumulator: PumpFunUserVolumeAccumulator,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct PumpFunUserVolumeAccumulator {
|
||||
pub user: Pubkey,
|
||||
pub needs_claim: bool,
|
||||
pub total_unclaimed_tokens: u64,
|
||||
pub total_claimed_tokens: u64,
|
||||
pub current_sol_volume: u64,
|
||||
pub last_update_timestamp: i64,
|
||||
pub has_total_claimed_tokens: bool,
|
||||
pub cashback_earned: u64,
|
||||
pub total_cashback_claimed: u64,
|
||||
pub stable_cashback_earned: u64,
|
||||
pub total_stable_cashback_claimed: u64,
|
||||
}
|
||||
|
||||
/// Event discriminator constants
|
||||
pub mod discriminators {
|
||||
// Event discriminators
|
||||
|
||||
@@ -5,17 +5,18 @@ use solana_sdk::pubkey::Pubkey;
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, BorshDeserialize)]
|
||||
pub struct BondingCurve {
|
||||
pub virtual_token_reserves: u64,
|
||||
pub virtual_sol_reserves: u64,
|
||||
pub virtual_quote_reserves: u64,
|
||||
pub real_token_reserves: u64,
|
||||
pub real_sol_reserves: u64,
|
||||
pub real_quote_reserves: u64,
|
||||
pub token_total_supply: u64,
|
||||
pub complete: bool,
|
||||
pub creator: Pubkey,
|
||||
pub is_mayhem_mode: bool,
|
||||
pub is_cashback_coin: bool,
|
||||
pub quote_mint: Pubkey,
|
||||
}
|
||||
|
||||
pub const BONDING_CURVE_SIZE: usize = 8 * 5 + 1 + 32 + 1 + 1;
|
||||
pub const BONDING_CURVE_SIZE: usize = 8 * 5 + 1 + 32 + 1 + 1 + 32;
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, BorshDeserialize)]
|
||||
pub struct Global {
|
||||
@@ -40,7 +41,25 @@ pub struct Global {
|
||||
pub mayhem_mode_enabled: bool,
|
||||
pub reserved_fee_recipients: [Pubkey; 7],
|
||||
pub is_cashback_enabled: bool,
|
||||
pub buyback_fee_recipients: [Pubkey; 8],
|
||||
pub buyback_basis_points: u64,
|
||||
pub initial_virtual_quote_reserves: u64,
|
||||
pub whitelisted_quote_mints: [Pubkey; 1],
|
||||
}
|
||||
|
||||
pub const GLOBAL_SIZE: usize =
|
||||
1 + 32 * 2 + 8 * 5 + 32 + 1 + 8 * 2 + 32 * 7 + 32 * 2 + 1 + 32 * 2 + 1 + 32 * 7 + 1;
|
||||
pub const GLOBAL_SIZE: usize = 1
|
||||
+ 32 * 2
|
||||
+ 8 * 5
|
||||
+ 32
|
||||
+ 1
|
||||
+ 8 * 2
|
||||
+ 32 * 7
|
||||
+ 32 * 2
|
||||
+ 1
|
||||
+ 32 * 2
|
||||
+ 1
|
||||
+ 32 * 7
|
||||
+ 1
|
||||
+ 32 * 8
|
||||
+ 8 * 2
|
||||
+ 32;
|
||||
|
||||
Reference in New Issue
Block a user