+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeFundingSigned) };
+}
+#[allow(unused)]
+impl FundingSigned {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeFundingSigned {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeFundingSigned {
+ unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+ }
+ /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+ pub(crate) fn take_inner(mut self) -> *mut nativeFundingSigned {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn FundingSigned_get_channel_id(this_ptr: &FundingSigned) -> crate::lightning::ln::types::ChannelId {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id;
+ crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn FundingSigned_set_channel_id(this_ptr: &mut FundingSigned, mut val: crate::lightning::ln::types::ChannelId) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// The signature of the channel acceptor (fundee) on the initial commitment transaction
+#[no_mangle]
+pub extern "C" fn FundingSigned_get_signature(this_ptr: &FundingSigned) -> crate::c_types::ECDSASignature {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().signature;
+ crate::c_types::ECDSASignature::from_rust(&inner_val)
+}
+/// The signature of the channel acceptor (fundee) on the initial commitment transaction
+#[no_mangle]
+pub extern "C" fn FundingSigned_set_signature(this_ptr: &mut FundingSigned, mut val: crate::c_types::ECDSASignature) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.signature = val.into_rust();
+}
+/// Constructs a new FundingSigned given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn FundingSigned_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut signature_arg: crate::c_types::ECDSASignature) -> FundingSigned {
+ FundingSigned { inner: ObjOps::heap_alloc(nativeFundingSigned {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ signature: signature_arg.into_rust(),
+ }), is_owned: true }
+}
+impl Clone for FundingSigned {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeFundingSigned>::is_null(self.inner) { core::ptr::null_mut() } else {
+ ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
+ is_owned: true,
+ }
+ }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn FundingSigned_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeFundingSigned)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the FundingSigned
+pub extern "C" fn FundingSigned_clone(orig: &FundingSigned) -> FundingSigned {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a FundingSigned object
+pub extern "C" fn FundingSigned_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::FundingSigned }).into()}
+/// Generates a non-cryptographic 64-bit hash of the FundingSigned.
+#[no_mangle]
+pub extern "C" fn FundingSigned_hash(o: &FundingSigned) -> u64 {
+ if o.inner.is_null() { return 0; }
+ // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core
+ #[allow(deprecated)]
+ let mut hasher = core::hash::SipHasher::new();
+ core::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+ core::hash::Hasher::finish(&hasher)
+}
+/// Checks if two FundingSigneds contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn FundingSigned_eq(a: &FundingSigned, b: &FundingSigned) -> bool {
+ if a.inner == b.inner { return true; }
+ if a.inner.is_null() || b.inner.is_null() { return false; }
+ if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
+
+use lightning::ln::msgs::ChannelReady as nativeChannelReadyImport;
+pub(crate) type nativeChannelReady = nativeChannelReadyImport;
+
+/// A [`channel_ready`] message to be sent to or received from a peer.
+///
+/// [`channel_ready`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-channel_ready-message
+#[must_use]
+#[repr(C)]
+pub struct ChannelReady {
+ /// 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.
+ pub inner: *mut nativeChannelReady,
+ /// 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.
+ pub is_owned: bool,
+}
+
+impl Drop for ChannelReady {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeChannelReady>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the ChannelReady, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn ChannelReady_free(this_obj: ChannelReady) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ChannelReady_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelReady) };
+}
+#[allow(unused)]
+impl ChannelReady {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeChannelReady {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelReady {
+ unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+ }
+ /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+ pub(crate) fn take_inner(mut self) -> *mut nativeChannelReady {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn ChannelReady_get_channel_id(this_ptr: &ChannelReady) -> crate::lightning::ln::types::ChannelId {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id;
+ crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn ChannelReady_set_channel_id(this_ptr: &mut ChannelReady, mut val: crate::lightning::ln::types::ChannelId) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// The per-commitment point of the second commitment transaction
+#[no_mangle]
+pub extern "C" fn ChannelReady_get_next_per_commitment_point(this_ptr: &ChannelReady) -> crate::c_types::PublicKey {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().next_per_commitment_point;
+ crate::c_types::PublicKey::from_rust(&inner_val)
+}
+/// The per-commitment point of the second commitment transaction
+#[no_mangle]
+pub extern "C" fn ChannelReady_set_next_per_commitment_point(this_ptr: &mut ChannelReady, mut val: crate::c_types::PublicKey) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.next_per_commitment_point = val.into_rust();
+}
+/// If set, provides a `short_channel_id` alias for this channel.
+///
+/// The sender will accept payments to be forwarded over this SCID and forward them to this
+/// messages' recipient.
+#[no_mangle]
+pub extern "C" fn ChannelReady_get_short_channel_id_alias(this_ptr: &ChannelReady) -> crate::c_types::derived::COption_u64Z {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().short_channel_id_alias;
+ let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { inner_val.unwrap() }) };
+ local_inner_val
+}
+/// If set, provides a `short_channel_id` alias for this channel.
+///
+/// The sender will accept payments to be forwarded over this SCID and forward them to this
+/// messages' recipient.
+#[no_mangle]
+pub extern "C" fn ChannelReady_set_short_channel_id_alias(this_ptr: &mut ChannelReady, mut val: crate::c_types::derived::COption_u64Z) {
+ let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.short_channel_id_alias = local_val;
+}
+/// Constructs a new ChannelReady given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn ChannelReady_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut next_per_commitment_point_arg: crate::c_types::PublicKey, mut short_channel_id_alias_arg: crate::c_types::derived::COption_u64Z) -> ChannelReady {
+ let mut local_short_channel_id_alias_arg = if short_channel_id_alias_arg.is_some() { Some( { short_channel_id_alias_arg.take() }) } else { None };
+ ChannelReady { inner: ObjOps::heap_alloc(nativeChannelReady {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ next_per_commitment_point: next_per_commitment_point_arg.into_rust(),
+ short_channel_id_alias: local_short_channel_id_alias_arg,
+ }), is_owned: true }
+}
+impl Clone for ChannelReady {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeChannelReady>::is_null(self.inner) { core::ptr::null_mut() } else {
+ ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
+ is_owned: true,
+ }
+ }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ChannelReady_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelReady)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the ChannelReady
+pub extern "C" fn ChannelReady_clone(orig: &ChannelReady) -> ChannelReady {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a ChannelReady object
+pub extern "C" fn ChannelReady_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::ChannelReady }).into()}
+/// Generates a non-cryptographic 64-bit hash of the ChannelReady.
+#[no_mangle]
+pub extern "C" fn ChannelReady_hash(o: &ChannelReady) -> u64 {
+ if o.inner.is_null() { return 0; }
+ // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core
+ #[allow(deprecated)]
+ let mut hasher = core::hash::SipHasher::new();
+ core::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+ core::hash::Hasher::finish(&hasher)
+}
+/// Checks if two ChannelReadys contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn ChannelReady_eq(a: &ChannelReady, b: &ChannelReady) -> bool {
+ if a.inner == b.inner { return true; }
+ if a.inner.is_null() || b.inner.is_null() { return false; }
+ if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
+
+use lightning::ln::msgs::Stfu as nativeStfuImport;
+pub(crate) type nativeStfu = nativeStfuImport;
+
+/// An stfu (quiescence) message to be sent by or received from the stfu initiator.
+#[must_use]
+#[repr(C)]
+pub struct Stfu {
+ /// 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.
+ pub inner: *mut nativeStfu,
+ /// 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.
+ pub is_owned: bool,
+}
+
+impl Drop for Stfu {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeStfu>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the Stfu, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn Stfu_free(this_obj: Stfu) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Stfu_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeStfu) };
+}
+#[allow(unused)]
+impl Stfu {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeStfu {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeStfu {
+ unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+ }
+ /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+ pub(crate) fn take_inner(mut self) -> *mut nativeStfu {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The channel ID where quiescence is intended
+#[no_mangle]
+pub extern "C" fn Stfu_get_channel_id(this_ptr: &Stfu) -> crate::lightning::ln::types::ChannelId {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id;
+ crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false }
+}
+/// The channel ID where quiescence is intended
+#[no_mangle]
+pub extern "C" fn Stfu_set_channel_id(this_ptr: &mut Stfu, mut val: crate::lightning::ln::types::ChannelId) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// Initiator flag, 1 if initiating, 0 if replying to an stfu.
+#[no_mangle]
+pub extern "C" fn Stfu_get_initiator(this_ptr: &Stfu) -> u8 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().initiator;
+ *inner_val
+}
+/// Initiator flag, 1 if initiating, 0 if replying to an stfu.
+#[no_mangle]
+pub extern "C" fn Stfu_set_initiator(this_ptr: &mut Stfu, mut val: u8) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.initiator = val;
+}
+/// Constructs a new Stfu given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn Stfu_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut initiator_arg: u8) -> Stfu {
+ Stfu { inner: ObjOps::heap_alloc(nativeStfu {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ initiator: initiator_arg,
+ }), is_owned: true }
+}
+impl Clone for Stfu {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeStfu>::is_null(self.inner) { core::ptr::null_mut() } else {
+ ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
+ is_owned: true,
+ }
+ }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Stfu_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeStfu)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the Stfu
+pub extern "C" fn Stfu_clone(orig: &Stfu) -> Stfu {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a Stfu object
+pub extern "C" fn Stfu_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::Stfu }).into()}
+/// Checks if two Stfus contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn Stfu_eq(a: &Stfu, b: &Stfu) -> bool {
+ if a.inner == b.inner { return true; }
+ if a.inner.is_null() || b.inner.is_null() { return false; }
+ if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
+
+use lightning::ln::msgs::Splice as nativeSpliceImport;
+pub(crate) type nativeSplice = nativeSpliceImport;
+
+/// A splice message to be sent by or received from the stfu initiator (splice initiator).
+#[must_use]
+#[repr(C)]
+pub struct Splice {
+ /// 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.
+ pub inner: *mut nativeSplice,
+ /// 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.
+ pub is_owned: bool,
+}
+
+impl Drop for Splice {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeSplice>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the Splice, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn Splice_free(this_obj: Splice) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Splice_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeSplice) };
+}
+#[allow(unused)]
+impl Splice {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeSplice {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeSplice {
+ unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+ }
+ /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+ pub(crate) fn take_inner(mut self) -> *mut nativeSplice {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The channel ID where splicing is intended
+#[no_mangle]
+pub extern "C" fn Splice_get_channel_id(this_ptr: &Splice) -> crate::lightning::ln::types::ChannelId {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id;
+ crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false }
+}
+/// The channel ID where splicing is intended
+#[no_mangle]
+pub extern "C" fn Splice_set_channel_id(this_ptr: &mut Splice, mut val: crate::lightning::ln::types::ChannelId) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// The genesis hash of the blockchain where the channel is intended to be spliced
+#[no_mangle]
+pub extern "C" fn Splice_get_chain_hash(this_ptr: &Splice) -> *const [u8; 32] {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().chain_hash;
+ inner_val.as_ref()
+}
+/// The genesis hash of the blockchain where the channel is intended to be spliced
+#[no_mangle]
+pub extern "C" fn Splice_set_chain_hash(this_ptr: &mut Splice, mut val: crate::c_types::ThirtyTwoBytes) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::blockdata::constants::ChainHash::from(&val.data);
+}
+/// The intended change in channel capacity: the amount to be added (positive value)
+/// or removed (negative value) by the sender (splice initiator) by splicing into/from the channel.
+#[no_mangle]
+pub extern "C" fn Splice_get_relative_satoshis(this_ptr: &Splice) -> i64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().relative_satoshis;
+ *inner_val
+}
+/// The intended change in channel capacity: the amount to be added (positive value)
+/// or removed (negative value) by the sender (splice initiator) by splicing into/from the channel.
+#[no_mangle]
+pub extern "C" fn Splice_set_relative_satoshis(this_ptr: &mut Splice, mut val: i64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.relative_satoshis = val;
+}
+/// The feerate for the new funding transaction, set by the splice initiator
+#[no_mangle]
+pub extern "C" fn Splice_get_funding_feerate_perkw(this_ptr: &Splice) -> u32 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_feerate_perkw;
+ *inner_val
+}
+/// The feerate for the new funding transaction, set by the splice initiator
+#[no_mangle]
+pub extern "C" fn Splice_set_funding_feerate_perkw(this_ptr: &mut Splice, mut val: u32) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.funding_feerate_perkw = val;
+}
+/// The locktime for the new funding transaction
+#[no_mangle]
+pub extern "C" fn Splice_get_locktime(this_ptr: &Splice) -> u32 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().locktime;
+ *inner_val
+}
+/// The locktime for the new funding transaction
+#[no_mangle]
+pub extern "C" fn Splice_set_locktime(this_ptr: &mut Splice, mut val: u32) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.locktime = val;
+}
+/// The key of the sender (splice initiator) controlling the new funding transaction
+#[no_mangle]
+pub extern "C" fn Splice_get_funding_pubkey(this_ptr: &Splice) -> crate::c_types::PublicKey {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_pubkey;
+ crate::c_types::PublicKey::from_rust(&inner_val)
+}
+/// The key of the sender (splice initiator) controlling the new funding transaction
+#[no_mangle]
+pub extern "C" fn Splice_set_funding_pubkey(this_ptr: &mut Splice, mut val: crate::c_types::PublicKey) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.funding_pubkey = val.into_rust();
+}
+/// Constructs a new Splice given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn Splice_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut relative_satoshis_arg: i64, mut funding_feerate_perkw_arg: u32, mut locktime_arg: u32, mut funding_pubkey_arg: crate::c_types::PublicKey) -> Splice {
+ Splice { inner: ObjOps::heap_alloc(nativeSplice {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ chain_hash: ::bitcoin::blockdata::constants::ChainHash::from(&chain_hash_arg.data),
+ relative_satoshis: relative_satoshis_arg,
+ funding_feerate_perkw: funding_feerate_perkw_arg,
+ locktime: locktime_arg,
+ funding_pubkey: funding_pubkey_arg.into_rust(),
+ }), is_owned: true }
+}
+impl Clone for Splice {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeSplice>::is_null(self.inner) { core::ptr::null_mut() } else {
+ ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
+ is_owned: true,
+ }
+ }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Splice_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeSplice)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the Splice
+pub extern "C" fn Splice_clone(orig: &Splice) -> Splice {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a Splice object
+pub extern "C" fn Splice_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::Splice }).into()}
+/// Checks if two Splices contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn Splice_eq(a: &Splice, b: &Splice) -> bool {
+ if a.inner == b.inner { return true; }
+ if a.inner.is_null() || b.inner.is_null() { return false; }
+ if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
+
+use lightning::ln::msgs::SpliceAck as nativeSpliceAckImport;
+pub(crate) type nativeSpliceAck = nativeSpliceAckImport;
+
+/// A splice_ack message to be received by or sent to the splice initiator.
+///
+#[must_use]
+#[repr(C)]
+pub struct SpliceAck {
+ /// 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.
+ pub inner: *mut nativeSpliceAck,
+ /// 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.
+ pub is_owned: bool,
+}
+
+impl Drop for SpliceAck {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeSpliceAck>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the SpliceAck, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn SpliceAck_free(this_obj: SpliceAck) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn SpliceAck_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeSpliceAck) };
+}
+#[allow(unused)]
+impl SpliceAck {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeSpliceAck {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeSpliceAck {
+ unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+ }
+ /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+ pub(crate) fn take_inner(mut self) -> *mut nativeSpliceAck {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The channel ID where splicing is intended
+#[no_mangle]
+pub extern "C" fn SpliceAck_get_channel_id(this_ptr: &SpliceAck) -> crate::lightning::ln::types::ChannelId {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id;
+ crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false }
+}
+/// The channel ID where splicing is intended
+#[no_mangle]
+pub extern "C" fn SpliceAck_set_channel_id(this_ptr: &mut SpliceAck, mut val: crate::lightning::ln::types::ChannelId) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// The genesis hash of the blockchain where the channel is intended to be spliced
+#[no_mangle]
+pub extern "C" fn SpliceAck_get_chain_hash(this_ptr: &SpliceAck) -> *const [u8; 32] {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().chain_hash;
+ inner_val.as_ref()
+}
+/// The genesis hash of the blockchain where the channel is intended to be spliced
+#[no_mangle]
+pub extern "C" fn SpliceAck_set_chain_hash(this_ptr: &mut SpliceAck, mut val: crate::c_types::ThirtyTwoBytes) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::blockdata::constants::ChainHash::from(&val.data);
+}
+/// The intended change in channel capacity: the amount to be added (positive value)
+/// or removed (negative value) by the sender (splice acceptor) by splicing into/from the channel.
+#[no_mangle]
+pub extern "C" fn SpliceAck_get_relative_satoshis(this_ptr: &SpliceAck) -> i64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().relative_satoshis;
+ *inner_val
+}
+/// The intended change in channel capacity: the amount to be added (positive value)
+/// or removed (negative value) by the sender (splice acceptor) by splicing into/from the channel.
+#[no_mangle]
+pub extern "C" fn SpliceAck_set_relative_satoshis(this_ptr: &mut SpliceAck, mut val: i64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.relative_satoshis = val;
+}
+/// The key of the sender (splice acceptor) controlling the new funding transaction
+#[no_mangle]
+pub extern "C" fn SpliceAck_get_funding_pubkey(this_ptr: &SpliceAck) -> crate::c_types::PublicKey {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_pubkey;
+ crate::c_types::PublicKey::from_rust(&inner_val)
+}
+/// The key of the sender (splice acceptor) controlling the new funding transaction
+#[no_mangle]
+pub extern "C" fn SpliceAck_set_funding_pubkey(this_ptr: &mut SpliceAck, mut val: crate::c_types::PublicKey) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.funding_pubkey = val.into_rust();
+}
+/// Constructs a new SpliceAck given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn SpliceAck_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut relative_satoshis_arg: i64, mut funding_pubkey_arg: crate::c_types::PublicKey) -> SpliceAck {
+ SpliceAck { inner: ObjOps::heap_alloc(nativeSpliceAck {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ chain_hash: ::bitcoin::blockdata::constants::ChainHash::from(&chain_hash_arg.data),
+ relative_satoshis: relative_satoshis_arg,
+ funding_pubkey: funding_pubkey_arg.into_rust(),
+ }), is_owned: true }
+}
+impl Clone for SpliceAck {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeSpliceAck>::is_null(self.inner) { core::ptr::null_mut() } else {
+ ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
+ is_owned: true,
+ }
+ }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn SpliceAck_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeSpliceAck)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the SpliceAck
+pub extern "C" fn SpliceAck_clone(orig: &SpliceAck) -> SpliceAck {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a SpliceAck object
+pub extern "C" fn SpliceAck_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::SpliceAck }).into()}
+/// Checks if two SpliceAcks contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn SpliceAck_eq(a: &SpliceAck, b: &SpliceAck) -> bool {
+ if a.inner == b.inner { return true; }
+ if a.inner.is_null() || b.inner.is_null() { return false; }
+ if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
+
+use lightning::ln::msgs::SpliceLocked as nativeSpliceLockedImport;
+pub(crate) type nativeSpliceLocked = nativeSpliceLockedImport;
+
+/// A splice_locked message to be sent to or received from a peer.
+///
+#[must_use]
+#[repr(C)]
+pub struct SpliceLocked {
+ /// 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.
+ pub inner: *mut nativeSpliceLocked,
+ /// 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.
+ pub is_owned: bool,
+}
+
+impl Drop for SpliceLocked {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeSpliceLocked>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the SpliceLocked, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn SpliceLocked_free(this_obj: SpliceLocked) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn SpliceLocked_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeSpliceLocked) };
+}
+#[allow(unused)]
+impl SpliceLocked {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeSpliceLocked {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeSpliceLocked {
+ unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+ }
+ /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+ pub(crate) fn take_inner(mut self) -> *mut nativeSpliceLocked {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn SpliceLocked_get_channel_id(this_ptr: &SpliceLocked) -> crate::lightning::ln::types::ChannelId {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id;
+ crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn SpliceLocked_set_channel_id(this_ptr: &mut SpliceLocked, mut val: crate::lightning::ln::types::ChannelId) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// Constructs a new SpliceLocked given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn SpliceLocked_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId) -> SpliceLocked {
+ SpliceLocked { inner: ObjOps::heap_alloc(nativeSpliceLocked {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ }), is_owned: true }
+}
+impl Clone for SpliceLocked {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeSpliceLocked>::is_null(self.inner) { core::ptr::null_mut() } else {
+ ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
+ is_owned: true,
+ }
+ }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn SpliceLocked_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeSpliceLocked)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the SpliceLocked
+pub extern "C" fn SpliceLocked_clone(orig: &SpliceLocked) -> SpliceLocked {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a SpliceLocked object
+pub extern "C" fn SpliceLocked_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::SpliceLocked }).into()}
+/// Checks if two SpliceLockeds contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn SpliceLocked_eq(a: &SpliceLocked, b: &SpliceLocked) -> bool {
+ if a.inner == b.inner { return true; }
+ if a.inner.is_null() || b.inner.is_null() { return false; }
+ if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
+
+use lightning::ln::msgs::TxAddInput as nativeTxAddInputImport;
+pub(crate) type nativeTxAddInput = nativeTxAddInputImport;
+
+/// A tx_add_input message for adding an input during interactive transaction construction
+///
+#[must_use]
+#[repr(C)]
+pub struct TxAddInput {
+ /// 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.
+ pub inner: *mut nativeTxAddInput,
+ /// 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.
+ pub is_owned: bool,
+}
+
+impl Drop for TxAddInput {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeTxAddInput>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the TxAddInput, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn TxAddInput_free(this_obj: TxAddInput) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn TxAddInput_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeTxAddInput) };
+}
+#[allow(unused)]
+impl TxAddInput {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeTxAddInput {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeTxAddInput {
+ unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+ }
+ /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+ pub(crate) fn take_inner(mut self) -> *mut nativeTxAddInput {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn TxAddInput_get_channel_id(this_ptr: &TxAddInput) -> crate::lightning::ln::types::ChannelId {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id;
+ crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn TxAddInput_set_channel_id(this_ptr: &mut TxAddInput, mut val: crate::lightning::ln::types::ChannelId) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// A randomly chosen unique identifier for this input, which is even for initiators and odd for
+/// non-initiators.
+#[no_mangle]
+pub extern "C" fn TxAddInput_get_serial_id(this_ptr: &TxAddInput) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().serial_id;
+ *inner_val
+}
+/// A randomly chosen unique identifier for this input, which is even for initiators and odd for
+/// non-initiators.
+#[no_mangle]
+pub extern "C" fn TxAddInput_set_serial_id(this_ptr: &mut TxAddInput, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.serial_id = val;
+}
+/// Serialized transaction that contains the output this input spends to verify that it is non
+/// malleable.
+#[no_mangle]
+pub extern "C" fn TxAddInput_get_prevtx(this_ptr: &TxAddInput) -> crate::lightning::util::ser::TransactionU16LenLimited {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().prevtx;
+ crate::lightning::util::ser::TransactionU16LenLimited { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::util::ser::TransactionU16LenLimited<>) as *mut _) }, is_owned: false }
+}
+/// Serialized transaction that contains the output this input spends to verify that it is non
+/// malleable.
+#[no_mangle]
+pub extern "C" fn TxAddInput_set_prevtx(this_ptr: &mut TxAddInput, mut val: crate::lightning::util::ser::TransactionU16LenLimited) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.prevtx = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// The index of the output being spent
+#[no_mangle]
+pub extern "C" fn TxAddInput_get_prevtx_out(this_ptr: &TxAddInput) -> u32 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().prevtx_out;
+ *inner_val
+}
+/// The index of the output being spent
+#[no_mangle]
+pub extern "C" fn TxAddInput_set_prevtx_out(this_ptr: &mut TxAddInput, mut val: u32) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.prevtx_out = val;
+}
+/// The sequence number of this input
+#[no_mangle]
+pub extern "C" fn TxAddInput_get_sequence(this_ptr: &TxAddInput) -> u32 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().sequence;
+ *inner_val
+}
+/// The sequence number of this input
+#[no_mangle]
+pub extern "C" fn TxAddInput_set_sequence(this_ptr: &mut TxAddInput, mut val: u32) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.sequence = val;
+}
+/// Constructs a new TxAddInput given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn TxAddInput_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut serial_id_arg: u64, mut prevtx_arg: crate::lightning::util::ser::TransactionU16LenLimited, mut prevtx_out_arg: u32, mut sequence_arg: u32) -> TxAddInput {
+ TxAddInput { inner: ObjOps::heap_alloc(nativeTxAddInput {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ serial_id: serial_id_arg,
+ prevtx: *unsafe { Box::from_raw(prevtx_arg.take_inner()) },
+ prevtx_out: prevtx_out_arg,
+ sequence: sequence_arg,
+ }), is_owned: true }
+}
+impl Clone for TxAddInput {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeTxAddInput>::is_null(self.inner) { core::ptr::null_mut() } else {
+ ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
+ is_owned: true,
+ }
+ }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn TxAddInput_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxAddInput)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the TxAddInput
+pub extern "C" fn TxAddInput_clone(orig: &TxAddInput) -> TxAddInput {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a TxAddInput object
+pub extern "C" fn TxAddInput_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::TxAddInput }).into()}
+/// Generates a non-cryptographic 64-bit hash of the TxAddInput.
+#[no_mangle]
+pub extern "C" fn TxAddInput_hash(o: &TxAddInput) -> u64 {
+ if o.inner.is_null() { return 0; }
+ // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core
+ #[allow(deprecated)]
+ let mut hasher = core::hash::SipHasher::new();
+ core::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+ core::hash::Hasher::finish(&hasher)
+}
+/// Checks if two TxAddInputs contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn TxAddInput_eq(a: &TxAddInput, b: &TxAddInput) -> bool {
+ if a.inner == b.inner { return true; }
+ if a.inner.is_null() || b.inner.is_null() { return false; }
+ if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
+
+use lightning::ln::msgs::TxAddOutput as nativeTxAddOutputImport;
+pub(crate) type nativeTxAddOutput = nativeTxAddOutputImport;
+
+/// A tx_add_output message for adding an output during interactive transaction construction.
+///
+#[must_use]
+#[repr(C)]
+pub struct TxAddOutput {
+ /// 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.
+ pub inner: *mut nativeTxAddOutput,
+ /// 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.
+ pub is_owned: bool,
+}
+
+impl Drop for TxAddOutput {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeTxAddOutput>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the TxAddOutput, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn TxAddOutput_free(this_obj: TxAddOutput) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn TxAddOutput_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeTxAddOutput) };
+}
+#[allow(unused)]
+impl TxAddOutput {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeTxAddOutput {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeTxAddOutput {
+ unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+ }
+ /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+ pub(crate) fn take_inner(mut self) -> *mut nativeTxAddOutput {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn TxAddOutput_get_channel_id(this_ptr: &TxAddOutput) -> crate::lightning::ln::types::ChannelId {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id;
+ crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn TxAddOutput_set_channel_id(this_ptr: &mut TxAddOutput, mut val: crate::lightning::ln::types::ChannelId) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// A randomly chosen unique identifier for this output, which is even for initiators and odd for
+/// non-initiators.
+#[no_mangle]
+pub extern "C" fn TxAddOutput_get_serial_id(this_ptr: &TxAddOutput) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().serial_id;
+ *inner_val
+}
+/// A randomly chosen unique identifier for this output, which is even for initiators and odd for
+/// non-initiators.
+#[no_mangle]
+pub extern "C" fn TxAddOutput_set_serial_id(this_ptr: &mut TxAddOutput, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.serial_id = val;
+}
+/// The satoshi value of the output
+#[no_mangle]
+pub extern "C" fn TxAddOutput_get_sats(this_ptr: &TxAddOutput) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().sats;
+ *inner_val
+}
+/// The satoshi value of the output
+#[no_mangle]
+pub extern "C" fn TxAddOutput_set_sats(this_ptr: &mut TxAddOutput, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.sats = val;
+}
+/// The scriptPubKey for the output
+#[no_mangle]
+pub extern "C" fn TxAddOutput_get_script(this_ptr: &TxAddOutput) -> crate::c_types::derived::CVec_u8Z {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().script;
+ inner_val.as_bytes().to_vec().into()
+}
+/// The scriptPubKey for the output
+#[no_mangle]
+pub extern "C" fn TxAddOutput_set_script(this_ptr: &mut TxAddOutput, mut val: crate::c_types::derived::CVec_u8Z) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.script = ::bitcoin::blockdata::script::ScriptBuf::from(val.into_rust());
+}
+/// Constructs a new TxAddOutput given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn TxAddOutput_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut serial_id_arg: u64, mut sats_arg: u64, mut script_arg: crate::c_types::derived::CVec_u8Z) -> TxAddOutput {
+ TxAddOutput { inner: ObjOps::heap_alloc(nativeTxAddOutput {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ serial_id: serial_id_arg,
+ sats: sats_arg,
+ script: ::bitcoin::blockdata::script::ScriptBuf::from(script_arg.into_rust()),
+ }), is_owned: true }
+}
+impl Clone for TxAddOutput {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeTxAddOutput>::is_null(self.inner) { core::ptr::null_mut() } else {
+ ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
+ is_owned: true,
+ }
+ }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn TxAddOutput_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxAddOutput)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the TxAddOutput
+pub extern "C" fn TxAddOutput_clone(orig: &TxAddOutput) -> TxAddOutput {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a TxAddOutput object
+pub extern "C" fn TxAddOutput_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::TxAddOutput }).into()}
+/// Generates a non-cryptographic 64-bit hash of the TxAddOutput.
+#[no_mangle]
+pub extern "C" fn TxAddOutput_hash(o: &TxAddOutput) -> u64 {
+ if o.inner.is_null() { return 0; }
+ // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core
+ #[allow(deprecated)]
+ let mut hasher = core::hash::SipHasher::new();
+ core::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+ core::hash::Hasher::finish(&hasher)
+}
+/// Checks if two TxAddOutputs contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn TxAddOutput_eq(a: &TxAddOutput, b: &TxAddOutput) -> bool {
+ if a.inner == b.inner { return true; }
+ if a.inner.is_null() || b.inner.is_null() { return false; }
+ if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
+
+use lightning::ln::msgs::TxRemoveInput as nativeTxRemoveInputImport;
+pub(crate) type nativeTxRemoveInput = nativeTxRemoveInputImport;
+
+/// A tx_remove_input message for removing an input during interactive transaction construction.
+///
+#[must_use]
+#[repr(C)]
+pub struct TxRemoveInput {
+ /// 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.
+ pub inner: *mut nativeTxRemoveInput,
+ /// 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.
+ pub is_owned: bool,
+}
+
+impl Drop for TxRemoveInput {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeTxRemoveInput>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the TxRemoveInput, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn TxRemoveInput_free(this_obj: TxRemoveInput) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn TxRemoveInput_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeTxRemoveInput) };
+}
+#[allow(unused)]
+impl TxRemoveInput {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeTxRemoveInput {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeTxRemoveInput {
+ unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+ }
+ /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+ pub(crate) fn take_inner(mut self) -> *mut nativeTxRemoveInput {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn TxRemoveInput_get_channel_id(this_ptr: &TxRemoveInput) -> crate::lightning::ln::types::ChannelId {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id;
+ crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn TxRemoveInput_set_channel_id(this_ptr: &mut TxRemoveInput, mut val: crate::lightning::ln::types::ChannelId) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// The serial ID of the input to be removed
+#[no_mangle]
+pub extern "C" fn TxRemoveInput_get_serial_id(this_ptr: &TxRemoveInput) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().serial_id;
+ *inner_val
+}
+/// The serial ID of the input to be removed
+#[no_mangle]
+pub extern "C" fn TxRemoveInput_set_serial_id(this_ptr: &mut TxRemoveInput, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.serial_id = val;
+}
+/// Constructs a new TxRemoveInput given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn TxRemoveInput_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut serial_id_arg: u64) -> TxRemoveInput {
+ TxRemoveInput { inner: ObjOps::heap_alloc(nativeTxRemoveInput {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ serial_id: serial_id_arg,
+ }), is_owned: true }
+}
+impl Clone for TxRemoveInput {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeTxRemoveInput>::is_null(self.inner) { core::ptr::null_mut() } else {
+ ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
+ is_owned: true,
+ }
+ }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn TxRemoveInput_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxRemoveInput)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the TxRemoveInput
+pub extern "C" fn TxRemoveInput_clone(orig: &TxRemoveInput) -> TxRemoveInput {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a TxRemoveInput object
+pub extern "C" fn TxRemoveInput_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::TxRemoveInput }).into()}
+/// Generates a non-cryptographic 64-bit hash of the TxRemoveInput.
+#[no_mangle]
+pub extern "C" fn TxRemoveInput_hash(o: &TxRemoveInput) -> u64 {
+ if o.inner.is_null() { return 0; }
+ // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core
+ #[allow(deprecated)]
+ let mut hasher = core::hash::SipHasher::new();
+ core::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+ core::hash::Hasher::finish(&hasher)
+}
+/// Checks if two TxRemoveInputs contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn TxRemoveInput_eq(a: &TxRemoveInput, b: &TxRemoveInput) -> bool {
+ if a.inner == b.inner { return true; }
+ if a.inner.is_null() || b.inner.is_null() { return false; }
+ if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
+
+use lightning::ln::msgs::TxRemoveOutput as nativeTxRemoveOutputImport;
+pub(crate) type nativeTxRemoveOutput = nativeTxRemoveOutputImport;
+
+/// A tx_remove_output message for removing an output during interactive transaction construction.
+///
+#[must_use]
+#[repr(C)]
+pub struct TxRemoveOutput {
+ /// 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.
+ pub inner: *mut nativeTxRemoveOutput,
+ /// 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.
+ pub is_owned: bool,
+}
+
+impl Drop for TxRemoveOutput {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeTxRemoveOutput>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the TxRemoveOutput, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn TxRemoveOutput_free(this_obj: TxRemoveOutput) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn TxRemoveOutput_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeTxRemoveOutput) };
+}
+#[allow(unused)]
+impl TxRemoveOutput {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeTxRemoveOutput {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeTxRemoveOutput {
+ unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+ }
+ /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+ pub(crate) fn take_inner(mut self) -> *mut nativeTxRemoveOutput {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn TxRemoveOutput_get_channel_id(this_ptr: &TxRemoveOutput) -> crate::lightning::ln::types::ChannelId {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id;
+ crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn TxRemoveOutput_set_channel_id(this_ptr: &mut TxRemoveOutput, mut val: crate::lightning::ln::types::ChannelId) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// The serial ID of the output to be removed
+#[no_mangle]
+pub extern "C" fn TxRemoveOutput_get_serial_id(this_ptr: &TxRemoveOutput) -> u64 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().serial_id;
+ *inner_val
+}
+/// The serial ID of the output to be removed
+#[no_mangle]
+pub extern "C" fn TxRemoveOutput_set_serial_id(this_ptr: &mut TxRemoveOutput, mut val: u64) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.serial_id = val;
+}
+/// Constructs a new TxRemoveOutput given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn TxRemoveOutput_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut serial_id_arg: u64) -> TxRemoveOutput {
+ TxRemoveOutput { inner: ObjOps::heap_alloc(nativeTxRemoveOutput {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ serial_id: serial_id_arg,
+ }), is_owned: true }
+}
+impl Clone for TxRemoveOutput {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeTxRemoveOutput>::is_null(self.inner) { core::ptr::null_mut() } else {
+ ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
+ is_owned: true,
+ }
+ }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn TxRemoveOutput_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxRemoveOutput)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the TxRemoveOutput
+pub extern "C" fn TxRemoveOutput_clone(orig: &TxRemoveOutput) -> TxRemoveOutput {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a TxRemoveOutput object
+pub extern "C" fn TxRemoveOutput_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::TxRemoveOutput }).into()}
+/// Generates a non-cryptographic 64-bit hash of the TxRemoveOutput.
+#[no_mangle]
+pub extern "C" fn TxRemoveOutput_hash(o: &TxRemoveOutput) -> u64 {
+ if o.inner.is_null() { return 0; }
+ // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core
+ #[allow(deprecated)]
+ let mut hasher = core::hash::SipHasher::new();
+ core::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+ core::hash::Hasher::finish(&hasher)
+}
+/// Checks if two TxRemoveOutputs contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn TxRemoveOutput_eq(a: &TxRemoveOutput, b: &TxRemoveOutput) -> bool {
+ if a.inner == b.inner { return true; }
+ if a.inner.is_null() || b.inner.is_null() { return false; }
+ if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
+
+use lightning::ln::msgs::TxComplete as nativeTxCompleteImport;
+pub(crate) type nativeTxComplete = nativeTxCompleteImport;
+
+/// A tx_complete message signalling the conclusion of a peer's transaction contributions during
+/// interactive transaction construction.
+///
+#[must_use]
+#[repr(C)]
+pub struct TxComplete {
+ /// 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.
+ pub inner: *mut nativeTxComplete,
+ /// 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.
+ pub is_owned: bool,
+}
+
+impl Drop for TxComplete {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeTxComplete>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the TxComplete, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn TxComplete_free(this_obj: TxComplete) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn TxComplete_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeTxComplete) };
+}
+#[allow(unused)]
+impl TxComplete {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeTxComplete {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeTxComplete {
+ unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+ }
+ /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+ pub(crate) fn take_inner(mut self) -> *mut nativeTxComplete {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn TxComplete_get_channel_id(this_ptr: &TxComplete) -> crate::lightning::ln::types::ChannelId {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id;
+ crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn TxComplete_set_channel_id(this_ptr: &mut TxComplete, mut val: crate::lightning::ln::types::ChannelId) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// Constructs a new TxComplete given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn TxComplete_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId) -> TxComplete {
+ TxComplete { inner: ObjOps::heap_alloc(nativeTxComplete {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ }), is_owned: true }
+}
+impl Clone for TxComplete {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeTxComplete>::is_null(self.inner) { core::ptr::null_mut() } else {
+ ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
+ is_owned: true,
+ }
+ }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn TxComplete_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxComplete)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the TxComplete
+pub extern "C" fn TxComplete_clone(orig: &TxComplete) -> TxComplete {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a TxComplete object
+pub extern "C" fn TxComplete_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::TxComplete }).into()}
+/// Generates a non-cryptographic 64-bit hash of the TxComplete.
+#[no_mangle]
+pub extern "C" fn TxComplete_hash(o: &TxComplete) -> u64 {
+ if o.inner.is_null() { return 0; }
+ // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core
+ #[allow(deprecated)]
+ let mut hasher = core::hash::SipHasher::new();
+ core::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+ core::hash::Hasher::finish(&hasher)
+}
+/// Checks if two TxCompletes contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn TxComplete_eq(a: &TxComplete, b: &TxComplete) -> bool {
+ if a.inner == b.inner { return true; }
+ if a.inner.is_null() || b.inner.is_null() { return false; }
+ if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
+
+use lightning::ln::msgs::TxSignatures as nativeTxSignaturesImport;
+pub(crate) type nativeTxSignatures = nativeTxSignaturesImport;
+
+/// A tx_signatures message containing the sender's signatures for a transaction constructed with
+/// interactive transaction construction.
+///
+#[must_use]
+#[repr(C)]
+pub struct TxSignatures {
+ /// 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.
+ pub inner: *mut nativeTxSignatures,
+ /// 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.
+ pub is_owned: bool,
+}
+
+impl Drop for TxSignatures {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeTxSignatures>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the TxSignatures, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn TxSignatures_free(this_obj: TxSignatures) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn TxSignatures_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeTxSignatures) };
+}
+#[allow(unused)]
+impl TxSignatures {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeTxSignatures {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeTxSignatures {
+ unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+ }
+ /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+ pub(crate) fn take_inner(mut self) -> *mut nativeTxSignatures {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn TxSignatures_get_channel_id(this_ptr: &TxSignatures) -> crate::lightning::ln::types::ChannelId {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id;
+ crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn TxSignatures_set_channel_id(this_ptr: &mut TxSignatures, mut val: crate::lightning::ln::types::ChannelId) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// The TXID
+#[no_mangle]
+pub extern "C" fn TxSignatures_get_tx_hash(this_ptr: &TxSignatures) -> *const [u8; 32] {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().tx_hash;
+ inner_val.as_ref()
+}
+/// The TXID
+#[no_mangle]
+pub extern "C" fn TxSignatures_set_tx_hash(this_ptr: &mut TxSignatures, mut val: crate::c_types::ThirtyTwoBytes) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.tx_hash = ::bitcoin::hash_types::Txid::from_slice(&val.data[..]).unwrap();
+}
+/// The list of witnesses
+///
+/// Returns a copy of the field.
+#[no_mangle]
+pub extern "C" fn TxSignatures_get_witnesses(this_ptr: &TxSignatures) -> crate::c_types::derived::CVec_WitnessZ {
+ let mut inner_val = this_ptr.get_native_mut_ref().witnesses.clone();
+ let mut local_inner_val = Vec::new(); for mut item in inner_val.drain(..) { local_inner_val.push( { crate::c_types::Witness::from_bitcoin(&item) }); };
+ local_inner_val.into()
+}
+/// The list of witnesses
+#[no_mangle]
+pub extern "C" fn TxSignatures_set_witnesses(this_ptr: &mut TxSignatures, mut val: crate::c_types::derived::CVec_WitnessZ) {
+ let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item.into_bitcoin() }); };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.witnesses = local_val;
+}
+/// Optional signature for the shared input -- the previous funding outpoint -- signed by both peers
+#[no_mangle]
+pub extern "C" fn TxSignatures_get_funding_outpoint_sig(this_ptr: &TxSignatures) -> crate::c_types::derived::COption_ECDSASignatureZ {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_outpoint_sig;
+ let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_ECDSASignatureZ::None } else { crate::c_types::derived::COption_ECDSASignatureZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option<Enum> is otherwise un-expressable. */ { crate::c_types::ECDSASignature::from_rust(&(*inner_val.as_ref().unwrap()).clone()) }) };
+ local_inner_val
+}
+/// Optional signature for the shared input -- the previous funding outpoint -- signed by both peers
+#[no_mangle]
+pub extern "C" fn TxSignatures_set_funding_outpoint_sig(this_ptr: &mut TxSignatures, mut val: crate::c_types::derived::COption_ECDSASignatureZ) {
+ let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { { val_opt.take() }.into_rust() }})} };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.funding_outpoint_sig = local_val;
+}
+/// Constructs a new TxSignatures given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn TxSignatures_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut tx_hash_arg: crate::c_types::ThirtyTwoBytes, mut witnesses_arg: crate::c_types::derived::CVec_WitnessZ, mut funding_outpoint_sig_arg: crate::c_types::derived::COption_ECDSASignatureZ) -> TxSignatures {
+ let mut local_witnesses_arg = Vec::new(); for mut item in witnesses_arg.into_rust().drain(..) { local_witnesses_arg.push( { item.into_bitcoin() }); };
+ let mut local_funding_outpoint_sig_arg = { /*funding_outpoint_sig_arg*/ let funding_outpoint_sig_arg_opt = funding_outpoint_sig_arg; if funding_outpoint_sig_arg_opt.is_none() { None } else { Some({ { { funding_outpoint_sig_arg_opt.take() }.into_rust() }})} };
+ TxSignatures { inner: ObjOps::heap_alloc(nativeTxSignatures {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ tx_hash: ::bitcoin::hash_types::Txid::from_slice(&tx_hash_arg.data[..]).unwrap(),
+ witnesses: local_witnesses_arg,
+ funding_outpoint_sig: local_funding_outpoint_sig_arg,
+ }), is_owned: true }
+}
+impl Clone for TxSignatures {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeTxSignatures>::is_null(self.inner) { core::ptr::null_mut() } else {
+ ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
+ is_owned: true,
+ }
+ }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn TxSignatures_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxSignatures)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the TxSignatures
+pub extern "C" fn TxSignatures_clone(orig: &TxSignatures) -> TxSignatures {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a TxSignatures object
+pub extern "C" fn TxSignatures_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::TxSignatures }).into()}
+/// Generates a non-cryptographic 64-bit hash of the TxSignatures.
+#[no_mangle]
+pub extern "C" fn TxSignatures_hash(o: &TxSignatures) -> u64 {
+ if o.inner.is_null() { return 0; }
+ // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core
+ #[allow(deprecated)]
+ let mut hasher = core::hash::SipHasher::new();
+ core::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+ core::hash::Hasher::finish(&hasher)
+}
+/// Checks if two TxSignaturess contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn TxSignatures_eq(a: &TxSignatures, b: &TxSignatures) -> bool {
+ if a.inner == b.inner { return true; }
+ if a.inner.is_null() || b.inner.is_null() { return false; }
+ if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
+
+use lightning::ln::msgs::TxInitRbf as nativeTxInitRbfImport;
+pub(crate) type nativeTxInitRbf = nativeTxInitRbfImport;
+
+/// A tx_init_rbf message which initiates a replacement of the transaction after it's been
+/// completed.
+///
+#[must_use]
+#[repr(C)]
+pub struct TxInitRbf {
+ /// 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.
+ pub inner: *mut nativeTxInitRbf,
+ /// 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.
+ pub is_owned: bool,
+}
+
+impl Drop for TxInitRbf {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeTxInitRbf>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the TxInitRbf, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn TxInitRbf_free(this_obj: TxInitRbf) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn TxInitRbf_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeTxInitRbf) };
+}
+#[allow(unused)]
+impl TxInitRbf {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeTxInitRbf {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeTxInitRbf {
+ unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+ }
+ /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+ pub(crate) fn take_inner(mut self) -> *mut nativeTxInitRbf {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn TxInitRbf_get_channel_id(this_ptr: &TxInitRbf) -> crate::lightning::ln::types::ChannelId {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id;
+ crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false }
+}
+/// The channel ID
+#[no_mangle]
+pub extern "C" fn TxInitRbf_set_channel_id(this_ptr: &mut TxInitRbf, mut val: crate::lightning::ln::types::ChannelId) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) };
+}
+/// The locktime of the transaction
+#[no_mangle]
+pub extern "C" fn TxInitRbf_get_locktime(this_ptr: &TxInitRbf) -> u32 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().locktime;
+ *inner_val
+}
+/// The locktime of the transaction
+#[no_mangle]
+pub extern "C" fn TxInitRbf_set_locktime(this_ptr: &mut TxInitRbf, mut val: u32) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.locktime = val;
+}
+/// The feerate of the transaction
+#[no_mangle]
+pub extern "C" fn TxInitRbf_get_feerate_sat_per_1000_weight(this_ptr: &TxInitRbf) -> u32 {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().feerate_sat_per_1000_weight;
+ *inner_val
+}
+/// The feerate of the transaction
+#[no_mangle]
+pub extern "C" fn TxInitRbf_set_feerate_sat_per_1000_weight(this_ptr: &mut TxInitRbf, mut val: u32) {
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.feerate_sat_per_1000_weight = val;
+}
+/// The number of satoshis the sender will contribute to or, if negative, remove from
+/// (e.g. splice-out) the funding output of the transaction
+#[no_mangle]
+pub extern "C" fn TxInitRbf_get_funding_output_contribution(this_ptr: &TxInitRbf) -> crate::c_types::derived::COption_i64Z {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_output_contribution;
+ let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_i64Z::None } else { crate::c_types::derived::COption_i64Z::Some( { inner_val.unwrap() }) };
+ local_inner_val
+}
+/// The number of satoshis the sender will contribute to or, if negative, remove from
+/// (e.g. splice-out) the funding output of the transaction
+#[no_mangle]
+pub extern "C" fn TxInitRbf_set_funding_output_contribution(this_ptr: &mut TxInitRbf, mut val: crate::c_types::derived::COption_i64Z) {
+ let mut local_val = if val.is_some() { Some( { val.take() }) } else { None };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.funding_output_contribution = local_val;
+}
+/// Constructs a new TxInitRbf given each field
+#[must_use]
+#[no_mangle]
+pub extern "C" fn TxInitRbf_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut locktime_arg: u32, mut feerate_sat_per_1000_weight_arg: u32, mut funding_output_contribution_arg: crate::c_types::derived::COption_i64Z) -> TxInitRbf {
+ let mut local_funding_output_contribution_arg = if funding_output_contribution_arg.is_some() { Some( { funding_output_contribution_arg.take() }) } else { None };
+ TxInitRbf { inner: ObjOps::heap_alloc(nativeTxInitRbf {
+ channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) },
+ locktime: locktime_arg,
+ feerate_sat_per_1000_weight: feerate_sat_per_1000_weight_arg,
+ funding_output_contribution: local_funding_output_contribution_arg,
+ }), is_owned: true }
+}
+impl Clone for TxInitRbf {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeTxInitRbf>::is_null(self.inner) { core::ptr::null_mut() } else {
+ ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
+ is_owned: true,
+ }
+ }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn TxInitRbf_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxInitRbf)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the TxInitRbf
+pub extern "C" fn TxInitRbf_clone(orig: &TxInitRbf) -> TxInitRbf {
+ orig.clone()
+}
+/// Get a string which allows debug introspection of a TxInitRbf object
+pub extern "C" fn TxInitRbf_debug_str_void(o: *const c_void) -> Str {
+ alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::TxInitRbf }).into()}
+/// Generates a non-cryptographic 64-bit hash of the TxInitRbf.
+#[no_mangle]
+pub extern "C" fn TxInitRbf_hash(o: &TxInitRbf) -> u64 {
+ if o.inner.is_null() { return 0; }
+ // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core
+ #[allow(deprecated)]
+ let mut hasher = core::hash::SipHasher::new();
+ core::hash::Hash::hash(o.get_native_ref(), &mut hasher);
+ core::hash::Hasher::finish(&hasher)
+}
+/// Checks if two TxInitRbfs contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+/// Two objects with NULL inner values will be considered "equal" here.
+#[no_mangle]
+pub extern "C" fn TxInitRbf_eq(a: &TxInitRbf, b: &TxInitRbf) -> bool {
+ if a.inner == b.inner { return true; }
+ if a.inner.is_null() || b.inner.is_null() { return false; }
+ if a.get_native_ref() == b.get_native_ref() { true } else { false }
+}
+
+use lightning::ln::msgs::TxAckRbf as nativeTxAckRbfImport;
+pub(crate) type nativeTxAckRbf = nativeTxAckRbfImport;
+
+/// A tx_ack_rbf message which acknowledges replacement of the transaction after it's been
+/// completed.
+///
+#[must_use]
+#[repr(C)]
+pub struct TxAckRbf {
+ /// 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.
+ pub inner: *mut nativeTxAckRbf,
+ /// 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.
+ pub is_owned: bool,
+}
+
+impl Drop for TxAckRbf {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeTxAckRbf>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the TxAckRbf, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn TxAckRbf_free(this_obj: TxAckRbf) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn TxAckRbf_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeTxAckRbf) };