[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / ReceiveTlvs.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  * Data to construct a [`BlindedHop`] for receiving a payment. This payload is custom to LDK and
11  * may not be valid if received by another lightning implementation.
12  */
13 public class ReceiveTlvs : CommonBase {
14         internal ReceiveTlvs(object _dummy, long ptr) : base(ptr) { }
15         ~ReceiveTlvs() {
16                 if (ptr != 0) { bindings.ReceiveTlvs_free(ptr); }
17         }
18
19         /**
20          * Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together.
21          */
22         public byte[] get_payment_secret() {
23                 long ret = bindings.ReceiveTlvs_get_payment_secret(this.ptr);
24                 GC.KeepAlive(this);
25                 if (ret >= 0 && ret <= 4096) { return null; }
26                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
27                 return ret_conv;
28         }
29
30         /**
31          * Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together.
32          */
33         public void set_payment_secret(byte[] val) {
34                 bindings.ReceiveTlvs_set_payment_secret(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
35                 GC.KeepAlive(this);
36                 GC.KeepAlive(val);
37         }
38
39         /**
40          * Constraints for the receiver of this payment.
41          */
42         public PaymentConstraints get_payment_constraints() {
43                 long ret = bindings.ReceiveTlvs_get_payment_constraints(this.ptr);
44                 GC.KeepAlive(this);
45                 if (ret >= 0 && ret <= 4096) { return null; }
46                 org.ldk.structs.PaymentConstraints ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PaymentConstraints(null, ret); }
47                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
48                 return ret_hu_conv;
49         }
50
51         /**
52          * Constraints for the receiver of this payment.
53          */
54         public void set_payment_constraints(org.ldk.structs.PaymentConstraints val) {
55                 bindings.ReceiveTlvs_set_payment_constraints(this.ptr, val == null ? 0 : val.ptr);
56                 GC.KeepAlive(this);
57                 GC.KeepAlive(val);
58                 if (this != null) { this.ptrs_to.AddLast(val); };
59         }
60
61         /**
62          * Constructs a new ReceiveTlvs given each field
63          */
64         public static ReceiveTlvs of(byte[] payment_secret_arg, org.ldk.structs.PaymentConstraints payment_constraints_arg) {
65                 long ret = bindings.ReceiveTlvs_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_secret_arg, 32)), payment_constraints_arg == null ? 0 : payment_constraints_arg.ptr);
66                 GC.KeepAlive(payment_secret_arg);
67                 GC.KeepAlive(payment_constraints_arg);
68                 if (ret >= 0 && ret <= 4096) { return null; }
69                 org.ldk.structs.ReceiveTlvs ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ReceiveTlvs(null, ret); }
70                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
71                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(payment_constraints_arg); };
72                 return ret_hu_conv;
73         }
74
75         internal long clone_ptr() {
76                 long ret = bindings.ReceiveTlvs_clone_ptr(this.ptr);
77                 GC.KeepAlive(this);
78                 return ret;
79         }
80
81         /**
82          * Creates a copy of the ReceiveTlvs
83          */
84         public ReceiveTlvs clone() {
85                 long ret = bindings.ReceiveTlvs_clone(this.ptr);
86                 GC.KeepAlive(this);
87                 if (ret >= 0 && ret <= 4096) { return null; }
88                 org.ldk.structs.ReceiveTlvs ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ReceiveTlvs(null, ret); }
89                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
90                 return ret_hu_conv;
91         }
92
93         /**
94          * Serialize the ReceiveTlvs object into a byte array which can be read by ReceiveTlvs_read
95          */
96         public byte[] write() {
97                 long ret = bindings.ReceiveTlvs_write(this.ptr);
98                 GC.KeepAlive(this);
99                 if (ret >= 0 && ret <= 4096) { return null; }
100                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
101                 return ret_conv;
102         }
103
104 }
105 } } }