[Java] Update auto-generated Java bindings to LDK 0.0.121
[ldk-java] / src / main / java / org / ldk / structs / TxAckRbf.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_ack_rbf message which acknowledges replacement of the transaction after it's been
13  * completed.
14  */
15 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
16 public class TxAckRbf extends CommonBase {
17         TxAckRbf(Object _dummy, long ptr) { super(ptr); }
18         @Override @SuppressWarnings("deprecation")
19         protected void finalize() throws Throwable {
20                 super.finalize();
21                 if (ptr != 0) { bindings.TxAckRbf_free(ptr); }
22         }
23
24         /**
25          * The channel ID
26          */
27         public byte[] get_channel_id() {
28                 byte[] ret = bindings.TxAckRbf_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.TxAckRbf_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
38                 Reference.reachabilityFence(this);
39                 Reference.reachabilityFence(val);
40         }
41
42         /**
43          * The number of satoshis the sender will contribute to or, if negative, remove from
44          * (e.g. splice-out) the funding output of the transaction
45          */
46         public Option_i64Z get_funding_output_contribution() {
47                 long ret = bindings.TxAckRbf_get_funding_output_contribution(this.ptr);
48                 Reference.reachabilityFence(this);
49                 if (ret >= 0 && ret <= 4096) { return null; }
50                 org.ldk.structs.Option_i64Z ret_hu_conv = org.ldk.structs.Option_i64Z.constr_from_ptr(ret);
51                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
52                 return ret_hu_conv;
53         }
54
55         /**
56          * The number of satoshis the sender will contribute to or, if negative, remove from
57          * (e.g. splice-out) the funding output of the transaction
58          */
59         public void set_funding_output_contribution(org.ldk.structs.Option_i64Z val) {
60                 bindings.TxAckRbf_set_funding_output_contribution(this.ptr, val.ptr);
61                 Reference.reachabilityFence(this);
62                 Reference.reachabilityFence(val);
63                 if (this != null) { this.ptrs_to.add(val); };
64         }
65
66         /**
67          * Constructs a new TxAckRbf given each field
68          */
69         public static TxAckRbf of(byte[] channel_id_arg, org.ldk.structs.Option_i64Z funding_output_contribution_arg) {
70                 long ret = bindings.TxAckRbf_new(InternalUtils.check_arr_len(channel_id_arg, 32), funding_output_contribution_arg.ptr);
71                 Reference.reachabilityFence(channel_id_arg);
72                 Reference.reachabilityFence(funding_output_contribution_arg);
73                 if (ret >= 0 && ret <= 4096) { return null; }
74                 org.ldk.structs.TxAckRbf ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxAckRbf(null, ret); }
75                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
76                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(funding_output_contribution_arg); };
77                 return ret_hu_conv;
78         }
79
80         long clone_ptr() {
81                 long ret = bindings.TxAckRbf_clone_ptr(this.ptr);
82                 Reference.reachabilityFence(this);
83                 return ret;
84         }
85
86         /**
87          * Creates a copy of the TxAckRbf
88          */
89         public TxAckRbf clone() {
90                 long ret = bindings.TxAckRbf_clone(this.ptr);
91                 Reference.reachabilityFence(this);
92                 if (ret >= 0 && ret <= 4096) { return null; }
93                 org.ldk.structs.TxAckRbf ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxAckRbf(null, ret); }
94                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
95                 return ret_hu_conv;
96         }
97
98         /**
99          * Generates a non-cryptographic 64-bit hash of the TxAckRbf.
100          */
101         public long hash() {
102                 long ret = bindings.TxAckRbf_hash(this.ptr);
103                 Reference.reachabilityFence(this);
104                 return ret;
105         }
106
107         @Override public int hashCode() {
108                 return (int)this.hash();
109         }
110         /**
111          * Checks if two TxAckRbfs contain equal inner contents.
112          * This ignores pointers and is_owned flags and looks at the values in fields.
113          * Two objects with NULL inner values will be considered "equal" here.
114          */
115         public boolean eq(org.ldk.structs.TxAckRbf b) {
116                 boolean ret = bindings.TxAckRbf_eq(this.ptr, b == null ? 0 : b.ptr);
117                 Reference.reachabilityFence(this);
118                 Reference.reachabilityFence(b);
119                 if (this != null) { this.ptrs_to.add(b); };
120                 return ret;
121         }
122
123         @Override public boolean equals(Object o) {
124                 if (!(o instanceof TxAckRbf)) return false;
125                 return this.eq((TxAckRbf)o);
126         }
127         /**
128          * Serialize the TxAckRbf object into a byte array which can be read by TxAckRbf_read
129          */
130         public byte[] write() {
131                 byte[] ret = bindings.TxAckRbf_write(this.ptr);
132                 Reference.reachabilityFence(this);
133                 return ret;
134         }
135
136         /**
137          * Read a TxAckRbf from a byte array, created by TxAckRbf_write
138          */
139         public static Result_TxAckRbfDecodeErrorZ read(byte[] ser) {
140                 long ret = bindings.TxAckRbf_read(ser);
141                 Reference.reachabilityFence(ser);
142                 if (ret >= 0 && ret <= 4096) { return null; }
143                 Result_TxAckRbfDecodeErrorZ ret_hu_conv = Result_TxAckRbfDecodeErrorZ.constr_from_ptr(ret);
144                 return ret_hu_conv;
145         }
146
147 }