forked from bitcoindevkit/bdk-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.rs
More file actions
47 lines (40 loc) · 1.3 KB
/
main.rs
File metadata and controls
47 lines (40 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright (c) 2020-2025 Bitcoin Dev Kit Developers
//
// This file is licensed under the Apache License, Version 2.0 <LICENSE-APACHE
// or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
// You may not use this file except in accordance with one or both of these
// licenses.
#![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 error;
mod handlers;
#[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);
}
}
}