[TS] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[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 ChannelId get_channel_id() {
28                 long ret = bindings.TxAckRbf_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.TxAckRbf_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 number of satoshis the sender will contribute to or, if negative, remove from
48          * (e.g. splice-out) the funding output of the transaction
49          */
50         public Option_i64Z get_funding_output_contribution() {
51                 long ret = bindings.TxAckRbf_get_funding_output_contribution(this.ptr);
52                 Reference.reachabilityFence(this);
53                 if (ret >= 0 && ret <= 4096) { return null; }
54                 org.ldk.structs.Option_i64Z ret_hu_conv = org.ldk.structs.Option_i64Z.constr_from_ptr(ret);
55                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
56                 return ret_hu_conv;
57         }
58
59         /**
60          * The number of satoshis the sender will contribute to or, if negative, remove from
61          * (e.g. splice-out) the funding output of the transaction
62          */
63         public void set_funding_output_contribution(org.ldk.structs.Option_i64Z val) {
64                 bindings.TxAckRbf_set_funding_output_contribution(this.ptr, val.ptr);
65                 Reference.reachabilityFence(this);
66                 Reference.reachabilityFence(val);
67                 if (this != null) { this.ptrs_to.add(val); };
68         }
69
70         /**
71          * Constructs a new TxAckRbf given each field
72          */
73         public static TxAckRbf of(org.ldk.structs.ChannelId channel_id_arg, org.ldk.structs.Option_i64Z funding_output_contribution_arg) {
74                 long ret = bindings.TxAckRbf_new(channel_id_arg.ptr, funding_output_contribution_arg.ptr);
75                 Reference.reachabilityFence(channel_id_arg);
76                 Reference.reachabilityFence(funding_output_contribution_arg);
77                 if (ret >= 0 && ret <= 4096) { return null; }
78                 org.ldk.structs.TxAckRbf ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxAckRbf(null, ret); }
79                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
80                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_id_arg); };
81                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(funding_output_contribution_arg); };
82                 return ret_hu_conv;
83         }
84
85         long clone_ptr() {
86                 long ret = bindings.TxAckRbf_clone_ptr(this.ptr);
87                 Reference.reachabilityFence(this);
88                 return ret;
89         }
90
91         /**
92          * Creates a copy of the TxAckRbf
93          */
94         public TxAckRbf clone() {
95                 long ret = bindings.TxAckRbf_clone(this.ptr);
96                 Reference.reachabilityFence(this);
97                 if (ret >= 0 && ret <= 4096) { return null; }
98                 org.ldk.structs.TxAckRbf ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxAckRbf(null, ret); }
99                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
100                 return ret_hu_conv;
101         }
102
103         /**
104          * Generates a non-cryptographic 64-bit hash of the TxAckRbf.
105          */
106         public long hash() {
107                 long ret = bindings.TxAckRbf_hash(this.ptr);
108                 Reference.reachabilityFence(this);
109                 return ret;
110         }
111
112         @Override public int hashCode() {
113                 return (int)this.hash();
114         }
115         /**
116          * Checks if two TxAckRbfs contain equal inner contents.
117          * This ignores pointers and is_owned flags and looks at the values in fields.
118          * Two objects with NULL inner values will be considered "equal" here.
119          */
120         public boolean eq(org.ldk.structs.TxAckRbf b) {
121                 boolean ret = bindings.TxAckRbf_eq(this.ptr, b.ptr);
122                 Reference.reachabilityFence(this);
123                 Reference.reachabilityFence(b);
124                 if (this != null) { this.ptrs_to.add(b); };
125                 return ret;
126         }
127
128         @Override public boolean equals(Object o) {
129                 if (!(o instanceof TxAckRbf)) return false;
130                 return this.eq((TxAckRbf)o);
131         }
132         /**
133          * Serialize the TxAckRbf object into a byte array which can be read by TxAckRbf_read
134          */
135         public byte[] write() {
136                 byte[] ret = bindings.TxAckRbf_write(this.ptr);
137                 Reference.reachabilityFence(this);
138                 return ret;
139         }
140
141         /**
142          * Read a TxAckRbf from a byte array, created by TxAckRbf_write
143          */
144         public static Result_TxAckRbfDecodeErrorZ read(byte[] ser) {
145                 long ret = bindings.TxAckRbf_read(ser);
146                 Reference.reachabilityFence(ser);
147                 if (ret >= 0 && ret <= 4096) { return null; }
148                 Result_TxAckRbfDecodeErrorZ ret_hu_conv = Result_TxAckRbfDecodeErrorZ.constr_from_ptr(ret);
149                 return ret_hu_conv;
150         }
151
152 }