[C#] Update auto-generated files
[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                 byte[] ret = bindings.RouteHop_get_pubkey(this.ptr);
24                 GC.KeepAlive(this);
25                 return ret;
26         }
27
28         /**
29          * The node_id of the node at this hop.
30          */
31         public void set_pubkey(byte[] val) {
32                 bindings.RouteHop_set_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
33                 GC.KeepAlive(this);
34                 GC.KeepAlive(val);
35         }
36
37         /**
38          * The node_announcement features of the node at this hop. For the last hop, these may be
39          * amended to match the features present in the invoice this node generated.
40          */
41         public NodeFeatures get_node_features() {
42                 long ret = bindings.RouteHop_get_node_features(this.ptr);
43                 GC.KeepAlive(this);
44                 if (ret >= 0 && ret <= 4096) { return null; }
45                 org.ldk.structs.NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeFeatures(null, ret); }
46                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
47                 return ret_hu_conv;
48         }
49
50         /**
51          * The node_announcement features of the node at this hop. For the last hop, these may be
52          * amended to match the features present in the invoice this node generated.
53          */
54         public void set_node_features(org.ldk.structs.NodeFeatures val) {
55                 bindings.RouteHop_set_node_features(this.ptr, val == null ? 0 : val.ptr);
56                 GC.KeepAlive(this);
57                 GC.KeepAlive(val);
58                 if (this != null) { this.ptrs_to.AddLast(val); };
59         }
60
61         /**
62          * The channel that should be used from the previous hop to reach this node.
63          */
64         public long get_short_channel_id() {
65                 long ret = bindings.RouteHop_get_short_channel_id(this.ptr);
66                 GC.KeepAlive(this);
67                 return ret;
68         }
69
70         /**
71          * The channel that should be used from the previous hop to reach this node.
72          */
73         public void set_short_channel_id(long val) {
74                 bindings.RouteHop_set_short_channel_id(this.ptr, val);
75                 GC.KeepAlive(this);
76                 GC.KeepAlive(val);
77         }
78
79         /**
80          * The channel_announcement features of the channel that should be used from the previous hop
81          * to reach this node.
82          */
83         public ChannelFeatures get_channel_features() {
84                 long ret = bindings.RouteHop_get_channel_features(this.ptr);
85                 GC.KeepAlive(this);
86                 if (ret >= 0 && ret <= 4096) { return null; }
87                 org.ldk.structs.ChannelFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelFeatures(null, ret); }
88                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
89                 return ret_hu_conv;
90         }
91
92         /**
93          * The channel_announcement features of the channel that should be used from the previous hop
94          * to reach this node.
95          */
96         public void set_channel_features(org.ldk.structs.ChannelFeatures val) {
97                 bindings.RouteHop_set_channel_features(this.ptr, val == null ? 0 : val.ptr);
98                 GC.KeepAlive(this);
99                 GC.KeepAlive(val);
100                 if (this != null) { this.ptrs_to.AddLast(val); };
101         }
102
103         /**
104          * The fee taken on this hop (for paying for the use of the *next* channel in the path).
105          * If this is the last hop in [`Path::hops`]:
106          * if we're sending to a [`BlindedPath`], this is the fee paid for use of the entire blinded path
107          * otherwise, this is the full value of this [`Path`]'s part of the payment
108          * 
109          * [`BlindedPath`]: crate::blinded_path::BlindedPath
110          */
111         public long get_fee_msat() {
112                 long ret = bindings.RouteHop_get_fee_msat(this.ptr);
113                 GC.KeepAlive(this);
114                 return ret;
115         }
116
117         /**
118          * The fee taken on this hop (for paying for the use of the *next* channel in the path).
119          * If this is the last hop in [`Path::hops`]:
120          * if we're sending to a [`BlindedPath`], this is the fee paid for use of the entire blinded path
121          * otherwise, this is the full value of this [`Path`]'s part of the payment
122          * 
123          * [`BlindedPath`]: crate::blinded_path::BlindedPath
124          */
125         public void set_fee_msat(long val) {
126                 bindings.RouteHop_set_fee_msat(this.ptr, val);
127                 GC.KeepAlive(this);
128                 GC.KeepAlive(val);
129         }
130
131         /**
132          * The CLTV delta added for this hop.
133          * If this is the last hop in [`Path::hops`]:
134          * if we're sending to a [`BlindedPath`], this is the CLTV delta for the entire blinded path
135          * otherwise, this is the CLTV delta expected at the destination
136          * 
137          * [`BlindedPath`]: crate::blinded_path::BlindedPath
138          */
139         public int get_cltv_expiry_delta() {
140                 int ret = bindings.RouteHop_get_cltv_expiry_delta(this.ptr);
141                 GC.KeepAlive(this);
142                 return ret;
143         }
144
145         /**
146          * The CLTV delta added for this hop.
147          * If this is the last hop in [`Path::hops`]:
148          * if we're sending to a [`BlindedPath`], this is the CLTV delta for the entire blinded path
149          * otherwise, this is the CLTV delta expected at the destination
150          * 
151          * [`BlindedPath`]: crate::blinded_path::BlindedPath
152          */
153         public void set_cltv_expiry_delta(int val) {
154                 bindings.RouteHop_set_cltv_expiry_delta(this.ptr, val);
155                 GC.KeepAlive(this);
156                 GC.KeepAlive(val);
157         }
158
159         /**
160          * Constructs a new RouteHop given each field
161          */
162         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) {
163                 long ret = bindings.RouteHop_new(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);
164                 GC.KeepAlive(pubkey_arg);
165                 GC.KeepAlive(node_features_arg);
166                 GC.KeepAlive(short_channel_id_arg);
167                 GC.KeepAlive(channel_features_arg);
168                 GC.KeepAlive(fee_msat_arg);
169                 GC.KeepAlive(cltv_expiry_delta_arg);
170                 if (ret >= 0 && ret <= 4096) { return null; }
171                 org.ldk.structs.RouteHop ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RouteHop(null, ret); }
172                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
173                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(node_features_arg); };
174                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_features_arg); };
175                 return ret_hu_conv;
176         }
177
178         internal long clone_ptr() {
179                 long ret = bindings.RouteHop_clone_ptr(this.ptr);
180                 GC.KeepAlive(this);
181                 return ret;
182         }
183
184         /**
185          * Creates a copy of the RouteHop
186          */
187         public RouteHop clone() {
188                 long ret = bindings.RouteHop_clone(this.ptr);
189                 GC.KeepAlive(this);
190                 if (ret >= 0 && ret <= 4096) { return null; }
191                 org.ldk.structs.RouteHop ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RouteHop(null, ret); }
192                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
193                 return ret_hu_conv;
194         }
195
196         /**
197          * Generates a non-cryptographic 64-bit hash of the RouteHop.
198          */
199         public long hash() {
200                 long ret = bindings.RouteHop_hash(this.ptr);
201                 GC.KeepAlive(this);
202                 return ret;
203         }
204
205         public override int GetHashCode() {
206                 return (int)this.hash();
207         }
208         /**
209          * Checks if two RouteHops contain equal inner contents.
210          * This ignores pointers and is_owned flags and looks at the values in fields.
211          * Two objects with NULL inner values will be considered "equal" here.
212          */
213         public bool eq(org.ldk.structs.RouteHop b) {
214                 bool ret = bindings.RouteHop_eq(this.ptr, b == null ? 0 : b.ptr);
215                 GC.KeepAlive(this);
216                 GC.KeepAlive(b);
217                 if (this != null) { this.ptrs_to.AddLast(b); };
218                 return ret;
219         }
220
221         public override bool Equals(object o) {
222                 if (!(o is RouteHop)) return false;
223                 return this.eq((RouteHop)o);
224         }
225         /**
226          * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
227          */
228         public byte[] write() {
229                 byte[] ret = bindings.RouteHop_write(this.ptr);
230                 GC.KeepAlive(this);
231                 return ret;
232         }
233
234         /**
235          * Read a RouteHop from a byte array, created by RouteHop_write
236          */
237         public static Result_RouteHopDecodeErrorZ read(byte[] ser) {
238                 long ret = bindings.RouteHop_read(ser);
239                 GC.KeepAlive(ser);
240                 if (ret >= 0 && ret <= 4096) { return null; }
241                 Result_RouteHopDecodeErrorZ ret_hu_conv = Result_RouteHopDecodeErrorZ.constr_from_ptr(ret);
242                 return ret_hu_conv;
243         }
244
245 }
246 } } }