You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace the flat fee reserve with `sm` method objects carrying optional
`mf` values, and encode them as NUT-26 supported-method sub-TLVs on tag
0x0a.
Apply method fees when paying from an unlisted mint, or from any mint
when the request has no mint list. Select the lowest fee among matching
NUT-05 melt methods and keep requested amounts net of input fees.
Cover the current NUT-18 and NUT-26 spec vectors, including the
preferred-method-fee cases. Accept the standard-base64 NUT-18 vectors
published by the spec while continuing to emit urlsafe CREQ-A strings.
let value = serde_json::to_value(&payment_request).unwrap();
545
+
assert_eq!(
546
+
value.get("sm"),
547
+
Some(&serde_json::json!([
548
+
{"mn":"bolt11"},
549
+
{"mn":"bolt12","mf":5}
550
+
]))
551
+
);
552
+
553
+
let decoded:PaymentRequest = serde_json::from_value(serde_json::json!({
554
+
"sm":[
555
+
{"mn":"bolt11"},
556
+
{"mn":"bolt12","mf":5}
557
+
]
558
+
}))
559
+
.unwrap();
560
+
assert_eq!(
561
+
decoded.supported_methods,
562
+
vec![
563
+
SupportedMethod::new("bolt11"),
564
+
SupportedMethod::with_fee("bolt12",5),
565
+
]
566
+
);
567
+
}
568
+
502
569
#[test]
503
570
fntest_nut10_secret_request_htlc(){
504
571
let bolt11 = "lnbc100n1p5z3a63pp56854ytysg7e5z9fl3w5mgvrlqjfcytnjv8ff5hm5qt6gl6alxesqdqqcqzzsxqyz5vqsp5p0x0dlhn27s63j4emxnk26p7f94u0lyarnfp5yqmac9gzy4ngdss9qxpqysgqne3v0hnzt2lp0hc69xpzckk0cdcar7glvjhq60lsrfe8gejdm8c564prrnsft6ctxxyrewp4jtezrq3gxxqnfjj0f9tw2qs9y0lslmqpfu7et9";
@@ -625,6 +692,72 @@ mod tests {
625
692
);
626
693
}
627
694
695
+
#[test]
696
+
fntest_complete_payment_request(){
697
+
// Complete payment request with all optional fields included
698
+
let expected_encoded = "creqAqGF0gaNhdGRwb3N0YWF4G2h0dHBzOi8vYXBpLmV4YW1wbGUuY29tL3BheWFn92FpaDQ4NDBmNTFlYWEZA+hhdWNzYXRhbYF4GGh0dHBzOi8vbWludC5leGFtcGxlLmNvbWFkcFByb2R1Y3QgcHVyY2hhc2Vhc/VlbnV0MTCjYWtkUDJQS2FkeEIwM2JhZjBjM2FjMjIwMzY2YzJjMzk3YmY5MzA1NzljNDE2MzQzNTU4NGY1NzNiMTA5MTA5ODdjNTQ0YzU5ZTYxZjFhdIGCZ3B1cnBvc2Vnb2ZmbGluZQ==";
699
+
700
+
let decoded_from_spec = PaymentRequest::from_str(expected_encoded).unwrap();
let expected_encoded = "creqApWF0gaNhdGRwb3N0YWF4H2h0dHBzOi8vYXBpLmV4YW1wbGUuY29tL3JlY2VpdmVhZ/dhaWhhMmMxMmY0NWFhGDJhdWNzYXRhbYF4GWh0dHBzOi8vY2FzaHUuZXhhbXBsZS5jb20=";
740
+
741
+
let decoded_from_spec = PaymentRequest::from_str(expected_encoded).unwrap();
// Preferred mint list with supported methods and per-method fee
920
+
let expected_encoded = "creqApmFpdXByZWZlcnJlZF9mZWVfbWV0aG9kc2FhGGRhdWNzYXRhbYF4GGh0dHBzOi8vbWludC5leGFtcGxlLmNvbWJtcPVic22CoWJtbmZib2x0MTGiYm1uZmJvbHQxMmJtZgU=";
921
+
922
+
let decoded_from_spec = PaymentRequest::from_str(expected_encoded).unwrap();
0 commit comments