]> git.bitcoin.ninja Git - ldk-java/blob - src/main/java/org/ldk/structs/TxAddOutput.java
[Java] Update auto-generated bindings to LDK 0.0.123
[ldk-java] / src / main / java / org / ldk / structs / TxAddOutput.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_add_output message for adding an output during interactive transaction construction.
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class TxAddOutput extends CommonBase {
16         TxAddOutput(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.TxAddOutput_free(ptr); }
21         }
22
23         /**
24          * The channel ID
25          */
26         public ChannelId get_channel_id() {
27                 long ret = bindings.TxAddOutput_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); };
32                 return ret_hu_conv;
33         }
34
35         /**
36          * The channel ID
37          */
38         public void set_channel_id(org.ldk.structs.ChannelId val) {
39                 bindings.TxAddOutput_set_channel_id(this.ptr, val.ptr);
40                 Reference.reachabilityFence(this);
41                 Reference.reachabilityFence(val);
42                 if (this != null) { this.ptrs_to.add(val); };
43         }
44
45         /**
46          * A randomly chosen unique identifier for this output, which is even for initiators and odd for
47          * non-initiators.
48          */
49         public long get_serial_id() {
50                 long ret = bindings.TxAddOutput_get_serial_id(this.ptr);
51                 Reference.reachabilityFence(this);
52                 return ret;
53         }
54
55         /**
56          * A randomly chosen unique identifier for this output, which is even for initiators and odd for
57          * non-initiators.
58          */
59         public void set_serial_id(long val) {
60                 bindings.TxAddOutput_set_serial_id(this.ptr, val);
61                 Reference.reachabilityFence(this);
62                 Reference.reachabilityFence(val);
63         }
64
65         /**
66          * The satoshi value of the output
67          */
68         public long get_sats() {
69                 long ret = bindings.TxAddOutput_get_sats(this.ptr);
70                 Reference.reachabilityFence(this);
71                 return ret;
72         }
73
74         /**
75          * The satoshi value of the output
76          */
77         public void set_sats(long val) {
78                 bindings.TxAddOutput_set_sats(this.ptr, val);
79                 Reference.reachabilityFence(this);
80                 Reference.reachabilityFence(val);
81         }
82
83         /**
84          * The scriptPubKey for the output
85          */
86         public byte[] get_script() {
87                 byte[] ret = bindings.TxAddOutput_get_script(this.ptr);
88                 Reference.reachabilityFence(this);
89                 return ret;
90         }
91
92         /**
93          * The scriptPubKey for the output
94          */
95         public void set_script(byte[] val) {
96                 bindings.TxAddOutput_set_script(this.ptr, val);
97                 Reference.reachabilityFence(this);
98                 Reference.reachabilityFence(val);
99         }
100
101         /**
102          * Constructs a new TxAddOutput given each field
103          */
104         public static TxAddOutput of(org.ldk.structs.ChannelId channel_id_arg, long serial_id_arg, long sats_arg, byte[] script_arg) {
105                 long ret = bindings.TxAddOutput_new(channel_id_arg.ptr, serial_id_arg, sats_arg, script_arg);
106                 Reference.reachabilityFence(channel_id_arg);
107                 Reference.reachabilityFence(serial_id_arg);
108                 Reference.reachabilityFence(sats_arg);
109                 Reference.reachabilityFence(script_arg);
110                 if (ret >= 0 && ret <= 4096) { return null; }
111                 org.ldk.structs.TxAddOutput ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxAddOutput(null, ret); }
112                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
113                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_id_arg); };
114                 return ret_hu_conv;
115         }
116
117         long clone_ptr() {
118                 long ret = bindings.TxAddOutput_clone_ptr(this.ptr);
119                 Reference.reachabilityFence(this);
120                 return ret;
121         }
122
123         /**
124          * Creates a copy of the TxAddOutput
125          */
126         public TxAddOutput clone() {
127                 long ret = bindings.TxAddOutput_clone(this.ptr);
128                 Reference.reachabilityFence(this);
129                 if (ret >= 0 && ret <= 4096) { return null; }
130                 org.ldk.structs.TxAddOutput ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxAddOutput(null, ret); }
131                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
132                 return ret_hu_conv;
133         }
134
135         /**
136          * Generates a non-cryptographic 64-bit hash of the TxAddOutput.
137          */
138         public long hash() {
139                 long ret = bindings.TxAddOutput_hash(this.ptr);
140                 Reference.reachabilityFence(this);
141                 return ret;
142         }
143
144         @Override public int hashCode() {
145                 return (int)this.hash();
146         }
147         /**
148          * Checks if two TxAddOutputs contain equal inner contents.
149          * This ignores pointers and is_owned flags and looks at the values in fields.
150          * Two objects with NULL inner values will be considered "equal" here.
151          */
152         public boolean eq(org.ldk.structs.TxAddOutput b) {
153                 boolean ret = bindings.TxAddOutput_eq(this.ptr, b.ptr);
154                 Reference.reachabilityFence(this);
155                 Reference.reachabilityFence(b);
156                 if (this != null) { this.ptrs_to.add(b); };
157                 return ret;
158         }
159
160         @Override public boolean equals(Object o) {
161                 if (!(o instanceof TxAddOutput)) return false;
162                 return this.eq((TxAddOutput)o);
163         }
164         /**
165          * Serialize the TxAddOutput object into a byte array which can be read by TxAddOutput_read
166          */
167         public byte[] write() {
168                 byte[] ret = bindings.TxAddOutput_write(this.ptr);
169                 Reference.reachabilityFence(this);
170                 return ret;
171         }
172
173         /**
174          * Read a TxAddOutput from a byte array, created by TxAddOutput_write
175          */
176         public static Result_TxAddOutputDecodeErrorZ read(byte[] ser) {
177                 long ret = bindings.TxAddOutput_read(ser);
178                 Reference.reachabilityFence(ser);
179                 if (ret >= 0 && ret <= 4096) { return null; }
180                 Result_TxAddOutputDecodeErrorZ ret_hu_conv = Result_TxAddOutputDecodeErrorZ.constr_from_ptr(ret);
181                 return ret_hu_conv;
182         }
183
184 }