use super::client::BitcoinClient;
use bdk::bitcoin::Network;
use tracing::Level;
use tracing_subscriber::{filter, fmt, layer::Layer, prelude::*, Registry};

pub mod create_htlc;
pub mod simple_transfer;
pub mod transfer_policy;

async fn setup() -> Result<(BitcoinClient, BitcoinClient), anyhow::Error> {
    tracing_setup();
    let dave = BitcoinClient::create("dave", Network::Signet)?;
    let sammy = BitcoinClient::create("sammy", Network::Signet)?;

    Ok((dave, sammy))
}

fn tracing_setup() {
    // show only info level logs and above:
    let info = filter::LevelFilter::from_level(Level::INFO);

    // set up the tracing subscriber:
    let subscriber = Registry::default().with(fmt::layer().with_filter(info));
    tracing::subscriber::set_global_default(subscriber).unwrap();

    tracing::info!("Tracing initialized.");
}
