/ fedimintd / src / lib.rs
lib.rs
 1  /// Module for creating `fedimintd` binary with custom modules
 2  use bitcoin::Network;
 3  use fedimint_core::envs::BitcoinRpcConfig;
 4  use fedimint_core::util::SafeUrl;
 5  pub use fedimintd::*;
 6  
 7  mod fedimintd;
 8  
 9  pub mod envs;
10  use crate::envs::FM_PORT_ESPLORA_ENV;
11  
12  pub fn default_esplora_server(network: Network) -> BitcoinRpcConfig {
13      let url = match network {
14          Network::Bitcoin => SafeUrl::parse("https://blockstream.info/api/")
15              .expect("Failed to parse default esplora server"),
16          Network::Testnet => SafeUrl::parse("https://blockstream.info/testnet/api/")
17              .expect("Failed to parse default esplora server"),
18          Network::Regtest => SafeUrl::parse(&format!(
19              "http://127.0.0.1:{}/",
20              std::env::var(FM_PORT_ESPLORA_ENV).unwrap_or(String::from("50002"))
21          ))
22          .expect("Failed to parse default esplora server"),
23          Network::Signet => SafeUrl::parse("https://mutinynet.com/api/")
24              .expect("Failed to parse default esplora server"),
25          _ => panic!("Failed to parse default esplora server"),
26      };
27      BitcoinRpcConfig {
28          kind: "esplora".to_string(),
29          url,
30      }
31  }