forked from ordinals/ord
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lib.rs
87 lines (76 loc) Β· 1.79 KB
/
lib.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
#![allow(clippy::type_complexity)]
use {
self::{command_builder::CommandBuilder, expected::Expected, test_server::TestServer},
bip39::Mnemonic,
bitcoin::{blockdata::constants::COIN_VALUE, Network, OutPoint, Txid},
executable_path::executable_path,
pretty_assertions::assert_eq as pretty_assert_eq,
regex::Regex,
reqwest::{StatusCode, Url},
serde::{de::DeserializeOwned, Deserialize},
std::{
fs,
net::TcpListener,
path::Path,
process::{Child, Command, Stdio},
str::{self, FromStr},
thread,
time::Duration,
},
tempfile::TempDir,
test_bitcoincore_rpc::Sent,
};
macro_rules! assert_regex_match {
($string:expr, $pattern:expr $(,)?) => {
let regex = Regex::new(&format!("^(?s){}$", $pattern)).unwrap();
let string = $string;
if !regex.is_match(string.as_ref()) {
panic!(
"Regex:\n\n{}\n\nβ¦did not match string:\n\n{}",
regex, string
);
}
};
}
#[derive(Deserialize, Debug)]
struct Inscribe {
#[allow(dead_code)]
commit: Txid,
inscription: String,
reveal: Txid,
fees: u64,
}
fn inscribe(rpc_server: &test_bitcoincore_rpc::Handle) -> Inscribe {
rpc_server.mine_blocks(1);
let output = CommandBuilder::new("wallet inscribe --fee-rate 1 foo.txt")
.write("foo.txt", "FOO")
.rpc_server(rpc_server)
.output();
rpc_server.mine_blocks(1);
output
}
#[derive(Deserialize)]
struct Create {
mnemonic: Mnemonic,
}
fn create_wallet(rpc_server: &test_bitcoincore_rpc::Handle) {
CommandBuilder::new(format!("--chain {} wallet create", rpc_server.network()))
.rpc_server(rpc_server)
.output::<Create>();
}
mod command_builder;
mod core;
mod epochs;
mod expected;
mod find;
mod index;
mod info;
mod list;
mod parse;
mod server;
mod subsidy;
mod supply;
mod test_server;
mod traits;
mod version;
mod wallet;