sol_parser_sdk/shredstream/proto/
mod.rs1pub mod shredstream {
4 use tonic::codegen::*;
7
8 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
10 pub struct SubscribeEntriesRequest {}
11
12 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
14 pub struct Entry {
15 #[prost(uint64, tag = "1")]
17 pub slot: u64,
18 #[prost(bytes = "vec", tag = "2")]
20 pub entries: ::prost::alloc::vec::Vec<u8>,
21 }
22
23 #[derive(Debug, Clone)]
25 pub struct ShredstreamProxyClient<T> {
26 inner: tonic::client::Grpc<T>,
27 }
28
29 impl ShredstreamProxyClient<tonic::transport::Channel> {
30 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
32 where
33 D: TryInto<tonic::transport::Endpoint>,
34 D::Error: Into<StdError>,
35 {
36 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
37 Ok(Self::new(conn))
38 }
39 }
40
41 impl<T> ShredstreamProxyClient<T>
42 where
43 T: tonic::client::GrpcService<tonic::body::Body>,
44 T::Error: Into<StdError>,
45 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
46 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
47 {
48 pub fn new(inner: T) -> Self {
49 let inner = tonic::client::Grpc::new(inner);
50 Self { inner }
51 }
52
53 pub async fn subscribe_entries(
55 &mut self,
56 request: impl tonic::IntoRequest<SubscribeEntriesRequest>,
57 ) -> std::result::Result<tonic::Response<tonic::codec::Streaming<Entry>>, tonic::Status>
58 {
59 self.inner.ready().await.map_err(|e| {
60 tonic::Status::unknown(format!("Service was not ready: {}", e.into()))
61 })?;
62 let codec = tonic::codec::ProstCodec::default();
63 let path = http::uri::PathAndQuery::from_static(
64 "/shredstream.ShredstreamProxy/SubscribeEntries",
65 );
66 let mut req = request.into_request();
67 req.extensions_mut()
68 .insert(GrpcMethod::new("shredstream.ShredstreamProxy", "SubscribeEntries"));
69 self.inner.server_streaming(req, path, codec).await
70 }
71 }
72}
73
74pub use shredstream::{Entry, ShredstreamProxyClient, SubscribeEntriesRequest};