From cebc3da43b2091d6d7a7ab1c49ca6295f8997bc0 Mon Sep 17 00:00:00 2001 From: ngutech21 Date: Fri, 15 Dec 2023 08:13:00 +0100 Subject: [PATCH] fix: list all melt actions in swagger --- moksha-core/src/proof.rs | 2 +- moksha-mint/src/server.rs | 24 +++++++++++++++++------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/moksha-core/src/proof.rs b/moksha-core/src/proof.rs index 79cf353a..db614b44 100644 --- a/moksha-core/src/proof.rs +++ b/moksha-core/src/proof.rs @@ -42,7 +42,7 @@ impl Proof { } } -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, ToSchema)] pub struct P2SHScript; #[derive(Clone, Debug, Serialize, Deserialize, PartialEq, ToSchema)] diff --git a/moksha-mint/src/server.rs b/moksha-mint/src/server.rs index 93e4d8e7..0a8eaec4 100644 --- a/moksha-mint/src/server.rs +++ b/moksha-mint/src/server.rs @@ -12,8 +12,8 @@ use axum::routing::{get_service, post}; use axum::{middleware, Router}; use axum::{routing::get, Json}; use moksha_core::keyset::{generate_hash, Keysets, V1Keyset, V1Keysets}; -use moksha_core::proof::Proof; use moksha_core::proof::Proofs; +use moksha_core::proof::{P2SHScript, Proof}; use utoipa_swagger_ui::SwaggerUi; use uuid::Uuid; @@ -88,10 +88,12 @@ pub async fn run_server( get_keys, get_keys_by_id, get_keysets, + post_mint_bolt11, post_mint_quote_bolt11, get_mint_quote_bolt11, post_melt_bolt11, - post_mint_bolt11, + post_melt_quote_bolt11, + get_melt_quote_bolt11, post_swap, get_info, ), @@ -127,6 +129,7 @@ pub async fn run_server( PostMintBolt11Response, PostSwapRequest, PostSwapResponse, + P2SHScript )) )] struct ApiDoc; @@ -475,7 +478,7 @@ async fn post_mint_bolt11( #[utoipa::path( post, - path = "/v1/melt/quote/bolt11/{quote}", + path = "/v1/melt/quote/bolt11", request_body = PostMeltQuoteBolt11Request, responses( (status = 200, description = "post mint quote", body = [PostMeltQuoteBolt11Response]) @@ -514,14 +517,11 @@ async fn post_melt_quote_bolt11( #[utoipa::path( post, - path = "/v1/melt/bolt11/{quote_id}", + path = "/v1/melt/bolt11", request_body = PostMeltBolt11Request, responses( (status = 200, description = "post melt", body = [PostMeltBolt11Response]) ), - params( - ("quote_id" = String, Path, description = "quote id"), - ) )] async fn post_melt_bolt11( State(mint): State, @@ -579,6 +579,16 @@ async fn get_mint_quote_bolt11( Ok(Json(Bolt11MintQuote { paid, ..quote }.into())) } +#[utoipa::path( + get, + path = "/v1/melt/quote/bolt11/{quote_id}", + responses( + (status = 200, description = "post mint quote", body = [PostMeltQuoteBolt11Response]) + ), + params( + ("quote_id" = String, Path, description = "quote id"), + ) + )] async fn get_melt_quote_bolt11( Path(quote_id): Path, State(mint): State,