[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / PaymentConstraints.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8
9 /**
10  * Constraints for relaying over a given [`BlindedHop`].
11  * 
12  * [`BlindedHop`]: crate::blinded_path::BlindedHop
13  */
14 public class PaymentConstraints : CommonBase {
15         internal PaymentConstraints(object _dummy, long ptr) : base(ptr) { }
16         ~PaymentConstraints() {
17                 if (ptr != 0) { bindings.PaymentConstraints_free(ptr); }
18         }
19
20         /**
21          * The maximum total CLTV that is acceptable when relaying a payment over this [`BlindedHop`].
22          */
23         public int get_max_cltv_expiry() {
24                 int ret = bindings.PaymentConstraints_get_max_cltv_expiry(this.ptr);
25                 GC.KeepAlive(this);
26                 return ret;
27         }
28
29         /**
30          * The maximum total CLTV that is acceptable when relaying a payment over this [`BlindedHop`].
31          */
32         public void set_max_cltv_expiry(int val) {
33                 bindings.PaymentConstraints_set_max_cltv_expiry(this.ptr, val);
34                 GC.KeepAlive(this);
35                 GC.KeepAlive(val);
36         }
37
38         /**
39          * The minimum value, in msat, that may be accepted by the node corresponding to this
40          * [`BlindedHop`].
41          */
42         public long get_htlc_minimum_msat() {
43                 long ret = bindings.PaymentConstraints_get_htlc_minimum_msat(this.ptr);
44                 GC.KeepAlive(this);
45                 return ret;
46         }
47
48         /**
49          * The minimum value, in msat, that may be accepted by the node corresponding to this
50          * [`BlindedHop`].
51          */
52         public void set_htlc_minimum_msat(long val) {
53                 bindings.PaymentConstraints_set_htlc_minimum_msat(this.ptr, val);
54                 GC.KeepAlive(this);
55                 GC.KeepAlive(val);
56         }
57
58         /**
59          * Constructs a new PaymentConstraints given each field
60          */
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); };
68                 return ret_hu_conv;
69         }
70
71         internal long clone_ptr() {
72                 long ret = bindings.PaymentConstraints_clone_ptr(this.ptr);
73                 GC.KeepAlive(this);
74                 return ret;
75         }
76
77         /**
78          * Creates a copy of the PaymentConstraints
79          */
80         public PaymentConstraints clone() {
81                 long ret = bindings.PaymentConstraints_clone(this.ptr);
82                 GC.KeepAlive(this);
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); };
86                 return ret_hu_conv;
87         }
88
89         /**
90          * Serialize the PaymentConstraints object into a byte array which can be read by PaymentConstraints_read
91          */
92         public byte[] write() {
93                 long ret = bindings.PaymentConstraints_write(this.ptr);
94                 GC.KeepAlive(this);
95                 if (ret >= 0 && ret <= 4096) { return null; }
96                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
97                 return ret_conv;
98         }
99
100         /**
101          * Read a PaymentConstraints from a byte array, created by PaymentConstraints_write
102          */
103         public static Result_PaymentConstraintsDecodeErrorZ read(byte[] ser) {
104                 long ret = bindings.PaymentConstraints_read(InternalUtils.encodeUint8Array(ser));
105                 GC.KeepAlive(ser);
106                 if (ret >= 0 && ret <= 4096) { return null; }
107                 Result_PaymentConstraintsDecodeErrorZ ret_hu_conv = Result_PaymentConstraintsDecodeErrorZ.constr_from_ptr(ret);
108                 return ret_hu_conv;
109         }
110
111 }
112 } } }