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