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 * Parameters for relaying over a given [`BlindedHop`].
14 * [`BlindedHop`]: crate::blinded_path::BlindedHop
16 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
17 public class PaymentRelay extends CommonBase {
18 PaymentRelay(Object _dummy, long ptr) { super(ptr); }
19 @Override @SuppressWarnings("deprecation")
20 protected void finalize() throws Throwable {
22 if (ptr != 0) { bindings.PaymentRelay_free(ptr); }
26 * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for this [`BlindedHop`].
28 public short get_cltv_expiry_delta() {
29 short ret = bindings.PaymentRelay_get_cltv_expiry_delta(this.ptr);
30 Reference.reachabilityFence(this);
35 * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for this [`BlindedHop`].
37 public void set_cltv_expiry_delta(short val) {
38 bindings.PaymentRelay_set_cltv_expiry_delta(this.ptr, val);
39 Reference.reachabilityFence(this);
40 Reference.reachabilityFence(val);
44 * Liquidity fee charged (in millionths of the amount transferred) for relaying a payment over
45 * this [`BlindedHop`], (i.e., 10,000 is 1%).
47 public int get_fee_proportional_millionths() {
48 int ret = bindings.PaymentRelay_get_fee_proportional_millionths(this.ptr);
49 Reference.reachabilityFence(this);
54 * Liquidity fee charged (in millionths of the amount transferred) for relaying a payment over
55 * this [`BlindedHop`], (i.e., 10,000 is 1%).
57 public void set_fee_proportional_millionths(int val) {
58 bindings.PaymentRelay_set_fee_proportional_millionths(this.ptr, val);
59 Reference.reachabilityFence(this);
60 Reference.reachabilityFence(val);
64 * Base fee charged (in millisatoshi) for relaying a payment over this [`BlindedHop`].
66 public int get_fee_base_msat() {
67 int ret = bindings.PaymentRelay_get_fee_base_msat(this.ptr);
68 Reference.reachabilityFence(this);
73 * Base fee charged (in millisatoshi) for relaying a payment over this [`BlindedHop`].
75 public void set_fee_base_msat(int val) {
76 bindings.PaymentRelay_set_fee_base_msat(this.ptr, val);
77 Reference.reachabilityFence(this);
78 Reference.reachabilityFence(val);
82 * Constructs a new PaymentRelay given each field
84 public static PaymentRelay of(short cltv_expiry_delta_arg, int fee_proportional_millionths_arg, int fee_base_msat_arg) {
85 long ret = bindings.PaymentRelay_new(cltv_expiry_delta_arg, fee_proportional_millionths_arg, fee_base_msat_arg);
86 Reference.reachabilityFence(cltv_expiry_delta_arg);
87 Reference.reachabilityFence(fee_proportional_millionths_arg);
88 Reference.reachabilityFence(fee_base_msat_arg);
89 if (ret >= 0 && ret <= 4096) { return null; }
90 org.ldk.structs.PaymentRelay ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PaymentRelay(null, ret); }
91 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
96 long ret = bindings.PaymentRelay_clone_ptr(this.ptr);
97 Reference.reachabilityFence(this);
102 * Creates a copy of the PaymentRelay
104 public PaymentRelay clone() {
105 long ret = bindings.PaymentRelay_clone(this.ptr);
106 Reference.reachabilityFence(this);
107 if (ret >= 0 && ret <= 4096) { return null; }
108 org.ldk.structs.PaymentRelay ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PaymentRelay(null, ret); }
109 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
114 * Serialize the PaymentRelay object into a byte array which can be read by PaymentRelay_read
116 public byte[] write() {
117 byte[] ret = bindings.PaymentRelay_write(this.ptr);
118 Reference.reachabilityFence(this);
123 * Read a PaymentRelay from a byte array, created by PaymentRelay_write
125 public static Result_PaymentRelayDecodeErrorZ read(byte[] ser) {
126 long ret = bindings.PaymentRelay_read(ser);
127 Reference.reachabilityFence(ser);
128 if (ret >= 0 && ret <= 4096) { return null; }
129 Result_PaymentRelayDecodeErrorZ ret_hu_conv = Result_PaymentRelayDecodeErrorZ.constr_from_ptr(ret);