[TS] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[ldk-java] / c_sharp / src / org / ldk / structs / CommonOpenChannelFields.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  * Contains fields that are both common to [`open_channel`] and `open_channel2` messages.
11  * 
12  * [`open_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel-message
13  */
14 public class CommonOpenChannelFields : CommonBase {
15         internal CommonOpenChannelFields(object _dummy, long ptr) : base(ptr) { }
16         ~CommonOpenChannelFields() {
17                 if (ptr != 0) { bindings.CommonOpenChannelFields_free(ptr); }
18         }
19
20         /**
21          * The genesis hash of the blockchain where the channel is to be opened
22          */
23         public byte[] get_chain_hash() {
24                 long ret = bindings.CommonOpenChannelFields_get_chain_hash(this.ptr);
25                 GC.KeepAlive(this);
26                 if (ret >= 0 && ret <= 4096) { return null; }
27                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
28                 return ret_conv;
29         }
30
31         /**
32          * The genesis hash of the blockchain where the channel is to be opened
33          */
34         public void set_chain_hash(byte[] val) {
35                 bindings.CommonOpenChannelFields_set_chain_hash(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
36                 GC.KeepAlive(this);
37                 GC.KeepAlive(val);
38         }
39
40         /**
41          * A temporary channel ID
42          * For V2 channels: derived using a zeroed out value for the channel acceptor's revocation basepoint
43          * For V1 channels: a temporary channel ID, until the funding outpoint is announced
44          */
45         public ChannelId get_temporary_channel_id() {
46                 long ret = bindings.CommonOpenChannelFields_get_temporary_channel_id(this.ptr);
47                 GC.KeepAlive(this);
48                 if (ret >= 0 && ret <= 4096) { return null; }
49                 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
50                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
51                 return ret_hu_conv;
52         }
53
54         /**
55          * A temporary channel ID
56          * For V2 channels: derived using a zeroed out value for the channel acceptor's revocation basepoint
57          * For V1 channels: a temporary channel ID, until the funding outpoint is announced
58          */
59         public void set_temporary_channel_id(org.ldk.structs.ChannelId val) {
60                 bindings.CommonOpenChannelFields_set_temporary_channel_id(this.ptr, val.ptr);
61                 GC.KeepAlive(this);
62                 GC.KeepAlive(val);
63                 if (this != null) { this.ptrs_to.AddLast(val); };
64         }
65
66         /**
67          * For V1 channels: The channel value
68          * For V2 channels: Part of the channel value contributed by the channel initiator
69          */
70         public long get_funding_satoshis() {
71                 long ret = bindings.CommonOpenChannelFields_get_funding_satoshis(this.ptr);
72                 GC.KeepAlive(this);
73                 return ret;
74         }
75
76         /**
77          * For V1 channels: The channel value
78          * For V2 channels: Part of the channel value contributed by the channel initiator
79          */
80         public void set_funding_satoshis(long val) {
81                 bindings.CommonOpenChannelFields_set_funding_satoshis(this.ptr, val);
82                 GC.KeepAlive(this);
83                 GC.KeepAlive(val);
84         }
85
86         /**
87          * The threshold below which outputs on transactions broadcast by the channel initiator will be
88          * omitted
89          */
90         public long get_dust_limit_satoshis() {
91                 long ret = bindings.CommonOpenChannelFields_get_dust_limit_satoshis(this.ptr);
92                 GC.KeepAlive(this);
93                 return ret;
94         }
95
96         /**
97          * The threshold below which outputs on transactions broadcast by the channel initiator will be
98          * omitted
99          */
100         public void set_dust_limit_satoshis(long val) {
101                 bindings.CommonOpenChannelFields_set_dust_limit_satoshis(this.ptr, val);
102                 GC.KeepAlive(this);
103                 GC.KeepAlive(val);
104         }
105
106         /**
107          * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi
108          */
109         public long get_max_htlc_value_in_flight_msat() {
110                 long ret = bindings.CommonOpenChannelFields_get_max_htlc_value_in_flight_msat(this.ptr);
111                 GC.KeepAlive(this);
112                 return ret;
113         }
114
115         /**
116          * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi
117          */
118         public void set_max_htlc_value_in_flight_msat(long val) {
119                 bindings.CommonOpenChannelFields_set_max_htlc_value_in_flight_msat(this.ptr, val);
120                 GC.KeepAlive(this);
121                 GC.KeepAlive(val);
122         }
123
124         /**
125          * The minimum HTLC size incoming to channel initiator, in milli-satoshi
126          */
127         public long get_htlc_minimum_msat() {
128                 long ret = bindings.CommonOpenChannelFields_get_htlc_minimum_msat(this.ptr);
129                 GC.KeepAlive(this);
130                 return ret;
131         }
132
133         /**
134          * The minimum HTLC size incoming to channel initiator, in milli-satoshi
135          */
136         public void set_htlc_minimum_msat(long val) {
137                 bindings.CommonOpenChannelFields_set_htlc_minimum_msat(this.ptr, val);
138                 GC.KeepAlive(this);
139                 GC.KeepAlive(val);
140         }
141
142         /**
143          * The feerate for the commitment transaction set by the channel initiator until updated by
144          * [`UpdateFee`]
145          */
146         public int get_commitment_feerate_sat_per_1000_weight() {
147                 int ret = bindings.CommonOpenChannelFields_get_commitment_feerate_sat_per_1000_weight(this.ptr);
148                 GC.KeepAlive(this);
149                 return ret;
150         }
151
152         /**
153          * The feerate for the commitment transaction set by the channel initiator until updated by
154          * [`UpdateFee`]
155          */
156         public void set_commitment_feerate_sat_per_1000_weight(int val) {
157                 bindings.CommonOpenChannelFields_set_commitment_feerate_sat_per_1000_weight(this.ptr, val);
158                 GC.KeepAlive(this);
159                 GC.KeepAlive(val);
160         }
161
162         /**
163          * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
164          * broadcast a commitment transaction
165          */
166         public short get_to_self_delay() {
167                 short ret = bindings.CommonOpenChannelFields_get_to_self_delay(this.ptr);
168                 GC.KeepAlive(this);
169                 return ret;
170         }
171
172         /**
173          * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
174          * broadcast a commitment transaction
175          */
176         public void set_to_self_delay(short val) {
177                 bindings.CommonOpenChannelFields_set_to_self_delay(this.ptr, val);
178                 GC.KeepAlive(this);
179                 GC.KeepAlive(val);
180         }
181
182         /**
183          * The maximum number of inbound HTLCs towards channel initiator
184          */
185         public short get_max_accepted_htlcs() {
186                 short ret = bindings.CommonOpenChannelFields_get_max_accepted_htlcs(this.ptr);
187                 GC.KeepAlive(this);
188                 return ret;
189         }
190
191         /**
192          * The maximum number of inbound HTLCs towards channel initiator
193          */
194         public void set_max_accepted_htlcs(short val) {
195                 bindings.CommonOpenChannelFields_set_max_accepted_htlcs(this.ptr, val);
196                 GC.KeepAlive(this);
197                 GC.KeepAlive(val);
198         }
199
200         /**
201          * The channel initiator's key controlling the funding transaction
202          */
203         public byte[] get_funding_pubkey() {
204                 long ret = bindings.CommonOpenChannelFields_get_funding_pubkey(this.ptr);
205                 GC.KeepAlive(this);
206                 if (ret >= 0 && ret <= 4096) { return null; }
207                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
208                 return ret_conv;
209         }
210
211         /**
212          * The channel initiator's key controlling the funding transaction
213          */
214         public void set_funding_pubkey(byte[] val) {
215                 bindings.CommonOpenChannelFields_set_funding_pubkey(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
216                 GC.KeepAlive(this);
217                 GC.KeepAlive(val);
218         }
219
220         /**
221          * Used to derive a revocation key for transactions broadcast by counterparty
222          */
223         public byte[] get_revocation_basepoint() {
224                 long ret = bindings.CommonOpenChannelFields_get_revocation_basepoint(this.ptr);
225                 GC.KeepAlive(this);
226                 if (ret >= 0 && ret <= 4096) { return null; }
227                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
228                 return ret_conv;
229         }
230
231         /**
232          * Used to derive a revocation key for transactions broadcast by counterparty
233          */
234         public void set_revocation_basepoint(byte[] val) {
235                 bindings.CommonOpenChannelFields_set_revocation_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
236                 GC.KeepAlive(this);
237                 GC.KeepAlive(val);
238         }
239
240         /**
241          * A payment key to channel initiator for transactions broadcast by counterparty
242          */
243         public byte[] get_payment_basepoint() {
244                 long ret = bindings.CommonOpenChannelFields_get_payment_basepoint(this.ptr);
245                 GC.KeepAlive(this);
246                 if (ret >= 0 && ret <= 4096) { return null; }
247                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
248                 return ret_conv;
249         }
250
251         /**
252          * A payment key to channel initiator for transactions broadcast by counterparty
253          */
254         public void set_payment_basepoint(byte[] val) {
255                 bindings.CommonOpenChannelFields_set_payment_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
256                 GC.KeepAlive(this);
257                 GC.KeepAlive(val);
258         }
259
260         /**
261          * Used to derive a payment key to channel initiator for transactions broadcast by channel
262          * initiator
263          */
264         public byte[] get_delayed_payment_basepoint() {
265                 long ret = bindings.CommonOpenChannelFields_get_delayed_payment_basepoint(this.ptr);
266                 GC.KeepAlive(this);
267                 if (ret >= 0 && ret <= 4096) { return null; }
268                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
269                 return ret_conv;
270         }
271
272         /**
273          * Used to derive a payment key to channel initiator for transactions broadcast by channel
274          * initiator
275          */
276         public void set_delayed_payment_basepoint(byte[] val) {
277                 bindings.CommonOpenChannelFields_set_delayed_payment_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
278                 GC.KeepAlive(this);
279                 GC.KeepAlive(val);
280         }
281
282         /**
283          * Used to derive an HTLC payment key to channel initiator
284          */
285         public byte[] get_htlc_basepoint() {
286                 long ret = bindings.CommonOpenChannelFields_get_htlc_basepoint(this.ptr);
287                 GC.KeepAlive(this);
288                 if (ret >= 0 && ret <= 4096) { return null; }
289                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
290                 return ret_conv;
291         }
292
293         /**
294          * Used to derive an HTLC payment key to channel initiator
295          */
296         public void set_htlc_basepoint(byte[] val) {
297                 bindings.CommonOpenChannelFields_set_htlc_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
298                 GC.KeepAlive(this);
299                 GC.KeepAlive(val);
300         }
301
302         /**
303          * The first to-be-broadcast-by-channel-initiator transaction's per commitment point
304          */
305         public byte[] get_first_per_commitment_point() {
306                 long ret = bindings.CommonOpenChannelFields_get_first_per_commitment_point(this.ptr);
307                 GC.KeepAlive(this);
308                 if (ret >= 0 && ret <= 4096) { return null; }
309                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
310                 return ret_conv;
311         }
312
313         /**
314          * The first to-be-broadcast-by-channel-initiator transaction's per commitment point
315          */
316         public void set_first_per_commitment_point(byte[] val) {
317                 bindings.CommonOpenChannelFields_set_first_per_commitment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
318                 GC.KeepAlive(this);
319                 GC.KeepAlive(val);
320         }
321
322         /**
323          * The channel flags to be used
324          */
325         public byte get_channel_flags() {
326                 byte ret = bindings.CommonOpenChannelFields_get_channel_flags(this.ptr);
327                 GC.KeepAlive(this);
328                 return ret;
329         }
330
331         /**
332          * The channel flags to be used
333          */
334         public void set_channel_flags(byte val) {
335                 bindings.CommonOpenChannelFields_set_channel_flags(this.ptr, val);
336                 GC.KeepAlive(this);
337                 GC.KeepAlive(val);
338         }
339
340         /**
341          * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we
342          * collaboratively close
343          */
344         public Option_CVec_u8ZZ get_shutdown_scriptpubkey() {
345                 long ret = bindings.CommonOpenChannelFields_get_shutdown_scriptpubkey(this.ptr);
346                 GC.KeepAlive(this);
347                 if (ret >= 0 && ret <= 4096) { return null; }
348                 org.ldk.structs.Option_CVec_u8ZZ ret_hu_conv = org.ldk.structs.Option_CVec_u8ZZ.constr_from_ptr(ret);
349                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
350                 return ret_hu_conv;
351         }
352
353         /**
354          * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we
355          * collaboratively close
356          */
357         public void set_shutdown_scriptpubkey(org.ldk.structs.Option_CVec_u8ZZ val) {
358                 bindings.CommonOpenChannelFields_set_shutdown_scriptpubkey(this.ptr, val.ptr);
359                 GC.KeepAlive(this);
360                 GC.KeepAlive(val);
361                 if (this != null) { this.ptrs_to.AddLast(val); };
362         }
363
364         /**
365          * The channel type that this channel will represent
366          * 
367          * If this is `None`, we derive the channel type from the intersection of our
368          * feature bits with our counterparty's feature bits from the [`Init`] message.
369          * 
370          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
371          */
372         public ChannelTypeFeatures get_channel_type() {
373                 long ret = bindings.CommonOpenChannelFields_get_channel_type(this.ptr);
374                 GC.KeepAlive(this);
375                 if (ret >= 0 && ret <= 4096) { return null; }
376                 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
377                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
378                 return ret_hu_conv;
379         }
380
381         /**
382          * The channel type that this channel will represent
383          * 
384          * If this is `None`, we derive the channel type from the intersection of our
385          * feature bits with our counterparty's feature bits from the [`Init`] message.
386          * 
387          * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
388          */
389         public void set_channel_type(org.ldk.structs.ChannelTypeFeatures val) {
390                 bindings.CommonOpenChannelFields_set_channel_type(this.ptr, val == null ? 0 : val.ptr);
391                 GC.KeepAlive(this);
392                 GC.KeepAlive(val);
393                 if (this != null) { this.ptrs_to.AddLast(val); };
394         }
395
396         /**
397          * Constructs a new CommonOpenChannelFields given each field
398          * 
399          * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
400          */
401         public static CommonOpenChannelFields of(byte[] chain_hash_arg, org.ldk.structs.ChannelId temporary_channel_id_arg, long funding_satoshis_arg, long dust_limit_satoshis_arg, long max_htlc_value_in_flight_msat_arg, long htlc_minimum_msat_arg, int commitment_feerate_sat_per_1000_weight_arg, short to_self_delay_arg, short max_accepted_htlcs_arg, byte[] funding_pubkey_arg, byte[] revocation_basepoint_arg, byte[] payment_basepoint_arg, byte[] delayed_payment_basepoint_arg, byte[] htlc_basepoint_arg, byte[] first_per_commitment_point_arg, byte channel_flags_arg, org.ldk.structs.Option_CVec_u8ZZ shutdown_scriptpubkey_arg, org.ldk.structs.ChannelTypeFeatures channel_type_arg) {
402                 long ret = bindings.CommonOpenChannelFields_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(chain_hash_arg, 32)), temporary_channel_id_arg.ptr, funding_satoshis_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, commitment_feerate_sat_per_1000_weight_arg, to_self_delay_arg, max_accepted_htlcs_arg, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(funding_pubkey_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(revocation_basepoint_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_basepoint_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(delayed_payment_basepoint_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(htlc_basepoint_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(first_per_commitment_point_arg, 33)), channel_flags_arg, shutdown_scriptpubkey_arg.ptr, channel_type_arg == null ? 0 : channel_type_arg.ptr);
403                 GC.KeepAlive(chain_hash_arg);
404                 GC.KeepAlive(temporary_channel_id_arg);
405                 GC.KeepAlive(funding_satoshis_arg);
406                 GC.KeepAlive(dust_limit_satoshis_arg);
407                 GC.KeepAlive(max_htlc_value_in_flight_msat_arg);
408                 GC.KeepAlive(htlc_minimum_msat_arg);
409                 GC.KeepAlive(commitment_feerate_sat_per_1000_weight_arg);
410                 GC.KeepAlive(to_self_delay_arg);
411                 GC.KeepAlive(max_accepted_htlcs_arg);
412                 GC.KeepAlive(funding_pubkey_arg);
413                 GC.KeepAlive(revocation_basepoint_arg);
414                 GC.KeepAlive(payment_basepoint_arg);
415                 GC.KeepAlive(delayed_payment_basepoint_arg);
416                 GC.KeepAlive(htlc_basepoint_arg);
417                 GC.KeepAlive(first_per_commitment_point_arg);
418                 GC.KeepAlive(channel_flags_arg);
419                 GC.KeepAlive(shutdown_scriptpubkey_arg);
420                 GC.KeepAlive(channel_type_arg);
421                 if (ret >= 0 && ret <= 4096) { return null; }
422                 org.ldk.structs.CommonOpenChannelFields ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.CommonOpenChannelFields(null, ret); }
423                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
424                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(temporary_channel_id_arg); };
425                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(shutdown_scriptpubkey_arg); };
426                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_type_arg); };
427                 return ret_hu_conv;
428         }
429
430         internal long clone_ptr() {
431                 long ret = bindings.CommonOpenChannelFields_clone_ptr(this.ptr);
432                 GC.KeepAlive(this);
433                 return ret;
434         }
435
436         /**
437          * Creates a copy of the CommonOpenChannelFields
438          */
439         public CommonOpenChannelFields clone() {
440                 long ret = bindings.CommonOpenChannelFields_clone(this.ptr);
441                 GC.KeepAlive(this);
442                 if (ret >= 0 && ret <= 4096) { return null; }
443                 org.ldk.structs.CommonOpenChannelFields ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.CommonOpenChannelFields(null, ret); }
444                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
445                 return ret_hu_conv;
446         }
447
448         /**
449          * Generates a non-cryptographic 64-bit hash of the CommonOpenChannelFields.
450          */
451         public long hash() {
452                 long ret = bindings.CommonOpenChannelFields_hash(this.ptr);
453                 GC.KeepAlive(this);
454                 return ret;
455         }
456
457         public override int GetHashCode() {
458                 return (int)this.hash();
459         }
460         /**
461          * Checks if two CommonOpenChannelFieldss contain equal inner contents.
462          * This ignores pointers and is_owned flags and looks at the values in fields.
463          * Two objects with NULL inner values will be considered "equal" here.
464          */
465         public bool eq(org.ldk.structs.CommonOpenChannelFields b) {
466                 bool ret = bindings.CommonOpenChannelFields_eq(this.ptr, b.ptr);
467                 GC.KeepAlive(this);
468                 GC.KeepAlive(b);
469                 if (this != null) { this.ptrs_to.AddLast(b); };
470                 return ret;
471         }
472
473         public override bool Equals(object o) {
474                 if (!(o is CommonOpenChannelFields)) return false;
475                 return this.eq((CommonOpenChannelFields)o);
476         }
477 }
478 } } }