Skip to main content

miden_objects/
lib.rs

1#![no_std]
2
3extern crate alloc;
4#[cfg(feature = "std")]
5extern crate std;
6
7pub mod account_file;
8pub mod conversion;
9pub mod decoded;
10pub mod error;
11pub mod note_file;
12
13#[cfg(test)]
14pub(crate) mod test_utils;
15
16pub use error::{ConversionError, ConversionResultExt};
17pub use miden_protobuf::{
18    BuildUnchecked,
19    DecodeMessage,
20    DecodeMessageExt,
21    Decoded,
22    Verify,
23    VerifyWith,
24};
25pub use prost;
26
27/// Generated canonical Protobuf messages.
28pub mod proto {
29    pub mod account {
30        include!(concat!(env!("OUT_DIR"), "/account.rs"));
31    }
32
33    #[expect(clippy::module_inception)]
34    pub mod account_file {
35        include!(concat!(env!("OUT_DIR"), "/account_file.rs"));
36    }
37
38    pub mod asset {
39        include!(concat!(env!("OUT_DIR"), "/asset.rs"));
40    }
41
42    pub mod blockchain {
43        include!(concat!(env!("OUT_DIR"), "/blockchain.rs"));
44    }
45
46    pub mod note {
47        include!(concat!(env!("OUT_DIR"), "/note.rs"));
48    }
49
50    #[expect(clippy::module_inception)]
51    pub mod note_file {
52        include!(concat!(env!("OUT_DIR"), "/note_file.rs"));
53    }
54
55    pub mod primitives {
56        include!(concat!(env!("OUT_DIR"), "/primitives.rs"));
57    }
58
59    pub mod protocol_config {
60        include!(concat!(env!("OUT_DIR"), "/protocol_config.rs"));
61    }
62
63    pub mod transaction {
64        include!(concat!(env!("OUT_DIR"), "/transaction.rs"));
65    }
66}
67
68/// Self-contained descriptor set for the canonical object schemas.
69pub const FILE_DESCRIPTOR_SET: &[u8] =
70    include_bytes!(concat!(env!("OUT_DIR"), "/miden_objects_descriptor.bin"));
71
72/// Protobuf paths and their canonical generated Rust paths.
73///
74/// Service-binding build scripts should configure these as Prost external paths so that messages
75/// imported from this descriptor are represented by this crate's generated Rust types.
76pub const EXTERN_PATHS: &[(&str, &str)] = &[
77    (".account", "::miden_objects::proto::account"),
78    (".asset", "::miden_objects::proto::asset"),
79    (".blockchain", "::miden_objects::proto::blockchain"),
80    (".note", "::miden_objects::proto::note"),
81    (".primitives", "::miden_objects::proto::primitives"),
82    (".protocol_config", "::miden_objects::proto::protocol_config"),
83    (".transaction", "::miden_objects::proto::transaction"),
84];