Skip to content

Commit

Permalink
Derive Debug for relevant structs (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
ok300 authored Mar 21, 2024
1 parent a32fffe commit 4e3536f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 24 deletions.
4 changes: 2 additions & 2 deletions cli/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ pub(crate) fn handle_command(
.iter()
.map(|tx| {
format!(
"Id: {} | Type: {} | Amount: {} sat | Timestamp: {}",
"Id: {} | Type: {:?} | Amount: {} sat | Timestamp: {}",
tx.id.clone().unwrap_or("None".to_string()),
tx.payment_type.to_string(),
tx.payment_type,
tx.amount_sat,
match tx.timestamp {
Some(t) => t.to_string(),
Expand Down
25 changes: 3 additions & 22 deletions lib/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,6 @@ pub enum SwapStatus {
Completed,
}

impl ToString for SwapStatus {
fn to_string(&self) -> String {
match self {
SwapStatus::Mempool => "transaction.mempool",
SwapStatus::Completed => "transaction.mempool",
SwapStatus::Created => "swap.created",
}
.to_string()
}
}

pub struct ReceivePaymentRequest {
pub invoice_amount_sat: Option<u64>,
pub onchain_amount_sat: Option<u64>,
Expand Down Expand Up @@ -103,6 +92,7 @@ impl From<S5Error> for SwapError {
}
}

#[derive(Debug)]
pub struct WalletInfo {
pub balance_sat: u64,
pub pubkey: String,
Expand All @@ -128,23 +118,14 @@ pub struct OngoingSendSwap {
// pub onchain_amount_sat: Option<u64>,
}

#[derive(Debug)]
pub enum PaymentType {
Sent,
Received,
PendingReceive,
}

impl ToString for PaymentType {
fn to_string(&self) -> String {
match self {
PaymentType::Sent => "Sent",
PaymentType::Received => "Received",
PaymentType::PendingReceive => "Pending Receive",
}
.to_string()
}
}

#[derive(Debug)]
pub struct Payment {
pub id: Option<String>,
pub timestamp: Option<u32>,
Expand Down

0 comments on commit 4e3536f

Please sign in to comment.