1use bitcoin::Network;
2use reqwest::Client;
3mod addresses;
4mod transactions;
5
6pub struct MempoolClient {
7 client: Client,
8 base_url: String,
9}
10
11impl MempoolClient {
12 pub fn new(network: Network) -> Self {
13 let base_url = match network {
14 Network::Bitcoin => "https://mempool.space/api",
15 Network::Testnet => "https://mempool.space/testnet/api",
16 Network::Signet => "https://mempool.space/signet/api",
17 Network::Regtest => "https://mempool.space/regtest/api",
18 Network::Testnet4 => "https://mempool.space/testnet4/api",
19 _ => panic!("Unsupported network"),
20 }
21 .to_string();
22
23 Self {
24 client: Client::new(),
25 base_url,
26 }
27 }
28
29 pub fn new_with_endpoint(endpoint: &str) -> Self {
30 Self {
31 client: Client::new(),
32 base_url: endpoint.to_string(),
33 }
34 }
35}