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