[Java] Update auto-generated Java bindings to LDK 0.0.121
[ldk-java] / src / main / java / org / ldk / structs / ChannelPublicKeys.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  * One counterparty's public keys which do not change over the life of a channel.
13  */
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class ChannelPublicKeys extends CommonBase {
16         ChannelPublicKeys(Object _dummy, long ptr) { super(ptr); }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 super.finalize();
20                 if (ptr != 0) { bindings.ChannelPublicKeys_free(ptr); }
21         }
22
23         /**
24          * The public key which is used to sign all commitment transactions, as it appears in the
25          * on-chain channel lock-in 2-of-2 multisig output.
26          */
27         public byte[] get_funding_pubkey() {
28                 byte[] ret = bindings.ChannelPublicKeys_get_funding_pubkey(this.ptr);
29                 Reference.reachabilityFence(this);
30                 return ret;
31         }
32
33         /**
34          * The public key which is used to sign all commitment transactions, as it appears in the
35          * on-chain channel lock-in 2-of-2 multisig output.
36          */
37         public void set_funding_pubkey(byte[] val) {
38                 bindings.ChannelPublicKeys_set_funding_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
39                 Reference.reachabilityFence(this);
40                 Reference.reachabilityFence(val);
41         }
42
43         /**
44          * The base point which is used (with derive_public_revocation_key) to derive per-commitment
45          * revocation keys. This is combined with the per-commitment-secret generated by the
46          * counterparty to create a secret which the counterparty can reveal to revoke previous
47          * states.
48          */
49         public RevocationBasepoint get_revocation_basepoint() {
50                 long ret = bindings.ChannelPublicKeys_get_revocation_basepoint(this.ptr);
51                 Reference.reachabilityFence(this);
52                 if (ret >= 0 && ret <= 4096) { return null; }
53                 org.ldk.structs.RevocationBasepoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RevocationBasepoint(null, ret); }
54                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
55                 return ret_hu_conv;
56         }
57
58         /**
59          * The base point which is used (with derive_public_revocation_key) to derive per-commitment
60          * revocation keys. This is combined with the per-commitment-secret generated by the
61          * counterparty to create a secret which the counterparty can reveal to revoke previous
62          * states.
63          */
64         public void set_revocation_basepoint(org.ldk.structs.RevocationBasepoint val) {
65                 bindings.ChannelPublicKeys_set_revocation_basepoint(this.ptr, val == null ? 0 : val.ptr);
66                 Reference.reachabilityFence(this);
67                 Reference.reachabilityFence(val);
68                 if (this != null) { this.ptrs_to.add(val); };
69         }
70
71         /**
72          * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
73          * spendable primary channel balance on the broadcaster's commitment transaction. This key is
74          * static across every commitment transaction.
75          */
76         public byte[] get_payment_point() {
77                 byte[] ret = bindings.ChannelPublicKeys_get_payment_point(this.ptr);
78                 Reference.reachabilityFence(this);
79                 return ret;
80         }
81
82         /**
83          * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
84          * spendable primary channel balance on the broadcaster's commitment transaction. This key is
85          * static across every commitment transaction.
86          */
87         public void set_payment_point(byte[] val) {
88                 bindings.ChannelPublicKeys_set_payment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
89                 Reference.reachabilityFence(this);
90                 Reference.reachabilityFence(val);
91         }
92
93         /**
94          * The base point which is used (with derive_public_key) to derive a per-commitment payment
95          * public key which receives non-HTLC-encumbered funds which are only available for spending
96          * after some delay (or can be claimed via the revocation path).
97          */
98         public DelayedPaymentBasepoint get_delayed_payment_basepoint() {
99                 long ret = bindings.ChannelPublicKeys_get_delayed_payment_basepoint(this.ptr);
100                 Reference.reachabilityFence(this);
101                 if (ret >= 0 && ret <= 4096) { return null; }
102                 org.ldk.structs.DelayedPaymentBasepoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DelayedPaymentBasepoint(null, ret); }
103                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
104                 return ret_hu_conv;
105         }
106
107         /**
108          * The base point which is used (with derive_public_key) to derive a per-commitment payment
109          * public key which receives non-HTLC-encumbered funds which are only available for spending
110          * after some delay (or can be claimed via the revocation path).
111          */
112         public void set_delayed_payment_basepoint(org.ldk.structs.DelayedPaymentBasepoint val) {
113                 bindings.ChannelPublicKeys_set_delayed_payment_basepoint(this.ptr, val == null ? 0 : val.ptr);
114                 Reference.reachabilityFence(this);
115                 Reference.reachabilityFence(val);
116                 if (this != null) { this.ptrs_to.add(val); };
117         }
118
119         /**
120          * The base point which is used (with derive_public_key) to derive a per-commitment public key
121          * which is used to encumber HTLC-in-flight outputs.
122          */
123         public HtlcBasepoint get_htlc_basepoint() {
124                 long ret = bindings.ChannelPublicKeys_get_htlc_basepoint(this.ptr);
125                 Reference.reachabilityFence(this);
126                 if (ret >= 0 && ret <= 4096) { return null; }
127                 org.ldk.structs.HtlcBasepoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.HtlcBasepoint(null, ret); }
128                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
129                 return ret_hu_conv;
130         }
131
132         /**
133          * The base point which is used (with derive_public_key) to derive a per-commitment public key
134          * which is used to encumber HTLC-in-flight outputs.
135          */
136         public void set_htlc_basepoint(org.ldk.structs.HtlcBasepoint val) {
137                 bindings.ChannelPublicKeys_set_htlc_basepoint(this.ptr, val == null ? 0 : val.ptr);
138                 Reference.reachabilityFence(this);
139                 Reference.reachabilityFence(val);
140                 if (this != null) { this.ptrs_to.add(val); };
141         }
142
143         /**
144          * Constructs a new ChannelPublicKeys given each field
145          */
146         public static ChannelPublicKeys of(byte[] funding_pubkey_arg, org.ldk.structs.RevocationBasepoint revocation_basepoint_arg, byte[] payment_point_arg, org.ldk.structs.DelayedPaymentBasepoint delayed_payment_basepoint_arg, org.ldk.structs.HtlcBasepoint htlc_basepoint_arg) {
147                 long ret = bindings.ChannelPublicKeys_new(InternalUtils.check_arr_len(funding_pubkey_arg, 33), revocation_basepoint_arg == null ? 0 : revocation_basepoint_arg.ptr, InternalUtils.check_arr_len(payment_point_arg, 33), delayed_payment_basepoint_arg == null ? 0 : delayed_payment_basepoint_arg.ptr, htlc_basepoint_arg == null ? 0 : htlc_basepoint_arg.ptr);
148                 Reference.reachabilityFence(funding_pubkey_arg);
149                 Reference.reachabilityFence(revocation_basepoint_arg);
150                 Reference.reachabilityFence(payment_point_arg);
151                 Reference.reachabilityFence(delayed_payment_basepoint_arg);
152                 Reference.reachabilityFence(htlc_basepoint_arg);
153                 if (ret >= 0 && ret <= 4096) { return null; }
154                 org.ldk.structs.ChannelPublicKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelPublicKeys(null, ret); }
155                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
156                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(revocation_basepoint_arg); };
157                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(delayed_payment_basepoint_arg); };
158                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(htlc_basepoint_arg); };
159                 return ret_hu_conv;
160         }
161
162         long clone_ptr() {
163                 long ret = bindings.ChannelPublicKeys_clone_ptr(this.ptr);
164                 Reference.reachabilityFence(this);
165                 return ret;
166         }
167
168         /**
169          * Creates a copy of the ChannelPublicKeys
170          */
171         public ChannelPublicKeys clone() {
172                 long ret = bindings.ChannelPublicKeys_clone(this.ptr);
173                 Reference.reachabilityFence(this);
174                 if (ret >= 0 && ret <= 4096) { return null; }
175                 org.ldk.structs.ChannelPublicKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelPublicKeys(null, ret); }
176                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
177                 return ret_hu_conv;
178         }
179
180         /**
181          * Generates a non-cryptographic 64-bit hash of the ChannelPublicKeys.
182          */
183         public long hash() {
184                 long ret = bindings.ChannelPublicKeys_hash(this.ptr);
185                 Reference.reachabilityFence(this);
186                 return ret;
187         }
188
189         @Override public int hashCode() {
190                 return (int)this.hash();
191         }
192         /**
193          * Checks if two ChannelPublicKeyss contain equal inner contents.
194          * This ignores pointers and is_owned flags and looks at the values in fields.
195          * Two objects with NULL inner values will be considered "equal" here.
196          */
197         public boolean eq(org.ldk.structs.ChannelPublicKeys b) {
198                 boolean ret = bindings.ChannelPublicKeys_eq(this.ptr, b == null ? 0 : b.ptr);
199                 Reference.reachabilityFence(this);
200                 Reference.reachabilityFence(b);
201                 if (this != null) { this.ptrs_to.add(b); };
202                 return ret;
203         }
204
205         @Override public boolean equals(Object o) {
206                 if (!(o instanceof ChannelPublicKeys)) return false;
207                 return this.eq((ChannelPublicKeys)o);
208         }
209         /**
210          * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
211          */
212         public byte[] write() {
213                 byte[] ret = bindings.ChannelPublicKeys_write(this.ptr);
214                 Reference.reachabilityFence(this);
215                 return ret;
216         }
217
218         /**
219          * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
220          */
221         public static Result_ChannelPublicKeysDecodeErrorZ read(byte[] ser) {
222                 long ret = bindings.ChannelPublicKeys_read(ser);
223                 Reference.reachabilityFence(ser);
224                 if (ret >= 0 && ret <= 4096) { return null; }
225                 Result_ChannelPublicKeysDecodeErrorZ ret_hu_conv = Result_ChannelPublicKeysDecodeErrorZ.constr_from_ptr(ret);
226                 return ret_hu_conv;
227         }
228
229 }