@@ -927,7 +927,7 @@ public class Bindings {
927
927
/* RUST_TO_SWIFT_END */
928
928
public class func extractNativeLDKC2Tuple_BlockHashChannelMonitorZArray( array: [ C2Tuple_BlockHashChannelMonitorZ ] ) -> [ LDKC2Tuple_BlockHashChannelMonitorZ ] {
929
929
return array. map { entry -> LDKC2Tuple_BlockHashChannelMonitorZ in
930
- entry. cOpaqueStruct!
930
+ entry. danglingClone ( ) . cOpaqueStruct!
931
931
}
932
932
}
933
933
@@ -943,6 +943,13 @@ public class Bindings {
943
943
}
944
944
}
945
945
946
+ internal class func cloneNativeLDKC2Tuple_BlockHashChannelMonitorZArray( array: [ LDKC2Tuple_BlockHashChannelMonitorZ ] ) -> [ LDKC2Tuple_BlockHashChannelMonitorZ ] {
947
+ return array. map { entry -> LDKC2Tuple_BlockHashChannelMonitorZ in
948
+ // create a wrapper around the native object, dangle it to make it non-destructive, clone it, and then dangle the clone
949
+ C2Tuple_BlockHashChannelMonitorZ ( pointer: entry) . dangle ( ) . clone ( ) . dangle ( ) . cOpaqueStruct!
950
+ }
951
+ }
952
+
946
953
947
954
/* SWIFT_TO_RUST_START */
948
955
public class func new_LDKCVec_C2Tuple_PublicKeyTypeZZWrapper( array: [ LDKC2Tuple_PublicKeyTypeZ ] ) -> LDKCVec_C2Tuple_PublicKeyTypeZZWrapper {
@@ -2558,6 +2565,108 @@ public class Bindings {
2558
2565
}
2559
2566
2560
2567
2568
+ /* SWIFT_TO_RUST_START */
2569
+ public class func new_LDKCVec_OutPointZWrapper( array: [ LDKOutPoint ] ) -> LDKCVec_OutPointZWrapper {
2570
+ /* DIMENSION_REDUCTION_PREP */
2571
+
2572
+ /*
2573
+ let dataContainer = array.withUnsafeBufferPointer { (pointer: UnsafeBufferPointer<LDKOutPoint>) -> UnsafeMutablePointer<LDKOutPoint> in
2574
+ let mutablePointer = UnsafeMutablePointer<LDKOutPoint>(mutating: pointer.baseAddress!)
2575
+ return mutablePointer
2576
+ }
2577
+ */
2578
+
2579
+ let dataContainer = UnsafeMutablePointer< LDKOutPoint> . allocate( capacity: array. count)
2580
+ dataContainer. initialize ( from: array, count: array. count)
2581
+
2582
+ let vector = LDKCVec_OutPointZ ( data: dataContainer, datalen: UInt ( array. count) )
2583
+ let wrapper = LDKCVec_OutPointZWrapper ( pointer: vector)
2584
+ return wrapper
2585
+ }
2586
+
2587
+ public class LDKCVec_OutPointZWrapper : NativeTypeWrapper {
2588
+ private static var instanceCounter : UInt = 0
2589
+ internal let instanceNumber : UInt
2590
+
2591
+ internal var cOpaqueStruct : LDKCVec_OutPointZ ?
2592
+ internal var subdimensionWrapper : [ AnyObject ] ? = nil
2593
+
2594
+ public init ( pointer: LDKCVec_OutPointZ ) {
2595
+ Self . instanceCounter += 1
2596
+ self . instanceNumber = Self . instanceCounter
2597
+ self . cOpaqueStruct = pointer
2598
+ super. init ( conflictAvoidingVariableName: 0 )
2599
+ }
2600
+
2601
+ internal init ( pointer: LDKCVec_OutPointZ , subdimensionWrapper: [ AnyObject ] ) {
2602
+ Self . instanceCounter += 1
2603
+ self . instanceNumber = Self . instanceCounter
2604
+ self . subdimensionWrapper = subdimensionWrapper
2605
+ self . cOpaqueStruct = pointer
2606
+ super. init ( conflictAvoidingVariableName: 0 )
2607
+ }
2608
+
2609
+ public func noOpRetain( ) { }
2610
+
2611
+ internal func dangle( dangleSubdimensions: Bool = true ) -> LDKCVec_OutPointZWrapper {
2612
+ self . dangling = true
2613
+ /* SUBDIMENSION_DANGLE_PREP */
2614
+ return self
2615
+ }
2616
+
2617
+ deinit {
2618
+ if !self . dangling {
2619
+ print ( " Freeing LDKCVec_OutPointZWrapper \( self . instanceNumber) . " )
2620
+ self . cOpaqueStruct!. data. deallocate ( )
2621
+ } else {
2622
+ print ( " Not freeing LDKCVec_OutPointZWrapper \( self . instanceNumber) due to dangle. " )
2623
+ }
2624
+ }
2625
+ }
2626
+ /* SWIFT_TO_RUST_END */
2627
+
2628
+ /* RUST_TO_SWIFT_START */
2629
+ public class func LDKCVec_OutPointZ_to_array( nativeType: LDKCVec_OutPointZ , deallocate: Bool = true ) -> [ LDKOutPoint ] {
2630
+ var array = [ LDKOutPoint] ( )
2631
+ for index in 0 ..< Int ( nativeType. datalen) {
2632
+ let currentEntry = nativeType. data [ index]
2633
+ /* CONVERSION_PREP */
2634
+ array. append ( currentEntry)
2635
+ }
2636
+
2637
+ if deallocate && nativeType. datalen > 0 {
2638
+ nativeType. data. deallocate ( )
2639
+ }
2640
+
2641
+ return array
2642
+ }
2643
+ /* RUST_TO_SWIFT_END */
2644
+ public class func extractNativeLDKOutPointArray( array: [ OutPoint ] ) -> [ LDKOutPoint ] {
2645
+ return array. map { entry -> LDKOutPoint in
2646
+ entry. danglingClone ( ) . cOpaqueStruct!
2647
+ }
2648
+ }
2649
+
2650
+ public class func wrapNativeLDKOutPointArray( array: [ LDKOutPoint ] ) -> [ OutPoint ] {
2651
+ return array. map { entry -> OutPoint in
2652
+ OutPoint ( pointer: entry)
2653
+ }
2654
+ }
2655
+
2656
+ public class func wrapDanglingNativeLDKOutPointArray( array: [ LDKOutPoint ] ) -> [ OutPoint ] {
2657
+ return array. map { entry -> OutPoint in
2658
+ OutPoint ( pointer: entry) . dangle ( )
2659
+ }
2660
+ }
2661
+
2662
+ internal class func cloneNativeLDKOutPointArray( array: [ LDKOutPoint ] ) -> [ LDKOutPoint ] {
2663
+ return array. map { entry -> LDKOutPoint in
2664
+ // create a wrapper around the native object, dangle it to make it non-destructive, clone it, and then dangle the clone
2665
+ OutPoint ( pointer: entry) . dangle ( ) . clone ( ) . dangle ( ) . cOpaqueStruct!
2666
+ }
2667
+ }
2668
+
2669
+
2561
2670
/* SWIFT_TO_RUST_START */
2562
2671
public class func new_LDKCVec_PrivateRouteZWrapper( array: [ LDKPrivateRoute ] ) -> LDKCVec_PrivateRouteZWrapper {
2563
2672
/* DIMENSION_REDUCTION_PREP */
@@ -4362,7 +4471,7 @@ withUnsafePointer(to: htlc.cOpaqueStruct!) { (htlcPointer: UnsafePointer<LDKHTLC
4362
4471
4363
4472
4364
4473
}
4365
- public class func swift_get_keysend_route( our_node_id : [ UInt8 ] , network: NetworkGraph , payee: [ UInt8 ] , first_hops: [ ChannelDetails ] ? , last_hops: [ RouteHint ] , final_value_msat: UInt64 , final_cltv: UInt32 , logger: Logger ) -> Result_RouteLightningErrorZ {
4474
+ public class func swift_get_keysend_route( our_node_pubkey : [ UInt8 ] , network: NetworkGraph , payee: [ UInt8 ] , first_hops: [ ChannelDetails ] ? , last_hops: [ RouteHint ] , final_value_msat: UInt64 , final_cltv: UInt32 , logger: Logger , scorer : Score ) -> Result_RouteLightningErrorZ {
4366
4475
4367
4476
4368
4477
var first_hopsPointer : UnsafeMutablePointer < LDKCVec_ChannelDetailsZ > ? = nil
@@ -4388,9 +4497,11 @@ withUnsafePointer(to: htlc.cOpaqueStruct!) { (htlcPointer: UnsafePointer<LDKHTLC
4388
4497
}
4389
4498
4390
4499
return withUnsafePointer ( to: network. cOpaqueStruct!) { ( networkPointer: UnsafePointer < LDKNetworkGraph > ) in
4500
+ withUnsafePointer ( to: scorer. cOpaqueStruct!) { ( scorerPointer: UnsafePointer < LDKScore > ) in
4391
4501
4392
- Result_RouteLightningErrorZ ( pointer: get_keysend_route ( Bindings . new_LDKPublicKey ( array: our_node_id ) , networkPointer, Bindings . new_LDKPublicKey ( array: payee) , first_hopsPointer, last_hopsWrapper. dangle ( ) . cOpaqueStruct!, final_value_msat, final_cltv, logger. cOpaqueStruct!) )
4502
+ Result_RouteLightningErrorZ ( pointer: get_keysend_route ( Bindings . new_LDKPublicKey ( array: our_node_pubkey ) , networkPointer, Bindings . new_LDKPublicKey ( array: payee) , first_hopsPointer, last_hopsWrapper. dangle ( ) . cOpaqueStruct!, final_value_msat, final_cltv, logger. cOpaqueStruct!, scorerPointer ) )
4393
4503
4504
+ }
4394
4505
}
4395
4506
4396
4507
}
@@ -4583,7 +4694,7 @@ withUnsafePointer(to: htlc.cOpaqueStruct!) { (htlcPointer: UnsafePointer<LDKHTLC
4583
4694
}
4584
4695
4585
4696
public class func get_ldk_swift_bindings_version( ) -> String {
4586
- return " 034c20c8e2a658f53ade8a8350a1aa5f36118992 "
4697
+ return " c57f422ea3fecd28800deabc7d81ffed507baa36 "
4587
4698
}
4588
4699
4589
4700
}
0 commit comments