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