diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 120000 index 41cc13f5f..000000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1 +0,0 @@ -/nix/store/9p08fy8g4sijw8k1l9spf8npjbjk34xf-pre-commit-config.json \ No newline at end of file diff --git a/crates/cdk-cln/src/bolt12.rs b/crates/cdk-cln/src/bolt12.rs index 65dfa7a8b..7e91aa387 100644 --- a/crates/cdk-cln/src/bolt12.rs +++ b/crates/cdk-cln/src/bolt12.rs @@ -21,8 +21,7 @@ use lightning::offers::invoice::Bolt12Invoice; use lightning::offers::offer::Offer; use uuid::Uuid; -use super::Cln; -use super::Error; +use super::{Cln, Error}; #[async_trait] impl MintBolt12Lightning for Cln { diff --git a/crates/cdk/src/amount.rs b/crates/cdk/src/amount.rs index 087d01784..e80897261 100644 --- a/crates/cdk/src/amount.rs +++ b/crates/cdk/src/amount.rs @@ -6,9 +6,8 @@ use std::cmp::Ordering; use std::fmt; use std::str::FromStr; -use serde::{Deserialize, Deserializer, Serialize, Serializer}; - use lightning::offers::offer::Offer; +use serde::{Deserialize, Deserializer, Serialize, Serializer}; use thiserror::Error; use crate::nuts::CurrencyUnit; diff --git a/crates/cdk/src/mint/melt.rs b/crates/cdk/src/mint/melt.rs index 4789d2537..a1e98156b 100644 --- a/crates/cdk/src/mint/melt.rs +++ b/crates/cdk/src/mint/melt.rs @@ -6,30 +6,21 @@ use anyhow::bail; use lightning::offers::offer::Offer; use tracing::instrument; -use crate::amount::amount_for_offer; -use crate::cdk_lightning; -use crate::cdk_lightning::MintLightning; -use crate::cdk_lightning::PayInvoiceResponse; -use crate::nuts::nut00::ProofsMethods; -use crate::nuts::nut11::enforce_sig_flag; -use crate::nuts::nut11::EnforceSigFlag; -use crate::{ - amount::to_unit, mint::SigFlag, nuts::Id, nuts::MeltQuoteState, types::LnKey, util::unix_time, - Amount, Error, -}; - use super::nut05::MeltRequestTrait; use super::types::PaymentRequest; -use super::BlindSignature; -use super::CurrencyUnit; -use super::MeltQuote; -use super::MeltQuoteBolt11Request; -use super::MeltQuoteBolt11Response; -use super::MeltQuoteBolt12Request; -use super::Mint; -use super::PaymentMethod; -use super::State; -use crate::nuts::PublicKey; +use super::{ + BlindSignature, CurrencyUnit, MeltQuote, MeltQuoteBolt11Request, MeltQuoteBolt11Response, + MeltQuoteBolt12Request, Mint, PaymentMethod, State, +}; +use crate::amount::{amount_for_offer, to_unit}; +use crate::cdk_lightning::{MintLightning, PayInvoiceResponse}; +use crate::mint::SigFlag; +use crate::nuts::nut00::ProofsMethods; +use crate::nuts::nut11::{enforce_sig_flag, EnforceSigFlag}; +use crate::nuts::{Id, MeltQuoteState, PublicKey}; +use crate::types::LnKey; +use crate::util::unix_time; +use crate::{cdk_lightning, Amount, Error}; impl Mint { fn check_melt_request_acceptable( diff --git a/crates/cdk/src/mint/mint_18.rs b/crates/cdk/src/mint/mint_18.rs index a76266490..827b3bd33 100644 --- a/crates/cdk/src/mint/mint_18.rs +++ b/crates/cdk/src/mint/mint_18.rs @@ -1,11 +1,10 @@ use tracing::instrument; -use crate::{types::LnKey, util::unix_time, Amount, Error}; - -use super::{ - nut19::{MintQuoteBolt12Request, MintQuoteBolt12Response}, - Mint, MintQuote, PaymentMethod, -}; +use super::nut19::{MintQuoteBolt12Request, MintQuoteBolt12Response}; +use super::{Mint, MintQuote, PaymentMethod}; +use crate::types::LnKey; +use crate::util::unix_time; +use crate::{Amount, Error}; impl Mint { /// Create new mint bolt11 quote diff --git a/crates/cdk/src/mint/types.rs b/crates/cdk/src/mint/types.rs index 8a8d6b8f9..c001598f1 100644 --- a/crates/cdk/src/mint/types.rs +++ b/crates/cdk/src/mint/types.rs @@ -150,10 +150,12 @@ pub enum PaymentRequest { } mod offer_serde { - use super::Offer; - use serde::{self, Deserialize, Deserializer, Serializer}; use std::str::FromStr; + use serde::{self, Deserialize, Deserializer, Serializer}; + + use super::Offer; + pub fn serialize(offer: &Offer, serializer: S) -> Result where S: Serializer, diff --git a/crates/cdk/src/nuts/nut20.rs b/crates/cdk/src/nuts/nut20.rs index dbb498084..30af3ac58 100644 --- a/crates/cdk/src/nuts/nut20.rs +++ b/crates/cdk/src/nuts/nut20.rs @@ -2,10 +2,10 @@ use serde::{Deserialize, Serialize}; use thiserror::Error; +use super::nut05::MeltRequestTrait; +use super::{BlindedMessage, CurrencyUnit, PaymentMethod, Proofs}; use crate::Amount; -use super::{nut05::MeltRequestTrait, BlindedMessage, CurrencyUnit, PaymentMethod, Proofs}; - /// NUT18 Error #[derive(Debug, Error)] pub enum Error { diff --git a/crates/cdk/src/wallet/mint_bolt12.rs b/crates/cdk/src/wallet/mint_bolt12.rs index 1ca25f537..3111b74f5 100644 --- a/crates/cdk/src/wallet/mint_bolt12.rs +++ b/crates/cdk/src/wallet/mint_bolt12.rs @@ -1,17 +1,16 @@ use tracing::instrument; use super::MintQuote; +use crate::amount::SplitTarget; +use crate::dhke::construct_proofs; use crate::nuts::nut00::ProofsMethods; use crate::nuts::nut19::{MintQuoteBolt12Request, MintQuoteBolt12Response}; -use crate::nuts::{MintBolt11Request, PaymentMethod}; -use crate::{ - amount::SplitTarget, - dhke::construct_proofs, - nuts::{nut12, PreMintSecrets, SpendingConditions, State}, - types::ProofInfo, - util::unix_time, - Amount, Error, Wallet, +use crate::nuts::{ + nut12, MintBolt11Request, PaymentMethod, PreMintSecrets, SpendingConditions, State, }; +use crate::types::ProofInfo; +use crate::util::unix_time; +use crate::{Amount, Error, Wallet}; impl Wallet { /// Mint Bolt12 diff --git a/flake.lock b/flake.lock index 601a91726..5077b6362 100644 --- a/flake.lock +++ b/flake.lock @@ -21,11 +21,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1726560853, - "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -57,28 +57,16 @@ }, "nixpkgs": { "locked": { -<<<<<<< HEAD - "lastModified": 1730785428, - "narHash": "sha256-Zwl8YgTVJTEum+L+0zVAWvXAGbWAuXHax3KzuejaDyo=", + "lastModified": 1731676054, + "narHash": "sha256-OZiZ3m8SCMfh3B6bfGC/Bm4x3qc1m2SVEAlkV6iY7Yg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4aa36568d413aca0ea84a1684d2d46f55dbabad7", -======= - "lastModified": 1731386116, - "narHash": "sha256-lKA770aUmjPHdTaJWnP3yQ9OI1TigenUqVC3wweqZuI=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "689fed12a013f56d4c4d3f612489634267d86529", ->>>>>>> main + "rev": "5e4fbfb6b3de1aa2872b76d49fafc942626e2add", "type": "github" }, "original": { "owner": "NixOS", -<<<<<<< HEAD "ref": "nixos-unstable", -======= - "ref": "nixos-24.05", ->>>>>>> main "repo": "nixpkgs", "type": "github" } @@ -123,19 +111,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { -<<<<<<< HEAD - "lastModified": 1730814269, - "narHash": "sha256-fWPHyhYE6xvMI1eGY3pwBTq85wcy1YXqdzTZF+06nOg=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "d70155fdc00df4628446352fc58adc640cd705c2", -======= "lastModified": 1731363552, "narHash": "sha256-vFta1uHnD29VUY4HJOO/D6p6rxyObnf+InnSMT4jlMU=", "owner": "cachix", "repo": "pre-commit-hooks.nix", "rev": "cd1af27aa85026ac759d5d3fccf650abe7e1bbf0", ->>>>>>> main "type": "github" }, "original": { @@ -159,19 +139,11 @@ ] }, "locked": { -<<<<<<< HEAD - "lastModified": 1730773675, - "narHash": "sha256-pULo7GryzLkqGveWvnNWVz1Kk6EJqvq+HQeSkwvr7DA=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "e19e9d54fac1e53f73411ebe22d19f946b1ba0bd", -======= - "lastModified": 1731378398, - "narHash": "sha256-a0QWaiX8+AJ9/XBLGMDy6c90GD7HzpxKVdlFwCke5Pw=", + "lastModified": 1731820690, + "narHash": "sha256-/hHFMTD+FGURXZ4JtfXoIgpy87zL505pVi6AL76Wc+U=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "0ae9fc2f2fe5361837d59c0bdebbda176427111e", ->>>>>>> main + "rev": "bbab2ab9e1932133b1996baa1dc00fefe924ca81", "type": "github" }, "original": {