Skip to content

Commit

Permalink
add list_swaps to cli
Browse files Browse the repository at this point in the history
  • Loading branch information
JssDWt committed Nov 8, 2024
1 parent 4083e90 commit 318b42b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tools/sdk-cli/src/command_handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use anyhow::{anyhow, Context, Error, Result};
use breez_sdk_core::InputType::{LnUrlAuth, LnUrlPay, LnUrlWithdraw};
use breez_sdk_core::{
parse, BreezEvent, BreezServices, BuyBitcoinRequest, CheckMessageRequest, ConnectRequest,
EventListener, GreenlightCredentials, ListPaymentsRequest, LnUrlPayRequest,
EventListener, GreenlightCredentials, ListPaymentsRequest, ListSwapsRequest, LnUrlPayRequest,
LnUrlWithdrawRequest, MetadataFilter, PayOnchainRequest, PrepareOnchainPaymentRequest,
PrepareRedeemOnchainFundsRequest, PrepareRefundRequest, ReceiveOnchainRequest,
ReceivePaymentRequest, RedeemOnchainFundsRequest, RefundRequest, ReportIssueRequest,
Expand Down Expand Up @@ -459,6 +459,16 @@ pub(crate) async fn handle_command(
.await?;
Ok(format!("Refund tx: {}", res.refund_tx_id))
}
Commands::ListSwaps { offset, limit } => {
let res = sdk()?
.list_swaps(ListSwapsRequest {
offset,
limit,
..Default::default()
})
.await?;
Ok(serde_json::to_string_pretty(&res)?)
}
Commands::SignMessage { message } => {
let req = SignMessageRequest { message };
let res = sdk()?.sign_message(req).await?;
Expand Down
8 changes: 8 additions & 0 deletions tools/sdk-cli/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@ pub(crate) enum Commands {
sat_per_vbyte: u32,
},

ListSwaps {
#[clap(short = 'o', long = "offset")]
offset: Option<u32>,

#[clap(short = 'l', long = "limit")]
limit: Option<u32>,
},

/// [swap-out] Send on-chain using a reverse swap
SendOnchain {
amount_sat: u64,
Expand Down

0 comments on commit 318b42b

Please sign in to comment.