[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / RouteHop.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  * A hop in a route, and additional metadata about it. \"Hop\" is defined as a node and the channel
11  * that leads to it.
12  */
13 public class RouteHop : CommonBase {
14         internal RouteHop(object _dummy, long ptr) : base(ptr) { }
15         ~RouteHop() {
16                 if (ptr != 0) { bindings.RouteHop_free(ptr); }
17         }
18
19         /**
20          * The node_id of the node at this hop.
21          */
22         public byte[] get_pubkey() {
23                 long ret = bindings.RouteHop_get_pubkey(this.ptr);
24                 GC.KeepAlive(this);
25                 if (ret >= 0 && ret <= 4096) { return null; }
26                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
27                 return ret_conv;
28         }
29
30         /**
31          * The node_id of the node at this hop.
32          */
33         public void set_pubkey(byte[] val) {
34                 bindings.RouteHop_set_pubkey(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
35                 GC.KeepAlive(this);
36                 GC.KeepAlive(val);
37         }
38
39         /**
40          * The node_announcement features of the node at this hop. For the last hop, these may be
41          * amended to match the features present in the invoice this node generated.
42          */
43         public NodeFeatures get_node_features() {
44                 long ret = bindings.RouteHop_get_node_features(this.ptr);
45                 GC.KeepAlive(this);
46                 if (ret >= 0 && ret <= 4096) { return null; }
47                 org.ldk.structs.NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeFeatures(null, ret); }
48                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
49                 return ret_hu_conv;
50         }
51
52         /**
53          * The node_announcement features of the node at this hop. For the last hop, these may be
54          * amended to match the features present in the invoice this node generated.
55          */
56         public void set_node_features(org.ldk.structs.NodeFeatures val) {
57                 bindings.RouteHop_set_node_features(this.ptr, val == null ? 0 : val.ptr);
58                 GC.KeepAlive(this);
59                 GC.KeepAlive(val);
60                 if (this != null) { this.ptrs_to.AddLast(val); };
61         }
62
63         /**
64          * The channel that should be used from the previous hop to reach this node.
65          */
66         public long get_short_channel_id() {
67                 long ret = bindings.RouteHop_get_short_channel_id(this.ptr);
68                 GC.KeepAlive(this);
69                 return ret;
70         }
71
72         /**
73          * The channel that should be used from the previous hop to reach this node.
74          */
75         public void set_short_channel_id(long val) {
76                 bindings.RouteHop_set_short_channel_id(this.ptr, val);
77                 GC.KeepAlive(this);
78                 GC.KeepAlive(val);
79         }
80
81         /**
82          * The channel_announcement features of the channel that should be used from the previous hop
83          * to reach this node.
84          */
85         public ChannelFeatures get_channel_features() {
86                 long ret = bindings.RouteHop_get_channel_features(this.ptr);
87                 GC.KeepAlive(this);
88                 if (ret >= 0 && ret <= 4096) { return null; }
89                 org.ldk.structs.ChannelFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelFeatures(null, ret); }
90                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
91                 return ret_hu_conv;
92         }
93
94         /**
95          * The channel_announcement features of the channel that should be used from the previous hop
96          * to reach this node.
97          */
98         public void set_channel_features(org.ldk.structs.ChannelFeatures val) {
99                 bindings.RouteHop_set_channel_features(this.ptr, val == null ? 0 : val.ptr);
100                 GC.KeepAlive(this);
101                 GC.KeepAlive(val);
102                 if (this != null) { this.ptrs_to.AddLast(val); };
103         }
104
105         /**
106          * The fee taken on this hop (for paying for the use of the *next* channel in the path).
107          * If this is the last hop in [`Path::hops`]:
108          * if we're sending to a [`BlindedPath`], this is the fee paid for use of the entire blinded path
109          * otherwise, this is the full value of this [`Path`]'s part of the payment
110          * 
111          * [`BlindedPath`]: crate::blinded_path::BlindedPath
112          */
113         public long get_fee_msat() {
114                 long ret = bindings.RouteHop_get_fee_msat(this.ptr);
115                 GC.KeepAlive(this);
116                 return ret;
117         }
118
119         /**
120          * The fee taken on this hop (for paying for the use of the *next* channel in the path).
121          * If this is the last hop in [`Path::hops`]:
122          * if we're sending to a [`BlindedPath`], this is the fee paid for use of the entire blinded path
123          * otherwise, this is the full value of this [`Path`]'s part of the payment
124          * 
125          * [`BlindedPath`]: crate::blinded_path::BlindedPath
126          */
127         public void set_fee_msat(long val) {
128                 bindings.RouteHop_set_fee_msat(this.ptr, val);
129                 GC.KeepAlive(this);
130                 GC.KeepAlive(val);
131         }
132
133         /**
134          * The CLTV delta added for this hop.
135          * If this is the last hop in [`Path::hops`]:
136          * if we're sending to a [`BlindedPath`], this is the CLTV delta for the entire blinded path
137          * otherwise, this is the CLTV delta expected at the destination
138          * 
139          * [`BlindedPath`]: crate::blinded_path::BlindedPath
140          */
141         public int get_cltv_expiry_delta() {
142                 int ret = bindings.RouteHop_get_cltv_expiry_delta(this.ptr);
143                 GC.KeepAlive(this);
144                 return ret;
145         }
146
147         /**
148          * The CLTV delta added for this hop.
149          * If this is the last hop in [`Path::hops`]:
150          * if we're sending to a [`BlindedPath`], this is the CLTV delta for the entire blinded path
151          * otherwise, this is the CLTV delta expected at the destination
152          * 
153          * [`BlindedPath`]: crate::blinded_path::BlindedPath
154          */
155         public void set_cltv_expiry_delta(int val) {
156                 bindings.RouteHop_set_cltv_expiry_delta(this.ptr, val);
157                 GC.KeepAlive(this);
158                 GC.KeepAlive(val);
159         }
160
161         /**
162          * Indicates whether this hop is possibly announced in the public network graph.
163          * 
164          * Will be `true` if there is a possibility that the channel is publicly known, i.e., if we
165          * either know for sure it's announced in the public graph, or if any public channels exist
166          * for which the given `short_channel_id` could be an alias for. Will be `false` if we believe
167          * the channel to be unannounced.
168          * 
169          * Will be `true` for objects serialized with LDK version 0.0.116 and before.
170          */
171         public bool get_maybe_announced_channel() {
172                 bool ret = bindings.RouteHop_get_maybe_announced_channel(this.ptr);
173                 GC.KeepAlive(this);
174                 return ret;
175         }
176
177         /**
178          * Indicates whether this hop is possibly announced in the public network graph.
179          * 
180          * Will be `true` if there is a possibility that the channel is publicly known, i.e., if we
181          * either know for sure it's announced in the public graph, or if any public channels exist
182          * for which the given `short_channel_id` could be an alias for. Will be `false` if we believe
183          * the channel to be unannounced.
184          * 
185          * Will be `true` for objects serialized with LDK version 0.0.116 and before.
186          */
187         public void set_maybe_announced_channel(bool val) {
188                 bindings.RouteHop_set_maybe_announced_channel(this.ptr, val);
189                 GC.KeepAlive(this);
190                 GC.KeepAlive(val);
191         }
192
193         /**
194          * Constructs a new RouteHop given each field
195          */
196         public static RouteHop of(byte[] pubkey_arg, org.ldk.structs.NodeFeatures node_features_arg, long short_channel_id_arg, org.ldk.structs.ChannelFeatures channel_features_arg, long fee_msat_arg, int cltv_expiry_delta_arg, bool maybe_announced_channel_arg) {
197                 long ret = bindings.RouteHop_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(pubkey_arg, 33)), node_features_arg == null ? 0 : node_features_arg.ptr, short_channel_id_arg, channel_features_arg == null ? 0 : channel_features_arg.ptr, fee_msat_arg, cltv_expiry_delta_arg, maybe_announced_channel_arg);
198                 GC.KeepAlive(pubkey_arg);
199                 GC.KeepAlive(node_features_arg);
200                 GC.KeepAlive(short_channel_id_arg);
201                 GC.KeepAlive(channel_features_arg);
202                 GC.KeepAlive(fee_msat_arg);
203                 GC.KeepAlive(cltv_expiry_delta_arg);
204                 GC.KeepAlive(maybe_announced_channel_arg);
205                 if (ret >= 0 && ret <= 4096) { return null; }
206                 org.ldk.structs.RouteHop ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RouteHop(null, ret); }
207                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
208                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(node_features_arg); };
209                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_features_arg); };
210                 return ret_hu_conv;
211         }
212
213         internal long clone_ptr() {
214                 long ret = bindings.RouteHop_clone_ptr(this.ptr);
215                 GC.KeepAlive(this);
216                 return ret;
217         }
218
219         /**
220          * Creates a copy of the RouteHop
221          */
222         public RouteHop clone() {
223                 long ret = bindings.RouteHop_clone(this.ptr);
224                 GC.KeepAlive(this);
225                 if (ret >= 0 && ret <= 4096) { return null; }
226                 org.ldk.structs.RouteHop ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RouteHop(null, ret); }
227                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
228                 return ret_hu_conv;
229         }
230
231         /**
232          * Generates a non-cryptographic 64-bit hash of the RouteHop.
233          */
234         public long hash() {
235                 long ret = bindings.RouteHop_hash(this.ptr);
236                 GC.KeepAlive(this);
237                 return ret;
238         }
239
240         public override int GetHashCode() {
241                 return (int)this.hash();
242         }
243         /**
244          * Checks if two RouteHops contain equal inner contents.
245          * This ignores pointers and is_owned flags and looks at the values in fields.
246          * Two objects with NULL inner values will be considered "equal" here.
247          */
248         public bool eq(org.ldk.structs.RouteHop b) {
249                 bool ret = bindings.RouteHop_eq(this.ptr, b == null ? 0 : b.ptr);
250                 GC.KeepAlive(this);
251                 GC.KeepAlive(b);
252                 if (this != null) { this.ptrs_to.AddLast(b); };
253                 return ret;
254         }
255
256         public override bool Equals(object o) {
257                 if (!(o is RouteHop)) return false;
258                 return this.eq((RouteHop)o);
259         }
260         /**
261          * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
262          */
263         public byte[] write() {
264                 long ret = bindings.RouteHop_write(this.ptr);
265                 GC.KeepAlive(this);
266                 if (ret >= 0 && ret <= 4096) { return null; }
267                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
268                 return ret_conv;
269         }
270
271         /**
272          * Read a RouteHop from a byte array, created by RouteHop_write
273          */
274         public static Result_RouteHopDecodeErrorZ read(byte[] ser) {
275                 long ret = bindings.RouteHop_read(InternalUtils.encodeUint8Array(ser));
276                 GC.KeepAlive(ser);
277                 if (ret >= 0 && ret <= 4096) { return null; }
278                 Result_RouteHopDecodeErrorZ ret_hu_conv = Result_RouteHopDecodeErrorZ.constr_from_ptr(ret);
279                 return ret_hu_conv;
280         }
281
282 }
283 } } }