mirror of
https://github.com/0xfnzero/solana-streamer.git
synced 2026-08-22 13:28:08 +00:00
feat: bridge streamer to sol-parser-sdk
This commit is contained in:
+15
-18
@@ -16,7 +16,8 @@ use std::sync::Arc;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
let default_sig = "64srGF8CnTz9zPbdayWYmzs5aVRFBcfjDcidFVvBgAD25VMh52wr88vma7ytSbAZT3C5Giu5BPyGfNfLexLSrKhP";
|
||||
let default_sig =
|
||||
"64srGF8CnTz9zPbdayWYmzs5aVRFBcfjDcidFVvBgAD25VMh52wr88vma7ytSbAZT3C5Giu5BPyGfNfLexLSrKhP";
|
||||
let tx_sig = std::env::var("TX_SIGNATURE")
|
||||
.ok()
|
||||
.or_else(|| std::env::args().nth(1))
|
||||
@@ -36,11 +37,11 @@ async fn main() -> Result<()> {
|
||||
async fn parse_one_tx(signature_str: &str, rpc_url: &str) -> Result<()> {
|
||||
use prost_types::Timestamp;
|
||||
use solana_sdk::{
|
||||
message::compiled_instruction::CompiledInstruction,
|
||||
pubkey::Pubkey,
|
||||
signature::Signature,
|
||||
message::compiled_instruction::CompiledInstruction, pubkey::Pubkey, signature::Signature,
|
||||
};
|
||||
use solana_transaction_status::{
|
||||
InnerInstruction, InnerInstructions, UiInstruction, UiTransactionEncoding,
|
||||
};
|
||||
use solana_transaction_status::{InnerInstruction, InnerInstructions, UiInstruction, UiTransactionEncoding};
|
||||
|
||||
let signature = Signature::from_str(signature_str)?;
|
||||
let client = solana_client::nonblocking::rpc_client::RpcClient::new(rpc_url.to_string());
|
||||
@@ -77,8 +78,9 @@ async fn parse_one_tx(signature_str: &str, rpc_url: &str) -> Result<()> {
|
||||
|
||||
let mut inner_instructions_vec: Vec<InnerInstructions> = Vec::new();
|
||||
if let Some(meta) = &transaction.transaction.meta {
|
||||
if let solana_transaction_status::option_serializer::OptionSerializer::Some(ui_inner_insts) =
|
||||
&meta.inner_instructions
|
||||
if let solana_transaction_status::option_serializer::OptionSerializer::Some(
|
||||
ui_inner_insts,
|
||||
) = &meta.inner_instructions
|
||||
{
|
||||
for ui_inner in ui_inner_insts {
|
||||
let mut converted = Vec::new();
|
||||
@@ -96,10 +98,8 @@ async fn parse_one_tx(signature_str: &str, rpc_url: &str) -> Result<()> {
|
||||
}
|
||||
}
|
||||
}
|
||||
inner_instructions_vec.push(InnerInstructions {
|
||||
index: ui_inner.index,
|
||||
instructions: converted,
|
||||
});
|
||||
inner_instructions_vec
|
||||
.push(InnerInstructions { index: ui_inner.index, instructions: converted });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,13 +123,10 @@ async fn parse_one_tx(signature_str: &str, rpc_url: &str) -> Result<()> {
|
||||
accounts.extend(address_table_lookups);
|
||||
|
||||
let slot = transaction.slot;
|
||||
let block_time = transaction
|
||||
.block_time
|
||||
.map(|t| Timestamp { seconds: t as i64, nanos: 0 });
|
||||
let recv_us = std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.unwrap()
|
||||
.as_micros() as i64;
|
||||
let block_time = transaction.block_time.map(|t| Timestamp { seconds: t as i64, nanos: 0 });
|
||||
let recv_us =
|
||||
std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_micros()
|
||||
as i64;
|
||||
|
||||
let protocols = vec![
|
||||
Protocol::PumpFun,
|
||||
|
||||
Reference in New Issue
Block a user