[C#] Update auto-generated files
[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                 byte[] ret = bindings.HTLCOutputInCommitment_get_payment_hash(this.ptr);
85                 GC.KeepAlive(this);
86                 return ret;
87         }
88
89         /**
90          * The hash of the preimage which unlocks this HTLC.
91          */
92         public void set_payment_hash(byte[] val) {
93                 bindings.HTLCOutputInCommitment_set_payment_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
94                 GC.KeepAlive(this);
95                 GC.KeepAlive(val);
96         }
97
98         /**
99          * The position within the commitment transactions' outputs. This may be None if the value is
100          * below the dust limit (in which case no output appears in the commitment transaction and the
101          * value is spent to additional transaction fees).
102          */
103         public Option_u32Z get_transaction_output_index() {
104                 long ret = bindings.HTLCOutputInCommitment_get_transaction_output_index(this.ptr);
105                 GC.KeepAlive(this);
106                 if (ret >= 0 && ret <= 4096) { return null; }
107                 org.ldk.structs.Option_u32Z ret_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(ret);
108                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
109                 return ret_hu_conv;
110         }
111
112         /**
113          * The position within the commitment transactions' outputs. This may be None if the value is
114          * below the dust limit (in which case no output appears in the commitment transaction and the
115          * value is spent to additional transaction fees).
116          */
117         public void set_transaction_output_index(org.ldk.structs.Option_u32Z val) {
118                 bindings.HTLCOutputInCommitment_set_transaction_output_index(this.ptr, val.ptr);
119                 GC.KeepAlive(this);
120                 GC.KeepAlive(val);
121                 if (this != null) { this.ptrs_to.AddLast(val); };
122         }
123
124         /**
125          * Constructs a new HTLCOutputInCommitment given each field
126          */
127         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) {
128                 long ret = bindings.HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, InternalUtils.check_arr_len(payment_hash_arg, 32), transaction_output_index_arg.ptr);
129                 GC.KeepAlive(offered_arg);
130                 GC.KeepAlive(amount_msat_arg);
131                 GC.KeepAlive(cltv_expiry_arg);
132                 GC.KeepAlive(payment_hash_arg);
133                 GC.KeepAlive(transaction_output_index_arg);
134                 if (ret >= 0 && ret <= 4096) { return null; }
135                 org.ldk.structs.HTLCOutputInCommitment ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.HTLCOutputInCommitment(null, ret); }
136                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
137                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(transaction_output_index_arg); };
138                 return ret_hu_conv;
139         }
140
141         internal long clone_ptr() {
142                 long ret = bindings.HTLCOutputInCommitment_clone_ptr(this.ptr);
143                 GC.KeepAlive(this);
144                 return ret;
145         }
146
147         /**
148          * Creates a copy of the HTLCOutputInCommitment
149          */
150         public HTLCOutputInCommitment clone() {
151                 long ret = bindings.HTLCOutputInCommitment_clone(this.ptr);
152                 GC.KeepAlive(this);
153                 if (ret >= 0 && ret <= 4096) { return null; }
154                 org.ldk.structs.HTLCOutputInCommitment ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.HTLCOutputInCommitment(null, ret); }
155                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
156                 return ret_hu_conv;
157         }
158
159         /**
160          * Checks if two HTLCOutputInCommitments contain equal inner contents.
161          * This ignores pointers and is_owned flags and looks at the values in fields.
162          * Two objects with NULL inner values will be considered "equal" here.
163          */
164         public bool eq(org.ldk.structs.HTLCOutputInCommitment b) {
165                 bool ret = bindings.HTLCOutputInCommitment_eq(this.ptr, b == null ? 0 : b.ptr);
166                 GC.KeepAlive(this);
167                 GC.KeepAlive(b);
168                 if (this != null) { this.ptrs_to.AddLast(b); };
169                 return ret;
170         }
171
172         public override bool Equals(object o) {
173                 if (!(o is HTLCOutputInCommitment)) return false;
174                 return this.eq((HTLCOutputInCommitment)o);
175         }
176         /**
177          * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
178          */
179         public byte[] write() {
180                 byte[] ret = bindings.HTLCOutputInCommitment_write(this.ptr);
181                 GC.KeepAlive(this);
182                 return ret;
183         }
184
185         /**
186          * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
187          */
188         public static Result_HTLCOutputInCommitmentDecodeErrorZ read(byte[] ser) {
189                 long ret = bindings.HTLCOutputInCommitment_read(ser);
190                 GC.KeepAlive(ser);
191                 if (ret >= 0 && ret <= 4096) { return null; }
192                 Result_HTLCOutputInCommitmentDecodeErrorZ ret_hu_conv = Result_HTLCOutputInCommitmentDecodeErrorZ.constr_from_ptr(ret);
193                 return ret_hu_conv;
194         }
195
196 }
197 } } }