ca79d4b251fcd27c6515f8f9eeb887553c5d8140
[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          * The Channel's funding transaction output, if we've negotiated the funding transaction with
44          * our counterparty already.
45          * 
46          * Note that, if this has been set, `channel_id` will be equivalent to
47          * `funding_txo.unwrap().to_channel_id()`.
48          */
49         public OutPoint get_funding_txo() {
50                 long ret = bindings.ChannelDetails_get_funding_txo(this.ptr);
51                 OutPoint ret_hu_conv = new OutPoint(null, ret);
52                 ret_hu_conv.ptrs_to.add(this);
53                 return ret_hu_conv;
54         }
55
56         /**
57          * The Channel's funding transaction output, if we've negotiated the funding transaction with
58          * our counterparty already.
59          * 
60          * Note that, if this has been set, `channel_id` will be equivalent to
61          * `funding_txo.unwrap().to_channel_id()`.
62          */
63         public void set_funding_txo(OutPoint val) {
64                 bindings.ChannelDetails_set_funding_txo(this.ptr, val == null ? 0 : val.ptr & ~1);
65                 this.ptrs_to.add(val);
66         }
67
68         /**
69          * The position of the funding transaction in the chain. None if the funding transaction has
70          * not yet been confirmed and the channel fully opened.
71          */
72         public Option_u64Z get_short_channel_id() {
73                 long ret = bindings.ChannelDetails_get_short_channel_id(this.ptr);
74                 Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret);
75                 ret_hu_conv.ptrs_to.add(this);
76                 return ret_hu_conv;
77         }
78
79         /**
80          * The position of the funding transaction in the chain. None if the funding transaction has
81          * not yet been confirmed and the channel fully opened.
82          */
83         public void set_short_channel_id(Option_u64Z val) {
84                 bindings.ChannelDetails_set_short_channel_id(this.ptr, val.ptr);
85         }
86
87         /**
88          * The node_id of our counterparty
89          */
90         public byte[] get_remote_network_id() {
91                 byte[] ret = bindings.ChannelDetails_get_remote_network_id(this.ptr);
92                 return ret;
93         }
94
95         /**
96          * The node_id of our counterparty
97          */
98         public void set_remote_network_id(byte[] val) {
99                 bindings.ChannelDetails_set_remote_network_id(this.ptr, val);
100         }
101
102         /**
103          * The Features the channel counterparty provided upon last connection.
104          * Useful for routing as it is the most up-to-date copy of the counterparty's features and
105          * many routing-relevant features are present in the init context.
106          */
107         public InitFeatures get_counterparty_features() {
108                 long ret = bindings.ChannelDetails_get_counterparty_features(this.ptr);
109                 InitFeatures ret_hu_conv = new InitFeatures(null, ret);
110                 ret_hu_conv.ptrs_to.add(this);
111                 return ret_hu_conv;
112         }
113
114         /**
115          * The Features the channel counterparty provided upon last connection.
116          * Useful for routing as it is the most up-to-date copy of the counterparty's features and
117          * many routing-relevant features are present in the init context.
118          */
119         public void set_counterparty_features(InitFeatures val) {
120                 bindings.ChannelDetails_set_counterparty_features(this.ptr, val == null ? 0 : val.ptr & ~1);
121                 this.ptrs_to.add(val);
122         }
123
124         /**
125          * The value, in satoshis, of this channel as appears in the funding output
126          */
127         public long get_channel_value_satoshis() {
128                 long ret = bindings.ChannelDetails_get_channel_value_satoshis(this.ptr);
129                 return ret;
130         }
131
132         /**
133          * The value, in satoshis, of this channel as appears in the funding output
134          */
135         public void set_channel_value_satoshis(long val) {
136                 bindings.ChannelDetails_set_channel_value_satoshis(this.ptr, val);
137         }
138
139         /**
140          * The user_id passed in to create_channel, or 0 if the channel was inbound.
141          */
142         public long get_user_id() {
143                 long ret = bindings.ChannelDetails_get_user_id(this.ptr);
144                 return ret;
145         }
146
147         /**
148          * The user_id passed in to create_channel, or 0 if the channel was inbound.
149          */
150         public void set_user_id(long val) {
151                 bindings.ChannelDetails_set_user_id(this.ptr, val);
152         }
153
154         /**
155          * The available outbound capacity for sending HTLCs to the remote peer. This does not include
156          * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
157          * available for inclusion in new outbound HTLCs). This further does not include any pending
158          * outgoing HTLCs which are awaiting some other resolution to be sent.
159          */
160         public long get_outbound_capacity_msat() {
161                 long ret = bindings.ChannelDetails_get_outbound_capacity_msat(this.ptr);
162                 return ret;
163         }
164
165         /**
166          * The available outbound capacity for sending HTLCs to the remote peer. This does not include
167          * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
168          * available for inclusion in new outbound HTLCs). This further does not include any pending
169          * outgoing HTLCs which are awaiting some other resolution to be sent.
170          */
171         public void set_outbound_capacity_msat(long val) {
172                 bindings.ChannelDetails_set_outbound_capacity_msat(this.ptr, val);
173         }
174
175         /**
176          * The available inbound capacity for the remote peer to send HTLCs to us. This does not
177          * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
178          * available for inclusion in new inbound HTLCs).
179          * Note that there are some corner cases not fully handled here, so the actual available
180          * inbound capacity may be slightly higher than this.
181          */
182         public long get_inbound_capacity_msat() {
183                 long ret = bindings.ChannelDetails_get_inbound_capacity_msat(this.ptr);
184                 return ret;
185         }
186
187         /**
188          * The available inbound capacity for the remote peer to send HTLCs to us. This does not
189          * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
190          * available for inclusion in new inbound HTLCs).
191          * Note that there are some corner cases not fully handled here, so the actual available
192          * inbound capacity may be slightly higher than this.
193          */
194         public void set_inbound_capacity_msat(long val) {
195                 bindings.ChannelDetails_set_inbound_capacity_msat(this.ptr, val);
196         }
197
198         /**
199          * True if the channel was initiated (and thus funded) by us.
200          */
201         public boolean get_is_outbound() {
202                 boolean ret = bindings.ChannelDetails_get_is_outbound(this.ptr);
203                 return ret;
204         }
205
206         /**
207          * True if the channel was initiated (and thus funded) by us.
208          */
209         public void set_is_outbound(boolean val) {
210                 bindings.ChannelDetails_set_is_outbound(this.ptr, val);
211         }
212
213         /**
214          * True if the channel is confirmed, funding_locked messages have been exchanged, and the
215          * channel is not currently being shut down. `funding_locked` message exchange implies the
216          * required confirmation count has been reached (and we were connected to the peer at some
217          * point after the funding transaction received enough confirmations).
218          */
219         public boolean get_is_funding_locked() {
220                 boolean ret = bindings.ChannelDetails_get_is_funding_locked(this.ptr);
221                 return ret;
222         }
223
224         /**
225          * True if the channel is confirmed, funding_locked messages have been exchanged, and the
226          * channel is not currently being shut down. `funding_locked` message exchange implies the
227          * required confirmation count has been reached (and we were connected to the peer at some
228          * point after the funding transaction received enough confirmations).
229          */
230         public void set_is_funding_locked(boolean val) {
231                 bindings.ChannelDetails_set_is_funding_locked(this.ptr, val);
232         }
233
234         /**
235          * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
236          * the peer is connected, (c) no monitor update failure is pending resolution, and (d) the
237          * channel is not currently negotiating a shutdown.
238          * 
239          * This is a strict superset of `is_funding_locked`.
240          */
241         public boolean get_is_usable() {
242                 boolean ret = bindings.ChannelDetails_get_is_usable(this.ptr);
243                 return ret;
244         }
245
246         /**
247          * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
248          * the peer is connected, (c) no monitor update failure is pending resolution, and (d) the
249          * channel is not currently negotiating a shutdown.
250          * 
251          * This is a strict superset of `is_funding_locked`.
252          */
253         public void set_is_usable(boolean val) {
254                 bindings.ChannelDetails_set_is_usable(this.ptr, val);
255         }
256
257         /**
258          * True if this channel is (or will be) publicly-announced.
259          */
260         public boolean get_is_public() {
261                 boolean ret = bindings.ChannelDetails_get_is_public(this.ptr);
262                 return ret;
263         }
264
265         /**
266          * True if this channel is (or will be) publicly-announced.
267          */
268         public void set_is_public(boolean val) {
269                 bindings.ChannelDetails_set_is_public(this.ptr, val);
270         }
271
272         /**
273          * Creates a copy of the ChannelDetails
274          */
275         public ChannelDetails clone() {
276                 long ret = bindings.ChannelDetails_clone(this.ptr);
277                 ChannelDetails ret_hu_conv = new ChannelDetails(null, ret);
278                 ret_hu_conv.ptrs_to.add(this);
279                 return ret_hu_conv;
280         }
281
282 }