penumbra_sdk_view/
status.rs

1use penumbra_sdk_proto::{view::v1 as pb, DomainType};
2
3#[derive(Clone, Copy, Debug)]
4pub struct StatusStreamResponse {
5    pub latest_known_block_height: u64,
6    pub full_sync_height: u64,
7    pub partial_sync_height: u64,
8}
9
10impl DomainType for StatusStreamResponse {
11    type Proto = pb::StatusStreamResponse;
12}
13
14impl TryFrom<pb::StatusStreamResponse> for StatusStreamResponse {
15    type Error = anyhow::Error;
16
17    fn try_from(proto: pb::StatusStreamResponse) -> Result<Self, Self::Error> {
18        Ok(StatusStreamResponse {
19            latest_known_block_height: proto.latest_known_block_height,
20            full_sync_height: proto.full_sync_height,
21            partial_sync_height: proto.partial_sync_height,
22        })
23    }
24}
25
26impl From<StatusStreamResponse> for pb::StatusStreamResponse {
27    fn from(msg: StatusStreamResponse) -> Self {
28        pb::StatusStreamResponse {
29            latest_known_block_height: msg.latest_known_block_height,
30            full_sync_height: msg.full_sync_height,
31            partial_sync_height: msg.partial_sync_height,
32        }
33    }
34}