[C#] Update auto-generated files
[ldk-java] / c_sharp / src / org / ldk / structs / RouteHintHop.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 channel descriptor for a hop along a payment path.
11  */
12 public class RouteHintHop : CommonBase {
13         internal RouteHintHop(object _dummy, long ptr) : base(ptr) { }
14         ~RouteHintHop() {
15                 if (ptr != 0) { bindings.RouteHintHop_free(ptr); }
16         }
17
18         /**
19          * The node_id of the non-target end of the route
20          */
21         public byte[] get_src_node_id() {
22                 byte[] ret = bindings.RouteHintHop_get_src_node_id(this.ptr);
23                 GC.KeepAlive(this);
24                 return ret;
25         }
26
27         /**
28          * The node_id of the non-target end of the route
29          */
30         public void set_src_node_id(byte[] val) {
31                 bindings.RouteHintHop_set_src_node_id(this.ptr, InternalUtils.check_arr_len(val, 33));
32                 GC.KeepAlive(this);
33                 GC.KeepAlive(val);
34         }
35
36         /**
37          * The short_channel_id of this channel
38          */
39         public long get_short_channel_id() {
40                 long ret = bindings.RouteHintHop_get_short_channel_id(this.ptr);
41                 GC.KeepAlive(this);
42                 return ret;
43         }
44
45         /**
46          * The short_channel_id of this channel
47          */
48         public void set_short_channel_id(long val) {
49                 bindings.RouteHintHop_set_short_channel_id(this.ptr, val);
50                 GC.KeepAlive(this);
51                 GC.KeepAlive(val);
52         }
53
54         /**
55          * The fees which must be paid to use this channel
56          */
57         public RoutingFees get_fees() {
58                 long ret = bindings.RouteHintHop_get_fees(this.ptr);
59                 GC.KeepAlive(this);
60                 if (ret >= 0 && ret <= 4096) { return null; }
61                 org.ldk.structs.RoutingFees ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RoutingFees(null, ret); }
62                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
63                 return ret_hu_conv;
64         }
65
66         /**
67          * The fees which must be paid to use this channel
68          */
69         public void set_fees(org.ldk.structs.RoutingFees val) {
70                 bindings.RouteHintHop_set_fees(this.ptr, val == null ? 0 : val.ptr);
71                 GC.KeepAlive(this);
72                 GC.KeepAlive(val);
73                 if (this != null) { this.ptrs_to.AddLast(val); };
74         }
75
76         /**
77          * The difference in CLTV values between this node and the next node.
78          */
79         public short get_cltv_expiry_delta() {
80                 short ret = bindings.RouteHintHop_get_cltv_expiry_delta(this.ptr);
81                 GC.KeepAlive(this);
82                 return ret;
83         }
84
85         /**
86          * The difference in CLTV values between this node and the next node.
87          */
88         public void set_cltv_expiry_delta(short val) {
89                 bindings.RouteHintHop_set_cltv_expiry_delta(this.ptr, val);
90                 GC.KeepAlive(this);
91                 GC.KeepAlive(val);
92         }
93
94         /**
95          * The minimum value, in msat, which must be relayed to the next hop.
96          */
97         public Option_u64Z get_htlc_minimum_msat() {
98                 long ret = bindings.RouteHintHop_get_htlc_minimum_msat(this.ptr);
99                 GC.KeepAlive(this);
100                 if (ret >= 0 && ret <= 4096) { return null; }
101                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
102                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
103                 return ret_hu_conv;
104         }
105
106         /**
107          * The minimum value, in msat, which must be relayed to the next hop.
108          */
109         public void set_htlc_minimum_msat(org.ldk.structs.Option_u64Z val) {
110                 bindings.RouteHintHop_set_htlc_minimum_msat(this.ptr, val.ptr);
111                 GC.KeepAlive(this);
112                 GC.KeepAlive(val);
113                 if (this != null) { this.ptrs_to.AddLast(val); };
114         }
115
116         /**
117          * The maximum value in msat available for routing with a single HTLC.
118          */
119         public Option_u64Z get_htlc_maximum_msat() {
120                 long ret = bindings.RouteHintHop_get_htlc_maximum_msat(this.ptr);
121                 GC.KeepAlive(this);
122                 if (ret >= 0 && ret <= 4096) { return null; }
123                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
124                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
125                 return ret_hu_conv;
126         }
127
128         /**
129          * The maximum value in msat available for routing with a single HTLC.
130          */
131         public void set_htlc_maximum_msat(org.ldk.structs.Option_u64Z val) {
132                 bindings.RouteHintHop_set_htlc_maximum_msat(this.ptr, val.ptr);
133                 GC.KeepAlive(this);
134                 GC.KeepAlive(val);
135                 if (this != null) { this.ptrs_to.AddLast(val); };
136         }
137
138         /**
139          * Constructs a new RouteHintHop given each field
140          */
141         public static RouteHintHop of(byte[] src_node_id_arg, long short_channel_id_arg, org.ldk.structs.RoutingFees fees_arg, short cltv_expiry_delta_arg, org.ldk.structs.Option_u64Z htlc_minimum_msat_arg, org.ldk.structs.Option_u64Z htlc_maximum_msat_arg) {
142                 long ret = bindings.RouteHintHop_new(InternalUtils.check_arr_len(src_node_id_arg, 33), short_channel_id_arg, fees_arg == null ? 0 : fees_arg.ptr, cltv_expiry_delta_arg, htlc_minimum_msat_arg.ptr, htlc_maximum_msat_arg.ptr);
143                 GC.KeepAlive(src_node_id_arg);
144                 GC.KeepAlive(short_channel_id_arg);
145                 GC.KeepAlive(fees_arg);
146                 GC.KeepAlive(cltv_expiry_delta_arg);
147                 GC.KeepAlive(htlc_minimum_msat_arg);
148                 GC.KeepAlive(htlc_maximum_msat_arg);
149                 if (ret >= 0 && ret <= 4096) { return null; }
150                 org.ldk.structs.RouteHintHop ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RouteHintHop(null, ret); }
151                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
152                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(fees_arg); };
153                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(htlc_minimum_msat_arg); };
154                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(htlc_maximum_msat_arg); };
155                 return ret_hu_conv;
156         }
157
158         internal long clone_ptr() {
159                 long ret = bindings.RouteHintHop_clone_ptr(this.ptr);
160                 GC.KeepAlive(this);
161                 return ret;
162         }
163
164         /**
165          * Creates a copy of the RouteHintHop
166          */
167         public RouteHintHop clone() {
168                 long ret = bindings.RouteHintHop_clone(this.ptr);
169                 GC.KeepAlive(this);
170                 if (ret >= 0 && ret <= 4096) { return null; }
171                 org.ldk.structs.RouteHintHop ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RouteHintHop(null, ret); }
172                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
173                 return ret_hu_conv;
174         }
175
176         /**
177          * Generates a non-cryptographic 64-bit hash of the RouteHintHop.
178          */
179         public long hash() {
180                 long ret = bindings.RouteHintHop_hash(this.ptr);
181                 GC.KeepAlive(this);
182                 return ret;
183         }
184
185         public override int GetHashCode() {
186                 return (int)this.hash();
187         }
188         /**
189          * Checks if two RouteHintHops contain equal inner contents.
190          * This ignores pointers and is_owned flags and looks at the values in fields.
191          * Two objects with NULL inner values will be considered "equal" here.
192          */
193         public bool eq(org.ldk.structs.RouteHintHop b) {
194                 bool ret = bindings.RouteHintHop_eq(this.ptr, b == null ? 0 : b.ptr);
195                 GC.KeepAlive(this);
196                 GC.KeepAlive(b);
197                 if (this != null) { this.ptrs_to.AddLast(b); };
198                 return ret;
199         }
200
201         public override bool Equals(object o) {
202                 if (!(o is RouteHintHop)) return false;
203                 return this.eq((RouteHintHop)o);
204         }
205         /**
206          * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read
207          */
208         public byte[] write() {
209                 byte[] ret = bindings.RouteHintHop_write(this.ptr);
210                 GC.KeepAlive(this);
211                 return ret;
212         }
213
214         /**
215          * Read a RouteHintHop from a byte array, created by RouteHintHop_write
216          */
217         public static Result_RouteHintHopDecodeErrorZ read(byte[] ser) {
218                 long ret = bindings.RouteHintHop_read(ser);
219                 GC.KeepAlive(ser);
220                 if (ret >= 0 && ret <= 4096) { return null; }
221                 Result_RouteHintHopDecodeErrorZ ret_hu_conv = Result_RouteHintHopDecodeErrorZ.constr_from_ptr(ret);
222                 return ret_hu_conv;
223         }
224
225 }
226 } } }