[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / AcceptChannelV2.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  * An accept_channel2 message to be sent by or received from the channel accepter.
11  * 
12  * Used in V2 channel establishment
13  */
14 public class AcceptChannelV2 : CommonBase {
15         internal AcceptChannelV2(object _dummy, long ptr) : base(ptr) { }
16         ~AcceptChannelV2() {
17                 if (ptr != 0) { bindings.AcceptChannelV2_free(ptr); }
18         }
19
20         /**
21          * The same `temporary_channel_id` received from the initiator's `open_channel2` message.
22          */
23         public byte[] get_temporary_channel_id() {
24                 long ret = bindings.AcceptChannelV2_get_temporary_channel_id(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 same `temporary_channel_id` received from the initiator's `open_channel2` message.
33          */
34         public void set_temporary_channel_id(byte[] val) {
35                 bindings.AcceptChannelV2_set_temporary_channel_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
36                 GC.KeepAlive(this);
37                 GC.KeepAlive(val);
38         }
39
40         /**
41          * Part of the channel value contributed by the channel acceptor
42          */
43         public long get_funding_satoshis() {
44                 long ret = bindings.AcceptChannelV2_get_funding_satoshis(this.ptr);
45                 GC.KeepAlive(this);
46                 return ret;
47         }
48
49         /**
50          * Part of the channel value contributed by the channel acceptor
51          */
52         public void set_funding_satoshis(long val) {
53                 bindings.AcceptChannelV2_set_funding_satoshis(this.ptr, val);
54                 GC.KeepAlive(this);
55                 GC.KeepAlive(val);
56         }
57
58         /**
59          * The threshold below which outputs on transactions broadcast by the channel acceptor will be
60          * omitted
61          */
62         public long get_dust_limit_satoshis() {
63                 long ret = bindings.AcceptChannelV2_get_dust_limit_satoshis(this.ptr);
64                 GC.KeepAlive(this);
65                 return ret;
66         }
67
68         /**
69          * The threshold below which outputs on transactions broadcast by the channel acceptor will be
70          * omitted
71          */
72         public void set_dust_limit_satoshis(long val) {
73                 bindings.AcceptChannelV2_set_dust_limit_satoshis(this.ptr, val);
74                 GC.KeepAlive(this);
75                 GC.KeepAlive(val);
76         }
77
78         /**
79          * The maximum inbound HTLC value in flight towards channel acceptor, in milli-satoshi
80          */
81         public long get_max_htlc_value_in_flight_msat() {
82                 long ret = bindings.AcceptChannelV2_get_max_htlc_value_in_flight_msat(this.ptr);
83                 GC.KeepAlive(this);
84                 return ret;
85         }
86
87         /**
88          * The maximum inbound HTLC value in flight towards channel acceptor, in milli-satoshi
89          */
90         public void set_max_htlc_value_in_flight_msat(long val) {
91                 bindings.AcceptChannelV2_set_max_htlc_value_in_flight_msat(this.ptr, val);
92                 GC.KeepAlive(this);
93                 GC.KeepAlive(val);
94         }
95
96         /**
97          * The minimum HTLC size incoming to channel acceptor, in milli-satoshi
98          */
99         public long get_htlc_minimum_msat() {
100                 long ret = bindings.AcceptChannelV2_get_htlc_minimum_msat(this.ptr);
101                 GC.KeepAlive(this);
102                 return ret;
103         }
104
105         /**
106          * The minimum HTLC size incoming to channel acceptor, in milli-satoshi
107          */
108         public void set_htlc_minimum_msat(long val) {
109                 bindings.AcceptChannelV2_set_htlc_minimum_msat(this.ptr, val);
110                 GC.KeepAlive(this);
111                 GC.KeepAlive(val);
112         }
113
114         /**
115          * Minimum depth of the funding transaction before the channel is considered open
116          */
117         public int get_minimum_depth() {
118                 int ret = bindings.AcceptChannelV2_get_minimum_depth(this.ptr);
119                 GC.KeepAlive(this);
120                 return ret;
121         }
122
123         /**
124          * Minimum depth of the funding transaction before the channel is considered open
125          */
126         public void set_minimum_depth(int val) {
127                 bindings.AcceptChannelV2_set_minimum_depth(this.ptr, val);
128                 GC.KeepAlive(this);
129                 GC.KeepAlive(val);
130         }
131
132         /**
133          * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
134          * broadcast a commitment transaction
135          */
136         public short get_to_self_delay() {
137                 short ret = bindings.AcceptChannelV2_get_to_self_delay(this.ptr);
138                 GC.KeepAlive(this);
139                 return ret;
140         }
141
142         /**
143          * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
144          * broadcast a commitment transaction
145          */
146         public void set_to_self_delay(short val) {
147                 bindings.AcceptChannelV2_set_to_self_delay(this.ptr, val);
148                 GC.KeepAlive(this);
149                 GC.KeepAlive(val);
150         }
151
152         /**
153          * The maximum number of inbound HTLCs towards channel acceptor
154          */
155         public short get_max_accepted_htlcs() {
156                 short ret = bindings.AcceptChannelV2_get_max_accepted_htlcs(this.ptr);
157                 GC.KeepAlive(this);
158                 return ret;
159         }
160
161         /**
162          * The maximum number of inbound HTLCs towards channel acceptor
163          */
164         public void set_max_accepted_htlcs(short val) {
165                 bindings.AcceptChannelV2_set_max_accepted_htlcs(this.ptr, val);
166                 GC.KeepAlive(this);
167                 GC.KeepAlive(val);
168         }
169
170         /**
171          * The channel acceptor's key controlling the funding transaction
172          */
173         public byte[] get_funding_pubkey() {
174                 long ret = bindings.AcceptChannelV2_get_funding_pubkey(this.ptr);
175                 GC.KeepAlive(this);
176                 if (ret >= 0 && ret <= 4096) { return null; }
177                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
178                 return ret_conv;
179         }
180
181         /**
182          * The channel acceptor's key controlling the funding transaction
183          */
184         public void set_funding_pubkey(byte[] val) {
185                 bindings.AcceptChannelV2_set_funding_pubkey(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
186                 GC.KeepAlive(this);
187                 GC.KeepAlive(val);
188         }
189
190         /**
191          * Used to derive a revocation key for transactions broadcast by counterparty
192          */
193         public byte[] get_revocation_basepoint() {
194                 long ret = bindings.AcceptChannelV2_get_revocation_basepoint(this.ptr);
195                 GC.KeepAlive(this);
196                 if (ret >= 0 && ret <= 4096) { return null; }
197                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
198                 return ret_conv;
199         }
200
201         /**
202          * Used to derive a revocation key for transactions broadcast by counterparty
203          */
204         public void set_revocation_basepoint(byte[] val) {
205                 bindings.AcceptChannelV2_set_revocation_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
206                 GC.KeepAlive(this);
207                 GC.KeepAlive(val);
208         }
209
210         /**
211          * A payment key to channel acceptor for transactions broadcast by counterparty
212          */
213         public byte[] get_payment_basepoint() {
214                 long ret = bindings.AcceptChannelV2_get_payment_basepoint(this.ptr);
215                 GC.KeepAlive(this);
216                 if (ret >= 0 && ret <= 4096) { return null; }
217                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
218                 return ret_conv;
219         }
220
221         /**
222          * A payment key to channel acceptor for transactions broadcast by counterparty
223          */
224         public void set_payment_basepoint(byte[] val) {
225                 bindings.AcceptChannelV2_set_payment_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
226                 GC.KeepAlive(this);
227                 GC.KeepAlive(val);
228         }
229
230         /**
231          * Used to derive a payment key to channel acceptor for transactions broadcast by channel
232          * acceptor
233          */
234         public byte[] get_delayed_payment_basepoint() {
235                 long ret = bindings.AcceptChannelV2_get_delayed_payment_basepoint(this.ptr);
236                 GC.KeepAlive(this);
237                 if (ret >= 0 && ret <= 4096) { return null; }
238                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
239                 return ret_conv;
240         }
241
242         /**
243          * Used to derive a payment key to channel acceptor for transactions broadcast by channel
244          * acceptor
245          */
246         public void set_delayed_payment_basepoint(byte[] val) {
247                 bindings.AcceptChannelV2_set_delayed_payment_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
248                 GC.KeepAlive(this);
249                 GC.KeepAlive(val);
250         }
251
252         /**
253          * Used to derive an HTLC payment key to channel acceptor for transactions broadcast by counterparty
254          */
255         public byte[] get_htlc_basepoint() {
256                 long ret = bindings.AcceptChannelV2_get_htlc_basepoint(this.ptr);
257                 GC.KeepAlive(this);
258                 if (ret >= 0 && ret <= 4096) { return null; }
259                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
260                 return ret_conv;
261         }
262
263         /**
264          * Used to derive an HTLC payment key to channel acceptor for transactions broadcast by counterparty
265          */
266         public void set_htlc_basepoint(byte[] val) {
267                 bindings.AcceptChannelV2_set_htlc_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
268                 GC.KeepAlive(this);
269                 GC.KeepAlive(val);
270         }
271
272         /**
273          * The first to-be-broadcast-by-channel-acceptor transaction's per commitment point
274          */
275         public byte[] get_first_per_commitment_point() {
276                 long ret = bindings.AcceptChannelV2_get_first_per_commitment_point(this.ptr);
277                 GC.KeepAlive(this);
278                 if (ret >= 0 && ret <= 4096) { return null; }
279                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
280                 return ret_conv;
281         }
282
283         /**
284          * The first to-be-broadcast-by-channel-acceptor transaction's per commitment point
285          */
286         public void set_first_per_commitment_point(byte[] val) {
287                 bindings.AcceptChannelV2_set_first_per_commitment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
288                 GC.KeepAlive(this);
289                 GC.KeepAlive(val);
290         }
291
292         /**
293          * The second to-be-broadcast-by-channel-acceptor transaction's per commitment point
294          */
295         public byte[] get_second_per_commitment_point() {
296                 long ret = bindings.AcceptChannelV2_get_second_per_commitment_point(this.ptr);
297                 GC.KeepAlive(this);
298                 if (ret >= 0 && ret <= 4096) { return null; }
299                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
300                 return ret_conv;
301         }
302
303         /**
304          * The second to-be-broadcast-by-channel-acceptor transaction's per commitment point
305          */
306         public void set_second_per_commitment_point(byte[] val) {
307                 bindings.AcceptChannelV2_set_second_per_commitment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
308                 GC.KeepAlive(this);
309                 GC.KeepAlive(val);
310         }
311
312         /**
313          * Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we
314          * collaboratively close
315          */
316         public Option_CVec_u8ZZ get_shutdown_scriptpubkey() {
317                 long ret = bindings.AcceptChannelV2_get_shutdown_scriptpubkey(this.ptr);
318                 GC.KeepAlive(this);
319                 if (ret >= 0 && ret <= 4096) { return null; }
320                 org.ldk.structs.Option_CVec_u8ZZ ret_hu_conv = org.ldk.structs.Option_CVec_u8ZZ.constr_from_ptr(ret);
321                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
322                 return ret_hu_conv;
323         }
324
325         /**
326          * Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we
327          * collaboratively close
328          */
329         public void set_shutdown_scriptpubkey(org.ldk.structs.Option_CVec_u8ZZ val) {
330                 bindings.AcceptChannelV2_set_shutdown_scriptpubkey(this.ptr, val.ptr);
331                 GC.KeepAlive(this);
332                 GC.KeepAlive(val);
333                 if (this != null) { this.ptrs_to.AddLast(val); };
334         }
335
336         /**
337          * The channel type that this channel will represent. If none is set, we derive the channel
338          * type from the intersection of our feature bits with our counterparty's feature bits from
339          * the Init message.
340          * 
341          * This is required to match the equivalent field in [`OpenChannelV2::channel_type`].
342          * 
343          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
344          */
345         public ChannelTypeFeatures get_channel_type() {
346                 long ret = bindings.AcceptChannelV2_get_channel_type(this.ptr);
347                 GC.KeepAlive(this);
348                 if (ret >= 0 && ret <= 4096) { return null; }
349                 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
350                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
351                 return ret_hu_conv;
352         }
353
354         /**
355          * The channel type that this channel will represent. If none is set, we derive the channel
356          * type from the intersection of our feature bits with our counterparty's feature bits from
357          * the Init message.
358          * 
359          * This is required to match the equivalent field in [`OpenChannelV2::channel_type`].
360          * 
361          * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
362          */
363         public void set_channel_type(org.ldk.structs.ChannelTypeFeatures val) {
364                 bindings.AcceptChannelV2_set_channel_type(this.ptr, val == null ? 0 : val.ptr);
365                 GC.KeepAlive(this);
366                 GC.KeepAlive(val);
367                 if (this != null) { this.ptrs_to.AddLast(val); };
368         }
369
370         /**
371          * Optionally, a requirement that only confirmed inputs can be added
372          */
373         public COption_NoneZ get_require_confirmed_inputs() {
374                 COption_NoneZ ret = bindings.AcceptChannelV2_get_require_confirmed_inputs(this.ptr);
375                 GC.KeepAlive(this);
376                 return ret;
377         }
378
379         /**
380          * Optionally, a requirement that only confirmed inputs can be added
381          */
382         public void set_require_confirmed_inputs(COption_NoneZ val) {
383                 bindings.AcceptChannelV2_set_require_confirmed_inputs(this.ptr, val);
384                 GC.KeepAlive(this);
385                 GC.KeepAlive(val);
386         }
387
388         /**
389          * Constructs a new AcceptChannelV2 given each field
390          * 
391          * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
392          */
393         public static AcceptChannelV2 of(byte[] 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 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, byte[] second_per_commitment_point_arg, org.ldk.structs.Option_CVec_u8ZZ shutdown_scriptpubkey_arg, org.ldk.structs.ChannelTypeFeatures channel_type_arg, COption_NoneZ require_confirmed_inputs_arg) {
394                 long ret = bindings.AcceptChannelV2_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(temporary_channel_id_arg, 32)), funding_satoshis_arg, 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)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(second_per_commitment_point_arg, 33)), shutdown_scriptpubkey_arg.ptr, channel_type_arg == null ? 0 : channel_type_arg.ptr, require_confirmed_inputs_arg);
395                 GC.KeepAlive(temporary_channel_id_arg);
396                 GC.KeepAlive(funding_satoshis_arg);
397                 GC.KeepAlive(dust_limit_satoshis_arg);
398                 GC.KeepAlive(max_htlc_value_in_flight_msat_arg);
399                 GC.KeepAlive(htlc_minimum_msat_arg);
400                 GC.KeepAlive(minimum_depth_arg);
401                 GC.KeepAlive(to_self_delay_arg);
402                 GC.KeepAlive(max_accepted_htlcs_arg);
403                 GC.KeepAlive(funding_pubkey_arg);
404                 GC.KeepAlive(revocation_basepoint_arg);
405                 GC.KeepAlive(payment_basepoint_arg);
406                 GC.KeepAlive(delayed_payment_basepoint_arg);
407                 GC.KeepAlive(htlc_basepoint_arg);
408                 GC.KeepAlive(first_per_commitment_point_arg);
409                 GC.KeepAlive(second_per_commitment_point_arg);
410                 GC.KeepAlive(shutdown_scriptpubkey_arg);
411                 GC.KeepAlive(channel_type_arg);
412                 GC.KeepAlive(require_confirmed_inputs_arg);
413                 if (ret >= 0 && ret <= 4096) { return null; }
414                 org.ldk.structs.AcceptChannelV2 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.AcceptChannelV2(null, ret); }
415                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
416                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(shutdown_scriptpubkey_arg); };
417                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_type_arg); };
418                 return ret_hu_conv;
419         }
420
421         internal long clone_ptr() {
422                 long ret = bindings.AcceptChannelV2_clone_ptr(this.ptr);
423                 GC.KeepAlive(this);
424                 return ret;
425         }
426
427         /**
428          * Creates a copy of the AcceptChannelV2
429          */
430         public AcceptChannelV2 clone() {
431                 long ret = bindings.AcceptChannelV2_clone(this.ptr);
432                 GC.KeepAlive(this);
433                 if (ret >= 0 && ret <= 4096) { return null; }
434                 org.ldk.structs.AcceptChannelV2 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.AcceptChannelV2(null, ret); }
435                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
436                 return ret_hu_conv;
437         }
438
439         /**
440          * Generates a non-cryptographic 64-bit hash of the AcceptChannelV2.
441          */
442         public long hash() {
443                 long ret = bindings.AcceptChannelV2_hash(this.ptr);
444                 GC.KeepAlive(this);
445                 return ret;
446         }
447
448         public override int GetHashCode() {
449                 return (int)this.hash();
450         }
451         /**
452          * Checks if two AcceptChannelV2s contain equal inner contents.
453          * This ignores pointers and is_owned flags and looks at the values in fields.
454          * Two objects with NULL inner values will be considered "equal" here.
455          */
456         public bool eq(org.ldk.structs.AcceptChannelV2 b) {
457                 bool ret = bindings.AcceptChannelV2_eq(this.ptr, b == null ? 0 : b.ptr);
458                 GC.KeepAlive(this);
459                 GC.KeepAlive(b);
460                 if (this != null) { this.ptrs_to.AddLast(b); };
461                 return ret;
462         }
463
464         public override bool Equals(object o) {
465                 if (!(o is AcceptChannelV2)) return false;
466                 return this.eq((AcceptChannelV2)o);
467         }
468         /**
469          * Serialize the AcceptChannelV2 object into a byte array which can be read by AcceptChannelV2_read
470          */
471         public byte[] write() {
472                 long ret = bindings.AcceptChannelV2_write(this.ptr);
473                 GC.KeepAlive(this);
474                 if (ret >= 0 && ret <= 4096) { return null; }
475                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
476                 return ret_conv;
477         }
478
479         /**
480          * Read a AcceptChannelV2 from a byte array, created by AcceptChannelV2_write
481          */
482         public static Result_AcceptChannelV2DecodeErrorZ read(byte[] ser) {
483                 long ret = bindings.AcceptChannelV2_read(InternalUtils.encodeUint8Array(ser));
484                 GC.KeepAlive(ser);
485                 if (ret >= 0 && ret <= 4096) { return null; }
486                 Result_AcceptChannelV2DecodeErrorZ ret_hu_conv = Result_AcceptChannelV2DecodeErrorZ.constr_from_ptr(ret);
487                 return ret_hu_conv;
488         }
489
490 }
491 } } }