Simplifying Bitcoin client creation a bit
This commit is contained in:
@@ -75,7 +75,7 @@ impl BitcoinClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a Bitcoin descriptor wallet with the mnemonic in the given user directory.
|
/// Creates a Bitcoin descriptor wallet with the mnemonic in the given user directory.
|
||||||
pub(crate) fn create_wallet(name: &str, network: Network) -> anyhow::Result<BitcoinClient> {
|
pub(crate) fn create(name: &str, network: Network) -> anyhow::Result<BitcoinClient> {
|
||||||
let keys_dir = utils::home(name);
|
let keys_dir = utils::home(name);
|
||||||
|
|
||||||
let mnemonic_path = crate::utils::side_paths(keys_dir).1; // TODO: this tuple stinks
|
let mnemonic_path = crate::utils::side_paths(keys_dir).1; // TODO: this tuple stinks
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ use super::client::BitcoinClient;
|
|||||||
|
|
||||||
async fn setup() -> Result<(BitcoinClient, BitcoinClient), anyhow::Error> {
|
async fn setup() -> Result<(BitcoinClient, BitcoinClient), anyhow::Error> {
|
||||||
tracing_setup();
|
tracing_setup();
|
||||||
let dave = BitcoinClient::create_wallet("dave", Network::Signet)?;
|
let dave = BitcoinClient::create("dave", Network::Signet)?;
|
||||||
let sammy = BitcoinClient::create_wallet("sammy", Network::Signet)?;
|
let sammy = BitcoinClient::create("sammy", Network::Signet)?;
|
||||||
|
|
||||||
dave.sync()?;
|
dave.sync()?;
|
||||||
let _ = dave.wallet.get_balance();
|
let _ = dave.wallet.get_balance();
|
||||||
|
|||||||
Reference in New Issue
Block a user