From e8cc037970381132a5e152e6bc83f311520ed675 Mon Sep 17 00:00:00 2001 From: Atif Nazir Date: Mon, 12 Oct 2026 18:38:45 -0700 Subject: [PATCH] Release 0.1.2: usual names for transaction kinds --- CHANGELOG.md | 9 ++++++++- Cargo.lock | 2 +- Cargo.toml | 2 +- src/commands.rs | 25 ++++++++++++++++++++++++- tests/cli.rs | 2 +- 5 files changed, 35 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90cd073..112a3fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,12 @@ names, environment variables, exit codes, error codes, and the shape of ## [Unreleased] +## [0.1.2] - 2026-10-13 + +### Changed + +- Transaction kinds use their usual names: CoinJoin, Lightning and MWEB. + ## [0.1.1] - 2026-10-12 ### Added @@ -39,6 +45,7 @@ names, environment variables, exit codes, error codes, and the shape of - `skill` and `mcp` to set up AI agents. - `schema` and `guide` for scripts and agents. -[Unreleased]: https://github.com/BlockIo/sochain-cli/compare/v0.1.1...HEAD +[Unreleased]: https://github.com/BlockIo/sochain-cli/compare/v0.1.2...HEAD +[0.1.2]: https://github.com/BlockIo/sochain-cli/compare/v0.1.1...v0.1.2 [0.1.1]: https://github.com/BlockIo/sochain-cli/compare/v0.1.0...v0.1.1 [0.1.0]: https://github.com/BlockIo/sochain-cli/releases/tag/v0.1.0 diff --git a/Cargo.lock b/Cargo.lock index ff42a90..9debb31 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1452,7 +1452,7 @@ checksum = "f9395f0f0eee849a9b707b2f06bb92a6a422090e2123bb2ef8e87a0e61892a8e" [[package]] name = "sochain-cli" -version = "0.1.1" +version = "0.1.2" dependencies = [ "assert_cmd", "clap", diff --git a/Cargo.toml b/Cargo.toml index d4463fd..bc33dc3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sochain-cli" -version = "0.1.1" +version = "0.1.2" edition = "2024" rust-version = "1.88" description = "Command-line interface for SoChain: Bitcoin, Litecoin, Dogecoin and Zcash blockchain data" diff --git a/src/commands.rs b/src/commands.rs index d6a42e5..4c8508b 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -647,7 +647,7 @@ fn show_transaction(out: &mut dyn Write, n: Network, tx: Transaction) -> Result< } else { "" }; - writeln!(out, "Kind {}{guess}", kind.replace('_', " "))?; + writeln!(out, "Kind {}{guess}", kind_name(kind))?; } writeln!(out, "From:")?; if tx.inputs.is_empty() { @@ -1207,6 +1207,20 @@ fn show_chart(out: &mut dyn Write, n: Network, r: Chart, last: usize) -> Result< Ok(()) } +/// A transaction kind as words, with names in their usual casing: +/// `coinjoin` is `CoinJoin`, `lightning_close` is `Lightning close`. +fn kind_name(kind: &str) -> String { + kind.split('_') + .map(|w| match w { + "coinjoin" => "CoinJoin", + "lightning" => "Lightning", + "mweb" => "MWEB", + w => w, + }) + .collect::>() + .join(" ") +} + /// `3 days 4 h`, `5 h 20 min`, `12 min`. fn duration(s: u64) -> String { let (d, h, m) = (s / 86_400, s % 86_400 / 3_600, s % 3_600 / 60); @@ -1531,6 +1545,15 @@ mod tests { assert_eq!(format_chart_value("tx_count", &Value::Null), "no data"); } + #[test] + fn names_transaction_kinds() { + assert_eq!(kind_name("coinjoin"), "CoinJoin"); + assert_eq!(kind_name("lightning_close"), "Lightning close"); + assert_eq!(kind_name("mweb_peg_in"), "MWEB peg in"); + assert_eq!(kind_name("batch_payout"), "batch payout"); + assert_eq!(kind_name("payment"), "payment"); + } + #[test] fn formats_durations() { assert_eq!(duration(30), "1 min"); diff --git a/tests/cli.rs b/tests/cli.rs index ffa5601..b13974e 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -1043,7 +1043,7 @@ fn transaction_kind_is_shown_with_its_certainty() { .args(["tx", "BTC", TXID]) .assert() .success() - .stdout(predicate::str::contains("Kind coinjoin (likely)\n")); + .stdout(predicate::str::contains("Kind CoinJoin (likely)\n")); sochain(&m, &config()) .args(["tx", "BTC", TXID]) .assert()