diff --git a/Cargo.lock b/Cargo.lock index 506b279..87cdd31 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -571,7 +571,7 @@ dependencies = [ "http 1.1.0", "http-body 1.0.1", "http-body-util", - "hyper 1.5.0", + "hyper 1.4.1", "hyper-util", "itoa", "matchit", @@ -2476,9 +2476,9 @@ dependencies = [ [[package]] name = "hyper" -version = "1.5.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" dependencies = [ "bytes", "futures-channel", @@ -2517,9 +2517,9 @@ checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", "http 1.1.0", - "hyper 1.5.0", + "hyper 1.4.1", "hyper-util", - "rustls 0.23.15", + "rustls 0.23.14", "rustls-pki-types", "tokio", "tokio-rustls 0.26.0", @@ -2545,7 +2545,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3203a961e5c83b6f5498933e78b6b263e208c197b63e9c6c53cc82ffd3f63793" dependencies = [ - "hyper 1.5.0", + "hyper 1.4.1", "hyper-util", "pin-project-lite", "tokio", @@ -2573,7 +2573,7 @@ checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", "http-body-util", - "hyper 1.5.0", + "hyper 1.4.1", "hyper-util", "native-tls", "tokio", @@ -2592,7 +2592,7 @@ dependencies = [ "futures-util", "http 1.1.0", "http-body 1.0.1", - "hyper 1.5.0", + "hyper 1.4.1", "pin-project-lite", "socket2", "tokio", @@ -3404,9 +3404,9 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "openssl" -version = "0.10.68" +version = "0.10.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" +checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" dependencies = [ "bitflags 2.6.0", "cfg-if", @@ -3445,9 +3445,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.104" +version = "0.9.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" +checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" dependencies = [ "cc", "libc", @@ -4168,7 +4168,7 @@ dependencies = [ "quinn-proto", "quinn-udp", "rustc-hash 2.0.0", - "rustls 0.23.15", + "rustls 0.23.14", "socket2", "thiserror", "tokio", @@ -4185,7 +4185,7 @@ dependencies = [ "rand", "ring 0.17.8", "rustc-hash 2.0.0", - "rustls 0.23.15", + "rustls 0.23.14", "slab", "thiserror", "tinyvec", @@ -4383,7 +4383,7 @@ dependencies = [ "http 1.1.0", "http-body 1.0.1", "http-body-util", - "hyper 1.5.0", + "hyper 1.4.1", "hyper-rustls 0.27.3", "hyper-tls 0.6.0", "hyper-util", @@ -4396,7 +4396,7 @@ dependencies = [ "percent-encoding", "pin-project-lite", "quinn", - "rustls 0.23.15", + "rustls 0.23.14", "rustls-pemfile 2.2.0", "rustls-pki-types", "serde", @@ -4719,9 +4719,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.15" +version = "0.23.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fbb44d7acc4e873d613422379f69f237a1b141928c02f6bc6ccfddddc2d7993" +checksum = "415d9944693cb90382053259f89fbb077ea730ad7273047ec63b19bc9b160ba8" dependencies = [ "log", "once_cell", @@ -4764,9 +4764,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.10.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" +checksum = "0e696e35370c65c9c541198af4543ccd580cf17fc25d8e05c5a242b202488c55" [[package]] name = "rustls-webpki" @@ -6099,7 +6099,7 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.23.15", + "rustls 0.23.14", "rustls-pki-types", "tokio", ] @@ -6150,7 +6150,7 @@ dependencies = [ "futures-util", "log", "native-tls", - "rustls 0.23.15", + "rustls 0.23.14", "rustls-pki-types", "tokio", "tokio-native-tls", @@ -6257,7 +6257,7 @@ dependencies = [ "http 1.1.0", "http-body 1.0.1", "http-body-util", - "hyper 1.5.0", + "hyper 1.4.1", "hyper-timeout 0.5.1", "hyper-util", "percent-encoding", @@ -6491,7 +6491,7 @@ dependencies = [ "log", "native-tls", "rand", - "rustls 0.23.15", + "rustls 0.23.14", "rustls-pki-types", "sha1", "thiserror", diff --git a/README.md b/README.md index 627bede..47604db 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ If you like what we do, consider starring, sharing and contributing! - `JWT` token authentication` (tested with Auth0, Supabase). - `RBAC`. Fine grained authorization per route. - Data availability through pagination and advanced search. +- API keys authentication Numeraire SwissKnife ships with a [Dashboard](https://github.com/bitcoin-numeraire/swissknife-dashboard). @@ -47,6 +48,10 @@ SwissKnife allows direct Lightning integration, supporting the most used node im - Non-custodial - Automatic node management. - Automatic liquidity management via LSPs (user can switch LSPs) +- [`LND`](https://github.com/lightningnetwork/lnd) + - Non-custodial + - Run your own node + - Manage your own liquidity ## Documentation @@ -57,10 +62,9 @@ Extended documentation is available [here](https://docs.numeraire.tech/swissknif #### Features - [ ] Webhooks -- [x] API keys authentication - [ ] BOLT12 (offers) - [ ] Notifications (Email, SMS by Twilio) -- [ ] Dockerhub images +- [x] Dockerhub images - [ ] Desktop applications - [ ] Helm Charts @@ -74,10 +78,6 @@ Extended documentation is available [here](https://docs.numeraire.tech/swissknif - Custodial - Automatic node management - Automatic liquidity management via Lightspark -- [ ] [`LND`](https://github.com/lightningnetwork/lnd) - - Non-custodial - - Run your own node - - Manage your own liquidity #### Smart contracts diff --git a/src/infra/lightning/cln/cln_grpc_client.rs b/src/infra/lightning/cln/cln_grpc_client.rs index 400e8cd..c393e62 100644 --- a/src/infra/lightning/cln/cln_grpc_client.rs +++ b/src/infra/lightning/cln/cln_grpc_client.rs @@ -168,7 +168,7 @@ impl LnClient for ClnGrpcClient { label: Some(Uuid::new_v4().to_string()), maxfeepercent: self.maxfeepercent, retry_for: self.retry_for, - exemptfee: self.payment_exemptfee.clone(), + exemptfee: self.payment_exemptfee, ..Default::default() }) .await diff --git a/src/infra/lightning/cln/cln_grpc_types.rs b/src/infra/lightning/cln/cln_grpc_types.rs index 50e82f7..a2004f3 100644 --- a/src/infra/lightning/cln/cln_grpc_types.rs +++ b/src/infra/lightning/cln/cln_grpc_types.rs @@ -34,7 +34,7 @@ impl From for Payment { ledger: Ledger::Lightning, payment_hash: Some(val.payment_hash.to_hex()), payment_preimage: Some(val.payment_preimage.to_hex()), - amount_msat: val.amount_sent_msat.clone().unwrap().msat, + amount_msat: val.amount_sent_msat.unwrap().msat, fee_msat: Some(val.amount_sent_msat.unwrap().msat - val.amount_msat.unwrap().msat), payment_time: Some(Utc.timestamp_opt(seconds, nanoseconds).unwrap()), error, diff --git a/src/infra/lightning/lnd/lnd_rest_client.rs b/src/infra/lightning/lnd/lnd_rest_client.rs index 47f6faa..66d3518 100644 --- a/src/infra/lightning/lnd/lnd_rest_client.rs +++ b/src/infra/lightning/lnd/lnd_rest_client.rs @@ -201,7 +201,7 @@ impl LnClient for LndRestClient { }; if deschashonly { - payload.description_hash = sha256::Hash::hash(&description.as_bytes()).to_string(); + payload.description_hash = sha256::Hash::hash(description.as_bytes()).to_string(); } let response: AddInvoiceResponse = self diff --git a/src/infra/lightning/lnd/lnd_websocket_client.rs b/src/infra/lightning/lnd/lnd_websocket_client.rs index bc2c0c6..3259294 100644 --- a/src/infra/lightning/lnd/lnd_websocket_client.rs +++ b/src/infra/lightning/lnd/lnd_websocket_client.rs @@ -132,14 +132,13 @@ async fn process_message(text: &str, ln_events: Arc) -> an if let Some(event) = value.get("result") { match serde_json::from_value::(event.clone()) { - Ok(invoice) => match invoice.state.as_str() { - "SETTLED" => { + Ok(invoice) => { + if invoice.state.as_str() == "SETTLED" { if let Err(err) = ln_events.invoice_paid(invoice.into()).await { warn!(%err, "Failed to process incoming payment"); } } - _ => {} - }, + } Err(err) => { error!(%err, "Failed to parse SubscribeInvoices event"); }