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

Expose error code for pocket offers #697

Closed
Closed
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
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ name = "uniffi_lipalightninglib"
nigiri = []

[dependencies]
chameleon = { git = "https://github.com/getlipa/wild", tag = "v1.12.0" }
crow = { git = "https://github.com/getlipa/wild", tag = "v1.12.0" }
honey-badger = { git = "https://github.com/getlipa/wild", tag = "v1.12.0" }
graphql = { git = "https://github.com/getlipa/wild", tag = "v1.12.0" }
chameleon = { git = "https://github.com/getlipa/wild/", tag = "v1.13.0" }
crow = { git = "https://github.com/getlipa/wild/", tag = "v1.13.0" }
honey-badger = { git = "https://github.com/getlipa/wild/", tag = "v1.13.0" }
graphql = { git = "https://github.com/getlipa/wild/", tag = "v1.13.0" }
perro = { git = "https://github.com/getlipa/perro", tag = "v1.1.0" }

breez-sdk-core = { git = "https://github.com/breez/breez-sdk", tag = "0.2.5" }
Expand Down
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