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