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_output message for removing an output during interactive transaction construction.
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class TxRemoveOutput extends CommonBase {
16 TxRemoveOutput(Object _dummy, long ptr) { super(ptr); }
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
20 if (ptr != 0) { bindings.TxRemoveOutput_free(ptr); }
26 public ChannelId get_channel_id() {
27 long ret = bindings.TxRemoveOutput_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.TxRemoveOutput_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 output to be removed
48 public long get_serial_id() {
49 long ret = bindings.TxRemoveOutput_get_serial_id(this.ptr);
50 Reference.reachabilityFence(this);
55 * The serial ID of the output to be removed
57 public void set_serial_id(long val) {
58 bindings.TxRemoveOutput_set_serial_id(this.ptr, val);
59 Reference.reachabilityFence(this);
60 Reference.reachabilityFence(val);
64 * Constructs a new TxRemoveOutput given each field
66 public static TxRemoveOutput of(org.ldk.structs.ChannelId channel_id_arg, long serial_id_arg) {
67 long ret = bindings.TxRemoveOutput_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.TxRemoveOutput ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxRemoveOutput(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.TxRemoveOutput_clone_ptr(this.ptr);
79 Reference.reachabilityFence(this);
84 * Creates a copy of the TxRemoveOutput
86 public TxRemoveOutput clone() {
87 long ret = bindings.TxRemoveOutput_clone(this.ptr);
88 Reference.reachabilityFence(this);
89 if (ret >= 0 && ret <= 4096) { return null; }
90 org.ldk.structs.TxRemoveOutput ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxRemoveOutput(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 TxRemoveOutput.
99 long ret = bindings.TxRemoveOutput_hash(this.ptr);
100 Reference.reachabilityFence(this);
104 @Override public int hashCode() {
105 return (int)this.hash();
108 * Checks if two TxRemoveOutputs 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.TxRemoveOutput b) {
113 boolean ret = bindings.TxRemoveOutput_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 TxRemoveOutput)) return false;
122 return this.eq((TxRemoveOutput)o);
125 * Serialize the TxRemoveOutput object into a byte array which can be read by TxRemoveOutput_read
127 public byte[] write() {
128 byte[] ret = bindings.TxRemoveOutput_write(this.ptr);
129 Reference.reachabilityFence(this);
134 * Read a TxRemoveOutput from a byte array, created by TxRemoveOutput_write
136 public static Result_TxRemoveOutputDecodeErrorZ read(byte[] ser) {
137 long ret = bindings.TxRemoveOutput_read(ser);
138 Reference.reachabilityFence(ser);
139 if (ret >= 0 && ret <= 4096) { return null; }
140 Result_TxRemoveOutputDecodeErrorZ ret_hu_conv = Result_TxRemoveOutputDecodeErrorZ.constr_from_ptr(ret);