From 218083d07d08b459cbdc4a49cd39b530cf02ec53 Mon Sep 17 00:00:00 2001 From: ok300 <106775972+ok300@users.noreply.github.com> Date: Sun, 6 Oct 2024 12:22:53 +0200 Subject: [PATCH] Cargo fmt --- crates/cdk-axum/src/lib.rs | 70 +++++++++++--------------- crates/cdk-axum/src/router_handlers.rs | 1 - crates/cdk-mintd/src/main.rs | 5 +- crates/cdk/src/amount.rs | 4 +- 4 files changed, 37 insertions(+), 43 deletions(-) diff --git a/crates/cdk-axum/src/lib.rs b/crates/cdk-axum/src/lib.rs index 55218935..28c44544 100644 --- a/crates/cdk-axum/src/lib.rs +++ b/crates/cdk-axum/src/lib.rs @@ -9,12 +9,12 @@ use std::time::Duration; use anyhow::Result; use axum::routing::{get, post}; use axum::Router; -use cdk::error::{ErrorCode, ErrorResponse}; use cdk::amount::Amount; +use cdk::error::{ErrorCode, ErrorResponse}; use cdk::mint::Mint; use cdk::nuts::nut00::{CurrencyUnit, PaymentMethod}; use cdk::nuts::nut01::{Keys, KeysResponse, PublicKey}; -use cdk::nuts::nut02::{Id, KeysetResponse, KeySet, KeySetInfo, KeySetVersion}; +use cdk::nuts::nut02::{Id, KeySet, KeySetInfo, KeySetVersion, KeysetResponse}; use cdk::nuts::nut04; use cdk::nuts::nut04::MintMethodSettings; use cdk::nuts::nut05; @@ -37,44 +37,34 @@ pub struct MintState { #[derive(OpenApi)] #[openapi( -components( -schemas( -Amount, -ContactInfo, -CurrencyUnit, -ErrorCode, -ErrorResponse, -Id, -Keys, -KeysResponse, -KeysetResponse, -KeySet, -KeySetInfo, -KeySetVersion, -MeltMethodSettings, -MintInfo, -MintMethodSettings, -MintVersion, -MppMethodSettings, -Nuts, -PaymentMethod, -PublicKey, -SupportedSettings, -nut04::Settings, -nut05::Settings, -nut15::Settings -) -), -info( -description = "Cashu CDK mint APIs", -title = "cdk-mintd", -), -paths( -get_keys, -get_keyset_pubkeys, -get_keysets, -get_mint_info -) + components(schemas( + Amount, + ContactInfo, + CurrencyUnit, + ErrorCode, + ErrorResponse, + Id, + Keys, + KeysResponse, + KeysetResponse, + KeySet, + KeySetInfo, + KeySetVersion, + MeltMethodSettings, + MintInfo, + MintMethodSettings, + MintVersion, + MppMethodSettings, + Nuts, + PaymentMethod, + PublicKey, + SupportedSettings, + nut04::Settings, + nut05::Settings, + nut15::Settings + )), + info(description = "Cashu CDK mint APIs", title = "cdk-mintd",), + paths(get_keys, get_keyset_pubkeys, get_keysets, get_mint_info) )] /// OpenAPI spec for the mint's v1 APIs pub struct ApiDocV1; diff --git a/crates/cdk-axum/src/router_handlers.rs b/crates/cdk-axum/src/router_handlers.rs index 71edf163..b6570b07 100644 --- a/crates/cdk-axum/src/router_handlers.rs +++ b/crates/cdk-axum/src/router_handlers.rs @@ -49,7 +49,6 @@ post_cache_wrapper!(post_swap, SwapRequest, SwapResponse); post_cache_wrapper!(post_mint_bolt11, MintBolt11Request, MintBolt11Response); post_cache_wrapper!(post_melt_bolt11, MeltBolt11Request, MeltQuoteBolt11Response); - #[utoipa::path( get, context_path = "/v1", diff --git a/crates/cdk-mintd/src/main.rs b/crates/cdk-mintd/src/main.rs index b2a0f499..7947ef13 100644 --- a/crates/cdk-mintd/src/main.rs +++ b/crates/cdk-mintd/src/main.rs @@ -474,7 +474,10 @@ 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() - .merge(SwaggerUi::new("/swagger-ui").url("/api-docs/openapi.json", cdk_axum::ApiDocV1::openapi())) + .merge( + SwaggerUi::new("/swagger-ui") + .url("/api-docs/openapi.json", cdk_axum::ApiDocV1::openapi()), + ) .merge(v1_service) .layer(CorsLayer::permissive()); diff --git a/crates/cdk/src/amount.rs b/crates/cdk/src/amount.rs index 737620c4..0fa976a3 100644 --- a/crates/cdk/src/amount.rs +++ b/crates/cdk/src/amount.rs @@ -26,7 +26,9 @@ pub enum Error { } /// Amount can be any unit -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize, ToSchema)] +#[derive( + Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize, ToSchema, +)] #[serde(transparent)] pub struct Amount(u64);