[Java] Update auto-generated Java bindings to LDK 0.0.121
[ldk-java] / src / main / java / org / ldk / structs / UtilMethods.java
1 package org.ldk.structs;
2 import org.ldk.impl.bindings;
3 import org.ldk.enums.*;
4 import org.ldk.util.*;
5 import java.util.Arrays;
6 import java.lang.ref.Reference;
7 import javax.annotation.Nullable;
8
9 public class UtilMethods {
10         /**
11          * Gets the 128-bit integer, as 16 little-endian bytes
12          */
13         public static byte[] U128_le_bytes(org.ldk.util.UInt128 val) {
14                 byte[] ret = bindings.U128_le_bytes(val.getLEBytes());
15                 Reference.reachabilityFence(val);
16                 return ret;
17         }
18
19         /**
20          * Constructs a new U128 from 16 little-endian bytes
21          */
22         public static UInt128 U128_new(byte[] le_bytes) {
23                 byte[] ret = bindings.U128_new(InternalUtils.check_arr_len(le_bytes, 16));
24                 Reference.reachabilityFence(le_bytes);
25                 org.ldk.util.UInt128 ret_conv = new org.ldk.util.UInt128(ret);
26                 return ret_conv;
27         }
28
29         /**
30          * Constructs a new COption_NoneZ containing a
31          */
32         public static COption_NoneZ COption_NoneZ_some() {
33                 COption_NoneZ ret = bindings.COption_NoneZ_some();
34                 return ret;
35         }
36
37         /**
38          * Constructs a new COption_NoneZ containing nothing
39          */
40         public static COption_NoneZ COption_NoneZ_none() {
41                 COption_NoneZ ret = bindings.COption_NoneZ_none();
42                 return ret;
43         }
44
45         /**
46          * Read a APIError from a byte array, created by APIError_write
47          */
48         public static Result_COption_APIErrorZDecodeErrorZ APIError_read(byte[] ser) {
49                 long ret = bindings.APIError_read(ser);
50                 Reference.reachabilityFence(ser);
51                 if (ret >= 0 && ret <= 4096) { return null; }
52                 Result_COption_APIErrorZDecodeErrorZ ret_hu_conv = Result_COption_APIErrorZDecodeErrorZ.constr_from_ptr(ret);
53                 return ret_hu_conv;
54         }
55
56         /**
57          * Creates a digital signature of a message given a SecretKey, like the node's secret.
58          * A receiver knowing the PublicKey (e.g. the node's id) and the message can be sure that the signature was generated by the caller.
59          * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
60          */
61         public static Result_StrSecp256k1ErrorZ sign(byte[] msg, byte[] sk) {
62                 long ret = bindings.sign(msg, InternalUtils.check_arr_len(sk, 32));
63                 Reference.reachabilityFence(msg);
64                 Reference.reachabilityFence(sk);
65                 if (ret >= 0 && ret <= 4096) { return null; }
66                 Result_StrSecp256k1ErrorZ ret_hu_conv = Result_StrSecp256k1ErrorZ.constr_from_ptr(ret);
67                 return ret_hu_conv;
68         }
69
70         /**
71          * Recovers the PublicKey of the signer of the message given the message and the signature.
72          */
73         public static Result_PublicKeySecp256k1ErrorZ recover_pk(byte[] msg, java.lang.String sig) {
74                 long ret = bindings.recover_pk(msg, sig);
75                 Reference.reachabilityFence(msg);
76                 Reference.reachabilityFence(sig);
77                 if (ret >= 0 && ret <= 4096) { return null; }
78                 Result_PublicKeySecp256k1ErrorZ ret_hu_conv = Result_PublicKeySecp256k1ErrorZ.constr_from_ptr(ret);
79                 return ret_hu_conv;
80         }
81
82         /**
83          * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
84          * and the PublicKey.
85          */
86         public static boolean verify(byte[] msg, java.lang.String sig, byte[] pk) {
87                 boolean ret = bindings.verify(msg, sig, InternalUtils.check_arr_len(pk, 33));
88                 Reference.reachabilityFence(msg);
89                 Reference.reachabilityFence(sig);
90                 Reference.reachabilityFence(pk);
91                 return ret;
92         }
93
94         /**
95          * Construct the invoice's HRP and signatureless data into a preimage to be hashed.
96          */
97         public static byte[] construct_invoice_preimage(byte[] hrp_bytes, UInt5[] data_without_signature) {
98                 byte[] ret = bindings.construct_invoice_preimage(hrp_bytes, data_without_signature != null ? InternalUtils.convUInt5Array(data_without_signature) : null);
99                 Reference.reachabilityFence(hrp_bytes);
100                 Reference.reachabilityFence(data_without_signature);
101                 return ret;
102         }
103
104         /**
105          * Read previously persisted [`ChannelMonitor`]s from the store.
106          */
107         public static Result_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ read_channel_monitors(org.ldk.structs.KVStore kv_store, org.ldk.structs.EntropySource entropy_source, org.ldk.structs.SignerProvider signer_provider) {
108                 long ret = bindings.read_channel_monitors(kv_store.ptr, entropy_source.ptr, signer_provider.ptr);
109                 Reference.reachabilityFence(kv_store);
110                 Reference.reachabilityFence(entropy_source);
111                 Reference.reachabilityFence(signer_provider);
112                 if (ret >= 0 && ret <= 4096) { return null; }
113                 Result_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ ret_hu_conv = Result_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ.constr_from_ptr(ret);
114                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(kv_store); };
115                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(entropy_source); };
116                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(signer_provider); };
117                 return ret_hu_conv;
118         }
119
120         /**
121          * Read a MonitorEvent from a byte array, created by MonitorEvent_write
122          */
123         public static Result_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(byte[] ser) {
124                 long ret = bindings.MonitorEvent_read(ser);
125                 Reference.reachabilityFence(ser);
126                 if (ret >= 0 && ret <= 4096) { return null; }
127                 Result_COption_MonitorEventZDecodeErrorZ ret_hu_conv = Result_COption_MonitorEventZDecodeErrorZ.constr_from_ptr(ret);
128                 return ret_hu_conv;
129         }
130
131         /**
132          * Read a C2Tuple_ThirtyTwoBytesChannelMonitorZ from a byte array, created by C2Tuple_ThirtyTwoBytesChannelMonitorZ_write
133          */
134         public static Result_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(byte[] ser, org.ldk.structs.EntropySource arg_a, org.ldk.structs.SignerProvider arg_b) {
135                 long ret = bindings.C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(ser, arg_a.ptr, arg_b.ptr);
136                 Reference.reachabilityFence(ser);
137                 Reference.reachabilityFence(arg_a);
138                 Reference.reachabilityFence(arg_b);
139                 if (ret >= 0 && ret <= 4096) { return null; }
140                 Result_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ ret_hu_conv = Result_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ.constr_from_ptr(ret);
141                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_a); };
142                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_b); };
143                 return ret_hu_conv;
144         }
145
146         /**
147          * Peel one layer off an incoming onion, returning a [`PendingHTLCInfo`] that contains information
148          * about the intended next-hop for the HTLC.
149          * 
150          * This does all the relevant context-free checks that LDK requires for payment relay or
151          * acceptance. If the payment is to be received, and the amount matches the expected amount for
152          * a given invoice, this indicates the [`msgs::UpdateAddHTLC`], once fully committed in the
153          * channel, will generate an [`Event::PaymentClaimable`].
154          * 
155          * [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable
156          */
157         public static Result_PendingHTLCInfoInboundHTLCErrZ peel_payment_onion(org.ldk.structs.UpdateAddHTLC msg, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, int cur_height, boolean accept_mpp_keysend, boolean allow_skimmed_fees) {
158                 long ret = bindings.peel_payment_onion(msg == null ? 0 : msg.ptr, node_signer.ptr, logger.ptr, cur_height, accept_mpp_keysend, allow_skimmed_fees);
159                 Reference.reachabilityFence(msg);
160                 Reference.reachabilityFence(node_signer);
161                 Reference.reachabilityFence(logger);
162                 Reference.reachabilityFence(cur_height);
163                 Reference.reachabilityFence(accept_mpp_keysend);
164                 Reference.reachabilityFence(allow_skimmed_fees);
165                 if (ret >= 0 && ret <= 4096) { return null; }
166                 Result_PendingHTLCInfoInboundHTLCErrZ ret_hu_conv = Result_PendingHTLCInfoInboundHTLCErrZ.constr_from_ptr(ret);
167                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
168                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); };
169                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
170                 return ret_hu_conv;
171         }
172
173         /**
174          * Fetches the set of [`InitFeatures`] flags that are provided by or required by
175          * [`ChannelManager`].
176          */
177         public static InitFeatures provided_init_features(org.ldk.structs.UserConfig config) {
178                 long ret = bindings.provided_init_features(config == null ? 0 : config.ptr);
179                 Reference.reachabilityFence(config);
180                 if (ret >= 0 && ret <= 4096) { return null; }
181                 org.ldk.structs.InitFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InitFeatures(null, ret); }
182                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
183                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(config); };
184                 return ret_hu_conv;
185         }
186
187         /**
188          * Read a C2Tuple_ThirtyTwoBytesChannelManagerZ from a byte array, created by C2Tuple_ThirtyTwoBytesChannelManagerZ_write
189          */
190         public static Result_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ C2Tuple_ThirtyTwoBytesChannelManagerZ_read(byte[] ser, EntropySource arg_entropy_source, NodeSigner arg_node_signer, SignerProvider arg_signer_provider, FeeEstimator arg_fee_estimator, Watch arg_chain_monitor, BroadcasterInterface arg_tx_broadcaster, Router arg_router, Logger arg_logger, UserConfig arg_default_config, ChannelMonitor[] arg_channel_monitors) {
191                 long ret = bindings.C2Tuple_ThirtyTwoBytesChannelManagerZ_read(ser, bindings.ChannelManagerReadArgs_new(arg_entropy_source.ptr, arg_node_signer.ptr, arg_signer_provider.ptr, arg_fee_estimator.ptr, arg_chain_monitor.ptr, arg_tx_broadcaster.ptr, arg_router.ptr, arg_logger.ptr, arg_default_config == null ? 0 : arg_default_config.ptr, arg_channel_monitors != null ? Arrays.stream(arg_channel_monitors).mapToLong(arg_channel_monitors_conv_16 -> arg_channel_monitors_conv_16 == null ? 0 : arg_channel_monitors_conv_16.ptr).toArray() : null));
192                 Reference.reachabilityFence(ser);
193                 Reference.reachabilityFence(arg_entropy_source);
194                 Reference.reachabilityFence(arg_node_signer);
195                 Reference.reachabilityFence(arg_signer_provider);
196                 Reference.reachabilityFence(arg_fee_estimator);
197                 Reference.reachabilityFence(arg_chain_monitor);
198                 Reference.reachabilityFence(arg_tx_broadcaster);
199                 Reference.reachabilityFence(arg_router);
200                 Reference.reachabilityFence(arg_logger);
201                 Reference.reachabilityFence(arg_default_config);
202                 Reference.reachabilityFence(arg_channel_monitors);
203                 if (ret >= 0 && ret <= 4096) { return null; }
204                 Result_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ ret_hu_conv = Result_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ.constr_from_ptr(ret);
205                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_entropy_source); };
206                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_node_signer); };
207                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_signer_provider); };
208                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_fee_estimator); };
209                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_chain_monitor); };
210                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_tx_broadcaster); };
211                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_router); };
212                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_logger); };
213                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_default_config); };
214                 for (ChannelMonitor arg_channel_monitors_conv_16: arg_channel_monitors) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_channel_monitors_conv_16); }; };
215                 return ret_hu_conv;
216         }
217
218         /**
219          * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment`], but no
220          * `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without
221          * a `ChannelManager`.
222          * 
223          * `keys` is generated by calling [`NodeSigner::get_inbound_payment_key_material`] and then
224          * calling [`ExpandedKey::new`] with its result. It is recommended to cache this value and not
225          * regenerate it for each new inbound payment.
226          * 
227          * `current_time` is a Unix timestamp representing the current time.
228          * 
229          * Note that if `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable
230          * on versions of LDK prior to 0.0.114.
231          * 
232          * [phantom node payments]: crate::sign::PhantomKeysManager
233          * [`NodeSigner::get_inbound_payment_key_material`]: crate::sign::NodeSigner::get_inbound_payment_key_material
234          */
235         public static Result_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ create(org.ldk.structs.ExpandedKey keys, org.ldk.structs.Option_u64Z min_value_msat, int invoice_expiry_delta_secs, org.ldk.structs.EntropySource entropy_source, long current_time, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) {
236                 long ret = bindings.create(keys == null ? 0 : keys.ptr, min_value_msat.ptr, invoice_expiry_delta_secs, entropy_source.ptr, current_time, min_final_cltv_expiry_delta.ptr);
237                 Reference.reachabilityFence(keys);
238                 Reference.reachabilityFence(min_value_msat);
239                 Reference.reachabilityFence(invoice_expiry_delta_secs);
240                 Reference.reachabilityFence(entropy_source);
241                 Reference.reachabilityFence(current_time);
242                 Reference.reachabilityFence(min_final_cltv_expiry_delta);
243                 if (ret >= 0 && ret <= 4096) { return null; }
244                 Result_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ ret_hu_conv = Result_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ.constr_from_ptr(ret);
245                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys); };
246                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_value_msat); };
247                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(entropy_source); };
248                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_final_cltv_expiry_delta); };
249                 return ret_hu_conv;
250         }
251
252         /**
253          * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash`],
254          * but no `ChannelManager` is required. Useful for generating invoices for [phantom node payments]
255          * without a `ChannelManager`.
256          * 
257          * See [`create`] for information on the `keys` and `current_time` parameters.
258          * 
259          * Note that if `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable
260          * on versions of LDK prior to 0.0.114.
261          * 
262          * [phantom node payments]: crate::sign::PhantomKeysManager
263          */
264         public static Result_ThirtyTwoBytesNoneZ create_from_hash(org.ldk.structs.ExpandedKey keys, org.ldk.structs.Option_u64Z min_value_msat, byte[] payment_hash, int invoice_expiry_delta_secs, long current_time, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) {
265                 long ret = bindings.create_from_hash(keys == null ? 0 : keys.ptr, min_value_msat.ptr, InternalUtils.check_arr_len(payment_hash, 32), invoice_expiry_delta_secs, current_time, min_final_cltv_expiry_delta.ptr);
266                 Reference.reachabilityFence(keys);
267                 Reference.reachabilityFence(min_value_msat);
268                 Reference.reachabilityFence(payment_hash);
269                 Reference.reachabilityFence(invoice_expiry_delta_secs);
270                 Reference.reachabilityFence(current_time);
271                 Reference.reachabilityFence(min_final_cltv_expiry_delta);
272                 if (ret >= 0 && ret <= 4096) { return null; }
273                 Result_ThirtyTwoBytesNoneZ ret_hu_conv = Result_ThirtyTwoBytesNoneZ.constr_from_ptr(ret);
274                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys); };
275                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_value_msat); };
276                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_final_cltv_expiry_delta); };
277                 return ret_hu_conv;
278         }
279
280         /**
281          * Parses an OnionV3 host and port into a [`SocketAddress::OnionV3`].
282          * 
283          * The host part must end with \".onion\".
284          */
285         public static Result_SocketAddressSocketAddressParseErrorZ parse_onion_address(java.lang.String host, short port) {
286                 long ret = bindings.parse_onion_address(host, port);
287                 Reference.reachabilityFence(host);
288                 Reference.reachabilityFence(port);
289                 if (ret >= 0 && ret <= 4096) { return null; }
290                 Result_SocketAddressSocketAddressParseErrorZ ret_hu_conv = Result_SocketAddressSocketAddressParseErrorZ.constr_from_ptr(ret);
291                 return ret_hu_conv;
292         }
293
294         /**
295          * Gets the weight for an HTLC-Success transaction.
296          */
297         public static long htlc_success_tx_weight(org.ldk.structs.ChannelTypeFeatures channel_type_features) {
298                 long ret = bindings.htlc_success_tx_weight(channel_type_features == null ? 0 : channel_type_features.ptr);
299                 Reference.reachabilityFence(channel_type_features);
300                 return ret;
301         }
302
303         /**
304          * Gets the weight for an HTLC-Timeout transaction.
305          */
306         public static long htlc_timeout_tx_weight(org.ldk.structs.ChannelTypeFeatures channel_type_features) {
307                 long ret = bindings.htlc_timeout_tx_weight(channel_type_features == null ? 0 : channel_type_features.ptr);
308                 Reference.reachabilityFence(channel_type_features);
309                 return ret;
310         }
311
312         /**
313          * Check if a given input witness attempts to claim a HTLC.
314          */
315         public static Option_HTLCClaimZ HTLCClaim_from_witness(byte[] witness) {
316                 long ret = bindings.HTLCClaim_from_witness(witness);
317                 Reference.reachabilityFence(witness);
318                 if (ret >= 0 && ret <= 4096) { return null; }
319                 org.ldk.structs.Option_HTLCClaimZ ret_hu_conv = org.ldk.structs.Option_HTLCClaimZ.constr_from_ptr(ret);
320                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
321                 return ret_hu_conv;
322         }
323
324         /**
325          * Build the commitment secret from the seed and the commitment number
326          */
327         public static byte[] build_commitment_secret(byte[] commitment_seed, long idx) {
328                 byte[] ret = bindings.build_commitment_secret(InternalUtils.check_arr_len(commitment_seed, 32), idx);
329                 Reference.reachabilityFence(commitment_seed);
330                 Reference.reachabilityFence(idx);
331                 return ret;
332         }
333
334         /**
335          * Build a closing transaction
336          */
337         public static byte[] build_closing_transaction(long to_holder_value_sat, long to_counterparty_value_sat, byte[] to_holder_script, byte[] to_counterparty_script, org.ldk.structs.OutPoint funding_outpoint) {
338                 byte[] ret = bindings.build_closing_transaction(to_holder_value_sat, to_counterparty_value_sat, to_holder_script, to_counterparty_script, funding_outpoint == null ? 0 : funding_outpoint.ptr);
339                 Reference.reachabilityFence(to_holder_value_sat);
340                 Reference.reachabilityFence(to_counterparty_value_sat);
341                 Reference.reachabilityFence(to_holder_script);
342                 Reference.reachabilityFence(to_counterparty_script);
343                 Reference.reachabilityFence(funding_outpoint);
344                 return ret;
345         }
346
347         /**
348          * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
349          * from the base secret and the per_commitment_point.
350          */
351         public static byte[] derive_private_key(byte[] per_commitment_point, byte[] base_secret) {
352                 byte[] ret = bindings.derive_private_key(InternalUtils.check_arr_len(per_commitment_point, 33), InternalUtils.check_arr_len(base_secret, 32));
353                 Reference.reachabilityFence(per_commitment_point);
354                 Reference.reachabilityFence(base_secret);
355                 return ret;
356         }
357
358         /**
359          * Derives a per-commitment-transaction revocation key from its constituent parts.
360          * 
361          * Only the cheating participant owns a valid witness to propagate a revoked
362          * commitment transaction, thus per_commitment_secret always come from cheater
363          * and revocation_base_secret always come from punisher, which is the broadcaster
364          * of the transaction spending with this key knowledge.
365          */
366         public static byte[] derive_private_revocation_key(byte[] per_commitment_secret, byte[] countersignatory_revocation_base_secret) {
367                 byte[] ret = bindings.derive_private_revocation_key(InternalUtils.check_arr_len(per_commitment_secret, 32), InternalUtils.check_arr_len(countersignatory_revocation_base_secret, 32));
368                 Reference.reachabilityFence(per_commitment_secret);
369                 Reference.reachabilityFence(countersignatory_revocation_base_secret);
370                 return ret;
371         }
372
373         /**
374          * A script either spendable by the revocation
375          * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
376          * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
377          */
378         public static byte[] get_revokeable_redeemscript(org.ldk.structs.RevocationKey revocation_key, short contest_delay, org.ldk.structs.DelayedPaymentKey broadcaster_delayed_payment_key) {
379                 byte[] ret = bindings.get_revokeable_redeemscript(revocation_key == null ? 0 : revocation_key.ptr, contest_delay, broadcaster_delayed_payment_key == null ? 0 : broadcaster_delayed_payment_key.ptr);
380                 Reference.reachabilityFence(revocation_key);
381                 Reference.reachabilityFence(contest_delay);
382                 Reference.reachabilityFence(broadcaster_delayed_payment_key);
383                 return ret;
384         }
385
386         /**
387          * Returns the script for the counterparty's output on a holder's commitment transaction based on
388          * the channel type.
389          */
390         public static byte[] get_counterparty_payment_script(org.ldk.structs.ChannelTypeFeatures channel_type_features, byte[] payment_key) {
391                 byte[] ret = bindings.get_counterparty_payment_script(channel_type_features == null ? 0 : channel_type_features.ptr, InternalUtils.check_arr_len(payment_key, 33));
392                 Reference.reachabilityFence(channel_type_features);
393                 Reference.reachabilityFence(payment_key);
394                 return ret;
395         }
396
397         /**
398          * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
399          * does not need to have its previous_output_index filled.
400          */
401         public static byte[] get_htlc_redeemscript(org.ldk.structs.HTLCOutputInCommitment htlc, org.ldk.structs.ChannelTypeFeatures channel_type_features, org.ldk.structs.TxCreationKeys keys) {
402                 byte[] ret = bindings.get_htlc_redeemscript(htlc == null ? 0 : htlc.ptr, channel_type_features == null ? 0 : channel_type_features.ptr, keys == null ? 0 : keys.ptr);
403                 Reference.reachabilityFence(htlc);
404                 Reference.reachabilityFence(channel_type_features);
405                 Reference.reachabilityFence(keys);
406                 return ret;
407         }
408
409         /**
410          * Gets the redeemscript for a funding output from the two funding public keys.
411          * Note that the order of funding public keys does not matter.
412          */
413         public static byte[] make_funding_redeemscript(byte[] broadcaster, byte[] countersignatory) {
414                 byte[] ret = bindings.make_funding_redeemscript(InternalUtils.check_arr_len(broadcaster, 33), InternalUtils.check_arr_len(countersignatory, 33));
415                 Reference.reachabilityFence(broadcaster);
416                 Reference.reachabilityFence(countersignatory);
417                 return ret;
418         }
419
420         /**
421          * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
422          * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
423          * transaction which needs signing, and can be used to construct an HTLC transaction which is
424          * broadcastable given a counterparty HTLC signature.
425          * 
426          * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
427          * commitment transaction).
428          */
429         public static byte[] build_htlc_transaction(byte[] commitment_txid, int feerate_per_kw, short contest_delay, org.ldk.structs.HTLCOutputInCommitment htlc, org.ldk.structs.ChannelTypeFeatures channel_type_features, org.ldk.structs.DelayedPaymentKey broadcaster_delayed_payment_key, org.ldk.structs.RevocationKey revocation_key) {
430                 byte[] ret = bindings.build_htlc_transaction(InternalUtils.check_arr_len(commitment_txid, 32), feerate_per_kw, contest_delay, htlc == null ? 0 : htlc.ptr, channel_type_features == null ? 0 : channel_type_features.ptr, broadcaster_delayed_payment_key == null ? 0 : broadcaster_delayed_payment_key.ptr, revocation_key == null ? 0 : revocation_key.ptr);
431                 Reference.reachabilityFence(commitment_txid);
432                 Reference.reachabilityFence(feerate_per_kw);
433                 Reference.reachabilityFence(contest_delay);
434                 Reference.reachabilityFence(htlc);
435                 Reference.reachabilityFence(channel_type_features);
436                 Reference.reachabilityFence(broadcaster_delayed_payment_key);
437                 Reference.reachabilityFence(revocation_key);
438                 return ret;
439         }
440
441         /**
442          * Returns the witness required to satisfy and spend a HTLC input.
443          */
444         public static byte[] build_htlc_input_witness(byte[] local_sig, byte[] remote_sig, org.ldk.structs.Option_ThirtyTwoBytesZ preimage, byte[] redeem_script, org.ldk.structs.ChannelTypeFeatures channel_type_features) {
445                 byte[] ret = bindings.build_htlc_input_witness(InternalUtils.check_arr_len(local_sig, 64), InternalUtils.check_arr_len(remote_sig, 64), preimage.ptr, redeem_script, channel_type_features == null ? 0 : channel_type_features.ptr);
446                 Reference.reachabilityFence(local_sig);
447                 Reference.reachabilityFence(remote_sig);
448                 Reference.reachabilityFence(preimage);
449                 Reference.reachabilityFence(redeem_script);
450                 Reference.reachabilityFence(channel_type_features);
451                 return ret;
452         }
453
454         /**
455          * Gets the witnessScript for the to_remote output when anchors are enabled.
456          */
457         public static byte[] get_to_countersignatory_with_anchors_redeemscript(byte[] payment_point) {
458                 byte[] ret = bindings.get_to_countersignatory_with_anchors_redeemscript(InternalUtils.check_arr_len(payment_point, 33));
459                 Reference.reachabilityFence(payment_point);
460                 return ret;
461         }
462
463         /**
464          * Gets the witnessScript for an anchor output from the funding public key.
465          * The witness in the spending input must be:
466          * <BIP 143 funding_signature>
467          * After 16 blocks of confirmation, an alternative satisfying witness could be:
468          * <>
469          * (empty vector required to satisfy compliance with MINIMALIF-standard rule)
470          */
471         public static byte[] get_anchor_redeemscript(byte[] funding_pubkey) {
472                 byte[] ret = bindings.get_anchor_redeemscript(InternalUtils.check_arr_len(funding_pubkey, 33));
473                 Reference.reachabilityFence(funding_pubkey);
474                 return ret;
475         }
476
477         /**
478          * Returns the witness required to satisfy and spend an anchor input.
479          */
480         public static byte[] build_anchor_input_witness(byte[] funding_key, byte[] funding_sig) {
481                 byte[] ret = bindings.build_anchor_input_witness(InternalUtils.check_arr_len(funding_key, 33), InternalUtils.check_arr_len(funding_sig, 64));
482                 Reference.reachabilityFence(funding_key);
483                 Reference.reachabilityFence(funding_sig);
484                 return ret;
485         }
486
487         /**
488          * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
489          * shared secret first. This prevents on-chain observers from discovering how many commitment
490          * transactions occurred in a channel before it was closed.
491          * 
492          * This function gets the shared secret from relevant channel public keys and can be used to
493          * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
494          */
495         public static long get_commitment_transaction_number_obscure_factor(byte[] broadcaster_payment_basepoint, byte[] countersignatory_payment_basepoint, boolean outbound_from_broadcaster) {
496                 long ret = bindings.get_commitment_transaction_number_obscure_factor(InternalUtils.check_arr_len(broadcaster_payment_basepoint, 33), InternalUtils.check_arr_len(countersignatory_payment_basepoint, 33), outbound_from_broadcaster);
497                 Reference.reachabilityFence(broadcaster_payment_basepoint);
498                 Reference.reachabilityFence(countersignatory_payment_basepoint);
499                 Reference.reachabilityFence(outbound_from_broadcaster);
500                 return ret;
501         }
502
503         /**
504          * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write
505          */
506         public static Result_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(byte[] ser) {
507                 long ret = bindings.NetworkUpdate_read(ser);
508                 Reference.reachabilityFence(ser);
509                 if (ret >= 0 && ret <= 4096) { return null; }
510                 Result_COption_NetworkUpdateZDecodeErrorZ ret_hu_conv = Result_COption_NetworkUpdateZDecodeErrorZ.constr_from_ptr(ret);
511                 return ret_hu_conv;
512         }
513
514         /**
515          * Verifies the signature of a [`NodeAnnouncement`].
516          * 
517          * Returns an error if it is invalid.
518          */
519         public static Result_NoneLightningErrorZ verify_node_announcement(org.ldk.structs.NodeAnnouncement msg) {
520                 long ret = bindings.verify_node_announcement(msg == null ? 0 : msg.ptr);
521                 Reference.reachabilityFence(msg);
522                 if (ret >= 0 && ret <= 4096) { return null; }
523                 Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
524                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
525                 return ret_hu_conv;
526         }
527
528         /**
529          * Verifies all signatures included in a [`ChannelAnnouncement`].
530          * 
531          * Returns an error if one of the signatures is invalid.
532          */
533         public static Result_NoneLightningErrorZ verify_channel_announcement(org.ldk.structs.ChannelAnnouncement msg) {
534                 long ret = bindings.verify_channel_announcement(msg == null ? 0 : msg.ptr);
535                 Reference.reachabilityFence(msg);
536                 if (ret >= 0 && ret <= 4096) { return null; }
537                 Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
538                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
539                 return ret_hu_conv;
540         }
541
542         /**
543          * Finds a route from us (payer) to the given target node (payee).
544          * 
545          * If the payee provided features in their invoice, they should be provided via the `payee` field
546          * in the given [`RouteParameters::payment_params`].
547          * Without this, MPP will only be used if the payee's features are available in the network graph.
548          * 
549          * Private routing paths between a public node and the target may be included in the `payee` field
550          * of [`RouteParameters::payment_params`].
551          * 
552          * If some channels aren't announced, it may be useful to fill in `first_hops` with the results
553          * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of these channels
554          * from `network_graph` will be ignored, and only those in `first_hops` will be used.
555          * 
556          * The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
557          * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
558          * `htlc_maximum_msat` *are* checked as they may change based on the receiving node.
559          * 
560          * # Panics
561          * 
562          * Panics if first_hops contains channels without `short_channel_id`s;
563          * [`ChannelManager::list_usable_channels`] will never include such channels.
564          * 
565          * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
566          * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
567          * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
568          * 
569          * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
570          */
571         public static Result_RouteLightningErrorZ find_route(byte[] our_node_pubkey, org.ldk.structs.RouteParameters route_params, org.ldk.structs.NetworkGraph network_graph, @Nullable ChannelDetails[] first_hops, org.ldk.structs.Logger logger, org.ldk.structs.ScoreLookUp scorer, org.ldk.structs.ProbabilisticScoringFeeParameters score_params, byte[] random_seed_bytes) {
572                 long ret = bindings.find_route(InternalUtils.check_arr_len(our_node_pubkey, 33), route_params == null ? 0 : route_params.ptr, network_graph == null ? 0 : network_graph.ptr, first_hops != null ? Arrays.stream(first_hops).mapToLong(first_hops_conv_16 -> first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr).toArray() : null, logger.ptr, scorer.ptr, score_params == null ? 0 : score_params.ptr, InternalUtils.check_arr_len(random_seed_bytes, 32));
573                 Reference.reachabilityFence(our_node_pubkey);
574                 Reference.reachabilityFence(route_params);
575                 Reference.reachabilityFence(network_graph);
576                 Reference.reachabilityFence(first_hops);
577                 Reference.reachabilityFence(logger);
578                 Reference.reachabilityFence(scorer);
579                 Reference.reachabilityFence(score_params);
580                 Reference.reachabilityFence(random_seed_bytes);
581                 if (ret >= 0 && ret <= 4096) { return null; }
582                 Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret);
583                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(route_params); };
584                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(network_graph); };
585                 if (first_hops != null) { for (ChannelDetails first_hops_conv_16: first_hops) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(first_hops_conv_16); }; } };
586                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
587                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(scorer); };
588                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(score_params); };
589                 return ret_hu_conv;
590         }
591
592         /**
593          * Construct a route from us (payer) to the target node (payee) via the given hops (which should
594          * exclude the payer, but include the payee). This may be useful, e.g., for probing the chosen path.
595          * 
596          * Re-uses logic from `find_route`, so the restrictions described there also apply here.
597          */
598         public static Result_RouteLightningErrorZ build_route_from_hops(byte[] our_node_pubkey, byte[][] hops, org.ldk.structs.RouteParameters route_params, org.ldk.structs.NetworkGraph network_graph, org.ldk.structs.Logger logger, byte[] random_seed_bytes) {
599                 long ret = bindings.build_route_from_hops(InternalUtils.check_arr_len(our_node_pubkey, 33), hops != null ? Arrays.stream(hops).map(hops_conv_8 -> InternalUtils.check_arr_len(hops_conv_8, 33)).toArray(byte[][]::new) : null, route_params == null ? 0 : route_params.ptr, network_graph == null ? 0 : network_graph.ptr, logger.ptr, InternalUtils.check_arr_len(random_seed_bytes, 32));
600                 Reference.reachabilityFence(our_node_pubkey);
601                 Reference.reachabilityFence(hops);
602                 Reference.reachabilityFence(route_params);
603                 Reference.reachabilityFence(network_graph);
604                 Reference.reachabilityFence(logger);
605                 Reference.reachabilityFence(random_seed_bytes);
606                 if (ret >= 0 && ret <= 4096) { return null; }
607                 Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret);
608                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(route_params); };
609                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(network_graph); };
610                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
611                 return ret_hu_conv;
612         }
613
614         /**
615          * Creates an unsigned [`PartiallySignedTransaction`] which spends the given descriptors to
616          * the given outputs, plus an output to the given change destination (if sufficient
617          * change value remains). The PSBT will have a feerate, at least, of the given value.
618          * 
619          * The `locktime` argument is used to set the transaction's locktime. If `None`, the
620          * transaction will have a locktime of 0. It it recommended to set this to the current block
621          * height to avoid fee sniping, unless you have some specific reason to use a different
622          * locktime.
623          * 
624          * Returns the PSBT and expected max transaction weight.
625          * 
626          * Returns `Err(())` if the output value is greater than the input value minus required fee,
627          * if a descriptor was duplicated, or if an output descriptor `script_pubkey`
628          * does not match the one we can spend.
629          * 
630          * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
631          */
632         public static Result_C2Tuple_CVec_u8Zu64ZNoneZ SpendableOutputDescriptor_create_spendable_outputs_psbt(SpendableOutputDescriptor[] descriptors, TxOut[] outputs, byte[] change_destination_script, int feerate_sat_per_1000_weight, org.ldk.structs.Option_u32Z locktime) {
633                 long ret = bindings.SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors != null ? Arrays.stream(descriptors).mapToLong(descriptors_conv_27 -> descriptors_conv_27.ptr).toArray() : null, outputs != null ? Arrays.stream(outputs).mapToLong(outputs_conv_7 -> outputs_conv_7.ptr).toArray() : null, change_destination_script, feerate_sat_per_1000_weight, locktime.ptr);
634                 Reference.reachabilityFence(descriptors);
635                 Reference.reachabilityFence(outputs);
636                 Reference.reachabilityFence(change_destination_script);
637                 Reference.reachabilityFence(feerate_sat_per_1000_weight);
638                 Reference.reachabilityFence(locktime);
639                 if (ret >= 0 && ret <= 4096) { return null; }
640                 Result_C2Tuple_CVec_u8Zu64ZNoneZ ret_hu_conv = Result_C2Tuple_CVec_u8Zu64ZNoneZ.constr_from_ptr(ret);
641                 for (SpendableOutputDescriptor descriptors_conv_27: descriptors) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(descriptors_conv_27); }; };
642                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(locktime); };
643                 return ret_hu_conv;
644         }
645
646         /**
647          * Creates an [`OnionMessage`] with the given `contents` for sending to the destination of
648          * `path`.
649          * 
650          * Returns the node id of the peer to send the message to, the message itself, and any addresses
651          * need to connect to the first node.
652          * 
653          * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None
654          */
655         public static Result_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ create_onion_message(org.ldk.structs.EntropySource entropy_source, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.OnionMessagePath path, org.ldk.structs.OnionMessageContents contents, @Nullable org.ldk.structs.BlindedPath reply_path) {
656                 long ret = bindings.create_onion_message(entropy_source.ptr, node_signer.ptr, path == null ? 0 : path.ptr, contents.ptr, reply_path == null ? 0 : reply_path.ptr);
657                 Reference.reachabilityFence(entropy_source);
658                 Reference.reachabilityFence(node_signer);
659                 Reference.reachabilityFence(path);
660                 Reference.reachabilityFence(contents);
661                 Reference.reachabilityFence(reply_path);
662                 if (ret >= 0 && ret <= 4096) { return null; }
663                 Result_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ ret_hu_conv = Result_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ.constr_from_ptr(ret);
664                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(entropy_source); };
665                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); };
666                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path); };
667                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(contents); };
668                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(reply_path); };
669                 return ret_hu_conv;
670         }
671
672         /**
673          * Decode one layer of an incoming [`OnionMessage`].
674          * 
675          * Returns either the next layer of the onion for forwarding or the decrypted content for the
676          * receiver.
677          */
678         public static Result_PeeledOnionNoneZ peel_onion_message(org.ldk.structs.OnionMessage msg, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.structs.CustomOnionMessageHandler custom_handler) {
679                 long ret = bindings.peel_onion_message(msg == null ? 0 : msg.ptr, node_signer.ptr, logger.ptr, custom_handler.ptr);
680                 Reference.reachabilityFence(msg);
681                 Reference.reachabilityFence(node_signer);
682                 Reference.reachabilityFence(logger);
683                 Reference.reachabilityFence(custom_handler);
684                 if (ret >= 0 && ret <= 4096) { return null; }
685                 Result_PeeledOnionNoneZ ret_hu_conv = Result_PeeledOnionNoneZ.constr_from_ptr(ret);
686                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
687                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); };
688                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
689                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(custom_handler); };
690                 return ret_hu_conv;
691         }
692
693         /**
694          * Returns whether `tlv_type` corresponds to a TLV record for Offers.
695          */
696         public static boolean OffersMessage_is_known_type(long tlv_type) {
697                 boolean ret = bindings.OffersMessage_is_known_type(tlv_type);
698                 Reference.reachabilityFence(tlv_type);
699                 return ret;
700         }
701
702         /**
703          * Create a one-hop blinded path for a payment.
704          */
705         public static Result_C2Tuple_BlindedPayInfoBlindedPathZNoneZ BlindedPath_one_hop_for_payment(byte[] payee_node_id, org.ldk.structs.ReceiveTlvs payee_tlvs, org.ldk.structs.EntropySource entropy_source) {
706                 long ret = bindings.BlindedPath_one_hop_for_payment(InternalUtils.check_arr_len(payee_node_id, 33), payee_tlvs == null ? 0 : payee_tlvs.ptr, entropy_source.ptr);
707                 Reference.reachabilityFence(payee_node_id);
708                 Reference.reachabilityFence(payee_tlvs);
709                 Reference.reachabilityFence(entropy_source);
710                 if (ret >= 0 && ret <= 4096) { return null; }
711                 Result_C2Tuple_BlindedPayInfoBlindedPathZNoneZ ret_hu_conv = Result_C2Tuple_BlindedPayInfoBlindedPathZNoneZ.constr_from_ptr(ret);
712                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(payee_tlvs); };
713                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(entropy_source); };
714                 return ret_hu_conv;
715         }
716
717         /**
718          * Create a blinded path for a payment, to be forwarded along `intermediate_nodes`.
719          * 
720          * Errors if:
721          * a provided node id is invalid
722          * [`BlindedPayInfo`] calculation results in an integer overflow
723          * any unknown features are required in the provided [`ForwardTlvs`]
724          * 
725          * [`ForwardTlvs`]: crate::blinded_path::payment::ForwardTlvs
726          */
727         public static Result_C2Tuple_BlindedPayInfoBlindedPathZNoneZ BlindedPath_new_for_payment(ForwardNode[] intermediate_nodes, byte[] payee_node_id, org.ldk.structs.ReceiveTlvs payee_tlvs, long htlc_maximum_msat, org.ldk.structs.EntropySource entropy_source) {
728                 long ret = bindings.BlindedPath_new_for_payment(intermediate_nodes != null ? Arrays.stream(intermediate_nodes).mapToLong(intermediate_nodes_conv_13 -> intermediate_nodes_conv_13 == null ? 0 : intermediate_nodes_conv_13.ptr).toArray() : null, InternalUtils.check_arr_len(payee_node_id, 33), payee_tlvs == null ? 0 : payee_tlvs.ptr, htlc_maximum_msat, entropy_source.ptr);
729                 Reference.reachabilityFence(intermediate_nodes);
730                 Reference.reachabilityFence(payee_node_id);
731                 Reference.reachabilityFence(payee_tlvs);
732                 Reference.reachabilityFence(htlc_maximum_msat);
733                 Reference.reachabilityFence(entropy_source);
734                 if (ret >= 0 && ret <= 4096) { return null; }
735                 Result_C2Tuple_BlindedPayInfoBlindedPathZNoneZ ret_hu_conv = Result_C2Tuple_BlindedPayInfoBlindedPathZNoneZ.constr_from_ptr(ret);
736                 for (ForwardNode intermediate_nodes_conv_13: intermediate_nodes) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(intermediate_nodes_conv_13); }; };
737                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(payee_tlvs); };
738                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(entropy_source); };
739                 return ret_hu_conv;
740         }
741
742         /**
743          * Read a PathFailure from a byte array, created by PathFailure_write
744          */
745         public static Result_COption_PathFailureZDecodeErrorZ PathFailure_read(byte[] ser) {
746                 long ret = bindings.PathFailure_read(ser);
747                 Reference.reachabilityFence(ser);
748                 if (ret >= 0 && ret <= 4096) { return null; }
749                 Result_COption_PathFailureZDecodeErrorZ ret_hu_conv = Result_COption_PathFailureZDecodeErrorZ.constr_from_ptr(ret);
750                 return ret_hu_conv;
751         }
752
753         /**
754          * Read a ClosureReason from a byte array, created by ClosureReason_write
755          */
756         public static Result_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(byte[] ser) {
757                 long ret = bindings.ClosureReason_read(ser);
758                 Reference.reachabilityFence(ser);
759                 if (ret >= 0 && ret <= 4096) { return null; }
760                 Result_COption_ClosureReasonZDecodeErrorZ ret_hu_conv = Result_COption_ClosureReasonZDecodeErrorZ.constr_from_ptr(ret);
761                 return ret_hu_conv;
762         }
763
764         /**
765          * Read a HTLCDestination from a byte array, created by HTLCDestination_write
766          */
767         public static Result_COption_HTLCDestinationZDecodeErrorZ HTLCDestination_read(byte[] ser) {
768                 long ret = bindings.HTLCDestination_read(ser);
769                 Reference.reachabilityFence(ser);
770                 if (ret >= 0 && ret <= 4096) { return null; }
771                 Result_COption_HTLCDestinationZDecodeErrorZ ret_hu_conv = Result_COption_HTLCDestinationZDecodeErrorZ.constr_from_ptr(ret);
772                 return ret_hu_conv;
773         }
774
775         /**
776          * Read a Event from a byte array, created by Event_write
777          */
778         public static Result_COption_EventZDecodeErrorZ Event_read(byte[] ser) {
779                 long ret = bindings.Event_read(ser);
780                 Reference.reachabilityFence(ser);
781                 if (ret >= 0 && ret <= 4096) { return null; }
782                 Result_COption_EventZDecodeErrorZ ret_hu_conv = Result_COption_EventZDecodeErrorZ.constr_from_ptr(ret);
783                 return ret_hu_conv;
784         }
785
786         /**
787          * Builds the necessary parameters to pay or pre-flight probe the given zero-amount
788          * [`Bolt11Invoice`] using [`ChannelManager::send_payment`] or
789          * [`ChannelManager::send_preflight_probes`].
790          * 
791          * Prior to paying, you must ensure that the [`Bolt11Invoice::payment_hash`] is unique and the
792          * same [`PaymentHash`] has never been paid before.
793          * 
794          * Will always succeed unless the invoice has an amount specified, in which case
795          * [`payment_parameters_from_invoice`] should be used.
796          * 
797          * [`ChannelManager::send_payment`]: lightning::ln::channelmanager::ChannelManager::send_payment
798          * [`ChannelManager::send_preflight_probes`]: lightning::ln::channelmanager::ChannelManager::send_preflight_probes
799          */
800         public static Result_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ payment_parameters_from_zero_amount_invoice(org.ldk.structs.Bolt11Invoice invoice, long amount_msat) {
801                 long ret = bindings.payment_parameters_from_zero_amount_invoice(invoice == null ? 0 : invoice.ptr, amount_msat);
802                 Reference.reachabilityFence(invoice);
803                 Reference.reachabilityFence(amount_msat);
804                 if (ret >= 0 && ret <= 4096) { return null; }
805                 Result_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ ret_hu_conv = Result_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ.constr_from_ptr(ret);
806                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(invoice); };
807                 return ret_hu_conv;
808         }
809
810         /**
811          * Builds the necessary parameters to pay or pre-flight probe the given [`Bolt11Invoice`] using
812          * [`ChannelManager::send_payment`] or [`ChannelManager::send_preflight_probes`].
813          * 
814          * Prior to paying, you must ensure that the [`Bolt11Invoice::payment_hash`] is unique and the
815          * same [`PaymentHash`] has never been paid before.
816          * 
817          * Will always succeed unless the invoice has no amount specified, in which case
818          * [`payment_parameters_from_zero_amount_invoice`] should be used.
819          * 
820          * [`ChannelManager::send_payment`]: lightning::ln::channelmanager::ChannelManager::send_payment
821          * [`ChannelManager::send_preflight_probes`]: lightning::ln::channelmanager::ChannelManager::send_preflight_probes
822          */
823         public static Result_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ payment_parameters_from_invoice(org.ldk.structs.Bolt11Invoice invoice) {
824                 long ret = bindings.payment_parameters_from_invoice(invoice == null ? 0 : invoice.ptr);
825                 Reference.reachabilityFence(invoice);
826                 if (ret >= 0 && ret <= 4096) { return null; }
827                 Result_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ ret_hu_conv = Result_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ.constr_from_ptr(ret);
828                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(invoice); };
829                 return ret_hu_conv;
830         }
831
832         /**
833          * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
834          * See [`PhantomKeysManager`] for more information on phantom node payments.
835          * 
836          * `phantom_route_hints` parameter:
837          * Contains channel info for all nodes participating in the phantom invoice
838          * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
839          * participating node
840          * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
841          * updated when a channel becomes disabled or closes
842          * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
843          * may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
844          * down
845          * 
846          * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
847          * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
848          * If `None` is provided for `payment_hash`, then one will be created.
849          * 
850          * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
851          * in excess of the current time.
852          * 
853          * `duration_since_epoch` is the current time since epoch in seconds.
854          * 
855          * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to
856          * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`] - 3.
857          * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block
858          * confirmations during routing.
859          * 
860          * Note that the provided `keys_manager`'s `NodeSigner` implementation must support phantom
861          * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
862          * requirement).
863          * 
864          * [`PhantomKeysManager`]: lightning::sign::PhantomKeysManager
865          * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
866          * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
867          * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
868          * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
869          * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
870          * 
871          * This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
872          * available and the current time is supplied by the caller.
873          */
874         public static Result_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice(org.ldk.structs.Option_u64Z amt_msat, org.ldk.structs.Option_ThirtyTwoBytesZ payment_hash, java.lang.String description, int invoice_expiry_delta_secs, PhantomRouteHints[] phantom_route_hints, org.ldk.structs.EntropySource entropy_source, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta, long duration_since_epoch) {
875                 long ret = bindings.create_phantom_invoice(amt_msat.ptr, payment_hash.ptr, description, invoice_expiry_delta_secs, phantom_route_hints != null ? Arrays.stream(phantom_route_hints).mapToLong(phantom_route_hints_conv_19 -> phantom_route_hints_conv_19 == null ? 0 : phantom_route_hints_conv_19.ptr).toArray() : null, entropy_source.ptr, node_signer.ptr, logger.ptr, network, min_final_cltv_expiry_delta.ptr, duration_since_epoch);
876                 Reference.reachabilityFence(amt_msat);
877                 Reference.reachabilityFence(payment_hash);
878                 Reference.reachabilityFence(description);
879                 Reference.reachabilityFence(invoice_expiry_delta_secs);
880                 Reference.reachabilityFence(phantom_route_hints);
881                 Reference.reachabilityFence(entropy_source);
882                 Reference.reachabilityFence(node_signer);
883                 Reference.reachabilityFence(logger);
884                 Reference.reachabilityFence(network);
885                 Reference.reachabilityFence(min_final_cltv_expiry_delta);
886                 Reference.reachabilityFence(duration_since_epoch);
887                 if (ret >= 0 && ret <= 4096) { return null; }
888                 Result_Bolt11InvoiceSignOrCreationErrorZ ret_hu_conv = Result_Bolt11InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
889                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(amt_msat); };
890                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(payment_hash); };
891                 for (PhantomRouteHints phantom_route_hints_conv_19: phantom_route_hints) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(phantom_route_hints_conv_19); }; };
892                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(entropy_source); };
893                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); };
894                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
895                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_final_cltv_expiry_delta); };
896                 return ret_hu_conv;
897         }
898
899         /**
900          * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
901          * See [`PhantomKeysManager`] for more information on phantom node payments.
902          * 
903          * `phantom_route_hints` parameter:
904          * Contains channel info for all nodes participating in the phantom invoice
905          * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
906          * participating node
907          * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
908          * updated when a channel becomes disabled or closes
909          * Note that the route hints generated from `phantom_route_hints` will be limited to a maximum
910          * of 3 hints to ensure that the invoice can be scanned in a QR code. These hints are selected
911          * in the order that the nodes in `PhantomRouteHints` are specified, selecting one hint per node
912          * until the maximum is hit. Callers may provide as many `PhantomRouteHints::channels` as
913          * desired, but note that some nodes will be trimmed if more than 3 nodes are provided.
914          * 
915          * `description_hash` is a SHA-256 hash of the description text
916          * 
917          * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
918          * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
919          * If `None` is provided for `payment_hash`, then one will be created.
920          * 
921          * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
922          * in excess of the current time.
923          * 
924          * `duration_since_epoch` is the current time since epoch in seconds.
925          * 
926          * Note that the provided `keys_manager`'s `NodeSigner` implementation must support phantom
927          * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
928          * requirement).
929          * 
930          * [`PhantomKeysManager`]: lightning::sign::PhantomKeysManager
931          * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
932          * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
933          * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
934          * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
935          * 
936          * This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
937          * available and the current time is supplied by the caller.
938          */
939         public static Result_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(org.ldk.structs.Option_u64Z amt_msat, org.ldk.structs.Option_ThirtyTwoBytesZ payment_hash, int invoice_expiry_delta_secs, org.ldk.structs.Sha256 description_hash, PhantomRouteHints[] phantom_route_hints, org.ldk.structs.EntropySource entropy_source, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta, long duration_since_epoch) {
940                 long ret = bindings.create_phantom_invoice_with_description_hash(amt_msat.ptr, payment_hash.ptr, invoice_expiry_delta_secs, description_hash == null ? 0 : description_hash.ptr, phantom_route_hints != null ? Arrays.stream(phantom_route_hints).mapToLong(phantom_route_hints_conv_19 -> phantom_route_hints_conv_19 == null ? 0 : phantom_route_hints_conv_19.ptr).toArray() : null, entropy_source.ptr, node_signer.ptr, logger.ptr, network, min_final_cltv_expiry_delta.ptr, duration_since_epoch);
941                 Reference.reachabilityFence(amt_msat);
942                 Reference.reachabilityFence(payment_hash);
943                 Reference.reachabilityFence(invoice_expiry_delta_secs);
944                 Reference.reachabilityFence(description_hash);
945                 Reference.reachabilityFence(phantom_route_hints);
946                 Reference.reachabilityFence(entropy_source);
947                 Reference.reachabilityFence(node_signer);
948                 Reference.reachabilityFence(logger);
949                 Reference.reachabilityFence(network);
950                 Reference.reachabilityFence(min_final_cltv_expiry_delta);
951                 Reference.reachabilityFence(duration_since_epoch);
952                 if (ret >= 0 && ret <= 4096) { return null; }
953                 Result_Bolt11InvoiceSignOrCreationErrorZ ret_hu_conv = Result_Bolt11InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
954                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(amt_msat); };
955                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(payment_hash); };
956                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(description_hash); };
957                 for (PhantomRouteHints phantom_route_hints_conv_19: phantom_route_hints) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(phantom_route_hints_conv_19); }; };
958                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(entropy_source); };
959                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); };
960                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
961                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_final_cltv_expiry_delta); };
962                 return ret_hu_conv;
963         }
964
965         /**
966          * Utility to construct an invoice. Generally, unless you want to do something like a custom
967          * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
968          * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
969          * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
970          * that the payment secret is valid when the invoice is paid.
971          * 
972          * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
973          * in excess of the current time.
974          * 
975          * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to
976          * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`].
977          * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block
978          * confirmations during routing.
979          * 
980          * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
981          */
982         public static Result_Bolt11InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, java.lang.String description, int invoice_expiry_delta_secs, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) {
983                 long ret = bindings.create_invoice_from_channelmanager(channelmanager == null ? 0 : channelmanager.ptr, node_signer.ptr, logger.ptr, network, amt_msat.ptr, description, invoice_expiry_delta_secs, min_final_cltv_expiry_delta.ptr);
984                 Reference.reachabilityFence(channelmanager);
985                 Reference.reachabilityFence(node_signer);
986                 Reference.reachabilityFence(logger);
987                 Reference.reachabilityFence(network);
988                 Reference.reachabilityFence(amt_msat);
989                 Reference.reachabilityFence(description);
990                 Reference.reachabilityFence(invoice_expiry_delta_secs);
991                 Reference.reachabilityFence(min_final_cltv_expiry_delta);
992                 if (ret >= 0 && ret <= 4096) { return null; }
993                 Result_Bolt11InvoiceSignOrCreationErrorZ ret_hu_conv = Result_Bolt11InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
994                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); };
995                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); };
996                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
997                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(amt_msat); };
998                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_final_cltv_expiry_delta); };
999                 return ret_hu_conv;
1000         }
1001
1002         /**
1003          * Utility to construct an invoice. Generally, unless you want to do something like a custom
1004          * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
1005          * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
1006          * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
1007          * that the payment secret is valid when the invoice is paid.
1008          * Use this variant if you want to pass the `description_hash` to the invoice.
1009          * 
1010          * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
1011          * in excess of the current time.
1012          * 
1013          * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to
1014          * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`].
1015          * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block
1016          * confirmations during routing.
1017          * 
1018          * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
1019          */
1020         public static Result_Bolt11InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, org.ldk.structs.Sha256 description_hash, int invoice_expiry_delta_secs, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) {
1021                 long ret = bindings.create_invoice_from_channelmanager_with_description_hash(channelmanager == null ? 0 : channelmanager.ptr, node_signer.ptr, logger.ptr, network, amt_msat.ptr, description_hash == null ? 0 : description_hash.ptr, invoice_expiry_delta_secs, min_final_cltv_expiry_delta.ptr);
1022                 Reference.reachabilityFence(channelmanager);
1023                 Reference.reachabilityFence(node_signer);
1024                 Reference.reachabilityFence(logger);
1025                 Reference.reachabilityFence(network);
1026                 Reference.reachabilityFence(amt_msat);
1027                 Reference.reachabilityFence(description_hash);
1028                 Reference.reachabilityFence(invoice_expiry_delta_secs);
1029                 Reference.reachabilityFence(min_final_cltv_expiry_delta);
1030                 if (ret >= 0 && ret <= 4096) { return null; }
1031                 Result_Bolt11InvoiceSignOrCreationErrorZ ret_hu_conv = Result_Bolt11InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
1032                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); };
1033                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); };
1034                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
1035                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(amt_msat); };
1036                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(description_hash); };
1037                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_final_cltv_expiry_delta); };
1038                 return ret_hu_conv;
1039         }
1040
1041         /**
1042          * See [`create_invoice_from_channelmanager_with_description_hash`]
1043          * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
1044          * available and the current time is supplied by the caller.
1045          */
1046         public static Result_Bolt11InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, org.ldk.structs.Sha256 description_hash, long duration_since_epoch, int invoice_expiry_delta_secs, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) {
1047                 long ret = bindings.create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(channelmanager == null ? 0 : channelmanager.ptr, node_signer.ptr, logger.ptr, network, amt_msat.ptr, description_hash == null ? 0 : description_hash.ptr, duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta.ptr);
1048                 Reference.reachabilityFence(channelmanager);
1049                 Reference.reachabilityFence(node_signer);
1050                 Reference.reachabilityFence(logger);
1051                 Reference.reachabilityFence(network);
1052                 Reference.reachabilityFence(amt_msat);
1053                 Reference.reachabilityFence(description_hash);
1054                 Reference.reachabilityFence(duration_since_epoch);
1055                 Reference.reachabilityFence(invoice_expiry_delta_secs);
1056                 Reference.reachabilityFence(min_final_cltv_expiry_delta);
1057                 if (ret >= 0 && ret <= 4096) { return null; }
1058                 Result_Bolt11InvoiceSignOrCreationErrorZ ret_hu_conv = Result_Bolt11InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
1059                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); };
1060                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); };
1061                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
1062                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(amt_msat); };
1063                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(description_hash); };
1064                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_final_cltv_expiry_delta); };
1065                 return ret_hu_conv;
1066         }
1067
1068         /**
1069          * See [`create_invoice_from_channelmanager`]
1070          * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
1071          * available and the current time is supplied by the caller.
1072          */
1073         public static Result_Bolt11InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, java.lang.String description, long duration_since_epoch, int invoice_expiry_delta_secs, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) {
1074                 long ret = bindings.create_invoice_from_channelmanager_and_duration_since_epoch(channelmanager == null ? 0 : channelmanager.ptr, node_signer.ptr, logger.ptr, network, amt_msat.ptr, description, duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta.ptr);
1075                 Reference.reachabilityFence(channelmanager);
1076                 Reference.reachabilityFence(node_signer);
1077                 Reference.reachabilityFence(logger);
1078                 Reference.reachabilityFence(network);
1079                 Reference.reachabilityFence(amt_msat);
1080                 Reference.reachabilityFence(description);
1081                 Reference.reachabilityFence(duration_since_epoch);
1082                 Reference.reachabilityFence(invoice_expiry_delta_secs);
1083                 Reference.reachabilityFence(min_final_cltv_expiry_delta);
1084                 if (ret >= 0 && ret <= 4096) { return null; }
1085                 Result_Bolt11InvoiceSignOrCreationErrorZ ret_hu_conv = Result_Bolt11InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
1086                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); };
1087                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); };
1088                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
1089                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(amt_msat); };
1090                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_final_cltv_expiry_delta); };
1091                 return ret_hu_conv;
1092         }
1093
1094         /**
1095          * See [`create_invoice_from_channelmanager_and_duration_since_epoch`]
1096          * This version allows for providing a custom [`PaymentHash`] for the invoice.
1097          * This may be useful if you're building an on-chain swap or involving another protocol where
1098          * the payment hash is also involved outside the scope of lightning.
1099          */
1100         public static Result_Bolt11InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, java.lang.String description, long duration_since_epoch, int invoice_expiry_delta_secs, byte[] payment_hash, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) {
1101                 long ret = bindings.create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(channelmanager == null ? 0 : channelmanager.ptr, node_signer.ptr, logger.ptr, network, amt_msat.ptr, description, duration_since_epoch, invoice_expiry_delta_secs, InternalUtils.check_arr_len(payment_hash, 32), min_final_cltv_expiry_delta.ptr);
1102                 Reference.reachabilityFence(channelmanager);
1103                 Reference.reachabilityFence(node_signer);
1104                 Reference.reachabilityFence(logger);
1105                 Reference.reachabilityFence(network);
1106                 Reference.reachabilityFence(amt_msat);
1107                 Reference.reachabilityFence(description);
1108                 Reference.reachabilityFence(duration_since_epoch);
1109                 Reference.reachabilityFence(invoice_expiry_delta_secs);
1110                 Reference.reachabilityFence(payment_hash);
1111                 Reference.reachabilityFence(min_final_cltv_expiry_delta);
1112                 if (ret >= 0 && ret <= 4096) { return null; }
1113                 Result_Bolt11InvoiceSignOrCreationErrorZ ret_hu_conv = Result_Bolt11InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
1114                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); };
1115                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); };
1116                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
1117                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(amt_msat); };
1118                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_final_cltv_expiry_delta); };
1119                 return ret_hu_conv;
1120         }
1121
1122 }