[Java] Update auto-generated bindings to 0.0.117
[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 feature bit. Errors if `bit` is outside the feature range as defined
101          * by [BOLT 9].
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          * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
107          */
108         public Result_NoneNoneZ set_required_feature_bit(long bit) {
109                 long ret = bindings.ChannelTypeFeatures_set_required_feature_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 feature bit. Errors if `bit` is outside the feature range as defined
119          * by [BOLT 9].
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          * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
125          */
126         public Result_NoneNoneZ set_optional_feature_bit(long bit) {
127                 long ret = bindings.ChannelTypeFeatures_set_optional_feature_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          * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
137          * by [bLIP 2] or if it is a known `T` feature.
138          * 
139          * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
140          * be set instead (i.e., `bit - 1`).
141          * 
142          * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
143          */
144         public Result_NoneNoneZ set_required_custom_bit(long bit) {
145                 long ret = bindings.ChannelTypeFeatures_set_required_custom_bit(this.ptr, bit);
146                 Reference.reachabilityFence(this);
147                 Reference.reachabilityFence(bit);
148                 if (ret >= 0 && ret <= 4096) { return null; }
149                 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
150                 return ret_hu_conv;
151         }
152
153         /**
154          * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
155          * by [bLIP 2] or if it is a known `T` feature.
156          * 
157          * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
158          * set instead (i.e., `bit + 1`).
159          * 
160          * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
161          */
162         public Result_NoneNoneZ set_optional_custom_bit(long bit) {
163                 long ret = bindings.ChannelTypeFeatures_set_optional_custom_bit(this.ptr, bit);
164                 Reference.reachabilityFence(this);
165                 Reference.reachabilityFence(bit);
166                 if (ret >= 0 && ret <= 4096) { return null; }
167                 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
168                 return ret_hu_conv;
169         }
170
171         /**
172          * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read
173          */
174         public byte[] write() {
175                 byte[] ret = bindings.ChannelTypeFeatures_write(this.ptr);
176                 Reference.reachabilityFence(this);
177                 return ret;
178         }
179
180         /**
181          * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write
182          */
183         public static Result_ChannelTypeFeaturesDecodeErrorZ read(byte[] ser) {
184                 long ret = bindings.ChannelTypeFeatures_read(ser);
185                 Reference.reachabilityFence(ser);
186                 if (ret >= 0 && ret <= 4096) { return null; }
187                 Result_ChannelTypeFeaturesDecodeErrorZ ret_hu_conv = Result_ChannelTypeFeaturesDecodeErrorZ.constr_from_ptr(ret);
188                 return ret_hu_conv;
189         }
190
191         /**
192          * Set this feature as optional.
193          */
194         public void set_static_remote_key_optional() {
195                 bindings.ChannelTypeFeatures_set_static_remote_key_optional(this.ptr);
196                 Reference.reachabilityFence(this);
197         }
198
199         /**
200          * Set this feature as required.
201          */
202         public void set_static_remote_key_required() {
203                 bindings.ChannelTypeFeatures_set_static_remote_key_required(this.ptr);
204                 Reference.reachabilityFence(this);
205         }
206
207         /**
208          * Checks if this feature is supported.
209          */
210         public boolean supports_static_remote_key() {
211                 boolean ret = bindings.ChannelTypeFeatures_supports_static_remote_key(this.ptr);
212                 Reference.reachabilityFence(this);
213                 return ret;
214         }
215
216         /**
217          * Checks if this feature is required.
218          */
219         public boolean requires_static_remote_key() {
220                 boolean ret = bindings.ChannelTypeFeatures_requires_static_remote_key(this.ptr);
221                 Reference.reachabilityFence(this);
222                 return ret;
223         }
224
225         /**
226          * Set this feature as optional.
227          */
228         public void set_anchors_nonzero_fee_htlc_tx_optional() {
229                 bindings.ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(this.ptr);
230                 Reference.reachabilityFence(this);
231         }
232
233         /**
234          * Set this feature as required.
235          */
236         public void set_anchors_nonzero_fee_htlc_tx_required() {
237                 bindings.ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(this.ptr);
238                 Reference.reachabilityFence(this);
239         }
240
241         /**
242          * Checks if this feature is supported.
243          */
244         public boolean supports_anchors_nonzero_fee_htlc_tx() {
245                 boolean ret = bindings.ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(this.ptr);
246                 Reference.reachabilityFence(this);
247                 return ret;
248         }
249
250         /**
251          * Checks if this feature is required.
252          */
253         public boolean requires_anchors_nonzero_fee_htlc_tx() {
254                 boolean ret = bindings.ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(this.ptr);
255                 Reference.reachabilityFence(this);
256                 return ret;
257         }
258
259         /**
260          * Set this feature as optional.
261          */
262         public void set_anchors_zero_fee_htlc_tx_optional() {
263                 bindings.ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(this.ptr);
264                 Reference.reachabilityFence(this);
265         }
266
267         /**
268          * Set this feature as required.
269          */
270         public void set_anchors_zero_fee_htlc_tx_required() {
271                 bindings.ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(this.ptr);
272                 Reference.reachabilityFence(this);
273         }
274
275         /**
276          * Checks if this feature is supported.
277          */
278         public boolean supports_anchors_zero_fee_htlc_tx() {
279                 boolean ret = bindings.ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(this.ptr);
280                 Reference.reachabilityFence(this);
281                 return ret;
282         }
283
284         /**
285          * Checks if this feature is required.
286          */
287         public boolean requires_anchors_zero_fee_htlc_tx() {
288                 boolean ret = bindings.ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(this.ptr);
289                 Reference.reachabilityFence(this);
290                 return ret;
291         }
292
293         /**
294          * Set this feature as optional.
295          */
296         public void set_taproot_optional() {
297                 bindings.ChannelTypeFeatures_set_taproot_optional(this.ptr);
298                 Reference.reachabilityFence(this);
299         }
300
301         /**
302          * Set this feature as required.
303          */
304         public void set_taproot_required() {
305                 bindings.ChannelTypeFeatures_set_taproot_required(this.ptr);
306                 Reference.reachabilityFence(this);
307         }
308
309         /**
310          * Checks if this feature is supported.
311          */
312         public boolean supports_taproot() {
313                 boolean ret = bindings.ChannelTypeFeatures_supports_taproot(this.ptr);
314                 Reference.reachabilityFence(this);
315                 return ret;
316         }
317
318         /**
319          * Checks if this feature is required.
320          */
321         public boolean requires_taproot() {
322                 boolean ret = bindings.ChannelTypeFeatures_requires_taproot(this.ptr);
323                 Reference.reachabilityFence(this);
324                 return ret;
325         }
326
327         /**
328          * Set this feature as optional.
329          */
330         public void set_scid_privacy_optional() {
331                 bindings.ChannelTypeFeatures_set_scid_privacy_optional(this.ptr);
332                 Reference.reachabilityFence(this);
333         }
334
335         /**
336          * Set this feature as required.
337          */
338         public void set_scid_privacy_required() {
339                 bindings.ChannelTypeFeatures_set_scid_privacy_required(this.ptr);
340                 Reference.reachabilityFence(this);
341         }
342
343         /**
344          * Checks if this feature is supported.
345          */
346         public boolean supports_scid_privacy() {
347                 boolean ret = bindings.ChannelTypeFeatures_supports_scid_privacy(this.ptr);
348                 Reference.reachabilityFence(this);
349                 return ret;
350         }
351
352         /**
353          * Checks if this feature is required.
354          */
355         public boolean requires_scid_privacy() {
356                 boolean ret = bindings.ChannelTypeFeatures_requires_scid_privacy(this.ptr);
357                 Reference.reachabilityFence(this);
358                 return ret;
359         }
360
361         /**
362          * Set this feature as optional.
363          */
364         public void set_zero_conf_optional() {
365                 bindings.ChannelTypeFeatures_set_zero_conf_optional(this.ptr);
366                 Reference.reachabilityFence(this);
367         }
368
369         /**
370          * Set this feature as required.
371          */
372         public void set_zero_conf_required() {
373                 bindings.ChannelTypeFeatures_set_zero_conf_required(this.ptr);
374                 Reference.reachabilityFence(this);
375         }
376
377         /**
378          * Checks if this feature is supported.
379          */
380         public boolean supports_zero_conf() {
381                 boolean ret = bindings.ChannelTypeFeatures_supports_zero_conf(this.ptr);
382                 Reference.reachabilityFence(this);
383                 return ret;
384         }
385
386         /**
387          * Checks if this feature is required.
388          */
389         public boolean requires_zero_conf() {
390                 boolean ret = bindings.ChannelTypeFeatures_requires_zero_conf(this.ptr);
391                 Reference.reachabilityFence(this);
392                 return ret;
393         }
394
395 }