X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FInvoice.java;h=e848a21837f9c1b0fb191171cfcceeb5408e37b0;hb=8c0814bf345323be8f16e075a9af0bd43d9400ee;hp=695f35decfced543f1bb30630408d6fd80eb7016;hpb=b0c50b891cbca28d3bd1d86276c132ff5221d8e4;p=ldk-java diff --git a/src/main/java/org/ldk/structs/Invoice.java b/src/main/java/org/ldk/structs/Invoice.java index 695f35de..e848a218 100644 --- a/src/main/java/org/ldk/structs/Invoice.java +++ b/src/main/java/org/ldk/structs/Invoice.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import javax.annotation.Nullable; /** @@ -39,6 +40,7 @@ public class Invoice extends CommonBase { */ public Invoice clone() { long ret = bindings.Invoice_clone(this.ptr); + if (ret < 1024) { return null; } Invoice ret_hu_conv = new Invoice(null, ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; @@ -49,9 +51,10 @@ public class Invoice extends CommonBase { */ public SignedRawInvoice into_signed_raw() { long ret = bindings.Invoice_into_signed_raw(this.ptr); + if (ret < 1024) { return null; } SignedRawInvoice ret_hu_conv = new SignedRawInvoice(null, ret); ret_hu_conv.ptrs_to.add(this); - this.ptrs_to.add(this); + ; return ret_hu_conv; } @@ -60,6 +63,7 @@ public class Invoice extends CommonBase { */ public Result_NoneSemanticErrorZ check_signature() { long ret = bindings.Invoice_check_signature(this.ptr); + if (ret < 1024) { return null; } Result_NoneSemanticErrorZ ret_hu_conv = Result_NoneSemanticErrorZ.constr_from_ptr(ret); return ret_hu_conv; } @@ -69,10 +73,17 @@ public class Invoice extends CommonBase { * ``` * use lightning_invoice::*; * - * let invoice = \"lnbc1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdp\\ - * \tl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaq8rkx3yf5tcsyz3d7\\ - * \t3gafnh3cax9rn449d9p5uxz9ezhhypd0elx87sjle52x86fux2ypatgddc6k63n7erqz25le42c4u4ec\\ - * \tky03ylcqca784w\"; + * let invoice = \"lnbc100p1psj9jhxdqud3jxktt5w46x7unfv9kz6mn0v3jsnp4q0d3p2sfluzdx45tqcs\\ + * h2pu5qc7lgq0xs578ngs6s0s68ua4h7cvspp5q6rmq35js88zp5dvwrv9m459tnk2zunwj5jalqtyxqulh0l\\ + * 5gflssp5nf55ny5gcrfl30xuhzj3nphgj27rstekmr9fw3ny5989s300gyus9qyysgqcqpcrzjqw2sxwe993\\ + * h5pcm4dxzpvttgza8zhkqxpgffcrf5v25nwpr3cmfg7z54kuqq8rgqqqqqqqq2qqqqq9qq9qrzjqd0ylaqcl\\ + * j9424x9m8h2vcukcgnm6s56xfgu3j78zyqzhgs4hlpzvznlugqq9vsqqqqqqqlgqqqqqeqq9qrzjqwldmj9d\\ + * ha74df76zhx6l9we0vjdquygcdt3kssupehe64g6yyp5yz5rhuqqwccqqyqqqqlgqqqqjcqq9qrzjqf9e58a\\ + * guqr0rcun0ajlvmzq3ek63cw2w282gv3z5uupmuwvgjtq2z55qsqqg6qqqyqqqrtnqqqzq3cqygrzjqvphms\\ + * ywntrrhqjcraumvc4y6r8v4z5v593trte429v4hredj7ms5z52usqq9ngqqqqqqqlgqqqqqqgq9qrzjq2v0v\\ + * p62g49p7569ev48cmulecsxe59lvaw3wlxm7r982zxa9zzj7z5l0cqqxusqqyqqqqlgqqqqqzsqygarl9fh3\\ + * 8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\\ + * j5r6drg6k6zcqj0fcwg\"; * * let signed = invoice.parse::().unwrap(); * @@ -81,8 +92,8 @@ public class Invoice extends CommonBase { */ public static Result_InvoiceSemanticErrorZ from_signed(SignedRawInvoice signed_invoice) { long ret = bindings.Invoice_from_signed(signed_invoice == null ? 0 : signed_invoice.ptr & ~1); + if (ret < 1024) { return null; } Result_InvoiceSemanticErrorZ ret_hu_conv = Result_InvoiceSemanticErrorZ.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(signed_invoice); return ret_hu_conv; } @@ -104,7 +115,10 @@ public class Invoice extends CommonBase { /** * Get the payee's public key if one was included in the invoice + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ + @Nullable public byte[] payee_pub_key() { byte[] ret = bindings.Invoice_payee_pub_key(this.ptr); return ret; @@ -120,9 +134,13 @@ public class Invoice extends CommonBase { /** * Get the invoice features if they were included in the invoice + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ + @Nullable public InvoiceFeatures features() { long ret = bindings.Invoice_features(this.ptr); + if (ret < 1024) { return null; } InvoiceFeatures ret_hu_conv = new InvoiceFeatures(null, ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; @@ -196,6 +214,7 @@ public class Invoice extends CommonBase { */ public Option_u64Z amount_pico_btc() { long ret = bindings.Invoice_amount_pico_btc(this.ptr); + if (ret < 1024) { return null; } Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; @@ -204,8 +223,9 @@ public class Invoice extends CommonBase { /** * Read a Invoice object from a string */ - public static Result_InvoiceNoneZ from_str(String s) { + public static Result_InvoiceNoneZ from_str(java.lang.String s) { long ret = bindings.Invoice_from_str(s); + if (ret < 1024) { return null; } Result_InvoiceNoneZ ret_hu_conv = Result_InvoiceNoneZ.constr_from_ptr(ret); return ret_hu_conv; }