[C#] Update auto-generated files
[ldk-java] / c_sharp / src / org / ldk / structs / OpenChannelV2.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 open_channel2 message to be sent by or received from the channel initiator.
11  * 
12  * Used in V2 channel establishment
13  */
14 public class OpenChannelV2 : CommonBase {
15         internal OpenChannelV2(object _dummy, long ptr) : base(ptr) { }
16         ~OpenChannelV2() {
17                 if (ptr != 0) { bindings.OpenChannelV2_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                 byte[] ret = bindings.OpenChannelV2_get_chain_hash(this.ptr);
25                 GC.KeepAlive(this);
26                 return ret;
27         }
28
29         /**
30          * The genesis hash of the blockchain where the channel is to be opened
31          */
32         public void set_chain_hash(byte[] val) {
33                 bindings.OpenChannelV2_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
34                 GC.KeepAlive(this);
35                 GC.KeepAlive(val);
36         }
37
38         /**
39          * A temporary channel ID derived using a zeroed out value for the channel acceptor's revocation basepoint
40          */
41         public byte[] get_temporary_channel_id() {
42                 byte[] ret = bindings.OpenChannelV2_get_temporary_channel_id(this.ptr);
43                 GC.KeepAlive(this);
44                 return ret;
45         }
46
47         /**
48          * A temporary channel ID derived using a zeroed out value for the channel acceptor's revocation basepoint
49          */
50         public void set_temporary_channel_id(byte[] val) {
51                 bindings.OpenChannelV2_set_temporary_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
52                 GC.KeepAlive(this);
53                 GC.KeepAlive(val);
54         }
55
56         /**
57          * The feerate for the funding transaction set by the channel initiator
58          */
59         public int get_funding_feerate_sat_per_1000_weight() {
60                 int ret = bindings.OpenChannelV2_get_funding_feerate_sat_per_1000_weight(this.ptr);
61                 GC.KeepAlive(this);
62                 return ret;
63         }
64
65         /**
66          * The feerate for the funding transaction set by the channel initiator
67          */
68         public void set_funding_feerate_sat_per_1000_weight(int val) {
69                 bindings.OpenChannelV2_set_funding_feerate_sat_per_1000_weight(this.ptr, val);
70                 GC.KeepAlive(this);
71                 GC.KeepAlive(val);
72         }
73
74         /**
75          * The feerate for the commitment transaction set by the channel initiator
76          */
77         public int get_commitment_feerate_sat_per_1000_weight() {
78                 int ret = bindings.OpenChannelV2_get_commitment_feerate_sat_per_1000_weight(this.ptr);
79                 GC.KeepAlive(this);
80                 return ret;
81         }
82
83         /**
84          * The feerate for the commitment transaction set by the channel initiator
85          */
86         public void set_commitment_feerate_sat_per_1000_weight(int val) {
87                 bindings.OpenChannelV2_set_commitment_feerate_sat_per_1000_weight(this.ptr, val);
88                 GC.KeepAlive(this);
89                 GC.KeepAlive(val);
90         }
91
92         /**
93          * Part of the channel value contributed by the channel initiator
94          */
95         public long get_funding_satoshis() {
96                 long ret = bindings.OpenChannelV2_get_funding_satoshis(this.ptr);
97                 GC.KeepAlive(this);
98                 return ret;
99         }
100
101         /**
102          * Part of the channel value contributed by the channel initiator
103          */
104         public void set_funding_satoshis(long val) {
105                 bindings.OpenChannelV2_set_funding_satoshis(this.ptr, val);
106                 GC.KeepAlive(this);
107                 GC.KeepAlive(val);
108         }
109
110         /**
111          * The threshold below which outputs on transactions broadcast by the channel initiator will be
112          * omitted
113          */
114         public long get_dust_limit_satoshis() {
115                 long ret = bindings.OpenChannelV2_get_dust_limit_satoshis(this.ptr);
116                 GC.KeepAlive(this);
117                 return ret;
118         }
119
120         /**
121          * The threshold below which outputs on transactions broadcast by the channel initiator will be
122          * omitted
123          */
124         public void set_dust_limit_satoshis(long val) {
125                 bindings.OpenChannelV2_set_dust_limit_satoshis(this.ptr, val);
126                 GC.KeepAlive(this);
127                 GC.KeepAlive(val);
128         }
129
130         /**
131          * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi
132          */
133         public long get_max_htlc_value_in_flight_msat() {
134                 long ret = bindings.OpenChannelV2_get_max_htlc_value_in_flight_msat(this.ptr);
135                 GC.KeepAlive(this);
136                 return ret;
137         }
138
139         /**
140          * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi
141          */
142         public void set_max_htlc_value_in_flight_msat(long val) {
143                 bindings.OpenChannelV2_set_max_htlc_value_in_flight_msat(this.ptr, val);
144                 GC.KeepAlive(this);
145                 GC.KeepAlive(val);
146         }
147
148         /**
149          * The minimum HTLC size incoming to channel initiator, in milli-satoshi
150          */
151         public long get_htlc_minimum_msat() {
152                 long ret = bindings.OpenChannelV2_get_htlc_minimum_msat(this.ptr);
153                 GC.KeepAlive(this);
154                 return ret;
155         }
156
157         /**
158          * The minimum HTLC size incoming to channel initiator, in milli-satoshi
159          */
160         public void set_htlc_minimum_msat(long val) {
161                 bindings.OpenChannelV2_set_htlc_minimum_msat(this.ptr, val);
162                 GC.KeepAlive(this);
163                 GC.KeepAlive(val);
164         }
165
166         /**
167          * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
168          * broadcast a commitment transaction
169          */
170         public short get_to_self_delay() {
171                 short ret = bindings.OpenChannelV2_get_to_self_delay(this.ptr);
172                 GC.KeepAlive(this);
173                 return ret;
174         }
175
176         /**
177          * The number of blocks which the counterparty will have to wait to claim on-chain funds if they
178          * broadcast a commitment transaction
179          */
180         public void set_to_self_delay(short val) {
181                 bindings.OpenChannelV2_set_to_self_delay(this.ptr, val);
182                 GC.KeepAlive(this);
183                 GC.KeepAlive(val);
184         }
185
186         /**
187          * The maximum number of inbound HTLCs towards channel initiator
188          */
189         public short get_max_accepted_htlcs() {
190                 short ret = bindings.OpenChannelV2_get_max_accepted_htlcs(this.ptr);
191                 GC.KeepAlive(this);
192                 return ret;
193         }
194
195         /**
196          * The maximum number of inbound HTLCs towards channel initiator
197          */
198         public void set_max_accepted_htlcs(short val) {
199                 bindings.OpenChannelV2_set_max_accepted_htlcs(this.ptr, val);
200                 GC.KeepAlive(this);
201                 GC.KeepAlive(val);
202         }
203
204         /**
205          * The locktime for the funding transaction
206          */
207         public int get_locktime() {
208                 int ret = bindings.OpenChannelV2_get_locktime(this.ptr);
209                 GC.KeepAlive(this);
210                 return ret;
211         }
212
213         /**
214          * The locktime for the funding transaction
215          */
216         public void set_locktime(int val) {
217                 bindings.OpenChannelV2_set_locktime(this.ptr, val);
218                 GC.KeepAlive(this);
219                 GC.KeepAlive(val);
220         }
221
222         /**
223          * The channel initiator's key controlling the funding transaction
224          */
225         public byte[] get_funding_pubkey() {
226                 byte[] ret = bindings.OpenChannelV2_get_funding_pubkey(this.ptr);
227                 GC.KeepAlive(this);
228                 return ret;
229         }
230
231         /**
232          * The channel initiator's key controlling the funding transaction
233          */
234         public void set_funding_pubkey(byte[] val) {
235                 bindings.OpenChannelV2_set_funding_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
236                 GC.KeepAlive(this);
237                 GC.KeepAlive(val);
238         }
239
240         /**
241          * Used to derive a revocation key for transactions broadcast by counterparty
242          */
243         public byte[] get_revocation_basepoint() {
244                 byte[] ret = bindings.OpenChannelV2_get_revocation_basepoint(this.ptr);
245                 GC.KeepAlive(this);
246                 return ret;
247         }
248
249         /**
250          * Used to derive a revocation key for transactions broadcast by counterparty
251          */
252         public void set_revocation_basepoint(byte[] val) {
253                 bindings.OpenChannelV2_set_revocation_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
254                 GC.KeepAlive(this);
255                 GC.KeepAlive(val);
256         }
257
258         /**
259          * A payment key to channel initiator for transactions broadcast by counterparty
260          */
261         public byte[] get_payment_basepoint() {
262                 byte[] ret = bindings.OpenChannelV2_get_payment_basepoint(this.ptr);
263                 GC.KeepAlive(this);
264                 return ret;
265         }
266
267         /**
268          * A payment key to channel initiator for transactions broadcast by counterparty
269          */
270         public void set_payment_basepoint(byte[] val) {
271                 bindings.OpenChannelV2_set_payment_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
272                 GC.KeepAlive(this);
273                 GC.KeepAlive(val);
274         }
275
276         /**
277          * Used to derive a payment key to channel initiator for transactions broadcast by channel
278          * initiator
279          */
280         public byte[] get_delayed_payment_basepoint() {
281                 byte[] ret = bindings.OpenChannelV2_get_delayed_payment_basepoint(this.ptr);
282                 GC.KeepAlive(this);
283                 return ret;
284         }
285
286         /**
287          * Used to derive a payment key to channel initiator for transactions broadcast by channel
288          * initiator
289          */
290         public void set_delayed_payment_basepoint(byte[] val) {
291                 bindings.OpenChannelV2_set_delayed_payment_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
292                 GC.KeepAlive(this);
293                 GC.KeepAlive(val);
294         }
295
296         /**
297          * Used to derive an HTLC payment key to channel initiator
298          */
299         public byte[] get_htlc_basepoint() {
300                 byte[] ret = bindings.OpenChannelV2_get_htlc_basepoint(this.ptr);
301                 GC.KeepAlive(this);
302                 return ret;
303         }
304
305         /**
306          * Used to derive an HTLC payment key to channel initiator
307          */
308         public void set_htlc_basepoint(byte[] val) {
309                 bindings.OpenChannelV2_set_htlc_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
310                 GC.KeepAlive(this);
311                 GC.KeepAlive(val);
312         }
313
314         /**
315          * The first to-be-broadcast-by-channel-initiator transaction's per commitment point
316          */
317         public byte[] get_first_per_commitment_point() {
318                 byte[] ret = bindings.OpenChannelV2_get_first_per_commitment_point(this.ptr);
319                 GC.KeepAlive(this);
320                 return ret;
321         }
322
323         /**
324          * The first to-be-broadcast-by-channel-initiator transaction's per commitment point
325          */
326         public void set_first_per_commitment_point(byte[] val) {
327                 bindings.OpenChannelV2_set_first_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
328                 GC.KeepAlive(this);
329                 GC.KeepAlive(val);
330         }
331
332         /**
333          * The second to-be-broadcast-by-channel-initiator transaction's per commitment point
334          */
335         public byte[] get_second_per_commitment_point() {
336                 byte[] ret = bindings.OpenChannelV2_get_second_per_commitment_point(this.ptr);
337                 GC.KeepAlive(this);
338                 return ret;
339         }
340
341         /**
342          * The second to-be-broadcast-by-channel-initiator transaction's per commitment point
343          */
344         public void set_second_per_commitment_point(byte[] val) {
345                 bindings.OpenChannelV2_set_second_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
346                 GC.KeepAlive(this);
347                 GC.KeepAlive(val);
348         }
349
350         /**
351          * Channel flags
352          */
353         public byte get_channel_flags() {
354                 byte ret = bindings.OpenChannelV2_get_channel_flags(this.ptr);
355                 GC.KeepAlive(this);
356                 return ret;
357         }
358
359         /**
360          * Channel flags
361          */
362         public void set_channel_flags(byte val) {
363                 bindings.OpenChannelV2_set_channel_flags(this.ptr, val);
364                 GC.KeepAlive(this);
365                 GC.KeepAlive(val);
366         }
367
368         /**
369          * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we
370          * collaboratively close
371          */
372         public Option_ScriptZ get_shutdown_scriptpubkey() {
373                 long ret = bindings.OpenChannelV2_get_shutdown_scriptpubkey(this.ptr);
374                 GC.KeepAlive(this);
375                 if (ret >= 0 && ret <= 4096) { return null; }
376                 org.ldk.structs.Option_ScriptZ ret_hu_conv = org.ldk.structs.Option_ScriptZ.constr_from_ptr(ret);
377                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
378                 return ret_hu_conv;
379         }
380
381         /**
382          * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we
383          * collaboratively close
384          */
385         public void set_shutdown_scriptpubkey(org.ldk.structs.Option_ScriptZ val) {
386                 bindings.OpenChannelV2_set_shutdown_scriptpubkey(this.ptr, val.ptr);
387                 GC.KeepAlive(this);
388                 GC.KeepAlive(val);
389                 if (this != null) { this.ptrs_to.AddLast(val); };
390         }
391
392         /**
393          * The channel type that this channel will represent. If none is set, we derive the channel
394          * type from the intersection of our feature bits with our counterparty's feature bits from
395          * the Init message.
396          * 
397          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
398          */
399         public ChannelTypeFeatures get_channel_type() {
400                 long ret = bindings.OpenChannelV2_get_channel_type(this.ptr);
401                 GC.KeepAlive(this);
402                 if (ret >= 0 && ret <= 4096) { return null; }
403                 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
404                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
405                 return ret_hu_conv;
406         }
407
408         /**
409          * The channel type that this channel will represent. If none is set, we derive the channel
410          * type from the intersection of our feature bits with our counterparty's feature bits from
411          * the Init message.
412          * 
413          * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
414          */
415         public void set_channel_type(org.ldk.structs.ChannelTypeFeatures val) {
416                 bindings.OpenChannelV2_set_channel_type(this.ptr, val == null ? 0 : val.ptr);
417                 GC.KeepAlive(this);
418                 GC.KeepAlive(val);
419                 if (this != null) { this.ptrs_to.AddLast(val); };
420         }
421
422         /**
423          * Optionally, a requirement that only confirmed inputs can be added
424          */
425         public COption_NoneZ get_require_confirmed_inputs() {
426                 COption_NoneZ ret = bindings.OpenChannelV2_get_require_confirmed_inputs(this.ptr);
427                 GC.KeepAlive(this);
428                 return ret;
429         }
430
431         /**
432          * Optionally, a requirement that only confirmed inputs can be added
433          */
434         public void set_require_confirmed_inputs(COption_NoneZ val) {
435                 bindings.OpenChannelV2_set_require_confirmed_inputs(this.ptr, val);
436                 GC.KeepAlive(this);
437                 GC.KeepAlive(val);
438         }
439
440         /**
441          * Constructs a new OpenChannelV2 given each field
442          */
443         public static OpenChannelV2 of(byte[] chain_hash_arg, byte[] temporary_channel_id_arg, int funding_feerate_sat_per_1000_weight_arg, int commitment_feerate_sat_per_1000_weight_arg, long funding_satoshis_arg, long dust_limit_satoshis_arg, long max_htlc_value_in_flight_msat_arg, long htlc_minimum_msat_arg, short to_self_delay_arg, short max_accepted_htlcs_arg, int locktime_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, byte channel_flags_arg, org.ldk.structs.Option_ScriptZ shutdown_scriptpubkey_arg, org.ldk.structs.ChannelTypeFeatures channel_type_arg, COption_NoneZ require_confirmed_inputs_arg) {
444                 long ret = bindings.OpenChannelV2_new(InternalUtils.check_arr_len(chain_hash_arg, 32), InternalUtils.check_arr_len(temporary_channel_id_arg, 32), funding_feerate_sat_per_1000_weight_arg, commitment_feerate_sat_per_1000_weight_arg, funding_satoshis_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, htlc_minimum_msat_arg, to_self_delay_arg, max_accepted_htlcs_arg, locktime_arg, InternalUtils.check_arr_len(funding_pubkey_arg, 33), InternalUtils.check_arr_len(revocation_basepoint_arg, 33), InternalUtils.check_arr_len(payment_basepoint_arg, 33), InternalUtils.check_arr_len(delayed_payment_basepoint_arg, 33), InternalUtils.check_arr_len(htlc_basepoint_arg, 33), InternalUtils.check_arr_len(first_per_commitment_point_arg, 33), InternalUtils.check_arr_len(second_per_commitment_point_arg, 33), channel_flags_arg, shutdown_scriptpubkey_arg.ptr, channel_type_arg == null ? 0 : channel_type_arg.ptr, require_confirmed_inputs_arg);
445                 GC.KeepAlive(chain_hash_arg);
446                 GC.KeepAlive(temporary_channel_id_arg);
447                 GC.KeepAlive(funding_feerate_sat_per_1000_weight_arg);
448                 GC.KeepAlive(commitment_feerate_sat_per_1000_weight_arg);
449                 GC.KeepAlive(funding_satoshis_arg);
450                 GC.KeepAlive(dust_limit_satoshis_arg);
451                 GC.KeepAlive(max_htlc_value_in_flight_msat_arg);
452                 GC.KeepAlive(htlc_minimum_msat_arg);
453                 GC.KeepAlive(to_self_delay_arg);
454                 GC.KeepAlive(max_accepted_htlcs_arg);
455                 GC.KeepAlive(locktime_arg);
456                 GC.KeepAlive(funding_pubkey_arg);
457                 GC.KeepAlive(revocation_basepoint_arg);
458                 GC.KeepAlive(payment_basepoint_arg);
459                 GC.KeepAlive(delayed_payment_basepoint_arg);
460                 GC.KeepAlive(htlc_basepoint_arg);
461                 GC.KeepAlive(first_per_commitment_point_arg);
462                 GC.KeepAlive(second_per_commitment_point_arg);
463                 GC.KeepAlive(channel_flags_arg);
464                 GC.KeepAlive(shutdown_scriptpubkey_arg);
465                 GC.KeepAlive(channel_type_arg);
466                 GC.KeepAlive(require_confirmed_inputs_arg);
467                 if (ret >= 0 && ret <= 4096) { return null; }
468                 org.ldk.structs.OpenChannelV2 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OpenChannelV2(null, ret); }
469                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
470                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(shutdown_scriptpubkey_arg); };
471                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_type_arg); };
472                 return ret_hu_conv;
473         }
474
475         internal long clone_ptr() {
476                 long ret = bindings.OpenChannelV2_clone_ptr(this.ptr);
477                 GC.KeepAlive(this);
478                 return ret;
479         }
480
481         /**
482          * Creates a copy of the OpenChannelV2
483          */
484         public OpenChannelV2 clone() {
485                 long ret = bindings.OpenChannelV2_clone(this.ptr);
486                 GC.KeepAlive(this);
487                 if (ret >= 0 && ret <= 4096) { return null; }
488                 org.ldk.structs.OpenChannelV2 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OpenChannelV2(null, ret); }
489                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
490                 return ret_hu_conv;
491         }
492
493         /**
494          * Checks if two OpenChannelV2s contain equal inner contents.
495          * This ignores pointers and is_owned flags and looks at the values in fields.
496          * Two objects with NULL inner values will be considered "equal" here.
497          */
498         public bool eq(org.ldk.structs.OpenChannelV2 b) {
499                 bool ret = bindings.OpenChannelV2_eq(this.ptr, b == null ? 0 : b.ptr);
500                 GC.KeepAlive(this);
501                 GC.KeepAlive(b);
502                 if (this != null) { this.ptrs_to.AddLast(b); };
503                 return ret;
504         }
505
506         public override bool Equals(object o) {
507                 if (!(o is OpenChannelV2)) return false;
508                 return this.eq((OpenChannelV2)o);
509         }
510         /**
511          * Serialize the OpenChannelV2 object into a byte array which can be read by OpenChannelV2_read
512          */
513         public byte[] write() {
514                 byte[] ret = bindings.OpenChannelV2_write(this.ptr);
515                 GC.KeepAlive(this);
516                 return ret;
517         }
518
519         /**
520          * Read a OpenChannelV2 from a byte array, created by OpenChannelV2_write
521          */
522         public static Result_OpenChannelV2DecodeErrorZ read(byte[] ser) {
523                 long ret = bindings.OpenChannelV2_read(ser);
524                 GC.KeepAlive(ser);
525                 if (ret >= 0 && ret <= 4096) { return null; }
526                 Result_OpenChannelV2DecodeErrorZ ret_hu_conv = Result_OpenChannelV2DecodeErrorZ.constr_from_ptr(ret);
527                 return ret_hu_conv;
528         }
529
530 }
531 } } }