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 byte[] get_channel_id() {
28 byte[] ret = bindings.TxInitRbf_get_channel_id(this.ptr);
29 Reference.reachabilityFence(this);
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);
43 * The locktime of the transaction
45 public int get_locktime() {
46 int ret = bindings.TxInitRbf_get_locktime(this.ptr);
47 Reference.reachabilityFence(this);
52 * The locktime of the transaction
54 public void set_locktime(int val) {
55 bindings.TxInitRbf_set_locktime(this.ptr, val);
56 Reference.reachabilityFence(this);
57 Reference.reachabilityFence(val);
61 * The feerate of the transaction
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);
70 * The feerate of the transaction
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);
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
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); };
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
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); };
103 * Constructs a new TxInitRbf given each field
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); };
119 long ret = bindings.TxInitRbf_clone_ptr(this.ptr);
120 Reference.reachabilityFence(this);
125 * Creates a copy of the TxInitRbf
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); };
137 * Checks if two TxInitRbfs contain equal inner contents.
138 * This ignores pointers and is_owned flags and looks at the values in fields.
139 * Two objects with NULL inner values will be considered "equal" here.
141 public boolean eq(org.ldk.structs.TxInitRbf b) {
142 boolean ret = bindings.TxInitRbf_eq(this.ptr, b == null ? 0 : b.ptr);
143 Reference.reachabilityFence(this);
144 Reference.reachabilityFence(b);
145 if (this != null) { this.ptrs_to.add(b); };
149 @Override public boolean equals(Object o) {
150 if (!(o instanceof TxInitRbf)) return false;
151 return this.eq((TxInitRbf)o);
154 * Serialize the TxInitRbf object into a byte array which can be read by TxInitRbf_read
156 public byte[] write() {
157 byte[] ret = bindings.TxInitRbf_write(this.ptr);
158 Reference.reachabilityFence(this);
163 * Read a TxInitRbf from a byte array, created by TxInitRbf_write
165 public static Result_TxInitRbfDecodeErrorZ read(byte[] ser) {
166 long ret = bindings.TxInitRbf_read(ser);
167 Reference.reachabilityFence(ser);
168 if (ret >= 0 && ret <= 4096) { return null; }
169 Result_TxInitRbfDecodeErrorZ ret_hu_conv = Result_TxInitRbfDecodeErrorZ.constr_from_ptr(ret);