Update auto-generated bindings to 0.0.103
[ldk-java] / src / main / java / org / ldk / structs / CommitmentSigned.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  * A commitment_signed message to be sent or received from a peer
12  */
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class CommitmentSigned extends CommonBase {
15         CommitmentSigned(Object _dummy, long ptr) { super(ptr); }
16         @Override @SuppressWarnings("deprecation")
17         protected void finalize() throws Throwable {
18                 super.finalize();
19                 if (ptr != 0) { bindings.CommitmentSigned_free(ptr); }
20         }
21
22         /**
23          * The channel ID
24          */
25         public byte[] get_channel_id() {
26                 byte[] ret = bindings.CommitmentSigned_get_channel_id(this.ptr);
27                 return ret;
28         }
29
30         /**
31          * The channel ID
32          */
33         public void set_channel_id(byte[] val) {
34                 bindings.CommitmentSigned_set_channel_id(this.ptr, val);
35         }
36
37         /**
38          * A signature on the commitment transaction
39          */
40         public byte[] get_signature() {
41                 byte[] ret = bindings.CommitmentSigned_get_signature(this.ptr);
42                 return ret;
43         }
44
45         /**
46          * A signature on the commitment transaction
47          */
48         public void set_signature(byte[] val) {
49                 bindings.CommitmentSigned_set_signature(this.ptr, val);
50         }
51
52         /**
53          * Signatures on the HTLC transactions
54          */
55         public void set_htlc_signatures(byte[][] val) {
56                 bindings.CommitmentSigned_set_htlc_signatures(this.ptr, val);
57         }
58
59         /**
60          * Constructs a new CommitmentSigned given each field
61          */
62         public static CommitmentSigned of(byte[] channel_id_arg, byte[] signature_arg, byte[][] htlc_signatures_arg) {
63                 long ret = bindings.CommitmentSigned_new(channel_id_arg, signature_arg, htlc_signatures_arg);
64                 if (ret >= 0 && ret <= 4096) { return null; }
65                 CommitmentSigned ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new CommitmentSigned(null, ret); }
66                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
67                 return ret_hu_conv;
68         }
69
70         /**
71          * Creates a copy of the CommitmentSigned
72          */
73         public CommitmentSigned clone() {
74                 long ret = bindings.CommitmentSigned_clone(this.ptr);
75                 if (ret >= 0 && ret <= 4096) { return null; }
76                 CommitmentSigned ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new CommitmentSigned(null, ret); }
77                 ret_hu_conv.ptrs_to.add(this);
78                 return ret_hu_conv;
79         }
80
81         /**
82          * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
83          */
84         public byte[] write() {
85                 byte[] ret = bindings.CommitmentSigned_write(this.ptr);
86                 return ret;
87         }
88
89         /**
90          * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
91          */
92         public static Result_CommitmentSignedDecodeErrorZ read(byte[] ser) {
93                 long ret = bindings.CommitmentSigned_read(ser);
94                 if (ret >= 0 && ret <= 4096) { return null; }
95                 Result_CommitmentSignedDecodeErrorZ ret_hu_conv = Result_CommitmentSignedDecodeErrorZ.constr_from_ptr(ret);
96                 return ret_hu_conv;
97         }
98
99 }