bee_inx/
protocol_parameters.rs

1// Copyright 2022 IOTA Stiftung
2// SPDX-License-Identifier: Apache-2.0
3
4use bee_block as bee;
5use inx::proto;
6
7use crate::Raw;
8
9#[allow(missing_docs)]
10#[derive(Clone, Debug, PartialEq, Eq)]
11pub struct ProtocolParameters {
12    pub protocol_version: u8,
13    pub params: Raw<bee::protocol::ProtocolParameters>,
14}
15
16impl From<proto::RawProtocolParameters> for ProtocolParameters {
17    fn from(value: proto::RawProtocolParameters) -> Self {
18        Self {
19            protocol_version: value.protocol_version as u8,
20            params: value.params.into(),
21        }
22    }
23}
24
25impl From<ProtocolParameters> for proto::RawProtocolParameters {
26    fn from(value: ProtocolParameters) -> Self {
27        Self {
28            protocol_version: value.protocol_version as u32,
29            params: value.params.data(),
30        }
31    }
32}