iota_stardust_types/block/
ids.rs1use derive_more::{Deref, From};
5
6impl_id!(
7 pub TransactionId,
8 32,
9 "A transaction identifier, the BLAKE2b-256 hash of the transaction bytes. See <https://www.blake2.net/> for more information."
10);
11
12#[cfg(feature = "serde")]
13string_serde_impl!(TransactionId);
14
15impl_id!(
16 pub BlockId,
17 32,
18 "A block identifier, the BLAKE2b-256 hash of the block bytes. See <https://www.blake2.net/> for more information."
19);
20
21#[cfg(feature = "serde")]
22string_serde_impl!(BlockId);
23
24impl_id!(
25 pub MilestoneId,
26 32,
27 "A milestone identifier, the BLAKE2b-256 hash of the milestone bytes. See <https://www.blake2.net/> for more information."
28);
29
30#[cfg(feature = "serde")]
31string_serde_impl!(MilestoneId);
32
33#[repr(transparent)]
35#[derive(
36 Debug,
37 Clone,
38 Copy,
39 Default,
40 Eq,
41 Hash,
42 Ord,
43 PartialEq,
44 PartialOrd,
45 From,
46 Deref,
47 packable::Packable,
48)]
49#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
50pub struct MilestoneIndex(pub u32);
51
52impl MilestoneIndex {
53 pub fn new(index: u32) -> Self {
55 Self(index)
56 }
57}