chore: update deps (#761)

This commit is contained in:
thesimplekid
2025-05-20 10:27:52 +01:00
committed by GitHub
parent b63dc1045d
commit abf10da330
16 changed files with 37 additions and 78 deletions

View File

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

View File

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

View File

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

View File

@@ -86,7 +86,7 @@ impl HttpCacheStorage for HttpCacheRedis {
}; };
let _: Result<(), _> = conn 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 .await
.map_err(|err| { .map_err(|err| {
tracing::error!("Failed to set value in redis: {:?}", err); tracing::error!("Failed to set value in redis: {:?}", err);

View File

@@ -18,6 +18,7 @@ redb = ["dep:cdk-redb"]
[dependencies] [dependencies]
anyhow.workspace = true anyhow.workspace = true
bip39.workspace = true bip39.workspace = true
bitcoin.workspace = true
cdk = { workspace = true, default-features = false, features = ["wallet", "auth"]} cdk = { workspace = true, default-features = false, features = ["wallet", "auth"]}
cdk-redb = { workspace = true, features = ["wallet"], optional = true } cdk-redb = { workspace = true, features = ["wallet"], optional = true }
cdk-sqlite = { workspace = true, features = ["wallet"] } cdk-sqlite = { workspace = true, features = ["wallet"] }
@@ -28,7 +29,7 @@ tokio.workspace = true
tracing.workspace = true tracing.workspace = true
tracing-subscriber.workspace = true tracing-subscriber.workspace = true
home.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", "nip04",
"nip44", "nip44",
"nip59" "nip59"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -47,7 +47,7 @@ cdk-fake-wallet = { workspace = true, optional = true }
cdk-axum.workspace = true cdk-axum.workspace = true
cdk-mint-rpc = { workspace = true, optional = true } cdk-mint-rpc = { workspace = true, optional = true }
cdk-payment-processor = { 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 clap.workspace = true
bitcoin.workspace = true bitcoin.workspace = true
tokio = { workspace = true, default-features = false, features = ["signal"] } tokio = { workspace = true, default-features = false, features = ["signal"] }
@@ -63,9 +63,3 @@ home.workspace = true
url.workspace = true url.workspace = true
utoipa = { workspace = true, optional = true } utoipa = { workspace = true, optional = true }
utoipa-swagger-ui = { version = "9.0.0", features = ["axum"], 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"

View File

@@ -23,22 +23,3 @@ fn expand_path(path: &str) -> Option<PathBuf> {
Some(PathBuf::from(path)) 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));
}
}

View File

@@ -42,10 +42,6 @@ utoipa = { workspace = true, optional = true }
uuid.workspace = true uuid.workspace = true
jsonwebtoken = { workspace = true, optional = 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] [target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tokio = { workspace = true, features = [ tokio = { workspace = true, features = [
"rt-multi-thread", "rt-multi-thread",
@@ -93,7 +89,7 @@ rand.workspace = true
cdk-sqlite.workspace = true cdk-sqlite.workspace = true
bip39.workspace = true bip39.workspace = true
tracing-subscriber.workspace = true tracing-subscriber.workspace = true
criterion = "0.5.1" criterion = "0.6.0"
reqwest = { workspace = true } reqwest = { workspace = true }

View File

@@ -25,7 +25,7 @@ async fn main() -> Result<(), Error> {
let localstore = memory::empty().await?; let localstore = memory::empty().await?;
// Generate a random seed for the wallet // 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 // Define the mint URL and currency unit
let mint_url = "http://127.0.0.1:8085"; let mint_url = "http://127.0.0.1:8085";

View File

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

View File

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