[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / HTLCOutputInCommitment.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  * Information about an HTLC as it appears in a commitment transaction
11  */
12 public class HTLCOutputInCommitment : CommonBase {
13         internal HTLCOutputInCommitment(object _dummy, long ptr) : base(ptr) { }
14         ~HTLCOutputInCommitment() {
15                 if (ptr != 0) { bindings.HTLCOutputInCommitment_free(ptr); }
16         }
17
18         /**
19          * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
20          * Note that this is not the same as whether it is ountbound *from us*. To determine that you
21          * need to compare this value to whether the commitment transaction in question is that of
22          * the counterparty or our own.
23          */
24         public bool get_offered() {
25                 bool ret = bindings.HTLCOutputInCommitment_get_offered(this.ptr);
26                 GC.KeepAlive(this);
27                 return ret;
28         }
29
30         /**
31          * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
32          * Note that this is not the same as whether it is ountbound *from us*. To determine that you
33          * need to compare this value to whether the commitment transaction in question is that of
34          * the counterparty or our own.
35          */
36         public void set_offered(bool val) {
37                 bindings.HTLCOutputInCommitment_set_offered(this.ptr, val);
38                 GC.KeepAlive(this);
39                 GC.KeepAlive(val);
40         }
41
42         /**
43          * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
44          * this divided by 1000.
45          */
46         public long get_amount_msat() {
47                 long ret = bindings.HTLCOutputInCommitment_get_amount_msat(this.ptr);
48                 GC.KeepAlive(this);
49                 return ret;
50         }
51
52         /**
53          * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
54          * this divided by 1000.
55          */
56         public void set_amount_msat(long val) {
57                 bindings.HTLCOutputInCommitment_set_amount_msat(this.ptr, val);
58                 GC.KeepAlive(this);
59                 GC.KeepAlive(val);
60         }
61
62         /**
63          * The CLTV lock-time at which this HTLC expires.
64          */
65         public int get_cltv_expiry() {
66                 int ret = bindings.HTLCOutputInCommitment_get_cltv_expiry(this.ptr);
67                 GC.KeepAlive(this);
68                 return ret;
69         }
70
71         /**
72          * The CLTV lock-time at which this HTLC expires.
73          */
74         public void set_cltv_expiry(int val) {
75                 bindings.HTLCOutputInCommitment_set_cltv_expiry(this.ptr, val);
76                 GC.KeepAlive(this);
77                 GC.KeepAlive(val);
78         }
79
80         /**
81          * The hash of the preimage which unlocks this HTLC.
82          */
83         public byte[] get_payment_hash() {
84                 long ret = bindings.HTLCOutputInCommitment_get_payment_hash(this.ptr);
85                 GC.KeepAlive(this);
86                 if (ret >= 0 && ret <= 4096) { return null; }
87                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
88                 return ret_conv;
89         }
90
91         /**
92          * The hash of the preimage which unlocks this HTLC.
93          */
94         public void set_payment_hash(byte[] val) {
95                 bindings.HTLCOutputInCommitment_set_payment_hash(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
96                 GC.KeepAlive(this);
97                 GC.KeepAlive(val);
98         }
99
100         /**
101          * The position within the commitment transactions' outputs. This may be None if the value is
102          * below the dust limit (in which case no output appears in the commitment transaction and the
103          * value is spent to additional transaction fees).
104          */
105         public Option_u32Z get_transaction_output_index() {
106                 long ret = bindings.HTLCOutputInCommitment_get_transaction_output_index(this.ptr);
107                 GC.KeepAlive(this);
108                 if (ret >= 0 && ret <= 4096) { return null; }
109                 org.ldk.structs.Option_u32Z ret_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(ret);
110                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
111                 return ret_hu_conv;
112         }
113
114         /**
115          * The position within the commitment transactions' outputs. This may be None if the value is
116          * below the dust limit (in which case no output appears in the commitment transaction and the
117          * value is spent to additional transaction fees).
118          */
119         public void set_transaction_output_index(org.ldk.structs.Option_u32Z val) {
120                 bindings.HTLCOutputInCommitment_set_transaction_output_index(this.ptr, val.ptr);
121                 GC.KeepAlive(this);
122                 GC.KeepAlive(val);
123                 if (this != null) { this.ptrs_to.AddLast(val); };
124         }
125
126         /**
127          * Constructs a new HTLCOutputInCommitment given each field
128          */
129         public static HTLCOutputInCommitment of(bool offered_arg, long amount_msat_arg, int cltv_expiry_arg, byte[] payment_hash_arg, org.ldk.structs.Option_u32Z transaction_output_index_arg) {
130                 long ret = bindings.HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_hash_arg, 32)), transaction_output_index_arg.ptr);
131                 GC.KeepAlive(offered_arg);
132                 GC.KeepAlive(amount_msat_arg);
133                 GC.KeepAlive(cltv_expiry_arg);
134                 GC.KeepAlive(payment_hash_arg);
135                 GC.KeepAlive(transaction_output_index_arg);
136                 if (ret >= 0 && ret <= 4096) { return null; }
137                 org.ldk.structs.HTLCOutputInCommitment ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.HTLCOutputInCommitment(null, ret); }
138                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
139                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(transaction_output_index_arg); };
140                 return ret_hu_conv;
141         }
142
143         internal long clone_ptr() {
144                 long ret = bindings.HTLCOutputInCommitment_clone_ptr(this.ptr);
145                 GC.KeepAlive(this);
146                 return ret;
147         }
148
149         /**
150          * Creates a copy of the HTLCOutputInCommitment
151          */
152         public HTLCOutputInCommitment clone() {
153                 long ret = bindings.HTLCOutputInCommitment_clone(this.ptr);
154                 GC.KeepAlive(this);
155                 if (ret >= 0 && ret <= 4096) { return null; }
156                 org.ldk.structs.HTLCOutputInCommitment ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.HTLCOutputInCommitment(null, ret); }
157                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
158                 return ret_hu_conv;
159         }
160
161         /**
162          * Checks if two HTLCOutputInCommitments contain equal inner contents.
163          * This ignores pointers and is_owned flags and looks at the values in fields.
164          * Two objects with NULL inner values will be considered "equal" here.
165          */
166         public bool eq(org.ldk.structs.HTLCOutputInCommitment b) {
167                 bool ret = bindings.HTLCOutputInCommitment_eq(this.ptr, b == null ? 0 : b.ptr);
168                 GC.KeepAlive(this);
169                 GC.KeepAlive(b);
170                 if (this != null) { this.ptrs_to.AddLast(b); };
171                 return ret;
172         }
173
174         public override bool Equals(object o) {
175                 if (!(o is HTLCOutputInCommitment)) return false;
176                 return this.eq((HTLCOutputInCommitment)o);
177         }
178         /**
179          * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
180          */
181         public byte[] write() {
182                 long ret = bindings.HTLCOutputInCommitment_write(this.ptr);
183                 GC.KeepAlive(this);
184                 if (ret >= 0 && ret <= 4096) { return null; }
185                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
186                 return ret_conv;
187         }
188
189         /**
190          * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
191          */
192         public static Result_HTLCOutputInCommitmentDecodeErrorZ read(byte[] ser) {
193                 long ret = bindings.HTLCOutputInCommitment_read(InternalUtils.encodeUint8Array(ser));
194                 GC.KeepAlive(ser);
195                 if (ret >= 0 && ret <= 4096) { return null; }
196                 Result_HTLCOutputInCommitmentDecodeErrorZ ret_hu_conv = Result_HTLCOutputInCommitmentDecodeErrorZ.constr_from_ptr(ret);
197                 return ret_hu_conv;
198         }
199
200 }
201 } } }