Skip to content

Commit

Permalink
fix: compatibility with nutshell v0.16.0
Browse files Browse the repository at this point in the history
fixes #315
  • Loading branch information
ngutech21 committed Aug 2, 2024
1 parent 9e9cae6 commit 4aa4877
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ services:
- itest

nutshell:
image: cashubtc/nutshell:0.15.3
image: cashubtc/nutshell:0.16.0
container_name: nutshell
ports:
- "2228:3338"
Expand Down
42 changes: 42 additions & 0 deletions moksha-core/src/fixtures/nutshell_mint_info_v0.16.0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "nutshell",
"pubkey": "0296d0aa13b6a31cf0cd974249f28c7b7176d7274712c95a41c7d8066d3f29d679",
"version": "Nutshell/0.16.0",
"contact": [],
"nuts": {
"4": {
"methods": [
{ "method": "bolt11", "unit": "sat" },
{ "method": "bolt11", "unit": "usd" }
],
"disabled": false
},
"5": {
"methods": [
{ "method": "bolt11", "unit": "sat" },
{ "method": "bolt11", "unit": "usd" }
],
"disabled": false
},
"7": { "supported": true },
"8": { "supported": true },
"9": { "supported": true },
"10": { "supported": true },
"11": { "supported": true },
"12": { "supported": true },
"17": {
"supported": [
{
"method": "bolt11",
"unit": "sat",
"commands": ["bolt11_melt_quote", "proof_state", "bolt11_mint_quote"]
},
{
"method": "bolt11",
"unit": "usd",
"commands": ["bolt11_melt_quote", "proof_state", "bolt11_mint_quote"]
}
]
}
}
}
14 changes: 11 additions & 3 deletions moksha-core/src/primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -613,9 +613,7 @@ pub struct Nut16 {
}

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

#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq, ToSchema)]
pub struct Nut18 {
Expand Down Expand Up @@ -752,6 +750,16 @@ mod tests {
Ok(())
}

#[test]
fn test_deserialize_nustash_v_0_16_0_mint_info() -> anyhow::Result<()> {
let mint_info = read_fixture("nutshell_mint_info_v0.16.0.json")?;
let info = serde_json::from_str::<MintInfoResponse>(&mint_info);
assert!(info.is_ok());
let info = info?;
assert_eq!("Nutshell/0.16.0", info.version.unwrap());
Ok(())
}

#[test]
fn test_deserialize_incomplete_mint_info() -> anyhow::Result<()> {
let mint_info = read_fixture("incomplete_mint_info.json")?;
Expand Down

0 comments on commit 4aa4877

Please sign in to comment.