342cc52847631a735cc1210ebc9720d1393e96a7
[ldk-java] / src / main / java / org / ldk / structs / ChannelDetails.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  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class ChannelDetails extends CommonBase {
16         ChannelDetails(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.ChannelDetails_free(ptr); }
21         }
22
23         /**
24          * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
25          * thereafter this is the txid of the funding transaction xor the funding transaction output).
26          * Note that this means this value is *not* persistent - it can change once during the
27          * lifetime of the channel.
28          */
29         public byte[] get_channel_id() {
30                 byte[] ret = bindings.ChannelDetails_get_channel_id(this.ptr);
31                 Reference.reachabilityFence(this);
32                 return ret;
33         }
34
35         /**
36          * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
37          * thereafter this is the txid of the funding transaction xor the funding transaction output).
38          * Note that this means this value is *not* persistent - it can change once during the
39          * lifetime of the channel.
40          */
41         public void set_channel_id(byte[] val) {
42                 bindings.ChannelDetails_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
43                 Reference.reachabilityFence(this);
44                 Reference.reachabilityFence(val);
45         }
46
47         /**
48          * Parameters which apply to our counterparty. See individual fields for more information.
49          */
50         public ChannelCounterparty get_counterparty() {
51                 long ret = bindings.ChannelDetails_get_counterparty(this.ptr);
52                 Reference.reachabilityFence(this);
53                 if (ret >= 0 && ret <= 4096) { return null; }
54                 org.ldk.structs.ChannelCounterparty ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelCounterparty(null, ret); }
55                 ret_hu_conv.ptrs_to.add(this);
56                 return ret_hu_conv;
57         }
58
59         /**
60          * Parameters which apply to our counterparty. See individual fields for more information.
61          */
62         public void set_counterparty(ChannelCounterparty val) {
63                 bindings.ChannelDetails_set_counterparty(this.ptr, val == null ? 0 : val.ptr);
64                 Reference.reachabilityFence(this);
65                 Reference.reachabilityFence(val);
66                 this.ptrs_to.add(val);
67         }
68
69         /**
70          * The Channel's funding transaction output, if we've negotiated the funding transaction with
71          * our counterparty already.
72          * 
73          * Note that, if this has been set, `channel_id` will be equivalent to
74          * `funding_txo.unwrap().to_channel_id()`.
75          * 
76          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
77          */
78         @Nullable
79         public OutPoint get_funding_txo() {
80                 long ret = bindings.ChannelDetails_get_funding_txo(this.ptr);
81                 Reference.reachabilityFence(this);
82                 if (ret >= 0 && ret <= 4096) { return null; }
83                 org.ldk.structs.OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OutPoint(null, ret); }
84                 ret_hu_conv.ptrs_to.add(this);
85                 return ret_hu_conv;
86         }
87
88         /**
89          * The Channel's funding transaction output, if we've negotiated the funding transaction with
90          * our counterparty already.
91          * 
92          * Note that, if this has been set, `channel_id` will be equivalent to
93          * `funding_txo.unwrap().to_channel_id()`.
94          * 
95          * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
96          */
97         public void set_funding_txo(@Nullable OutPoint val) {
98                 bindings.ChannelDetails_set_funding_txo(this.ptr, val == null ? 0 : val.ptr);
99                 Reference.reachabilityFence(this);
100                 Reference.reachabilityFence(val);
101                 this.ptrs_to.add(val);
102         }
103
104         /**
105          * The features which this channel operates with. See individual features for more info.
106          * 
107          * `None` until negotiation completes and the channel type is finalized.
108          * 
109          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
110          */
111         @Nullable
112         public ChannelTypeFeatures get_channel_type() {
113                 long ret = bindings.ChannelDetails_get_channel_type(this.ptr);
114                 Reference.reachabilityFence(this);
115                 if (ret >= 0 && ret <= 4096) { return null; }
116                 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
117                 ret_hu_conv.ptrs_to.add(this);
118                 return ret_hu_conv;
119         }
120
121         /**
122          * The features which this channel operates with. See individual features for more info.
123          * 
124          * `None` until negotiation completes and the channel type is finalized.
125          * 
126          * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
127          */
128         public void set_channel_type(@Nullable ChannelTypeFeatures val) {
129                 bindings.ChannelDetails_set_channel_type(this.ptr, val == null ? 0 : val.ptr);
130                 Reference.reachabilityFence(this);
131                 Reference.reachabilityFence(val);
132                 this.ptrs_to.add(val);
133         }
134
135         /**
136          * The position of the funding transaction in the chain. None if the funding transaction has
137          * not yet been confirmed and the channel fully opened.
138          * 
139          * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
140          * payments instead of this. See [`get_inbound_payment_scid`].
141          * 
142          * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
143          * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
144          * 
145          * [`inbound_scid_alias`]: Self::inbound_scid_alias
146          * [`outbound_scid_alias`]: Self::outbound_scid_alias
147          * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
148          * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
149          * [`confirmations_required`]: Self::confirmations_required
150          */
151         public Option_u64Z get_short_channel_id() {
152                 long ret = bindings.ChannelDetails_get_short_channel_id(this.ptr);
153                 Reference.reachabilityFence(this);
154                 if (ret >= 0 && ret <= 4096) { return null; }
155                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
156                 ret_hu_conv.ptrs_to.add(this);
157                 return ret_hu_conv;
158         }
159
160         /**
161          * The position of the funding transaction in the chain. None if the funding transaction has
162          * not yet been confirmed and the channel fully opened.
163          * 
164          * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
165          * payments instead of this. See [`get_inbound_payment_scid`].
166          * 
167          * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may
168          * be used in place of this in outbound routes. See [`get_outbound_payment_scid`].
169          * 
170          * [`inbound_scid_alias`]: Self::inbound_scid_alias
171          * [`outbound_scid_alias`]: Self::outbound_scid_alias
172          * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
173          * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid
174          * [`confirmations_required`]: Self::confirmations_required
175          */
176         public void set_short_channel_id(Option_u64Z val) {
177                 bindings.ChannelDetails_set_short_channel_id(this.ptr, val.ptr);
178                 Reference.reachabilityFence(this);
179                 Reference.reachabilityFence(val);
180         }
181
182         /**
183          * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
184          * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
185          * the channel has not yet been confirmed (as long as [`confirmations_required`] is
186          * `Some(0)`).
187          * 
188          * This will be `None` as long as the channel is not available for routing outbound payments.
189          * 
190          * [`short_channel_id`]: Self::short_channel_id
191          * [`confirmations_required`]: Self::confirmations_required
192          */
193         public Option_u64Z get_outbound_scid_alias() {
194                 long ret = bindings.ChannelDetails_get_outbound_scid_alias(this.ptr);
195                 Reference.reachabilityFence(this);
196                 if (ret >= 0 && ret <= 4096) { return null; }
197                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
198                 ret_hu_conv.ptrs_to.add(this);
199                 return ret_hu_conv;
200         }
201
202         /**
203          * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
204          * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
205          * the channel has not yet been confirmed (as long as [`confirmations_required`] is
206          * `Some(0)`).
207          * 
208          * This will be `None` as long as the channel is not available for routing outbound payments.
209          * 
210          * [`short_channel_id`]: Self::short_channel_id
211          * [`confirmations_required`]: Self::confirmations_required
212          */
213         public void set_outbound_scid_alias(Option_u64Z val) {
214                 bindings.ChannelDetails_set_outbound_scid_alias(this.ptr, val.ptr);
215                 Reference.reachabilityFence(this);
216                 Reference.reachabilityFence(val);
217         }
218
219         /**
220          * An optional [`short_channel_id`] alias for this channel, randomly generated by our
221          * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
222          * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
223          * when they see a payment to be routed to us.
224          * 
225          * Our counterparty may choose to rotate this value at any time, though will always recognize
226          * previous values for inbound payment forwarding.
227          * 
228          * [`short_channel_id`]: Self::short_channel_id
229          */
230         public Option_u64Z get_inbound_scid_alias() {
231                 long ret = bindings.ChannelDetails_get_inbound_scid_alias(this.ptr);
232                 Reference.reachabilityFence(this);
233                 if (ret >= 0 && ret <= 4096) { return null; }
234                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
235                 ret_hu_conv.ptrs_to.add(this);
236                 return ret_hu_conv;
237         }
238
239         /**
240          * An optional [`short_channel_id`] alias for this channel, randomly generated by our
241          * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
242          * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
243          * when they see a payment to be routed to us.
244          * 
245          * Our counterparty may choose to rotate this value at any time, though will always recognize
246          * previous values for inbound payment forwarding.
247          * 
248          * [`short_channel_id`]: Self::short_channel_id
249          */
250         public void set_inbound_scid_alias(Option_u64Z val) {
251                 bindings.ChannelDetails_set_inbound_scid_alias(this.ptr, val.ptr);
252                 Reference.reachabilityFence(this);
253                 Reference.reachabilityFence(val);
254         }
255
256         /**
257          * The value, in satoshis, of this channel as appears in the funding output
258          */
259         public long get_channel_value_satoshis() {
260                 long ret = bindings.ChannelDetails_get_channel_value_satoshis(this.ptr);
261                 Reference.reachabilityFence(this);
262                 return ret;
263         }
264
265         /**
266          * The value, in satoshis, of this channel as appears in the funding output
267          */
268         public void set_channel_value_satoshis(long val) {
269                 bindings.ChannelDetails_set_channel_value_satoshis(this.ptr, val);
270                 Reference.reachabilityFence(this);
271                 Reference.reachabilityFence(val);
272         }
273
274         /**
275          * The value, in satoshis, that must always be held in the channel for us. This value ensures
276          * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
277          * this value on chain.
278          * 
279          * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
280          * 
281          * This value will be `None` for outbound channels until the counterparty accepts the channel.
282          * 
283          * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
284          */
285         public Option_u64Z get_unspendable_punishment_reserve() {
286                 long ret = bindings.ChannelDetails_get_unspendable_punishment_reserve(this.ptr);
287                 Reference.reachabilityFence(this);
288                 if (ret >= 0 && ret <= 4096) { return null; }
289                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
290                 ret_hu_conv.ptrs_to.add(this);
291                 return ret_hu_conv;
292         }
293
294         /**
295          * The value, in satoshis, that must always be held in the channel for us. This value ensures
296          * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
297          * this value on chain.
298          * 
299          * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
300          * 
301          * This value will be `None` for outbound channels until the counterparty accepts the channel.
302          * 
303          * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
304          */
305         public void set_unspendable_punishment_reserve(Option_u64Z val) {
306                 bindings.ChannelDetails_set_unspendable_punishment_reserve(this.ptr, val.ptr);
307                 Reference.reachabilityFence(this);
308                 Reference.reachabilityFence(val);
309         }
310
311         /**
312          * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
313          */
314         public long get_user_channel_id() {
315                 long ret = bindings.ChannelDetails_get_user_channel_id(this.ptr);
316                 Reference.reachabilityFence(this);
317                 return ret;
318         }
319
320         /**
321          * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
322          */
323         public void set_user_channel_id(long val) {
324                 bindings.ChannelDetails_set_user_channel_id(this.ptr, val);
325                 Reference.reachabilityFence(this);
326                 Reference.reachabilityFence(val);
327         }
328
329         /**
330          * Our total balance.  This is the amount we would get if we close the channel.
331          * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
332          * amount is not likely to be recoverable on close.
333          * 
334          * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
335          * balance is not available for inclusion in new outbound HTLCs). This further does not include
336          * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
337          * This does not consider any on-chain fees.
338          * 
339          * See also [`ChannelDetails::outbound_capacity_msat`]
340          */
341         public long get_balance_msat() {
342                 long ret = bindings.ChannelDetails_get_balance_msat(this.ptr);
343                 Reference.reachabilityFence(this);
344                 return ret;
345         }
346
347         /**
348          * Our total balance.  This is the amount we would get if we close the channel.
349          * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
350          * amount is not likely to be recoverable on close.
351          * 
352          * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
353          * balance is not available for inclusion in new outbound HTLCs). This further does not include
354          * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
355          * This does not consider any on-chain fees.
356          * 
357          * See also [`ChannelDetails::outbound_capacity_msat`]
358          */
359         public void set_balance_msat(long val) {
360                 bindings.ChannelDetails_set_balance_msat(this.ptr, val);
361                 Reference.reachabilityFence(this);
362                 Reference.reachabilityFence(val);
363         }
364
365         /**
366          * The available outbound capacity for sending HTLCs to the remote peer. This does not include
367          * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
368          * available for inclusion in new outbound HTLCs). This further does not include any pending
369          * outgoing HTLCs which are awaiting some other resolution to be sent.
370          * 
371          * See also [`ChannelDetails::balance_msat`]
372          * 
373          * This value is not exact. Due to various in-flight changes, feerate changes, and our
374          * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
375          * should be able to spend nearly this amount.
376          */
377         public long get_outbound_capacity_msat() {
378                 long ret = bindings.ChannelDetails_get_outbound_capacity_msat(this.ptr);
379                 Reference.reachabilityFence(this);
380                 return ret;
381         }
382
383         /**
384          * The available outbound capacity for sending HTLCs to the remote peer. This does not include
385          * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
386          * available for inclusion in new outbound HTLCs). This further does not include any pending
387          * outgoing HTLCs which are awaiting some other resolution to be sent.
388          * 
389          * See also [`ChannelDetails::balance_msat`]
390          * 
391          * This value is not exact. Due to various in-flight changes, feerate changes, and our
392          * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
393          * should be able to spend nearly this amount.
394          */
395         public void set_outbound_capacity_msat(long val) {
396                 bindings.ChannelDetails_set_outbound_capacity_msat(this.ptr, val);
397                 Reference.reachabilityFence(this);
398                 Reference.reachabilityFence(val);
399         }
400
401         /**
402          * The available outbound capacity for sending a single HTLC to the remote peer. This is
403          * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
404          * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
405          * to use a limit as close as possible to the HTLC limit we can currently send.
406          * 
407          * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`].
408          */
409         public long get_next_outbound_htlc_limit_msat() {
410                 long ret = bindings.ChannelDetails_get_next_outbound_htlc_limit_msat(this.ptr);
411                 Reference.reachabilityFence(this);
412                 return ret;
413         }
414
415         /**
416          * The available outbound capacity for sending a single HTLC to the remote peer. This is
417          * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
418          * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
419          * to use a limit as close as possible to the HTLC limit we can currently send.
420          * 
421          * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`].
422          */
423         public void set_next_outbound_htlc_limit_msat(long val) {
424                 bindings.ChannelDetails_set_next_outbound_htlc_limit_msat(this.ptr, val);
425                 Reference.reachabilityFence(this);
426                 Reference.reachabilityFence(val);
427         }
428
429         /**
430          * The available inbound capacity for the remote peer to send HTLCs to us. This does not
431          * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
432          * available for inclusion in new inbound HTLCs).
433          * Note that there are some corner cases not fully handled here, so the actual available
434          * inbound capacity may be slightly higher than this.
435          * 
436          * This value is not exact. Due to various in-flight changes, feerate changes, and our
437          * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
438          * However, our counterparty should be able to spend nearly this amount.
439          */
440         public long get_inbound_capacity_msat() {
441                 long ret = bindings.ChannelDetails_get_inbound_capacity_msat(this.ptr);
442                 Reference.reachabilityFence(this);
443                 return ret;
444         }
445
446         /**
447          * The available inbound capacity for the remote peer to send HTLCs to us. This does not
448          * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
449          * available for inclusion in new inbound HTLCs).
450          * Note that there are some corner cases not fully handled here, so the actual available
451          * inbound capacity may be slightly higher than this.
452          * 
453          * This value is not exact. Due to various in-flight changes, feerate changes, and our
454          * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
455          * However, our counterparty should be able to spend nearly this amount.
456          */
457         public void set_inbound_capacity_msat(long val) {
458                 bindings.ChannelDetails_set_inbound_capacity_msat(this.ptr, val);
459                 Reference.reachabilityFence(this);
460                 Reference.reachabilityFence(val);
461         }
462
463         /**
464          * The number of required confirmations on the funding transaction before the funding will be
465          * considered \"locked\". This number is selected by the channel fundee (i.e. us if
466          * [`is_outbound`] is *not* set), and can be selected for inbound channels with
467          * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
468          * [`ChannelHandshakeLimits::max_minimum_depth`].
469          * 
470          * This value will be `None` for outbound channels until the counterparty accepts the channel.
471          * 
472          * [`is_outbound`]: ChannelDetails::is_outbound
473          * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
474          * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
475          */
476         public Option_u32Z get_confirmations_required() {
477                 long ret = bindings.ChannelDetails_get_confirmations_required(this.ptr);
478                 Reference.reachabilityFence(this);
479                 if (ret >= 0 && ret <= 4096) { return null; }
480                 org.ldk.structs.Option_u32Z ret_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(ret);
481                 ret_hu_conv.ptrs_to.add(this);
482                 return ret_hu_conv;
483         }
484
485         /**
486          * The number of required confirmations on the funding transaction before the funding will be
487          * considered \"locked\". This number is selected by the channel fundee (i.e. us if
488          * [`is_outbound`] is *not* set), and can be selected for inbound channels with
489          * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
490          * [`ChannelHandshakeLimits::max_minimum_depth`].
491          * 
492          * This value will be `None` for outbound channels until the counterparty accepts the channel.
493          * 
494          * [`is_outbound`]: ChannelDetails::is_outbound
495          * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
496          * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
497          */
498         public void set_confirmations_required(Option_u32Z val) {
499                 bindings.ChannelDetails_set_confirmations_required(this.ptr, val.ptr);
500                 Reference.reachabilityFence(this);
501                 Reference.reachabilityFence(val);
502         }
503
504         /**
505          * The number of blocks (after our commitment transaction confirms) that we will need to wait
506          * until we can claim our funds after we force-close the channel. During this time our
507          * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
508          * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
509          * time to claim our non-HTLC-encumbered funds.
510          * 
511          * This value will be `None` for outbound channels until the counterparty accepts the channel.
512          */
513         public Option_u16Z get_force_close_spend_delay() {
514                 long ret = bindings.ChannelDetails_get_force_close_spend_delay(this.ptr);
515                 Reference.reachabilityFence(this);
516                 if (ret >= 0 && ret <= 4096) { return null; }
517                 org.ldk.structs.Option_u16Z ret_hu_conv = org.ldk.structs.Option_u16Z.constr_from_ptr(ret);
518                 ret_hu_conv.ptrs_to.add(this);
519                 return ret_hu_conv;
520         }
521
522         /**
523          * The number of blocks (after our commitment transaction confirms) that we will need to wait
524          * until we can claim our funds after we force-close the channel. During this time our
525          * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
526          * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
527          * time to claim our non-HTLC-encumbered funds.
528          * 
529          * This value will be `None` for outbound channels until the counterparty accepts the channel.
530          */
531         public void set_force_close_spend_delay(Option_u16Z val) {
532                 bindings.ChannelDetails_set_force_close_spend_delay(this.ptr, val.ptr);
533                 Reference.reachabilityFence(this);
534                 Reference.reachabilityFence(val);
535         }
536
537         /**
538          * True if the channel was initiated (and thus funded) by us.
539          */
540         public boolean get_is_outbound() {
541                 boolean ret = bindings.ChannelDetails_get_is_outbound(this.ptr);
542                 Reference.reachabilityFence(this);
543                 return ret;
544         }
545
546         /**
547          * True if the channel was initiated (and thus funded) by us.
548          */
549         public void set_is_outbound(boolean val) {
550                 bindings.ChannelDetails_set_is_outbound(this.ptr, val);
551                 Reference.reachabilityFence(this);
552                 Reference.reachabilityFence(val);
553         }
554
555         /**
556          * True if the channel is confirmed, channel_ready messages have been exchanged, and the
557          * channel is not currently being shut down. `channel_ready` message exchange implies the
558          * required confirmation count has been reached (and we were connected to the peer at some
559          * point after the funding transaction received enough confirmations). The required
560          * confirmation count is provided in [`confirmations_required`].
561          * 
562          * [`confirmations_required`]: ChannelDetails::confirmations_required
563          */
564         public boolean get_is_channel_ready() {
565                 boolean ret = bindings.ChannelDetails_get_is_channel_ready(this.ptr);
566                 Reference.reachabilityFence(this);
567                 return ret;
568         }
569
570         /**
571          * True if the channel is confirmed, channel_ready messages have been exchanged, and the
572          * channel is not currently being shut down. `channel_ready` message exchange implies the
573          * required confirmation count has been reached (and we were connected to the peer at some
574          * point after the funding transaction received enough confirmations). The required
575          * confirmation count is provided in [`confirmations_required`].
576          * 
577          * [`confirmations_required`]: ChannelDetails::confirmations_required
578          */
579         public void set_is_channel_ready(boolean val) {
580                 bindings.ChannelDetails_set_is_channel_ready(this.ptr, val);
581                 Reference.reachabilityFence(this);
582                 Reference.reachabilityFence(val);
583         }
584
585         /**
586          * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
587          * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
588          * 
589          * This is a strict superset of `is_channel_ready`.
590          */
591         public boolean get_is_usable() {
592                 boolean ret = bindings.ChannelDetails_get_is_usable(this.ptr);
593                 Reference.reachabilityFence(this);
594                 return ret;
595         }
596
597         /**
598          * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
599          * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
600          * 
601          * This is a strict superset of `is_channel_ready`.
602          */
603         public void set_is_usable(boolean val) {
604                 bindings.ChannelDetails_set_is_usable(this.ptr, val);
605                 Reference.reachabilityFence(this);
606                 Reference.reachabilityFence(val);
607         }
608
609         /**
610          * True if this channel is (or will be) publicly-announced.
611          */
612         public boolean get_is_public() {
613                 boolean ret = bindings.ChannelDetails_get_is_public(this.ptr);
614                 Reference.reachabilityFence(this);
615                 return ret;
616         }
617
618         /**
619          * True if this channel is (or will be) publicly-announced.
620          */
621         public void set_is_public(boolean val) {
622                 bindings.ChannelDetails_set_is_public(this.ptr, val);
623                 Reference.reachabilityFence(this);
624                 Reference.reachabilityFence(val);
625         }
626
627         /**
628          * The smallest value HTLC (in msat) we will accept, for this channel. This field
629          * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
630          */
631         public Option_u64Z get_inbound_htlc_minimum_msat() {
632                 long ret = bindings.ChannelDetails_get_inbound_htlc_minimum_msat(this.ptr);
633                 Reference.reachabilityFence(this);
634                 if (ret >= 0 && ret <= 4096) { return null; }
635                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
636                 ret_hu_conv.ptrs_to.add(this);
637                 return ret_hu_conv;
638         }
639
640         /**
641          * The smallest value HTLC (in msat) we will accept, for this channel. This field
642          * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
643          */
644         public void set_inbound_htlc_minimum_msat(Option_u64Z val) {
645                 bindings.ChannelDetails_set_inbound_htlc_minimum_msat(this.ptr, val.ptr);
646                 Reference.reachabilityFence(this);
647                 Reference.reachabilityFence(val);
648         }
649
650         /**
651          * The largest value HTLC (in msat) we currently will accept, for this channel.
652          */
653         public Option_u64Z get_inbound_htlc_maximum_msat() {
654                 long ret = bindings.ChannelDetails_get_inbound_htlc_maximum_msat(this.ptr);
655                 Reference.reachabilityFence(this);
656                 if (ret >= 0 && ret <= 4096) { return null; }
657                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
658                 ret_hu_conv.ptrs_to.add(this);
659                 return ret_hu_conv;
660         }
661
662         /**
663          * The largest value HTLC (in msat) we currently will accept, for this channel.
664          */
665         public void set_inbound_htlc_maximum_msat(Option_u64Z val) {
666                 bindings.ChannelDetails_set_inbound_htlc_maximum_msat(this.ptr, val.ptr);
667                 Reference.reachabilityFence(this);
668                 Reference.reachabilityFence(val);
669         }
670
671         /**
672          * Set of configurable parameters that affect channel operation.
673          * 
674          * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
675          * 
676          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
677          */
678         @Nullable
679         public ChannelConfig get_config() {
680                 long ret = bindings.ChannelDetails_get_config(this.ptr);
681                 Reference.reachabilityFence(this);
682                 if (ret >= 0 && ret <= 4096) { return null; }
683                 org.ldk.structs.ChannelConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelConfig(null, ret); }
684                 ret_hu_conv.ptrs_to.add(this);
685                 return ret_hu_conv;
686         }
687
688         /**
689          * Set of configurable parameters that affect channel operation.
690          * 
691          * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
692          * 
693          * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
694          */
695         public void set_config(@Nullable ChannelConfig val) {
696                 bindings.ChannelDetails_set_config(this.ptr, val == null ? 0 : val.ptr);
697                 Reference.reachabilityFence(this);
698                 Reference.reachabilityFence(val);
699                 this.ptrs_to.add(val);
700         }
701
702         /**
703          * Constructs a new ChannelDetails given each field
704          */
705         public static ChannelDetails of(byte[] channel_id_arg, ChannelCounterparty counterparty_arg, OutPoint funding_txo_arg, ChannelTypeFeatures channel_type_arg, Option_u64Z short_channel_id_arg, Option_u64Z outbound_scid_alias_arg, Option_u64Z inbound_scid_alias_arg, long channel_value_satoshis_arg, Option_u64Z unspendable_punishment_reserve_arg, long user_channel_id_arg, long balance_msat_arg, long outbound_capacity_msat_arg, long next_outbound_htlc_limit_msat_arg, long inbound_capacity_msat_arg, Option_u32Z confirmations_required_arg, Option_u16Z force_close_spend_delay_arg, boolean is_outbound_arg, boolean is_channel_ready_arg, boolean is_usable_arg, boolean is_public_arg, Option_u64Z inbound_htlc_minimum_msat_arg, Option_u64Z inbound_htlc_maximum_msat_arg, ChannelConfig config_arg) {
706                 long ret = bindings.ChannelDetails_new(InternalUtils.check_arr_len(channel_id_arg, 32), counterparty_arg == null ? 0 : counterparty_arg.ptr, funding_txo_arg == null ? 0 : funding_txo_arg.ptr, channel_type_arg == null ? 0 : channel_type_arg.ptr, short_channel_id_arg.ptr, outbound_scid_alias_arg.ptr, inbound_scid_alias_arg.ptr, channel_value_satoshis_arg, unspendable_punishment_reserve_arg.ptr, user_channel_id_arg, balance_msat_arg, outbound_capacity_msat_arg, next_outbound_htlc_limit_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg.ptr, force_close_spend_delay_arg.ptr, is_outbound_arg, is_channel_ready_arg, is_usable_arg, is_public_arg, inbound_htlc_minimum_msat_arg.ptr, inbound_htlc_maximum_msat_arg.ptr, config_arg == null ? 0 : config_arg.ptr);
707                 Reference.reachabilityFence(channel_id_arg);
708                 Reference.reachabilityFence(counterparty_arg);
709                 Reference.reachabilityFence(funding_txo_arg);
710                 Reference.reachabilityFence(channel_type_arg);
711                 Reference.reachabilityFence(short_channel_id_arg);
712                 Reference.reachabilityFence(outbound_scid_alias_arg);
713                 Reference.reachabilityFence(inbound_scid_alias_arg);
714                 Reference.reachabilityFence(channel_value_satoshis_arg);
715                 Reference.reachabilityFence(unspendable_punishment_reserve_arg);
716                 Reference.reachabilityFence(user_channel_id_arg);
717                 Reference.reachabilityFence(balance_msat_arg);
718                 Reference.reachabilityFence(outbound_capacity_msat_arg);
719                 Reference.reachabilityFence(next_outbound_htlc_limit_msat_arg);
720                 Reference.reachabilityFence(inbound_capacity_msat_arg);
721                 Reference.reachabilityFence(confirmations_required_arg);
722                 Reference.reachabilityFence(force_close_spend_delay_arg);
723                 Reference.reachabilityFence(is_outbound_arg);
724                 Reference.reachabilityFence(is_channel_ready_arg);
725                 Reference.reachabilityFence(is_usable_arg);
726                 Reference.reachabilityFence(is_public_arg);
727                 Reference.reachabilityFence(inbound_htlc_minimum_msat_arg);
728                 Reference.reachabilityFence(inbound_htlc_maximum_msat_arg);
729                 Reference.reachabilityFence(config_arg);
730                 if (ret >= 0 && ret <= 4096) { return null; }
731                 org.ldk.structs.ChannelDetails ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelDetails(null, ret); }
732                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
733                 ret_hu_conv.ptrs_to.add(counterparty_arg);
734                 ret_hu_conv.ptrs_to.add(funding_txo_arg);
735                 ret_hu_conv.ptrs_to.add(channel_type_arg);
736                 ret_hu_conv.ptrs_to.add(config_arg);
737                 return ret_hu_conv;
738         }
739
740         long clone_ptr() {
741                 long ret = bindings.ChannelDetails_clone_ptr(this.ptr);
742                 Reference.reachabilityFence(this);
743                 return ret;
744         }
745
746         /**
747          * Creates a copy of the ChannelDetails
748          */
749         public ChannelDetails clone() {
750                 long ret = bindings.ChannelDetails_clone(this.ptr);
751                 Reference.reachabilityFence(this);
752                 if (ret >= 0 && ret <= 4096) { return null; }
753                 org.ldk.structs.ChannelDetails ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelDetails(null, ret); }
754                 ret_hu_conv.ptrs_to.add(this);
755                 return ret_hu_conv;
756         }
757
758         /**
759          * Gets the current SCID which should be used to identify this channel for inbound payments.
760          * This should be used for providing invoice hints or in any other context where our
761          * counterparty will forward a payment to us.
762          * 
763          * This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the
764          * [`ChannelDetails::short_channel_id`]. See those for more information.
765          */
766         public Option_u64Z get_inbound_payment_scid() {
767                 long ret = bindings.ChannelDetails_get_inbound_payment_scid(this.ptr);
768                 Reference.reachabilityFence(this);
769                 if (ret >= 0 && ret <= 4096) { return null; }
770                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
771                 ret_hu_conv.ptrs_to.add(this);
772                 return ret_hu_conv;
773         }
774
775         /**
776          * Gets the current SCID which should be used to identify this channel for outbound payments.
777          * This should be used in [`Route`]s to describe the first hop or in other contexts where
778          * we're sending or forwarding a payment outbound over this channel.
779          * 
780          * This is either the [`ChannelDetails::short_channel_id`], if set, or the
781          * [`ChannelDetails::outbound_scid_alias`]. See those for more information.
782          */
783         public Option_u64Z get_outbound_payment_scid() {
784                 long ret = bindings.ChannelDetails_get_outbound_payment_scid(this.ptr);
785                 Reference.reachabilityFence(this);
786                 if (ret >= 0 && ret <= 4096) { return null; }
787                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
788                 ret_hu_conv.ptrs_to.add(this);
789                 return ret_hu_conv;
790         }
791
792         /**
793          * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read
794          */
795         public byte[] write() {
796                 byte[] ret = bindings.ChannelDetails_write(this.ptr);
797                 Reference.reachabilityFence(this);
798                 return ret;
799         }
800
801         /**
802          * Read a ChannelDetails from a byte array, created by ChannelDetails_write
803          */
804         public static Result_ChannelDetailsDecodeErrorZ read(byte[] ser) {
805                 long ret = bindings.ChannelDetails_read(ser);
806                 Reference.reachabilityFence(ser);
807                 if (ret >= 0 && ret <= 4096) { return null; }
808                 Result_ChannelDetailsDecodeErrorZ ret_hu_conv = Result_ChannelDetailsDecodeErrorZ.constr_from_ptr(ret);
809                 return ret_hu_conv;
810         }
811
812 }