@@ -59,7 +59,7 @@ impl<'de> Deserialize<'de> for MintVersion {
59
59
}
60
60
}
61
61
62
- /// Mint Info [NIP -06]
62
+ /// Mint Info [NUT -06]
63
63
#[ derive( Default , Debug , Clone , PartialEq , Eq , Hash , Serialize , Deserialize ) ]
64
64
#[ cfg_attr( feature = "swagger" , derive( utoipa:: ToSchema ) ) ]
65
65
pub struct MintInfo {
@@ -95,6 +95,9 @@ pub struct MintInfo {
95
95
/// server unix timestamp
96
96
#[ serde( skip_serializing_if = "Option::is_none" ) ]
97
97
pub time : Option < u64 > ,
98
+ /// terms of url service of the mint
99
+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
100
+ pub tos_url : Option < String > ,
98
101
}
99
102
100
103
impl MintInfo {
@@ -197,6 +200,17 @@ impl MintInfo {
197
200
..self
198
201
}
199
202
}
203
+
204
+ /// Set tos_url
205
+ pub fn tos_url < S > ( self , tos_url : S ) -> Self
206
+ where
207
+ S : Into < String > ,
208
+ {
209
+ Self {
210
+ tos_url : Some ( tos_url. into ( ) ) ,
211
+ ..self
212
+ }
213
+ }
200
214
}
201
215
202
216
/// Supported nuts and settings
@@ -405,12 +419,12 @@ mod tests {
405
419
#[ test]
406
420
fn test_des_mint_into ( ) {
407
421
let mint_info_str = r#"{
408
- "name": "Cashu mint",
409
- "pubkey": "0296d0aa13b6a31cf0cd974249f28c7b7176d7274712c95a41c7d8066d3f29d679",
410
- "version": "Nutshell/0.15.3",
411
- "contact": [
412
- ["", ""],
413
- ["", ""]
422
+ "name": "Cashu mint",
423
+ "pubkey": "0296d0aa13b6a31cf0cd974249f28c7b7176d7274712c95a41c7d8066d3f29d679",
424
+ "version": "Nutshell/0.15.3",
425
+ "contact": [
426
+ ["", ""],
427
+ ["", ""]
414
428
],
415
429
"nuts": {
416
430
"4": {
@@ -432,7 +446,8 @@ mod tests {
432
446
"9": {"supported": true},
433
447
"10": {"supported": true},
434
448
"11": {"supported": true}
435
- }
449
+ },
450
+ "tos_url": "https://cashu.mint/tos"
436
451
}"# ;
437
452
438
453
let _mint_info: MintInfo = serde_json:: from_str ( mint_info_str) . unwrap ( ) ;
@@ -455,7 +470,8 @@ mod tests {
455
470
456
471
println!("{}", mint_info);
457
472
*/
458
- let mint_info_str = r#"{
473
+ let mint_info_str = r#"
474
+ {
459
475
"name": "Bob's Cashu mint",
460
476
"pubkey": "0283bf290884eed3a7ca2663fc0260de2e2064d6b355ea13f98dec004b7a7ead99",
461
477
"version": "Nutshell/0.15.0",
@@ -502,51 +518,54 @@ mod tests {
502
518
"9": {"supported": true},
503
519
"10": {"supported": true},
504
520
"12": {"supported": true}
505
- }
521
+ },
522
+ "tos_url": "https://cashu.mint/tos"
506
523
}"# ;
507
524
let info: MintInfo = serde_json:: from_str ( mint_info_str) . unwrap ( ) ;
508
- let mint_info_str = r#"{
509
- "name": "Bob's Cashu mint",
510
- "pubkey": "0283bf290884eed3a7ca2663fc0260de2e2064d6b355ea13f98dec004b7a7ead99",
511
- "version": "Nutshell/0.15.0",
512
- "description": "The short mint description",
513
- "description_long": "A description that can be a long piece of text.",
514
- "contact": [
515
- ["nostr", "xxxxx"],
516
- ["email", "contact@me.com"]
517
- ],
518
- "motd": "Message to display to users.",
519
- "icon_url": "https://this-is-a-mint-icon-url.com/icon.png",
520
- "nuts": {
521
- "4": {
522
- "methods": [
523
- {
524
- "method": "bolt11",
525
- "unit": "sat",
526
- "min_amount": 0,
527
- "max_amount": 10000,
528
- "description": true
529
- }
530
- ],
531
- "disabled": false
532
- },
533
- "5": {
534
- "methods": [
535
- {
536
- "method": "bolt11",
537
- "unit": "sat",
538
- "min_amount": 0,
539
- "max_amount": 10000
540
- }
541
- ],
542
- "disabled": false
543
- },
544
- "7": {"supported": true},
545
- "8": {"supported": true},
546
- "9": {"supported": true},
547
- "10": {"supported": true},
548
- "12": {"supported": true}
549
- }
525
+ let mint_info_str = r#"
526
+ {
527
+ "name": "Bob's Cashu mint",
528
+ "pubkey": "0283bf290884eed3a7ca2663fc0260de2e2064d6b355ea13f98dec004b7a7ead99",
529
+ "version": "Nutshell/0.15.0",
530
+ "description": "The short mint description",
531
+ "description_long": "A description that can be a long piece of text.",
532
+ "contact": [
533
+ ["nostr", "xxxxx"],
534
+ ["email", "contact@me.com"]
535
+ ],
536
+ "motd": "Message to display to users.",
537
+ "icon_url": "https://this-is-a-mint-icon-url.com/icon.png",
538
+ "nuts": {
539
+ "4": {
540
+ "methods": [
541
+ {
542
+ "method": "bolt11",
543
+ "unit": "sat",
544
+ "min_amount": 0,
545
+ "max_amount": 10000,
546
+ "description": true
547
+ }
548
+ ],
549
+ "disabled": false
550
+ },
551
+ "5": {
552
+ "methods": [
553
+ {
554
+ "method": "bolt11",
555
+ "unit": "sat",
556
+ "min_amount": 0,
557
+ "max_amount": 10000
558
+ }
559
+ ],
560
+ "disabled": false
561
+ },
562
+ "7": {"supported": true},
563
+ "8": {"supported": true},
564
+ "9": {"supported": true},
565
+ "10": {"supported": true},
566
+ "12": {"supported": true}
567
+ },
568
+ "tos_url": "https://cashu.mint/tos"
550
569
}"# ;
551
570
let mint_info: MintInfo = serde_json:: from_str ( mint_info_str) . unwrap ( ) ;
552
571
0 commit comments