[Java] Update auto-generated Java bindings for 0.0.116
[ldk-java] / src / main / java / org / ldk / structs / NodeFeatures.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 a `node_announcement` message.
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class NodeFeatures extends CommonBase {
16         NodeFeatures(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.NodeFeatures_free(ptr); }
21         }
22
23         /**
24          * Checks if two NodeFeaturess contain equal inner contents.
25          * This ignores pointers and is_owned flags and looks at the values in fields.
26          * Two objects with NULL inner values will be considered "equal" here.
27          */
28         public boolean eq(org.ldk.structs.NodeFeatures b) {
29                 boolean ret = bindings.NodeFeatures_eq(this.ptr, b == null ? 0 : b.ptr);
30                 Reference.reachabilityFence(this);
31                 Reference.reachabilityFence(b);
32                 if (this != null) { this.ptrs_to.add(b); };
33                 return ret;
34         }
35
36         @Override public boolean equals(Object o) {
37                 if (!(o instanceof NodeFeatures)) return false;
38                 return this.eq((NodeFeatures)o);
39         }
40         long clone_ptr() {
41                 long ret = bindings.NodeFeatures_clone_ptr(this.ptr);
42                 Reference.reachabilityFence(this);
43                 return ret;
44         }
45
46         /**
47          * Creates a copy of the NodeFeatures
48          */
49         public NodeFeatures clone() {
50                 long ret = bindings.NodeFeatures_clone(this.ptr);
51                 Reference.reachabilityFence(this);
52                 if (ret >= 0 && ret <= 4096) { return null; }
53                 org.ldk.structs.NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeFeatures(null, ret); }
54                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
55                 return ret_hu_conv;
56         }
57
58         /**
59          * Create a blank Features with no features set
60          */
61         public static NodeFeatures empty() {
62                 long ret = bindings.NodeFeatures_empty();
63                 if (ret >= 0 && ret <= 4096) { return null; }
64                 org.ldk.structs.NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeFeatures(null, ret); }
65                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
66                 return ret_hu_conv;
67         }
68
69         /**
70          * Returns true if this `Features` object contains required features unknown by `other`.
71          */
72         public boolean requires_unknown_bits_from(org.ldk.structs.NodeFeatures other) {
73                 boolean ret = bindings.NodeFeatures_requires_unknown_bits_from(this.ptr, other == null ? 0 : other.ptr);
74                 Reference.reachabilityFence(this);
75                 Reference.reachabilityFence(other);
76                 if (this != null) { this.ptrs_to.add(other); };
77                 return ret;
78         }
79
80         /**
81          * Returns true if this `Features` object contains unknown feature flags which are set as
82          * \"required\".
83          */
84         public boolean requires_unknown_bits() {
85                 boolean ret = bindings.NodeFeatures_requires_unknown_bits(this.ptr);
86                 Reference.reachabilityFence(this);
87                 return ret;
88         }
89
90         /**
91          * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
92          * by [bLIP 2] or if it is a known `T` feature.
93          * 
94          * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
95          * be set instead (i.e., `bit - 1`).
96          * 
97          * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
98          */
99         public Result_NoneNoneZ set_required_custom_bit(long bit) {
100                 long ret = bindings.NodeFeatures_set_required_custom_bit(this.ptr, bit);
101                 Reference.reachabilityFence(this);
102                 Reference.reachabilityFence(bit);
103                 if (ret >= 0 && ret <= 4096) { return null; }
104                 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
105                 return ret_hu_conv;
106         }
107
108         /**
109          * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
110          * by [bLIP 2] or if it is a known `T` feature.
111          * 
112          * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
113          * set instead (i.e., `bit + 1`).
114          * 
115          * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
116          */
117         public Result_NoneNoneZ set_optional_custom_bit(long bit) {
118                 long ret = bindings.NodeFeatures_set_optional_custom_bit(this.ptr, bit);
119                 Reference.reachabilityFence(this);
120                 Reference.reachabilityFence(bit);
121                 if (ret >= 0 && ret <= 4096) { return null; }
122                 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
123                 return ret_hu_conv;
124         }
125
126         /**
127          * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
128          */
129         public byte[] write() {
130                 byte[] ret = bindings.NodeFeatures_write(this.ptr);
131                 Reference.reachabilityFence(this);
132                 return ret;
133         }
134
135         /**
136          * Read a NodeFeatures from a byte array, created by NodeFeatures_write
137          */
138         public static Result_NodeFeaturesDecodeErrorZ read(byte[] ser) {
139                 long ret = bindings.NodeFeatures_read(ser);
140                 Reference.reachabilityFence(ser);
141                 if (ret >= 0 && ret <= 4096) { return null; }
142                 Result_NodeFeaturesDecodeErrorZ ret_hu_conv = Result_NodeFeaturesDecodeErrorZ.constr_from_ptr(ret);
143                 return ret_hu_conv;
144         }
145
146         /**
147          * Set this feature as optional.
148          */
149         public void set_data_loss_protect_optional() {
150                 bindings.NodeFeatures_set_data_loss_protect_optional(this.ptr);
151                 Reference.reachabilityFence(this);
152         }
153
154         /**
155          * Set this feature as required.
156          */
157         public void set_data_loss_protect_required() {
158                 bindings.NodeFeatures_set_data_loss_protect_required(this.ptr);
159                 Reference.reachabilityFence(this);
160         }
161
162         /**
163          * Checks if this feature is supported.
164          */
165         public boolean supports_data_loss_protect() {
166                 boolean ret = bindings.NodeFeatures_supports_data_loss_protect(this.ptr);
167                 Reference.reachabilityFence(this);
168                 return ret;
169         }
170
171         /**
172          * Checks if this feature is required.
173          */
174         public boolean requires_data_loss_protect() {
175                 boolean ret = bindings.NodeFeatures_requires_data_loss_protect(this.ptr);
176                 Reference.reachabilityFence(this);
177                 return ret;
178         }
179
180         /**
181          * Set this feature as optional.
182          */
183         public void set_upfront_shutdown_script_optional() {
184                 bindings.NodeFeatures_set_upfront_shutdown_script_optional(this.ptr);
185                 Reference.reachabilityFence(this);
186         }
187
188         /**
189          * Set this feature as required.
190          */
191         public void set_upfront_shutdown_script_required() {
192                 bindings.NodeFeatures_set_upfront_shutdown_script_required(this.ptr);
193                 Reference.reachabilityFence(this);
194         }
195
196         /**
197          * Checks if this feature is supported.
198          */
199         public boolean supports_upfront_shutdown_script() {
200                 boolean ret = bindings.NodeFeatures_supports_upfront_shutdown_script(this.ptr);
201                 Reference.reachabilityFence(this);
202                 return ret;
203         }
204
205         /**
206          * Checks if this feature is required.
207          */
208         public boolean requires_upfront_shutdown_script() {
209                 boolean ret = bindings.NodeFeatures_requires_upfront_shutdown_script(this.ptr);
210                 Reference.reachabilityFence(this);
211                 return ret;
212         }
213
214         /**
215          * Set this feature as optional.
216          */
217         public void set_gossip_queries_optional() {
218                 bindings.NodeFeatures_set_gossip_queries_optional(this.ptr);
219                 Reference.reachabilityFence(this);
220         }
221
222         /**
223          * Set this feature as required.
224          */
225         public void set_gossip_queries_required() {
226                 bindings.NodeFeatures_set_gossip_queries_required(this.ptr);
227                 Reference.reachabilityFence(this);
228         }
229
230         /**
231          * Checks if this feature is supported.
232          */
233         public boolean supports_gossip_queries() {
234                 boolean ret = bindings.NodeFeatures_supports_gossip_queries(this.ptr);
235                 Reference.reachabilityFence(this);
236                 return ret;
237         }
238
239         /**
240          * Checks if this feature is required.
241          */
242         public boolean requires_gossip_queries() {
243                 boolean ret = bindings.NodeFeatures_requires_gossip_queries(this.ptr);
244                 Reference.reachabilityFence(this);
245                 return ret;
246         }
247
248         /**
249          * Set this feature as optional.
250          */
251         public void set_variable_length_onion_optional() {
252                 bindings.NodeFeatures_set_variable_length_onion_optional(this.ptr);
253                 Reference.reachabilityFence(this);
254         }
255
256         /**
257          * Set this feature as required.
258          */
259         public void set_variable_length_onion_required() {
260                 bindings.NodeFeatures_set_variable_length_onion_required(this.ptr);
261                 Reference.reachabilityFence(this);
262         }
263
264         /**
265          * Checks if this feature is supported.
266          */
267         public boolean supports_variable_length_onion() {
268                 boolean ret = bindings.NodeFeatures_supports_variable_length_onion(this.ptr);
269                 Reference.reachabilityFence(this);
270                 return ret;
271         }
272
273         /**
274          * Checks if this feature is required.
275          */
276         public boolean requires_variable_length_onion() {
277                 boolean ret = bindings.NodeFeatures_requires_variable_length_onion(this.ptr);
278                 Reference.reachabilityFence(this);
279                 return ret;
280         }
281
282         /**
283          * Set this feature as optional.
284          */
285         public void set_static_remote_key_optional() {
286                 bindings.NodeFeatures_set_static_remote_key_optional(this.ptr);
287                 Reference.reachabilityFence(this);
288         }
289
290         /**
291          * Set this feature as required.
292          */
293         public void set_static_remote_key_required() {
294                 bindings.NodeFeatures_set_static_remote_key_required(this.ptr);
295                 Reference.reachabilityFence(this);
296         }
297
298         /**
299          * Checks if this feature is supported.
300          */
301         public boolean supports_static_remote_key() {
302                 boolean ret = bindings.NodeFeatures_supports_static_remote_key(this.ptr);
303                 Reference.reachabilityFence(this);
304                 return ret;
305         }
306
307         /**
308          * Checks if this feature is required.
309          */
310         public boolean requires_static_remote_key() {
311                 boolean ret = bindings.NodeFeatures_requires_static_remote_key(this.ptr);
312                 Reference.reachabilityFence(this);
313                 return ret;
314         }
315
316         /**
317          * Set this feature as optional.
318          */
319         public void set_payment_secret_optional() {
320                 bindings.NodeFeatures_set_payment_secret_optional(this.ptr);
321                 Reference.reachabilityFence(this);
322         }
323
324         /**
325          * Set this feature as required.
326          */
327         public void set_payment_secret_required() {
328                 bindings.NodeFeatures_set_payment_secret_required(this.ptr);
329                 Reference.reachabilityFence(this);
330         }
331
332         /**
333          * Checks if this feature is supported.
334          */
335         public boolean supports_payment_secret() {
336                 boolean ret = bindings.NodeFeatures_supports_payment_secret(this.ptr);
337                 Reference.reachabilityFence(this);
338                 return ret;
339         }
340
341         /**
342          * Checks if this feature is required.
343          */
344         public boolean requires_payment_secret() {
345                 boolean ret = bindings.NodeFeatures_requires_payment_secret(this.ptr);
346                 Reference.reachabilityFence(this);
347                 return ret;
348         }
349
350         /**
351          * Set this feature as optional.
352          */
353         public void set_basic_mpp_optional() {
354                 bindings.NodeFeatures_set_basic_mpp_optional(this.ptr);
355                 Reference.reachabilityFence(this);
356         }
357
358         /**
359          * Set this feature as required.
360          */
361         public void set_basic_mpp_required() {
362                 bindings.NodeFeatures_set_basic_mpp_required(this.ptr);
363                 Reference.reachabilityFence(this);
364         }
365
366         /**
367          * Checks if this feature is supported.
368          */
369         public boolean supports_basic_mpp() {
370                 boolean ret = bindings.NodeFeatures_supports_basic_mpp(this.ptr);
371                 Reference.reachabilityFence(this);
372                 return ret;
373         }
374
375         /**
376          * Checks if this feature is required.
377          */
378         public boolean requires_basic_mpp() {
379                 boolean ret = bindings.NodeFeatures_requires_basic_mpp(this.ptr);
380                 Reference.reachabilityFence(this);
381                 return ret;
382         }
383
384         /**
385          * Set this feature as optional.
386          */
387         public void set_wumbo_optional() {
388                 bindings.NodeFeatures_set_wumbo_optional(this.ptr);
389                 Reference.reachabilityFence(this);
390         }
391
392         /**
393          * Set this feature as required.
394          */
395         public void set_wumbo_required() {
396                 bindings.NodeFeatures_set_wumbo_required(this.ptr);
397                 Reference.reachabilityFence(this);
398         }
399
400         /**
401          * Checks if this feature is supported.
402          */
403         public boolean supports_wumbo() {
404                 boolean ret = bindings.NodeFeatures_supports_wumbo(this.ptr);
405                 Reference.reachabilityFence(this);
406                 return ret;
407         }
408
409         /**
410          * Checks if this feature is required.
411          */
412         public boolean requires_wumbo() {
413                 boolean ret = bindings.NodeFeatures_requires_wumbo(this.ptr);
414                 Reference.reachabilityFence(this);
415                 return ret;
416         }
417
418         /**
419          * Set this feature as optional.
420          */
421         public void set_anchors_nonzero_fee_htlc_tx_optional() {
422                 bindings.NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(this.ptr);
423                 Reference.reachabilityFence(this);
424         }
425
426         /**
427          * Set this feature as required.
428          */
429         public void set_anchors_nonzero_fee_htlc_tx_required() {
430                 bindings.NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(this.ptr);
431                 Reference.reachabilityFence(this);
432         }
433
434         /**
435          * Checks if this feature is supported.
436          */
437         public boolean supports_anchors_nonzero_fee_htlc_tx() {
438                 boolean ret = bindings.NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(this.ptr);
439                 Reference.reachabilityFence(this);
440                 return ret;
441         }
442
443         /**
444          * Checks if this feature is required.
445          */
446         public boolean requires_anchors_nonzero_fee_htlc_tx() {
447                 boolean ret = bindings.NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(this.ptr);
448                 Reference.reachabilityFence(this);
449                 return ret;
450         }
451
452         /**
453          * Set this feature as optional.
454          */
455         public void set_anchors_zero_fee_htlc_tx_optional() {
456                 bindings.NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(this.ptr);
457                 Reference.reachabilityFence(this);
458         }
459
460         /**
461          * Set this feature as required.
462          */
463         public void set_anchors_zero_fee_htlc_tx_required() {
464                 bindings.NodeFeatures_set_anchors_zero_fee_htlc_tx_required(this.ptr);
465                 Reference.reachabilityFence(this);
466         }
467
468         /**
469          * Checks if this feature is supported.
470          */
471         public boolean supports_anchors_zero_fee_htlc_tx() {
472                 boolean ret = bindings.NodeFeatures_supports_anchors_zero_fee_htlc_tx(this.ptr);
473                 Reference.reachabilityFence(this);
474                 return ret;
475         }
476
477         /**
478          * Checks if this feature is required.
479          */
480         public boolean requires_anchors_zero_fee_htlc_tx() {
481                 boolean ret = bindings.NodeFeatures_requires_anchors_zero_fee_htlc_tx(this.ptr);
482                 Reference.reachabilityFence(this);
483                 return ret;
484         }
485
486         /**
487          * Set this feature as optional.
488          */
489         public void set_shutdown_any_segwit_optional() {
490                 bindings.NodeFeatures_set_shutdown_any_segwit_optional(this.ptr);
491                 Reference.reachabilityFence(this);
492         }
493
494         /**
495          * Set this feature as required.
496          */
497         public void set_shutdown_any_segwit_required() {
498                 bindings.NodeFeatures_set_shutdown_any_segwit_required(this.ptr);
499                 Reference.reachabilityFence(this);
500         }
501
502         /**
503          * Checks if this feature is supported.
504          */
505         public boolean supports_shutdown_anysegwit() {
506                 boolean ret = bindings.NodeFeatures_supports_shutdown_anysegwit(this.ptr);
507                 Reference.reachabilityFence(this);
508                 return ret;
509         }
510
511         /**
512          * Checks if this feature is required.
513          */
514         public boolean requires_shutdown_anysegwit() {
515                 boolean ret = bindings.NodeFeatures_requires_shutdown_anysegwit(this.ptr);
516                 Reference.reachabilityFence(this);
517                 return ret;
518         }
519
520         /**
521          * Set this feature as optional.
522          */
523         public void set_onion_messages_optional() {
524                 bindings.NodeFeatures_set_onion_messages_optional(this.ptr);
525                 Reference.reachabilityFence(this);
526         }
527
528         /**
529          * Set this feature as required.
530          */
531         public void set_onion_messages_required() {
532                 bindings.NodeFeatures_set_onion_messages_required(this.ptr);
533                 Reference.reachabilityFence(this);
534         }
535
536         /**
537          * Checks if this feature is supported.
538          */
539         public boolean supports_onion_messages() {
540                 boolean ret = bindings.NodeFeatures_supports_onion_messages(this.ptr);
541                 Reference.reachabilityFence(this);
542                 return ret;
543         }
544
545         /**
546          * Checks if this feature is required.
547          */
548         public boolean requires_onion_messages() {
549                 boolean ret = bindings.NodeFeatures_requires_onion_messages(this.ptr);
550                 Reference.reachabilityFence(this);
551                 return ret;
552         }
553
554         /**
555          * Set this feature as optional.
556          */
557         public void set_channel_type_optional() {
558                 bindings.NodeFeatures_set_channel_type_optional(this.ptr);
559                 Reference.reachabilityFence(this);
560         }
561
562         /**
563          * Set this feature as required.
564          */
565         public void set_channel_type_required() {
566                 bindings.NodeFeatures_set_channel_type_required(this.ptr);
567                 Reference.reachabilityFence(this);
568         }
569
570         /**
571          * Checks if this feature is supported.
572          */
573         public boolean supports_channel_type() {
574                 boolean ret = bindings.NodeFeatures_supports_channel_type(this.ptr);
575                 Reference.reachabilityFence(this);
576                 return ret;
577         }
578
579         /**
580          * Checks if this feature is required.
581          */
582         public boolean requires_channel_type() {
583                 boolean ret = bindings.NodeFeatures_requires_channel_type(this.ptr);
584                 Reference.reachabilityFence(this);
585                 return ret;
586         }
587
588         /**
589          * Set this feature as optional.
590          */
591         public void set_scid_privacy_optional() {
592                 bindings.NodeFeatures_set_scid_privacy_optional(this.ptr);
593                 Reference.reachabilityFence(this);
594         }
595
596         /**
597          * Set this feature as required.
598          */
599         public void set_scid_privacy_required() {
600                 bindings.NodeFeatures_set_scid_privacy_required(this.ptr);
601                 Reference.reachabilityFence(this);
602         }
603
604         /**
605          * Checks if this feature is supported.
606          */
607         public boolean supports_scid_privacy() {
608                 boolean ret = bindings.NodeFeatures_supports_scid_privacy(this.ptr);
609                 Reference.reachabilityFence(this);
610                 return ret;
611         }
612
613         /**
614          * Checks if this feature is required.
615          */
616         public boolean requires_scid_privacy() {
617                 boolean ret = bindings.NodeFeatures_requires_scid_privacy(this.ptr);
618                 Reference.reachabilityFence(this);
619                 return ret;
620         }
621
622         /**
623          * Set this feature as optional.
624          */
625         public void set_zero_conf_optional() {
626                 bindings.NodeFeatures_set_zero_conf_optional(this.ptr);
627                 Reference.reachabilityFence(this);
628         }
629
630         /**
631          * Set this feature as required.
632          */
633         public void set_zero_conf_required() {
634                 bindings.NodeFeatures_set_zero_conf_required(this.ptr);
635                 Reference.reachabilityFence(this);
636         }
637
638         /**
639          * Checks if this feature is supported.
640          */
641         public boolean supports_zero_conf() {
642                 boolean ret = bindings.NodeFeatures_supports_zero_conf(this.ptr);
643                 Reference.reachabilityFence(this);
644                 return ret;
645         }
646
647         /**
648          * Checks if this feature is required.
649          */
650         public boolean requires_zero_conf() {
651                 boolean ret = bindings.NodeFeatures_requires_zero_conf(this.ptr);
652                 Reference.reachabilityFence(this);
653                 return ret;
654         }
655
656         /**
657          * Set this feature as optional.
658          */
659         public void set_keysend_optional() {
660                 bindings.NodeFeatures_set_keysend_optional(this.ptr);
661                 Reference.reachabilityFence(this);
662         }
663
664         /**
665          * Set this feature as required.
666          */
667         public void set_keysend_required() {
668                 bindings.NodeFeatures_set_keysend_required(this.ptr);
669                 Reference.reachabilityFence(this);
670         }
671
672         /**
673          * Checks if this feature is supported.
674          */
675         public boolean supports_keysend() {
676                 boolean ret = bindings.NodeFeatures_supports_keysend(this.ptr);
677                 Reference.reachabilityFence(this);
678                 return ret;
679         }
680
681         /**
682          * Checks if this feature is required.
683          */
684         public boolean requires_keysend() {
685                 boolean ret = bindings.NodeFeatures_requires_keysend(this.ptr);
686                 Reference.reachabilityFence(this);
687                 return ret;
688         }
689
690 }