Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / OpenChannel.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
8
9
10 /**
11  * An open_channel message to be sent or received from a peer
12  */
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class OpenChannel extends CommonBase {
15         OpenChannel(Object _dummy, long ptr) { super(ptr); }
16         @Override @SuppressWarnings("deprecation")
17         protected void finalize() throws Throwable {
18                 super.finalize();
19                 if (ptr != 0) { bindings.OpenChannel_free(ptr); }
20         }
21
22         /**
23          * The genesis hash of the blockchain where the channel is to be opened
24          */
25         public byte[] get_chain_hash() {
26                 byte[] ret = bindings.OpenChannel_get_chain_hash(this.ptr);
27                 return ret;
28         }
29
30         /**
31          * The genesis hash of the blockchain where the channel is to be opened
32          */
33         public void set_chain_hash(byte[] val) {
34                 bindings.OpenChannel_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
35         }
36
37         /**
38          * A temporary channel ID, until the funding outpoint is announced
39          */
40         public byte[] get_temporary_channel_id() {
41                 byte[] ret = bindings.OpenChannel_get_temporary_channel_id(this.ptr);
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         }
51
52         /**
53          * The channel value
54          */
55         public long get_funding_satoshis() {
56                 long ret = bindings.OpenChannel_get_funding_satoshis(this.ptr);
57                 return ret;
58         }
59
60         /**
61          * The channel value
62          */
63         public void set_funding_satoshis(long val) {
64                 bindings.OpenChannel_set_funding_satoshis(this.ptr, val);
65         }
66
67         /**
68          * The amount to push to the counterparty as part of the open, in milli-satoshi
69          */
70         public long get_push_msat() {
71                 long ret = bindings.OpenChannel_get_push_msat(this.ptr);
72                 return ret;
73         }
74
75         /**
76          * The amount to push to the counterparty as part of the open, in milli-satoshi
77          */
78         public void set_push_msat(long val) {
79                 bindings.OpenChannel_set_push_msat(this.ptr, val);
80         }
81
82         /**
83          * The threshold below which outputs on transactions broadcast by sender will be omitted
84          */
85         public long get_dust_limit_satoshis() {
86                 long ret = bindings.OpenChannel_get_dust_limit_satoshis(this.ptr);
87                 return ret;
88         }
89
90         /**
91          * The threshold below which outputs on transactions broadcast by sender will be omitted
92          */
93         public void set_dust_limit_satoshis(long val) {
94                 bindings.OpenChannel_set_dust_limit_satoshis(this.ptr, val);
95         }
96
97         /**
98          * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
99          */
100         public long get_max_htlc_value_in_flight_msat() {
101                 long ret = bindings.OpenChannel_get_max_htlc_value_in_flight_msat(this.ptr);
102                 return ret;
103         }
104
105         /**
106          * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
107          */
108         public void set_max_htlc_value_in_flight_msat(long val) {
109                 bindings.OpenChannel_set_max_htlc_value_in_flight_msat(this.ptr, val);
110         }
111
112         /**
113          * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
114          */
115         public long get_channel_reserve_satoshis() {
116                 long ret = bindings.OpenChannel_get_channel_reserve_satoshis(this.ptr);
117                 return ret;
118         }
119
120         /**
121          * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
122          */
123         public void set_channel_reserve_satoshis(long val) {
124                 bindings.OpenChannel_set_channel_reserve_satoshis(this.ptr, val);
125         }
126
127         /**
128          * The minimum HTLC size incoming to sender, in milli-satoshi
129          */
130         public long get_htlc_minimum_msat() {
131                 long ret = bindings.OpenChannel_get_htlc_minimum_msat(this.ptr);
132                 return ret;
133         }
134
135         /**
136          * The minimum HTLC size incoming to sender, in milli-satoshi
137          */
138         public void set_htlc_minimum_msat(long val) {
139                 bindings.OpenChannel_set_htlc_minimum_msat(this.ptr, val);
140         }
141
142         /**
143          * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
144          */
145         public int get_feerate_per_kw() {
146                 int ret = bindings.OpenChannel_get_feerate_per_kw(this.ptr);
147                 return ret;
148         }
149
150         /**
151          * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
152          */
153         public void set_feerate_per_kw(int val) {
154                 bindings.OpenChannel_set_feerate_per_kw(this.ptr, val);
155         }
156
157         /**
158          * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
159          */
160         public short get_to_self_delay() {
161                 short ret = bindings.OpenChannel_get_to_self_delay(this.ptr);
162                 return ret;
163         }
164
165         /**
166          * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
167          */
168         public void set_to_self_delay(short val) {
169                 bindings.OpenChannel_set_to_self_delay(this.ptr, val);
170         }
171
172         /**
173          * The maximum number of inbound HTLCs towards sender
174          */
175         public short get_max_accepted_htlcs() {
176                 short ret = bindings.OpenChannel_get_max_accepted_htlcs(this.ptr);
177                 return ret;
178         }
179
180         /**
181          * The maximum number of inbound HTLCs towards sender
182          */
183         public void set_max_accepted_htlcs(short val) {
184                 bindings.OpenChannel_set_max_accepted_htlcs(this.ptr, val);
185         }
186
187         /**
188          * The sender's key controlling the funding transaction
189          */
190         public byte[] get_funding_pubkey() {
191                 byte[] ret = bindings.OpenChannel_get_funding_pubkey(this.ptr);
192                 return ret;
193         }
194
195         /**
196          * The sender's key controlling the funding transaction
197          */
198         public void set_funding_pubkey(byte[] val) {
199                 bindings.OpenChannel_set_funding_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
200         }
201
202         /**
203          * Used to derive a revocation key for transactions broadcast by counterparty
204          */
205         public byte[] get_revocation_basepoint() {
206                 byte[] ret = bindings.OpenChannel_get_revocation_basepoint(this.ptr);
207                 return ret;
208         }
209
210         /**
211          * Used to derive a revocation key for transactions broadcast by counterparty
212          */
213         public void set_revocation_basepoint(byte[] val) {
214                 bindings.OpenChannel_set_revocation_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
215         }
216
217         /**
218          * A payment key to sender for transactions broadcast by counterparty
219          */
220         public byte[] get_payment_point() {
221                 byte[] ret = bindings.OpenChannel_get_payment_point(this.ptr);
222                 return ret;
223         }
224
225         /**
226          * A payment key to sender for transactions broadcast by counterparty
227          */
228         public void set_payment_point(byte[] val) {
229                 bindings.OpenChannel_set_payment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
230         }
231
232         /**
233          * Used to derive a payment key to sender for transactions broadcast by sender
234          */
235         public byte[] get_delayed_payment_basepoint() {
236                 byte[] ret = bindings.OpenChannel_get_delayed_payment_basepoint(this.ptr);
237                 return ret;
238         }
239
240         /**
241          * Used to derive a payment key to sender for transactions broadcast by sender
242          */
243         public void set_delayed_payment_basepoint(byte[] val) {
244                 bindings.OpenChannel_set_delayed_payment_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
245         }
246
247         /**
248          * Used to derive an HTLC payment key to sender
249          */
250         public byte[] get_htlc_basepoint() {
251                 byte[] ret = bindings.OpenChannel_get_htlc_basepoint(this.ptr);
252                 return ret;
253         }
254
255         /**
256          * Used to derive an HTLC payment key to sender
257          */
258         public void set_htlc_basepoint(byte[] val) {
259                 bindings.OpenChannel_set_htlc_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
260         }
261
262         /**
263          * The first to-be-broadcast-by-sender transaction's per commitment point
264          */
265         public byte[] get_first_per_commitment_point() {
266                 byte[] ret = bindings.OpenChannel_get_first_per_commitment_point(this.ptr);
267                 return ret;
268         }
269
270         /**
271          * The first to-be-broadcast-by-sender transaction's per commitment point
272          */
273         public void set_first_per_commitment_point(byte[] val) {
274                 bindings.OpenChannel_set_first_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
275         }
276
277         /**
278          * Channel flags
279          */
280         public byte get_channel_flags() {
281                 byte ret = bindings.OpenChannel_get_channel_flags(this.ptr);
282                 return ret;
283         }
284
285         /**
286          * Channel flags
287          */
288         public void set_channel_flags(byte val) {
289                 bindings.OpenChannel_set_channel_flags(this.ptr, val);
290         }
291
292         long clone_ptr() {
293                 long ret = bindings.OpenChannel_clone_ptr(this.ptr);
294                 return ret;
295         }
296
297         /**
298          * Creates a copy of the OpenChannel
299          */
300         public OpenChannel clone() {
301                 long ret = bindings.OpenChannel_clone(this.ptr);
302                 if (ret >= 0 && ret <= 4096) { return null; }
303                 OpenChannel ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new OpenChannel(null, ret); }
304                 ret_hu_conv.ptrs_to.add(this);
305                 return ret_hu_conv;
306         }
307
308         /**
309          * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
310          */
311         public byte[] write() {
312                 byte[] ret = bindings.OpenChannel_write(this.ptr);
313                 return ret;
314         }
315
316         /**
317          * Read a OpenChannel from a byte array, created by OpenChannel_write
318          */
319         public static Result_OpenChannelDecodeErrorZ read(byte[] ser) {
320                 long ret = bindings.OpenChannel_read(ser);
321                 if (ret >= 0 && ret <= 4096) { return null; }
322                 Result_OpenChannelDecodeErrorZ ret_hu_conv = Result_OpenChannelDecodeErrorZ.constr_from_ptr(ret);
323                 return ret_hu_conv;
324         }
325
326 }