1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
12 * Information needed to route a payment across a [`BlindedPaymentPath`].
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 {
20 if (ptr != 0) { bindings.BlindedPayInfo_free(ptr); }
24 * Base fee charged (in millisatoshi) for the entire blinded path.
26 public int get_fee_base_msat() {
27 int ret = bindings.BlindedPayInfo_get_fee_base_msat(this.ptr);
28 Reference.reachabilityFence(this);
33 * Base fee charged (in millisatoshi) for the entire blinded path.
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);
42 * Liquidity fee charged (in millionths of the amount transferred) for the entire blinded path
43 * (i.e., 10,000 is 1%).
45 public int get_fee_proportional_millionths() {
46 int ret = bindings.BlindedPayInfo_get_fee_proportional_millionths(this.ptr);
47 Reference.reachabilityFence(this);
52 * Liquidity fee charged (in millionths of the amount transferred) for the entire blinded path
53 * (i.e., 10,000 is 1%).
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);
62 * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for the entire blinded
65 public short get_cltv_expiry_delta() {
66 short ret = bindings.BlindedPayInfo_get_cltv_expiry_delta(this.ptr);
67 Reference.reachabilityFence(this);
72 * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for the entire blinded
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);
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.
86 public long get_htlc_minimum_msat() {
87 long ret = bindings.BlindedPayInfo_get_htlc_minimum_msat(this.ptr);
88 Reference.reachabilityFence(this);
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.
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);
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.
108 public long get_htlc_maximum_msat() {
109 long ret = bindings.BlindedPayInfo_get_htlc_maximum_msat(this.ptr);
110 Reference.reachabilityFence(this);
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.
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);
126 * Features set in `encrypted_data_tlv` for the `encrypted_recipient_data` TLV record in an
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); };
139 * Features set in `encrypted_data_tlv` for the `encrypted_recipient_data` TLV record in an
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);
149 * Constructs a new BlindedPayInfo given each field
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); };
166 long ret = bindings.BlindedPayInfo_clone_ptr(this.ptr);
167 Reference.reachabilityFence(this);
172 * Creates a copy of the BlindedPayInfo
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); };
184 * Generates a non-cryptographic 64-bit hash of the BlindedPayInfo.
187 long ret = bindings.BlindedPayInfo_hash(this.ptr);
188 Reference.reachabilityFence(this);
192 @Override public int hashCode() {
193 return (int)this.hash();
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.
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); };
208 @Override public boolean equals(Object o) {
209 if (!(o instanceof BlindedPayInfo)) return false;
210 return this.eq((BlindedPayInfo)o);
213 * Serialize the BlindedPayInfo object into a byte array which can be read by BlindedPayInfo_read
215 public byte[] write() {
216 byte[] ret = bindings.BlindedPayInfo_write(this.ptr);
217 Reference.reachabilityFence(this);
222 * Read a BlindedPayInfo from a byte array, created by BlindedPayInfo_write
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);