[Java] Update auto-generated bindings to LDK 0.0.123
[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 ChannelId get_channel_id() {
28                 long ret = bindings.TxInitRbf_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.TxInitRbf_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          * The locktime of the transaction
48          */
49         public int get_locktime() {
50                 int ret = bindings.TxInitRbf_get_locktime(this.ptr);
51                 Reference.reachabilityFence(this);
52                 return ret;
53         }
54
55         /**
56          * The locktime of the transaction
57          */
58         public void set_locktime(int val) {
59                 bindings.TxInitRbf_set_locktime(this.ptr, val);
60                 Reference.reachabilityFence(this);
61                 Reference.reachabilityFence(val);
62         }
63
64         /**
65          * The feerate of the transaction
66          */
67         public int get_feerate_sat_per_1000_weight() {
68                 int ret = bindings.TxInitRbf_get_feerate_sat_per_1000_weight(this.ptr);
69                 Reference.reachabilityFence(this);
70                 return ret;
71         }
72
73         /**
74          * The feerate of the transaction
75          */
76         public void set_feerate_sat_per_1000_weight(int val) {
77                 bindings.TxInitRbf_set_feerate_sat_per_1000_weight(this.ptr, val);
78                 Reference.reachabilityFence(this);
79                 Reference.reachabilityFence(val);
80         }
81
82         /**
83          * The number of satoshis the sender will contribute to or, if negative, remove from
84          * (e.g. splice-out) the funding output of the transaction
85          */
86         public Option_i64Z get_funding_output_contribution() {
87                 long ret = bindings.TxInitRbf_get_funding_output_contribution(this.ptr);
88                 Reference.reachabilityFence(this);
89                 if (ret >= 0 && ret <= 4096) { return null; }
90                 org.ldk.structs.Option_i64Z ret_hu_conv = org.ldk.structs.Option_i64Z.constr_from_ptr(ret);
91                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
92                 return ret_hu_conv;
93         }
94
95         /**
96          * The number of satoshis the sender will contribute to or, if negative, remove from
97          * (e.g. splice-out) the funding output of the transaction
98          */
99         public void set_funding_output_contribution(org.ldk.structs.Option_i64Z val) {
100                 bindings.TxInitRbf_set_funding_output_contribution(this.ptr, val.ptr);
101                 Reference.reachabilityFence(this);
102                 Reference.reachabilityFence(val);
103                 if (this != null) { this.ptrs_to.add(val); };
104         }
105
106         /**
107          * Constructs a new TxInitRbf given each field
108          */
109         public static TxInitRbf of(org.ldk.structs.ChannelId channel_id_arg, int locktime_arg, int feerate_sat_per_1000_weight_arg, org.ldk.structs.Option_i64Z funding_output_contribution_arg) {
110                 long ret = bindings.TxInitRbf_new(channel_id_arg.ptr, locktime_arg, feerate_sat_per_1000_weight_arg, funding_output_contribution_arg.ptr);
111                 Reference.reachabilityFence(channel_id_arg);
112                 Reference.reachabilityFence(locktime_arg);
113                 Reference.reachabilityFence(feerate_sat_per_1000_weight_arg);
114                 Reference.reachabilityFence(funding_output_contribution_arg);
115                 if (ret >= 0 && ret <= 4096) { return null; }
116                 org.ldk.structs.TxInitRbf ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxInitRbf(null, ret); }
117                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
118                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_id_arg); };
119                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(funding_output_contribution_arg); };
120                 return ret_hu_conv;
121         }
122
123         long clone_ptr() {
124                 long ret = bindings.TxInitRbf_clone_ptr(this.ptr);
125                 Reference.reachabilityFence(this);
126                 return ret;
127         }
128
129         /**
130          * Creates a copy of the TxInitRbf
131          */
132         public TxInitRbf clone() {
133                 long ret = bindings.TxInitRbf_clone(this.ptr);
134                 Reference.reachabilityFence(this);
135                 if (ret >= 0 && ret <= 4096) { return null; }
136                 org.ldk.structs.TxInitRbf ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxInitRbf(null, ret); }
137                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
138                 return ret_hu_conv;
139         }
140
141         /**
142          * Generates a non-cryptographic 64-bit hash of the TxInitRbf.
143          */
144         public long hash() {
145                 long ret = bindings.TxInitRbf_hash(this.ptr);
146                 Reference.reachabilityFence(this);
147                 return ret;
148         }
149
150         @Override public int hashCode() {
151                 return (int)this.hash();
152         }
153         /**
154          * Checks if two TxInitRbfs contain equal inner contents.
155          * This ignores pointers and is_owned flags and looks at the values in fields.
156          * Two objects with NULL inner values will be considered "equal" here.
157          */
158         public boolean eq(org.ldk.structs.TxInitRbf b) {
159                 boolean ret = bindings.TxInitRbf_eq(this.ptr, b.ptr);
160                 Reference.reachabilityFence(this);
161                 Reference.reachabilityFence(b);
162                 if (this != null) { this.ptrs_to.add(b); };
163                 return ret;
164         }
165
166         @Override public boolean equals(Object o) {
167                 if (!(o instanceof TxInitRbf)) return false;
168                 return this.eq((TxInitRbf)o);
169         }
170         /**
171          * Serialize the TxInitRbf object into a byte array which can be read by TxInitRbf_read
172          */
173         public byte[] write() {
174                 byte[] ret = bindings.TxInitRbf_write(this.ptr);
175                 Reference.reachabilityFence(this);
176                 return ret;
177         }
178
179         /**
180          * Read a TxInitRbf from a byte array, created by TxInitRbf_write
181          */
182         public static Result_TxInitRbfDecodeErrorZ read(byte[] ser) {
183                 long ret = bindings.TxInitRbf_read(ser);
184                 Reference.reachabilityFence(ser);
185                 if (ret >= 0 && ret <= 4096) { return null; }
186                 Result_TxInitRbfDecodeErrorZ ret_hu_conv = Result_TxInitRbfDecodeErrorZ.constr_from_ptr(ret);
187                 return ret_hu_conv;
188         }
189
190 }