forked from apezord/ord-dogecoin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.rs
35 lines (28 loc) Β· 775 Bytes
/
config.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use super::*;
#[derive(Deserialize, Default, PartialEq, Debug)]
pub(crate) struct Config {
pub(crate) hidden: HashSet<InscriptionId>,
}
impl Config {
pub(crate) fn is_hidden(&self, inscription_id: InscriptionId) -> bool {
self.hidden.contains(&inscription_id)
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn inscriptions_can_be_hidden() {
let a = "8d363b28528b0cb86b5fd48615493fb175bdf132d2a3d20b4251bba3f130a5abi0"
.parse::<InscriptionId>()
.unwrap();
let b = "8d363b28528b0cb86b5fd48615493fb175bdf132d2a3d20b4251bba3f130a5abi1"
.parse::<InscriptionId>()
.unwrap();
let config = Config {
hidden: iter::once(a).collect(),
};
assert!(config.is_hidden(a));
assert!(!config.is_hidden(b));
}
}