[Java] Update auto-generated bindings to LDK 0.0.123
[ldk-java] / src / main / java / org / ldk / structs / SignInvoiceRequestFn.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10 /**
11  * A function for signing an [`UnsignedInvoiceRequest`].
12  */
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class SignInvoiceRequestFn extends CommonBase {
15         final bindings.LDKSignInvoiceRequestFn bindings_instance;
16         SignInvoiceRequestFn(Object _dummy, long ptr) { super(ptr); bindings_instance = null; }
17         private SignInvoiceRequestFn(bindings.LDKSignInvoiceRequestFn arg) {
18                 super(bindings.LDKSignInvoiceRequestFn_new(arg));
19                 this.ptrs_to.add(arg);
20                 this.bindings_instance = arg;
21         }
22         @Override @SuppressWarnings("deprecation")
23         protected void finalize() throws Throwable {
24                 if (ptr != 0) { bindings.SignInvoiceRequestFn_free(ptr); } super.finalize();
25         }
26         /**
27          * Destroys the object, freeing associated resources. After this call, any access
28          * to this object may result in a SEGFAULT or worse.
29          *
30          * You should generally NEVER call this method. You should let the garbage collector
31          * do this for you when it finalizes objects. However, it may be useful for types
32          * which represent locks and should be closed immediately to avoid holding locks
33          * until the GC runs.
34          */
35         public void destroy() {
36                 if (ptr != 0) { bindings.SignInvoiceRequestFn_free(ptr); }
37                 ptr = 0;
38         }
39         public static interface SignInvoiceRequestFnInterface {
40                 /**
41                  * Signs a [`TaggedHash`] computed over the merkle root of `message`'s TLV stream.
42                  */
43                 Result_SchnorrSignatureNoneZ sign_invoice_request(UnsignedInvoiceRequest message);
44         }
45         private static class LDKSignInvoiceRequestFnHolder { SignInvoiceRequestFn held; }
46         public static SignInvoiceRequestFn new_impl(SignInvoiceRequestFnInterface arg) {
47                 final LDKSignInvoiceRequestFnHolder impl_holder = new LDKSignInvoiceRequestFnHolder();
48                 impl_holder.held = new SignInvoiceRequestFn(new bindings.LDKSignInvoiceRequestFn() {
49                         @Override public long sign_invoice_request(long message) {
50                                 org.ldk.structs.UnsignedInvoiceRequest message_hu_conv = null; if (message < 0 || message > 4096) { message_hu_conv = new org.ldk.structs.UnsignedInvoiceRequest(null, message); }
51                                 Result_SchnorrSignatureNoneZ ret = arg.sign_invoice_request(message_hu_conv);
52                                 Reference.reachabilityFence(arg);
53                                 long result = ret.clone_ptr();
54                                 return result;
55                         }
56                 });
57                 return impl_holder.held;
58         }
59         /**
60          * Signs a [`TaggedHash`] computed over the merkle root of `message`'s TLV stream.
61          */
62         public Result_SchnorrSignatureNoneZ sign_invoice_request(org.ldk.structs.UnsignedInvoiceRequest message) {
63                 long ret = bindings.SignInvoiceRequestFn_sign_invoice_request(this.ptr, message.ptr);
64                 Reference.reachabilityFence(this);
65                 Reference.reachabilityFence(message);
66                 if (ret >= 0 && ret <= 4096) { return null; }
67                 Result_SchnorrSignatureNoneZ ret_hu_conv = Result_SchnorrSignatureNoneZ.constr_from_ptr(ret);
68                 if (this != null) { this.ptrs_to.add(message); };
69                 return ret_hu_conv;
70         }
71
72 }