]> git.bitcoin.ninja Git - ldk-java/blob - src/main/java/org/ldk/structs/TxComplete.java
[Java] Update auto-generated bindings to LDK 0.0.123
[ldk-java] / src / main / java / org / ldk / structs / TxComplete.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_complete message signalling the conclusion of a peer's transaction contributions during
13  * interactive transaction construction.
14  */
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 {
20                 super.finalize();
21                 if (ptr != 0) { bindings.TxComplete_free(ptr); }
22         }
23
24         /**
25          * The channel ID
26          */
27         public ChannelId get_channel_id() {
28                 long ret = bindings.TxComplete_get_channel_id(this.ptr);
29                 Reference.reachabilityFence(this);
30                 if (ret >= 0 && ret <= 4096) { return null; }
31                 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
32                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
33                 return ret_hu_conv;
34         }
35
36         /**
37          * The channel ID
38          */
39         public void set_channel_id(org.ldk.structs.ChannelId val) {
40                 bindings.TxComplete_set_channel_id(this.ptr, val.ptr);
41                 Reference.reachabilityFence(this);
42                 Reference.reachabilityFence(val);
43                 if (this != null) { this.ptrs_to.add(val); };
44         }
45
46         /**
47          * Constructs a new TxComplete given each field
48          */
49         public static TxComplete of(org.ldk.structs.ChannelId channel_id_arg) {
50                 long ret = bindings.TxComplete_new(channel_id_arg.ptr);
51                 Reference.reachabilityFence(channel_id_arg);
52                 if (ret >= 0 && ret <= 4096) { return null; }
53                 org.ldk.structs.TxComplete ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxComplete(null, ret); }
54                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
55                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_id_arg); };
56                 return ret_hu_conv;
57         }
58
59         long clone_ptr() {
60                 long ret = bindings.TxComplete_clone_ptr(this.ptr);
61                 Reference.reachabilityFence(this);
62                 return ret;
63         }
64
65         /**
66          * Creates a copy of the TxComplete
67          */
68         public TxComplete clone() {
69                 long ret = bindings.TxComplete_clone(this.ptr);
70                 Reference.reachabilityFence(this);
71                 if (ret >= 0 && ret <= 4096) { return null; }
72                 org.ldk.structs.TxComplete ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxComplete(null, ret); }
73                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
74                 return ret_hu_conv;
75         }
76
77         /**
78          * Generates a non-cryptographic 64-bit hash of the TxComplete.
79          */
80         public long hash() {
81                 long ret = bindings.TxComplete_hash(this.ptr);
82                 Reference.reachabilityFence(this);
83                 return ret;
84         }
85
86         @Override public int hashCode() {
87                 return (int)this.hash();
88         }
89         /**
90          * Checks if two TxCompletes contain equal inner contents.
91          * This ignores pointers and is_owned flags and looks at the values in fields.
92          * Two objects with NULL inner values will be considered "equal" here.
93          */
94         public boolean eq(org.ldk.structs.TxComplete b) {
95                 boolean ret = bindings.TxComplete_eq(this.ptr, b.ptr);
96                 Reference.reachabilityFence(this);
97                 Reference.reachabilityFence(b);
98                 if (this != null) { this.ptrs_to.add(b); };
99                 return ret;
100         }
101
102         @Override public boolean equals(Object o) {
103                 if (!(o instanceof TxComplete)) return false;
104                 return this.eq((TxComplete)o);
105         }
106         /**
107          * Serialize the TxComplete object into a byte array which can be read by TxComplete_read
108          */
109         public byte[] write() {
110                 byte[] ret = bindings.TxComplete_write(this.ptr);
111                 Reference.reachabilityFence(this);
112                 return ret;
113         }
114
115         /**
116          * Read a TxComplete from a byte array, created by TxComplete_write
117          */
118         public static Result_TxCompleteDecodeErrorZ read(byte[] ser) {
119                 long ret = bindings.TxComplete_read(ser);
120                 Reference.reachabilityFence(ser);
121                 if (ret >= 0 && ret <= 4096) { return null; }
122                 Result_TxCompleteDecodeErrorZ ret_hu_conv = Result_TxCompleteDecodeErrorZ.constr_from_ptr(ret);
123                 return ret_hu_conv;
124         }
125
126 }