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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ page. See [DEVELOPMENT_CYCLE.md](DEVELOPMENT_CYCLE.md) for more details.
- Fixed `key restore` ignoring `--password`, which restored passphrase-protected mnemonics to the wrong key
- Fixed `key generate` silently producing a 24-word mnemonic for any `--entropy` value other than 12; values other than 12 and 24 are now rejected
- Gated `full_scan`'s `--scan-stop-gap` to the Electrum and Esplora backends that use it; RPC and CBF wallets now reject the flag instead of silently ignoring it, while a `STOP_GAP` environment variable keeps working for supported backends and no longer breaks unsupported ones
- Changed `payjoin history` to return JSON instead of a rendered table

## [4.0.0]

Expand Down
60 changes: 0 additions & 60 deletions Cargo.lock

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

9 changes: 4 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ log = "0.4"
serde_json = "1.0"
thiserror = "2.0.18"
tokio = { version = "1", features = ["full"] }
cli-table = "0.5.0"
tracing = "0.1.44"
tracing-subscriber = "0.3.20"
toml = "1.1.0"
serde= {version = "1.0", features = ["derive"]}

Expand All @@ -34,6 +31,8 @@ bdk_esplora = { version = "0.22.2", default-features = false, features = ["async
bdk_kyoto = { version = "0.17.0", optional = true }
bdk_redb = { version = "0.2.0", optional = true }
bdk_sp = { version = "0.2.0", optional = true }
tracing = { version = "0.1.44", optional = true }
tracing-subscriber = { version = "0.3.20", optional = true }
shlex = { version = "1.3.0", optional = true }
payjoin = { version = "0.25.0", features = ["v1", "v2", "io", "_test-utils"], optional = true}
reqwest = { version = "0.13.2", default-features = false, features = ["rustls"], optional = true }
Expand All @@ -53,14 +52,14 @@ sqlite = ["bdk_wallet/rusqlite"]
redb = ["bdk_redb"]

# Available blockchain client options
cbf = ["bdk_kyoto", "_payjoin-dependencies"]
cbf = ["bdk_kyoto", "tracing", "tracing-subscriber", "_payjoin-dependencies"]
electrum = ["bdk_electrum", "_payjoin-dependencies"]
esplora = ["bdk_esplora", "_payjoin-dependencies"]
rpc = ["bdk_bitcoind_rpc", "_payjoin-dependencies"]
dns_payment = ["bitcoin-payment-instructions"]

# Internal features
_payjoin-dependencies = ["payjoin", "reqwest", "url", "sqlite"]
_payjoin-dependencies = ["payjoin", "reqwest", "url", "sqlite", "tracing"]
message_signer = ["bdk_message_signer"]

# Use this to consensus verify transactions at sync time
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/payjoin/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ mod tests {
assert!(table.contains(&active_recv_ids[0].to_string()));
assert!(table.contains(&inactive_send_ids[0].0.to_string()));
assert!(table.contains(&inactive_recv_ids[0].0.to_string()));
assert!(table.contains("Not Completed"));
assert!(table.contains("\"completed_at\": null"));

drop(active_sender);
drop(active_receiver);
Expand Down
37 changes: 9 additions & 28 deletions src/handlers/payjoin/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use bdk_wallet::{
SignOptions, Wallet,
bitcoin::{FeeRate, Psbt, Txid, consensus::encode::serialize_hex},
};
use cli_table::{Cell, CellStruct, Style, Table};
use payjoin::bitcoin::TxIn;
use payjoin::persist::{OptionalTransitionOutcome, SessionPersister};
use payjoin::receive::InputPair;
Expand All @@ -21,6 +20,7 @@ use payjoin::send::v2::{
replay_event_log as replay_sender_event_log,
};
use payjoin::{HpkePublicKey, ImplementationError, UriExt};
use serde::Serialize;
use serde_json::{json, to_string_pretty};
use std::{path::PathBuf, sync::Arc};

Expand Down Expand Up @@ -92,6 +92,12 @@ impl StatusText for ReceiveSession {
}
}

#[derive(Serialize)]
struct SessionHistory<'a> {
sessions: Vec<&'a SessionHistoryRow>,
}

#[derive(Serialize)]
struct SessionHistoryRow {
id: String,
role: &'static str,
Expand Down Expand Up @@ -1050,33 +1056,8 @@ impl<'a> PayjoinManager<'a> {
});
}

let rows: Vec<Vec<CellStruct>> = send_rows
.iter()
.chain(recv_rows.iter())
.map(|row| {
vec![
row.id.as_str().cell(),
row.role.cell(),
row.completed_at
.clone()
.unwrap_or_else(|| "Not Completed".to_string())
.cell(),
row.status.as_str().cell(),
]
})
.collect();
let sessions: Vec<&SessionHistoryRow> = send_rows.iter().chain(recv_rows.iter()).collect();

let table = rows
.table()
.title(vec![
"Session ID".cell().bold(true),
"Sender/Receiver".cell().bold(true),
"Completed At".cell().bold(true),
"Status".cell().bold(true),
])
.display()
.map_err(|e| Error::Generic(e.to_string()))?;

Ok(format!("{table}"))
Ok(to_string_pretty(&SessionHistory { sessions })?)
}
}
Loading