[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / ChannelUpdateInfo.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8
9 /**
10  * Details about one direction of a channel as received within a [`ChannelUpdate`].
11  */
12 public class ChannelUpdateInfo : CommonBase {
13         internal ChannelUpdateInfo(object _dummy, long ptr) : base(ptr) { }
14         ~ChannelUpdateInfo() {
15                 if (ptr != 0) { bindings.ChannelUpdateInfo_free(ptr); }
16         }
17
18         /**
19          * When the last update to the channel direction was issued.
20          * Value is opaque, as set in the announcement.
21          */
22         public int get_last_update() {
23                 int ret = bindings.ChannelUpdateInfo_get_last_update(this.ptr);
24                 GC.KeepAlive(this);
25                 return ret;
26         }
27
28         /**
29          * When the last update to the channel direction was issued.
30          * Value is opaque, as set in the announcement.
31          */
32         public void set_last_update(int val) {
33                 bindings.ChannelUpdateInfo_set_last_update(this.ptr, val);
34                 GC.KeepAlive(this);
35                 GC.KeepAlive(val);
36         }
37
38         /**
39          * Whether the channel can be currently used for payments (in this one direction).
40          */
41         public bool get_enabled() {
42                 bool ret = bindings.ChannelUpdateInfo_get_enabled(this.ptr);
43                 GC.KeepAlive(this);
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(bool val) {
51                 bindings.ChannelUpdateInfo_set_enabled(this.ptr, val);
52                 GC.KeepAlive(this);
53                 GC.KeepAlive(val);
54         }
55
56         /**
57          * The difference in CLTV values that you must have when routing through this channel.
58          */
59         public short get_cltv_expiry_delta() {
60                 short ret = bindings.ChannelUpdateInfo_get_cltv_expiry_delta(this.ptr);
61                 GC.KeepAlive(this);
62                 return ret;
63         }
64
65         /**
66          * The difference in CLTV values that you must have when routing through this channel.
67          */
68         public void set_cltv_expiry_delta(short val) {
69                 bindings.ChannelUpdateInfo_set_cltv_expiry_delta(this.ptr, val);
70                 GC.KeepAlive(this);
71                 GC.KeepAlive(val);
72         }
73
74         /**
75          * The minimum value, which must be relayed to the next hop via the channel
76          */
77         public long get_htlc_minimum_msat() {
78                 long ret = bindings.ChannelUpdateInfo_get_htlc_minimum_msat(this.ptr);
79                 GC.KeepAlive(this);
80                 return ret;
81         }
82
83         /**
84          * The minimum value, which must be relayed to the next hop via the channel
85          */
86         public void set_htlc_minimum_msat(long val) {
87                 bindings.ChannelUpdateInfo_set_htlc_minimum_msat(this.ptr, val);
88                 GC.KeepAlive(this);
89                 GC.KeepAlive(val);
90         }
91
92         /**
93          * The maximum value which may be relayed to the next hop via the channel.
94          */
95         public long get_htlc_maximum_msat() {
96                 long ret = bindings.ChannelUpdateInfo_get_htlc_maximum_msat(this.ptr);
97                 GC.KeepAlive(this);
98                 return ret;
99         }
100
101         /**
102          * The maximum value which may be relayed to the next hop via the channel.
103          */
104         public void set_htlc_maximum_msat(long val) {
105                 bindings.ChannelUpdateInfo_set_htlc_maximum_msat(this.ptr, val);
106                 GC.KeepAlive(this);
107                 GC.KeepAlive(val);
108         }
109
110         /**
111          * Fees charged when the channel is used for routing
112          */
113         public RoutingFees get_fees() {
114                 long ret = bindings.ChannelUpdateInfo_get_fees(this.ptr);
115                 GC.KeepAlive(this);
116                 if (ret >= 0 && ret <= 4096) { return null; }
117                 org.ldk.structs.RoutingFees ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RoutingFees(null, ret); }
118                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
119                 return ret_hu_conv;
120         }
121
122         /**
123          * Fees charged when the channel is used for routing
124          */
125         public void set_fees(org.ldk.structs.RoutingFees val) {
126                 bindings.ChannelUpdateInfo_set_fees(this.ptr, val == null ? 0 : val.ptr);
127                 GC.KeepAlive(this);
128                 GC.KeepAlive(val);
129                 if (this != null) { this.ptrs_to.AddLast(val); };
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          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
139          */
140         public ChannelUpdate get_last_update_message() {
141                 long ret = bindings.ChannelUpdateInfo_get_last_update_message(this.ptr);
142                 GC.KeepAlive(this);
143                 if (ret >= 0 && ret <= 4096) { return null; }
144                 org.ldk.structs.ChannelUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelUpdate(null, ret); }
145                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
146                 return ret_hu_conv;
147         }
148
149         /**
150          * Most recent update for the channel received from the network
151          * Mostly redundant with the data we store in fields explicitly.
152          * Everything else is useful only for sending out for initial routing sync.
153          * Not stored if contains excess data to prevent DoS.
154          * 
155          * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
156          */
157         public void set_last_update_message(org.ldk.structs.ChannelUpdate val) {
158                 bindings.ChannelUpdateInfo_set_last_update_message(this.ptr, val == null ? 0 : val.ptr);
159                 GC.KeepAlive(this);
160                 GC.KeepAlive(val);
161                 if (this != null) { this.ptrs_to.AddLast(val); };
162         }
163
164         /**
165          * Constructs a new ChannelUpdateInfo given each field
166          * 
167          * Note that last_update_message_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
168          */
169         public static ChannelUpdateInfo of(int last_update_arg, bool enabled_arg, short cltv_expiry_delta_arg, long htlc_minimum_msat_arg, long htlc_maximum_msat_arg, org.ldk.structs.RoutingFees fees_arg, org.ldk.structs.ChannelUpdate last_update_message_arg) {
170                 long ret = bindings.ChannelUpdateInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, fees_arg == null ? 0 : fees_arg.ptr, last_update_message_arg == null ? 0 : last_update_message_arg.ptr);
171                 GC.KeepAlive(last_update_arg);
172                 GC.KeepAlive(enabled_arg);
173                 GC.KeepAlive(cltv_expiry_delta_arg);
174                 GC.KeepAlive(htlc_minimum_msat_arg);
175                 GC.KeepAlive(htlc_maximum_msat_arg);
176                 GC.KeepAlive(fees_arg);
177                 GC.KeepAlive(last_update_message_arg);
178                 if (ret >= 0 && ret <= 4096) { return null; }
179                 org.ldk.structs.ChannelUpdateInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelUpdateInfo(null, ret); }
180                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
181                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(fees_arg); };
182                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(last_update_message_arg); };
183                 return ret_hu_conv;
184         }
185
186         internal long clone_ptr() {
187                 long ret = bindings.ChannelUpdateInfo_clone_ptr(this.ptr);
188                 GC.KeepAlive(this);
189                 return ret;
190         }
191
192         /**
193          * Creates a copy of the ChannelUpdateInfo
194          */
195         public ChannelUpdateInfo clone() {
196                 long ret = bindings.ChannelUpdateInfo_clone(this.ptr);
197                 GC.KeepAlive(this);
198                 if (ret >= 0 && ret <= 4096) { return null; }
199                 org.ldk.structs.ChannelUpdateInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelUpdateInfo(null, ret); }
200                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
201                 return ret_hu_conv;
202         }
203
204         /**
205          * Checks if two ChannelUpdateInfos contain equal inner contents.
206          * This ignores pointers and is_owned flags and looks at the values in fields.
207          * Two objects with NULL inner values will be considered "equal" here.
208          */
209         public bool eq(org.ldk.structs.ChannelUpdateInfo b) {
210                 bool ret = bindings.ChannelUpdateInfo_eq(this.ptr, b == null ? 0 : b.ptr);
211                 GC.KeepAlive(this);
212                 GC.KeepAlive(b);
213                 if (this != null) { this.ptrs_to.AddLast(b); };
214                 return ret;
215         }
216
217         public override bool Equals(object o) {
218                 if (!(o is ChannelUpdateInfo)) return false;
219                 return this.eq((ChannelUpdateInfo)o);
220         }
221         /**
222          * Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read
223          */
224         public byte[] write() {
225                 long ret = bindings.ChannelUpdateInfo_write(this.ptr);
226                 GC.KeepAlive(this);
227                 if (ret >= 0 && ret <= 4096) { return null; }
228                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
229                 return ret_conv;
230         }
231
232         /**
233          * Read a ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write
234          */
235         public static Result_ChannelUpdateInfoDecodeErrorZ read(byte[] ser) {
236                 long ret = bindings.ChannelUpdateInfo_read(InternalUtils.encodeUint8Array(ser));
237                 GC.KeepAlive(ser);
238                 if (ret >= 0 && ret <= 4096) { return null; }
239                 Result_ChannelUpdateInfoDecodeErrorZ ret_hu_conv = Result_ChannelUpdateInfoDecodeErrorZ.constr_from_ptr(ret);
240                 return ret_hu_conv;
241         }
242
243 }
244 } } }