[Java] Update auto-generated Java bindings to LDK 0.0.121
[ldk-java] / src / main / java / org / ldk / structs / TxSignatures.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 java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10
11 /**
12  * A tx_signatures message containing the sender's signatures for a transaction constructed with
13  * interactive transaction construction.
14  */
15 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
16 public class TxSignatures extends CommonBase {
17         TxSignatures(Object _dummy, long ptr) { super(ptr); }
18         @Override @SuppressWarnings("deprecation")
19         protected void finalize() throws Throwable {
20                 super.finalize();
21                 if (ptr != 0) { bindings.TxSignatures_free(ptr); }
22         }
23
24         /**
25          * The channel ID
26          */
27         public byte[] get_channel_id() {
28                 byte[] ret = bindings.TxSignatures_get_channel_id(this.ptr);
29                 Reference.reachabilityFence(this);
30                 return ret;
31         }
32
33         /**
34          * The channel ID
35          */
36         public void set_channel_id(byte[] val) {
37                 bindings.TxSignatures_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
38                 Reference.reachabilityFence(this);
39                 Reference.reachabilityFence(val);
40         }
41
42         /**
43          * The TXID
44          */
45         public byte[] get_tx_hash() {
46                 byte[] ret = bindings.TxSignatures_get_tx_hash(this.ptr);
47                 Reference.reachabilityFence(this);
48                 return ret;
49         }
50
51         /**
52          * The TXID
53          */
54         public void set_tx_hash(byte[] val) {
55                 bindings.TxSignatures_set_tx_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
56                 Reference.reachabilityFence(this);
57                 Reference.reachabilityFence(val);
58         }
59
60         /**
61          * The list of witnesses
62          * 
63          * Returns a copy of the field.
64          */
65         public byte[][] get_witnesses() {
66                 byte[][] ret = bindings.TxSignatures_get_witnesses(this.ptr);
67                 Reference.reachabilityFence(this);
68                 return ret;
69         }
70
71         /**
72          * The list of witnesses
73          */
74         public void set_witnesses(byte[][] val) {
75                 bindings.TxSignatures_set_witnesses(this.ptr, val);
76                 Reference.reachabilityFence(this);
77                 Reference.reachabilityFence(val);
78         }
79
80         /**
81          * Constructs a new TxSignatures given each field
82          */
83         public static TxSignatures of(byte[] channel_id_arg, byte[] tx_hash_arg, byte[][] witnesses_arg) {
84                 long ret = bindings.TxSignatures_new(InternalUtils.check_arr_len(channel_id_arg, 32), InternalUtils.check_arr_len(tx_hash_arg, 32), witnesses_arg);
85                 Reference.reachabilityFence(channel_id_arg);
86                 Reference.reachabilityFence(tx_hash_arg);
87                 Reference.reachabilityFence(witnesses_arg);
88                 if (ret >= 0 && ret <= 4096) { return null; }
89                 org.ldk.structs.TxSignatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxSignatures(null, ret); }
90                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
91                 return ret_hu_conv;
92         }
93
94         long clone_ptr() {
95                 long ret = bindings.TxSignatures_clone_ptr(this.ptr);
96                 Reference.reachabilityFence(this);
97                 return ret;
98         }
99
100         /**
101          * Creates a copy of the TxSignatures
102          */
103         public TxSignatures clone() {
104                 long ret = bindings.TxSignatures_clone(this.ptr);
105                 Reference.reachabilityFence(this);
106                 if (ret >= 0 && ret <= 4096) { return null; }
107                 org.ldk.structs.TxSignatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxSignatures(null, ret); }
108                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
109                 return ret_hu_conv;
110         }
111
112         /**
113          * Generates a non-cryptographic 64-bit hash of the TxSignatures.
114          */
115         public long hash() {
116                 long ret = bindings.TxSignatures_hash(this.ptr);
117                 Reference.reachabilityFence(this);
118                 return ret;
119         }
120
121         @Override public int hashCode() {
122                 return (int)this.hash();
123         }
124         /**
125          * Checks if two TxSignaturess contain equal inner contents.
126          * This ignores pointers and is_owned flags and looks at the values in fields.
127          * Two objects with NULL inner values will be considered "equal" here.
128          */
129         public boolean eq(org.ldk.structs.TxSignatures b) {
130                 boolean ret = bindings.TxSignatures_eq(this.ptr, b == null ? 0 : b.ptr);
131                 Reference.reachabilityFence(this);
132                 Reference.reachabilityFence(b);
133                 if (this != null) { this.ptrs_to.add(b); };
134                 return ret;
135         }
136
137         @Override public boolean equals(Object o) {
138                 if (!(o instanceof TxSignatures)) return false;
139                 return this.eq((TxSignatures)o);
140         }
141         /**
142          * Serialize the TxSignatures object into a byte array which can be read by TxSignatures_read
143          */
144         public byte[] write() {
145                 byte[] ret = bindings.TxSignatures_write(this.ptr);
146                 Reference.reachabilityFence(this);
147                 return ret;
148         }
149
150         /**
151          * Read a TxSignatures from a byte array, created by TxSignatures_write
152          */
153         public static Result_TxSignaturesDecodeErrorZ read(byte[] ser) {
154                 long ret = bindings.TxSignatures_read(ser);
155                 Reference.reachabilityFence(ser);
156                 if (ret >= 0 && ret <= 4096) { return null; }
157                 Result_TxSignaturesDecodeErrorZ ret_hu_conv = Result_TxSignaturesDecodeErrorZ.constr_from_ptr(ret);
158                 return ret_hu_conv;
159         }
160
161 }