[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / ChannelReestablish.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  * A [`channel_reestablish`] message to be sent to or received from a peer.
11  * 
12  * [`channel_reestablish`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#message-retransmission
13  */
14 public class ChannelReestablish : CommonBase {
15         internal ChannelReestablish(object _dummy, long ptr) : base(ptr) { }
16         ~ChannelReestablish() {
17                 if (ptr != 0) { bindings.ChannelReestablish_free(ptr); }
18         }
19
20         /**
21          * The channel ID
22          */
23         public byte[] get_channel_id() {
24                 long ret = bindings.ChannelReestablish_get_channel_id(this.ptr);
25                 GC.KeepAlive(this);
26                 if (ret >= 0 && ret <= 4096) { return null; }
27                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
28                 return ret_conv;
29         }
30
31         /**
32          * The channel ID
33          */
34         public void set_channel_id(byte[] val) {
35                 bindings.ChannelReestablish_set_channel_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
36                 GC.KeepAlive(this);
37                 GC.KeepAlive(val);
38         }
39
40         /**
41          * The next commitment number for the sender
42          */
43         public long get_next_local_commitment_number() {
44                 long ret = bindings.ChannelReestablish_get_next_local_commitment_number(this.ptr);
45                 GC.KeepAlive(this);
46                 return ret;
47         }
48
49         /**
50          * The next commitment number for the sender
51          */
52         public void set_next_local_commitment_number(long val) {
53                 bindings.ChannelReestablish_set_next_local_commitment_number(this.ptr, val);
54                 GC.KeepAlive(this);
55                 GC.KeepAlive(val);
56         }
57
58         /**
59          * The next commitment number for the recipient
60          */
61         public long get_next_remote_commitment_number() {
62                 long ret = bindings.ChannelReestablish_get_next_remote_commitment_number(this.ptr);
63                 GC.KeepAlive(this);
64                 return ret;
65         }
66
67         /**
68          * The next commitment number for the recipient
69          */
70         public void set_next_remote_commitment_number(long val) {
71                 bindings.ChannelReestablish_set_next_remote_commitment_number(this.ptr, val);
72                 GC.KeepAlive(this);
73                 GC.KeepAlive(val);
74         }
75
76         /**
77          * Proof that the sender knows the per-commitment secret of a specific commitment transaction
78          * belonging to the recipient
79          */
80         public byte[] get_your_last_per_commitment_secret() {
81                 long ret = bindings.ChannelReestablish_get_your_last_per_commitment_secret(this.ptr);
82                 GC.KeepAlive(this);
83                 if (ret >= 0 && ret <= 4096) { return null; }
84                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
85                 return ret_conv;
86         }
87
88         /**
89          * Proof that the sender knows the per-commitment secret of a specific commitment transaction
90          * belonging to the recipient
91          */
92         public void set_your_last_per_commitment_secret(byte[] val) {
93                 bindings.ChannelReestablish_set_your_last_per_commitment_secret(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
94                 GC.KeepAlive(this);
95                 GC.KeepAlive(val);
96         }
97
98         /**
99          * The sender's per-commitment point for their current commitment transaction
100          */
101         public byte[] get_my_current_per_commitment_point() {
102                 long ret = bindings.ChannelReestablish_get_my_current_per_commitment_point(this.ptr);
103                 GC.KeepAlive(this);
104                 if (ret >= 0 && ret <= 4096) { return null; }
105                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
106                 return ret_conv;
107         }
108
109         /**
110          * The sender's per-commitment point for their current commitment transaction
111          */
112         public void set_my_current_per_commitment_point(byte[] val) {
113                 bindings.ChannelReestablish_set_my_current_per_commitment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
114                 GC.KeepAlive(this);
115                 GC.KeepAlive(val);
116         }
117
118         /**
119          * The next funding transaction ID
120          */
121         public Option_ThirtyTwoBytesZ get_next_funding_txid() {
122                 long ret = bindings.ChannelReestablish_get_next_funding_txid(this.ptr);
123                 GC.KeepAlive(this);
124                 if (ret >= 0 && ret <= 4096) { return null; }
125                 org.ldk.structs.Option_ThirtyTwoBytesZ ret_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(ret);
126                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
127                 return ret_hu_conv;
128         }
129
130         /**
131          * The next funding transaction ID
132          */
133         public void set_next_funding_txid(org.ldk.structs.Option_ThirtyTwoBytesZ val) {
134                 bindings.ChannelReestablish_set_next_funding_txid(this.ptr, val.ptr);
135                 GC.KeepAlive(this);
136                 GC.KeepAlive(val);
137                 if (this != null) { this.ptrs_to.AddLast(val); };
138         }
139
140         /**
141          * Constructs a new ChannelReestablish given each field
142          */
143         public static ChannelReestablish of(byte[] channel_id_arg, long next_local_commitment_number_arg, long next_remote_commitment_number_arg, byte[] your_last_per_commitment_secret_arg, byte[] my_current_per_commitment_point_arg, org.ldk.structs.Option_ThirtyTwoBytesZ next_funding_txid_arg) {
144                 long ret = bindings.ChannelReestablish_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(channel_id_arg, 32)), next_local_commitment_number_arg, next_remote_commitment_number_arg, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(your_last_per_commitment_secret_arg, 32)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(my_current_per_commitment_point_arg, 33)), next_funding_txid_arg.ptr);
145                 GC.KeepAlive(channel_id_arg);
146                 GC.KeepAlive(next_local_commitment_number_arg);
147                 GC.KeepAlive(next_remote_commitment_number_arg);
148                 GC.KeepAlive(your_last_per_commitment_secret_arg);
149                 GC.KeepAlive(my_current_per_commitment_point_arg);
150                 GC.KeepAlive(next_funding_txid_arg);
151                 if (ret >= 0 && ret <= 4096) { return null; }
152                 org.ldk.structs.ChannelReestablish ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelReestablish(null, ret); }
153                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
154                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(next_funding_txid_arg); };
155                 return ret_hu_conv;
156         }
157
158         internal long clone_ptr() {
159                 long ret = bindings.ChannelReestablish_clone_ptr(this.ptr);
160                 GC.KeepAlive(this);
161                 return ret;
162         }
163
164         /**
165          * Creates a copy of the ChannelReestablish
166          */
167         public ChannelReestablish clone() {
168                 long ret = bindings.ChannelReestablish_clone(this.ptr);
169                 GC.KeepAlive(this);
170                 if (ret >= 0 && ret <= 4096) { return null; }
171                 org.ldk.structs.ChannelReestablish ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelReestablish(null, ret); }
172                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
173                 return ret_hu_conv;
174         }
175
176         /**
177          * Checks if two ChannelReestablishs contain equal inner contents.
178          * This ignores pointers and is_owned flags and looks at the values in fields.
179          * Two objects with NULL inner values will be considered "equal" here.
180          */
181         public bool eq(org.ldk.structs.ChannelReestablish b) {
182                 bool ret = bindings.ChannelReestablish_eq(this.ptr, b == null ? 0 : b.ptr);
183                 GC.KeepAlive(this);
184                 GC.KeepAlive(b);
185                 if (this != null) { this.ptrs_to.AddLast(b); };
186                 return ret;
187         }
188
189         public override bool Equals(object o) {
190                 if (!(o is ChannelReestablish)) return false;
191                 return this.eq((ChannelReestablish)o);
192         }
193         /**
194          * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read
195          */
196         public byte[] write() {
197                 long ret = bindings.ChannelReestablish_write(this.ptr);
198                 GC.KeepAlive(this);
199                 if (ret >= 0 && ret <= 4096) { return null; }
200                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
201                 return ret_conv;
202         }
203
204         /**
205          * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write
206          */
207         public static Result_ChannelReestablishDecodeErrorZ read(byte[] ser) {
208                 long ret = bindings.ChannelReestablish_read(InternalUtils.encodeUint8Array(ser));
209                 GC.KeepAlive(ser);
210                 if (ret >= 0 && ret <= 4096) { return null; }
211                 Result_ChannelReestablishDecodeErrorZ ret_hu_conv = Result_ChannelReestablishDecodeErrorZ.constr_from_ptr(ret);
212                 return ret_hu_conv;
213         }
214
215 }
216 } } }