[Java] Update auto-generated bindings to 0.0.115
[ldk-java] / src / main / java / org / ldk / structs / BlindedPayInfo.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 java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10
11 /**
12  * Information needed to route a payment across a [`BlindedPath`].
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class BlindedPayInfo extends CommonBase {
16         BlindedPayInfo(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.BlindedPayInfo_free(ptr); }
21         }
22
23         /**
24          * Base fee charged (in millisatoshi) for the entire blinded path.
25          */
26         public int get_fee_base_msat() {
27                 int ret = bindings.BlindedPayInfo_get_fee_base_msat(this.ptr);
28                 Reference.reachabilityFence(this);
29                 return ret;
30         }
31
32         /**
33          * Base fee charged (in millisatoshi) for the entire blinded path.
34          */
35         public void set_fee_base_msat(int val) {
36                 bindings.BlindedPayInfo_set_fee_base_msat(this.ptr, val);
37                 Reference.reachabilityFence(this);
38                 Reference.reachabilityFence(val);
39         }
40
41         /**
42          * Liquidity fee charged (in millionths of the amount transferred) for the entire blinded path
43          * (i.e., 10,000 is 1%).
44          */
45         public int get_fee_proportional_millionths() {
46                 int ret = bindings.BlindedPayInfo_get_fee_proportional_millionths(this.ptr);
47                 Reference.reachabilityFence(this);
48                 return ret;
49         }
50
51         /**
52          * Liquidity fee charged (in millionths of the amount transferred) for the entire blinded path
53          * (i.e., 10,000 is 1%).
54          */
55         public void set_fee_proportional_millionths(int val) {
56                 bindings.BlindedPayInfo_set_fee_proportional_millionths(this.ptr, val);
57                 Reference.reachabilityFence(this);
58                 Reference.reachabilityFence(val);
59         }
60
61         /**
62          * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for the entire blinded
63          * path.
64          */
65         public short get_cltv_expiry_delta() {
66                 short ret = bindings.BlindedPayInfo_get_cltv_expiry_delta(this.ptr);
67                 Reference.reachabilityFence(this);
68                 return ret;
69         }
70
71         /**
72          * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for the entire blinded
73          * path.
74          */
75         public void set_cltv_expiry_delta(short val) {
76                 bindings.BlindedPayInfo_set_cltv_expiry_delta(this.ptr, val);
77                 Reference.reachabilityFence(this);
78                 Reference.reachabilityFence(val);
79         }
80
81         /**
82          * The minimum HTLC value (in millisatoshi) that is acceptable to all channel peers on the
83          * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as
84          * seen by the recipient.
85          */
86         public long get_htlc_minimum_msat() {
87                 long ret = bindings.BlindedPayInfo_get_htlc_minimum_msat(this.ptr);
88                 Reference.reachabilityFence(this);
89                 return ret;
90         }
91
92         /**
93          * The minimum HTLC value (in millisatoshi) that is acceptable to all channel peers on the
94          * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as
95          * seen by the recipient.
96          */
97         public void set_htlc_minimum_msat(long val) {
98                 bindings.BlindedPayInfo_set_htlc_minimum_msat(this.ptr, val);
99                 Reference.reachabilityFence(this);
100                 Reference.reachabilityFence(val);
101         }
102
103         /**
104          * The maximum HTLC value (in millisatoshi) that is acceptable to all channel peers on the
105          * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as
106          * seen by the recipient.
107          */
108         public long get_htlc_maximum_msat() {
109                 long ret = bindings.BlindedPayInfo_get_htlc_maximum_msat(this.ptr);
110                 Reference.reachabilityFence(this);
111                 return ret;
112         }
113
114         /**
115          * The maximum HTLC value (in millisatoshi) that is acceptable to all channel peers on the
116          * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as
117          * seen by the recipient.
118          */
119         public void set_htlc_maximum_msat(long val) {
120                 bindings.BlindedPayInfo_set_htlc_maximum_msat(this.ptr, val);
121                 Reference.reachabilityFence(this);
122                 Reference.reachabilityFence(val);
123         }
124
125         /**
126          * Features set in `encrypted_data_tlv` for the `encrypted_recipient_data` TLV record in an
127          * onion payload.
128          */
129         public BlindedHopFeatures get_features() {
130                 long ret = bindings.BlindedPayInfo_get_features(this.ptr);
131                 Reference.reachabilityFence(this);
132                 if (ret >= 0 && ret <= 4096) { return null; }
133                 org.ldk.structs.BlindedHopFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BlindedHopFeatures(null, ret); }
134                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
135                 return ret_hu_conv;
136         }
137
138         /**
139          * Features set in `encrypted_data_tlv` for the `encrypted_recipient_data` TLV record in an
140          * onion payload.
141          */
142         public void set_features(org.ldk.structs.BlindedHopFeatures val) {
143                 bindings.BlindedPayInfo_set_features(this.ptr, val == null ? 0 : val.ptr);
144                 Reference.reachabilityFence(this);
145                 Reference.reachabilityFence(val);
146                 if (this != null) { this.ptrs_to.add(val); };
147         }
148
149         /**
150          * Constructs a new BlindedPayInfo given each field
151          */
152         public static BlindedPayInfo of(int fee_base_msat_arg, int fee_proportional_millionths_arg, short cltv_expiry_delta_arg, long htlc_minimum_msat_arg, long htlc_maximum_msat_arg, org.ldk.structs.BlindedHopFeatures features_arg) {
153                 long ret = bindings.BlindedPayInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg, features_arg == null ? 0 : features_arg.ptr);
154                 Reference.reachabilityFence(fee_base_msat_arg);
155                 Reference.reachabilityFence(fee_proportional_millionths_arg);
156                 Reference.reachabilityFence(cltv_expiry_delta_arg);
157                 Reference.reachabilityFence(htlc_minimum_msat_arg);
158                 Reference.reachabilityFence(htlc_maximum_msat_arg);
159                 Reference.reachabilityFence(features_arg);
160                 if (ret >= 0 && ret <= 4096) { return null; }
161                 org.ldk.structs.BlindedPayInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BlindedPayInfo(null, ret); }
162                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
163                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(features_arg); };
164                 return ret_hu_conv;
165         }
166
167         long clone_ptr() {
168                 long ret = bindings.BlindedPayInfo_clone_ptr(this.ptr);
169                 Reference.reachabilityFence(this);
170                 return ret;
171         }
172
173         /**
174          * Creates a copy of the BlindedPayInfo
175          */
176         public BlindedPayInfo clone() {
177                 long ret = bindings.BlindedPayInfo_clone(this.ptr);
178                 Reference.reachabilityFence(this);
179                 if (ret >= 0 && ret <= 4096) { return null; }
180                 org.ldk.structs.BlindedPayInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BlindedPayInfo(null, ret); }
181                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
182                 return ret_hu_conv;
183         }
184
185         /**
186          * Generates a non-cryptographic 64-bit hash of the BlindedPayInfo.
187          */
188         public long hash() {
189                 long ret = bindings.BlindedPayInfo_hash(this.ptr);
190                 Reference.reachabilityFence(this);
191                 return ret;
192         }
193
194         @Override public int hashCode() {
195                 return (int)this.hash();
196         }
197         /**
198          * Checks if two BlindedPayInfos contain equal inner contents.
199          * This ignores pointers and is_owned flags and looks at the values in fields.
200          * Two objects with NULL inner values will be considered "equal" here.
201          */
202         public boolean eq(org.ldk.structs.BlindedPayInfo b) {
203                 boolean ret = bindings.BlindedPayInfo_eq(this.ptr, b == null ? 0 : b.ptr);
204                 Reference.reachabilityFence(this);
205                 Reference.reachabilityFence(b);
206                 if (this != null) { this.ptrs_to.add(b); };
207                 return ret;
208         }
209
210         @Override public boolean equals(Object o) {
211                 if (!(o instanceof BlindedPayInfo)) return false;
212                 return this.eq((BlindedPayInfo)o);
213         }
214         /**
215          * Serialize the BlindedPayInfo object into a byte array which can be read by BlindedPayInfo_read
216          */
217         public byte[] write() {
218                 byte[] ret = bindings.BlindedPayInfo_write(this.ptr);
219                 Reference.reachabilityFence(this);
220                 return ret;
221         }
222
223         /**
224          * Read a BlindedPayInfo from a byte array, created by BlindedPayInfo_write
225          */
226         public static Result_BlindedPayInfoDecodeErrorZ read(byte[] ser) {
227                 long ret = bindings.BlindedPayInfo_read(ser);
228                 Reference.reachabilityFence(ser);
229                 if (ret >= 0 && ret <= 4096) { return null; }
230                 Result_BlindedPayInfoDecodeErrorZ ret_hu_conv = Result_BlindedPayInfoDecodeErrorZ.constr_from_ptr(ret);
231                 return ret_hu_conv;
232         }
233
234 }