Add command to display bitcoin wallet balance

This commit is contained in:
rishflab 2021-02-09 18:06:20 +11:00 committed by Daniel Karzel
parent 7e10c5e7c3
commit eb310be2c0
2 changed files with 16 additions and 0 deletions

View file

@ -56,6 +56,10 @@ pub enum Command {
#[structopt(flatten)]
config: Config,
},
Balance {
#[structopt(flatten)]
config: Config,
},
}
#[derive(structopt::StructOpt, Debug)]

View file

@ -343,6 +343,18 @@ async fn main() -> Result<()> {
let address = bitcoin_wallet.new_address().await?;
info!("Deposit bitcoin here: {}", address);
}
Command::Balance { config } => {
let (bitcoin_wallet, _) = init_wallets(
config.path,
bitcoin_network,
&wallet_data_dir,
monero_network,
seed,
)
.await?;
let balance = bitcoin_wallet.balance().await?;
info!("Bitcoin wallet balance: {}", balance.as_btc());
}
};
Ok(())