• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

payjoin / rust-payjoin / 17444435859

03 Sep 2025 07:49PM UTC coverage: 84.73% (-1.2%) from 85.946%
17444435859

Pull #1039

github

web-flow
Merge e78b4ff91 into 31258eb86
Pull Request #1039: WIP - display session history

1 of 138 new or added lines in 6 files covered. (0.72%)

29 existing lines in 1 file now uncovered.

8201 of 9679 relevant lines covered (84.73%)

482.89 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

78.26
/payjoin-cli/src/main.rs
1
use anyhow::Result;
2
use app::config::Config;
3
use app::App as AppTrait;
4
use clap::Parser;
5
use cli::{Cli, Commands};
6
use tracing_subscriber::filter::LevelFilter;
7
use tracing_subscriber::EnvFilter;
8

9
mod app;
10
mod cli;
11
mod db;
12

13
#[cfg(not(any(feature = "v1", feature = "v2")))]
14
compile_error!("At least one of the features ['v1', 'v2'] must be enabled");
15

16
#[tokio::main]
17
async fn main() -> Result<()> {
12✔
18
    let env_filter =
12✔
19
        EnvFilter::builder().with_default_directive(LevelFilter::INFO.into()).from_env_lossy();
12✔
20
    tracing_subscriber::fmt().with_target(true).with_level(true).with_env_filter(env_filter).init();
12✔
21

22
    let cli = Cli::parse();
12✔
23
    let config = Config::new(&cli)?;
12✔
24

25
    #[allow(clippy::if_same_then_else)]
26
    let app: Box<dyn AppTrait> = if cli.flags.bip78.unwrap_or(false) {
12✔
27
        #[cfg(feature = "v1")]
28
        {
29
            Box::new(crate::app::v1::App::new(config).await?)
5✔
30
        }
31
        #[cfg(not(feature = "v1"))]
32
        {
33
            anyhow::bail!(
34
                "BIP78 (v1) support is not enabled in this build. Recompile with --features v1"
35
            )
36
        }
37
    } else if cli.flags.bip77.unwrap_or(false) {
7✔
38
        #[cfg(feature = "v2")]
39
        {
40
            Box::new(crate::app::v2::App::new(config).await?)
×
41
        }
42
        #[cfg(not(feature = "v2"))]
43
        {
44
            anyhow::bail!(
×
45
                "BIP77 (v2) support is not enabled in this build. Recompile with --features v2"
×
46
            )
47
        }
48
    } else {
49
        #[cfg(feature = "v2")]
50
        {
51
            Box::new(crate::app::v2::App::new(config).await?)
7✔
52
        }
53
        #[cfg(all(feature = "v1", not(feature = "v2")))]
54
        {
55
            Box::new(crate::app::v1::App::new(config).await?)
×
56
        }
57
        #[cfg(not(any(feature = "v1", feature = "v2")))]
58
        {
59
            anyhow::bail!("No valid version available - must compile with v1 or v2 feature")
60
        }
61
    };
62

63
    match &cli.command {
12✔
64
        Commands::Send { bip21, fee_rate } => {
5✔
65
            app.send_payjoin(bip21, *fee_rate).await?;
5✔
66
        }
67
        Commands::Receive { amount, .. } => {
4✔
68
            app.receive_payjoin(*amount).await?;
4✔
69
        }
70
        #[cfg(feature = "v2")]
71
        Commands::Resume => {
72
            app.resume_payjoins().await?;
3✔
73
        }
74
        #[cfg(feature = "v2")]
75
        Commands::History => {
NEW
76
            app.history().await?;
×
77
        }
78
    };
79

80
    Ok(())
22✔
81
}
12✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc