]> git.bitcoin.ninja Git - ldk-java/blob - src/main/java/org/ldk/structs/ChannelDetails.java
Merge pull request #94 from TheBlueMatt/main
[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                 ChannelCounterparty ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new 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 & ~1);
64                 Reference.reachabilityFence(this);
65                 Reference.reachabilityFence(val);
66         }
67
68         /**
69          * The Channel's funding transaction output, if we've negotiated the funding transaction with
70          * our counterparty already.
71          * 
72          * Note that, if this has been set, `channel_id` will be equivalent to
73          * `funding_txo.unwrap().to_channel_id()`.
74          * 
75          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
76          */
77         @Nullable
78         public OutPoint get_funding_txo() {
79                 long ret = bindings.ChannelDetails_get_funding_txo(this.ptr);
80                 Reference.reachabilityFence(this);
81                 if (ret >= 0 && ret <= 4096) { return null; }
82                 OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new OutPoint(null, ret); }
83                 ret_hu_conv.ptrs_to.add(this);
84                 return ret_hu_conv;
85         }
86
87         /**
88          * The Channel's funding transaction output, if we've negotiated the funding transaction with
89          * our counterparty already.
90          * 
91          * Note that, if this has been set, `channel_id` will be equivalent to
92          * `funding_txo.unwrap().to_channel_id()`.
93          * 
94          * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
95          */
96         public void set_funding_txo(@Nullable OutPoint val) {
97                 bindings.ChannelDetails_set_funding_txo(this.ptr, val == null ? 0 : val.ptr & ~1);
98                 Reference.reachabilityFence(this);
99                 Reference.reachabilityFence(val);
100         }
101
102         /**
103          * The features which this channel operates with. See individual features for more info.
104          * 
105          * `None` until negotiation completes and the channel type is finalized.
106          * 
107          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
108          */
109         @Nullable
110         public ChannelTypeFeatures get_channel_type() {
111                 long ret = bindings.ChannelDetails_get_channel_type(this.ptr);
112                 Reference.reachabilityFence(this);
113                 if (ret >= 0 && ret <= 4096) { return null; }
114                 ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelTypeFeatures(null, ret); }
115                 ret_hu_conv.ptrs_to.add(this);
116                 return ret_hu_conv;
117         }
118
119         /**
120          * The features which this channel operates with. See individual features for more info.
121          * 
122          * `None` until negotiation completes and the channel type is finalized.
123          * 
124          * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
125          */
126         public void set_channel_type(@Nullable ChannelTypeFeatures val) {
127                 bindings.ChannelDetails_set_channel_type(this.ptr, val == null ? 0 : val.ptr & ~1);
128                 Reference.reachabilityFence(this);
129                 Reference.reachabilityFence(val);
130         }
131
132         /**
133          * The position of the funding transaction in the chain. None if the funding transaction has
134          * not yet been confirmed and the channel fully opened.
135          * 
136          * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
137          * payments instead of this. See [`get_inbound_payment_scid`].
138          * 
139          * [`inbound_scid_alias`]: Self::inbound_scid_alias
140          * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
141          */
142         public Option_u64Z get_short_channel_id() {
143                 long ret = bindings.ChannelDetails_get_short_channel_id(this.ptr);
144                 Reference.reachabilityFence(this);
145                 if (ret >= 0 && ret <= 4096) { return null; }
146                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
147                 ret_hu_conv.ptrs_to.add(this);
148                 return ret_hu_conv;
149         }
150
151         /**
152          * The position of the funding transaction in the chain. None if the funding transaction has
153          * not yet been confirmed and the channel fully opened.
154          * 
155          * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound
156          * payments instead of this. See [`get_inbound_payment_scid`].
157          * 
158          * [`inbound_scid_alias`]: Self::inbound_scid_alias
159          * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid
160          */
161         public void set_short_channel_id(Option_u64Z val) {
162                 bindings.ChannelDetails_set_short_channel_id(this.ptr, val.ptr);
163                 Reference.reachabilityFence(this);
164                 Reference.reachabilityFence(val);
165         }
166
167         /**
168          * An optional [`short_channel_id`] alias for this channel, randomly generated by our
169          * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
170          * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
171          * when they see a payment to be routed to us.
172          * 
173          * Our counterparty may choose to rotate this value at any time, though will always recognize
174          * previous values for inbound payment forwarding.
175          * 
176          * [`short_channel_id`]: Self::short_channel_id
177          */
178         public Option_u64Z get_inbound_scid_alias() {
179                 long ret = bindings.ChannelDetails_get_inbound_scid_alias(this.ptr);
180                 Reference.reachabilityFence(this);
181                 if (ret >= 0 && ret <= 4096) { return null; }
182                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
183                 ret_hu_conv.ptrs_to.add(this);
184                 return ret_hu_conv;
185         }
186
187         /**
188          * An optional [`short_channel_id`] alias for this channel, randomly generated by our
189          * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our
190          * counterparty will recognize the alias provided here in place of the [`short_channel_id`]
191          * when they see a payment to be routed to us.
192          * 
193          * Our counterparty may choose to rotate this value at any time, though will always recognize
194          * previous values for inbound payment forwarding.
195          * 
196          * [`short_channel_id`]: Self::short_channel_id
197          */
198         public void set_inbound_scid_alias(Option_u64Z val) {
199                 bindings.ChannelDetails_set_inbound_scid_alias(this.ptr, val.ptr);
200                 Reference.reachabilityFence(this);
201                 Reference.reachabilityFence(val);
202         }
203
204         /**
205          * The value, in satoshis, of this channel as appears in the funding output
206          */
207         public long get_channel_value_satoshis() {
208                 long ret = bindings.ChannelDetails_get_channel_value_satoshis(this.ptr);
209                 Reference.reachabilityFence(this);
210                 return ret;
211         }
212
213         /**
214          * The value, in satoshis, of this channel as appears in the funding output
215          */
216         public void set_channel_value_satoshis(long val) {
217                 bindings.ChannelDetails_set_channel_value_satoshis(this.ptr, val);
218                 Reference.reachabilityFence(this);
219                 Reference.reachabilityFence(val);
220         }
221
222         /**
223          * The value, in satoshis, that must always be held in the channel for us. This value ensures
224          * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
225          * this value on chain.
226          * 
227          * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
228          * 
229          * This value will be `None` for outbound channels until the counterparty accepts the channel.
230          * 
231          * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
232          */
233         public Option_u64Z get_unspendable_punishment_reserve() {
234                 long ret = bindings.ChannelDetails_get_unspendable_punishment_reserve(this.ptr);
235                 Reference.reachabilityFence(this);
236                 if (ret >= 0 && ret <= 4096) { return null; }
237                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
238                 ret_hu_conv.ptrs_to.add(this);
239                 return ret_hu_conv;
240         }
241
242         /**
243          * The value, in satoshis, that must always be held in the channel for us. This value ensures
244          * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
245          * this value on chain.
246          * 
247          * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
248          * 
249          * This value will be `None` for outbound channels until the counterparty accepts the channel.
250          * 
251          * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
252          */
253         public void set_unspendable_punishment_reserve(Option_u64Z val) {
254                 bindings.ChannelDetails_set_unspendable_punishment_reserve(this.ptr, val.ptr);
255                 Reference.reachabilityFence(this);
256                 Reference.reachabilityFence(val);
257         }
258
259         /**
260          * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
261          */
262         public long get_user_channel_id() {
263                 long ret = bindings.ChannelDetails_get_user_channel_id(this.ptr);
264                 Reference.reachabilityFence(this);
265                 return ret;
266         }
267
268         /**
269          * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound.
270          */
271         public void set_user_channel_id(long val) {
272                 bindings.ChannelDetails_set_user_channel_id(this.ptr, val);
273                 Reference.reachabilityFence(this);
274                 Reference.reachabilityFence(val);
275         }
276
277         /**
278          * Our total balance.  This is the amount we would get if we close the channel.
279          * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
280          * amount is not likely to be recoverable on close.
281          * 
282          * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
283          * balance is not available for inclusion in new outbound HTLCs). This further does not include
284          * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
285          * This does not consider any on-chain fees.
286          * 
287          * See also [`ChannelDetails::outbound_capacity_msat`]
288          */
289         public long get_balance_msat() {
290                 long ret = bindings.ChannelDetails_get_balance_msat(this.ptr);
291                 Reference.reachabilityFence(this);
292                 return ret;
293         }
294
295         /**
296          * Our total balance.  This is the amount we would get if we close the channel.
297          * This value is not exact. Due to various in-flight changes and feerate changes, exactly this
298          * amount is not likely to be recoverable on close.
299          * 
300          * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose
301          * balance is not available for inclusion in new outbound HTLCs). This further does not include
302          * any pending outgoing HTLCs which are awaiting some other resolution to be sent.
303          * This does not consider any on-chain fees.
304          * 
305          * See also [`ChannelDetails::outbound_capacity_msat`]
306          */
307         public void set_balance_msat(long val) {
308                 bindings.ChannelDetails_set_balance_msat(this.ptr, val);
309                 Reference.reachabilityFence(this);
310                 Reference.reachabilityFence(val);
311         }
312
313         /**
314          * The available outbound capacity for sending HTLCs to the remote peer. This does not include
315          * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
316          * available for inclusion in new outbound HTLCs). This further does not include any pending
317          * outgoing HTLCs which are awaiting some other resolution to be sent.
318          * 
319          * See also [`ChannelDetails::balance_msat`]
320          * 
321          * This value is not exact. Due to various in-flight changes, feerate changes, and our
322          * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
323          * should be able to spend nearly this amount.
324          */
325         public long get_outbound_capacity_msat() {
326                 long ret = bindings.ChannelDetails_get_outbound_capacity_msat(this.ptr);
327                 Reference.reachabilityFence(this);
328                 return ret;
329         }
330
331         /**
332          * The available outbound capacity for sending HTLCs to the remote peer. This does not include
333          * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
334          * available for inclusion in new outbound HTLCs). This further does not include any pending
335          * outgoing HTLCs which are awaiting some other resolution to be sent.
336          * 
337          * See also [`ChannelDetails::balance_msat`]
338          * 
339          * This value is not exact. Due to various in-flight changes, feerate changes, and our
340          * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
341          * should be able to spend nearly this amount.
342          */
343         public void set_outbound_capacity_msat(long val) {
344                 bindings.ChannelDetails_set_outbound_capacity_msat(this.ptr, val);
345                 Reference.reachabilityFence(this);
346                 Reference.reachabilityFence(val);
347         }
348
349         /**
350          * The available inbound capacity for the remote peer to send HTLCs to us. This does not
351          * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
352          * available for inclusion in new inbound HTLCs).
353          * Note that there are some corner cases not fully handled here, so the actual available
354          * inbound capacity may be slightly higher than this.
355          * 
356          * This value is not exact. Due to various in-flight changes, feerate changes, and our
357          * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
358          * However, our counterparty should be able to spend nearly this amount.
359          */
360         public long get_inbound_capacity_msat() {
361                 long ret = bindings.ChannelDetails_get_inbound_capacity_msat(this.ptr);
362                 Reference.reachabilityFence(this);
363                 return ret;
364         }
365
366         /**
367          * The available inbound capacity for the remote peer to send HTLCs to us. This does not
368          * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not
369          * available for inclusion in new inbound HTLCs).
370          * Note that there are some corner cases not fully handled here, so the actual available
371          * inbound capacity may be slightly higher than this.
372          * 
373          * This value is not exact. Due to various in-flight changes, feerate changes, and our
374          * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
375          * However, our counterparty should be able to spend nearly this amount.
376          */
377         public void set_inbound_capacity_msat(long val) {
378                 bindings.ChannelDetails_set_inbound_capacity_msat(this.ptr, val);
379                 Reference.reachabilityFence(this);
380                 Reference.reachabilityFence(val);
381         }
382
383         /**
384          * The number of required confirmations on the funding transaction before the funding will be
385          * considered \"locked\". This number is selected by the channel fundee (i.e. us if
386          * [`is_outbound`] is *not* set), and can be selected for inbound channels with
387          * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
388          * [`ChannelHandshakeLimits::max_minimum_depth`].
389          * 
390          * This value will be `None` for outbound channels until the counterparty accepts the channel.
391          * 
392          * [`is_outbound`]: ChannelDetails::is_outbound
393          * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
394          * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
395          */
396         public Option_u32Z get_confirmations_required() {
397                 long ret = bindings.ChannelDetails_get_confirmations_required(this.ptr);
398                 Reference.reachabilityFence(this);
399                 if (ret >= 0 && ret <= 4096) { return null; }
400                 org.ldk.structs.Option_u32Z ret_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(ret);
401                 ret_hu_conv.ptrs_to.add(this);
402                 return ret_hu_conv;
403         }
404
405         /**
406          * The number of required confirmations on the funding transaction before the funding will be
407          * considered \"locked\". This number is selected by the channel fundee (i.e. us if
408          * [`is_outbound`] is *not* set), and can be selected for inbound channels with
409          * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
410          * [`ChannelHandshakeLimits::max_minimum_depth`].
411          * 
412          * This value will be `None` for outbound channels until the counterparty accepts the channel.
413          * 
414          * [`is_outbound`]: ChannelDetails::is_outbound
415          * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
416          * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
417          */
418         public void set_confirmations_required(Option_u32Z val) {
419                 bindings.ChannelDetails_set_confirmations_required(this.ptr, val.ptr);
420                 Reference.reachabilityFence(this);
421                 Reference.reachabilityFence(val);
422         }
423
424         /**
425          * The number of blocks (after our commitment transaction confirms) that we will need to wait
426          * until we can claim our funds after we force-close the channel. During this time our
427          * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
428          * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
429          * time to claim our non-HTLC-encumbered funds.
430          * 
431          * This value will be `None` for outbound channels until the counterparty accepts the channel.
432          */
433         public Option_u16Z get_force_close_spend_delay() {
434                 long ret = bindings.ChannelDetails_get_force_close_spend_delay(this.ptr);
435                 Reference.reachabilityFence(this);
436                 if (ret >= 0 && ret <= 4096) { return null; }
437                 org.ldk.structs.Option_u16Z ret_hu_conv = org.ldk.structs.Option_u16Z.constr_from_ptr(ret);
438                 ret_hu_conv.ptrs_to.add(this);
439                 return ret_hu_conv;
440         }
441
442         /**
443          * The number of blocks (after our commitment transaction confirms) that we will need to wait
444          * until we can claim our funds after we force-close the channel. During this time our
445          * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
446          * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
447          * time to claim our non-HTLC-encumbered funds.
448          * 
449          * This value will be `None` for outbound channels until the counterparty accepts the channel.
450          */
451         public void set_force_close_spend_delay(Option_u16Z val) {
452                 bindings.ChannelDetails_set_force_close_spend_delay(this.ptr, val.ptr);
453                 Reference.reachabilityFence(this);
454                 Reference.reachabilityFence(val);
455         }
456
457         /**
458          * True if the channel was initiated (and thus funded) by us.
459          */
460         public boolean get_is_outbound() {
461                 boolean ret = bindings.ChannelDetails_get_is_outbound(this.ptr);
462                 Reference.reachabilityFence(this);
463                 return ret;
464         }
465
466         /**
467          * True if the channel was initiated (and thus funded) by us.
468          */
469         public void set_is_outbound(boolean val) {
470                 bindings.ChannelDetails_set_is_outbound(this.ptr, val);
471                 Reference.reachabilityFence(this);
472                 Reference.reachabilityFence(val);
473         }
474
475         /**
476          * True if the channel is confirmed, funding_locked messages have been exchanged, and the
477          * channel is not currently being shut down. `funding_locked` message exchange implies the
478          * required confirmation count has been reached (and we were connected to the peer at some
479          * point after the funding transaction received enough confirmations). The required
480          * confirmation count is provided in [`confirmations_required`].
481          * 
482          * [`confirmations_required`]: ChannelDetails::confirmations_required
483          */
484         public boolean get_is_funding_locked() {
485                 boolean ret = bindings.ChannelDetails_get_is_funding_locked(this.ptr);
486                 Reference.reachabilityFence(this);
487                 return ret;
488         }
489
490         /**
491          * True if the channel is confirmed, funding_locked messages have been exchanged, and the
492          * channel is not currently being shut down. `funding_locked` message exchange implies the
493          * required confirmation count has been reached (and we were connected to the peer at some
494          * point after the funding transaction received enough confirmations). The required
495          * confirmation count is provided in [`confirmations_required`].
496          * 
497          * [`confirmations_required`]: ChannelDetails::confirmations_required
498          */
499         public void set_is_funding_locked(boolean val) {
500                 bindings.ChannelDetails_set_is_funding_locked(this.ptr, val);
501                 Reference.reachabilityFence(this);
502                 Reference.reachabilityFence(val);
503         }
504
505         /**
506          * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
507          * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
508          * 
509          * This is a strict superset of `is_funding_locked`.
510          */
511         public boolean get_is_usable() {
512                 boolean ret = bindings.ChannelDetails_get_is_usable(this.ptr);
513                 Reference.reachabilityFence(this);
514                 return ret;
515         }
516
517         /**
518          * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
519          * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
520          * 
521          * This is a strict superset of `is_funding_locked`.
522          */
523         public void set_is_usable(boolean val) {
524                 bindings.ChannelDetails_set_is_usable(this.ptr, val);
525                 Reference.reachabilityFence(this);
526                 Reference.reachabilityFence(val);
527         }
528
529         /**
530          * True if this channel is (or will be) publicly-announced.
531          */
532         public boolean get_is_public() {
533                 boolean ret = bindings.ChannelDetails_get_is_public(this.ptr);
534                 Reference.reachabilityFence(this);
535                 return ret;
536         }
537
538         /**
539          * True if this channel is (or will be) publicly-announced.
540          */
541         public void set_is_public(boolean val) {
542                 bindings.ChannelDetails_set_is_public(this.ptr, val);
543                 Reference.reachabilityFence(this);
544                 Reference.reachabilityFence(val);
545         }
546
547         /**
548          * Constructs a new ChannelDetails given each field
549          */
550         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 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 inbound_capacity_msat_arg, Option_u32Z confirmations_required_arg, Option_u16Z force_close_spend_delay_arg, boolean is_outbound_arg, boolean is_funding_locked_arg, boolean is_usable_arg, boolean is_public_arg) {
551                 long ret = bindings.ChannelDetails_new(InternalUtils.check_arr_len(channel_id_arg, 32), counterparty_arg == null ? 0 : counterparty_arg.ptr & ~1, funding_txo_arg == null ? 0 : funding_txo_arg.ptr & ~1, channel_type_arg == null ? 0 : channel_type_arg.ptr & ~1, short_channel_id_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, inbound_capacity_msat_arg, confirmations_required_arg.ptr, force_close_spend_delay_arg.ptr, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg);
552                 Reference.reachabilityFence(channel_id_arg);
553                 Reference.reachabilityFence(counterparty_arg);
554                 Reference.reachabilityFence(funding_txo_arg);
555                 Reference.reachabilityFence(channel_type_arg);
556                 Reference.reachabilityFence(short_channel_id_arg);
557                 Reference.reachabilityFence(inbound_scid_alias_arg);
558                 Reference.reachabilityFence(channel_value_satoshis_arg);
559                 Reference.reachabilityFence(unspendable_punishment_reserve_arg);
560                 Reference.reachabilityFence(user_channel_id_arg);
561                 Reference.reachabilityFence(balance_msat_arg);
562                 Reference.reachabilityFence(outbound_capacity_msat_arg);
563                 Reference.reachabilityFence(inbound_capacity_msat_arg);
564                 Reference.reachabilityFence(confirmations_required_arg);
565                 Reference.reachabilityFence(force_close_spend_delay_arg);
566                 Reference.reachabilityFence(is_outbound_arg);
567                 Reference.reachabilityFence(is_funding_locked_arg);
568                 Reference.reachabilityFence(is_usable_arg);
569                 Reference.reachabilityFence(is_public_arg);
570                 if (ret >= 0 && ret <= 4096) { return null; }
571                 ChannelDetails ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelDetails(null, ret); }
572                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
573                 return ret_hu_conv;
574         }
575
576         long clone_ptr() {
577                 long ret = bindings.ChannelDetails_clone_ptr(this.ptr);
578                 Reference.reachabilityFence(this);
579                 return ret;
580         }
581
582         /**
583          * Creates a copy of the ChannelDetails
584          */
585         public ChannelDetails clone() {
586                 long ret = bindings.ChannelDetails_clone(this.ptr);
587                 Reference.reachabilityFence(this);
588                 if (ret >= 0 && ret <= 4096) { return null; }
589                 ChannelDetails ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelDetails(null, ret); }
590                 ret_hu_conv.ptrs_to.add(this);
591                 return ret_hu_conv;
592         }
593
594         /**
595          * Gets the current SCID which should be used to identify this channel for inbound payments.
596          * This should be used for providing invoice hints or in any other context where our
597          * counterparty will forward a payment to us.
598          * 
599          * This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the
600          * [`ChannelDetails::short_channel_id`]. See those for more information.
601          */
602         public Option_u64Z get_inbound_payment_scid() {
603                 long ret = bindings.ChannelDetails_get_inbound_payment_scid(this.ptr);
604                 Reference.reachabilityFence(this);
605                 if (ret >= 0 && ret <= 4096) { return null; }
606                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
607                 ret_hu_conv.ptrs_to.add(this);
608                 return ret_hu_conv;
609         }
610
611         /**
612          * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read
613          */
614         public byte[] write() {
615                 byte[] ret = bindings.ChannelDetails_write(this.ptr);
616                 Reference.reachabilityFence(this);
617                 return ret;
618         }
619
620         /**
621          * Read a ChannelDetails from a byte array, created by ChannelDetails_write
622          */
623         public static Result_ChannelDetailsDecodeErrorZ read(byte[] ser) {
624                 long ret = bindings.ChannelDetails_read(ser);
625                 Reference.reachabilityFence(ser);
626                 if (ret >= 0 && ret <= 4096) { return null; }
627                 Result_ChannelDetailsDecodeErrorZ ret_hu_conv = Result_ChannelDetailsDecodeErrorZ.constr_from_ptr(ret);
628                 return ret_hu_conv;
629         }
630
631 }