6 namespace org { namespace ldk { namespace structs {
10 * A channel descriptor for a hop along a payment path.
12 public class RouteHintHop : CommonBase {
13 internal RouteHintHop(object _dummy, long ptr) : base(ptr) { }
15 if (ptr != 0) { bindings.RouteHintHop_free(ptr); }
19 * The node_id of the non-target end of the route
21 public byte[] get_src_node_id() {
22 long ret = bindings.RouteHintHop_get_src_node_id(this.ptr);
24 if (ret >= 0 && ret <= 4096) { return null; }
25 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
30 * The node_id of the non-target end of the route
32 public void set_src_node_id(byte[] val) {
33 bindings.RouteHintHop_set_src_node_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
39 * The short_channel_id of this channel
41 public long get_short_channel_id() {
42 long ret = bindings.RouteHintHop_get_short_channel_id(this.ptr);
48 * The short_channel_id of this channel
50 public void set_short_channel_id(long val) {
51 bindings.RouteHintHop_set_short_channel_id(this.ptr, val);
57 * The fees which must be paid to use this channel
59 public RoutingFees get_fees() {
60 long ret = bindings.RouteHintHop_get_fees(this.ptr);
62 if (ret >= 0 && ret <= 4096) { return null; }
63 org.ldk.structs.RoutingFees ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RoutingFees(null, ret); }
64 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
69 * The fees which must be paid to use this channel
71 public void set_fees(org.ldk.structs.RoutingFees val) {
72 bindings.RouteHintHop_set_fees(this.ptr, val == null ? 0 : val.ptr);
75 if (this != null) { this.ptrs_to.AddLast(val); };
79 * The difference in CLTV values between this node and the next node.
81 public short get_cltv_expiry_delta() {
82 short ret = bindings.RouteHintHop_get_cltv_expiry_delta(this.ptr);
88 * The difference in CLTV values between this node and the next node.
90 public void set_cltv_expiry_delta(short val) {
91 bindings.RouteHintHop_set_cltv_expiry_delta(this.ptr, val);
97 * The minimum value, in msat, which must be relayed to the next hop.
99 public Option_u64Z get_htlc_minimum_msat() {
100 long ret = bindings.RouteHintHop_get_htlc_minimum_msat(this.ptr);
102 if (ret >= 0 && ret <= 4096) { return null; }
103 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
104 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
109 * The minimum value, in msat, which must be relayed to the next hop.
111 public void set_htlc_minimum_msat(org.ldk.structs.Option_u64Z val) {
112 bindings.RouteHintHop_set_htlc_minimum_msat(this.ptr, val.ptr);
115 if (this != null) { this.ptrs_to.AddLast(val); };
119 * The maximum value in msat available for routing with a single HTLC.
121 public Option_u64Z get_htlc_maximum_msat() {
122 long ret = bindings.RouteHintHop_get_htlc_maximum_msat(this.ptr);
124 if (ret >= 0 && ret <= 4096) { return null; }
125 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
126 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
131 * The maximum value in msat available for routing with a single HTLC.
133 public void set_htlc_maximum_msat(org.ldk.structs.Option_u64Z val) {
134 bindings.RouteHintHop_set_htlc_maximum_msat(this.ptr, val.ptr);
137 if (this != null) { this.ptrs_to.AddLast(val); };
141 * Constructs a new RouteHintHop given each field
143 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) {
144 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);
145 GC.KeepAlive(src_node_id_arg);
146 GC.KeepAlive(short_channel_id_arg);
147 GC.KeepAlive(fees_arg);
148 GC.KeepAlive(cltv_expiry_delta_arg);
149 GC.KeepAlive(htlc_minimum_msat_arg);
150 GC.KeepAlive(htlc_maximum_msat_arg);
151 if (ret >= 0 && ret <= 4096) { return null; }
152 org.ldk.structs.RouteHintHop ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RouteHintHop(null, ret); }
153 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
154 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(fees_arg); };
155 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(htlc_minimum_msat_arg); };
156 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(htlc_maximum_msat_arg); };
160 internal long clone_ptr() {
161 long ret = bindings.RouteHintHop_clone_ptr(this.ptr);
167 * Creates a copy of the RouteHintHop
169 public RouteHintHop clone() {
170 long ret = bindings.RouteHintHop_clone(this.ptr);
172 if (ret >= 0 && ret <= 4096) { return null; }
173 org.ldk.structs.RouteHintHop ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RouteHintHop(null, ret); }
174 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
179 * Generates a non-cryptographic 64-bit hash of the RouteHintHop.
182 long ret = bindings.RouteHintHop_hash(this.ptr);
187 public override int GetHashCode() {
188 return (int)this.hash();
191 * Checks if two RouteHintHops contain equal inner contents.
192 * This ignores pointers and is_owned flags and looks at the values in fields.
193 * Two objects with NULL inner values will be considered "equal" here.
195 public bool eq(org.ldk.structs.RouteHintHop b) {
196 bool ret = bindings.RouteHintHop_eq(this.ptr, b == null ? 0 : b.ptr);
199 if (this != null) { this.ptrs_to.AddLast(b); };
203 public override bool Equals(object o) {
204 if (!(o is RouteHintHop)) return false;
205 return this.eq((RouteHintHop)o);
208 * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read
210 public byte[] write() {
211 long ret = bindings.RouteHintHop_write(this.ptr);
213 if (ret >= 0 && ret <= 4096) { return null; }
214 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
219 * Read a RouteHintHop from a byte array, created by RouteHintHop_write
221 public static Result_RouteHintHopDecodeErrorZ read(byte[] ser) {
222 long ret = bindings.RouteHintHop_read(InternalUtils.encodeUint8Array(ser));
224 if (ret >= 0 && ret <= 4096) { return null; }
225 Result_RouteHintHopDecodeErrorZ ret_hu_conv = Result_RouteHintHopDecodeErrorZ.constr_from_ptr(ret);