[Java] Update auto-generated Java bindings to LDK 0.0.121
[ldk-java] / src / main / java / org / ldk / structs / TxInitRbf.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_init_rbf message which initiates a replacement of the transaction after it's been
13  * completed.
14  */
15 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
16 public class TxInitRbf extends CommonBase {
17         TxInitRbf(Object _dummy, long ptr) { super(ptr); }
18         @Override @SuppressWarnings("deprecation")
19         protected void finalize() throws Throwable {
20                 super.finalize();
21                 if (ptr != 0) { bindings.TxInitRbf_free(ptr); }
22         }
23
24         /**
25          * The channel ID
26          */
27         public byte[] get_channel_id() {
28                 byte[] ret = bindings.TxInitRbf_get_channel_id(this.ptr);
29                 Reference.reachabilityFence(this);
30                 return ret;
31         }
32
33         /**
34          * The channel ID
35          */
36         public void set_channel_id(byte[] val) {
37                 bindings.TxInitRbf_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
38                 Reference.reachabilityFence(this);
39                 Reference.reachabilityFence(val);
40         }
41
42         /**
43          * The locktime of the transaction
44          */
45         public int get_locktime() {
46                 int ret = bindings.TxInitRbf_get_locktime(this.ptr);
47                 Reference.reachabilityFence(this);
48                 return ret;
49         }
50
51         /**
52          * The locktime of the transaction
53          */
54         public void set_locktime(int val) {
55                 bindings.TxInitRbf_set_locktime(this.ptr, val);
56                 Reference.reachabilityFence(this);
57                 Reference.reachabilityFence(val);
58         }
59
60         /**
61          * The feerate of the transaction
62          */
63         public int get_feerate_sat_per_1000_weight() {
64                 int ret = bindings.TxInitRbf_get_feerate_sat_per_1000_weight(this.ptr);
65                 Reference.reachabilityFence(this);
66                 return ret;
67         }
68
69         /**
70          * The feerate of the transaction
71          */
72         public void set_feerate_sat_per_1000_weight(int val) {
73                 bindings.TxInitRbf_set_feerate_sat_per_1000_weight(this.ptr, val);
74                 Reference.reachabilityFence(this);
75                 Reference.reachabilityFence(val);
76         }
77
78         /**
79          * The number of satoshis the sender will contribute to or, if negative, remove from
80          * (e.g. splice-out) the funding output of the transaction
81          */
82         public Option_i64Z get_funding_output_contribution() {
83                 long ret = bindings.TxInitRbf_get_funding_output_contribution(this.ptr);
84                 Reference.reachabilityFence(this);
85                 if (ret >= 0 && ret <= 4096) { return null; }
86                 org.ldk.structs.Option_i64Z ret_hu_conv = org.ldk.structs.Option_i64Z.constr_from_ptr(ret);
87                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
88                 return ret_hu_conv;
89         }
90
91         /**
92          * The number of satoshis the sender will contribute to or, if negative, remove from
93          * (e.g. splice-out) the funding output of the transaction
94          */
95         public void set_funding_output_contribution(org.ldk.structs.Option_i64Z val) {
96                 bindings.TxInitRbf_set_funding_output_contribution(this.ptr, val.ptr);
97                 Reference.reachabilityFence(this);
98                 Reference.reachabilityFence(val);
99                 if (this != null) { this.ptrs_to.add(val); };
100         }
101
102         /**
103          * Constructs a new TxInitRbf given each field
104          */
105         public static TxInitRbf of(byte[] channel_id_arg, int locktime_arg, int feerate_sat_per_1000_weight_arg, org.ldk.structs.Option_i64Z funding_output_contribution_arg) {
106                 long ret = bindings.TxInitRbf_new(InternalUtils.check_arr_len(channel_id_arg, 32), locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg.ptr);
107                 Reference.reachabilityFence(channel_id_arg);
108                 Reference.reachabilityFence(locktime_arg);
109                 Reference.reachabilityFence(feerate_sat_per_1000_weight_arg);
110                 Reference.reachabilityFence(funding_output_contribution_arg);
111                 if (ret >= 0 && ret <= 4096) { return null; }
112                 org.ldk.structs.TxInitRbf ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxInitRbf(null, ret); }
113                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
114                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(funding_output_contribution_arg); };
115                 return ret_hu_conv;
116         }
117
118         long clone_ptr() {
119                 long ret = bindings.TxInitRbf_clone_ptr(this.ptr);
120                 Reference.reachabilityFence(this);
121                 return ret;
122         }
123
124         /**
125          * Creates a copy of the TxInitRbf
126          */
127         public TxInitRbf clone() {
128                 long ret = bindings.TxInitRbf_clone(this.ptr);
129                 Reference.reachabilityFence(this);
130                 if (ret >= 0 && ret <= 4096) { return null; }
131                 org.ldk.structs.TxInitRbf ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxInitRbf(null, ret); }
132                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
133                 return ret_hu_conv;
134         }
135
136         /**
137          * Generates a non-cryptographic 64-bit hash of the TxInitRbf.
138          */
139         public long hash() {
140                 long ret = bindings.TxInitRbf_hash(this.ptr);
141                 Reference.reachabilityFence(this);
142                 return ret;
143         }
144
145         @Override public int hashCode() {
146                 return (int)this.hash();
147         }
148         /**
149          * Checks if two TxInitRbfs contain equal inner contents.
150          * This ignores pointers and is_owned flags and looks at the values in fields.
151          * Two objects with NULL inner values will be considered "equal" here.
152          */
153         public boolean eq(org.ldk.structs.TxInitRbf b) {
154                 boolean ret = bindings.TxInitRbf_eq(this.ptr, b == null ? 0 : b.ptr);
155                 Reference.reachabilityFence(this);
156                 Reference.reachabilityFence(b);
157                 if (this != null) { this.ptrs_to.add(b); };
158                 return ret;
159         }
160
161         @Override public boolean equals(Object o) {
162                 if (!(o instanceof TxInitRbf)) return false;
163                 return this.eq((TxInitRbf)o);
164         }
165         /**
166          * Serialize the TxInitRbf object into a byte array which can be read by TxInitRbf_read
167          */
168         public byte[] write() {
169                 byte[] ret = bindings.TxInitRbf_write(this.ptr);
170                 Reference.reachabilityFence(this);
171                 return ret;
172         }
173
174         /**
175          * Read a TxInitRbf from a byte array, created by TxInitRbf_write
176          */
177         public static Result_TxInitRbfDecodeErrorZ read(byte[] ser) {
178                 long ret = bindings.TxInitRbf_read(ser);
179                 Reference.reachabilityFence(ser);
180                 if (ret >= 0 && ret <= 4096) { return null; }
181                 Result_TxInitRbfDecodeErrorZ ret_hu_conv = Result_TxInitRbfDecodeErrorZ.constr_from_ptr(ret);
182                 return ret_hu_conv;
183         }
184
185 }