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