miden_base_sys/bindings/
types.rs

1use miden_stdlib_sys::{Felt, Word};
2
3#[repr(transparent)]
4#[derive(Copy, Clone)]
5pub struct AccountId(Felt);
6
7impl AccountId {
8    #[inline(always)]
9    pub const fn as_felt(&self) -> Felt {
10        self.0
11    }
12}
13
14impl From<AccountId> for Felt {
15    fn from(account_id: AccountId) -> Felt {
16        account_id.0
17    }
18}
19
20#[repr(transparent)]
21pub struct Asset {
22    pub inner: Word,
23}
24
25impl Asset {
26    pub fn new(word: impl Into<Word>) -> Self {
27        Asset { inner: word.into() }
28    }
29
30    pub fn as_word(&self) -> &Word {
31        &self.inner
32    }
33}
34
35impl From<Word> for Asset {
36    fn from(value: Word) -> Self {
37        Self::new(value)
38    }
39}
40
41impl From<Asset> for Word {
42    fn from(val: Asset) -> Self {
43        val.inner
44    }
45}
46
47impl AsRef<Word> for Asset {
48    fn as_ref(&self) -> &Word {
49        &self.inner
50    }
51}
52
53#[repr(transparent)]
54pub struct Recipient {
55    pub inner: Word,
56}
57
58#[repr(transparent)]
59pub struct Tag {
60    pub inner: Felt,
61}
62
63#[repr(transparent)]
64pub struct NoteId(pub(crate) Felt);
65
66#[repr(transparent)]
67pub struct NoteType {
68    pub inner: Felt,
69}
70
71#[repr(transparent)]
72pub struct StorageCommitmentRoot(Word);