[Java] Update auto-generated Java bindings
[ldk-java] / src / main / java / org / ldk / structs / WriteableEcdsaChannelSigner.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 writeable signer.
12  * 
13  * There will always be two instances of a signer per channel, one occupied by the
14  * [`ChannelManager`] and another by the channel's [`ChannelMonitor`].
15  * 
16  * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
17  * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
18  */
19 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
20 public class WriteableEcdsaChannelSigner extends CommonBase {
21         final bindings.LDKWriteableEcdsaChannelSigner bindings_instance;
22         WriteableEcdsaChannelSigner(Object _dummy, long ptr) { super(ptr); bindings_instance = null; }
23         private WriteableEcdsaChannelSigner(bindings.LDKWriteableEcdsaChannelSigner arg, bindings.LDKEcdsaChannelSigner EcdsaChannelSigner, bindings.LDKChannelSigner ChannelSigner, ChannelPublicKeys pubkeys) {
24                 super(bindings.LDKWriteableEcdsaChannelSigner_new(arg, EcdsaChannelSigner, ChannelSigner, pubkeys == null ? 0 : pubkeys.clone_ptr()));
25                 this.ptrs_to.add(arg);
26                 this.ptrs_to.add(EcdsaChannelSigner);
27                 this.ptrs_to.add(ChannelSigner);
28                 this.bindings_instance = arg;
29         }
30         @Override @SuppressWarnings("deprecation")
31         protected void finalize() throws Throwable {
32                 if (ptr != 0) { bindings.WriteableEcdsaChannelSigner_free(ptr); } super.finalize();
33         }
34         /**
35          * Destroys the object, freeing associated resources. After this call, any access
36          * to this object may result in a SEGFAULT or worse.
37          *
38          * You should generally NEVER call this method. You should let the garbage collector
39          * do this for you when it finalizes objects. However, it may be useful for types
40          * which represent locks and should be closed immediately to avoid holding locks
41          * until the GC runs.
42          */
43         public void destroy() {
44                 if (ptr != 0) { bindings.WriteableEcdsaChannelSigner_free(ptr); }
45                 ptr = 0;
46         }
47         public static interface WriteableEcdsaChannelSignerInterface {
48                 /**
49                  * Serialize the object into a byte array
50                  */
51                 byte[] write();
52         }
53         private static class LDKWriteableEcdsaChannelSignerHolder { WriteableEcdsaChannelSigner held; }
54         public static WriteableEcdsaChannelSigner new_impl(WriteableEcdsaChannelSignerInterface arg, EcdsaChannelSigner.EcdsaChannelSignerInterface EcdsaChannelSigner_impl, ChannelSigner.ChannelSignerInterface ChannelSigner_impl, ChannelPublicKeys pubkeys) {
55                 final LDKWriteableEcdsaChannelSignerHolder impl_holder = new LDKWriteableEcdsaChannelSignerHolder();
56                 impl_holder.held = new WriteableEcdsaChannelSigner(new bindings.LDKWriteableEcdsaChannelSigner() {
57                         @Override public byte[] write() {
58                                 byte[] ret = arg.write();
59                                 Reference.reachabilityFence(arg);
60                                 return ret;
61                         }
62                 }, EcdsaChannelSigner.new_impl(EcdsaChannelSigner_impl, ChannelSigner_impl, pubkeys).bindings_instance, ChannelSigner.new_impl(ChannelSigner_impl, pubkeys).bindings_instance, pubkeys);
63                 return impl_holder.held;
64         }
65
66         /**
67          * Gets the underlying EcdsaChannelSigner.
68          */
69         public EcdsaChannelSigner get_ecdsa_channel_signer() {
70                 EcdsaChannelSigner res = new EcdsaChannelSigner(null, bindings.LDKWriteableEcdsaChannelSigner_get_EcdsaChannelSigner(this.ptr));
71                 res.ptrs_to.add(this);
72                 return res;
73         }
74
75
76         /**
77          * Gets the underlying ChannelSigner.
78          */
79         public ChannelSigner get_channel_signer() {
80                 ChannelSigner res = new ChannelSigner(null, bindings.LDKWriteableEcdsaChannelSigner_get_ChannelSigner(this.ptr));
81                 res.ptrs_to.add(this);
82                 return res;
83         }
84
85         /**
86          * Serialize the object into a byte array
87          */
88         public byte[] write() {
89                 byte[] ret = bindings.WriteableEcdsaChannelSigner_write(this.ptr);
90                 Reference.reachabilityFence(this);
91                 return ret;
92         }
93
94         long clone_ptr() {
95                 long ret = bindings.WriteableEcdsaChannelSigner_clone_ptr(this.ptr);
96                 Reference.reachabilityFence(this);
97                 return ret;
98         }
99
100         /**
101          * Creates a copy of a WriteableEcdsaChannelSigner
102          */
103         public WriteableEcdsaChannelSigner clone() {
104                 long ret = bindings.WriteableEcdsaChannelSigner_clone(this.ptr);
105                 Reference.reachabilityFence(this);
106                 if (ret >= 0 && ret <= 4096) { return null; }
107                 WriteableEcdsaChannelSigner ret_hu_conv = new WriteableEcdsaChannelSigner(null, ret);
108                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
109                 return ret_hu_conv;
110         }
111
112 }