[Java] Update auto-generated bindings to LDK 0.0.123
[ldk-java] / src / main / java / org / ldk / structs / SpliceAck.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 splice_ack message to be received by or sent to the splice initiator.
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class SpliceAck extends CommonBase {
16         SpliceAck(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.SpliceAck_free(ptr); }
21         }
22
23         /**
24          * The channel ID where splicing is intended
25          */
26         public ChannelId get_channel_id() {
27                 long ret = bindings.SpliceAck_get_channel_id(this.ptr);
28                 Reference.reachabilityFence(this);
29                 if (ret >= 0 && ret <= 4096) { return null; }
30                 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
31                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
32                 return ret_hu_conv;
33         }
34
35         /**
36          * The channel ID where splicing is intended
37          */
38         public void set_channel_id(org.ldk.structs.ChannelId val) {
39                 bindings.SpliceAck_set_channel_id(this.ptr, val.ptr);
40                 Reference.reachabilityFence(this);
41                 Reference.reachabilityFence(val);
42                 if (this != null) { this.ptrs_to.add(val); };
43         }
44
45         /**
46          * The genesis hash of the blockchain where the channel is intended to be spliced
47          */
48         public byte[] get_chain_hash() {
49                 byte[] ret = bindings.SpliceAck_get_chain_hash(this.ptr);
50                 Reference.reachabilityFence(this);
51                 return ret;
52         }
53
54         /**
55          * The genesis hash of the blockchain where the channel is intended to be spliced
56          */
57         public void set_chain_hash(byte[] val) {
58                 bindings.SpliceAck_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
59                 Reference.reachabilityFence(this);
60                 Reference.reachabilityFence(val);
61         }
62
63         /**
64          * The intended change in channel capacity: the amount to be added (positive value)
65          * or removed (negative value) by the sender (splice acceptor) by splicing into/from the channel.
66          */
67         public long get_relative_satoshis() {
68                 long ret = bindings.SpliceAck_get_relative_satoshis(this.ptr);
69                 Reference.reachabilityFence(this);
70                 return ret;
71         }
72
73         /**
74          * The intended change in channel capacity: the amount to be added (positive value)
75          * or removed (negative value) by the sender (splice acceptor) by splicing into/from the channel.
76          */
77         public void set_relative_satoshis(long val) {
78                 bindings.SpliceAck_set_relative_satoshis(this.ptr, val);
79                 Reference.reachabilityFence(this);
80                 Reference.reachabilityFence(val);
81         }
82
83         /**
84          * The key of the sender (splice acceptor) controlling the new funding transaction
85          */
86         public byte[] get_funding_pubkey() {
87                 byte[] ret = bindings.SpliceAck_get_funding_pubkey(this.ptr);
88                 Reference.reachabilityFence(this);
89                 return ret;
90         }
91
92         /**
93          * The key of the sender (splice acceptor) controlling the new funding transaction
94          */
95         public void set_funding_pubkey(byte[] val) {
96                 bindings.SpliceAck_set_funding_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
97                 Reference.reachabilityFence(this);
98                 Reference.reachabilityFence(val);
99         }
100
101         /**
102          * Constructs a new SpliceAck given each field
103          */
104         public static SpliceAck of(org.ldk.structs.ChannelId channel_id_arg, byte[] chain_hash_arg, long relative_satoshis_arg, byte[] funding_pubkey_arg) {
105                 long ret = bindings.SpliceAck_new(channel_id_arg.ptr, InternalUtils.check_arr_len(chain_hash_arg, 32), relative_satoshis_arg, InternalUtils.check_arr_len(funding_pubkey_arg, 33));
106                 Reference.reachabilityFence(channel_id_arg);
107                 Reference.reachabilityFence(chain_hash_arg);
108                 Reference.reachabilityFence(relative_satoshis_arg);
109                 Reference.reachabilityFence(funding_pubkey_arg);
110                 if (ret >= 0 && ret <= 4096) { return null; }
111                 org.ldk.structs.SpliceAck ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.SpliceAck(null, ret); }
112                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
113                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channel_id_arg); };
114                 return ret_hu_conv;
115         }
116
117         long clone_ptr() {
118                 long ret = bindings.SpliceAck_clone_ptr(this.ptr);
119                 Reference.reachabilityFence(this);
120                 return ret;
121         }
122
123         /**
124          * Creates a copy of the SpliceAck
125          */
126         public SpliceAck clone() {
127                 long ret = bindings.SpliceAck_clone(this.ptr);
128                 Reference.reachabilityFence(this);
129                 if (ret >= 0 && ret <= 4096) { return null; }
130                 org.ldk.structs.SpliceAck ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.SpliceAck(null, ret); }
131                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
132                 return ret_hu_conv;
133         }
134
135         /**
136          * Checks if two SpliceAcks contain equal inner contents.
137          * This ignores pointers and is_owned flags and looks at the values in fields.
138          * Two objects with NULL inner values will be considered "equal" here.
139          */
140         public boolean eq(org.ldk.structs.SpliceAck b) {
141                 boolean ret = bindings.SpliceAck_eq(this.ptr, b.ptr);
142                 Reference.reachabilityFence(this);
143                 Reference.reachabilityFence(b);
144                 if (this != null) { this.ptrs_to.add(b); };
145                 return ret;
146         }
147
148         @Override public boolean equals(Object o) {
149                 if (!(o instanceof SpliceAck)) return false;
150                 return this.eq((SpliceAck)o);
151         }
152         /**
153          * Serialize the SpliceAck object into a byte array which can be read by SpliceAck_read
154          */
155         public byte[] write() {
156                 byte[] ret = bindings.SpliceAck_write(this.ptr);
157                 Reference.reachabilityFence(this);
158                 return ret;
159         }
160
161         /**
162          * Read a SpliceAck from a byte array, created by SpliceAck_write
163          */
164         public static Result_SpliceAckDecodeErrorZ read(byte[] ser) {
165                 long ret = bindings.SpliceAck_read(ser);
166                 Reference.reachabilityFence(ser);
167                 if (ret >= 0 && ret <= 4096) { return null; }
168                 Result_SpliceAckDecodeErrorZ ret_hu_conv = Result_SpliceAckDecodeErrorZ.constr_from_ptr(ret);
169                 return ret_hu_conv;
170         }
171
172 }