Update CI references to 0.0.122
[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                 if (ret_hu_conv != null) { 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(org.ldk.structs.ChannelCounterparty val) {
63                 bindings.ChannelDetails_set_counterparty(this.ptr, val == null ? 0 : val.ptr);
64                 Reference.reachabilityFence(this);
65                 Reference.reachabilityFence(val);
66                 if (this != null) { 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                 if (ret_hu_conv != null) { 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 org.ldk.structs.OutPoint val) {
98                 bindings.ChannelDetails_set_funding_txo(this.ptr, val == null ? 0 : val.ptr);
99                 Reference.reachabilityFence(this);
100                 Reference.reachabilityFence(val);
101                 if (this != null) { 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                 if (ret_hu_conv != null) { 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 org.ldk.structs.ChannelTypeFeatures val) {
129                 bindings.ChannelDetails_set_channel_type(this.ptr, val == null ? 0 : val.ptr);
130                 Reference.reachabilityFence(this);
131                 Reference.reachabilityFence(val);
132                 if (this != null) { 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                 if (ret_hu_conv != null) { 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(org.ldk.structs.Option_u64Z val) {
177                 bindings.ChannelDetails_set_short_channel_id(this.ptr, val.ptr);
178                 Reference.reachabilityFence(this);
179                 Reference.reachabilityFence(val);
180                 if (this != null) { this.ptrs_to.add(val); };
181         }
182
183         /**
184          * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
185          * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
186          * the channel has not yet been confirmed (as long as [`confirmations_required`] is
187          * `Some(0)`).
188          * 
189          * This will be `None` as long as the channel is not available for routing outbound payments.
190          * 
191          * [`short_channel_id`]: Self::short_channel_id
192          * [`confirmations_required`]: Self::confirmations_required
193          */
194         public Option_u64Z get_outbound_scid_alias() {
195                 long ret = bindings.ChannelDetails_get_outbound_scid_alias(this.ptr);
196                 Reference.reachabilityFence(this);
197                 if (ret >= 0 && ret <= 4096) { return null; }
198                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
199                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
200                 return ret_hu_conv;
201         }
202
203         /**
204          * An optional [`short_channel_id`] alias for this channel, randomly generated by us and
205          * usable in place of [`short_channel_id`] to reference the channel in outbound routes when
206          * the channel has not yet been confirmed (as long as [`confirmations_required`] is
207          * `Some(0)`).
208          * 
209          * This will be `None` as long as the channel is not available for routing outbound payments.
210          * 
211          * [`short_channel_id`]: Self::short_channel_id
212          * [`confirmations_required`]: Self::confirmations_required
213          */
214         public void set_outbound_scid_alias(org.ldk.structs.Option_u64Z val) {
215                 bindings.ChannelDetails_set_outbound_scid_alias(this.ptr, val.ptr);
216                 Reference.reachabilityFence(this);
217                 Reference.reachabilityFence(val);
218                 if (this != null) { this.ptrs_to.add(val); };
219         }
220
221         /**
222          * An optional [`short_channel_id`] alias for this channel, randomly generated by our
223          * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
224          * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
225          * when they see a payment to be routed to us.
226          * 
227          * Our counterparty may choose to rotate this value at any time, though will always recognize
228          * previous values for inbound payment forwarding.
229          * 
230          * [`short_channel_id`]: Self::short_channel_id
231          */
232         public Option_u64Z get_inbound_scid_alias() {
233                 long ret = bindings.ChannelDetails_get_inbound_scid_alias(this.ptr);
234                 Reference.reachabilityFence(this);
235                 if (ret >= 0 && ret <= 4096) { return null; }
236                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
237                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
238                 return ret_hu_conv;
239         }
240
241         /**
242          * An optional [`short_channel_id`] alias for this channel, randomly generated by our
243          * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
244          * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
245          * when they see a payment to be routed to us.
246          * 
247          * Our counterparty may choose to rotate this value at any time, though will always recognize
248          * previous values for inbound payment forwarding.
249          * 
250          * [`short_channel_id`]: Self::short_channel_id
251          */
252         public void set_inbound_scid_alias(org.ldk.structs.Option_u64Z val) {
253                 bindings.ChannelDetails_set_inbound_scid_alias(this.ptr, val.ptr);
254                 Reference.reachabilityFence(this);
255                 Reference.reachabilityFence(val);
256                 if (this != null) { this.ptrs_to.add(val); };
257         }
258
259         /**
260          * The value, in satoshis, of this channel as appears in the funding output
261          */
262         public long get_channel_value_satoshis() {
263                 long ret = bindings.ChannelDetails_get_channel_value_satoshis(this.ptr);
264                 Reference.reachabilityFence(this);
265                 return ret;
266         }
267
268         /**
269          * The value, in satoshis, of this channel as appears in the funding output
270          */
271         public void set_channel_value_satoshis(long val) {
272                 bindings.ChannelDetails_set_channel_value_satoshis(this.ptr, val);
273                 Reference.reachabilityFence(this);
274                 Reference.reachabilityFence(val);
275         }
276
277         /**
278          * The value, in satoshis, that must always be held in the channel for us. This value ensures
279          * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
280          * this value on chain.
281          * 
282          * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
283          * 
284          * This value will be `None` for outbound channels until the counterparty accepts the channel.
285          * 
286          * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
287          */
288         public Option_u64Z get_unspendable_punishment_reserve() {
289                 long ret = bindings.ChannelDetails_get_unspendable_punishment_reserve(this.ptr);
290                 Reference.reachabilityFence(this);
291                 if (ret >= 0 && ret <= 4096) { return null; }
292                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
293                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
294                 return ret_hu_conv;
295         }
296
297         /**
298          * The value, in satoshis, that must always be held in the channel for us. This value ensures
299          * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
300          * this value on chain.
301          * 
302          * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
303          * 
304          * This value will be `None` for outbound channels until the counterparty accepts the channel.
305          * 
306          * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
307          */
308         public void set_unspendable_punishment_reserve(org.ldk.structs.Option_u64Z val) {
309                 bindings.ChannelDetails_set_unspendable_punishment_reserve(this.ptr, val.ptr);
310                 Reference.reachabilityFence(this);
311                 Reference.reachabilityFence(val);
312                 if (this != null) { this.ptrs_to.add(val); };
313         }
314
315         /**
316          * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
317          * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
318          * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
319          * `user_channel_id` will be randomized for an inbound channel.  This may be zero for objects
320          * serialized with LDK versions prior to 0.0.113.
321          * 
322          * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
323          * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
324          * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
325          */
326         public UInt128 get_user_channel_id() {
327                 byte[] ret = bindings.ChannelDetails_get_user_channel_id(this.ptr);
328                 Reference.reachabilityFence(this);
329                 org.ldk.util.UInt128 ret_conv = new org.ldk.util.UInt128(ret);
330                 return ret_conv;
331         }
332
333         /**
334          * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
335          * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
336          * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
337          * `user_channel_id` will be randomized for an inbound channel.  This may be zero for objects
338          * serialized with LDK versions prior to 0.0.113.
339          * 
340          * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
341          * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
342          * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
343          */
344         public void set_user_channel_id(org.ldk.util.UInt128 val) {
345                 bindings.ChannelDetails_set_user_channel_id(this.ptr, val.getLEBytes());
346                 Reference.reachabilityFence(this);
347                 Reference.reachabilityFence(val);
348         }
349
350         /**
351          * The currently negotiated fee rate denominated in satoshi per 1000 weight units,
352          * which is applied to commitment and HTLC transactions.
353          * 
354          * This value will be `None` for objects serialized with LDK versions prior to 0.0.115.
355          */
356         public Option_u32Z get_feerate_sat_per_1000_weight() {
357                 long ret = bindings.ChannelDetails_get_feerate_sat_per_1000_weight(this.ptr);
358                 Reference.reachabilityFence(this);
359                 if (ret >= 0 && ret <= 4096) { return null; }
360                 org.ldk.structs.Option_u32Z ret_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(ret);
361                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
362                 return ret_hu_conv;
363         }
364
365         /**
366          * The currently negotiated fee rate denominated in satoshi per 1000 weight units,
367          * which is applied to commitment and HTLC transactions.
368          * 
369          * This value will be `None` for objects serialized with LDK versions prior to 0.0.115.
370          */
371         public void set_feerate_sat_per_1000_weight(org.ldk.structs.Option_u32Z val) {
372                 bindings.ChannelDetails_set_feerate_sat_per_1000_weight(this.ptr, val.ptr);
373                 Reference.reachabilityFence(this);
374                 Reference.reachabilityFence(val);
375                 if (this != null) { this.ptrs_to.add(val); };
376         }
377
378         /**
379          * Our total balance.  This is the amount we would get if we close the channel.
380          * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
381          * amount is not likely to be recoverable on close.
382          * 
383          * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
384          * balance is not available for inclusion in new outbound HTLCs). This further does not include
385          * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
386          * This does not consider any on-chain fees.
387          * 
388          * See also [`ChannelDetails::outbound_capacity_msat`]
389          */
390         public long get_balance_msat() {
391                 long ret = bindings.ChannelDetails_get_balance_msat(this.ptr);
392                 Reference.reachabilityFence(this);
393                 return ret;
394         }
395
396         /**
397          * Our total balance.  This is the amount we would get if we close the channel.
398          * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
399          * amount is not likely to be recoverable on close.
400          * 
401          * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
402          * balance is not available for inclusion in new outbound HTLCs). This further does not include
403          * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
404          * This does not consider any on-chain fees.
405          * 
406          * See also [`ChannelDetails::outbound_capacity_msat`]
407          */
408         public void set_balance_msat(long val) {
409                 bindings.ChannelDetails_set_balance_msat(this.ptr, val);
410                 Reference.reachabilityFence(this);
411                 Reference.reachabilityFence(val);
412         }
413
414         /**
415          * The available outbound capacity for sending HTLCs to the remote peer. This does not include
416          * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
417          * available for inclusion in new outbound HTLCs). This further does not include any pending
418          * outgoing HTLCs which are awaiting some other resolution to be sent.
419          * 
420          * See also [`ChannelDetails::balance_msat`]
421          * 
422          * This value is not exact. Due to various in-flight changes, feerate changes, and our
423          * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
424          * should be able to spend nearly this amount.
425          */
426         public long get_outbound_capacity_msat() {
427                 long ret = bindings.ChannelDetails_get_outbound_capacity_msat(this.ptr);
428                 Reference.reachabilityFence(this);
429                 return ret;
430         }
431
432         /**
433          * The available outbound capacity for sending HTLCs to the remote peer. This does not include
434          * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
435          * available for inclusion in new outbound HTLCs). This further does not include any pending
436          * outgoing HTLCs which are awaiting some other resolution to be sent.
437          * 
438          * See also [`ChannelDetails::balance_msat`]
439          * 
440          * This value is not exact. Due to various in-flight changes, feerate changes, and our
441          * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
442          * should be able to spend nearly this amount.
443          */
444         public void set_outbound_capacity_msat(long val) {
445                 bindings.ChannelDetails_set_outbound_capacity_msat(this.ptr, val);
446                 Reference.reachabilityFence(this);
447                 Reference.reachabilityFence(val);
448         }
449
450         /**
451          * The available outbound capacity for sending a single HTLC to the remote peer. This is
452          * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
453          * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
454          * to use a limit as close as possible to the HTLC limit we can currently send.
455          * 
456          * See also [`ChannelDetails::next_outbound_htlc_minimum_msat`],
457          * [`ChannelDetails::balance_msat`], and [`ChannelDetails::outbound_capacity_msat`].
458          */
459         public long get_next_outbound_htlc_limit_msat() {
460                 long ret = bindings.ChannelDetails_get_next_outbound_htlc_limit_msat(this.ptr);
461                 Reference.reachabilityFence(this);
462                 return ret;
463         }
464
465         /**
466          * The available outbound capacity for sending a single HTLC to the remote peer. This is
467          * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by
468          * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us
469          * to use a limit as close as possible to the HTLC limit we can currently send.
470          * 
471          * See also [`ChannelDetails::next_outbound_htlc_minimum_msat`],
472          * [`ChannelDetails::balance_msat`], and [`ChannelDetails::outbound_capacity_msat`].
473          */
474         public void set_next_outbound_htlc_limit_msat(long val) {
475                 bindings.ChannelDetails_set_next_outbound_htlc_limit_msat(this.ptr, val);
476                 Reference.reachabilityFence(this);
477                 Reference.reachabilityFence(val);
478         }
479
480         /**
481          * The minimum value for sending a single HTLC to the remote peer. This is the equivalent of
482          * [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than
483          * an upper-bound. This is intended for use when routing, allowing us to ensure we pick a
484          * route which is valid.
485          */
486         public long get_next_outbound_htlc_minimum_msat() {
487                 long ret = bindings.ChannelDetails_get_next_outbound_htlc_minimum_msat(this.ptr);
488                 Reference.reachabilityFence(this);
489                 return ret;
490         }
491
492         /**
493          * The minimum value for sending a single HTLC to the remote peer. This is the equivalent of
494          * [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than
495          * an upper-bound. This is intended for use when routing, allowing us to ensure we pick a
496          * route which is valid.
497          */
498         public void set_next_outbound_htlc_minimum_msat(long val) {
499                 bindings.ChannelDetails_set_next_outbound_htlc_minimum_msat(this.ptr, val);
500                 Reference.reachabilityFence(this);
501                 Reference.reachabilityFence(val);
502         }
503
504         /**
505          * The available inbound capacity for the remote peer to send HTLCs to us. This does not
506          * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
507          * available for inclusion in new inbound HTLCs).
508          * Note that there are some corner cases not fully handled here, so the actual available
509          * inbound capacity may be slightly higher than this.
510          * 
511          * This value is not exact. Due to various in-flight changes, feerate changes, and our
512          * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
513          * However, our counterparty should be able to spend nearly this amount.
514          */
515         public long get_inbound_capacity_msat() {
516                 long ret = bindings.ChannelDetails_get_inbound_capacity_msat(this.ptr);
517                 Reference.reachabilityFence(this);
518                 return ret;
519         }
520
521         /**
522          * The available inbound capacity for the remote peer to send HTLCs to us. This does not
523          * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
524          * available for inclusion in new inbound HTLCs).
525          * Note that there are some corner cases not fully handled here, so the actual available
526          * inbound capacity may be slightly higher than this.
527          * 
528          * This value is not exact. Due to various in-flight changes, feerate changes, and our
529          * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
530          * However, our counterparty should be able to spend nearly this amount.
531          */
532         public void set_inbound_capacity_msat(long val) {
533                 bindings.ChannelDetails_set_inbound_capacity_msat(this.ptr, val);
534                 Reference.reachabilityFence(this);
535                 Reference.reachabilityFence(val);
536         }
537
538         /**
539          * The number of required confirmations on the funding transaction before the funding will be
540          * considered \"locked\". This number is selected by the channel fundee (i.e. us if
541          * [`is_outbound`] is *not* set), and can be selected for inbound channels with
542          * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
543          * [`ChannelHandshakeLimits::max_minimum_depth`].
544          * 
545          * This value will be `None` for outbound channels until the counterparty accepts the channel.
546          * 
547          * [`is_outbound`]: ChannelDetails::is_outbound
548          * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
549          * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
550          */
551         public Option_u32Z get_confirmations_required() {
552                 long ret = bindings.ChannelDetails_get_confirmations_required(this.ptr);
553                 Reference.reachabilityFence(this);
554                 if (ret >= 0 && ret <= 4096) { return null; }
555                 org.ldk.structs.Option_u32Z ret_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(ret);
556                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
557                 return ret_hu_conv;
558         }
559
560         /**
561          * The number of required confirmations on the funding transaction before the funding will be
562          * considered \"locked\". This number is selected by the channel fundee (i.e. us if
563          * [`is_outbound`] is *not* set), and can be selected for inbound channels with
564          * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
565          * [`ChannelHandshakeLimits::max_minimum_depth`].
566          * 
567          * This value will be `None` for outbound channels until the counterparty accepts the channel.
568          * 
569          * [`is_outbound`]: ChannelDetails::is_outbound
570          * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
571          * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
572          */
573         public void set_confirmations_required(org.ldk.structs.Option_u32Z val) {
574                 bindings.ChannelDetails_set_confirmations_required(this.ptr, val.ptr);
575                 Reference.reachabilityFence(this);
576                 Reference.reachabilityFence(val);
577                 if (this != null) { this.ptrs_to.add(val); };
578         }
579
580         /**
581          * The current number of confirmations on the funding transaction.
582          * 
583          * This value will be `None` for objects serialized with LDK versions prior to 0.0.113.
584          */
585         public Option_u32Z get_confirmations() {
586                 long ret = bindings.ChannelDetails_get_confirmations(this.ptr);
587                 Reference.reachabilityFence(this);
588                 if (ret >= 0 && ret <= 4096) { return null; }
589                 org.ldk.structs.Option_u32Z ret_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(ret);
590                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
591                 return ret_hu_conv;
592         }
593
594         /**
595          * The current number of confirmations on the funding transaction.
596          * 
597          * This value will be `None` for objects serialized with LDK versions prior to 0.0.113.
598          */
599         public void set_confirmations(org.ldk.structs.Option_u32Z val) {
600                 bindings.ChannelDetails_set_confirmations(this.ptr, val.ptr);
601                 Reference.reachabilityFence(this);
602                 Reference.reachabilityFence(val);
603                 if (this != null) { this.ptrs_to.add(val); };
604         }
605
606         /**
607          * The number of blocks (after our commitment transaction confirms) that we will need to wait
608          * until we can claim our funds after we force-close the channel. During this time our
609          * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
610          * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
611          * time to claim our non-HTLC-encumbered funds.
612          * 
613          * This value will be `None` for outbound channels until the counterparty accepts the channel.
614          */
615         public Option_u16Z get_force_close_spend_delay() {
616                 long ret = bindings.ChannelDetails_get_force_close_spend_delay(this.ptr);
617                 Reference.reachabilityFence(this);
618                 if (ret >= 0 && ret <= 4096) { return null; }
619                 org.ldk.structs.Option_u16Z ret_hu_conv = org.ldk.structs.Option_u16Z.constr_from_ptr(ret);
620                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
621                 return ret_hu_conv;
622         }
623
624         /**
625          * The number of blocks (after our commitment transaction confirms) that we will need to wait
626          * until we can claim our funds after we force-close the channel. During this time our
627          * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
628          * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
629          * time to claim our non-HTLC-encumbered funds.
630          * 
631          * This value will be `None` for outbound channels until the counterparty accepts the channel.
632          */
633         public void set_force_close_spend_delay(org.ldk.structs.Option_u16Z val) {
634                 bindings.ChannelDetails_set_force_close_spend_delay(this.ptr, val.ptr);
635                 Reference.reachabilityFence(this);
636                 Reference.reachabilityFence(val);
637                 if (this != null) { this.ptrs_to.add(val); };
638         }
639
640         /**
641          * True if the channel was initiated (and thus funded) by us.
642          */
643         public boolean get_is_outbound() {
644                 boolean ret = bindings.ChannelDetails_get_is_outbound(this.ptr);
645                 Reference.reachabilityFence(this);
646                 return ret;
647         }
648
649         /**
650          * True if the channel was initiated (and thus funded) by us.
651          */
652         public void set_is_outbound(boolean val) {
653                 bindings.ChannelDetails_set_is_outbound(this.ptr, val);
654                 Reference.reachabilityFence(this);
655                 Reference.reachabilityFence(val);
656         }
657
658         /**
659          * True if the channel is confirmed, channel_ready messages have been exchanged, and the
660          * channel is not currently being shut down. `channel_ready` message exchange implies the
661          * required confirmation count has been reached (and we were connected to the peer at some
662          * point after the funding transaction received enough confirmations). The required
663          * confirmation count is provided in [`confirmations_required`].
664          * 
665          * [`confirmations_required`]: ChannelDetails::confirmations_required
666          */
667         public boolean get_is_channel_ready() {
668                 boolean ret = bindings.ChannelDetails_get_is_channel_ready(this.ptr);
669                 Reference.reachabilityFence(this);
670                 return ret;
671         }
672
673         /**
674          * True if the channel is confirmed, channel_ready messages have been exchanged, and the
675          * channel is not currently being shut down. `channel_ready` message exchange implies the
676          * required confirmation count has been reached (and we were connected to the peer at some
677          * point after the funding transaction received enough confirmations). The required
678          * confirmation count is provided in [`confirmations_required`].
679          * 
680          * [`confirmations_required`]: ChannelDetails::confirmations_required
681          */
682         public void set_is_channel_ready(boolean val) {
683                 bindings.ChannelDetails_set_is_channel_ready(this.ptr, val);
684                 Reference.reachabilityFence(this);
685                 Reference.reachabilityFence(val);
686         }
687
688         /**
689          * The stage of the channel's shutdown.
690          * `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116.
691          * 
692          * Returns a copy of the field.
693          */
694         public Option_ChannelShutdownStateZ get_channel_shutdown_state() {
695                 long ret = bindings.ChannelDetails_get_channel_shutdown_state(this.ptr);
696                 Reference.reachabilityFence(this);
697                 if (ret >= 0 && ret <= 4096) { return null; }
698                 org.ldk.structs.Option_ChannelShutdownStateZ ret_hu_conv = org.ldk.structs.Option_ChannelShutdownStateZ.constr_from_ptr(ret);
699                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
700                 return ret_hu_conv;
701         }
702
703         /**
704          * The stage of the channel's shutdown.
705          * `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116.
706          */
707         public void set_channel_shutdown_state(org.ldk.structs.Option_ChannelShutdownStateZ val) {
708                 bindings.ChannelDetails_set_channel_shutdown_state(this.ptr, val.ptr);
709                 Reference.reachabilityFence(this);
710                 Reference.reachabilityFence(val);
711                 if (this != null) { this.ptrs_to.add(val); };
712         }
713
714         /**
715          * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
716          * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
717          * 
718          * This is a strict superset of `is_channel_ready`.
719          */
720         public boolean get_is_usable() {
721                 boolean ret = bindings.ChannelDetails_get_is_usable(this.ptr);
722                 Reference.reachabilityFence(this);
723                 return ret;
724         }
725
726         /**
727          * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b)
728          * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
729          * 
730          * This is a strict superset of `is_channel_ready`.
731          */
732         public void set_is_usable(boolean val) {
733                 bindings.ChannelDetails_set_is_usable(this.ptr, val);
734                 Reference.reachabilityFence(this);
735                 Reference.reachabilityFence(val);
736         }
737
738         /**
739          * True if this channel is (or will be) publicly-announced.
740          */
741         public boolean get_is_public() {
742                 boolean ret = bindings.ChannelDetails_get_is_public(this.ptr);
743                 Reference.reachabilityFence(this);
744                 return ret;
745         }
746
747         /**
748          * True if this channel is (or will be) publicly-announced.
749          */
750         public void set_is_public(boolean val) {
751                 bindings.ChannelDetails_set_is_public(this.ptr, val);
752                 Reference.reachabilityFence(this);
753                 Reference.reachabilityFence(val);
754         }
755
756         /**
757          * The smallest value HTLC (in msat) we will accept, for this channel. This field
758          * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
759          */
760         public Option_u64Z get_inbound_htlc_minimum_msat() {
761                 long ret = bindings.ChannelDetails_get_inbound_htlc_minimum_msat(this.ptr);
762                 Reference.reachabilityFence(this);
763                 if (ret >= 0 && ret <= 4096) { return null; }
764                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
765                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
766                 return ret_hu_conv;
767         }
768
769         /**
770          * The smallest value HTLC (in msat) we will accept, for this channel. This field
771          * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107
772          */
773         public void set_inbound_htlc_minimum_msat(org.ldk.structs.Option_u64Z val) {
774                 bindings.ChannelDetails_set_inbound_htlc_minimum_msat(this.ptr, val.ptr);
775                 Reference.reachabilityFence(this);
776                 Reference.reachabilityFence(val);
777                 if (this != null) { this.ptrs_to.add(val); };
778         }
779
780         /**
781          * The largest value HTLC (in msat) we currently will accept, for this channel.
782          */
783         public Option_u64Z get_inbound_htlc_maximum_msat() {
784                 long ret = bindings.ChannelDetails_get_inbound_htlc_maximum_msat(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                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
789                 return ret_hu_conv;
790         }
791
792         /**
793          * The largest value HTLC (in msat) we currently will accept, for this channel.
794          */
795         public void set_inbound_htlc_maximum_msat(org.ldk.structs.Option_u64Z val) {
796                 bindings.ChannelDetails_set_inbound_htlc_maximum_msat(this.ptr, val.ptr);
797                 Reference.reachabilityFence(this);
798                 Reference.reachabilityFence(val);
799                 if (this != null) { this.ptrs_to.add(val); };
800         }
801
802         /**
803          * Set of configurable parameters that affect channel operation.
804          * 
805          * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
806          * 
807          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
808          */
809         @Nullable
810         public ChannelConfig get_config() {
811                 long ret = bindings.ChannelDetails_get_config(this.ptr);
812                 Reference.reachabilityFence(this);
813                 if (ret >= 0 && ret <= 4096) { return null; }
814                 org.ldk.structs.ChannelConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelConfig(null, ret); }
815                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
816                 return ret_hu_conv;
817         }
818
819         /**
820          * Set of configurable parameters that affect channel operation.
821          * 
822          * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109.
823          * 
824          * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
825          */
826         public void set_config(@Nullable org.ldk.structs.ChannelConfig val) {
827                 bindings.ChannelDetails_set_config(this.ptr, val == null ? 0 : val.ptr);
828                 Reference.reachabilityFence(this);
829                 Reference.reachabilityFence(val);
830                 if (this != null) { this.ptrs_to.add(val); };
831         }
832
833         /**
834          * Constructs a new ChannelDetails given each field
835          * 
836          * Note that funding_txo_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
837          * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
838          * Note that config_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
839          */
840         public static ChannelDetails of(byte[] channel_id_arg, org.ldk.structs.ChannelCounterparty counterparty_arg, @Nullable org.ldk.structs.OutPoint funding_txo_arg, @Nullable org.ldk.structs.ChannelTypeFeatures channel_type_arg, org.ldk.structs.Option_u64Z short_channel_id_arg, org.ldk.structs.Option_u64Z outbound_scid_alias_arg, org.ldk.structs.Option_u64Z inbound_scid_alias_arg, long channel_value_satoshis_arg, org.ldk.structs.Option_u64Z unspendable_punishment_reserve_arg, org.ldk.util.UInt128 user_channel_id_arg, org.ldk.structs.Option_u32Z feerate_sat_per_1000_weight_arg, long balance_msat_arg, long outbound_capacity_msat_arg, long next_outbound_htlc_limit_msat_arg, long next_outbound_htlc_minimum_msat_arg, long inbound_capacity_msat_arg, org.ldk.structs.Option_u32Z confirmations_required_arg, org.ldk.structs.Option_u32Z confirmations_arg, org.ldk.structs.Option_u16Z force_close_spend_delay_arg, boolean is_outbound_arg, boolean is_channel_ready_arg, org.ldk.structs.Option_ChannelShutdownStateZ channel_shutdown_state_arg, boolean is_usable_arg, boolean is_public_arg, org.ldk.structs.Option_u64Z inbound_htlc_minimum_msat_arg, org.ldk.structs.Option_u64Z inbound_htlc_maximum_msat_arg, @Nullable org.ldk.structs.ChannelConfig config_arg) {
841                 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.getLEBytes(), feerate_sat_per_1000_weight_arg.ptr, balance_msat_arg, outbound_capacity_msat_arg, next_outbound_htlc_limit_msat_arg, next_outbound_htlc_minimum_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg.ptr, confirmations_arg.ptr, force_close_spend_delay_arg.ptr, is_outbound_arg, is_channel_ready_arg, channel_shutdown_state_arg.ptr, 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);
842                 Reference.reachabilityFence(channel_id_arg);
843                 Reference.reachabilityFence(counterparty_arg);
844                 Reference.reachabilityFence(funding_txo_arg);
845                 Reference.reachabilityFence(channel_type_arg);
846                 Reference.reachabilityFence(short_channel_id_arg);
847                 Reference.reachabilityFence(outbound_scid_alias_arg);
848                 Reference.reachabilityFence(inbound_scid_alias_arg);
849                 Reference.reachabilityFence(channel_value_satoshis_arg);
850                 Reference.reachabilityFence(unspendable_punishment_reserve_arg);
851                 Reference.reachabilityFence(user_channel_id_arg);
852                 Reference.reachabilityFence(feerate_sat_per_1000_weight_arg);
853                 Reference.reachabilityFence(balance_msat_arg);
854                 Reference.reachabilityFence(outbound_capacity_msat_arg);
855                 Reference.reachabilityFence(next_outbound_htlc_limit_msat_arg);
856                 Reference.reachabilityFence(next_outbound_htlc_minimum_msat_arg);
857                 Reference.reachabilityFence(inbound_capacity_msat_arg);
858                 Reference.reachabilityFence(confirmations_required_arg);
859                 Reference.reachabilityFence(confirmations_arg);
860                 Reference.reachabilityFence(force_close_spend_delay_arg);
861                 Reference.reachabilityFence(is_outbound_arg);
862                 Reference.reachabilityFence(is_channel_ready_arg);
863                 Reference.reachabilityFence(channel_shutdown_state_arg);
864                 Reference.reachabilityFence(is_usable_arg);
865                 Reference.reachabilityFence(is_public_arg);
866                 Reference.reachabilityFence(inbound_htlc_minimum_msat_arg);
867                 Reference.reachabilityFence(inbound_htlc_maximum_msat_arg);
868                 Reference.reachabilityFence(config_arg);
869                 if (ret >= 0 && ret <= 4096) { return null; }
870                 org.ldk.structs.ChannelDetails ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelDetails(null, ret); }
871                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
872                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(counterparty_arg); };
873                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(funding_txo_arg); };
874                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_type_arg); };
875                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(short_channel_id_arg); };
876                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(outbound_scid_alias_arg); };
877                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(inbound_scid_alias_arg); };
878                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(unspendable_punishment_reserve_arg); };
879                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(feerate_sat_per_1000_weight_arg); };
880                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(confirmations_required_arg); };
881                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(confirmations_arg); };
882                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(force_close_spend_delay_arg); };
883                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_shutdown_state_arg); };
884                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(inbound_htlc_minimum_msat_arg); };
885                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(inbound_htlc_maximum_msat_arg); };
886                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(config_arg); };
887                 return ret_hu_conv;
888         }
889
890         long clone_ptr() {
891                 long ret = bindings.ChannelDetails_clone_ptr(this.ptr);
892                 Reference.reachabilityFence(this);
893                 return ret;
894         }
895
896         /**
897          * Creates a copy of the ChannelDetails
898          */
899         public ChannelDetails clone() {
900                 long ret = bindings.ChannelDetails_clone(this.ptr);
901                 Reference.reachabilityFence(this);
902                 if (ret >= 0 && ret <= 4096) { return null; }
903                 org.ldk.structs.ChannelDetails ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelDetails(null, ret); }
904                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
905                 return ret_hu_conv;
906         }
907
908         /**
909          * Gets the current SCID which should be used to identify this channel for inbound payments.
910          * This should be used for providing invoice hints or in any other context where our
911          * counterparty will forward a payment to us.
912          * 
913          * This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the
914          * [`ChannelDetails::short_channel_id`]. See those for more information.
915          */
916         public Option_u64Z get_inbound_payment_scid() {
917                 long ret = bindings.ChannelDetails_get_inbound_payment_scid(this.ptr);
918                 Reference.reachabilityFence(this);
919                 if (ret >= 0 && ret <= 4096) { return null; }
920                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
921                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
922                 return ret_hu_conv;
923         }
924
925         /**
926          * Gets the current SCID which should be used to identify this channel for outbound payments.
927          * This should be used in [`Route`]s to describe the first hop or in other contexts where
928          * we're sending or forwarding a payment outbound over this channel.
929          * 
930          * This is either the [`ChannelDetails::short_channel_id`], if set, or the
931          * [`ChannelDetails::outbound_scid_alias`]. See those for more information.
932          */
933         public Option_u64Z get_outbound_payment_scid() {
934                 long ret = bindings.ChannelDetails_get_outbound_payment_scid(this.ptr);
935                 Reference.reachabilityFence(this);
936                 if (ret >= 0 && ret <= 4096) { return null; }
937                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
938                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
939                 return ret_hu_conv;
940         }
941
942         /**
943          * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read
944          */
945         public byte[] write() {
946                 byte[] ret = bindings.ChannelDetails_write(this.ptr);
947                 Reference.reachabilityFence(this);
948                 return ret;
949         }
950
951         /**
952          * Read a ChannelDetails from a byte array, created by ChannelDetails_write
953          */
954         public static Result_ChannelDetailsDecodeErrorZ read(byte[] ser) {
955                 long ret = bindings.ChannelDetails_read(ser);
956                 Reference.reachabilityFence(ser);
957                 if (ret >= 0 && ret <= 4096) { return null; }
958                 Result_ChannelDetailsDecodeErrorZ ret_hu_conv = Result_ChannelDetailsDecodeErrorZ.constr_from_ptr(ret);
959                 return ret_hu_conv;
960         }
961
962 }