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