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_init_rbf message which initiates a replacement of the transaction after it's been
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 {
21 if (ptr != 0) { bindings.TxInitRbf_free(ptr); }
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); };
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); };
47 * The locktime of the transaction
49 public int get_locktime() {
50 int ret = bindings.TxInitRbf_get_locktime(this.ptr);
51 Reference.reachabilityFence(this);
56 * The locktime of the transaction
58 public void set_locktime(int val) {
59 bindings.TxInitRbf_set_locktime(this.ptr, val);
60 Reference.reachabilityFence(this);
61 Reference.reachabilityFence(val);
65 * The feerate of the transaction
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);
74 * The feerate of the transaction
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);
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
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); };
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
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); };
107 * Constructs a new TxInitRbf given each field
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); };
124 long ret = bindings.TxInitRbf_clone_ptr(this.ptr);
125 Reference.reachabilityFence(this);
130 * Creates a copy of the TxInitRbf
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); };
142 * Generates a non-cryptographic 64-bit hash of the TxInitRbf.
145 long ret = bindings.TxInitRbf_hash(this.ptr);
146 Reference.reachabilityFence(this);
150 @Override public int hashCode() {
151 return (int)this.hash();
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.
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); };
166 @Override public boolean equals(Object o) {
167 if (!(o instanceof TxInitRbf)) return false;
168 return this.eq((TxInitRbf)o);
171 * Serialize the TxInitRbf object into a byte array which can be read by TxInitRbf_read
173 public byte[] write() {
174 byte[] ret = bindings.TxInitRbf_write(this.ptr);
175 Reference.reachabilityFence(this);
180 * Read a TxInitRbf from a byte array, created by TxInitRbf_write
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);