]> git.bitcoin.ninja Git - ldk-java/blob - src/main/java/org/ldk/structs/BlindedPayInfo.java
Update CI references to LDK 0.0.124 drop stale memchr pins
[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 [`BlindedPaymentPath`].
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.ptr);
144                 Reference.reachabilityFence(this);
145                 Reference.reachabilityFence(val);
146         }
147
148         /**
149          * Constructs a new BlindedPayInfo given each field
150          */
151         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) {
152                 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.ptr);
153                 Reference.reachabilityFence(fee_base_msat_arg);
154                 Reference.reachabilityFence(fee_proportional_millionths_arg);
155                 Reference.reachabilityFence(cltv_expiry_delta_arg);
156                 Reference.reachabilityFence(htlc_minimum_msat_arg);
157                 Reference.reachabilityFence(htlc_maximum_msat_arg);
158                 Reference.reachabilityFence(features_arg);
159                 if (ret >= 0 && ret <= 4096) { return null; }
160                 org.ldk.structs.BlindedPayInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BlindedPayInfo(null, ret); }
161                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
162                 return ret_hu_conv;
163         }
164
165         long clone_ptr() {
166                 long ret = bindings.BlindedPayInfo_clone_ptr(this.ptr);
167                 Reference.reachabilityFence(this);
168                 return ret;
169         }
170
171         /**
172          * Creates a copy of the BlindedPayInfo
173          */
174         public BlindedPayInfo clone() {
175                 long ret = bindings.BlindedPayInfo_clone(this.ptr);
176                 Reference.reachabilityFence(this);
177                 if (ret >= 0 && ret <= 4096) { return null; }
178                 org.ldk.structs.BlindedPayInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BlindedPayInfo(null, ret); }
179                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
180                 return ret_hu_conv;
181         }
182
183         /**
184          * Generates a non-cryptographic 64-bit hash of the BlindedPayInfo.
185          */
186         public long hash() {
187                 long ret = bindings.BlindedPayInfo_hash(this.ptr);
188                 Reference.reachabilityFence(this);
189                 return ret;
190         }
191
192         @Override public int hashCode() {
193                 return (int)this.hash();
194         }
195         /**
196          * Checks if two BlindedPayInfos contain equal inner contents.
197          * This ignores pointers and is_owned flags and looks at the values in fields.
198          * Two objects with NULL inner values will be considered "equal" here.
199          */
200         public boolean eq(org.ldk.structs.BlindedPayInfo b) {
201                 boolean ret = bindings.BlindedPayInfo_eq(this.ptr, b.ptr);
202                 Reference.reachabilityFence(this);
203                 Reference.reachabilityFence(b);
204                 if (this != null) { this.ptrs_to.add(b); };
205                 return ret;
206         }
207
208         @Override public boolean equals(Object o) {
209                 if (!(o instanceof BlindedPayInfo)) return false;
210                 return this.eq((BlindedPayInfo)o);
211         }
212         /**
213          * Serialize the BlindedPayInfo object into a byte array which can be read by BlindedPayInfo_read
214          */
215         public byte[] write() {
216                 byte[] ret = bindings.BlindedPayInfo_write(this.ptr);
217                 Reference.reachabilityFence(this);
218                 return ret;
219         }
220
221         /**
222          * Read a BlindedPayInfo from a byte array, created by BlindedPayInfo_write
223          */
224         public static Result_BlindedPayInfoDecodeErrorZ read(byte[] ser) {
225                 long ret = bindings.BlindedPayInfo_read(ser);
226                 Reference.reachabilityFence(ser);
227                 if (ret >= 0 && ret <= 4096) { return null; }
228                 Result_BlindedPayInfoDecodeErrorZ ret_hu_conv = Result_BlindedPayInfoDecodeErrorZ.constr_from_ptr(ret);
229                 return ret_hu_conv;
230         }
231
232 }