Update auto-generated bindings to LDK v0.0.99
[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
8
9 /**
10  * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
11  */
12 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
13 public class ChannelDetails extends CommonBase {
14         ChannelDetails(Object _dummy, long ptr) { super(ptr); }
15         @Override @SuppressWarnings("deprecation")
16         protected void finalize() throws Throwable {
17                 super.finalize();
18                 if (ptr != 0) { bindings.ChannelDetails_free(ptr); }
19         }
20
21         /**
22          * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
23          * thereafter this is the txid of the funding transaction xor the funding transaction output).
24          * Note that this means this value is *not* persistent - it can change once during the
25          * lifetime of the channel.
26          */
27         public byte[] get_channel_id() {
28                 byte[] ret = bindings.ChannelDetails_get_channel_id(this.ptr);
29                 return ret;
30         }
31
32         /**
33          * The channel's ID (prior to funding transaction generation, this is a random 32 bytes,
34          * thereafter this is the txid of the funding transaction xor the funding transaction output).
35          * Note that this means this value is *not* persistent - it can change once during the
36          * lifetime of the channel.
37          */
38         public void set_channel_id(byte[] val) {
39                 bindings.ChannelDetails_set_channel_id(this.ptr, 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                 ChannelCounterparty ret_hu_conv = new ChannelCounterparty(null, ret);
48                 ret_hu_conv.ptrs_to.add(this);
49                 return ret_hu_conv;
50         }
51
52         /**
53          * Parameters which apply to our counterparty. See individual fields for more information.
54          */
55         public void set_counterparty(ChannelCounterparty val) {
56                 bindings.ChannelDetails_set_counterparty(this.ptr, val == null ? 0 : val.ptr & ~1);
57                 this.ptrs_to.add(val);
58         }
59
60         /**
61          * The Channel's funding transaction output, if we've negotiated the funding transaction with
62          * our counterparty already.
63          * 
64          * Note that, if this has been set, `channel_id` will be equivalent to
65          * `funding_txo.unwrap().to_channel_id()`.
66          */
67         public OutPoint get_funding_txo() {
68                 long ret = bindings.ChannelDetails_get_funding_txo(this.ptr);
69                 OutPoint ret_hu_conv = new OutPoint(null, ret);
70                 ret_hu_conv.ptrs_to.add(this);
71                 return ret_hu_conv;
72         }
73
74         /**
75          * The Channel's funding transaction output, if we've negotiated the funding transaction with
76          * our counterparty already.
77          * 
78          * Note that, if this has been set, `channel_id` will be equivalent to
79          * `funding_txo.unwrap().to_channel_id()`.
80          */
81         public void set_funding_txo(OutPoint val) {
82                 bindings.ChannelDetails_set_funding_txo(this.ptr, val == null ? 0 : val.ptr & ~1);
83                 this.ptrs_to.add(val);
84         }
85
86         /**
87          * The position of the funding transaction in the chain. None if the funding transaction has
88          * not yet been confirmed and the channel fully opened.
89          */
90         public Option_u64Z get_short_channel_id() {
91                 long ret = bindings.ChannelDetails_get_short_channel_id(this.ptr);
92                 Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret);
93                 ret_hu_conv.ptrs_to.add(this);
94                 return ret_hu_conv;
95         }
96
97         /**
98          * The position of the funding transaction in the chain. None if the funding transaction has
99          * not yet been confirmed and the channel fully opened.
100          */
101         public void set_short_channel_id(Option_u64Z val) {
102                 bindings.ChannelDetails_set_short_channel_id(this.ptr, val.ptr);
103         }
104
105         /**
106          * The value, in satoshis, of this channel as appears in the funding output
107          */
108         public long get_channel_value_satoshis() {
109                 long ret = bindings.ChannelDetails_get_channel_value_satoshis(this.ptr);
110                 return ret;
111         }
112
113         /**
114          * The value, in satoshis, of this channel as appears in the funding output
115          */
116         public void set_channel_value_satoshis(long val) {
117                 bindings.ChannelDetails_set_channel_value_satoshis(this.ptr, val);
118         }
119
120         /**
121          * The value, in satoshis, that must always be held in the channel for us. This value ensures
122          * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
123          * this value on chain.
124          * 
125          * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
126          * 
127          * This value will be `None` for outbound channels until the counterparty accepts the channel.
128          * 
129          * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
130          */
131         public Option_u64Z get_unspendable_punishment_reserve() {
132                 long ret = bindings.ChannelDetails_get_unspendable_punishment_reserve(this.ptr);
133                 Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret);
134                 ret_hu_conv.ptrs_to.add(this);
135                 return ret_hu_conv;
136         }
137
138         /**
139          * The value, in satoshis, that must always be held in the channel for us. This value ensures
140          * that if we broadcast a revoked state, our counterparty can punish us by claiming at least
141          * this value on chain.
142          * 
143          * This value is not included in [`outbound_capacity_msat`] as it can never be spent.
144          * 
145          * This value will be `None` for outbound channels until the counterparty accepts the channel.
146          * 
147          * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat
148          */
149         public void set_unspendable_punishment_reserve(Option_u64Z val) {
150                 bindings.ChannelDetails_set_unspendable_punishment_reserve(this.ptr, val.ptr);
151         }
152
153         /**
154          * The user_id passed in to create_channel, or 0 if the channel was inbound.
155          */
156         public long get_user_id() {
157                 long ret = bindings.ChannelDetails_get_user_id(this.ptr);
158                 return ret;
159         }
160
161         /**
162          * The user_id passed in to create_channel, or 0 if the channel was inbound.
163          */
164         public void set_user_id(long val) {
165                 bindings.ChannelDetails_set_user_id(this.ptr, val);
166         }
167
168         /**
169          * The available outbound capacity for sending HTLCs to the remote peer. This does not include
170          * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
171          * available for inclusion in new outbound HTLCs). This further does not include any pending
172          * outgoing HTLCs which are awaiting some other resolution to be sent.
173          * 
174          * This value is not exact. Due to various in-flight changes, feerate changes, and our
175          * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
176          * should be able to spend nearly this amount.
177          */
178         public long get_outbound_capacity_msat() {
179                 long ret = bindings.ChannelDetails_get_outbound_capacity_msat(this.ptr);
180                 return ret;
181         }
182
183         /**
184          * The available outbound capacity for sending HTLCs to the remote peer. This does not include
185          * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
186          * available for inclusion in new outbound HTLCs). This further does not include any pending
187          * outgoing HTLCs which are awaiting some other resolution to be sent.
188          * 
189          * This value is not exact. Due to various in-flight changes, feerate changes, and our
190          * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we
191          * should be able to spend nearly this amount.
192          */
193         public void set_outbound_capacity_msat(long val) {
194                 bindings.ChannelDetails_set_outbound_capacity_msat(this.ptr, val);
195         }
196
197         /**
198          * The available inbound capacity for the remote peer to send HTLCs to us. This does not
199          * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
200          * available for inclusion in new inbound HTLCs).
201          * Note that there are some corner cases not fully handled here, so the actual available
202          * inbound capacity may be slightly higher than this.
203          * 
204          * This value is not exact. Due to various in-flight changes, feerate changes, and our
205          * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
206          * However, our counterparty should be able to spend nearly this amount.
207          */
208         public long get_inbound_capacity_msat() {
209                 long ret = bindings.ChannelDetails_get_inbound_capacity_msat(this.ptr);
210                 return ret;
211         }
212
213         /**
214          * The available inbound capacity for the remote peer to send HTLCs to us. This does not
215          * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
216          * available for inclusion in new inbound HTLCs).
217          * Note that there are some corner cases not fully handled here, so the actual available
218          * inbound capacity may be slightly higher than this.
219          * 
220          * This value is not exact. Due to various in-flight changes, feerate changes, and our
221          * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable.
222          * However, our counterparty should be able to spend nearly this amount.
223          */
224         public void set_inbound_capacity_msat(long val) {
225                 bindings.ChannelDetails_set_inbound_capacity_msat(this.ptr, val);
226         }
227
228         /**
229          * The number of required confirmations on the funding transaction before the funding will be
230          * considered \"locked\". This number is selected by the channel fundee (i.e. us if
231          * [`is_outbound`] is *not* set), and can be selected for inbound channels with
232          * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
233          * [`ChannelHandshakeLimits::max_minimum_depth`].
234          * 
235          * This value will be `None` for outbound channels until the counterparty accepts the channel.
236          * 
237          * [`is_outbound`]: ChannelDetails::is_outbound
238          * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
239          * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
240          */
241         public Option_u32Z get_confirmations_required() {
242                 long ret = bindings.ChannelDetails_get_confirmations_required(this.ptr);
243                 Option_u32Z ret_hu_conv = Option_u32Z.constr_from_ptr(ret);
244                 ret_hu_conv.ptrs_to.add(this);
245                 return ret_hu_conv;
246         }
247
248         /**
249          * The number of required confirmations on the funding transaction before the funding will be
250          * considered \"locked\". This number is selected by the channel fundee (i.e. us if
251          * [`is_outbound`] is *not* set), and can be selected for inbound channels with
252          * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with
253          * [`ChannelHandshakeLimits::max_minimum_depth`].
254          * 
255          * This value will be `None` for outbound channels until the counterparty accepts the channel.
256          * 
257          * [`is_outbound`]: ChannelDetails::is_outbound
258          * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth
259          * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth
260          */
261         public void set_confirmations_required(Option_u32Z val) {
262                 bindings.ChannelDetails_set_confirmations_required(this.ptr, val.ptr);
263         }
264
265         /**
266          * The number of blocks (after our commitment transaction confirms) that we will need to wait
267          * until we can claim our funds after we force-close the channel. During this time our
268          * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
269          * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
270          * time to claim our non-HTLC-encumbered funds.
271          * 
272          * This value will be `None` for outbound channels until the counterparty accepts the channel.
273          */
274         public Option_u16Z get_force_close_spend_delay() {
275                 long ret = bindings.ChannelDetails_get_force_close_spend_delay(this.ptr);
276                 Option_u16Z ret_hu_conv = Option_u16Z.constr_from_ptr(ret);
277                 ret_hu_conv.ptrs_to.add(this);
278                 return ret_hu_conv;
279         }
280
281         /**
282          * The number of blocks (after our commitment transaction confirms) that we will need to wait
283          * until we can claim our funds after we force-close the channel. During this time our
284          * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty
285          * force-closes the channel and broadcasts a commitment transaction we do not have to wait any
286          * time to claim our non-HTLC-encumbered funds.
287          * 
288          * This value will be `None` for outbound channels until the counterparty accepts the channel.
289          */
290         public void set_force_close_spend_delay(Option_u16Z val) {
291                 bindings.ChannelDetails_set_force_close_spend_delay(this.ptr, val.ptr);
292         }
293
294         /**
295          * True if the channel was initiated (and thus funded) by us.
296          */
297         public boolean get_is_outbound() {
298                 boolean ret = bindings.ChannelDetails_get_is_outbound(this.ptr);
299                 return ret;
300         }
301
302         /**
303          * True if the channel was initiated (and thus funded) by us.
304          */
305         public void set_is_outbound(boolean val) {
306                 bindings.ChannelDetails_set_is_outbound(this.ptr, val);
307         }
308
309         /**
310          * True if the channel is confirmed, funding_locked messages have been exchanged, and the
311          * channel is not currently being shut down. `funding_locked` message exchange implies the
312          * required confirmation count has been reached (and we were connected to the peer at some
313          * point after the funding transaction received enough confirmations). The required
314          * confirmation count is provided in [`confirmations_required`].
315          * 
316          * [`confirmations_required`]: ChannelDetails::confirmations_required
317          */
318         public boolean get_is_funding_locked() {
319                 boolean ret = bindings.ChannelDetails_get_is_funding_locked(this.ptr);
320                 return ret;
321         }
322
323         /**
324          * True if the channel is confirmed, funding_locked messages have been exchanged, and the
325          * channel is not currently being shut down. `funding_locked` message exchange implies the
326          * required confirmation count has been reached (and we were connected to the peer at some
327          * point after the funding transaction received enough confirmations). The required
328          * confirmation count is provided in [`confirmations_required`].
329          * 
330          * [`confirmations_required`]: ChannelDetails::confirmations_required
331          */
332         public void set_is_funding_locked(boolean val) {
333                 bindings.ChannelDetails_set_is_funding_locked(this.ptr, val);
334         }
335
336         /**
337          * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
338          * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
339          * 
340          * This is a strict superset of `is_funding_locked`.
341          */
342         public boolean get_is_usable() {
343                 boolean ret = bindings.ChannelDetails_get_is_usable(this.ptr);
344                 return ret;
345         }
346
347         /**
348          * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
349          * the peer is connected, and (c) the channel is not currently negotiating a shutdown.
350          * 
351          * This is a strict superset of `is_funding_locked`.
352          */
353         public void set_is_usable(boolean val) {
354                 bindings.ChannelDetails_set_is_usable(this.ptr, val);
355         }
356
357         /**
358          * True if this channel is (or will be) publicly-announced.
359          */
360         public boolean get_is_public() {
361                 boolean ret = bindings.ChannelDetails_get_is_public(this.ptr);
362                 return ret;
363         }
364
365         /**
366          * True if this channel is (or will be) publicly-announced.
367          */
368         public void set_is_public(boolean val) {
369                 bindings.ChannelDetails_set_is_public(this.ptr, val);
370         }
371
372         /**
373          * Constructs a new ChannelDetails given each field
374          */
375         public static ChannelDetails of(byte[] channel_id_arg, ChannelCounterparty counterparty_arg, OutPoint funding_txo_arg, Option_u64Z short_channel_id_arg, long channel_value_satoshis_arg, Option_u64Z unspendable_punishment_reserve_arg, long user_id_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) {
376                 long ret = bindings.ChannelDetails_new(channel_id_arg, counterparty_arg == null ? 0 : counterparty_arg.ptr & ~1, funding_txo_arg == null ? 0 : funding_txo_arg.ptr & ~1, short_channel_id_arg.ptr, channel_value_satoshis_arg, unspendable_punishment_reserve_arg.ptr, user_id_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);
377                 ChannelDetails ret_hu_conv = new ChannelDetails(null, ret);
378                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
379                 ret_hu_conv.ptrs_to.add(counterparty_arg);
380                 ret_hu_conv.ptrs_to.add(funding_txo_arg);
381                 return ret_hu_conv;
382         }
383
384         /**
385          * Creates a copy of the ChannelDetails
386          */
387         public ChannelDetails clone() {
388                 long ret = bindings.ChannelDetails_clone(this.ptr);
389                 ChannelDetails ret_hu_conv = new ChannelDetails(null, ret);
390                 ret_hu_conv.ptrs_to.add(this);
391                 return ret_hu_conv;
392         }
393
394 }