[TS] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[ldk-java] / c_sharp / src / org / ldk / structs / CommonAcceptChannelFields.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 [`accept_channel`] and `accept_channel2` messages.
11  * 
12  * [`accept_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-accept_channel-message
13  */
14 public class CommonAcceptChannelFields : CommonBase {
15         internal CommonAcceptChannelFields(object _dummy, long ptr) : base(ptr) { }
16         ~CommonAcceptChannelFields() {
17                 if (ptr != 0) { bindings.CommonAcceptChannelFields_free(ptr); }
18         }
19
20         /**
21          * The same `temporary_channel_id` received from the initiator's `open_channel2` or `open_channel` message.
22          */
23         public ChannelId get_temporary_channel_id() {
24                 long ret = bindings.CommonAcceptChannelFields_get_temporary_channel_id(this.ptr);
25                 GC.KeepAlive(this);
26                 if (ret >= 0 && ret <= 4096) { return null; }
27                 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
28                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
29                 return ret_hu_conv;
30         }
31
32         /**
33          * The same `temporary_channel_id` received from the initiator's `open_channel2` or `open_channel` message.
34          */
35         public void set_temporary_channel_id(org.ldk.structs.ChannelId val) {
36                 bindings.CommonAcceptChannelFields_set_temporary_channel_id(this.ptr, val.ptr);
37                 GC.KeepAlive(this);
38                 GC.KeepAlive(val);
39                 if (this != null) { this.ptrs_to.AddLast(val); };
40         }
41
42         /**
43          * The threshold below which outputs on transactions broadcast by the channel acceptor will be
44          * omitted
45          */
46         public long get_dust_limit_satoshis() {
47                 long ret = bindings.CommonAcceptChannelFields_get_dust_limit_satoshis(this.ptr);
48                 GC.KeepAlive(this);
49                 return ret;
50         }
51
52         /**
53          * The threshold below which outputs on transactions broadcast by the channel acceptor will be
54          * omitted
55          */
56         public void set_dust_limit_satoshis(long val) {
57                 bindings.CommonAcceptChannelFields_set_dust_limit_satoshis(this.ptr, val);
58                 GC.KeepAlive(this);
59                 GC.KeepAlive(val);
60         }
61
62         /**
63          * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
64          */
65         public long get_max_htlc_value_in_flight_msat() {
66                 long ret = bindings.CommonAcceptChannelFields_get_max_htlc_value_in_flight_msat(this.ptr);
67                 GC.KeepAlive(this);
68                 return ret;
69         }
70
71         /**
72          * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
73          */
74         public void set_max_htlc_value_in_flight_msat(long val) {
75                 bindings.CommonAcceptChannelFields_set_max_htlc_value_in_flight_msat(this.ptr, val);
76                 GC.KeepAlive(this);
77                 GC.KeepAlive(val);
78         }
79
80         /**
81          * The minimum HTLC size incoming to channel acceptor, in milli-satoshi
82          */
83         public long get_htlc_minimum_msat() {
84                 long ret = bindings.CommonAcceptChannelFields_get_htlc_minimum_msat(this.ptr);
85                 GC.KeepAlive(this);
86                 return ret;
87         }
88
89         /**
90          * The minimum HTLC size incoming to channel acceptor, in milli-satoshi
91          */
92         public void set_htlc_minimum_msat(long val) {
93                 bindings.CommonAcceptChannelFields_set_htlc_minimum_msat(this.ptr, val);
94                 GC.KeepAlive(this);
95                 GC.KeepAlive(val);
96         }
97
98         /**
99          * Minimum depth of the funding transaction before the channel is considered open
100          */
101         public int get_minimum_depth() {
102                 int ret = bindings.CommonAcceptChannelFields_get_minimum_depth(this.ptr);
103                 GC.KeepAlive(this);
104                 return ret;
105         }
106
107         /**
108          * Minimum depth of the funding transaction before the channel is considered open
109          */
110         public void set_minimum_depth(int val) {
111                 bindings.CommonAcceptChannelFields_set_minimum_depth(this.ptr, val);
112                 GC.KeepAlive(this);
113                 GC.KeepAlive(val);
114         }
115
116         /**
117          * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
118          * broadcast a commitment transaction
119          */
120         public short get_to_self_delay() {
121                 short ret = bindings.CommonAcceptChannelFields_get_to_self_delay(this.ptr);
122                 GC.KeepAlive(this);
123                 return ret;
124         }
125
126         /**
127          * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
128          * broadcast a commitment transaction
129          */
130         public void set_to_self_delay(short val) {
131                 bindings.CommonAcceptChannelFields_set_to_self_delay(this.ptr, val);
132                 GC.KeepAlive(this);
133                 GC.KeepAlive(val);
134         }
135
136         /**
137          * The maximum number of inbound HTLCs towards channel acceptor
138          */
139         public short get_max_accepted_htlcs() {
140                 short ret = bindings.CommonAcceptChannelFields_get_max_accepted_htlcs(this.ptr);
141                 GC.KeepAlive(this);
142                 return ret;
143         }
144
145         /**
146          * The maximum number of inbound HTLCs towards channel acceptor
147          */
148         public void set_max_accepted_htlcs(short val) {
149                 bindings.CommonAcceptChannelFields_set_max_accepted_htlcs(this.ptr, val);
150                 GC.KeepAlive(this);
151                 GC.KeepAlive(val);
152         }
153
154         /**
155          * The channel acceptor's key controlling the funding transaction
156          */
157         public byte[] get_funding_pubkey() {
158                 long ret = bindings.CommonAcceptChannelFields_get_funding_pubkey(this.ptr);
159                 GC.KeepAlive(this);
160                 if (ret >= 0 && ret <= 4096) { return null; }
161                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
162                 return ret_conv;
163         }
164
165         /**
166          * The channel acceptor's key controlling the funding transaction
167          */
168         public void set_funding_pubkey(byte[] val) {
169                 bindings.CommonAcceptChannelFields_set_funding_pubkey(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
170                 GC.KeepAlive(this);
171                 GC.KeepAlive(val);
172         }
173
174         /**
175          * Used to derive a revocation key for transactions broadcast by counterparty
176          */
177         public byte[] get_revocation_basepoint() {
178                 long ret = bindings.CommonAcceptChannelFields_get_revocation_basepoint(this.ptr);
179                 GC.KeepAlive(this);
180                 if (ret >= 0 && ret <= 4096) { return null; }
181                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
182                 return ret_conv;
183         }
184
185         /**
186          * Used to derive a revocation key for transactions broadcast by counterparty
187          */
188         public void set_revocation_basepoint(byte[] val) {
189                 bindings.CommonAcceptChannelFields_set_revocation_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
190                 GC.KeepAlive(this);
191                 GC.KeepAlive(val);
192         }
193
194         /**
195          * A payment key to channel acceptor for transactions broadcast by counterparty
196          */
197         public byte[] get_payment_basepoint() {
198                 long ret = bindings.CommonAcceptChannelFields_get_payment_basepoint(this.ptr);
199                 GC.KeepAlive(this);
200                 if (ret >= 0 && ret <= 4096) { return null; }
201                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
202                 return ret_conv;
203         }
204
205         /**
206          * A payment key to channel acceptor for transactions broadcast by counterparty
207          */
208         public void set_payment_basepoint(byte[] val) {
209                 bindings.CommonAcceptChannelFields_set_payment_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
210                 GC.KeepAlive(this);
211                 GC.KeepAlive(val);
212         }
213
214         /**
215          * Used to derive a payment key to channel acceptor for transactions broadcast by channel
216          * acceptor
217          */
218         public byte[] get_delayed_payment_basepoint() {
219                 long ret = bindings.CommonAcceptChannelFields_get_delayed_payment_basepoint(this.ptr);
220                 GC.KeepAlive(this);
221                 if (ret >= 0 && ret <= 4096) { return null; }
222                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
223                 return ret_conv;
224         }
225
226         /**
227          * Used to derive a payment key to channel acceptor for transactions broadcast by channel
228          * acceptor
229          */
230         public void set_delayed_payment_basepoint(byte[] val) {
231                 bindings.CommonAcceptChannelFields_set_delayed_payment_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
232                 GC.KeepAlive(this);
233                 GC.KeepAlive(val);
234         }
235
236         /**
237          * Used to derive an HTLC payment key to channel acceptor for transactions broadcast by counterparty
238          */
239         public byte[] get_htlc_basepoint() {
240                 long ret = bindings.CommonAcceptChannelFields_get_htlc_basepoint(this.ptr);
241                 GC.KeepAlive(this);
242                 if (ret >= 0 && ret <= 4096) { return null; }
243                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
244                 return ret_conv;
245         }
246
247         /**
248          * Used to derive an HTLC payment key to channel acceptor for transactions broadcast by counterparty
249          */
250         public void set_htlc_basepoint(byte[] val) {
251                 bindings.CommonAcceptChannelFields_set_htlc_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
252                 GC.KeepAlive(this);
253                 GC.KeepAlive(val);
254         }
255
256         /**
257          * The first to-be-broadcast-by-channel-acceptor transaction's per commitment point
258          */
259         public byte[] get_first_per_commitment_point() {
260                 long ret = bindings.CommonAcceptChannelFields_get_first_per_commitment_point(this.ptr);
261                 GC.KeepAlive(this);
262                 if (ret >= 0 && ret <= 4096) { return null; }
263                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
264                 return ret_conv;
265         }
266
267         /**
268          * The first to-be-broadcast-by-channel-acceptor transaction's per commitment point
269          */
270         public void set_first_per_commitment_point(byte[] val) {
271                 bindings.CommonAcceptChannelFields_set_first_per_commitment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
272                 GC.KeepAlive(this);
273                 GC.KeepAlive(val);
274         }
275
276         /**
277          * Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we
278          * collaboratively close
279          */
280         public Option_CVec_u8ZZ get_shutdown_scriptpubkey() {
281                 long ret = bindings.CommonAcceptChannelFields_get_shutdown_scriptpubkey(this.ptr);
282                 GC.KeepAlive(this);
283                 if (ret >= 0 && ret <= 4096) { return null; }
284                 org.ldk.structs.Option_CVec_u8ZZ ret_hu_conv = org.ldk.structs.Option_CVec_u8ZZ.constr_from_ptr(ret);
285                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
286                 return ret_hu_conv;
287         }
288
289         /**
290          * Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we
291          * collaboratively close
292          */
293         public void set_shutdown_scriptpubkey(org.ldk.structs.Option_CVec_u8ZZ val) {
294                 bindings.CommonAcceptChannelFields_set_shutdown_scriptpubkey(this.ptr, val.ptr);
295                 GC.KeepAlive(this);
296                 GC.KeepAlive(val);
297                 if (this != null) { this.ptrs_to.AddLast(val); };
298         }
299
300         /**
301          * The channel type that this channel will represent. If none is set, we derive the channel
302          * type from the intersection of our feature bits with our counterparty's feature bits from
303          * the Init message.
304          * 
305          * This is required to match the equivalent field in [`OpenChannel`] or [`OpenChannelV2`]'s
306          * [`CommonOpenChannelFields::channel_type`].
307          * 
308          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
309          */
310         public ChannelTypeFeatures get_channel_type() {
311                 long ret = bindings.CommonAcceptChannelFields_get_channel_type(this.ptr);
312                 GC.KeepAlive(this);
313                 if (ret >= 0 && ret <= 4096) { return null; }
314                 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
315                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
316                 return ret_hu_conv;
317         }
318
319         /**
320          * The channel type that this channel will represent. If none is set, we derive the channel
321          * type from the intersection of our feature bits with our counterparty's feature bits from
322          * the Init message.
323          * 
324          * This is required to match the equivalent field in [`OpenChannel`] or [`OpenChannelV2`]'s
325          * [`CommonOpenChannelFields::channel_type`].
326          * 
327          * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
328          */
329         public void set_channel_type(org.ldk.structs.ChannelTypeFeatures val) {
330                 bindings.CommonAcceptChannelFields_set_channel_type(this.ptr, val == null ? 0 : val.ptr);
331                 GC.KeepAlive(this);
332                 GC.KeepAlive(val);
333                 if (this != null) { this.ptrs_to.AddLast(val); };
334         }
335
336         /**
337          * Constructs a new CommonAcceptChannelFields given each field
338          * 
339          * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
340          */
341         public static CommonAcceptChannelFields of(org.ldk.structs.ChannelId temporary_channel_id_arg, long dust_limit_satoshis_arg, long max_htlc_value_in_flight_msat_arg, long htlc_minimum_msat_arg, int minimum_depth_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, org.ldk.structs.Option_CVec_u8ZZ shutdown_scriptpubkey_arg, org.ldk.structs.ChannelTypeFeatures channel_type_arg) {
342                 long ret = bindings.CommonAcceptChannelFields_new(temporary_channel_id_arg.ptr, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, minimum_depth_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)), shutdown_scriptpubkey_arg.ptr, channel_type_arg == null ? 0 : channel_type_arg.ptr);
343                 GC.KeepAlive(temporary_channel_id_arg);
344                 GC.KeepAlive(dust_limit_satoshis_arg);
345                 GC.KeepAlive(max_htlc_value_in_flight_msat_arg);
346                 GC.KeepAlive(htlc_minimum_msat_arg);
347                 GC.KeepAlive(minimum_depth_arg);
348                 GC.KeepAlive(to_self_delay_arg);
349                 GC.KeepAlive(max_accepted_htlcs_arg);
350                 GC.KeepAlive(funding_pubkey_arg);
351                 GC.KeepAlive(revocation_basepoint_arg);
352                 GC.KeepAlive(payment_basepoint_arg);
353                 GC.KeepAlive(delayed_payment_basepoint_arg);
354                 GC.KeepAlive(htlc_basepoint_arg);
355                 GC.KeepAlive(first_per_commitment_point_arg);
356                 GC.KeepAlive(shutdown_scriptpubkey_arg);
357                 GC.KeepAlive(channel_type_arg);
358                 if (ret >= 0 && ret <= 4096) { return null; }
359                 org.ldk.structs.CommonAcceptChannelFields ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.CommonAcceptChannelFields(null, ret); }
360                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
361                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(temporary_channel_id_arg); };
362                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(shutdown_scriptpubkey_arg); };
363                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_type_arg); };
364                 return ret_hu_conv;
365         }
366
367         internal long clone_ptr() {
368                 long ret = bindings.CommonAcceptChannelFields_clone_ptr(this.ptr);
369                 GC.KeepAlive(this);
370                 return ret;
371         }
372
373         /**
374          * Creates a copy of the CommonAcceptChannelFields
375          */
376         public CommonAcceptChannelFields clone() {
377                 long ret = bindings.CommonAcceptChannelFields_clone(this.ptr);
378                 GC.KeepAlive(this);
379                 if (ret >= 0 && ret <= 4096) { return null; }
380                 org.ldk.structs.CommonAcceptChannelFields ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.CommonAcceptChannelFields(null, ret); }
381                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
382                 return ret_hu_conv;
383         }
384
385         /**
386          * Generates a non-cryptographic 64-bit hash of the CommonAcceptChannelFields.
387          */
388         public long hash() {
389                 long ret = bindings.CommonAcceptChannelFields_hash(this.ptr);
390                 GC.KeepAlive(this);
391                 return ret;
392         }
393
394         public override int GetHashCode() {
395                 return (int)this.hash();
396         }
397         /**
398          * Checks if two CommonAcceptChannelFieldss contain equal inner contents.
399          * This ignores pointers and is_owned flags and looks at the values in fields.
400          * Two objects with NULL inner values will be considered "equal" here.
401          */
402         public bool eq(org.ldk.structs.CommonAcceptChannelFields b) {
403                 bool ret = bindings.CommonAcceptChannelFields_eq(this.ptr, b.ptr);
404                 GC.KeepAlive(this);
405                 GC.KeepAlive(b);
406                 if (this != null) { this.ptrs_to.AddLast(b); };
407                 return ret;
408         }
409
410         public override bool Equals(object o) {
411                 if (!(o is CommonAcceptChannelFields)) return false;
412                 return this.eq((CommonAcceptChannelFields)o);
413         }
414 }
415 } } }