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