2f34454ccda21400ba7c215d01d63398ada02409
[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 node_id of our counterparty
44          */
45         public byte[] get_remote_network_id() {
46                 byte[] ret = bindings.ChannelDetails_get_remote_network_id(this.ptr);
47                 return ret;
48         }
49
50         /**
51          * The node_id of our counterparty
52          */
53         public void set_remote_network_id(byte[] val) {
54                 bindings.ChannelDetails_set_remote_network_id(this.ptr, val);
55         }
56
57         /**
58          * The Features the channel counterparty provided upon last connection.
59          * Useful for routing as it is the most up-to-date copy of the counterparty's features and
60          * many routing-relevant features are present in the init context.
61          */
62         public InitFeatures get_counterparty_features() {
63                 long ret = bindings.ChannelDetails_get_counterparty_features(this.ptr);
64                 InitFeatures ret_hu_conv = new InitFeatures(null, ret);
65                 ret_hu_conv.ptrs_to.add(this);
66                 return ret_hu_conv;
67         }
68
69         /**
70          * The Features the channel counterparty provided upon last connection.
71          * Useful for routing as it is the most up-to-date copy of the counterparty's features and
72          * many routing-relevant features are present in the init context.
73          */
74         public void set_counterparty_features(InitFeatures val) {
75                 bindings.ChannelDetails_set_counterparty_features(this.ptr, val == null ? 0 : val.ptr & ~1);
76                 this.ptrs_to.add(val);
77         }
78
79         /**
80          * The value, in satoshis, of this channel as appears in the funding output
81          */
82         public long get_channel_value_satoshis() {
83                 long ret = bindings.ChannelDetails_get_channel_value_satoshis(this.ptr);
84                 return ret;
85         }
86
87         /**
88          * The value, in satoshis, of this channel as appears in the funding output
89          */
90         public void set_channel_value_satoshis(long val) {
91                 bindings.ChannelDetails_set_channel_value_satoshis(this.ptr, val);
92         }
93
94         /**
95          * The user_id passed in to create_channel, or 0 if the channel was inbound.
96          */
97         public long get_user_id() {
98                 long ret = bindings.ChannelDetails_get_user_id(this.ptr);
99                 return ret;
100         }
101
102         /**
103          * The user_id passed in to create_channel, or 0 if the channel was inbound.
104          */
105         public void set_user_id(long val) {
106                 bindings.ChannelDetails_set_user_id(this.ptr, val);
107         }
108
109         /**
110          * The available outbound capacity for sending HTLCs to the remote peer. This does not include
111          * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
112          * available for inclusion in new outbound HTLCs). This further does not include any pending
113          * outgoing HTLCs which are awaiting some other resolution to be sent.
114          */
115         public long get_outbound_capacity_msat() {
116                 long ret = bindings.ChannelDetails_get_outbound_capacity_msat(this.ptr);
117                 return ret;
118         }
119
120         /**
121          * The available outbound capacity for sending HTLCs to the remote peer. This does not include
122          * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
123          * available for inclusion in new outbound HTLCs). This further does not include any pending
124          * outgoing HTLCs which are awaiting some other resolution to be sent.
125          */
126         public void set_outbound_capacity_msat(long val) {
127                 bindings.ChannelDetails_set_outbound_capacity_msat(this.ptr, val);
128         }
129
130         /**
131          * The available inbound capacity for the remote peer to send HTLCs to us. This does not
132          * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
133          * available for inclusion in new inbound HTLCs).
134          * Note that there are some corner cases not fully handled here, so the actual available
135          * inbound capacity may be slightly higher than this.
136          */
137         public long get_inbound_capacity_msat() {
138                 long ret = bindings.ChannelDetails_get_inbound_capacity_msat(this.ptr);
139                 return ret;
140         }
141
142         /**
143          * The available inbound capacity for the remote peer to send HTLCs to us. This does not
144          * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not
145          * available for inclusion in new inbound HTLCs).
146          * Note that there are some corner cases not fully handled here, so the actual available
147          * inbound capacity may be slightly higher than this.
148          */
149         public void set_inbound_capacity_msat(long val) {
150                 bindings.ChannelDetails_set_inbound_capacity_msat(this.ptr, val);
151         }
152
153         /**
154          * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
155          * the peer is connected, and (c) no monitor update failure is pending resolution.
156          */
157         public boolean get_is_live() {
158                 boolean ret = bindings.ChannelDetails_get_is_live(this.ptr);
159                 return ret;
160         }
161
162         /**
163          * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b)
164          * the peer is connected, and (c) no monitor update failure is pending resolution.
165          */
166         public void set_is_live(boolean val) {
167                 bindings.ChannelDetails_set_is_live(this.ptr, val);
168         }
169
170         /**
171          * Creates a copy of the ChannelDetails
172          */
173         public ChannelDetails clone() {
174                 long ret = bindings.ChannelDetails_clone(this.ptr);
175                 ChannelDetails ret_hu_conv = new ChannelDetails(null, ret);
176                 ret_hu_conv.ptrs_to.add(this);
177                 return ret_hu_conv;
178         }
179
180 }