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