[Java] Update auto-generated Java bindings for 0.0.116
[ldk-java] / src / main / java / org / ldk / structs / ChannelTypeFeatures.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 /**
12  * Features used within the channel_type field in an OpenChannel message.
13  * 
14  * A channel is always of some known \"type\", describing the transaction formats used and the exact
15  * semantics of our interaction with our peer.
16  * 
17  * Note that because a channel is a specific type which is proposed by the opener and accepted by
18  * the counterparty, only required features are allowed here.
19  * 
20  * This is serialized differently from other feature types - it is not prefixed by a length, and
21  * thus must only appear inside a TLV where its length is known in advance.
22  */
23 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
24 public class ChannelTypeFeatures extends CommonBase {
25         ChannelTypeFeatures(Object _dummy, long ptr) { super(ptr); }
26         @Override @SuppressWarnings("deprecation")
27         protected void finalize() throws Throwable {
28                 super.finalize();
29                 if (ptr != 0) { bindings.ChannelTypeFeatures_free(ptr); }
30         }
31
32         /**
33          * Checks if two ChannelTypeFeaturess contain equal inner contents.
34          * This ignores pointers and is_owned flags and looks at the values in fields.
35          * Two objects with NULL inner values will be considered "equal" here.
36          */
37         public boolean eq(org.ldk.structs.ChannelTypeFeatures b) {
38                 boolean ret = bindings.ChannelTypeFeatures_eq(this.ptr, b == null ? 0 : b.ptr);
39                 Reference.reachabilityFence(this);
40                 Reference.reachabilityFence(b);
41                 if (this != null) { this.ptrs_to.add(b); };
42                 return ret;
43         }
44
45         @Override public boolean equals(Object o) {
46                 if (!(o instanceof ChannelTypeFeatures)) return false;
47                 return this.eq((ChannelTypeFeatures)o);
48         }
49         long clone_ptr() {
50                 long ret = bindings.ChannelTypeFeatures_clone_ptr(this.ptr);
51                 Reference.reachabilityFence(this);
52                 return ret;
53         }
54
55         /**
56          * Creates a copy of the ChannelTypeFeatures
57          */
58         public ChannelTypeFeatures clone() {
59                 long ret = bindings.ChannelTypeFeatures_clone(this.ptr);
60                 Reference.reachabilityFence(this);
61                 if (ret >= 0 && ret <= 4096) { return null; }
62                 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
63                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
64                 return ret_hu_conv;
65         }
66
67         /**
68          * Create a blank Features with no features set
69          */
70         public static ChannelTypeFeatures empty() {
71                 long ret = bindings.ChannelTypeFeatures_empty();
72                 if (ret >= 0 && ret <= 4096) { return null; }
73                 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
74                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
75                 return ret_hu_conv;
76         }
77
78         /**
79          * Returns true if this `Features` object contains required features unknown by `other`.
80          */
81         public boolean requires_unknown_bits_from(org.ldk.structs.ChannelTypeFeatures other) {
82                 boolean ret = bindings.ChannelTypeFeatures_requires_unknown_bits_from(this.ptr, other == null ? 0 : other.ptr);
83                 Reference.reachabilityFence(this);
84                 Reference.reachabilityFence(other);
85                 if (this != null) { this.ptrs_to.add(other); };
86                 return ret;
87         }
88
89         /**
90          * Returns true if this `Features` object contains unknown feature flags which are set as
91          * \"required\".
92          */
93         public boolean requires_unknown_bits() {
94                 boolean ret = bindings.ChannelTypeFeatures_requires_unknown_bits(this.ptr);
95                 Reference.reachabilityFence(this);
96                 return ret;
97         }
98
99         /**
100          * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
101          * by [bLIP 2] or if it is a known `T` feature.
102          * 
103          * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
104          * be set instead (i.e., `bit - 1`).
105          * 
106          * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
107          */
108         public Result_NoneNoneZ set_required_custom_bit(long bit) {
109                 long ret = bindings.ChannelTypeFeatures_set_required_custom_bit(this.ptr, bit);
110                 Reference.reachabilityFence(this);
111                 Reference.reachabilityFence(bit);
112                 if (ret >= 0 && ret <= 4096) { return null; }
113                 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
114                 return ret_hu_conv;
115         }
116
117         /**
118          * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
119          * by [bLIP 2] or if it is a known `T` feature.
120          * 
121          * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
122          * set instead (i.e., `bit + 1`).
123          * 
124          * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
125          */
126         public Result_NoneNoneZ set_optional_custom_bit(long bit) {
127                 long ret = bindings.ChannelTypeFeatures_set_optional_custom_bit(this.ptr, bit);
128                 Reference.reachabilityFence(this);
129                 Reference.reachabilityFence(bit);
130                 if (ret >= 0 && ret <= 4096) { return null; }
131                 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
132                 return ret_hu_conv;
133         }
134
135         /**
136          * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read
137          */
138         public byte[] write() {
139                 byte[] ret = bindings.ChannelTypeFeatures_write(this.ptr);
140                 Reference.reachabilityFence(this);
141                 return ret;
142         }
143
144         /**
145          * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write
146          */
147         public static Result_ChannelTypeFeaturesDecodeErrorZ read(byte[] ser) {
148                 long ret = bindings.ChannelTypeFeatures_read(ser);
149                 Reference.reachabilityFence(ser);
150                 if (ret >= 0 && ret <= 4096) { return null; }
151                 Result_ChannelTypeFeaturesDecodeErrorZ ret_hu_conv = Result_ChannelTypeFeaturesDecodeErrorZ.constr_from_ptr(ret);
152                 return ret_hu_conv;
153         }
154
155         /**
156          * Set this feature as optional.
157          */
158         public void set_static_remote_key_optional() {
159                 bindings.ChannelTypeFeatures_set_static_remote_key_optional(this.ptr);
160                 Reference.reachabilityFence(this);
161         }
162
163         /**
164          * Set this feature as required.
165          */
166         public void set_static_remote_key_required() {
167                 bindings.ChannelTypeFeatures_set_static_remote_key_required(this.ptr);
168                 Reference.reachabilityFence(this);
169         }
170
171         /**
172          * Checks if this feature is supported.
173          */
174         public boolean supports_static_remote_key() {
175                 boolean ret = bindings.ChannelTypeFeatures_supports_static_remote_key(this.ptr);
176                 Reference.reachabilityFence(this);
177                 return ret;
178         }
179
180         /**
181          * Checks if this feature is required.
182          */
183         public boolean requires_static_remote_key() {
184                 boolean ret = bindings.ChannelTypeFeatures_requires_static_remote_key(this.ptr);
185                 Reference.reachabilityFence(this);
186                 return ret;
187         }
188
189         /**
190          * Set this feature as optional.
191          */
192         public void set_anchors_nonzero_fee_htlc_tx_optional() {
193                 bindings.ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(this.ptr);
194                 Reference.reachabilityFence(this);
195         }
196
197         /**
198          * Set this feature as required.
199          */
200         public void set_anchors_nonzero_fee_htlc_tx_required() {
201                 bindings.ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(this.ptr);
202                 Reference.reachabilityFence(this);
203         }
204
205         /**
206          * Checks if this feature is supported.
207          */
208         public boolean supports_anchors_nonzero_fee_htlc_tx() {
209                 boolean ret = bindings.ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(this.ptr);
210                 Reference.reachabilityFence(this);
211                 return ret;
212         }
213
214         /**
215          * Checks if this feature is required.
216          */
217         public boolean requires_anchors_nonzero_fee_htlc_tx() {
218                 boolean ret = bindings.ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(this.ptr);
219                 Reference.reachabilityFence(this);
220                 return ret;
221         }
222
223         /**
224          * Set this feature as optional.
225          */
226         public void set_anchors_zero_fee_htlc_tx_optional() {
227                 bindings.ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(this.ptr);
228                 Reference.reachabilityFence(this);
229         }
230
231         /**
232          * Set this feature as required.
233          */
234         public void set_anchors_zero_fee_htlc_tx_required() {
235                 bindings.ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(this.ptr);
236                 Reference.reachabilityFence(this);
237         }
238
239         /**
240          * Checks if this feature is supported.
241          */
242         public boolean supports_anchors_zero_fee_htlc_tx() {
243                 boolean ret = bindings.ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(this.ptr);
244                 Reference.reachabilityFence(this);
245                 return ret;
246         }
247
248         /**
249          * Checks if this feature is required.
250          */
251         public boolean requires_anchors_zero_fee_htlc_tx() {
252                 boolean ret = bindings.ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(this.ptr);
253                 Reference.reachabilityFence(this);
254                 return ret;
255         }
256
257         /**
258          * Set this feature as optional.
259          */
260         public void set_scid_privacy_optional() {
261                 bindings.ChannelTypeFeatures_set_scid_privacy_optional(this.ptr);
262                 Reference.reachabilityFence(this);
263         }
264
265         /**
266          * Set this feature as required.
267          */
268         public void set_scid_privacy_required() {
269                 bindings.ChannelTypeFeatures_set_scid_privacy_required(this.ptr);
270                 Reference.reachabilityFence(this);
271         }
272
273         /**
274          * Checks if this feature is supported.
275          */
276         public boolean supports_scid_privacy() {
277                 boolean ret = bindings.ChannelTypeFeatures_supports_scid_privacy(this.ptr);
278                 Reference.reachabilityFence(this);
279                 return ret;
280         }
281
282         /**
283          * Checks if this feature is required.
284          */
285         public boolean requires_scid_privacy() {
286                 boolean ret = bindings.ChannelTypeFeatures_requires_scid_privacy(this.ptr);
287                 Reference.reachabilityFence(this);
288                 return ret;
289         }
290
291         /**
292          * Set this feature as optional.
293          */
294         public void set_zero_conf_optional() {
295                 bindings.ChannelTypeFeatures_set_zero_conf_optional(this.ptr);
296                 Reference.reachabilityFence(this);
297         }
298
299         /**
300          * Set this feature as required.
301          */
302         public void set_zero_conf_required() {
303                 bindings.ChannelTypeFeatures_set_zero_conf_required(this.ptr);
304                 Reference.reachabilityFence(this);
305         }
306
307         /**
308          * Checks if this feature is supported.
309          */
310         public boolean supports_zero_conf() {
311                 boolean ret = bindings.ChannelTypeFeatures_supports_zero_conf(this.ptr);
312                 Reference.reachabilityFence(this);
313                 return ret;
314         }
315
316         /**
317          * Checks if this feature is required.
318          */
319         public boolean requires_zero_conf() {
320                 boolean ret = bindings.ChannelTypeFeatures_requires_zero_conf(this.ptr);
321                 Reference.reachabilityFence(this);
322                 return ret;
323         }
324
325 }