[Java] Update auto-generated Java bindings for 0.0.113
[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 ClosureReason from a byte array, created by ClosureReason_write
47          */
48         public static Result_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(byte[] ser) {
49                 long ret = bindings.ClosureReason_read(ser);
50                 Reference.reachabilityFence(ser);
51                 if (ret >= 0 && ret <= 4096) { return null; }
52                 Result_COption_ClosureReasonZDecodeErrorZ ret_hu_conv = Result_COption_ClosureReasonZDecodeErrorZ.constr_from_ptr(ret);
53                 return ret_hu_conv;
54         }
55
56         /**
57          * Read a HTLCDestination from a byte array, created by HTLCDestination_write
58          */
59         public static Result_COption_HTLCDestinationZDecodeErrorZ HTLCDestination_read(byte[] ser) {
60                 long ret = bindings.HTLCDestination_read(ser);
61                 Reference.reachabilityFence(ser);
62                 if (ret >= 0 && ret <= 4096) { return null; }
63                 Result_COption_HTLCDestinationZDecodeErrorZ ret_hu_conv = Result_COption_HTLCDestinationZDecodeErrorZ.constr_from_ptr(ret);
64                 return ret_hu_conv;
65         }
66
67         /**
68          * Read a Event from a byte array, created by Event_write
69          */
70         public static Result_COption_EventZDecodeErrorZ Event_read(byte[] ser) {
71                 long ret = bindings.Event_read(ser);
72                 Reference.reachabilityFence(ser);
73                 if (ret >= 0 && ret <= 4096) { return null; }
74                 Result_COption_EventZDecodeErrorZ ret_hu_conv = Result_COption_EventZDecodeErrorZ.constr_from_ptr(ret);
75                 return ret_hu_conv;
76         }
77
78         /**
79          * Creates a digital signature of a message given a SecretKey, like the node's secret.
80          * 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.
81          * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
82          */
83         public static Result_StringErrorZ sign(byte[] msg, byte[] sk) {
84                 long ret = bindings.sign(msg, InternalUtils.check_arr_len(sk, 32));
85                 Reference.reachabilityFence(msg);
86                 Reference.reachabilityFence(sk);
87                 if (ret >= 0 && ret <= 4096) { return null; }
88                 Result_StringErrorZ ret_hu_conv = Result_StringErrorZ.constr_from_ptr(ret);
89                 return ret_hu_conv;
90         }
91
92         /**
93          * Recovers the PublicKey of the signer of the message given the message and the signature.
94          */
95         public static Result_PublicKeyErrorZ recover_pk(byte[] msg, java.lang.String sig) {
96                 long ret = bindings.recover_pk(msg, sig);
97                 Reference.reachabilityFence(msg);
98                 Reference.reachabilityFence(sig);
99                 if (ret >= 0 && ret <= 4096) { return null; }
100                 Result_PublicKeyErrorZ ret_hu_conv = Result_PublicKeyErrorZ.constr_from_ptr(ret);
101                 return ret_hu_conv;
102         }
103
104         /**
105          * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
106          * and the PublicKey.
107          */
108         public static boolean verify(byte[] msg, java.lang.String sig, byte[] pk) {
109                 boolean ret = bindings.verify(msg, sig, InternalUtils.check_arr_len(pk, 33));
110                 Reference.reachabilityFence(msg);
111                 Reference.reachabilityFence(sig);
112                 Reference.reachabilityFence(pk);
113                 return ret;
114         }
115
116         /**
117          * Construct the invoice's HRP and signatureless data into a preimage to be hashed.
118          */
119         public static byte[] construct_invoice_preimage(byte[] hrp_bytes, UInt5[] data_without_signature) {
120                 byte[] ret = bindings.construct_invoice_preimage(hrp_bytes, data_without_signature != null ? InternalUtils.convUInt5Array(data_without_signature) : null);
121                 Reference.reachabilityFence(hrp_bytes);
122                 Reference.reachabilityFence(data_without_signature);
123                 return ret;
124         }
125
126         /**
127          * Read a MonitorEvent from a byte array, created by MonitorEvent_write
128          */
129         public static Result_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(byte[] ser) {
130                 long ret = bindings.MonitorEvent_read(ser);
131                 Reference.reachabilityFence(ser);
132                 if (ret >= 0 && ret <= 4096) { return null; }
133                 Result_COption_MonitorEventZDecodeErrorZ ret_hu_conv = Result_COption_MonitorEventZDecodeErrorZ.constr_from_ptr(ret);
134                 return ret_hu_conv;
135         }
136
137         /**
138          * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
139          */
140         public static Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(byte[] ser, org.ldk.structs.KeysInterface arg) {
141                 long ret = bindings.C2Tuple_BlockHashChannelMonitorZ_read(ser, arg == null ? 0 : arg.ptr);
142                 Reference.reachabilityFence(ser);
143                 Reference.reachabilityFence(arg);
144                 if (ret >= 0 && ret <= 4096) { return null; }
145                 Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ ret_hu_conv = Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.constr_from_ptr(ret);
146                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg); };
147                 return ret_hu_conv;
148         }
149
150         /**
151          * Fetches the set of [`NodeFeatures`] flags which are provided by or required by
152          * [`ChannelManager`].
153          */
154         public static NodeFeatures provided_node_features() {
155                 long ret = bindings.provided_node_features();
156                 if (ret >= 0 && ret <= 4096) { return null; }
157                 org.ldk.structs.NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.NodeFeatures(null, ret); }
158                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
159                 return ret_hu_conv;
160         }
161
162         /**
163          * Fetches the set of [`ChannelFeatures`] flags which are provided by or required by
164          * [`ChannelManager`].
165          */
166         public static ChannelFeatures provided_channel_features() {
167                 long ret = bindings.provided_channel_features();
168                 if (ret >= 0 && ret <= 4096) { return null; }
169                 org.ldk.structs.ChannelFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelFeatures(null, ret); }
170                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
171                 return ret_hu_conv;
172         }
173
174         /**
175          * Fetches the set of [`InitFeatures`] flags which are provided by or required by
176          * [`ChannelManager`].
177          */
178         public static InitFeatures provided_init_features() {
179                 long ret = bindings.provided_init_features();
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                 return ret_hu_conv;
184         }
185
186         /**
187          * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
188          */
189         public static Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(byte[] ser, KeysInterface arg_keys_manager, FeeEstimator arg_fee_estimator, Watch arg_chain_monitor, BroadcasterInterface arg_tx_broadcaster, Logger arg_logger, UserConfig arg_default_config, ChannelMonitor[] arg_channel_monitors) {
190                 long ret = bindings.C2Tuple_BlockHashChannelManagerZ_read(ser, bindings.ChannelManagerReadArgs_new(arg_keys_manager == null ? 0 : arg_keys_manager.ptr, arg_fee_estimator == null ? 0 : arg_fee_estimator.ptr, arg_chain_monitor == null ? 0 : arg_chain_monitor.ptr, arg_tx_broadcaster == null ? 0 : arg_tx_broadcaster.ptr, arg_logger == null ? 0 : 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));
191                 Reference.reachabilityFence(ser);
192                 Reference.reachabilityFence(arg_keys_manager);
193                 Reference.reachabilityFence(arg_fee_estimator);
194                 Reference.reachabilityFence(arg_chain_monitor);
195                 Reference.reachabilityFence(arg_tx_broadcaster);
196                 Reference.reachabilityFence(arg_logger);
197                 Reference.reachabilityFence(arg_default_config);
198                 Reference.reachabilityFence(arg_channel_monitors);
199                 if (ret >= 0 && ret <= 4096) { return null; }
200                 Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ ret_hu_conv = Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.constr_from_ptr(ret);
201                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_keys_manager); };
202                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_fee_estimator); };
203                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_chain_monitor); };
204                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_tx_broadcaster); };
205                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_logger); };
206                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_default_config); };
207                 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); }; };
208                 return ret_hu_conv;
209         }
210
211         /**
212          * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment`], but no
213          * `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without
214          * a `ChannelManager`.
215          * 
216          * `keys` is generated by calling [`KeysInterface::get_inbound_payment_key_material`] and then
217          * calling [`ExpandedKey::new`] with its result. It is recommended to cache this value and not
218          * regenerate it for each new inbound payment.
219          * 
220          * `current_time` is a Unix timestamp representing the current time.
221          * 
222          * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
223          */
224         public static Result_C2Tuple_PaymentHashPaymentSecretZNoneZ create(org.ldk.structs.ExpandedKey keys, org.ldk.structs.Option_u64Z min_value_msat, int invoice_expiry_delta_secs, org.ldk.structs.KeysInterface keys_manager, long current_time) {
225                 long ret = bindings.create(keys == null ? 0 : keys.ptr, min_value_msat.ptr, invoice_expiry_delta_secs, keys_manager == null ? 0 : keys_manager.ptr, current_time);
226                 Reference.reachabilityFence(keys);
227                 Reference.reachabilityFence(min_value_msat);
228                 Reference.reachabilityFence(invoice_expiry_delta_secs);
229                 Reference.reachabilityFence(keys_manager);
230                 Reference.reachabilityFence(current_time);
231                 if (ret >= 0 && ret <= 4096) { return null; }
232                 Result_C2Tuple_PaymentHashPaymentSecretZNoneZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.constr_from_ptr(ret);
233                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys); };
234                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); };
235                 return ret_hu_conv;
236         }
237
238         /**
239          * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash`],
240          * but no `ChannelManager` is required. Useful for generating invoices for [phantom node payments]
241          * without a `ChannelManager`.
242          * 
243          * See [`create`] for information on the `keys` and `current_time` parameters.
244          * 
245          * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
246          */
247         public static Result_PaymentSecretNoneZ 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) {
248                 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);
249                 Reference.reachabilityFence(keys);
250                 Reference.reachabilityFence(min_value_msat);
251                 Reference.reachabilityFence(payment_hash);
252                 Reference.reachabilityFence(invoice_expiry_delta_secs);
253                 Reference.reachabilityFence(current_time);
254                 if (ret >= 0 && ret <= 4096) { return null; }
255                 Result_PaymentSecretNoneZ ret_hu_conv = Result_PaymentSecretNoneZ.constr_from_ptr(ret);
256                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys); };
257                 return ret_hu_conv;
258         }
259
260         /**
261          * Gets the weight for an HTLC-Success transaction.
262          */
263         public static long htlc_success_tx_weight(boolean opt_anchors) {
264                 long ret = bindings.htlc_success_tx_weight(opt_anchors);
265                 Reference.reachabilityFence(opt_anchors);
266                 return ret;
267         }
268
269         /**
270          * Gets the weight for an HTLC-Timeout transaction.
271          */
272         public static long htlc_timeout_tx_weight(boolean opt_anchors) {
273                 long ret = bindings.htlc_timeout_tx_weight(opt_anchors);
274                 Reference.reachabilityFence(opt_anchors);
275                 return ret;
276         }
277
278         /**
279          * Check if a given input witness attempts to claim a HTLC.
280          */
281         public static Option_HTLCClaimZ HTLCClaim_from_witness(byte[] witness) {
282                 long ret = bindings.HTLCClaim_from_witness(witness);
283                 Reference.reachabilityFence(witness);
284                 if (ret >= 0 && ret <= 4096) { return null; }
285                 org.ldk.structs.Option_HTLCClaimZ ret_hu_conv = org.ldk.structs.Option_HTLCClaimZ.constr_from_ptr(ret);
286                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
287                 return ret_hu_conv;
288         }
289
290         /**
291          * Build the commitment secret from the seed and the commitment number
292          */
293         public static byte[] build_commitment_secret(byte[] commitment_seed, long idx) {
294                 byte[] ret = bindings.build_commitment_secret(InternalUtils.check_arr_len(commitment_seed, 32), idx);
295                 Reference.reachabilityFence(commitment_seed);
296                 Reference.reachabilityFence(idx);
297                 return ret;
298         }
299
300         /**
301          * Build a closing transaction
302          */
303         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) {
304                 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);
305                 Reference.reachabilityFence(to_holder_value_sat);
306                 Reference.reachabilityFence(to_counterparty_value_sat);
307                 Reference.reachabilityFence(to_holder_script);
308                 Reference.reachabilityFence(to_counterparty_script);
309                 Reference.reachabilityFence(funding_outpoint);
310                 return ret;
311         }
312
313         /**
314          * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
315          * from the base secret and the per_commitment_point.
316          */
317         public static byte[] derive_private_key(byte[] per_commitment_point, byte[] base_secret) {
318                 byte[] ret = bindings.derive_private_key(InternalUtils.check_arr_len(per_commitment_point, 33), InternalUtils.check_arr_len(base_secret, 32));
319                 Reference.reachabilityFence(per_commitment_point);
320                 Reference.reachabilityFence(base_secret);
321                 return ret;
322         }
323
324         /**
325          * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
326          * from the base point and the per_commitment_key. This is the public equivalent of
327          * derive_private_key - using only public keys to derive a public key instead of private keys.
328          */
329         public static byte[] derive_public_key(byte[] per_commitment_point, byte[] base_point) {
330                 byte[] ret = bindings.derive_public_key(InternalUtils.check_arr_len(per_commitment_point, 33), InternalUtils.check_arr_len(base_point, 33));
331                 Reference.reachabilityFence(per_commitment_point);
332                 Reference.reachabilityFence(base_point);
333                 return ret;
334         }
335
336         /**
337          * Derives a per-commitment-transaction revocation key from its constituent parts.
338          * 
339          * Only the cheating participant owns a valid witness to propagate a revoked
340          * commitment transaction, thus per_commitment_secret always come from cheater
341          * and revocation_base_secret always come from punisher, which is the broadcaster
342          * of the transaction spending with this key knowledge.
343          */
344         public static byte[] derive_private_revocation_key(byte[] per_commitment_secret, byte[] countersignatory_revocation_base_secret) {
345                 byte[] ret = bindings.derive_private_revocation_key(InternalUtils.check_arr_len(per_commitment_secret, 32), InternalUtils.check_arr_len(countersignatory_revocation_base_secret, 32));
346                 Reference.reachabilityFence(per_commitment_secret);
347                 Reference.reachabilityFence(countersignatory_revocation_base_secret);
348                 return ret;
349         }
350
351         /**
352          * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
353          * the public equivalend of derive_private_revocation_key - using only public keys to derive a
354          * public key instead of private keys.
355          * 
356          * Only the cheating participant owns a valid witness to propagate a revoked
357          * commitment transaction, thus per_commitment_point always come from cheater
358          * and revocation_base_point always come from punisher, which is the broadcaster
359          * of the transaction spending with this key knowledge.
360          * 
361          * Note that this is infallible iff we trust that at least one of the two input keys are randomly
362          * generated (ie our own).
363          */
364         public static byte[] derive_public_revocation_key(byte[] per_commitment_point, byte[] countersignatory_revocation_base_point) {
365                 byte[] ret = bindings.derive_public_revocation_key(InternalUtils.check_arr_len(per_commitment_point, 33), InternalUtils.check_arr_len(countersignatory_revocation_base_point, 33));
366                 Reference.reachabilityFence(per_commitment_point);
367                 Reference.reachabilityFence(countersignatory_revocation_base_point);
368                 return ret;
369         }
370
371         /**
372          * A script either spendable by the revocation
373          * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
374          * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
375          */
376         public static byte[] get_revokeable_redeemscript(byte[] revocation_key, short contest_delay, byte[] broadcaster_delayed_payment_key) {
377                 byte[] ret = bindings.get_revokeable_redeemscript(InternalUtils.check_arr_len(revocation_key, 33), contest_delay, InternalUtils.check_arr_len(broadcaster_delayed_payment_key, 33));
378                 Reference.reachabilityFence(revocation_key);
379                 Reference.reachabilityFence(contest_delay);
380                 Reference.reachabilityFence(broadcaster_delayed_payment_key);
381                 return ret;
382         }
383
384         /**
385          * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
386          * does not need to have its previous_output_index filled.
387          */
388         public static byte[] get_htlc_redeemscript(org.ldk.structs.HTLCOutputInCommitment htlc, boolean opt_anchors, org.ldk.structs.TxCreationKeys keys) {
389                 byte[] ret = bindings.get_htlc_redeemscript(htlc == null ? 0 : htlc.ptr, opt_anchors, keys == null ? 0 : keys.ptr);
390                 Reference.reachabilityFence(htlc);
391                 Reference.reachabilityFence(opt_anchors);
392                 Reference.reachabilityFence(keys);
393                 return ret;
394         }
395
396         /**
397          * Gets the redeemscript for a funding output from the two funding public keys.
398          * Note that the order of funding public keys does not matter.
399          */
400         public static byte[] make_funding_redeemscript(byte[] broadcaster, byte[] countersignatory) {
401                 byte[] ret = bindings.make_funding_redeemscript(InternalUtils.check_arr_len(broadcaster, 33), InternalUtils.check_arr_len(countersignatory, 33));
402                 Reference.reachabilityFence(broadcaster);
403                 Reference.reachabilityFence(countersignatory);
404                 return ret;
405         }
406
407         /**
408          * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC
409          * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the
410          * transaction which needs signing, and can be used to construct an HTLC transaction which is
411          * broadcastable given a counterparty HTLC signature.
412          * 
413          * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
414          * commitment transaction).
415          */
416         public static byte[] build_htlc_transaction(byte[] commitment_txid, int feerate_per_kw, short contest_delay, org.ldk.structs.HTLCOutputInCommitment htlc, boolean opt_anchors, boolean use_non_zero_fee_anchors, byte[] broadcaster_delayed_payment_key, byte[] revocation_key) {
417                 byte[] ret = bindings.build_htlc_transaction(InternalUtils.check_arr_len(commitment_txid, 32), feerate_per_kw, contest_delay, htlc == null ? 0 : htlc.ptr, opt_anchors, use_non_zero_fee_anchors, InternalUtils.check_arr_len(broadcaster_delayed_payment_key, 33), InternalUtils.check_arr_len(revocation_key, 33));
418                 Reference.reachabilityFence(commitment_txid);
419                 Reference.reachabilityFence(feerate_per_kw);
420                 Reference.reachabilityFence(contest_delay);
421                 Reference.reachabilityFence(htlc);
422                 Reference.reachabilityFence(opt_anchors);
423                 Reference.reachabilityFence(use_non_zero_fee_anchors);
424                 Reference.reachabilityFence(broadcaster_delayed_payment_key);
425                 Reference.reachabilityFence(revocation_key);
426                 return ret;
427         }
428
429         /**
430          * Returns the witness required to satisfy and spend a HTLC input.
431          * 
432          * Note that preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
433          */
434         public static byte[] build_htlc_input_witness(byte[] local_sig, byte[] remote_sig, @Nullable byte[] preimage, byte[] redeem_script, boolean opt_anchors) {
435                 byte[] ret = bindings.build_htlc_input_witness(InternalUtils.check_arr_len(local_sig, 64), InternalUtils.check_arr_len(remote_sig, 64), InternalUtils.check_arr_len(preimage, 32), redeem_script, opt_anchors);
436                 Reference.reachabilityFence(local_sig);
437                 Reference.reachabilityFence(remote_sig);
438                 Reference.reachabilityFence(preimage);
439                 Reference.reachabilityFence(redeem_script);
440                 Reference.reachabilityFence(opt_anchors);
441                 return ret;
442         }
443
444         /**
445          * Gets the witnessScript for the to_remote output when anchors are enabled.
446          */
447         public static byte[] get_to_countersignatory_with_anchors_redeemscript(byte[] payment_point) {
448                 byte[] ret = bindings.get_to_countersignatory_with_anchors_redeemscript(InternalUtils.check_arr_len(payment_point, 33));
449                 Reference.reachabilityFence(payment_point);
450                 return ret;
451         }
452
453         /**
454          * Gets the witnessScript for an anchor output from the funding public key.
455          * The witness in the spending input must be:
456          * <BIP 143 funding_signature>
457          * After 16 blocks of confirmation, an alternative satisfying witness could be:
458          * <>
459          * (empty vector required to satisfy compliance with MINIMALIF-standard rule)
460          */
461         public static byte[] get_anchor_redeemscript(byte[] funding_pubkey) {
462                 byte[] ret = bindings.get_anchor_redeemscript(InternalUtils.check_arr_len(funding_pubkey, 33));
463                 Reference.reachabilityFence(funding_pubkey);
464                 return ret;
465         }
466
467         /**
468          * Returns the witness required to satisfy and spend an anchor input.
469          */
470         public static byte[] build_anchor_input_witness(byte[] funding_key, byte[] funding_sig) {
471                 byte[] ret = bindings.build_anchor_input_witness(InternalUtils.check_arr_len(funding_key, 33), InternalUtils.check_arr_len(funding_sig, 64));
472                 Reference.reachabilityFence(funding_key);
473                 Reference.reachabilityFence(funding_sig);
474                 return ret;
475         }
476
477         /**
478          * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
479          * shared secret first. This prevents on-chain observers from discovering how many commitment
480          * transactions occurred in a channel before it was closed.
481          * 
482          * This function gets the shared secret from relevant channel public keys and can be used to
483          * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
484          */
485         public static long get_commitment_transaction_number_obscure_factor(byte[] broadcaster_payment_basepoint, byte[] countersignatory_payment_basepoint, boolean outbound_from_broadcaster) {
486                 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);
487                 Reference.reachabilityFence(broadcaster_payment_basepoint);
488                 Reference.reachabilityFence(countersignatory_payment_basepoint);
489                 Reference.reachabilityFence(outbound_from_broadcaster);
490                 return ret;
491         }
492
493         /**
494          * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write
495          */
496         public static Result_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(byte[] ser) {
497                 long ret = bindings.NetworkUpdate_read(ser);
498                 Reference.reachabilityFence(ser);
499                 if (ret >= 0 && ret <= 4096) { return null; }
500                 Result_COption_NetworkUpdateZDecodeErrorZ ret_hu_conv = Result_COption_NetworkUpdateZDecodeErrorZ.constr_from_ptr(ret);
501                 return ret_hu_conv;
502         }
503
504         /**
505          * Finds a route from us (payer) to the given target node (payee).
506          * 
507          * If the payee provided features in their invoice, they should be provided via `params.payee`.
508          * Without this, MPP will only be used if the payee's features are available in the network graph.
509          * 
510          * Private routing paths between a public node and the target may be included in `params.payee`.
511          * 
512          * If some channels aren't announced, it may be useful to fill in `first_hops` with the results
513          * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of these channels
514          * from `network_graph` will be ignored, and only those in `first_hops` will be used.
515          * 
516          * The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
517          * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
518          * `htlc_maximum_msat` *are* checked as they may change based on the receiving node.
519          * 
520          * # Note
521          * 
522          * May be used to re-compute a [`Route`] when handling a [`Event::PaymentPathFailed`]. Any
523          * adjustments to the [`NetworkGraph`] and channel scores should be made prior to calling this
524          * function.
525          * 
526          * # Panics
527          * 
528          * Panics if first_hops contains channels without short_channel_ids;
529          * [`ChannelManager::list_usable_channels`] will never include such channels.
530          * 
531          * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
532          * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
533          * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
534          * 
535          * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
536          */
537         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.Score scorer, byte[] random_seed_bytes) {
538                 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 == null ? 0 : logger.ptr, scorer == null ? 0 : scorer.ptr, InternalUtils.check_arr_len(random_seed_bytes, 32));
539                 Reference.reachabilityFence(our_node_pubkey);
540                 Reference.reachabilityFence(route_params);
541                 Reference.reachabilityFence(network_graph);
542                 Reference.reachabilityFence(first_hops);
543                 Reference.reachabilityFence(logger);
544                 Reference.reachabilityFence(scorer);
545                 Reference.reachabilityFence(random_seed_bytes);
546                 if (ret >= 0 && ret <= 4096) { return null; }
547                 Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret);
548                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(route_params); };
549                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(network_graph); };
550                 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); }; } };
551                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
552                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(scorer); };
553                 return ret_hu_conv;
554         }
555
556         /**
557          * Construct a route from us (payer) to the target node (payee) via the given hops (which should
558          * exclude the payer, but include the payee). This may be useful, e.g., for probing the chosen path.
559          * 
560          * Re-uses logic from `find_route`, so the restrictions described there also apply here.
561          */
562         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) {
563                 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 == null ? 0 : logger.ptr, InternalUtils.check_arr_len(random_seed_bytes, 32));
564                 Reference.reachabilityFence(our_node_pubkey);
565                 Reference.reachabilityFence(hops);
566                 Reference.reachabilityFence(route_params);
567                 Reference.reachabilityFence(network_graph);
568                 Reference.reachabilityFence(logger);
569                 Reference.reachabilityFence(random_seed_bytes);
570                 if (ret >= 0 && ret <= 4096) { return null; }
571                 Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret);
572                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(route_params); };
573                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(network_graph); };
574                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
575                 return ret_hu_conv;
576         }
577
578         /**
579          * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
580          * See [`PhantomKeysManager`] for more information on phantom node payments.
581          * 
582          * `phantom_route_hints` parameter:
583          * Contains channel info for all nodes participating in the phantom invoice
584          * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
585          * participating node
586          * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
587          * updated when a channel becomes disabled or closes
588          * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
589          * may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
590          * down
591          * 
592          * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
593          * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
594          * If `None` is provided for `payment_hash`, then one will be created.
595          * 
596          * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
597          * in excess of the current time.
598          * 
599          * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
600          * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
601          * requirement).
602          * 
603          * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
604          * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
605          * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
606          * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
607          * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
608          * 
609          * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
610          */
611         public static Result_InvoiceSignOrCreationErrorZ create_phantom_invoice(org.ldk.structs.Option_u64Z amt_msat, @Nullable byte[] payment_hash, java.lang.String description, int invoice_expiry_delta_secs, PhantomRouteHints[] phantom_route_hints, org.ldk.structs.KeysInterface keys_manager, org.ldk.structs.Logger logger, org.ldk.enums.Currency network) {
612                 long ret = bindings.create_phantom_invoice(amt_msat.ptr, InternalUtils.check_arr_len(payment_hash, 32), 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, keys_manager == null ? 0 : keys_manager.ptr, logger == null ? 0 : logger.ptr, network);
613                 Reference.reachabilityFence(amt_msat);
614                 Reference.reachabilityFence(payment_hash);
615                 Reference.reachabilityFence(description);
616                 Reference.reachabilityFence(invoice_expiry_delta_secs);
617                 Reference.reachabilityFence(phantom_route_hints);
618                 Reference.reachabilityFence(keys_manager);
619                 Reference.reachabilityFence(logger);
620                 Reference.reachabilityFence(network);
621                 if (ret >= 0 && ret <= 4096) { return null; }
622                 Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
623                 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); }; };
624                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); };
625                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
626                 return ret_hu_conv;
627         }
628
629         /**
630          * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
631          * See [`PhantomKeysManager`] for more information on phantom node payments.
632          * 
633          * `phantom_route_hints` parameter:
634          * Contains channel info for all nodes participating in the phantom invoice
635          * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
636          * participating node
637          * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
638          * updated when a channel becomes disabled or closes
639          * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
640          * may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
641          * down
642          * 
643          * `description_hash` is a SHA-256 hash of the description text
644          * 
645          * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
646          * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
647          * If `None` is provided for `payment_hash`, then one will be created.
648          * 
649          * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
650          * in excess of the current time.
651          * 
652          * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
653          * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
654          * requirement).
655          * 
656          * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
657          * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
658          * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
659          * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
660          * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
661          * 
662          * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
663          */
664         public static Result_InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(org.ldk.structs.Option_u64Z amt_msat, @Nullable byte[] payment_hash, int invoice_expiry_delta_secs, org.ldk.structs.Sha256 description_hash, PhantomRouteHints[] phantom_route_hints, org.ldk.structs.KeysInterface keys_manager, org.ldk.structs.Logger logger, org.ldk.enums.Currency network) {
665                 long ret = bindings.create_phantom_invoice_with_description_hash(amt_msat.ptr, InternalUtils.check_arr_len(payment_hash, 32), 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, keys_manager == null ? 0 : keys_manager.ptr, logger == null ? 0 : logger.ptr, network);
666                 Reference.reachabilityFence(amt_msat);
667                 Reference.reachabilityFence(payment_hash);
668                 Reference.reachabilityFence(invoice_expiry_delta_secs);
669                 Reference.reachabilityFence(description_hash);
670                 Reference.reachabilityFence(phantom_route_hints);
671                 Reference.reachabilityFence(keys_manager);
672                 Reference.reachabilityFence(logger);
673                 Reference.reachabilityFence(network);
674                 if (ret >= 0 && ret <= 4096) { return null; }
675                 Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
676                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(description_hash); };
677                 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); }; };
678                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); };
679                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
680                 return ret_hu_conv;
681         }
682
683         /**
684          * Utility to construct an invoice. Generally, unless you want to do something like a custom
685          * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
686          * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
687          * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
688          * that the payment secret is valid when the invoice is paid.
689          * 
690          * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
691          * in excess of the current time.
692          */
693         public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.KeysInterface keys_manager, 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) {
694                 long ret = bindings.create_invoice_from_channelmanager(channelmanager == null ? 0 : channelmanager.ptr, keys_manager == null ? 0 : keys_manager.ptr, logger == null ? 0 : logger.ptr, network, amt_msat.ptr, description, invoice_expiry_delta_secs);
695                 Reference.reachabilityFence(channelmanager);
696                 Reference.reachabilityFence(keys_manager);
697                 Reference.reachabilityFence(logger);
698                 Reference.reachabilityFence(network);
699                 Reference.reachabilityFence(amt_msat);
700                 Reference.reachabilityFence(description);
701                 Reference.reachabilityFence(invoice_expiry_delta_secs);
702                 if (ret >= 0 && ret <= 4096) { return null; }
703                 Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
704                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); };
705                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); };
706                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
707                 return ret_hu_conv;
708         }
709
710         /**
711          * Utility to construct an invoice. Generally, unless you want to do something like a custom
712          * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
713          * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
714          * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
715          * that the payment secret is valid when the invoice is paid.
716          * Use this variant if you want to pass the `description_hash` to the invoice.
717          * 
718          * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
719          * in excess of the current time.
720          */
721         public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.KeysInterface keys_manager, 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) {
722                 long ret = bindings.create_invoice_from_channelmanager_with_description_hash(channelmanager == null ? 0 : channelmanager.ptr, keys_manager == null ? 0 : keys_manager.ptr, logger == null ? 0 : logger.ptr, network, amt_msat.ptr, description_hash == null ? 0 : description_hash.ptr, invoice_expiry_delta_secs);
723                 Reference.reachabilityFence(channelmanager);
724                 Reference.reachabilityFence(keys_manager);
725                 Reference.reachabilityFence(logger);
726                 Reference.reachabilityFence(network);
727                 Reference.reachabilityFence(amt_msat);
728                 Reference.reachabilityFence(description_hash);
729                 Reference.reachabilityFence(invoice_expiry_delta_secs);
730                 if (ret >= 0 && ret <= 4096) { return null; }
731                 Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
732                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); };
733                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); };
734                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
735                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(description_hash); };
736                 return ret_hu_conv;
737         }
738
739         /**
740          * See [`create_invoice_from_channelmanager_with_description_hash`]
741          * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
742          * available and the current time is supplied by the caller.
743          */
744         public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.KeysInterface keys_manager, 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) {
745                 long ret = bindings.create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(channelmanager == null ? 0 : channelmanager.ptr, keys_manager == null ? 0 : keys_manager.ptr, logger == null ? 0 : logger.ptr, network, amt_msat.ptr, description_hash == null ? 0 : description_hash.ptr, duration_since_epoch, invoice_expiry_delta_secs);
746                 Reference.reachabilityFence(channelmanager);
747                 Reference.reachabilityFence(keys_manager);
748                 Reference.reachabilityFence(logger);
749                 Reference.reachabilityFence(network);
750                 Reference.reachabilityFence(amt_msat);
751                 Reference.reachabilityFence(description_hash);
752                 Reference.reachabilityFence(duration_since_epoch);
753                 Reference.reachabilityFence(invoice_expiry_delta_secs);
754                 if (ret >= 0 && ret <= 4096) { return null; }
755                 Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
756                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); };
757                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); };
758                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
759                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(description_hash); };
760                 return ret_hu_conv;
761         }
762
763         /**
764          * See [`create_invoice_from_channelmanager`]
765          * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
766          * available and the current time is supplied by the caller.
767          */
768         public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.KeysInterface keys_manager, 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) {
769                 long ret = bindings.create_invoice_from_channelmanager_and_duration_since_epoch(channelmanager == null ? 0 : channelmanager.ptr, keys_manager == null ? 0 : keys_manager.ptr, logger == null ? 0 : logger.ptr, network, amt_msat.ptr, description, duration_since_epoch, invoice_expiry_delta_secs);
770                 Reference.reachabilityFence(channelmanager);
771                 Reference.reachabilityFence(keys_manager);
772                 Reference.reachabilityFence(logger);
773                 Reference.reachabilityFence(network);
774                 Reference.reachabilityFence(amt_msat);
775                 Reference.reachabilityFence(description);
776                 Reference.reachabilityFence(duration_since_epoch);
777                 Reference.reachabilityFence(invoice_expiry_delta_secs);
778                 if (ret >= 0 && ret <= 4096) { return null; }
779                 Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
780                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); };
781                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); };
782                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
783                 return ret_hu_conv;
784         }
785
786         /**
787          * See [`create_invoice_from_channelmanager_and_duration_since_epoch`]
788          * This version allows for providing a custom [`PaymentHash`] for the invoice.
789          * This may be useful if you're building an on-chain swap or involving another protocol where
790          * the payment hash is also involved outside the scope of lightning.
791          */
792         public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.KeysInterface keys_manager, 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) {
793                 long ret = bindings.create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(channelmanager == null ? 0 : channelmanager.ptr, keys_manager == null ? 0 : keys_manager.ptr, logger == null ? 0 : logger.ptr, network, amt_msat.ptr, description, duration_since_epoch, invoice_expiry_delta_secs, InternalUtils.check_arr_len(payment_hash, 32));
794                 Reference.reachabilityFence(channelmanager);
795                 Reference.reachabilityFence(keys_manager);
796                 Reference.reachabilityFence(logger);
797                 Reference.reachabilityFence(network);
798                 Reference.reachabilityFence(amt_msat);
799                 Reference.reachabilityFence(description);
800                 Reference.reachabilityFence(duration_since_epoch);
801                 Reference.reachabilityFence(invoice_expiry_delta_secs);
802                 Reference.reachabilityFence(payment_hash);
803                 if (ret >= 0 && ret <= 4096) { return null; }
804                 Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
805                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); };
806                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); };
807                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
808                 return ret_hu_conv;
809         }
810
811 }