@@ -729,6 +729,108 @@ public class Bindings {
729729 }
730730
731731
732+ /* SWIFT_TO_RUST_START */
733+ public class func new_LDKCVec_BalanceZWrapper( array: [ LDKBalance ] ) -> LDKCVec_BalanceZWrapper {
734+ /* DIMENSION_REDUCTION_PREP */
735+
736+ /*
737+ let dataContainer = array.withUnsafeBufferPointer { (pointer: UnsafeBufferPointer<LDKBalance>) -> UnsafeMutablePointer<LDKBalance> in
738+ let mutablePointer = UnsafeMutablePointer<LDKBalance>(mutating: pointer.baseAddress!)
739+ return mutablePointer
740+ }
741+ */
742+
743+ let dataContainer = UnsafeMutablePointer< LDKBalance> . allocate( capacity: array. count)
744+ dataContainer. initialize ( from: array, count: array. count)
745+
746+ let vector = LDKCVec_BalanceZ ( data: dataContainer, datalen: UInt ( array. count) )
747+ let wrapper = LDKCVec_BalanceZWrapper ( pointer: vector)
748+ return wrapper
749+ }
750+
751+ public class LDKCVec_BalanceZWrapper : NativeTypeWrapper {
752+ private static var instanceCounter : UInt = 0
753+ internal let instanceNumber : UInt
754+
755+ internal var cOpaqueStruct : LDKCVec_BalanceZ ?
756+ internal var subdimensionWrapper : [ AnyObject ] ? = nil
757+
758+ public init ( pointer: LDKCVec_BalanceZ ) {
759+ Self . instanceCounter += 1
760+ self . instanceNumber = Self . instanceCounter
761+ self . cOpaqueStruct = pointer
762+ super. init ( conflictAvoidingVariableName: 0 )
763+ }
764+
765+ internal init ( pointer: LDKCVec_BalanceZ , subdimensionWrapper: [ AnyObject ] ) {
766+ Self . instanceCounter += 1
767+ self . instanceNumber = Self . instanceCounter
768+ self . subdimensionWrapper = subdimensionWrapper
769+ self . cOpaqueStruct = pointer
770+ super. init ( conflictAvoidingVariableName: 0 )
771+ }
772+
773+ public func noOpRetain( ) { }
774+
775+ internal func dangle( dangleSubdimensions: Bool = true ) -> LDKCVec_BalanceZWrapper {
776+ self . dangling = true
777+ /* SUBDIMENSION_DANGLE_PREP */
778+ return self
779+ }
780+
781+ deinit {
782+ if !self . dangling {
783+ print ( " Freeing LDKCVec_BalanceZWrapper \( self . instanceNumber) . " )
784+ self . cOpaqueStruct!. data. deallocate ( )
785+ } else {
786+ print ( " Not freeing LDKCVec_BalanceZWrapper \( self . instanceNumber) due to dangle. " )
787+ }
788+ }
789+ }
790+ /* SWIFT_TO_RUST_END */
791+
792+ /* RUST_TO_SWIFT_START */
793+ public class func LDKCVec_BalanceZ_to_array( nativeType: LDKCVec_BalanceZ , deallocate: Bool = true ) -> [ LDKBalance ] {
794+ var array = [ LDKBalance] ( )
795+ for index in 0 ..< Int ( nativeType. datalen) {
796+ let currentEntry = nativeType. data [ index]
797+ /* CONVERSION_PREP */
798+ array. append ( currentEntry)
799+ }
800+
801+ if deallocate && nativeType. datalen > 0 {
802+ nativeType. data. deallocate ( )
803+ }
804+
805+ return array
806+ }
807+ /* RUST_TO_SWIFT_END */
808+ public class func extractNativeLDKBalanceArray( array: [ Balance ] ) -> [ LDKBalance ] {
809+ return array. map { entry -> LDKBalance in
810+ entry. danglingClone ( ) . cOpaqueStruct!
811+ }
812+ }
813+
814+ public class func wrapNativeLDKBalanceArray( array: [ LDKBalance ] ) -> [ Balance ] {
815+ return array. map { entry -> Balance in
816+ Balance ( pointer: entry)
817+ }
818+ }
819+
820+ public class func wrapDanglingNativeLDKBalanceArray( array: [ LDKBalance ] ) -> [ Balance ] {
821+ return array. map { entry -> Balance in
822+ Balance ( pointer: entry) . dangle ( )
823+ }
824+ }
825+
826+ internal class func cloneNativeLDKBalanceArray( array: [ LDKBalance ] ) -> [ LDKBalance ] {
827+ return array. map { entry -> LDKBalance in
828+ // create a wrapper around the native object, dangle it to make it non-destructive, clone it, and then dangle the clone
829+ Balance ( pointer: entry) . dangle ( ) . clone ( ) . dangle ( ) . cOpaqueStruct!
830+ }
831+ }
832+
833+
732834 /* SWIFT_TO_RUST_START */
733835 public class func new_LDKCVec_C2Tuple_BlockHashChannelMonitorZZWrapper( array: [ LDKC2Tuple_BlockHashChannelMonitorZ ] ) -> LDKCVec_C2Tuple_BlockHashChannelMonitorZZWrapper {
734836 /* DIMENSION_REDUCTION_PREP */
@@ -824,6 +926,108 @@ public class Bindings {
824926 }
825927
826928
929+ /* SWIFT_TO_RUST_START */
930+ public class func new_LDKCVec_C2Tuple_PublicKeyTypeZZWrapper( array: [ LDKC2Tuple_PublicKeyTypeZ ] ) -> LDKCVec_C2Tuple_PublicKeyTypeZZWrapper {
931+ /* DIMENSION_REDUCTION_PREP */
932+
933+ /*
934+ let dataContainer = array.withUnsafeBufferPointer { (pointer: UnsafeBufferPointer<LDKC2Tuple_PublicKeyTypeZ>) -> UnsafeMutablePointer<LDKC2Tuple_PublicKeyTypeZ> in
935+ let mutablePointer = UnsafeMutablePointer<LDKC2Tuple_PublicKeyTypeZ>(mutating: pointer.baseAddress!)
936+ return mutablePointer
937+ }
938+ */
939+
940+ let dataContainer = UnsafeMutablePointer< LDKC2Tuple_PublicKeyTypeZ> . allocate( capacity: array. count)
941+ dataContainer. initialize ( from: array, count: array. count)
942+
943+ let vector = LDKCVec_C2Tuple_PublicKeyTypeZZ ( data: dataContainer, datalen: UInt ( array. count) )
944+ let wrapper = LDKCVec_C2Tuple_PublicKeyTypeZZWrapper ( pointer: vector)
945+ return wrapper
946+ }
947+
948+ public class LDKCVec_C2Tuple_PublicKeyTypeZZWrapper : NativeTypeWrapper {
949+ private static var instanceCounter : UInt = 0
950+ internal let instanceNumber : UInt
951+
952+ internal var cOpaqueStruct : LDKCVec_C2Tuple_PublicKeyTypeZZ ?
953+ internal var subdimensionWrapper : [ AnyObject ] ? = nil
954+
955+ public init ( pointer: LDKCVec_C2Tuple_PublicKeyTypeZZ ) {
956+ Self . instanceCounter += 1
957+ self . instanceNumber = Self . instanceCounter
958+ self . cOpaqueStruct = pointer
959+ super. init ( conflictAvoidingVariableName: 0 )
960+ }
961+
962+ internal init ( pointer: LDKCVec_C2Tuple_PublicKeyTypeZZ , subdimensionWrapper: [ AnyObject ] ) {
963+ Self . instanceCounter += 1
964+ self . instanceNumber = Self . instanceCounter
965+ self . subdimensionWrapper = subdimensionWrapper
966+ self . cOpaqueStruct = pointer
967+ super. init ( conflictAvoidingVariableName: 0 )
968+ }
969+
970+ public func noOpRetain( ) { }
971+
972+ internal func dangle( dangleSubdimensions: Bool = true ) -> LDKCVec_C2Tuple_PublicKeyTypeZZWrapper {
973+ self . dangling = true
974+ /* SUBDIMENSION_DANGLE_PREP */
975+ return self
976+ }
977+
978+ deinit {
979+ if !self . dangling {
980+ print ( " Freeing LDKCVec_C2Tuple_PublicKeyTypeZZWrapper \( self . instanceNumber) . " )
981+ self . cOpaqueStruct!. data. deallocate ( )
982+ } else {
983+ print ( " Not freeing LDKCVec_C2Tuple_PublicKeyTypeZZWrapper \( self . instanceNumber) due to dangle. " )
984+ }
985+ }
986+ }
987+ /* SWIFT_TO_RUST_END */
988+
989+ /* RUST_TO_SWIFT_START */
990+ public class func LDKCVec_C2Tuple_PublicKeyTypeZZ_to_array( nativeType: LDKCVec_C2Tuple_PublicKeyTypeZZ , deallocate: Bool = true ) -> [ LDKC2Tuple_PublicKeyTypeZ ] {
991+ var array = [ LDKC2Tuple_PublicKeyTypeZ] ( )
992+ for index in 0 ..< Int ( nativeType. datalen) {
993+ let currentEntry = nativeType. data [ index]
994+ /* CONVERSION_PREP */
995+ array. append ( currentEntry)
996+ }
997+
998+ if deallocate && nativeType. datalen > 0 {
999+ nativeType. data. deallocate ( )
1000+ }
1001+
1002+ return array
1003+ }
1004+ /* RUST_TO_SWIFT_END */
1005+ public class func extractNativeLDKC2Tuple_PublicKeyTypeZArray( array: [ C2Tuple_PublicKeyTypeZ ] ) -> [ LDKC2Tuple_PublicKeyTypeZ ] {
1006+ return array. map { entry -> LDKC2Tuple_PublicKeyTypeZ in
1007+ entry. danglingClone ( ) . cOpaqueStruct!
1008+ }
1009+ }
1010+
1011+ public class func wrapNativeLDKC2Tuple_PublicKeyTypeZArray( array: [ LDKC2Tuple_PublicKeyTypeZ ] ) -> [ C2Tuple_PublicKeyTypeZ ] {
1012+ return array. map { entry -> C2Tuple_PublicKeyTypeZ in
1013+ C2Tuple_PublicKeyTypeZ ( pointer: entry)
1014+ }
1015+ }
1016+
1017+ public class func wrapDanglingNativeLDKC2Tuple_PublicKeyTypeZArray( array: [ LDKC2Tuple_PublicKeyTypeZ ] ) -> [ C2Tuple_PublicKeyTypeZ ] {
1018+ return array. map { entry -> C2Tuple_PublicKeyTypeZ in
1019+ C2Tuple_PublicKeyTypeZ ( pointer: entry) . dangle ( )
1020+ }
1021+ }
1022+
1023+ internal class func cloneNativeLDKC2Tuple_PublicKeyTypeZArray( array: [ LDKC2Tuple_PublicKeyTypeZ ] ) -> [ LDKC2Tuple_PublicKeyTypeZ ] {
1024+ return array. map { entry -> LDKC2Tuple_PublicKeyTypeZ in
1025+ // create a wrapper around the native object, dangle it to make it non-destructive, clone it, and then dangle the clone
1026+ C2Tuple_PublicKeyTypeZ ( pointer: entry) . dangle ( ) . clone ( ) . dangle ( ) . cOpaqueStruct!
1027+ }
1028+ }
1029+
1030+
8271031 /* SWIFT_TO_RUST_START */
8281032 public class func new_LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZWrapper( array: [ LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ ] ) -> LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZWrapper {
8291033 /* DIMENSION_REDUCTION_PREP */
@@ -4035,6 +4239,24 @@ public class func swift_C2Tuple_BlockHashChannelManagerZ_read(ser: [UInt8], arg:
40354239
40364240}
40374241
4242+ }
4243+ public class func swift_build_closing_transaction( to_holder_value_sat: UInt64 , to_counterparty_value_sat: UInt64 , to_holder_script: [ UInt8 ] , to_counterparty_script: [ UInt8 ] , funding_outpoint: OutPoint ) -> [ UInt8 ] {
4244+
4245+
4246+ let to_holder_scriptWrapper = Bindings . new_LDKCVec_u8ZWrapper ( array: to_holder_script)
4247+ defer {
4248+ to_holder_scriptWrapper. noOpRetain ( )
4249+ }
4250+
4251+ let to_counterparty_scriptWrapper = Bindings . new_LDKCVec_u8ZWrapper ( array: to_counterparty_script)
4252+ defer {
4253+ to_counterparty_scriptWrapper. noOpRetain ( )
4254+ }
4255+
4256+ return
4257+ Bindings . LDKTransaction_to_array ( nativeType: build_closing_transaction ( to_holder_value_sat, to_counterparty_value_sat, to_holder_scriptWrapper. dangle ( ) . cOpaqueStruct!, to_counterparty_scriptWrapper. dangle ( ) . cOpaqueStruct!, funding_outpoint. danglingClone ( ) . cOpaqueStruct!) )
4258+
4259+
40384260 }
40394261 public class func swift_derive_private_key( per_commitment_point: [ UInt8 ] , base_secret: [ UInt8 ] ) -> Result_SecretKeyErrorZ {
40404262
@@ -4317,10 +4539,10 @@ withUnsafePointer(to: htlc.cOpaqueStruct!) { (htlcPointer: UnsafePointer<LDKHTLC
43174539 return UnsafePointer < UInt8 > ( dataMutablePointer)
43184540 }
43194541
4320- public class func new_LDKStr( string: String ) -> LDKStr {
4321- let nativeType = Self . string_to_unsafe_uint8_pointer ( string: string)
4322- return LDKStr ( chars: nativeType, len: UInt ( string. count) , chars_is_owned: false )
4323- }
4542+ public class func new_LDKStr( string: String , chars_is_owned : Bool = false ) -> LDKStr {
4543+ let nativeType = Self . string_to_unsafe_uint8_pointer ( string: string)
4544+ return LDKStr ( chars: nativeType, len: UInt ( string. count) , chars_is_owned: chars_is_owned )
4545+ }
43244546
43254547 public class func createInvoiceFromChannelManager( channelManager: ChannelManager , keysManager: KeysInterface , network: LDKCurrency , amountMsat: UInt64 ? , description: String ) -> Result_InvoiceSignOrCreationErrorZ {
43264548 let nativeKeysManager = keysManager. cOpaqueStruct!
0 commit comments