+ /**
+ * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment`], but no
+ * `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without
+ * a `ChannelManager`.
+ *
+ * `keys` is generated by calling [`KeysInterface::get_inbound_payment_key_material`] and then
+ * calling [`ExpandedKey::new`] with its result. It is recommended to cache this value and not
+ * regenerate it for each new inbound payment.
+ *
+ * `current_time` is a Unix timestamp representing the current time.
+ *
+ * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
+ */
+ public static Result_C2Tuple_PaymentHashPaymentSecretZNoneZ create(ExpandedKey keys, Option_u64Z min_value_msat, int invoice_expiry_delta_secs, KeysInterface keys_manager, long current_time) {
+ long ret = bindings.create(keys == null ? 0 : keys.ptr & ~1, min_value_msat.ptr, invoice_expiry_delta_secs, keys_manager == null ? 0 : keys_manager.ptr, current_time);
+ Reference.reachabilityFence(keys);
+ Reference.reachabilityFence(min_value_msat);
+ Reference.reachabilityFence(invoice_expiry_delta_secs);
+ Reference.reachabilityFence(keys_manager);
+ Reference.reachabilityFence(current_time);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ Result_C2Tuple_PaymentHashPaymentSecretZNoneZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(keys);
+ ret_hu_conv.ptrs_to.add(keys_manager);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash`],
+ * but no `ChannelManager` is required. Useful for generating invoices for [phantom node payments]
+ * without a `ChannelManager`.
+ *
+ * See [`create`] for information on the `keys` and `current_time` parameters.
+ *
+ * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
+ */
+ public static Result_PaymentSecretNoneZ create_from_hash(ExpandedKey keys, Option_u64Z min_value_msat, byte[] payment_hash, int invoice_expiry_delta_secs, long current_time) {
+ long ret = bindings.create_from_hash(keys == null ? 0 : keys.ptr & ~1, min_value_msat.ptr, InternalUtils.check_arr_len(payment_hash, 32), invoice_expiry_delta_secs, current_time);
+ Reference.reachabilityFence(keys);
+ Reference.reachabilityFence(min_value_msat);
+ Reference.reachabilityFence(payment_hash);
+ Reference.reachabilityFence(invoice_expiry_delta_secs);
+ Reference.reachabilityFence(current_time);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ Result_PaymentSecretNoneZ ret_hu_conv = Result_PaymentSecretNoneZ.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(keys);
+ return ret_hu_conv;
+ }
+