mirror of
https://github.com/0xfnzero/solana-streamer.git
synced 2026-11-02 07:16:31 +00:00
feat: expose transaction message version on Pump creation events
This commit is contained in:
@@ -301,6 +301,8 @@ instruction args, while log-only `CreatePoolEvent` payloads keep the default
|
||||
account value is also available from
|
||||
`PumpSwapPoolAccountEvent.pool.is_cashback_coin`.
|
||||
|
||||
`PumpFunCreateTokenEvent.transaction_version` reports the transaction message version as `Some(YellowstoneMessageVersion::Legacy)`, `V0` or `V1` on gRPC/RPC. JSON uses `"legacy"`, `"v0"` and `"v1"`. It remains `None` without transaction context (including standalone Shred parsing). This is independent of the Pump instruction name in `ix_name`.
|
||||
|
||||
<a id="trade-provenance-and-parsing-boundaries"></a>
|
||||
|
||||
## Trade provenance and parsing boundaries
|
||||
|
||||
@@ -281,6 +281,8 @@ log-only 的 `CreatePoolEvent` payload 因为 IDL 不包含该字段,会保持
|
||||
`false`。账户里的权威值也可通过
|
||||
`PumpSwapPoolAccountEvent.pool.is_cashback_coin` 读取。
|
||||
|
||||
`PumpFunCreateTokenEvent.transaction_version` 在 gRPC/RPC 路径下表示交易消息版本:`Some(YellowstoneMessageVersion::Legacy)`、`V0` 或 `V1`,JSON 分别为 `"legacy"`、`"v0"`、`"v1"`。缺少交易上下文时(包括独立 Shred 解析)为 `None`。该字段与 `ix_name` 表示的 Pump 指令版本相互独立。
|
||||
|
||||
<a id="交易来源与解析边界"></a>
|
||||
|
||||
## 交易来源与解析边界
|
||||
|
||||
@@ -92,6 +92,7 @@ fn print_trade(e: &PumpFunTradeEvent, now_us: i64) {
|
||||
}
|
||||
|
||||
fn print_create_legacy(e: &PumpFunCreateTokenEvent, now_us: i64) {
|
||||
println!("Transaction version: {:?}", e.transaction_version);
|
||||
let latency_us = now_us - e.metadata.recv_us;
|
||||
println!(
|
||||
"│ CREATE | sig={:.8}.. | name={} symbol={} | mint={:.8}.. | latency={} μs",
|
||||
|
||||
@@ -7,6 +7,10 @@ use crate::streaming::event_parser::protocols::pumpfun::types::{BondingCurve, Gl
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, BorshDeserialize)]
|
||||
pub struct PumpFunCreateTokenEvent {
|
||||
/// Transaction message version from gRPC/RPC context, independent of create/create_v2.
|
||||
#[borsh(skip)]
|
||||
#[serde(default)]
|
||||
pub transaction_version: Option<sol_parser_sdk::grpc::YellowstoneMessageVersion>,
|
||||
#[borsh(skip)]
|
||||
#[serde(default)]
|
||||
pub depth: u8,
|
||||
|
||||
@@ -339,6 +339,7 @@ mod tests {
|
||||
let quote_vault = Pubkey::new_unique();
|
||||
let quote_token_program = Pubkey::new_unique();
|
||||
let c = PbPumpCreateV2 {
|
||||
transaction_version: Some(sol_parser_sdk::YellowstoneMessageVersion::V1),
|
||||
metadata: EventMetadata {
|
||||
signature: Signature::default(),
|
||||
slot: 42,
|
||||
@@ -365,6 +366,10 @@ mod tests {
|
||||
let ev = convert_parser_event(PbDexEvent::PumpFunCreateV2(c), None, 999).expect("convert");
|
||||
match ev {
|
||||
DexEvent::PumpFunCreateTokenEvent(st) => {
|
||||
assert_eq!(
|
||||
st.transaction_version,
|
||||
Some(sol_parser_sdk::YellowstoneMessageVersion::V1)
|
||||
);
|
||||
assert_eq!(st.metadata.event_type, EventType::PumpFunCreateToken);
|
||||
assert_eq!(st.mint, mint);
|
||||
assert_eq!(st.global, global);
|
||||
|
||||
@@ -36,6 +36,7 @@ pub(crate) fn pumpfun_create_token_from_parser(
|
||||
meta: EventMetadata,
|
||||
) -> PumpFunCreateTokenEvent {
|
||||
PumpFunCreateTokenEvent {
|
||||
transaction_version: c.transaction_version,
|
||||
metadata: meta,
|
||||
name: c.name,
|
||||
symbol: c.symbol,
|
||||
@@ -82,6 +83,7 @@ pub(crate) fn pumpfun_create_token_from_parser_v2(
|
||||
meta: EventMetadata,
|
||||
) -> PumpFunCreateTokenEvent {
|
||||
PumpFunCreateTokenEvent {
|
||||
transaction_version: c.transaction_version,
|
||||
metadata: meta,
|
||||
name: c.name,
|
||||
symbol: c.symbol,
|
||||
|
||||
Reference in New Issue
Block a user