Update auto-generated bindings to LDK 0.0.121
[ldk-c-bindings] / lightning-c-bindings / src / lightning / blinded_path / mod.rs
index 949321c391ee3e0a4c756eb403d27ab64578c30b..b6e36eaf8dc87fc17b6b3d03a7549583cac83340 100644 (file)
@@ -166,13 +166,16 @@ impl Clone for BlindedPath {
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
 pub(crate) extern "C" fn BlindedPath_clone_void(this_ptr: *const c_void) -> *mut c_void {
-       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeBlindedPath)).clone() })) as *mut c_void
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBlindedPath)).clone() })) as *mut c_void
 }
 #[no_mangle]
 /// Creates a copy of the BlindedPath
 pub extern "C" fn BlindedPath_clone(orig: &BlindedPath) -> BlindedPath {
        orig.clone()
 }
+/// Get a string which allows debug introspection of a BlindedPath object
+pub extern "C" fn BlindedPath_debug_str_void(o: *const c_void) -> Str {
+       alloc::format!("{:?}", unsafe { o as *const crate::lightning::blinded_path::BlindedPath }).into()}
 /// Generates a non-cryptographic 64-bit hash of the BlindedPath.
 #[no_mangle]
 pub extern "C" fn BlindedPath_hash(o: &BlindedPath) -> u64 {
@@ -293,13 +296,16 @@ impl Clone for BlindedHop {
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
 pub(crate) extern "C" fn BlindedHop_clone_void(this_ptr: *const c_void) -> *mut c_void {
-       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeBlindedHop)).clone() })) as *mut c_void
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBlindedHop)).clone() })) as *mut c_void
 }
 #[no_mangle]
 /// Creates a copy of the BlindedHop
 pub extern "C" fn BlindedHop_clone(orig: &BlindedHop) -> BlindedHop {
        orig.clone()
 }
+/// Get a string which allows debug introspection of a BlindedHop object
+pub extern "C" fn BlindedHop_debug_str_void(o: *const c_void) -> Str {
+       alloc::format!("{:?}", unsafe { o as *const crate::lightning::blinded_path::BlindedHop }).into()}
 /// Generates a non-cryptographic 64-bit hash of the BlindedHop.
 #[no_mangle]
 pub extern "C" fn BlindedHop_hash(o: &BlindedHop) -> u64 {
@@ -319,10 +325,19 @@ pub extern "C" fn BlindedHop_eq(a: &BlindedHop, b: &BlindedHop) -> bool {
        if a.inner.is_null() || b.inner.is_null() { return false; }
        if a.get_native_ref() == b.get_native_ref() { true } else { false }
 }
+/// Create a one-hop blinded path for a message.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn BlindedPath_one_hop_for_message(mut recipient_node_id: crate::c_types::PublicKey, entropy_source: &crate::lightning::sign::EntropySource) -> crate::c_types::derived::CResult_BlindedPathNoneZ {
+       let mut ret = lightning::blinded_path::BlindedPath::one_hop_for_message(recipient_node_id.into_rust(), entropy_source, secp256k1::global::SECP256K1);
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::blinded_path::BlindedPath { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
+       local_ret
+}
+
 /// Create a blinded path for an onion message, to be forwarded along `node_pks`. The last node
 /// pubkey in `node_pks` will be the destination node.
 ///
-/// Errors if less than two hops are provided or if `node_pk`(s) are invalid.
+/// Errors if no hops are provided or if `node_pk`(s) are invalid.
 #[must_use]
 #[no_mangle]
 pub extern "C" fn BlindedPath_new_for_message(mut node_pks: crate::c_types::derived::CVec_PublicKeyZ, entropy_source: &crate::lightning::sign::EntropySource) -> crate::c_types::derived::CResult_BlindedPathNoneZ {
@@ -341,12 +356,29 @@ pub extern "C" fn BlindedPath_one_hop_for_payment(mut payee_node_id: crate::c_ty
        local_ret
 }
 
+/// Create a blinded path for a payment, to be forwarded along `intermediate_nodes`.
+///
+/// Errors if:
+/// * a provided node id is invalid
+/// * [`BlindedPayInfo`] calculation results in an integer overflow
+/// * any unknown features are required in the provided [`ForwardTlvs`]
+///
+/// [`ForwardTlvs`]: crate::blinded_path::payment::ForwardTlvs
+#[must_use]
+#[no_mangle]
+pub extern "C" fn BlindedPath_new_for_payment(mut intermediate_nodes: crate::c_types::derived::CVec_ForwardNodeZ, mut payee_node_id: crate::c_types::PublicKey, mut payee_tlvs: crate::lightning::blinded_path::payment::ReceiveTlvs, mut htlc_maximum_msat: u64, entropy_source: &crate::lightning::sign::EntropySource) -> crate::c_types::derived::CResult_C2Tuple_BlindedPayInfoBlindedPathZNoneZ {
+       let mut local_intermediate_nodes = Vec::new(); for mut item in intermediate_nodes.into_rust().drain(..) { local_intermediate_nodes.push( { *unsafe { Box::from_raw(item.take_inner()) } }); };
+       let mut ret = lightning::blinded_path::BlindedPath::new_for_payment(local_intermediate_nodes, payee_node_id.into_rust(), *unsafe { Box::from_raw(payee_tlvs.take_inner()) }, htlc_maximum_msat, entropy_source, secp256k1::global::SECP256K1);
+       let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = o; let mut local_ret_0 = (crate::lightning::offers::invoice::BlindedPayInfo { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, crate::lightning::blinded_path::BlindedPath { inner: ObjOps::heap_alloc(orig_ret_0_1), is_owned: true }).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
+       local_ret
+}
+
 #[no_mangle]
 /// Serialize the BlindedPath object into a byte array which can be read by BlindedPath_read
 pub extern "C" fn BlindedPath_write(obj: &crate::lightning::blinded_path::BlindedPath) -> crate::c_types::derived::CVec_u8Z {
        crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
 }
-#[no_mangle]
+#[allow(unused)]
 pub(crate) extern "C" fn BlindedPath_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
        crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeBlindedPath) })
 }
@@ -362,7 +394,7 @@ pub extern "C" fn BlindedPath_read(ser: crate::c_types::u8slice) -> crate::c_typ
 pub extern "C" fn BlindedHop_write(obj: &crate::lightning::blinded_path::BlindedHop) -> crate::c_types::derived::CVec_u8Z {
        crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
 }
-#[no_mangle]
+#[allow(unused)]
 pub(crate) extern "C" fn BlindedHop_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
        crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeBlindedHop) })
 }