6 namespace org { namespace ldk { namespace structs {
10 * Constraints for relaying over a given [`BlindedHop`].
12 * [`BlindedHop`]: crate::blinded_path::BlindedHop
14 public class PaymentConstraints : CommonBase {
15 internal PaymentConstraints(object _dummy, long ptr) : base(ptr) { }
16 ~PaymentConstraints() {
17 if (ptr != 0) { bindings.PaymentConstraints_free(ptr); }
21 * The maximum total CLTV that is acceptable when relaying a payment over this [`BlindedHop`].
23 public int get_max_cltv_expiry() {
24 int ret = bindings.PaymentConstraints_get_max_cltv_expiry(this.ptr);
30 * The maximum total CLTV that is acceptable when relaying a payment over this [`BlindedHop`].
32 public void set_max_cltv_expiry(int val) {
33 bindings.PaymentConstraints_set_max_cltv_expiry(this.ptr, val);
39 * The minimum value, in msat, that may be accepted by the node corresponding to this
42 public long get_htlc_minimum_msat() {
43 long ret = bindings.PaymentConstraints_get_htlc_minimum_msat(this.ptr);
49 * The minimum value, in msat, that may be accepted by the node corresponding to this
52 public void set_htlc_minimum_msat(long val) {
53 bindings.PaymentConstraints_set_htlc_minimum_msat(this.ptr, val);
59 * Constructs a new PaymentConstraints given each field
61 public static PaymentConstraints of(int max_cltv_expiry_arg, long htlc_minimum_msat_arg) {
62 long ret = bindings.PaymentConstraints_new(max_cltv_expiry_arg, htlc_minimum_msat_arg);
63 GC.KeepAlive(max_cltv_expiry_arg);
64 GC.KeepAlive(htlc_minimum_msat_arg);
65 if (ret >= 0 && ret <= 4096) { return null; }
66 org.ldk.structs.PaymentConstraints ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PaymentConstraints(null, ret); }
67 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
71 internal long clone_ptr() {
72 long ret = bindings.PaymentConstraints_clone_ptr(this.ptr);
78 * Creates a copy of the PaymentConstraints
80 public PaymentConstraints clone() {
81 long ret = bindings.PaymentConstraints_clone(this.ptr);
83 if (ret >= 0 && ret <= 4096) { return null; }
84 org.ldk.structs.PaymentConstraints ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PaymentConstraints(null, ret); }
85 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
90 * Serialize the PaymentConstraints object into a byte array which can be read by PaymentConstraints_read
92 public byte[] write() {
93 long ret = bindings.PaymentConstraints_write(this.ptr);
95 if (ret >= 0 && ret <= 4096) { return null; }
96 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
101 * Read a PaymentConstraints from a byte array, created by PaymentConstraints_write
103 public static Result_PaymentConstraintsDecodeErrorZ read(byte[] ser) {
104 long ret = bindings.PaymentConstraints_read(InternalUtils.encodeUint8Array(ser));
106 if (ret >= 0 && ret <= 4096) { return null; }
107 Result_PaymentConstraintsDecodeErrorZ ret_hu_conv = Result_PaymentConstraintsDecodeErrorZ.constr_from_ptr(ret);