Drop old manual implementations of the `Tx{In,Out}` getters
[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          * Checks if two TxSignaturess contain equal inner contents.
114          * This ignores pointers and is_owned flags and looks at the values in fields.
115          * Two objects with NULL inner values will be considered "equal" here.
116          */
117         public boolean eq(org.ldk.structs.TxSignatures b) {
118                 boolean ret = bindings.TxSignatures_eq(this.ptr, b == null ? 0 : b.ptr);
119                 Reference.reachabilityFence(this);
120                 Reference.reachabilityFence(b);
121                 if (this != null) { this.ptrs_to.add(b); };
122                 return ret;
123         }
124
125         @Override public boolean equals(Object o) {
126                 if (!(o instanceof TxSignatures)) return false;
127                 return this.eq((TxSignatures)o);
128         }
129         /**
130          * Serialize the TxSignatures object into a byte array which can be read by TxSignatures_read
131          */
132         public byte[] write() {
133                 byte[] ret = bindings.TxSignatures_write(this.ptr);
134                 Reference.reachabilityFence(this);
135                 return ret;
136         }
137
138         /**
139          * Read a TxSignatures from a byte array, created by TxSignatures_write
140          */
141         public static Result_TxSignaturesDecodeErrorZ read(byte[] ser) {
142                 long ret = bindings.TxSignatures_read(ser);
143                 Reference.reachabilityFence(ser);
144                 if (ret >= 0 && ret <= 4096) { return null; }
145                 Result_TxSignaturesDecodeErrorZ ret_hu_conv = Result_TxSignaturesDecodeErrorZ.constr_from_ptr(ret);
146                 return ret_hu_conv;
147         }
148
149 }