1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
12 * A tx_add_input message for adding an input during interactive transaction construction
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class TxAddInput extends CommonBase {
16 TxAddInput(Object _dummy, long ptr) { super(ptr); }
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
20 if (ptr != 0) { bindings.TxAddInput_free(ptr); }
26 public ChannelId get_channel_id() {
27 long ret = bindings.TxAddInput_get_channel_id(this.ptr);
28 Reference.reachabilityFence(this);
29 if (ret >= 0 && ret <= 4096) { return null; }
30 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
31 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
38 public void set_channel_id(org.ldk.structs.ChannelId val) {
39 bindings.TxAddInput_set_channel_id(this.ptr, val.ptr);
40 Reference.reachabilityFence(this);
41 Reference.reachabilityFence(val);
42 if (this != null) { this.ptrs_to.add(val); };
46 * A randomly chosen unique identifier for this input, which is even for initiators and odd for
49 public long get_serial_id() {
50 long ret = bindings.TxAddInput_get_serial_id(this.ptr);
51 Reference.reachabilityFence(this);
56 * A randomly chosen unique identifier for this input, which is even for initiators and odd for
59 public void set_serial_id(long val) {
60 bindings.TxAddInput_set_serial_id(this.ptr, val);
61 Reference.reachabilityFence(this);
62 Reference.reachabilityFence(val);
66 * Serialized transaction that contains the output this input spends to verify that it is non
69 public TransactionU16LenLimited get_prevtx() {
70 long ret = bindings.TxAddInput_get_prevtx(this.ptr);
71 Reference.reachabilityFence(this);
72 if (ret >= 0 && ret <= 4096) { return null; }
73 org.ldk.structs.TransactionU16LenLimited ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TransactionU16LenLimited(null, ret); }
74 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
79 * Serialized transaction that contains the output this input spends to verify that it is non
82 public void set_prevtx(org.ldk.structs.TransactionU16LenLimited val) {
83 bindings.TxAddInput_set_prevtx(this.ptr, val.ptr);
84 Reference.reachabilityFence(this);
85 Reference.reachabilityFence(val);
86 if (this != null) { this.ptrs_to.add(val); };
90 * The index of the output being spent
92 public int get_prevtx_out() {
93 int ret = bindings.TxAddInput_get_prevtx_out(this.ptr);
94 Reference.reachabilityFence(this);
99 * The index of the output being spent
101 public void set_prevtx_out(int val) {
102 bindings.TxAddInput_set_prevtx_out(this.ptr, val);
103 Reference.reachabilityFence(this);
104 Reference.reachabilityFence(val);
108 * The sequence number of this input
110 public int get_sequence() {
111 int ret = bindings.TxAddInput_get_sequence(this.ptr);
112 Reference.reachabilityFence(this);
117 * The sequence number of this input
119 public void set_sequence(int val) {
120 bindings.TxAddInput_set_sequence(this.ptr, val);
121 Reference.reachabilityFence(this);
122 Reference.reachabilityFence(val);
126 * Constructs a new TxAddInput given each field
128 public static TxAddInput of(org.ldk.structs.ChannelId channel_id_arg, long serial_id_arg, org.ldk.structs.TransactionU16LenLimited prevtx_arg, int prevtx_out_arg, int sequence_arg) {
129 long ret = bindings.TxAddInput_new(channel_id_arg.ptr, serial_id_arg, prevtx_arg.ptr, prevtx_out_arg, sequence_arg);
130 Reference.reachabilityFence(channel_id_arg);
131 Reference.reachabilityFence(serial_id_arg);
132 Reference.reachabilityFence(prevtx_arg);
133 Reference.reachabilityFence(prevtx_out_arg);
134 Reference.reachabilityFence(sequence_arg);
135 if (ret >= 0 && ret <= 4096) { return null; }
136 org.ldk.structs.TxAddInput ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxAddInput(null, ret); }
137 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
138 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_id_arg); };
139 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(prevtx_arg); };
144 long ret = bindings.TxAddInput_clone_ptr(this.ptr);
145 Reference.reachabilityFence(this);
150 * Creates a copy of the TxAddInput
152 public TxAddInput clone() {
153 long ret = bindings.TxAddInput_clone(this.ptr);
154 Reference.reachabilityFence(this);
155 if (ret >= 0 && ret <= 4096) { return null; }
156 org.ldk.structs.TxAddInput ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxAddInput(null, ret); }
157 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
162 * Generates a non-cryptographic 64-bit hash of the TxAddInput.
165 long ret = bindings.TxAddInput_hash(this.ptr);
166 Reference.reachabilityFence(this);
170 @Override public int hashCode() {
171 return (int)this.hash();
174 * Checks if two TxAddInputs contain equal inner contents.
175 * This ignores pointers and is_owned flags and looks at the values in fields.
176 * Two objects with NULL inner values will be considered "equal" here.
178 public boolean eq(org.ldk.structs.TxAddInput b) {
179 boolean ret = bindings.TxAddInput_eq(this.ptr, b.ptr);
180 Reference.reachabilityFence(this);
181 Reference.reachabilityFence(b);
182 if (this != null) { this.ptrs_to.add(b); };
186 @Override public boolean equals(Object o) {
187 if (!(o instanceof TxAddInput)) return false;
188 return this.eq((TxAddInput)o);
191 * Serialize the TxAddInput object into a byte array which can be read by TxAddInput_read
193 public byte[] write() {
194 byte[] ret = bindings.TxAddInput_write(this.ptr);
195 Reference.reachabilityFence(this);
200 * Read a TxAddInput from a byte array, created by TxAddInput_write
202 public static Result_TxAddInputDecodeErrorZ read(byte[] ser) {
203 long ret = bindings.TxAddInput_read(ser);
204 Reference.reachabilityFence(ser);
205 if (ret >= 0 && ret <= 4096) { return null; }
206 Result_TxAddInputDecodeErrorZ ret_hu_conv = Result_TxAddInputDecodeErrorZ.constr_from_ptr(ret);