Skip to content

Commit

Permalink
Cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ok300 committed Oct 6, 2024
1 parent 82f4c57 commit 218083d
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 43 deletions.
70 changes: 30 additions & 40 deletions crates/cdk-axum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
1 change: 0 additions & 1 deletion crates/cdk-axum/src/router_handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 4 additions & 1 deletion crates/cdk-mintd/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
4 changes: 3 additions & 1 deletion crates/cdk/src/amount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 218083d

Please sign in to comment.