diff --git a/crates/cdk-cli/src/main.rs b/crates/cdk-cli/src/main.rs index 6186866a5..3ce842d5c 100644 --- a/crates/cdk-cli/src/main.rs +++ b/crates/cdk-cli/src/main.rs @@ -3,9 +3,8 @@ use std::path::PathBuf; use std::str::FromStr; use std::sync::Arc; -use anyhow::{bail, Result}; +use anyhow::Result; use bip39::Mnemonic; -use cdk::cdk_database; use cdk::cdk_database::WalletDatabase; use cdk::wallet::client::HttpClient; use cdk::wallet::{MultiMintWallet, Wallet}; diff --git a/crates/cdk-cli/src/sub_commands/receive.rs b/crates/cdk-cli/src/sub_commands/receive.rs index de129ec81..6594bd40a 100644 --- a/crates/cdk-cli/src/sub_commands/receive.rs +++ b/crates/cdk-cli/src/sub_commands/receive.rs @@ -1,11 +1,9 @@ -use std::collections::HashSet; use std::str::FromStr; use std::sync::Arc; -use anyhow::{anyhow, Result}; +use anyhow::Result; use cdk::cdk_database::{self, WalletDatabase}; use cdk::nuts::{SecretKey, Token}; -use cdk::util::unix_time; use cdk::wallet::multi_mint_wallet::{MultiMintWallet, WalletKey}; use cdk::wallet::Wallet; use cdk::Amount; @@ -18,7 +16,6 @@ pub struct ReceiveSubCommand { /// Signing Key #[arg(short, long, action = clap::ArgAction::Append)] signing_key: Vec, - /// Nostr key } pub async fn receive( @@ -27,16 +24,8 @@ pub async fn receive( seed: &[u8], sub_command_args: &ReceiveSubCommand, ) -> Result<()> { - - let amount = receive_token( - multi_mint_wallet, - localstore, - seed, - token_str, - &[], - &[], - ) - .await?; + let token_str = sub_command_args.token.clone().unwrap(); + let amount = receive_token(multi_mint_wallet, localstore, seed, &token_str, &[], &[]).await?; println!("Received: {}", amount); Ok(()) diff --git a/crates/cdk-mintd/src/main.rs b/crates/cdk-mintd/src/main.rs index a83f03f62..2c73858a0 100644 --- a/crates/cdk-mintd/src/main.rs +++ b/crates/cdk-mintd/src/main.rs @@ -11,31 +11,22 @@ use std::sync::Arc; use anyhow::{anyhow, bail, Result}; use axum::Router; use bip39::Mnemonic; -use cdk::cdk_database::{self, MintDatabase}; use cdk::cdk_lightning; use cdk::cdk_lightning::MintLightning; use cdk::mint::{FeeReserve, MeltQuote, Mint}; use cdk::mint_url::MintUrl; use cdk::nuts::{ - nut04, nut05, ContactInfo, CurrencyUnit, MeltMethodSettings, MeltQuoteState, MintInfo, - MintMethodSettings, MintVersion, MppMethodSettings, Nuts, PaymentMethod, + nut04, nut05, ContactInfo, MeltMethodSettings, MeltQuoteState, MintInfo, MintMethodSettings, + MintVersion, MppMethodSettings, Nuts, PaymentMethod, }; use cdk::types::{LnKey, QuoteTTL}; -use cdk_cln::Cln; use cdk_fake_wallet::FakeWallet; -use cdk_lnbits::LNbits; -use cdk_lnd::Lnd; -use cdk_phoenixd::Phoenixd; use cdk_redb::MintRedbDatabase; -use cdk_sqlite::MintSqliteDatabase; -use cdk_strike::Strike; use clap::Parser; use cli::CLIArgs; -use config::{DatabaseEngine, LnBackend}; -use tokio::sync::{Mutex, Notify}; +use tokio::sync::Notify; use tower_http::cors::CorsLayer; use tracing_subscriber::EnvFilter; -use url::Url; mod cli; mod config; @@ -125,26 +116,26 @@ async fn main() -> anyhow::Result<()> { let mut supported_units = HashMap::new(); let input_fee_ppk = settings.info.input_fee_ppk.unwrap_or(0); - let mint_url: MintUrl = settings.info.url.parse()?; + let _mint_url: MintUrl = settings.info.url.parse()?; // Consider: we probably need only one unit, so this element might be redundant let units = settings.fake_wallet.unwrap_or_default().supported_units; - for unit in units { - let ln_key = LnKey::new(unit, PaymentMethod::Bolt11); + for unit in units { + let ln_key = LnKey::new(unit, PaymentMethod::Bolt11); - let wallet = Arc::new(FakeWallet::new( - fee_reserve.clone(), - MintMethodSettings::default(), - MeltMethodSettings::default(), - HashMap::default(), - HashSet::default(), - 0, - )); + let wallet = Arc::new(FakeWallet::new( + fee_reserve.clone(), + MintMethodSettings::default(), + MeltMethodSettings::default(), + HashMap::default(), + HashSet::default(), + 0, + )); - ln_backends.insert(ln_key, wallet); + ln_backends.insert(ln_key, wallet); - supported_units.insert(unit, (input_fee_ppk, 64)); - } + supported_units.insert(unit, (input_fee_ppk, 64)); + } let (nut04_settings, nut05_settings, mpp_settings): ( nut04::Settings, @@ -273,7 +264,7 @@ async fn main() -> anyhow::Result<()> { let v1_service = cdk_axum::create_mint_router(Arc::clone(&mint), cache_ttl, cache_tti).await?; - let mut mint_service = Router::new() + let mint_service = Router::new() .merge(v1_service) .layer(CorsLayer::permissive()); @@ -431,21 +422,6 @@ async fn check_pending_melt_quotes( Ok(()) } -fn expand_path(path: &str) -> Option { - if path.starts_with('~') { - if let Some(home_dir) = home::home_dir().as_mut() { - let remainder = &path[2..]; - home_dir.push(remainder); - let expanded_path = home_dir; - Some(expanded_path.clone()) - } else { - None - } - } else { - Some(PathBuf::from(path)) - } -} - fn work_dir() -> Result { let home_dir = home::home_dir().ok_or(anyhow!("Unknown home dir"))?;