From 243094b5dfce4d973b7de81122e94b4c115a6891 Mon Sep 17 00:00:00 2001 From: ok300 <106775972+ok300@users.noreply.github.com> Date: Thu, 10 Oct 2024 02:18:51 +0200 Subject: [PATCH] mint: annotate post_swap for Swagger UI --- crates/cdk-axum/src/lib.rs | 6 +++++- crates/cdk-axum/src/router_handlers.rs | 15 +++++++++++++++ crates/cdk/src/nuts/nut03.rs | 3 +++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/crates/cdk-axum/src/lib.rs b/crates/cdk-axum/src/lib.rs index 8351d9a82..7910da6d7 100644 --- a/crates/cdk-axum/src/lib.rs +++ b/crates/cdk-axum/src/lib.rs @@ -17,6 +17,7 @@ use cdk::nuts::nut00::{ }; use cdk::nuts::nut01::{Keys, KeysResponse, PublicKey, SecretKey}; use cdk::nuts::nut02::{Id, KeySet, KeySetInfo, KeySetVersion, KeysetResponse}; +use cdk::nuts::nut03::{SwapRequest, SwapResponse}; use cdk::nuts::nut04; use cdk::nuts::nut04::{ MintBolt11Request, MintBolt11Response, MintMethodSettings, MintQuoteBolt11Request, @@ -88,6 +89,8 @@ pub struct MintState { PublicKey, SecretKey, SupportedSettings, + SwapRequest, + SwapResponse, Witness, nut04::Settings, nut05::Settings, @@ -104,7 +107,8 @@ pub struct MintState { post_mint_bolt11, get_melt_bolt11_quote, get_check_melt_bolt11_quote, - post_melt_bolt11 + post_melt_bolt11, + post_swap ) )] /// OpenAPI spec for the mint's v1 APIs diff --git a/crates/cdk-axum/src/router_handlers.rs b/crates/cdk-axum/src/router_handlers.rs index 00197ddd4..fbd899204 100644 --- a/crates/cdk-axum/src/router_handlers.rs +++ b/crates/cdk-axum/src/router_handlers.rs @@ -311,6 +311,21 @@ pub async fn get_mint_info(State(state): State) -> Result, Json(payload): Json, diff --git a/crates/cdk/src/nuts/nut03.rs b/crates/cdk/src/nuts/nut03.rs index eca008ba4..101a0f578 100644 --- a/crates/cdk/src/nuts/nut03.rs +++ b/crates/cdk/src/nuts/nut03.rs @@ -34,8 +34,10 @@ pub struct PreSwap { /// Split Request [NUT-06] #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[cfg_attr(feature = "mint", derive(utoipa::ToSchema))] pub struct SwapRequest { /// Proofs that are to be spent in `Split` + #[cfg_attr(feature = "mint", schema(value_type = Vec))] pub inputs: Proofs, /// Blinded Messages for Mint to sign pub outputs: Vec, @@ -64,6 +66,7 @@ impl SwapRequest { /// Split Response [NUT-06] #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[cfg_attr(feature = "mint", derive(utoipa::ToSchema))] pub struct SwapResponse { /// Promises pub signatures: Vec,