forked from captainbuckkets/peercoin-ord
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunes.rs
138 lines (126 loc) Β· 3.14 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
use {super::*, ord::subcommand::runes::Output};
#[test]
fn flag_is_required() {
let rpc_server = test_bitcoincore_rpc::builder()
.network(Network::Regtest)
.build();
CommandBuilder::new("--regtest runes")
.rpc_server(&rpc_server)
.expected_exit_code(1)
.expected_stderr("error: `ord runes` requires index created with `--index-runes-pre-alpha-i-agree-to-get-rekt` flag\n")
.run_and_extract_stdout();
}
#[test]
fn no_runes() {
let rpc_server = test_bitcoincore_rpc::builder()
.network(Network::Regtest)
.build();
assert_eq!(
CommandBuilder::new("--index-runes-pre-alpha-i-agree-to-get-rekt --regtest runes")
.rpc_server(&rpc_server)
.run_and_deserialize_output::<Output>(),
Output {
runes: BTreeMap::new(),
}
);
}
#[test]
fn one_rune() {
let rpc_server = test_bitcoincore_rpc::builder()
.network(Network::Regtest)
.build();
create_wallet(&rpc_server);
let etch = etch(&rpc_server, Rune(RUNE));
assert_eq!(
CommandBuilder::new("--index-runes-pre-alpha-i-agree-to-get-rekt --regtest runes")
.rpc_server(&rpc_server)
.run_and_deserialize_output::<Output>(),
Output {
runes: vec![(
Rune(RUNE),
RuneInfo {
burned: 0,
divisibility: 0,
end: None,
etching: etch.transaction,
height: 2,
id: RuneId {
height: 2,
index: 1
},
index: 1,
limit: None,
number: 0,
rune: Rune(RUNE),
supply: 1000,
symbol: Some('Β’'),
timestamp: ord::timestamp(2),
}
)]
.into_iter()
.collect(),
}
);
}
#[test]
fn two_runes() {
let rpc_server = test_bitcoincore_rpc::builder()
.network(Network::Regtest)
.build();
create_wallet(&rpc_server);
let a = etch(&rpc_server, Rune(RUNE));
let b = etch(&rpc_server, Rune(RUNE + 1));
assert_eq!(
CommandBuilder::new("--index-runes-pre-alpha-i-agree-to-get-rekt --regtest runes")
.rpc_server(&rpc_server)
.run_and_deserialize_output::<Output>(),
Output {
runes: vec![
(
Rune(RUNE),
RuneInfo {
burned: 0,
divisibility: 0,
end: None,
etching: a.transaction,
height: 2,
id: RuneId {
height: 2,
index: 1
},
index: 1,
limit: None,
number: 0,
rune: Rune(RUNE),
supply: 1000,
symbol: Some('Β’'),
timestamp: ord::timestamp(2),
}
),
(
Rune(RUNE + 1),
RuneInfo {
burned: 0,
divisibility: 0,
end: None,
etching: b.transaction,
height: 4,
id: RuneId {
height: 4,
index: 1
},
index: 1,
limit: None,
number: 1,
rune: Rune(RUNE + 1),
supply: 1000,
symbol: Some('Β’'),
timestamp: ord::timestamp(4),
}
)
]
.into_iter()
.collect(),
}
);
}