-/* Text to put at the beginning of the generated file. Probably a license. */
+#ifndef LDK_C_BINDINGS_H
+#define LDK_C_BINDINGS_H
/* Generated with cbindgen:0.16.0 */
bool result_ok;
} LDKCResult_CVec_SignatureZNoneZ;
+/**
+ * The contents of CResult_StringErrorZ
+ */
+typedef union LDKCResult_StringErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKCVec_u8Z *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ enum LDKSecp256k1Error *err;
+} LDKCResult_StringErrorZPtr;
+
+/**
+ * A CResult_StringErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::CVec_u8Z on success and a crate::c_types::Secp256k1Error on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_StringErrorZ {
+ /**
+ * The contents of this CResult_StringErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_StringErrorZPtr contents;
+ /**
+ * Whether this CResult_StringErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_StringErrorZ;
+
/**
/**
* A channel descriptor which provides a last-hop route to get_route
*/
-typedef struct MUST_USE_STRUCT LDKRouteHint {
+typedef struct MUST_USE_STRUCT LDKRouteHintHop {
/**
* A pointer to the opaque Rust object.
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeRouteHint *inner;
+ LDKnativeRouteHintHop *inner;
/**
* Indicates that this is the only struct which contains the same pointer.
* Rust functions which take ownership of an object provided via an argument require
* this to be true and invalidate the object pointed to by inner.
*/
bool is_owned;
-} LDKRouteHint;
+} LDKRouteHintHop;
/**
- * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
+ * A dynamically-allocated array of crate::lightning::routing::router::RouteHintHops of arbitrary size.
* This corresponds to std::vector in C++
*/
-typedef struct LDKCVec_RouteHintZ {
+typedef struct LDKCVec_RouteHintHopZ {
/**
* The elements in the array.
* If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- struct LDKRouteHint *data;
+ struct LDKRouteHintHop *data;
/**
* The number of elements pointed to by `data`.
*/
uintptr_t datalen;
-} LDKCVec_RouteHintZ;
+} LDKCVec_RouteHintHopZ;
*/
struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
+/**
+ * Creates a new CResult_StringErrorZ in the success state.
+ */
+struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKCVec_u8Z o);
+
+/**
+ * Creates a new CResult_StringErrorZ in the error state.
+ */
+struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
+
+/**
+ * Frees any resources used by the CResult_StringErrorZ.
+ */
+void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
+
/**
* Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
*/
/**
* Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
+void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
/**
* Creates a new CResult_RouteLightningErrorZ in the success state.
*/
struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
+/**
+ * Creates a digital signature of a message given a SecretKey, like the node's secret.
+ * 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.
+ * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
+ */
+struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, struct LDKSecretKey sk);
+
+/**
+ * Recovers the PublicKey of the signer of the message given the message and the signature.
+ */
+struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
+
+/**
+ * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
+ * and the PublicKey.
+ */
+bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
+
/**
* Creates a copy of the Level
*/
struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
/**
- * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
+ * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL.
*/
-void RouteHint_free(struct LDKRouteHint this_obj);
+void RouteHintHop_free(struct LDKRouteHintHop this_obj);
/**
* The node_id of the non-target end of the route
*/
-struct LDKPublicKey RouteHint_get_src_node_id(const struct LDKRouteHint *NONNULL_PTR this_ptr);
+struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
/**
* The node_id of the non-target end of the route
*/
-void RouteHint_set_src_node_id(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKPublicKey val);
+void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val);
/**
* The short_channel_id of this channel
*/
-uint64_t RouteHint_get_short_channel_id(const struct LDKRouteHint *NONNULL_PTR this_ptr);
+uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
/**
* The short_channel_id of this channel
*/
-void RouteHint_set_short_channel_id(struct LDKRouteHint *NONNULL_PTR this_ptr, uint64_t val);
+void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val);
/**
* The fees which must be paid to use this channel
*/
-struct LDKRoutingFees RouteHint_get_fees(const struct LDKRouteHint *NONNULL_PTR this_ptr);
+struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
/**
* The fees which must be paid to use this channel
*/
-void RouteHint_set_fees(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
+void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val);
/**
* The difference in CLTV values between this node and the next node.
*/
-uint16_t RouteHint_get_cltv_expiry_delta(const struct LDKRouteHint *NONNULL_PTR this_ptr);
+uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
/**
* The difference in CLTV values between this node and the next node.
*/
-void RouteHint_set_cltv_expiry_delta(struct LDKRouteHint *NONNULL_PTR this_ptr, uint16_t val);
+void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val);
/**
* The minimum value, in msat, which must be relayed to the next hop.
*/
-struct LDKCOption_u64Z RouteHint_get_htlc_minimum_msat(const struct LDKRouteHint *NONNULL_PTR this_ptr);
+struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
/**
* The minimum value, in msat, which must be relayed to the next hop.
*/
-void RouteHint_set_htlc_minimum_msat(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
+void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
/**
* The maximum value in msat available for routing with a single HTLC.
*/
-struct LDKCOption_u64Z RouteHint_get_htlc_maximum_msat(const struct LDKRouteHint *NONNULL_PTR this_ptr);
+struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
/**
* The maximum value in msat available for routing with a single HTLC.
*/
-void RouteHint_set_htlc_maximum_msat(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
+void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val);
/**
- * Constructs a new RouteHint given each field
+ * Constructs a new RouteHintHop given each field
*/
-MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKPublicKey src_node_id_arg, uint64_t short_channel_id_arg, struct LDKRoutingFees fees_arg, uint16_t cltv_expiry_delta_arg, struct LDKCOption_u64Z htlc_minimum_msat_arg, struct LDKCOption_u64Z htlc_maximum_msat_arg);
+MUST_USE_RES struct LDKRouteHintHop RouteHintHop_new(struct LDKPublicKey src_node_id_arg, uint64_t short_channel_id_arg, struct LDKRoutingFees fees_arg, uint16_t cltv_expiry_delta_arg, struct LDKCOption_u64Z htlc_minimum_msat_arg, struct LDKCOption_u64Z htlc_maximum_msat_arg);
/**
- * Creates a copy of the RouteHint
+ * Creates a copy of the RouteHintHop
*/
-struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
+struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
/**
* Gets a route from us (payer) to the given target node (payee).
* equal), however the enabled/disabled bit on such channels as well as the
* htlc_minimum_msat/htlc_maximum_msat *are* checked as they may change based on the receiving node.
*/
-struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKInvoiceFeatures payee_features, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
+struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKInvoiceFeatures payee_features, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintHopZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
/**
* Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL.
*/
struct LDKPersist FilesystemPersister_as_Persist(const struct LDKFilesystemPersister *NONNULL_PTR this_arg);
-/* Text to put at the end of the generated file */
+#endif /* LDK_C_BINDINGS_H */