Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / DirectionalChannelInfo.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 one direction of a channel. Received
11  * within a channel update.
12  */
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class DirectionalChannelInfo extends CommonBase {
15         DirectionalChannelInfo(Object _dummy, long ptr) { super(ptr); }
16         @Override @SuppressWarnings("deprecation")
17         protected void finalize() throws Throwable {
18                 super.finalize();
19                 if (ptr != 0) { bindings.DirectionalChannelInfo_free(ptr); }
20         }
21
22         /**
23          * When the last update to the channel direction was issued.
24          * Value is opaque, as set in the announcement.
25          */
26         public int get_last_update() {
27                 int ret = bindings.DirectionalChannelInfo_get_last_update(this.ptr);
28                 return ret;
29         }
30
31         /**
32          * When the last update to the channel direction was issued.
33          * Value is opaque, as set in the announcement.
34          */
35         public void set_last_update(int val) {
36                 bindings.DirectionalChannelInfo_set_last_update(this.ptr, val);
37         }
38
39         /**
40          * Whether the channel can be currently used for payments (in this one direction).
41          */
42         public boolean get_enabled() {
43                 boolean ret = bindings.DirectionalChannelInfo_get_enabled(this.ptr);
44                 return ret;
45         }
46
47         /**
48          * Whether the channel can be currently used for payments (in this one direction).
49          */
50         public void set_enabled(boolean val) {
51                 bindings.DirectionalChannelInfo_set_enabled(this.ptr, val);
52         }
53
54         /**
55          * The difference in CLTV values that you must have when routing through this channel.
56          */
57         public short get_cltv_expiry_delta() {
58                 short ret = bindings.DirectionalChannelInfo_get_cltv_expiry_delta(this.ptr);
59                 return ret;
60         }
61
62         /**
63          * The difference in CLTV values that you must have when routing through this channel.
64          */
65         public void set_cltv_expiry_delta(short val) {
66                 bindings.DirectionalChannelInfo_set_cltv_expiry_delta(this.ptr, val);
67         }
68
69         /**
70          * The minimum value, which must be relayed to the next hop via the channel
71          */
72         public long get_htlc_minimum_msat() {
73                 long ret = bindings.DirectionalChannelInfo_get_htlc_minimum_msat(this.ptr);
74                 return ret;
75         }
76
77         /**
78          * The minimum value, which must be relayed to the next hop via the channel
79          */
80         public void set_htlc_minimum_msat(long val) {
81                 bindings.DirectionalChannelInfo_set_htlc_minimum_msat(this.ptr, val);
82         }
83
84         /**
85          * The maximum value which may be relayed to the next hop via the channel.
86          */
87         public Option_u64Z get_htlc_maximum_msat() {
88                 long ret = bindings.DirectionalChannelInfo_get_htlc_maximum_msat(this.ptr);
89                 Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret);
90                 ret_hu_conv.ptrs_to.add(this);
91                 return ret_hu_conv;
92         }
93
94         /**
95          * The maximum value which may be relayed to the next hop via the channel.
96          */
97         public void set_htlc_maximum_msat(Option_u64Z val) {
98                 bindings.DirectionalChannelInfo_set_htlc_maximum_msat(this.ptr, val.ptr);
99         }
100
101         /**
102          * Fees charged when the channel is used for routing
103          */
104         public RoutingFees get_fees() {
105                 long ret = bindings.DirectionalChannelInfo_get_fees(this.ptr);
106                 RoutingFees ret_hu_conv = new RoutingFees(null, ret);
107                 ret_hu_conv.ptrs_to.add(this);
108                 return ret_hu_conv;
109         }
110
111         /**
112          * Fees charged when the channel is used for routing
113          */
114         public void set_fees(RoutingFees val) {
115                 bindings.DirectionalChannelInfo_set_fees(this.ptr, val == null ? 0 : val.ptr & ~1);
116                 this.ptrs_to.add(val);
117         }
118
119         /**
120          * Most recent update for the channel received from the network
121          * Mostly redundant with the data we store in fields explicitly.
122          * Everything else is useful only for sending out for initial routing sync.
123          * Not stored if contains excess data to prevent DoS.
124          */
125         public ChannelUpdate get_last_update_message() {
126                 long ret = bindings.DirectionalChannelInfo_get_last_update_message(this.ptr);
127                 ChannelUpdate ret_hu_conv = new ChannelUpdate(null, ret);
128                 ret_hu_conv.ptrs_to.add(this);
129                 return ret_hu_conv;
130         }
131
132         /**
133          * Most recent update for the channel received from the network
134          * Mostly redundant with the data we store in fields explicitly.
135          * Everything else is useful only for sending out for initial routing sync.
136          * Not stored if contains excess data to prevent DoS.
137          */
138         public void set_last_update_message(ChannelUpdate val) {
139                 bindings.DirectionalChannelInfo_set_last_update_message(this.ptr, val == null ? 0 : val.ptr & ~1);
140                 this.ptrs_to.add(val);
141         }
142
143         /**
144          * Constructs a new DirectionalChannelInfo given each field
145          */
146         public static DirectionalChannelInfo constructor_new(int last_update_arg, boolean enabled_arg, short cltv_expiry_delta_arg, long htlc_minimum_msat_arg, Option_u64Z htlc_maximum_msat_arg, RoutingFees fees_arg, ChannelUpdate last_update_message_arg) {
147                 long ret = bindings.DirectionalChannelInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg.ptr, fees_arg == null ? 0 : fees_arg.ptr & ~1, last_update_message_arg == null ? 0 : last_update_message_arg.ptr & ~1);
148                 DirectionalChannelInfo ret_hu_conv = new DirectionalChannelInfo(null, ret);
149                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
150                 ret_hu_conv.ptrs_to.add(fees_arg);
151                 ret_hu_conv.ptrs_to.add(last_update_message_arg);
152                 return ret_hu_conv;
153         }
154
155         /**
156          * Creates a copy of the DirectionalChannelInfo
157          */
158         public DirectionalChannelInfo clone() {
159                 long ret = bindings.DirectionalChannelInfo_clone(this.ptr);
160                 DirectionalChannelInfo ret_hu_conv = new DirectionalChannelInfo(null, ret);
161                 ret_hu_conv.ptrs_to.add(this);
162                 return ret_hu_conv;
163         }
164
165         /**
166          * Serialize the DirectionalChannelInfo object into a byte array which can be read by DirectionalChannelInfo_read
167          */
168         public byte[] write() {
169                 byte[] ret = bindings.DirectionalChannelInfo_write(this.ptr);
170                 return ret;
171         }
172
173         /**
174          * Read a DirectionalChannelInfo from a byte array, created by DirectionalChannelInfo_write
175          */
176         public static Result_DirectionalChannelInfoDecodeErrorZ constructor_read(byte[] ser) {
177                 long ret = bindings.DirectionalChannelInfo_read(ser);
178                 Result_DirectionalChannelInfoDecodeErrorZ ret_hu_conv = Result_DirectionalChannelInfoDecodeErrorZ.constr_from_ptr(ret);
179                 return ret_hu_conv;
180         }
181
182 }