Skip to content

Commit

Permalink
fix: nut6 does not exist in mint-info
Browse files Browse the repository at this point in the history
  • Loading branch information
ngutech21 committed Feb 16, 2024
1 parent 54448c8 commit dbf0e04
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 18 deletions.
23 changes: 23 additions & 0 deletions moksha-core/src/fixtures/nutshell_mint_info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "My Cashu mint",
"pubkey": "03a2118b421e6b47f0656b97bb7eeea43c41096adbc0d0e511ff70de7d94dbd990",
"version": "Nutshell/0.15.0",
"description": "The short mint description",
"description_long": "A long mint description that can be a long piece of text.",
"contact": [
["email", "[email protected]"],
["twitter", "@me"],
["nostr", "npub..."]
],
"motd": "Message to users",
"nuts": {
"4": { "methods": [["bolt11", "sat"]], "disabled": false },
"5": { "methods": [["bolt11", "sat"]], "disabled": false },
"7": { "supported": true },
"8": { "supported": true },
"9": { "supported": true },
"10": { "supported": true },
"11": { "supported": true },
"12": { "supported": true }
}
}
26 changes: 11 additions & 15 deletions moksha-core/src/primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,6 @@ pub struct Nuts {
#[serde(rename = "5")]
pub nut5: Nut5,

/// Mint info
#[serde(rename = "6")]
pub nut6: Nut6,

/// Token state check
#[serde(rename = "7")]
pub nut7: Nut7,
Expand Down Expand Up @@ -468,17 +464,6 @@ impl Default for Nut5 {
}
}

#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq, ToSchema)]
pub struct Nut6 {
pub supported: bool,
}

impl Default for Nut6 {
fn default() -> Self {
Self { supported: true }
}
}

#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq, Default, ToSchema)]
pub struct Nut7 {
pub supported: bool,
Expand Down Expand Up @@ -571,6 +556,7 @@ mod tests {

use crate::{
dhke::public_key_from_hex,
fixture::read_fixture,
primitives::{
KeyResponse, MintInfoResponse, MintLegacyInfoResponse, Nuts, Parameter,
PostSwapResponse,
Expand Down Expand Up @@ -654,4 +640,14 @@ mod tests {

Ok(())
}

#[test]
fn test_deserialize_nustash_mint_info() -> anyhow::Result<()> {
let mint_info = read_fixture("nutshell_mint_info.json")?;
let info = serde_json::from_str::<MintInfoResponse>(&mint_info);
assert!(info.is_ok());
let info = info?;
assert_eq!("Nutshell/0.15.0", info.version.unwrap());
Ok(())
}
}
5 changes: 2 additions & 3 deletions moksha-mint/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ use moksha_core::blind::BlindedMessage;
use moksha_core::blind::BlindedSignature;
use moksha_core::primitives::{
CurrencyUnit, GetMeltOnchainResponse, KeyResponse, KeysResponse, MintInfoResponse,
MintLegacyInfoResponse, Nut10, Nut11, Nut12, Nut14, Nut15, Nut4, Nut5, Nut6, Nut7, Nut8, Nut9,
Nuts, PaymentMethod, PostMeltBolt11Request, PostMeltBolt11Response, PostMeltQuoteBolt11Request,
MintLegacyInfoResponse, Nut10, Nut11, Nut12, Nut14, Nut15, Nut4, Nut5, Nut7, Nut8, Nut9, Nuts,
PaymentMethod, PostMeltBolt11Request, PostMeltBolt11Response, PostMeltQuoteBolt11Request,
PostMeltQuoteBolt11Response, PostMeltQuoteOnchainRequest, PostMeltQuoteOnchainResponse,
PostMintBolt11Request, PostMintBolt11Response, PostMintQuoteBolt11Request,
PostMintQuoteBolt11Response, PostMintQuoteOnchainRequest, PostMintQuoteOnchainResponse,
Expand Down Expand Up @@ -134,7 +134,6 @@ pub async fn run_server(mint: Mint) -> anyhow::Result<()> {
Nuts,
Nut4,
Nut5,
Nut6,
Nut7,
Nut8,
Nut9,
Expand Down

0 comments on commit dbf0e04

Please sign in to comment.