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_complete message signalling the conclusion of a peer's transaction contributions during
13 * interactive transaction construction.
15 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
16 public class TxComplete extends CommonBase {
17 TxComplete(Object _dummy, long ptr) { super(ptr); }
18 @Override @SuppressWarnings("deprecation")
19 protected void finalize() throws Throwable {
21 if (ptr != 0) { bindings.TxComplete_free(ptr); }
27 public byte[] get_channel_id() {
28 byte[] ret = bindings.TxComplete_get_channel_id(this.ptr);
29 Reference.reachabilityFence(this);
36 public void set_channel_id(byte[] val) {
37 bindings.TxComplete_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
38 Reference.reachabilityFence(this);
39 Reference.reachabilityFence(val);
43 * Constructs a new TxComplete given each field
45 public static TxComplete of(byte[] channel_id_arg) {
46 long ret = bindings.TxComplete_new(InternalUtils.check_arr_len(channel_id_arg, 32));
47 Reference.reachabilityFence(channel_id_arg);
48 if (ret >= 0 && ret <= 4096) { return null; }
49 org.ldk.structs.TxComplete ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxComplete(null, ret); }
50 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
55 long ret = bindings.TxComplete_clone_ptr(this.ptr);
56 Reference.reachabilityFence(this);
61 * Creates a copy of the TxComplete
63 public TxComplete clone() {
64 long ret = bindings.TxComplete_clone(this.ptr);
65 Reference.reachabilityFence(this);
66 if (ret >= 0 && ret <= 4096) { return null; }
67 org.ldk.structs.TxComplete ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxComplete(null, ret); }
68 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
73 * Checks if two TxCompletes contain equal inner contents.
74 * This ignores pointers and is_owned flags and looks at the values in fields.
75 * Two objects with NULL inner values will be considered "equal" here.
77 public boolean eq(org.ldk.structs.TxComplete b) {
78 boolean ret = bindings.TxComplete_eq(this.ptr, b == null ? 0 : b.ptr);
79 Reference.reachabilityFence(this);
80 Reference.reachabilityFence(b);
81 if (this != null) { this.ptrs_to.add(b); };
85 @Override public boolean equals(Object o) {
86 if (!(o instanceof TxComplete)) return false;
87 return this.eq((TxComplete)o);
90 * Serialize the TxComplete object into a byte array which can be read by TxComplete_read
92 public byte[] write() {
93 byte[] ret = bindings.TxComplete_write(this.ptr);
94 Reference.reachabilityFence(this);
99 * Read a TxComplete from a byte array, created by TxComplete_write
101 public static Result_TxCompleteDecodeErrorZ read(byte[] ser) {
102 long ret = bindings.TxComplete_read(ser);
103 Reference.reachabilityFence(ser);
104 if (ret >= 0 && ret <= 4096) { return null; }
105 Result_TxCompleteDecodeErrorZ ret_hu_conv = Result_TxCompleteDecodeErrorZ.constr_from_ptr(ret);