Skip to content

Commit

Permalink
Merge pull request #702 from getlipa/feature/breez/add-pocket-offer-e…
Browse files Browse the repository at this point in the history
…rror-code

Add pocket offer error code
  • Loading branch information
danielgranhao authored Oct 20, 2023
2 parents d56ebb7 + 9585914 commit f1621c3
Show file tree
Hide file tree
Showing 5 changed files with 345 additions and 10 deletions.
8 changes: 7 additions & 1 deletion examples/3l-node/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,7 @@ fn list_offers(node: &LightningNode) -> Result<(), String> {
topup_value_minor_units,
exchange_fee_minor_units,
exchange_fee_rate_permyriad,
error,
} => {
println!(" ID: {id}");
println!(
Expand All @@ -628,6 +629,10 @@ fn list_offers(node: &LightningNode) -> Result<(), String> {
" Exchange at: {}",
exchanged_at.format("%d/%m/%Y %T UTC"),
);

if let Some(e) = error {
println!(" Failure reason: {:?}", e);
}
}
}
println!(" Status: {:?}", offer.status);
Expand Down Expand Up @@ -709,14 +714,15 @@ fn offer_to_string(offer: Option<OfferKind>) -> String {
topup_value_minor_units,
exchange_fee_minor_units,
exchange_fee_rate_permyriad,
..
}) => {
let updated_at: DateTime<Utc> = updated_at.into();
format!(
"Pocket exchange ({id}) of {:.2} {currency_code} at {} at rate {rate} SATS per {currency_code}, fee was {:.2}% or {:.2} {currency_code}",
topup_value_minor_units as f64 / 100f64,
updated_at.format("%d/%m/%Y %T UTC"),
exchange_fee_rate_permyriad as f64 / 100f64,
exchange_fee_minor_units as f64 / 100f64
exchange_fee_minor_units as f64 / 100f64,
)
}
None => "None".to_string(),
Expand Down
Loading

0 comments on commit f1621c3

Please sign in to comment.