|
1 | 1 | use super::*;
|
2 | 2 |
|
3 |
| -#[derive(Deserialize, Default, PartialEq, Debug)] |
| 3 | +#[derive(Deserialize, Default, PartialEq, Debug, Clone)] |
4 | 4 | #[serde(deny_unknown_fields)]
|
5 | 5 | pub(crate) struct Config {
|
6 |
| - pub(crate) hidden: HashSet<InscriptionId>, |
7 | 6 | pub(crate) bitcoin_rpc_pass: Option<String>,
|
8 | 7 | pub(crate) bitcoin_rpc_user: Option<String>,
|
9 |
| -} |
10 |
| - |
11 |
| -impl Config { |
12 |
| - pub(crate) fn is_hidden(&self, inscription_id: InscriptionId) -> bool { |
13 |
| - self.hidden.contains(&inscription_id) |
14 |
| - } |
| 8 | + pub(crate) chain: Option<Chain>, |
| 9 | + pub(crate) hidden: Option<HashSet<InscriptionId>>, |
15 | 10 | }
|
16 | 11 |
|
17 | 12 | #[cfg(test)]
|
18 | 13 | mod tests {
|
19 | 14 | use super::*;
|
20 | 15 |
|
21 |
| - #[test] |
22 |
| - fn inscriptions_can_be_hidden() { |
23 |
| - let a = "8d363b28528b0cb86b5fd48615493fb175bdf132d2a3d20b4251bba3f130a5abi0" |
24 |
| - .parse::<InscriptionId>() |
25 |
| - .unwrap(); |
26 |
| - |
27 |
| - let b = "8d363b28528b0cb86b5fd48615493fb175bdf132d2a3d20b4251bba3f130a5abi1" |
28 |
| - .parse::<InscriptionId>() |
29 |
| - .unwrap(); |
30 |
| - |
31 |
| - let config = Config { |
32 |
| - hidden: iter::once(a).collect(), |
33 |
| - ..Default::default() |
34 |
| - }; |
35 |
| - |
36 |
| - assert!(config.is_hidden(a)); |
37 |
| - assert!(!config.is_hidden(b)); |
38 |
| - } |
39 |
| - |
40 | 16 | #[test]
|
41 | 17 | fn example_config_file_is_valid() {
|
42 | 18 | let _: Config = serde_yaml::from_reader(File::open("ord.yaml").unwrap()).unwrap();
|
|
0 commit comments