-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
runes.rs
143 lines (128 loc) Β· 3.38 KB
/
runes.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
use {super::*, ord::subcommand::runes::Output};
#[test]
fn flag_is_required() {
let core = mockcore::builder().network(Network::Regtest).build();
let ord = TestServer::spawn_with_server_args(&core, &["--regtest"], &[]);
CommandBuilder::new("--regtest runes")
.core(&core)
.ord(&ord)
.expected_exit_code(1)
.expected_stderr("error: `ord runes` requires index created with `--index-runes` flag\n")
.run_and_extract_stdout();
}
#[test]
fn no_runes() {
let core = mockcore::builder().network(Network::Regtest).build();
assert_eq!(
CommandBuilder::new("--index-runes --regtest runes")
.core(&core)
.run_and_deserialize_output::<Output>(),
Output {
runes: BTreeMap::new(),
}
);
}
#[test]
fn one_rune() {
let core = mockcore::builder().network(Network::Regtest).build();
let ord = TestServer::spawn_with_server_args(&core, &["--regtest", "--index-runes"], &[]);
create_wallet(&core, &ord);
let etch = etch(&core, &ord, Rune(RUNE));
pretty_assert_eq!(
CommandBuilder::new("--index-runes --regtest runes")
.core(&core)
.run_and_deserialize_output::<Output>(),
Output {
runes: vec![(
Rune(RUNE),
RuneInfo {
block: 7,
burned: 0,
divisibility: 0,
etching: etch.output.reveal,
id: RuneId { block: 7, tx: 1 },
terms: None,
mints: 0,
number: 0,
premine: 1000,
rune: SpacedRune {
rune: Rune(RUNE),
spacers: 0
},
supply: 1000,
symbol: Some('Β’'),
timestamp: ord::timestamp(7),
turbo: false,
tx: 1,
}
)]
.into_iter()
.collect(),
}
);
}
#[test]
fn two_runes() {
let core = mockcore::builder().network(Network::Regtest).build();
let ord = TestServer::spawn_with_server_args(&core, &["--regtest", "--index-runes"], &[]);
create_wallet(&core, &ord);
let a = etch(&core, &ord, Rune(RUNE));
let b = etch(&core, &ord, Rune(RUNE + 1));
pretty_assert_eq!(
CommandBuilder::new("--index-runes --regtest runes")
.core(&core)
.run_and_deserialize_output::<Output>(),
Output {
runes: vec![
(
Rune(RUNE),
RuneInfo {
block: 7,
burned: 0,
divisibility: 0,
etching: a.output.reveal,
id: RuneId { block: 7, tx: 1 },
terms: None,
mints: 0,
number: 0,
premine: 1000,
rune: SpacedRune {
rune: Rune(RUNE),
spacers: 0
},
supply: 1000,
symbol: Some('Β’'),
timestamp: ord::timestamp(7),
turbo: false,
tx: 1,
}
),
(
Rune(RUNE + 1),
RuneInfo {
block: 14,
burned: 0,
divisibility: 0,
etching: b.output.reveal,
id: RuneId { block: 14, tx: 1 },
terms: None,
mints: 0,
number: 1,
premine: 1000,
rune: SpacedRune {
rune: Rune(RUNE + 1),
spacers: 0
},
supply: 1000,
symbol: Some('Β’'),
timestamp: ord::timestamp(14),
turbo: false,
tx: 1,
}
)
]
.into_iter()
.collect(),
}
);
}