shredlink-proto
Protocol buffer definitions for Shredlink gRPC services - a fast path to receive Solana blockchain shreds and transactions.
Features
- gRPC service definitions for subscribing to Solana entries and transactions
- Filter-based transaction subscription with account-level filtering
- Generated Rust client and server code
- Compatible with Tonic gRPC framework
Usage
Add this to your Cargo.toml:
[dependencies]
shredlink-proto = "0.1"
tonic = "0.10"
tokio = { version = "1.0", features = ["full"] }
Client Example
use shredlink_proto::shredlink::{
shredlink_service_client::ShredlinkServiceClient,
SubscribeEntriesRequest
};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut client = ShredlinkServiceClient::connect("http://127.0.0.1:50051").await?;
let request = SubscribeEntriesRequest {};
let mut stream = client.subscribe_entries(request).await?.into_inner();
while let Some(entry) = stream.message().await? {
println!("Received entry for slot: {}", entry.slot);
}
Ok(())
}
Server Example
use shredlink_proto::shredlink::{
shredlink_service_server::{ShredlinkService, ShredlinkServiceServer},
SubscribeEntriesRequest, Entry
};
use tonic::{transport::Server, Request, Response, Status};
#[derive(Default)]
pub struct MyShredlinkService;
#[tonic::async_trait]
impl ShredlinkService for MyShredlinkService {
type SubscribeEntriesStream =
async fn subscribe_entries(
&self,
request: Request<SubscribeEntriesRequest>,
) -> Result<Response<Self::SubscribeEntriesStream>, Status> {
}
}
Services
- SubscribeEntries: Stream Solana entries by slot
- SubscribeTransactions: Stream filtered transactions with account-based filtering
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Links