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
feat: Add Bolt11Invoice interface and wrapper implementation for FFI bindings
- Convert Bolt11Invoice from string type to full interface in UDL
- Define required Bolt11Invoice methods in the UDL interface (expiry_time_seconds, min_final_cltv_expiry_delta, amount_milli_satoshis, is_expired, etc.)
- Create Bolt11Invoice struct in uniffi_types.rs to wrap LdkBolt11Invoice
- Implement methods required by the UDL interface
- Add From/Into implementations for conversion between wrapper and LDK types
- Add tests for the wrapper struct
let reconverted_description:Bolt11InvoiceDescription = converted_description.into();
442
528
assert_eq!(description, reconverted_description);
443
529
}
530
+
531
+
#[test]
532
+
fntest_bolt11_invoice(){
533
+
let invoice_string = "lnbc1pn8g249pp5f6ytj32ty90jhvw69enf30hwfgdhyymjewywcmfjevflg6s4z86qdqqcqzzgxqyz5vqrzjqwnvuc0u4txn35cafc7w94gxvq5p3cu9dd95f7hlrh0fvs46wpvhdfjjzh2j9f7ye5qqqqryqqqqthqqpysp5mm832athgcal3m7h35sc29j63lmgzvwc5smfjh2es65elc2ns7dq9qrsgqu2xcje2gsnjp0wn97aknyd3h58an7sjj6nhcrm40846jxphv47958c6th76whmec8ttr2wmg6sxwchvxmsc00kqrzqcga6lvsf9jtqgqy5yexa";
534
+
let ldk_invoice:LdkBolt11Invoice = invoice_string.parse().unwrap();
535
+
536
+
let wrapped_invoice = Bolt11Invoice::from(ldk_invoice.clone());
let invoice_string = "lnbc1pn8g249pp5f6ytj32ty90jhvw69enf30hwfgdhyymjewywcmfjevflg6s4z86qdqqcqzzgxqyz5vqrzjqwnvuc0u4txn35cafc7w94gxvq5p3cu9dd95f7hlrh0fvs46wpvhdfjjzh2j9f7ye5qqqqryqqqqthqqpysp5mm832athgcal3m7h35sc29j63lmgzvwc5smfjh2es65elc2ns7dq9qrsgqu2xcje2gsnjp0wn97aknyd3h58an7sjj6nhcrm40846jxphv47958c6th76whmec8ttr2wmg6sxwchvxmsc00kqrzqcga6lvsf9jtqgqy5yexa";
572
+
let original_invoice:LdkBolt11Invoice = invoice_string.parse().unwrap();
573
+
let wrapped_invoice = Bolt11Invoice{inner: original_invoice.clone()};
574
+
let unwrapped_invoice:LdkBolt11Invoice = wrapped_invoice.clone().into();
0 commit comments