This commit is contained in:
GroovieGermanikus 2024-01-23 14:48:47 +01:00
parent 542f11607f
commit 1b9926fc1b
No known key found for this signature in database
GPG Key ID: 5B6EB831A5CD2015
1 changed files with 21 additions and 1 deletions

View File

@ -2,7 +2,7 @@ use solana_sdk::commitment_config::CommitmentConfig;
use std::collections::HashMap; use std::collections::HashMap;
use std::fmt::{Debug, Display}; use std::fmt::{Debug, Display};
use std::time::Duration; use std::time::Duration;
use yellowstone_grpc_proto::geyser::{CommitmentLevel, SubscribeRequest, SubscribeRequestFilterBlocks, SubscribeRequestFilterBlocksMeta, SubscribeUpdate}; use yellowstone_grpc_proto::geyser::{CommitmentLevel, SubscribeRequest, SubscribeRequestFilterBlocks, SubscribeRequestFilterBlocksMeta, SubscribeRequestFilterSlots, SubscribeUpdate};
use yellowstone_grpc_proto::tonic::transport::ClientTlsConfig; use yellowstone_grpc_proto::tonic::transport::ClientTlsConfig;
pub mod channel_plugger; pub mod channel_plugger;
@ -124,6 +124,26 @@ impl GeyserFilter {
ping: None, ping: None,
} }
} }
pub fn slots(&self) -> SubscribeRequest {
let mut slots_subs = HashMap::new();
slots_subs.insert("client".to_string(),
SubscribeRequestFilterSlots {
filter_by_commitment: Some(true),
});
SubscribeRequest {
slots: slots_subs,
accounts: Default::default(),
transactions: HashMap::new(),
entry: Default::default(),
blocks: HashMap::new(),
blocks_meta: HashMap::new(),
commitment: Some(map_commitment_level(self.0) as i32),
accounts_data_slice: Default::default(),
ping: None,
}
}
} }
fn map_commitment_level(commitment_config: CommitmentConfig) -> CommitmentLevel { fn map_commitment_level(commitment_config: CommitmentConfig) -> CommitmentLevel {