[C#] Check in initial auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / OpenChannel.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  * An open_channel message to be sent or received from a peer
11  */
12 public class OpenChannel : CommonBase {
13         internal OpenChannel(object _dummy, long ptr) : base(ptr) { }
14         ~OpenChannel() {
15                 if (ptr != 0) { bindings.OpenChannel_free(ptr); }
16         }
17
18         /**
19          * The genesis hash of the blockchain where the channel is to be opened
20          */
21         public byte[] get_chain_hash() {
22                 byte[] ret = bindings.OpenChannel_get_chain_hash(this.ptr);
23                 GC.KeepAlive(this);
24                 return ret;
25         }
26
27         /**
28          * The genesis hash of the blockchain where the channel is to be opened
29          */
30         public void set_chain_hash(byte[] val) {
31                 bindings.OpenChannel_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
32                 GC.KeepAlive(this);
33                 GC.KeepAlive(val);
34         }
35
36         /**
37          * A temporary channel ID, until the funding outpoint is announced
38          */
39         public byte[] get_temporary_channel_id() {
40                 byte[] ret = bindings.OpenChannel_get_temporary_channel_id(this.ptr);
41                 GC.KeepAlive(this);
42                 return ret;
43         }
44
45         /**
46          * A temporary channel ID, until the funding outpoint is announced
47          */
48         public void set_temporary_channel_id(byte[] val) {
49                 bindings.OpenChannel_set_temporary_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
50                 GC.KeepAlive(this);
51                 GC.KeepAlive(val);
52         }
53
54         /**
55          * The channel value
56          */
57         public long get_funding_satoshis() {
58                 long ret = bindings.OpenChannel_get_funding_satoshis(this.ptr);
59                 GC.KeepAlive(this);
60                 return ret;
61         }
62
63         /**
64          * The channel value
65          */
66         public void set_funding_satoshis(long val) {
67                 bindings.OpenChannel_set_funding_satoshis(this.ptr, val);
68                 GC.KeepAlive(this);
69                 GC.KeepAlive(val);
70         }
71
72         /**
73          * The amount to push to the counterparty as part of the open, in milli-satoshi
74          */
75         public long get_push_msat() {
76                 long ret = bindings.OpenChannel_get_push_msat(this.ptr);
77                 GC.KeepAlive(this);
78                 return ret;
79         }
80
81         /**
82          * The amount to push to the counterparty as part of the open, in milli-satoshi
83          */
84         public void set_push_msat(long val) {
85                 bindings.OpenChannel_set_push_msat(this.ptr, val);
86                 GC.KeepAlive(this);
87                 GC.KeepAlive(val);
88         }
89
90         /**
91          * The threshold below which outputs on transactions broadcast by sender will be omitted
92          */
93         public long get_dust_limit_satoshis() {
94                 long ret = bindings.OpenChannel_get_dust_limit_satoshis(this.ptr);
95                 GC.KeepAlive(this);
96                 return ret;
97         }
98
99         /**
100          * The threshold below which outputs on transactions broadcast by sender will be omitted
101          */
102         public void set_dust_limit_satoshis(long val) {
103                 bindings.OpenChannel_set_dust_limit_satoshis(this.ptr, val);
104                 GC.KeepAlive(this);
105                 GC.KeepAlive(val);
106         }
107
108         /**
109          * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
110          */
111         public long get_max_htlc_value_in_flight_msat() {
112                 long ret = bindings.OpenChannel_get_max_htlc_value_in_flight_msat(this.ptr);
113                 GC.KeepAlive(this);
114                 return ret;
115         }
116
117         /**
118          * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
119          */
120         public void set_max_htlc_value_in_flight_msat(long val) {
121                 bindings.OpenChannel_set_max_htlc_value_in_flight_msat(this.ptr, val);
122                 GC.KeepAlive(this);
123                 GC.KeepAlive(val);
124         }
125
126         /**
127          * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
128          */
129         public long get_channel_reserve_satoshis() {
130                 long ret = bindings.OpenChannel_get_channel_reserve_satoshis(this.ptr);
131                 GC.KeepAlive(this);
132                 return ret;
133         }
134
135         /**
136          * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
137          */
138         public void set_channel_reserve_satoshis(long val) {
139                 bindings.OpenChannel_set_channel_reserve_satoshis(this.ptr, val);
140                 GC.KeepAlive(this);
141                 GC.KeepAlive(val);
142         }
143
144         /**
145          * The minimum HTLC size incoming to sender, in milli-satoshi
146          */
147         public long get_htlc_minimum_msat() {
148                 long ret = bindings.OpenChannel_get_htlc_minimum_msat(this.ptr);
149                 GC.KeepAlive(this);
150                 return ret;
151         }
152
153         /**
154          * The minimum HTLC size incoming to sender, in milli-satoshi
155          */
156         public void set_htlc_minimum_msat(long val) {
157                 bindings.OpenChannel_set_htlc_minimum_msat(this.ptr, val);
158                 GC.KeepAlive(this);
159                 GC.KeepAlive(val);
160         }
161
162         /**
163          * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
164          */
165         public int get_feerate_per_kw() {
166                 int ret = bindings.OpenChannel_get_feerate_per_kw(this.ptr);
167                 GC.KeepAlive(this);
168                 return ret;
169         }
170
171         /**
172          * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
173          */
174         public void set_feerate_per_kw(int val) {
175                 bindings.OpenChannel_set_feerate_per_kw(this.ptr, val);
176                 GC.KeepAlive(this);
177                 GC.KeepAlive(val);
178         }
179
180         /**
181          * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
182          */
183         public short get_to_self_delay() {
184                 short ret = bindings.OpenChannel_get_to_self_delay(this.ptr);
185                 GC.KeepAlive(this);
186                 return ret;
187         }
188
189         /**
190          * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
191          */
192         public void set_to_self_delay(short val) {
193                 bindings.OpenChannel_set_to_self_delay(this.ptr, val);
194                 GC.KeepAlive(this);
195                 GC.KeepAlive(val);
196         }
197
198         /**
199          * The maximum number of inbound HTLCs towards sender
200          */
201         public short get_max_accepted_htlcs() {
202                 short ret = bindings.OpenChannel_get_max_accepted_htlcs(this.ptr);
203                 GC.KeepAlive(this);
204                 return ret;
205         }
206
207         /**
208          * The maximum number of inbound HTLCs towards sender
209          */
210         public void set_max_accepted_htlcs(short val) {
211                 bindings.OpenChannel_set_max_accepted_htlcs(this.ptr, val);
212                 GC.KeepAlive(this);
213                 GC.KeepAlive(val);
214         }
215
216         /**
217          * The sender's key controlling the funding transaction
218          */
219         public byte[] get_funding_pubkey() {
220                 byte[] ret = bindings.OpenChannel_get_funding_pubkey(this.ptr);
221                 GC.KeepAlive(this);
222                 return ret;
223         }
224
225         /**
226          * The sender's key controlling the funding transaction
227          */
228         public void set_funding_pubkey(byte[] val) {
229                 bindings.OpenChannel_set_funding_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
230                 GC.KeepAlive(this);
231                 GC.KeepAlive(val);
232         }
233
234         /**
235          * Used to derive a revocation key for transactions broadcast by counterparty
236          */
237         public byte[] get_revocation_basepoint() {
238                 byte[] ret = bindings.OpenChannel_get_revocation_basepoint(this.ptr);
239                 GC.KeepAlive(this);
240                 return ret;
241         }
242
243         /**
244          * Used to derive a revocation key for transactions broadcast by counterparty
245          */
246         public void set_revocation_basepoint(byte[] val) {
247                 bindings.OpenChannel_set_revocation_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
248                 GC.KeepAlive(this);
249                 GC.KeepAlive(val);
250         }
251
252         /**
253          * A payment key to sender for transactions broadcast by counterparty
254          */
255         public byte[] get_payment_point() {
256                 byte[] ret = bindings.OpenChannel_get_payment_point(this.ptr);
257                 GC.KeepAlive(this);
258                 return ret;
259         }
260
261         /**
262          * A payment key to sender for transactions broadcast by counterparty
263          */
264         public void set_payment_point(byte[] val) {
265                 bindings.OpenChannel_set_payment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
266                 GC.KeepAlive(this);
267                 GC.KeepAlive(val);
268         }
269
270         /**
271          * Used to derive a payment key to sender for transactions broadcast by sender
272          */
273         public byte[] get_delayed_payment_basepoint() {
274                 byte[] ret = bindings.OpenChannel_get_delayed_payment_basepoint(this.ptr);
275                 GC.KeepAlive(this);
276                 return ret;
277         }
278
279         /**
280          * Used to derive a payment key to sender for transactions broadcast by sender
281          */
282         public void set_delayed_payment_basepoint(byte[] val) {
283                 bindings.OpenChannel_set_delayed_payment_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
284                 GC.KeepAlive(this);
285                 GC.KeepAlive(val);
286         }
287
288         /**
289          * Used to derive an HTLC payment key to sender
290          */
291         public byte[] get_htlc_basepoint() {
292                 byte[] ret = bindings.OpenChannel_get_htlc_basepoint(this.ptr);
293                 GC.KeepAlive(this);
294                 return ret;
295         }
296
297         /**
298          * Used to derive an HTLC payment key to sender
299          */
300         public void set_htlc_basepoint(byte[] val) {
301                 bindings.OpenChannel_set_htlc_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
302                 GC.KeepAlive(this);
303                 GC.KeepAlive(val);
304         }
305
306         /**
307          * The first to-be-broadcast-by-sender transaction's per commitment point
308          */
309         public byte[] get_first_per_commitment_point() {
310                 byte[] ret = bindings.OpenChannel_get_first_per_commitment_point(this.ptr);
311                 GC.KeepAlive(this);
312                 return ret;
313         }
314
315         /**
316          * The first to-be-broadcast-by-sender transaction's per commitment point
317          */
318         public void set_first_per_commitment_point(byte[] val) {
319                 bindings.OpenChannel_set_first_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
320                 GC.KeepAlive(this);
321                 GC.KeepAlive(val);
322         }
323
324         /**
325          * Channel flags
326          */
327         public byte get_channel_flags() {
328                 byte ret = bindings.OpenChannel_get_channel_flags(this.ptr);
329                 GC.KeepAlive(this);
330                 return ret;
331         }
332
333         /**
334          * Channel flags
335          */
336         public void set_channel_flags(byte val) {
337                 bindings.OpenChannel_set_channel_flags(this.ptr, val);
338                 GC.KeepAlive(this);
339                 GC.KeepAlive(val);
340         }
341
342         /**
343          * The channel type that this channel will represent. If none is set, we derive the channel
344          * type from the intersection of our feature bits with our counterparty's feature bits from
345          * the Init message.
346          * 
347          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
348          */
349         public ChannelTypeFeatures get_channel_type() {
350                 long ret = bindings.OpenChannel_get_channel_type(this.ptr);
351                 GC.KeepAlive(this);
352                 if (ret >= 0 && ret <= 4096) { return null; }
353                 org.ldk.structs.ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, ret); }
354                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
355                 return ret_hu_conv;
356         }
357
358         /**
359          * The channel type that this channel will represent. If none is set, we derive the channel
360          * type from the intersection of our feature bits with our counterparty's feature bits from
361          * the Init message.
362          * 
363          * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
364          */
365         public void set_channel_type(org.ldk.structs.ChannelTypeFeatures val) {
366                 bindings.OpenChannel_set_channel_type(this.ptr, val == null ? 0 : val.ptr);
367                 GC.KeepAlive(this);
368                 GC.KeepAlive(val);
369                 if (this != null) { this.ptrs_to.AddLast(val); };
370         }
371
372         internal long clone_ptr() {
373                 long ret = bindings.OpenChannel_clone_ptr(this.ptr);
374                 GC.KeepAlive(this);
375                 return ret;
376         }
377
378         /**
379          * Creates a copy of the OpenChannel
380          */
381         public OpenChannel clone() {
382                 long ret = bindings.OpenChannel_clone(this.ptr);
383                 GC.KeepAlive(this);
384                 if (ret >= 0 && ret <= 4096) { return null; }
385                 org.ldk.structs.OpenChannel ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OpenChannel(null, ret); }
386                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
387                 return ret_hu_conv;
388         }
389
390         /**
391          * Checks if two OpenChannels contain equal inner contents.
392          * This ignores pointers and is_owned flags and looks at the values in fields.
393          * Two objects with NULL inner values will be considered "equal" here.
394          */
395         public bool eq(org.ldk.structs.OpenChannel b) {
396                 bool ret = bindings.OpenChannel_eq(this.ptr, b == null ? 0 : b.ptr);
397                 GC.KeepAlive(this);
398                 GC.KeepAlive(b);
399                 if (this != null) { this.ptrs_to.AddLast(b); };
400                 return ret;
401         }
402
403         public override bool Equals(object o) {
404                 if (!(o is OpenChannel)) return false;
405                 return this.eq((OpenChannel)o);
406         }
407         /**
408          * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
409          */
410         public byte[] write() {
411                 byte[] ret = bindings.OpenChannel_write(this.ptr);
412                 GC.KeepAlive(this);
413                 return ret;
414         }
415
416         /**
417          * Read a OpenChannel from a byte array, created by OpenChannel_write
418          */
419         public static Result_OpenChannelDecodeErrorZ read(byte[] ser) {
420                 long ret = bindings.OpenChannel_read(ser);
421                 GC.KeepAlive(ser);
422                 if (ret >= 0 && ret <= 4096) { return null; }
423                 Result_OpenChannelDecodeErrorZ ret_hu_conv = Result_OpenChannelDecodeErrorZ.constr_from_ptr(ret);
424                 return ret_hu_conv;
425         }
426
427 }
428 } } }