Quellcode durchsuchen

chore: update deps (#761)

thesimplekid vor 1 Monat
Ursprung
Commit
abf10da330

+ 5 - 6
Cargo.toml

@@ -59,10 +59,10 @@ clap = { version = "4.5.31", features = ["derive"] }
 ciborium = { version = "0.2.2", default-features = false, features = ["std"] }
 cbor-diag = "0.1.12"
 futures = { version = "0.3.28", default-features = false, features = ["async-await"] }
-lightning-invoice = { version = "0.32.0", features = ["serde", "std"] }
+lightning-invoice = { version = "0.33.0", features = ["serde", "std"] }
 serde = { version = "1", features = ["derive"] }
 serde_json = "1"
-thiserror = { version = "1" }
+thiserror = { version = "2" }
 tokio = { version = "1", default-features = false, features = ["rt", "macros", "test-util"] }
 tokio-util = { version = "0.7.11", default-features = false }
 tower-http = { version = "0.6.1", features = ["compression-full", "decompression-full", "cors", "trace"] }
@@ -89,16 +89,15 @@ reqwest = { version = "0.12", default-features = false, features = [
 ]}
 once_cell = "1.20.2"
 instant = { version = "0.1", default-features = false }
-rand = "0.8.5"
+rand = "0.9.1"
 regex = "1"
 home = "0.5.5"
-tonic = { version = "0.12.3", features = [
+tonic = { version = "0.13.1", features = [
     "channel",
-    "tls",
     "tls-webpki-roots",
 ] }
 prost = "0.13.1"
-tonic-build = "0.12"
+tonic-build = "0.13.1"
 strum = "0.27.1"
 strum_macros = "0.27.1"
 

+ 2 - 8
crates/cdk-axum/Cargo.toml

@@ -27,18 +27,12 @@ tokio.workspace = true
 tracing.workspace = true
 utoipa = { workspace = true, optional = true }
 futures.workspace = true
-moka = { version = "0.11.1", features = ["future"] }
+moka = { version = "0.12.10", features = ["future"] }
 serde_json.workspace = true
 paste = "1.0.15"
 serde.workspace = true
 uuid.workspace = true
 sha2 = "0.10.8"
-redis = { version = "0.23.3", features = [
+redis = { version = "0.31.0", features = [
     "tokio-rustls-comp",
 ], optional = true }
-
-
-[build-dependencies]
-# Dep of utopia 2.5.0 breaks so keeping here for now
-time = "=0.3.39"
-

+ 1 - 1
crates/cdk-axum/src/cache/backend/memory.rs

@@ -36,7 +36,7 @@ impl HttpCacheStorage for InMemoryHttpCache {
     }
 
     async fn get(&self, key: &HttpCacheKey) -> Option<Vec<u8>> {
-        self.0.get(key)
+        self.0.get(key).await
     }
 
     async fn set(&self, key: HttpCacheKey, value: Vec<u8>) {

+ 1 - 1
crates/cdk-axum/src/cache/backend/redis.rs

@@ -86,7 +86,7 @@ impl HttpCacheStorage for HttpCacheRedis {
         };
 
         let _: Result<(), _> = conn
-            .set_ex(db_key, value, self.cache_ttl.as_secs() as usize)
+            .set_ex(db_key, value, self.cache_ttl.as_secs())
             .await
             .map_err(|err| {
                 tracing::error!("Failed to set value in redis: {:?}", err);

+ 2 - 1
crates/cdk-cli/Cargo.toml

@@ -18,6 +18,7 @@ redb = ["dep:cdk-redb"]
 [dependencies]
 anyhow.workspace = true
 bip39.workspace = true
+bitcoin.workspace = true
 cdk = { workspace = true, default-features = false, features = ["wallet", "auth"]}
 cdk-redb = { workspace = true, features = ["wallet"], optional = true }
 cdk-sqlite = { workspace = true, features = ["wallet"] }
@@ -28,7 +29,7 @@ tokio.workspace = true
 tracing.workspace = true
 tracing-subscriber.workspace = true
 home.workspace = true
-nostr-sdk = { version = "0.35.0", default-features = false, features = [
+nostr-sdk = { version = "0.41.0", default-features = false, features = [
     "nip04",
     "nip44",
     "nip59"

+ 1 - 1
crates/cdk-cli/src/sub_commands/create_request.rs

@@ -259,7 +259,7 @@ pub async fn create_request(
         }
 
         client.connect().await;
-        client.subscribe(vec![filter], None).await?;
+        client.subscribe(filter, None).await?;
 
         // Handle subscription notifications with `handle_notifications` method
         client

+ 2 - 3
crates/cdk-cli/src/sub_commands/pay_request.rs

@@ -113,9 +113,8 @@ pub async fn pay_request(
                 let rumor = EventBuilder::new(
                     nostr_sdk::Kind::from_u16(14),
                     serde_json::to_string(&payload)?,
-                    [],
-                );
-
+                )
+                .build(nprofile.public_key);
                 let relays = nprofile.relays;
 
                 for relay in relays.iter() {

+ 3 - 8
crates/cdk-cli/src/sub_commands/receive.rs

@@ -1,6 +1,7 @@
 use std::collections::HashSet;
 use std::path::Path;
 use std::str::FromStr;
+use std::time::Duration;
 
 use anyhow::{anyhow, Result};
 use cdk::nuts::{SecretKey, Token};
@@ -171,7 +172,7 @@ async fn nostr_receive(
 
     let x_only_pubkey = verifying_key.x_only_public_key();
 
-    let nostr_pubkey = nostr_sdk::PublicKey::from_hex(x_only_pubkey.to_string())?;
+    let nostr_pubkey = nostr_sdk::PublicKey::from_hex(&x_only_pubkey.to_string())?;
 
     let since = since.map(|s| Timestamp::from(s as u64));
 
@@ -190,13 +191,7 @@ async fn nostr_receive(
     client.connect().await;
 
     let events = client
-        .get_events_of(
-            vec![filter],
-            nostr_sdk::EventSource::Relays {
-                timeout: None,
-                specific_relays: Some(relays),
-            },
-        )
+        .fetch_events_from(relays, filter, Duration::from_secs(30))
         .await?;
 
     let mut tokens: HashSet<String> = HashSet::new();

+ 1 - 1
crates/cdk-cln/Cargo.toml

@@ -14,7 +14,7 @@ readme = "README.md"
 async-trait.workspace = true
 bitcoin.workspace = true
 cdk-common = { workspace = true, features = ["mint"] }
-cln-rpc = "0.3.0"
+cln-rpc = "0.4.0"
 futures.workspace = true
 tokio.workspace = true
 tokio-util.workspace = true

+ 13 - 12
crates/cdk-integration-tests/tests/happy_path_mint_wallet.rs

@@ -9,11 +9,11 @@
 //! whether to use real Lightning Network payments (regtest mode) or simulated payments.
 
 use core::panic;
+use std::env;
 use std::fmt::Debug;
 use std::str::FromStr;
 use std::sync::Arc;
 use std::time::Duration;
-use std::{char, env};
 
 use bip39::Mnemonic;
 use cashu::{MeltRequest, PreMintSecrets};
@@ -134,17 +134,18 @@ async fn test_happy_mint_melt_round_trip() {
         .await
         .unwrap();
 
-    assert_eq!(
-        reader
-            .next()
-            .await
-            .unwrap()
-            .unwrap()
-            .to_text()
-            .unwrap()
-            .replace(char::is_whitespace, ""),
-        r#"{"jsonrpc":"2.0","result":{"status":"OK","subId":"test-sub"},"id":2}"#
-    );
+    // Parse both JSON strings to objects and compare them instead of comparing strings directly
+    let binding = reader.next().await.unwrap().unwrap();
+    let response_str = binding.to_text().unwrap();
+
+    let response_json: serde_json::Value =
+        serde_json::from_str(response_str).expect("Valid JSON response");
+    let expected_json: serde_json::Value = serde_json::from_str(
+        r#"{"jsonrpc":"2.0","result":{"status":"OK","subId":"test-sub"},"id":2}"#,
+    )
+    .expect("Valid JSON expected");
+
+    assert_eq!(response_json, expected_json);
 
     let melt_response = wallet.melt(&melt.id).await.unwrap();
     assert!(melt_response.preimage.is_some());

+ 1 - 7
crates/cdk-mintd/Cargo.toml

@@ -47,7 +47,7 @@ cdk-fake-wallet = { workspace = true, optional = true }
 cdk-axum.workspace = true
 cdk-mint-rpc = { workspace = true, optional = true }
 cdk-payment-processor = { workspace = true, optional = true }
-config = { version = "0.13.3", features = ["toml"] }
+config = { version = "0.15.11", features = ["toml"] }
 clap.workspace = true
 bitcoin.workspace = true
 tokio = { workspace = true, default-features = false, features = ["signal"] }
@@ -63,9 +63,3 @@ home.workspace = true
 url.workspace = true
 utoipa = { workspace = true, optional = true }
 utoipa-swagger-ui = { version = "9.0.0", features = ["axum"], optional = true }
-
-[build-dependencies]
-# Dep of utopia 2.5.0 breaks so keeping here for now
-zip = "=2.4.2"
-time = "=0.3.39"
-

+ 0 - 19
crates/cdk-mintd/src/lib.rs

@@ -23,22 +23,3 @@ fn expand_path(path: &str) -> Option<PathBuf> {
         Some(PathBuf::from(path))
     }
 }
-
-#[cfg(test)]
-mod test {
-    use std::env::current_dir;
-
-    use super::*;
-
-    #[test]
-    fn example_is_parsed() {
-        let config = config::Settings::new(Some(format!(
-            "{}/example.config.toml",
-            current_dir().expect("cwd").to_string_lossy()
-        )));
-        let cache = config.info.http_cache;
-
-        assert_eq!(cache.ttl, Some(60));
-        assert_eq!(cache.tti, Some(60));
-    }
-}

+ 1 - 5
crates/cdk/Cargo.toml

@@ -42,10 +42,6 @@ utoipa = { workspace = true, optional = true }
 uuid.workspace = true
 jsonwebtoken = { workspace = true, optional = true }
 
-# -Z minimal-versions
-sync_wrapper = "0.1.2"
-bech32 = "0.9.1"
-
 [target.'cfg(not(target_arch = "wasm32"))'.dependencies]
 tokio = { workspace = true, features = [
     "rt-multi-thread",
@@ -93,7 +89,7 @@ rand.workspace = true
 cdk-sqlite.workspace = true
 bip39.workspace = true
 tracing-subscriber.workspace = true
-criterion = "0.5.1"
+criterion = "0.6.0"
 reqwest = { workspace = true }
 
 

+ 1 - 1
crates/cdk/examples/auth_wallet.rs

@@ -25,7 +25,7 @@ async fn main() -> Result<(), Error> {
     let localstore = memory::empty().await?;
 
     // Generate a random seed for the wallet
-    let seed = rand::thread_rng().gen::<[u8; 32]>();
+    let seed = rand::rng().random::<[u8; 32]>();
 
     // Define the mint URL and currency unit
     let mint_url = "http://127.0.0.1:8085";

+ 2 - 3
crates/cdk/examples/melt-token.rs

@@ -19,7 +19,7 @@ async fn main() -> Result<(), Error> {
     let localstore = memory::empty().await?;
 
     // Generate a random seed for the wallet
-    let seed = rand::thread_rng().gen::<[u8; 32]>();
+    let seed = rand::rng().random::<[u8; 32]>();
 
     // Define the mint URL and currency unit
     let mint_url = "https://fake.thesimplekid.dev";
@@ -61,8 +61,7 @@ async fn main() -> Result<(), Error> {
             .unwrap(),
     )
     .unwrap();
-    let mut random_bytes = [1u8; 32];
-    rand::thread_rng().fill(&mut random_bytes);
+    let random_bytes = rand::rng().random::<[u8; 32]>();
     let payment_hash = sha256::Hash::from_slice(&random_bytes).unwrap();
     let payment_secret = PaymentSecret([42u8; 32]);
     let invoice_to_be_paid = InvoiceBuilder::new(Currency::Bitcoin)

+ 1 - 1
misc/nutshell_wallet_itest.sh

@@ -117,7 +117,7 @@ if docker info > /dev/null 2>&1; then
     --network=host \
     -p ${WALLET_PORT}:${WALLET_PORT} \
     -e MINT_URL=${MINT_URL} \
-    cashubtc/nutshell:latest \
+    cashubtc/nutshell:0.16.5 \
     poetry run cashu -d
 else
   echo "Docker is not accessible, skipping Nutshell wallet container setup"