Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Derive Debug for relevant structs #45

Merged
merged 1 commit into from
Mar 21, 2024
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
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) async 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