Update auto-generated bindings to latest upstream
[ldk-java] / src / main / java / org / ldk / structs / RouteHintHop.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
8
9
10 /**
11  * A channel descriptor for a hop along a payment path.
12  */
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class RouteHintHop extends CommonBase {
15         RouteHintHop(Object _dummy, long ptr) { super(ptr); }
16         @Override @SuppressWarnings("deprecation")
17         protected void finalize() throws Throwable {
18                 super.finalize();
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                 byte[] ret = bindings.RouteHintHop_get_src_node_id(this.ptr);
27                 return ret;
28         }
29
30         /**
31          * The node_id of the non-target end of the route
32          */
33         public void set_src_node_id(byte[] val) {
34                 bindings.RouteHintHop_set_src_node_id(this.ptr, val);
35         }
36
37         /**
38          * The short_channel_id of this channel
39          */
40         public long get_short_channel_id() {
41                 long ret = bindings.RouteHintHop_get_short_channel_id(this.ptr);
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         }
51
52         /**
53          * The fees which must be paid to use this channel
54          */
55         public RoutingFees get_fees() {
56                 long ret = bindings.RouteHintHop_get_fees(this.ptr);
57                 if (ret < 1024) { return null; }
58                 RoutingFees ret_hu_conv = new RoutingFees(null, ret);
59                 ret_hu_conv.ptrs_to.add(this);
60                 return ret_hu_conv;
61         }
62
63         /**
64          * The fees which must be paid to use this channel
65          */
66         public void set_fees(RoutingFees val) {
67                 bindings.RouteHintHop_set_fees(this.ptr, val == null ? 0 : val.ptr & ~1);
68                 this.ptrs_to.add(val);
69         }
70
71         /**
72          * The difference in CLTV values between this node and the next node.
73          */
74         public short get_cltv_expiry_delta() {
75                 short ret = bindings.RouteHintHop_get_cltv_expiry_delta(this.ptr);
76                 return ret;
77         }
78
79         /**
80          * The difference in CLTV values between this node and the next node.
81          */
82         public void set_cltv_expiry_delta(short val) {
83                 bindings.RouteHintHop_set_cltv_expiry_delta(this.ptr, val);
84         }
85
86         /**
87          * The minimum value, in msat, which must be relayed to the next hop.
88          */
89         public Option_u64Z get_htlc_minimum_msat() {
90                 long ret = bindings.RouteHintHop_get_htlc_minimum_msat(this.ptr);
91                 if (ret < 1024) { return null; }
92                 Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret);
93                 ret_hu_conv.ptrs_to.add(this);
94                 return ret_hu_conv;
95         }
96
97         /**
98          * The minimum value, in msat, which must be relayed to the next hop.
99          */
100         public void set_htlc_minimum_msat(Option_u64Z val) {
101                 bindings.RouteHintHop_set_htlc_minimum_msat(this.ptr, val.ptr);
102         }
103
104         /**
105          * The maximum value in msat available for routing with a single HTLC.
106          */
107         public Option_u64Z get_htlc_maximum_msat() {
108                 long ret = bindings.RouteHintHop_get_htlc_maximum_msat(this.ptr);
109                 if (ret < 1024) { return null; }
110                 Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret);
111                 ret_hu_conv.ptrs_to.add(this);
112                 return ret_hu_conv;
113         }
114
115         /**
116          * The maximum value in msat available for routing with a single HTLC.
117          */
118         public void set_htlc_maximum_msat(Option_u64Z val) {
119                 bindings.RouteHintHop_set_htlc_maximum_msat(this.ptr, val.ptr);
120         }
121
122         /**
123          * Constructs a new RouteHintHop given each field
124          */
125         public static RouteHintHop of(byte[] src_node_id_arg, long short_channel_id_arg, RoutingFees fees_arg, short cltv_expiry_delta_arg, Option_u64Z htlc_minimum_msat_arg, Option_u64Z htlc_maximum_msat_arg) {
126                 long ret = bindings.RouteHintHop_new(src_node_id_arg, short_channel_id_arg, fees_arg == null ? 0 : fees_arg.ptr & ~1, cltv_expiry_delta_arg, htlc_minimum_msat_arg.ptr, htlc_maximum_msat_arg.ptr);
127                 if (ret < 1024) { return null; }
128                 RouteHintHop ret_hu_conv = new RouteHintHop(null, ret);
129                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
130                 ret_hu_conv.ptrs_to.add(fees_arg);
131                 return ret_hu_conv;
132         }
133
134         /**
135          * Checks if two RouteHintHops contain equal inner contents.
136          * This ignores pointers and is_owned flags and looks at the values in fields.
137          * Two objects with NULL inner values will be considered "equal" here.
138          */
139         public boolean eq(RouteHintHop b) {
140                 boolean ret = bindings.RouteHintHop_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
141                 this.ptrs_to.add(b);
142                 return ret;
143         }
144
145         /**
146          * Creates a copy of the RouteHintHop
147          */
148         public RouteHintHop clone() {
149                 long ret = bindings.RouteHintHop_clone(this.ptr);
150                 if (ret < 1024) { return null; }
151                 RouteHintHop ret_hu_conv = new RouteHintHop(null, ret);
152                 ret_hu_conv.ptrs_to.add(this);
153                 return ret_hu_conv;
154         }
155
156 }