ord/subcommand/wallet/
transactions.rs

1use super::*;
2
3#[derive(Debug, Parser)]
4pub(crate) struct Transactions {
5  #[arg(long, help = "Fetch at most <LIMIT> transactions.")]
6  limit: Option<u16>,
7}
8
9#[derive(Serialize, Deserialize)]
10pub struct Output {
11  pub transaction: Txid,
12  pub confirmations: i32,
13}
14
15impl Transactions {
16  pub(crate) fn run(self, wallet: Wallet) -> SubcommandResult {
17    let client = wallet.bitcoin_client();
18
19    let mut output = Vec::new();
20    for tx in client.list_transactions(
21      None,
22      Some(self.limit.unwrap_or(u16::MAX).into()),
23      None,
24      None,
25    )? {
26      output.push(Output {
27        transaction: tx.info.txid,
28        confirmations: tx.info.confirmations,
29      });
30    }
31
32    Ok(Some(Box::new(output)))
33  }
34}