7f6c696022562c2b65ad3dc80f8f5b657e9550ba
[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(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          * Creates a Features with the bits set which are known by the implementation
71          */
72         public static NodeFeatures known() {
73                 long ret = bindings.NodeFeatures_known();
74                 if (ret >= 0 && ret <= 4096) { return null; }
75                 org.ldk.structs.NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeFeatures(null, ret); }
76                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
77                 return ret_hu_conv;
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          * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read
92          */
93         public byte[] write() {
94                 byte[] ret = bindings.NodeFeatures_write(this.ptr);
95                 Reference.reachabilityFence(this);
96                 return ret;
97         }
98
99         /**
100          * Read a NodeFeatures from a byte array, created by NodeFeatures_write
101          */
102         public static Result_NodeFeaturesDecodeErrorZ read(byte[] ser) {
103                 long ret = bindings.NodeFeatures_read(ser);
104                 Reference.reachabilityFence(ser);
105                 if (ret >= 0 && ret <= 4096) { return null; }
106                 Result_NodeFeaturesDecodeErrorZ ret_hu_conv = Result_NodeFeaturesDecodeErrorZ.constr_from_ptr(ret);
107                 return ret_hu_conv;
108         }
109
110         /**
111          * Set this feature as optional.
112          */
113         public void set_data_loss_protect_optional() {
114                 bindings.NodeFeatures_set_data_loss_protect_optional(this.ptr);
115                 Reference.reachabilityFence(this);
116         }
117
118         /**
119          * Set this feature as required.
120          */
121         public void set_data_loss_protect_required() {
122                 bindings.NodeFeatures_set_data_loss_protect_required(this.ptr);
123                 Reference.reachabilityFence(this);
124         }
125
126         /**
127          * Checks if this feature is supported.
128          */
129         public boolean supports_data_loss_protect() {
130                 boolean ret = bindings.NodeFeatures_supports_data_loss_protect(this.ptr);
131                 Reference.reachabilityFence(this);
132                 return ret;
133         }
134
135         /**
136          * Checks if this feature is required.
137          */
138         public boolean requires_data_loss_protect() {
139                 boolean ret = bindings.NodeFeatures_requires_data_loss_protect(this.ptr);
140                 Reference.reachabilityFence(this);
141                 return ret;
142         }
143
144         /**
145          * Set this feature as optional.
146          */
147         public void set_upfront_shutdown_script_optional() {
148                 bindings.NodeFeatures_set_upfront_shutdown_script_optional(this.ptr);
149                 Reference.reachabilityFence(this);
150         }
151
152         /**
153          * Set this feature as required.
154          */
155         public void set_upfront_shutdown_script_required() {
156                 bindings.NodeFeatures_set_upfront_shutdown_script_required(this.ptr);
157                 Reference.reachabilityFence(this);
158         }
159
160         /**
161          * Checks if this feature is supported.
162          */
163         public boolean supports_upfront_shutdown_script() {
164                 boolean ret = bindings.NodeFeatures_supports_upfront_shutdown_script(this.ptr);
165                 Reference.reachabilityFence(this);
166                 return ret;
167         }
168
169         /**
170          * Checks if this feature is required.
171          */
172         public boolean requires_upfront_shutdown_script() {
173                 boolean ret = bindings.NodeFeatures_requires_upfront_shutdown_script(this.ptr);
174                 Reference.reachabilityFence(this);
175                 return ret;
176         }
177
178         /**
179          * Set this feature as optional.
180          */
181         public void set_gossip_queries_optional() {
182                 bindings.NodeFeatures_set_gossip_queries_optional(this.ptr);
183                 Reference.reachabilityFence(this);
184         }
185
186         /**
187          * Set this feature as required.
188          */
189         public void set_gossip_queries_required() {
190                 bindings.NodeFeatures_set_gossip_queries_required(this.ptr);
191                 Reference.reachabilityFence(this);
192         }
193
194         /**
195          * Checks if this feature is supported.
196          */
197         public boolean supports_gossip_queries() {
198                 boolean ret = bindings.NodeFeatures_supports_gossip_queries(this.ptr);
199                 Reference.reachabilityFence(this);
200                 return ret;
201         }
202
203         /**
204          * Checks if this feature is required.
205          */
206         public boolean requires_gossip_queries() {
207                 boolean ret = bindings.NodeFeatures_requires_gossip_queries(this.ptr);
208                 Reference.reachabilityFence(this);
209                 return ret;
210         }
211
212         /**
213          * Set this feature as optional.
214          */
215         public void set_variable_length_onion_optional() {
216                 bindings.NodeFeatures_set_variable_length_onion_optional(this.ptr);
217                 Reference.reachabilityFence(this);
218         }
219
220         /**
221          * Set this feature as required.
222          */
223         public void set_variable_length_onion_required() {
224                 bindings.NodeFeatures_set_variable_length_onion_required(this.ptr);
225                 Reference.reachabilityFence(this);
226         }
227
228         /**
229          * Checks if this feature is supported.
230          */
231         public boolean supports_variable_length_onion() {
232                 boolean ret = bindings.NodeFeatures_supports_variable_length_onion(this.ptr);
233                 Reference.reachabilityFence(this);
234                 return ret;
235         }
236
237         /**
238          * Checks if this feature is required.
239          */
240         public boolean requires_variable_length_onion() {
241                 boolean ret = bindings.NodeFeatures_requires_variable_length_onion(this.ptr);
242                 Reference.reachabilityFence(this);
243                 return ret;
244         }
245
246         /**
247          * Set this feature as optional.
248          */
249         public void set_static_remote_key_optional() {
250                 bindings.NodeFeatures_set_static_remote_key_optional(this.ptr);
251                 Reference.reachabilityFence(this);
252         }
253
254         /**
255          * Set this feature as required.
256          */
257         public void set_static_remote_key_required() {
258                 bindings.NodeFeatures_set_static_remote_key_required(this.ptr);
259                 Reference.reachabilityFence(this);
260         }
261
262         /**
263          * Checks if this feature is supported.
264          */
265         public boolean supports_static_remote_key() {
266                 boolean ret = bindings.NodeFeatures_supports_static_remote_key(this.ptr);
267                 Reference.reachabilityFence(this);
268                 return ret;
269         }
270
271         /**
272          * Checks if this feature is required.
273          */
274         public boolean requires_static_remote_key() {
275                 boolean ret = bindings.NodeFeatures_requires_static_remote_key(this.ptr);
276                 Reference.reachabilityFence(this);
277                 return ret;
278         }
279
280         /**
281          * Set this feature as optional.
282          */
283         public void set_payment_secret_optional() {
284                 bindings.NodeFeatures_set_payment_secret_optional(this.ptr);
285                 Reference.reachabilityFence(this);
286         }
287
288         /**
289          * Set this feature as required.
290          */
291         public void set_payment_secret_required() {
292                 bindings.NodeFeatures_set_payment_secret_required(this.ptr);
293                 Reference.reachabilityFence(this);
294         }
295
296         /**
297          * Checks if this feature is supported.
298          */
299         public boolean supports_payment_secret() {
300                 boolean ret = bindings.NodeFeatures_supports_payment_secret(this.ptr);
301                 Reference.reachabilityFence(this);
302                 return ret;
303         }
304
305         /**
306          * Checks if this feature is required.
307          */
308         public boolean requires_payment_secret() {
309                 boolean ret = bindings.NodeFeatures_requires_payment_secret(this.ptr);
310                 Reference.reachabilityFence(this);
311                 return ret;
312         }
313
314         /**
315          * Set this feature as optional.
316          */
317         public void set_basic_mpp_optional() {
318                 bindings.NodeFeatures_set_basic_mpp_optional(this.ptr);
319                 Reference.reachabilityFence(this);
320         }
321
322         /**
323          * Set this feature as required.
324          */
325         public void set_basic_mpp_required() {
326                 bindings.NodeFeatures_set_basic_mpp_required(this.ptr);
327                 Reference.reachabilityFence(this);
328         }
329
330         /**
331          * Checks if this feature is supported.
332          */
333         public boolean supports_basic_mpp() {
334                 boolean ret = bindings.NodeFeatures_supports_basic_mpp(this.ptr);
335                 Reference.reachabilityFence(this);
336                 return ret;
337         }
338
339         /**
340          * Checks if this feature is required.
341          */
342         public boolean requires_basic_mpp() {
343                 boolean ret = bindings.NodeFeatures_requires_basic_mpp(this.ptr);
344                 Reference.reachabilityFence(this);
345                 return ret;
346         }
347
348         /**
349          * Set this feature as optional.
350          */
351         public void set_wumbo_optional() {
352                 bindings.NodeFeatures_set_wumbo_optional(this.ptr);
353                 Reference.reachabilityFence(this);
354         }
355
356         /**
357          * Set this feature as required.
358          */
359         public void set_wumbo_required() {
360                 bindings.NodeFeatures_set_wumbo_required(this.ptr);
361                 Reference.reachabilityFence(this);
362         }
363
364         /**
365          * Checks if this feature is supported.
366          */
367         public boolean supports_wumbo() {
368                 boolean ret = bindings.NodeFeatures_supports_wumbo(this.ptr);
369                 Reference.reachabilityFence(this);
370                 return ret;
371         }
372
373         /**
374          * Checks if this feature is required.
375          */
376         public boolean requires_wumbo() {
377                 boolean ret = bindings.NodeFeatures_requires_wumbo(this.ptr);
378                 Reference.reachabilityFence(this);
379                 return ret;
380         }
381
382         /**
383          * Set this feature as optional.
384          */
385         public void set_shutdown_any_segwit_optional() {
386                 bindings.NodeFeatures_set_shutdown_any_segwit_optional(this.ptr);
387                 Reference.reachabilityFence(this);
388         }
389
390         /**
391          * Set this feature as required.
392          */
393         public void set_shutdown_any_segwit_required() {
394                 bindings.NodeFeatures_set_shutdown_any_segwit_required(this.ptr);
395                 Reference.reachabilityFence(this);
396         }
397
398         /**
399          * Checks if this feature is supported.
400          */
401         public boolean supports_shutdown_anysegwit() {
402                 boolean ret = bindings.NodeFeatures_supports_shutdown_anysegwit(this.ptr);
403                 Reference.reachabilityFence(this);
404                 return ret;
405         }
406
407         /**
408          * Checks if this feature is required.
409          */
410         public boolean requires_shutdown_anysegwit() {
411                 boolean ret = bindings.NodeFeatures_requires_shutdown_anysegwit(this.ptr);
412                 Reference.reachabilityFence(this);
413                 return ret;
414         }
415
416         /**
417          * Set this feature as optional.
418          */
419         public void set_channel_type_optional() {
420                 bindings.NodeFeatures_set_channel_type_optional(this.ptr);
421                 Reference.reachabilityFence(this);
422         }
423
424         /**
425          * Set this feature as required.
426          */
427         public void set_channel_type_required() {
428                 bindings.NodeFeatures_set_channel_type_required(this.ptr);
429                 Reference.reachabilityFence(this);
430         }
431
432         /**
433          * Checks if this feature is supported.
434          */
435         public boolean supports_channel_type() {
436                 boolean ret = bindings.NodeFeatures_supports_channel_type(this.ptr);
437                 Reference.reachabilityFence(this);
438                 return ret;
439         }
440
441         /**
442          * Checks if this feature is required.
443          */
444         public boolean requires_channel_type() {
445                 boolean ret = bindings.NodeFeatures_requires_channel_type(this.ptr);
446                 Reference.reachabilityFence(this);
447                 return ret;
448         }
449
450         /**
451          * Set this feature as optional.
452          */
453         public void set_scid_privacy_optional() {
454                 bindings.NodeFeatures_set_scid_privacy_optional(this.ptr);
455                 Reference.reachabilityFence(this);
456         }
457
458         /**
459          * Set this feature as required.
460          */
461         public void set_scid_privacy_required() {
462                 bindings.NodeFeatures_set_scid_privacy_required(this.ptr);
463                 Reference.reachabilityFence(this);
464         }
465
466         /**
467          * Checks if this feature is supported.
468          */
469         public boolean supports_scid_privacy() {
470                 boolean ret = bindings.NodeFeatures_supports_scid_privacy(this.ptr);
471                 Reference.reachabilityFence(this);
472                 return ret;
473         }
474
475         /**
476          * Checks if this feature is required.
477          */
478         public boolean requires_scid_privacy() {
479                 boolean ret = bindings.NodeFeatures_requires_scid_privacy(this.ptr);
480                 Reference.reachabilityFence(this);
481                 return ret;
482         }
483
484         /**
485          * Set this feature as optional.
486          */
487         public void set_zero_conf_optional() {
488                 bindings.NodeFeatures_set_zero_conf_optional(this.ptr);
489                 Reference.reachabilityFence(this);
490         }
491
492         /**
493          * Set this feature as required.
494          */
495         public void set_zero_conf_required() {
496                 bindings.NodeFeatures_set_zero_conf_required(this.ptr);
497                 Reference.reachabilityFence(this);
498         }
499
500         /**
501          * Checks if this feature is supported.
502          */
503         public boolean supports_zero_conf() {
504                 boolean ret = bindings.NodeFeatures_supports_zero_conf(this.ptr);
505                 Reference.reachabilityFence(this);
506                 return ret;
507         }
508
509         /**
510          * Checks if this feature is required.
511          */
512         public boolean requires_zero_conf() {
513                 boolean ret = bindings.NodeFeatures_requires_zero_conf(this.ptr);
514                 Reference.reachabilityFence(this);
515                 return ret;
516         }
517
518         /**
519          * Set this feature as optional.
520          */
521         public void set_keysend_optional() {
522                 bindings.NodeFeatures_set_keysend_optional(this.ptr);
523                 Reference.reachabilityFence(this);
524         }
525
526         /**
527          * Set this feature as required.
528          */
529         public void set_keysend_required() {
530                 bindings.NodeFeatures_set_keysend_required(this.ptr);
531                 Reference.reachabilityFence(this);
532         }
533
534         /**
535          * Checks if this feature is supported.
536          */
537         public boolean supports_keysend() {
538                 boolean ret = bindings.NodeFeatures_supports_keysend(this.ptr);
539                 Reference.reachabilityFence(this);
540                 return ret;
541         }
542
543         /**
544          * Checks if this feature is required.
545          */
546         public boolean requires_keysend() {
547                 boolean ret = bindings.NodeFeatures_requires_keysend(this.ptr);
548                 Reference.reachabilityFence(this);
549                 return ret;
550         }
551
552 }