Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / ChannelInfo.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 about a channel (both directions).
11  * Received within a channel announcement.
12  */
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class ChannelInfo extends CommonBase {
15         ChannelInfo(Object _dummy, long ptr) { super(ptr); }
16         @Override @SuppressWarnings("deprecation")
17         protected void finalize() throws Throwable {
18                 super.finalize();
19                 if (ptr != 0) { bindings.ChannelInfo_free(ptr); }
20         }
21
22         /**
23          * Protocol features of a channel communicated during its announcement
24          */
25         public ChannelFeatures get_features() {
26                 long ret = bindings.ChannelInfo_get_features(this.ptr);
27                 ChannelFeatures ret_hu_conv = new ChannelFeatures(null, ret);
28                 ret_hu_conv.ptrs_to.add(this);
29                 return ret_hu_conv;
30         }
31
32         /**
33          * Protocol features of a channel communicated during its announcement
34          */
35         public void set_features(ChannelFeatures val) {
36                 bindings.ChannelInfo_set_features(this.ptr, val == null ? 0 : val.ptr & ~1);
37                 this.ptrs_to.add(val);
38         }
39
40         /**
41          * Source node of the first direction of a channel
42          */
43         public byte[] get_node_one() {
44                 byte[] ret = bindings.ChannelInfo_get_node_one(this.ptr);
45                 return ret;
46         }
47
48         /**
49          * Source node of the first direction of a channel
50          */
51         public void set_node_one(byte[] val) {
52                 bindings.ChannelInfo_set_node_one(this.ptr, val);
53         }
54
55         /**
56          * Details about the first direction of a channel
57          */
58         public DirectionalChannelInfo get_one_to_two() {
59                 long ret = bindings.ChannelInfo_get_one_to_two(this.ptr);
60                 DirectionalChannelInfo ret_hu_conv = new DirectionalChannelInfo(null, ret);
61                 ret_hu_conv.ptrs_to.add(this);
62                 return ret_hu_conv;
63         }
64
65         /**
66          * Details about the first direction of a channel
67          */
68         public void set_one_to_two(DirectionalChannelInfo val) {
69                 bindings.ChannelInfo_set_one_to_two(this.ptr, val == null ? 0 : val.ptr & ~1);
70                 this.ptrs_to.add(val);
71         }
72
73         /**
74          * Source node of the second direction of a channel
75          */
76         public byte[] get_node_two() {
77                 byte[] ret = bindings.ChannelInfo_get_node_two(this.ptr);
78                 return ret;
79         }
80
81         /**
82          * Source node of the second direction of a channel
83          */
84         public void set_node_two(byte[] val) {
85                 bindings.ChannelInfo_set_node_two(this.ptr, val);
86         }
87
88         /**
89          * Details about the second direction of a channel
90          */
91         public DirectionalChannelInfo get_two_to_one() {
92                 long ret = bindings.ChannelInfo_get_two_to_one(this.ptr);
93                 DirectionalChannelInfo ret_hu_conv = new DirectionalChannelInfo(null, ret);
94                 ret_hu_conv.ptrs_to.add(this);
95                 return ret_hu_conv;
96         }
97
98         /**
99          * Details about the second direction of a channel
100          */
101         public void set_two_to_one(DirectionalChannelInfo val) {
102                 bindings.ChannelInfo_set_two_to_one(this.ptr, val == null ? 0 : val.ptr & ~1);
103                 this.ptrs_to.add(val);
104         }
105
106         /**
107          * The channel capacity as seen on-chain, if chain lookup is available.
108          */
109         public Option_u64Z get_capacity_sats() {
110                 long ret = bindings.ChannelInfo_get_capacity_sats(this.ptr);
111                 Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret);
112                 ret_hu_conv.ptrs_to.add(this);
113                 return ret_hu_conv;
114         }
115
116         /**
117          * The channel capacity as seen on-chain, if chain lookup is available.
118          */
119         public void set_capacity_sats(Option_u64Z val) {
120                 bindings.ChannelInfo_set_capacity_sats(this.ptr, val.ptr);
121         }
122
123         /**
124          * An initial announcement of the channel
125          * Mostly redundant with the data we store in fields explicitly.
126          * Everything else is useful only for sending out for initial routing sync.
127          * Not stored if contains excess data to prevent DoS.
128          */
129         public ChannelAnnouncement get_announcement_message() {
130                 long ret = bindings.ChannelInfo_get_announcement_message(this.ptr);
131                 ChannelAnnouncement ret_hu_conv = new ChannelAnnouncement(null, ret);
132                 ret_hu_conv.ptrs_to.add(this);
133                 return ret_hu_conv;
134         }
135
136         /**
137          * An initial announcement of the channel
138          * Mostly redundant with the data we store in fields explicitly.
139          * Everything else is useful only for sending out for initial routing sync.
140          * Not stored if contains excess data to prevent DoS.
141          */
142         public void set_announcement_message(ChannelAnnouncement val) {
143                 bindings.ChannelInfo_set_announcement_message(this.ptr, val == null ? 0 : val.ptr & ~1);
144                 this.ptrs_to.add(val);
145         }
146
147         /**
148          * Constructs a new ChannelInfo given each field
149          */
150         public static ChannelInfo constructor_new(ChannelFeatures features_arg, byte[] node_one_arg, DirectionalChannelInfo one_to_two_arg, byte[] node_two_arg, DirectionalChannelInfo two_to_one_arg, Option_u64Z capacity_sats_arg, ChannelAnnouncement announcement_message_arg) {
151                 long ret = bindings.ChannelInfo_new(features_arg == null ? 0 : features_arg.ptr & ~1, node_one_arg, one_to_two_arg == null ? 0 : one_to_two_arg.ptr & ~1, node_two_arg, two_to_one_arg == null ? 0 : two_to_one_arg.ptr & ~1, capacity_sats_arg.ptr, announcement_message_arg == null ? 0 : announcement_message_arg.ptr & ~1);
152                 ChannelInfo ret_hu_conv = new ChannelInfo(null, ret);
153                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
154                 ret_hu_conv.ptrs_to.add(features_arg);
155                 ret_hu_conv.ptrs_to.add(one_to_two_arg);
156                 ret_hu_conv.ptrs_to.add(two_to_one_arg);
157                 ret_hu_conv.ptrs_to.add(announcement_message_arg);
158                 return ret_hu_conv;
159         }
160
161         /**
162          * Creates a copy of the ChannelInfo
163          */
164         public ChannelInfo clone() {
165                 long ret = bindings.ChannelInfo_clone(this.ptr);
166                 ChannelInfo ret_hu_conv = new ChannelInfo(null, ret);
167                 ret_hu_conv.ptrs_to.add(this);
168                 return ret_hu_conv;
169         }
170
171         /**
172          * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read
173          */
174         public byte[] write() {
175                 byte[] ret = bindings.ChannelInfo_write(this.ptr);
176                 return ret;
177         }
178
179         /**
180          * Read a ChannelInfo from a byte array, created by ChannelInfo_write
181          */
182         public static Result_ChannelInfoDecodeErrorZ constructor_read(byte[] ser) {
183                 long ret = bindings.ChannelInfo_read(ser);
184                 Result_ChannelInfoDecodeErrorZ ret_hu_conv = Result_ChannelInfoDecodeErrorZ.constr_from_ptr(ret);
185                 return ret_hu_conv;
186         }
187
188 }