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_remove_input message for removing an input during interactive transaction construction.
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class TxRemoveInput extends CommonBase {
16 TxRemoveInput(Object _dummy, long ptr) { super(ptr); }
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
20 if (ptr != 0) { bindings.TxRemoveInput_free(ptr); }
26 public ChannelId get_channel_id() {
27 long ret = bindings.TxRemoveInput_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.TxRemoveInput_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 * The serial ID of the input to be removed
48 public long get_serial_id() {
49 long ret = bindings.TxRemoveInput_get_serial_id(this.ptr);
50 Reference.reachabilityFence(this);
55 * The serial ID of the input to be removed
57 public void set_serial_id(long val) {
58 bindings.TxRemoveInput_set_serial_id(this.ptr, val);
59 Reference.reachabilityFence(this);
60 Reference.reachabilityFence(val);
64 * Constructs a new TxRemoveInput given each field
66 public static TxRemoveInput of(org.ldk.structs.ChannelId channel_id_arg, long serial_id_arg) {
67 long ret = bindings.TxRemoveInput_new(channel_id_arg.ptr, serial_id_arg);
68 Reference.reachabilityFence(channel_id_arg);
69 Reference.reachabilityFence(serial_id_arg);
70 if (ret >= 0 && ret <= 4096) { return null; }
71 org.ldk.structs.TxRemoveInput ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxRemoveInput(null, ret); }
72 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
73 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_id_arg); };
78 long ret = bindings.TxRemoveInput_clone_ptr(this.ptr);
79 Reference.reachabilityFence(this);
84 * Creates a copy of the TxRemoveInput
86 public TxRemoveInput clone() {
87 long ret = bindings.TxRemoveInput_clone(this.ptr);
88 Reference.reachabilityFence(this);
89 if (ret >= 0 && ret <= 4096) { return null; }
90 org.ldk.structs.TxRemoveInput ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxRemoveInput(null, ret); }
91 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
96 * Generates a non-cryptographic 64-bit hash of the TxRemoveInput.
99 long ret = bindings.TxRemoveInput_hash(this.ptr);
100 Reference.reachabilityFence(this);
104 @Override public int hashCode() {
105 return (int)this.hash();
108 * Checks if two TxRemoveInputs contain equal inner contents.
109 * This ignores pointers and is_owned flags and looks at the values in fields.
110 * Two objects with NULL inner values will be considered "equal" here.
112 public boolean eq(org.ldk.structs.TxRemoveInput b) {
113 boolean ret = bindings.TxRemoveInput_eq(this.ptr, b.ptr);
114 Reference.reachabilityFence(this);
115 Reference.reachabilityFence(b);
116 if (this != null) { this.ptrs_to.add(b); };
120 @Override public boolean equals(Object o) {
121 if (!(o instanceof TxRemoveInput)) return false;
122 return this.eq((TxRemoveInput)o);
125 * Serialize the TxRemoveInput object into a byte array which can be read by TxRemoveInput_read
127 public byte[] write() {
128 byte[] ret = bindings.TxRemoveInput_write(this.ptr);
129 Reference.reachabilityFence(this);
134 * Read a TxRemoveInput from a byte array, created by TxRemoveInput_write
136 public static Result_TxRemoveInputDecodeErrorZ read(byte[] ser) {
137 long ret = bindings.TxRemoveInput_read(ser);
138 Reference.reachabilityFence(ser);
139 if (ret >= 0 && ret <= 4096) { return null; }
140 Result_TxRemoveInputDecodeErrorZ ret_hu_conv = Result_TxRemoveInputDecodeErrorZ.constr_from_ptr(ret);