[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          * Generates a non-cryptographic 64-bit hash of the ChannelTypeFeatures.
64          */
65         public long hash() {
66                 long ret = bindings.ChannelTypeFeatures_hash(this.ptr);
67                 GC.KeepAlive(this);
68                 return ret;
69         }
70
71         public override int GetHashCode() {
72                 return (int)this.hash();
73         }
74         /**
75          * Create a blank Features with no features set
76          */
77         public static ChannelTypeFeatures empty() {
78                 long ret = bindings.ChannelTypeFeatures_empty();
79                 if (ret >= 0 && ret <= 4096) { return null; }
80                 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
81                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
82                 return ret_hu_conv;
83         }
84
85         /**
86          * Returns true if this `Features` object contains required features unknown by `other`.
87          */
88         public bool requires_unknown_bits_from(org.ldk.structs.ChannelTypeFeatures other) {
89                 bool ret = bindings.ChannelTypeFeatures_requires_unknown_bits_from(this.ptr, other == null ? 0 : other.ptr);
90                 GC.KeepAlive(this);
91                 GC.KeepAlive(other);
92                 if (this != null) { this.ptrs_to.AddLast(other); };
93                 return ret;
94         }
95
96         /**
97          * Returns true if this `Features` object contains unknown feature flags which are set as
98          * \"required\".
99          */
100         public bool requires_unknown_bits() {
101                 bool ret = bindings.ChannelTypeFeatures_requires_unknown_bits(this.ptr);
102                 GC.KeepAlive(this);
103                 return ret;
104         }
105
106         /**
107          * Sets a required feature bit. Errors if `bit` is outside the feature range as defined
108          * by [BOLT 9].
109          * 
110          * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
111          * be set instead (i.e., `bit - 1`).
112          * 
113          * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
114          */
115         public Result_NoneNoneZ set_required_feature_bit(long bit) {
116                 long ret = bindings.ChannelTypeFeatures_set_required_feature_bit(this.ptr, bit);
117                 GC.KeepAlive(this);
118                 GC.KeepAlive(bit);
119                 if (ret >= 0 && ret <= 4096) { return null; }
120                 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
121                 return ret_hu_conv;
122         }
123
124         /**
125          * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined
126          * by [BOLT 9].
127          * 
128          * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
129          * set instead (i.e., `bit + 1`).
130          * 
131          * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md
132          */
133         public Result_NoneNoneZ set_optional_feature_bit(long bit) {
134                 long ret = bindings.ChannelTypeFeatures_set_optional_feature_bit(this.ptr, bit);
135                 GC.KeepAlive(this);
136                 GC.KeepAlive(bit);
137                 if (ret >= 0 && ret <= 4096) { return null; }
138                 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
139                 return ret_hu_conv;
140         }
141
142         /**
143          * Sets a required custom feature bit. Errors if `bit` is outside the custom range as defined
144          * by [bLIP 2] or if it is a known `T` feature.
145          * 
146          * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will
147          * be set instead (i.e., `bit - 1`).
148          * 
149          * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
150          */
151         public Result_NoneNoneZ set_required_custom_bit(long bit) {
152                 long ret = bindings.ChannelTypeFeatures_set_required_custom_bit(this.ptr, bit);
153                 GC.KeepAlive(this);
154                 GC.KeepAlive(bit);
155                 if (ret >= 0 && ret <= 4096) { return null; }
156                 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
157                 return ret_hu_conv;
158         }
159
160         /**
161          * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined
162          * by [bLIP 2] or if it is a known `T` feature.
163          * 
164          * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be
165          * set instead (i.e., `bit + 1`).
166          * 
167          * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits
168          */
169         public Result_NoneNoneZ set_optional_custom_bit(long bit) {
170                 long ret = bindings.ChannelTypeFeatures_set_optional_custom_bit(this.ptr, bit);
171                 GC.KeepAlive(this);
172                 GC.KeepAlive(bit);
173                 if (ret >= 0 && ret <= 4096) { return null; }
174                 Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
175                 return ret_hu_conv;
176         }
177
178         /**
179          * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read
180          */
181         public byte[] write() {
182                 long ret = bindings.ChannelTypeFeatures_write(this.ptr);
183                 GC.KeepAlive(this);
184                 if (ret >= 0 && ret <= 4096) { return null; }
185                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
186                 return ret_conv;
187         }
188
189         /**
190          * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write
191          */
192         public static Result_ChannelTypeFeaturesDecodeErrorZ read(byte[] ser) {
193                 long ret = bindings.ChannelTypeFeatures_read(InternalUtils.encodeUint8Array(ser));
194                 GC.KeepAlive(ser);
195                 if (ret >= 0 && ret <= 4096) { return null; }
196                 Result_ChannelTypeFeaturesDecodeErrorZ ret_hu_conv = Result_ChannelTypeFeaturesDecodeErrorZ.constr_from_ptr(ret);
197                 return ret_hu_conv;
198         }
199
200         /**
201          * Set this feature as optional.
202          */
203         public void set_static_remote_key_optional() {
204                 bindings.ChannelTypeFeatures_set_static_remote_key_optional(this.ptr);
205                 GC.KeepAlive(this);
206         }
207
208         /**
209          * Set this feature as required.
210          */
211         public void set_static_remote_key_required() {
212                 bindings.ChannelTypeFeatures_set_static_remote_key_required(this.ptr);
213                 GC.KeepAlive(this);
214         }
215
216         /**
217          * Checks if this feature is supported.
218          */
219         public bool supports_static_remote_key() {
220                 bool ret = bindings.ChannelTypeFeatures_supports_static_remote_key(this.ptr);
221                 GC.KeepAlive(this);
222                 return ret;
223         }
224
225         /**
226          * Checks if this feature is required.
227          */
228         public bool requires_static_remote_key() {
229                 bool ret = bindings.ChannelTypeFeatures_requires_static_remote_key(this.ptr);
230                 GC.KeepAlive(this);
231                 return ret;
232         }
233
234         /**
235          * Set this feature as optional.
236          */
237         public void set_anchors_nonzero_fee_htlc_tx_optional() {
238                 bindings.ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(this.ptr);
239                 GC.KeepAlive(this);
240         }
241
242         /**
243          * Set this feature as required.
244          */
245         public void set_anchors_nonzero_fee_htlc_tx_required() {
246                 bindings.ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(this.ptr);
247                 GC.KeepAlive(this);
248         }
249
250         /**
251          * Checks if this feature is supported.
252          */
253         public bool supports_anchors_nonzero_fee_htlc_tx() {
254                 bool ret = bindings.ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(this.ptr);
255                 GC.KeepAlive(this);
256                 return ret;
257         }
258
259         /**
260          * Checks if this feature is required.
261          */
262         public bool requires_anchors_nonzero_fee_htlc_tx() {
263                 bool ret = bindings.ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(this.ptr);
264                 GC.KeepAlive(this);
265                 return ret;
266         }
267
268         /**
269          * Set this feature as optional.
270          */
271         public void set_anchors_zero_fee_htlc_tx_optional() {
272                 bindings.ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(this.ptr);
273                 GC.KeepAlive(this);
274         }
275
276         /**
277          * Set this feature as required.
278          */
279         public void set_anchors_zero_fee_htlc_tx_required() {
280                 bindings.ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(this.ptr);
281                 GC.KeepAlive(this);
282         }
283
284         /**
285          * Checks if this feature is supported.
286          */
287         public bool supports_anchors_zero_fee_htlc_tx() {
288                 bool ret = bindings.ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(this.ptr);
289                 GC.KeepAlive(this);
290                 return ret;
291         }
292
293         /**
294          * Checks if this feature is required.
295          */
296         public bool requires_anchors_zero_fee_htlc_tx() {
297                 bool ret = bindings.ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(this.ptr);
298                 GC.KeepAlive(this);
299                 return ret;
300         }
301
302         /**
303          * Set this feature as optional.
304          */
305         public void set_taproot_optional() {
306                 bindings.ChannelTypeFeatures_set_taproot_optional(this.ptr);
307                 GC.KeepAlive(this);
308         }
309
310         /**
311          * Set this feature as required.
312          */
313         public void set_taproot_required() {
314                 bindings.ChannelTypeFeatures_set_taproot_required(this.ptr);
315                 GC.KeepAlive(this);
316         }
317
318         /**
319          * Checks if this feature is supported.
320          */
321         public bool supports_taproot() {
322                 bool ret = bindings.ChannelTypeFeatures_supports_taproot(this.ptr);
323                 GC.KeepAlive(this);
324                 return ret;
325         }
326
327         /**
328          * Checks if this feature is required.
329          */
330         public bool requires_taproot() {
331                 bool ret = bindings.ChannelTypeFeatures_requires_taproot(this.ptr);
332                 GC.KeepAlive(this);
333                 return ret;
334         }
335
336         /**
337          * Set this feature as optional.
338          */
339         public void set_scid_privacy_optional() {
340                 bindings.ChannelTypeFeatures_set_scid_privacy_optional(this.ptr);
341                 GC.KeepAlive(this);
342         }
343
344         /**
345          * Set this feature as required.
346          */
347         public void set_scid_privacy_required() {
348                 bindings.ChannelTypeFeatures_set_scid_privacy_required(this.ptr);
349                 GC.KeepAlive(this);
350         }
351
352         /**
353          * Checks if this feature is supported.
354          */
355         public bool supports_scid_privacy() {
356                 bool ret = bindings.ChannelTypeFeatures_supports_scid_privacy(this.ptr);
357                 GC.KeepAlive(this);
358                 return ret;
359         }
360
361         /**
362          * Checks if this feature is required.
363          */
364         public bool requires_scid_privacy() {
365                 bool ret = bindings.ChannelTypeFeatures_requires_scid_privacy(this.ptr);
366                 GC.KeepAlive(this);
367                 return ret;
368         }
369
370         /**
371          * Set this feature as optional.
372          */
373         public void set_zero_conf_optional() {
374                 bindings.ChannelTypeFeatures_set_zero_conf_optional(this.ptr);
375                 GC.KeepAlive(this);
376         }
377
378         /**
379          * Set this feature as required.
380          */
381         public void set_zero_conf_required() {
382                 bindings.ChannelTypeFeatures_set_zero_conf_required(this.ptr);
383                 GC.KeepAlive(this);
384         }
385
386         /**
387          * Checks if this feature is supported.
388          */
389         public bool supports_zero_conf() {
390                 bool ret = bindings.ChannelTypeFeatures_supports_zero_conf(this.ptr);
391                 GC.KeepAlive(this);
392                 return ret;
393         }
394
395         /**
396          * Checks if this feature is required.
397          */
398         public bool requires_zero_conf() {
399                 bool ret = bindings.ChannelTypeFeatures_requires_zero_conf(this.ptr);
400                 GC.KeepAlive(this);
401                 return ret;
402         }
403
404 }
405 } } }