#![doc = include_str!("../README.md")]
#![doc(html_logo_url = "https://github.com/bitcoindevkit/bdk/raw/master/static/bdk.png")]
#![warn(missing_docs)]
mod commands;
mod config;
mod error;
mod handlers;
#[cfg(any(
feature = "electrum",
feature = "esplora",
feature = "cbf",
feature = "rpc"
))]
mod payjoin;
#[cfg(any(feature = "sqlite", feature = "redb"))]
mod persister;
mod utils;
use bdk_wallet::bitcoin::Network;
use log::{debug, error, warn};
use crate::commands::CliOpts;
use crate::handlers::*;
use clap::Parser;
#[tokio::main]
async fn main() {
env_logger::init();
let cli_opts: CliOpts = CliOpts::parse();
let network = &cli_opts.network;
debug!("network: {network:?}");
if network == &Network::Bitcoin {
warn!(
"This is experimental software and not currently recommended for use on Bitcoin mainnet, proceed with caution."
)
}
match handle_command(cli_opts).await {
Ok(result) => println!("{result}"),
Err(e) => {
error!("{e}");
std::process::exit(1);
}
}
}