Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
25 changes: 24 additions & 1 deletion src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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::<Vec<_>>()
.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);
Expand Down Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Loading