miden_lib/account/
mod.rs

1use super::auth::AuthScheme;
2
3pub mod auth;
4pub mod components;
5pub mod faucets;
6pub mod interface;
7pub mod wallets;
8
9/// Macro to simplify the creation of static procedure digest constants.
10///
11/// This macro generates a `LazyLock<Word>` static variable that lazily initializes
12/// the digest of a procedure from a library.
13///
14/// Note: This macro references exported types from `miden_objects`, so your crate must
15/// include `miden-objects` as a dependency.
16///
17/// # Arguments
18/// * `$name` - The name of the static variable to create
19/// * `$proc_name` - The string name of the procedure
20/// * `$library_fn` - The function that returns the library containing the procedure
21///
22/// # Example
23/// ```ignore
24/// procedure_digest!(
25///     BASIC_WALLET_RECEIVE_ASSET,
26///     BasicWallet::RECEIVE_ASSET_PROC_NAME,
27///     basic_wallet_library
28/// );
29/// ```
30#[macro_export]
31macro_rules! procedure_digest {
32    ($name:ident, $proc_name:expr, $library_fn:expr) => {
33        static $name: miden_objects::utils::sync::LazyLock<miden_objects::Word> =
34            miden_objects::utils::sync::LazyLock::new(|| {
35                let qualified_name = miden_objects::assembly::QualifiedProcedureName::new(
36                    ::core::default::Default::default(),
37                    miden_objects::assembly::ProcedureName::new($proc_name).unwrap_or_else(|_| {
38                        panic!("failed to create name for '{}' procedure", $proc_name)
39                    }),
40                );
41                $library_fn().get_procedure_root_by_name(qualified_name).unwrap_or_else(|| {
42                    panic!("{} should contain '{}' procedure", stringify!($library_fn), $proc_name)
43                })
44            });
45    };
46}