mirror of
https://github.com/aljazceru/breez-sdk-liquid.git
synced 2026-01-28 10:24:28 +01:00
feat: add invoice_amount_sat field to swaps (#33)
* fix: rebasing and updating cargo.lock * feat: add `requested-amount-sat` field to pending swaps * lint * feat: added list-payments method * linting * feat: adding pending transactions to list-payments * fix: rename received_amount to invoice_amount * fix: renaming Pending to PendingReceive * fix: remove expect from preimage unwrapping
This commit is contained in:
@@ -16,6 +16,8 @@ pub(crate) enum Command {
|
||||
SendPayment { bolt11: String },
|
||||
/// Receive lbtc and send btc through a swap
|
||||
ReceivePayment { amount_sat: u64 },
|
||||
/// List incoming and outgoing payments
|
||||
ListPayments,
|
||||
/// Get the balance of the currently loaded wallet
|
||||
GetInfo,
|
||||
}
|
||||
@@ -56,7 +58,7 @@ pub(crate) async fn handle_command(
|
||||
response.txid
|
||||
))
|
||||
}
|
||||
Command::GetInfo {} => {
|
||||
Command::GetInfo => {
|
||||
let info = wallet.get_info(true)?;
|
||||
|
||||
Ok(format!(
|
||||
@@ -64,5 +66,26 @@ pub(crate) async fn handle_command(
|
||||
info.balance_sat, info.pubkey, info.active_address
|
||||
))
|
||||
}
|
||||
Command::ListPayments => {
|
||||
let payments_str = wallet
|
||||
.list_payments(true, true)?
|
||||
.iter()
|
||||
.map(|tx| {
|
||||
format!(
|
||||
"Id: {} | Type: {} | Amount: {} sat | Timestamp: {}",
|
||||
tx.id.clone().unwrap_or("None".to_string()),
|
||||
tx.payment_type.to_string(),
|
||||
tx.amount_sat,
|
||||
match tx.timestamp {
|
||||
Some(t) => t.to_string(),
|
||||
None => "None".to_string(),
|
||||
},
|
||||
)
|
||||
})
|
||||
.collect::<Vec<String>>()
|
||||
.join("\n");
|
||||
|
||||
Ok(payments_str)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user