Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / RouteHop.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 hop in a route
11  */
12 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
13 public class RouteHop extends CommonBase {
14         RouteHop(Object _dummy, long ptr) { super(ptr); }
15         @Override @SuppressWarnings("deprecation")
16         protected void finalize() throws Throwable {
17                 super.finalize();
18                 if (ptr != 0) { bindings.RouteHop_free(ptr); }
19         }
20
21         /**
22          * The node_id of the node at this hop.
23          */
24         public byte[] get_pubkey() {
25                 byte[] ret = bindings.RouteHop_get_pubkey(this.ptr);
26                 return ret;
27         }
28
29         /**
30          * The node_id of the node at this hop.
31          */
32         public void set_pubkey(byte[] val) {
33                 bindings.RouteHop_set_pubkey(this.ptr, val);
34         }
35
36         /**
37          * The node_announcement features of the node at this hop. For the last hop, these may be
38          * amended to match the features present in the invoice this node generated.
39          */
40         public NodeFeatures get_node_features() {
41                 long ret = bindings.RouteHop_get_node_features(this.ptr);
42                 NodeFeatures ret_hu_conv = new NodeFeatures(null, ret);
43                 ret_hu_conv.ptrs_to.add(this);
44                 return ret_hu_conv;
45         }
46
47         /**
48          * The node_announcement features of the node at this hop. For the last hop, these may be
49          * amended to match the features present in the invoice this node generated.
50          */
51         public void set_node_features(NodeFeatures val) {
52                 bindings.RouteHop_set_node_features(this.ptr, val == null ? 0 : val.ptr & ~1);
53                 this.ptrs_to.add(val);
54         }
55
56         /**
57          * The channel that should be used from the previous hop to reach this node.
58          */
59         public long get_short_channel_id() {
60                 long ret = bindings.RouteHop_get_short_channel_id(this.ptr);
61                 return ret;
62         }
63
64         /**
65          * The channel that should be used from the previous hop to reach this node.
66          */
67         public void set_short_channel_id(long val) {
68                 bindings.RouteHop_set_short_channel_id(this.ptr, val);
69         }
70
71         /**
72          * The channel_announcement features of the channel that should be used from the previous hop
73          * to reach this node.
74          */
75         public ChannelFeatures get_channel_features() {
76                 long ret = bindings.RouteHop_get_channel_features(this.ptr);
77                 ChannelFeatures ret_hu_conv = new ChannelFeatures(null, ret);
78                 ret_hu_conv.ptrs_to.add(this);
79                 return ret_hu_conv;
80         }
81
82         /**
83          * The channel_announcement features of the channel that should be used from the previous hop
84          * to reach this node.
85          */
86         public void set_channel_features(ChannelFeatures val) {
87                 bindings.RouteHop_set_channel_features(this.ptr, val == null ? 0 : val.ptr & ~1);
88                 this.ptrs_to.add(val);
89         }
90
91         /**
92          * The fee taken on this hop (for paying for the use of the *next* channel in the path).
93          * For the last hop, this should be the full value of the payment (might be more than
94          * requested if we had to match htlc_minimum_msat).
95          */
96         public long get_fee_msat() {
97                 long ret = bindings.RouteHop_get_fee_msat(this.ptr);
98                 return ret;
99         }
100
101         /**
102          * The fee taken on this hop (for paying for the use of the *next* channel in the path).
103          * For the last hop, this should be the full value of the payment (might be more than
104          * requested if we had to match htlc_minimum_msat).
105          */
106         public void set_fee_msat(long val) {
107                 bindings.RouteHop_set_fee_msat(this.ptr, val);
108         }
109
110         /**
111          * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
112          * expected at the destination, in excess of the current block height.
113          */
114         public int get_cltv_expiry_delta() {
115                 int ret = bindings.RouteHop_get_cltv_expiry_delta(this.ptr);
116                 return ret;
117         }
118
119         /**
120          * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
121          * expected at the destination, in excess of the current block height.
122          */
123         public void set_cltv_expiry_delta(int val) {
124                 bindings.RouteHop_set_cltv_expiry_delta(this.ptr, val);
125         }
126
127         /**
128          * Constructs a new RouteHop given each field
129          */
130         public static RouteHop of(byte[] pubkey_arg, NodeFeatures node_features_arg, long short_channel_id_arg, ChannelFeatures channel_features_arg, long fee_msat_arg, int cltv_expiry_delta_arg) {
131                 long ret = bindings.RouteHop_new(pubkey_arg, node_features_arg == null ? 0 : node_features_arg.ptr & ~1, short_channel_id_arg, channel_features_arg == null ? 0 : channel_features_arg.ptr & ~1, fee_msat_arg, cltv_expiry_delta_arg);
132                 RouteHop ret_hu_conv = new RouteHop(null, ret);
133                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
134                 ret_hu_conv.ptrs_to.add(node_features_arg);
135                 ret_hu_conv.ptrs_to.add(channel_features_arg);
136                 return ret_hu_conv;
137         }
138
139         /**
140          * Creates a copy of the RouteHop
141          */
142         public RouteHop clone() {
143                 long ret = bindings.RouteHop_clone(this.ptr);
144                 RouteHop ret_hu_conv = new RouteHop(null, ret);
145                 ret_hu_conv.ptrs_to.add(this);
146                 return ret_hu_conv;
147         }
148
149         /**
150          * Serialize the RouteHop object into a byte array which can be read by RouteHop_read
151          */
152         public byte[] write() {
153                 byte[] ret = bindings.RouteHop_write(this.ptr);
154                 return ret;
155         }
156
157         /**
158          * Read a RouteHop from a byte array, created by RouteHop_write
159          */
160         public static Result_RouteHopDecodeErrorZ read(byte[] ser) {
161                 long ret = bindings.RouteHop_read(ser);
162                 Result_RouteHopDecodeErrorZ ret_hu_conv = Result_RouteHopDecodeErrorZ.constr_from_ptr(ret);
163                 return ret_hu_conv;
164         }
165
166 }