@@ -2732,6 +2732,108 @@ public class Bindings {
2732
2732
}
2733
2733
2734
2734
2735
+ /* SWIFT_TO_RUST_START */
2736
+ public class func new_LDKCVec_NodeIdZWrapper( array: [ LDKNodeId ] ) -> LDKCVec_NodeIdZWrapper {
2737
+ /* DIMENSION_REDUCTION_PREP */
2738
+
2739
+ /*
2740
+ let dataContainer = array.withUnsafeBufferPointer { (pointer: UnsafeBufferPointer<LDKNodeId>) -> UnsafeMutablePointer<LDKNodeId> in
2741
+ let mutablePointer = UnsafeMutablePointer<LDKNodeId>(mutating: pointer.baseAddress!)
2742
+ return mutablePointer
2743
+ }
2744
+ */
2745
+
2746
+ let dataContainer = UnsafeMutablePointer< LDKNodeId> . allocate( capacity: array. count)
2747
+ dataContainer. initialize ( from: array, count: array. count)
2748
+
2749
+ let vector = LDKCVec_NodeIdZ ( data: dataContainer, datalen: UInt ( array. count) )
2750
+ let wrapper = LDKCVec_NodeIdZWrapper ( pointer: vector)
2751
+ return wrapper
2752
+ }
2753
+
2754
+ public class LDKCVec_NodeIdZWrapper : NativeTypeWrapper {
2755
+ private static var instanceCounter : UInt = 0
2756
+ internal let instanceNumber : UInt
2757
+
2758
+ internal var cOpaqueStruct : LDKCVec_NodeIdZ ?
2759
+ internal var subdimensionWrapper : [ AnyObject ] ? = nil
2760
+
2761
+ public init ( pointer: LDKCVec_NodeIdZ ) {
2762
+ Self . instanceCounter += 1
2763
+ self . instanceNumber = Self . instanceCounter
2764
+ self . cOpaqueStruct = pointer
2765
+ super. init ( conflictAvoidingVariableName: 0 )
2766
+ }
2767
+
2768
+ internal init ( pointer: LDKCVec_NodeIdZ , subdimensionWrapper: [ AnyObject ] ) {
2769
+ Self . instanceCounter += 1
2770
+ self . instanceNumber = Self . instanceCounter
2771
+ self . subdimensionWrapper = subdimensionWrapper
2772
+ self . cOpaqueStruct = pointer
2773
+ super. init ( conflictAvoidingVariableName: 0 )
2774
+ }
2775
+
2776
+ public func noOpRetain( ) { }
2777
+
2778
+ internal func dangle( dangleSubdimensions: Bool = true ) -> LDKCVec_NodeIdZWrapper {
2779
+ self . dangling = true
2780
+ /* SUBDIMENSION_DANGLE_PREP */
2781
+ return self
2782
+ }
2783
+
2784
+ deinit {
2785
+ if !self . dangling {
2786
+ print ( " Freeing LDKCVec_NodeIdZWrapper \( self . instanceNumber) . " )
2787
+ self . cOpaqueStruct!. data. deallocate ( )
2788
+ } else {
2789
+ print ( " Not freeing LDKCVec_NodeIdZWrapper \( self . instanceNumber) due to dangle. " )
2790
+ }
2791
+ }
2792
+ }
2793
+ /* SWIFT_TO_RUST_END */
2794
+
2795
+ /* RUST_TO_SWIFT_START */
2796
+ public class func LDKCVec_NodeIdZ_to_array( nativeType: LDKCVec_NodeIdZ , deallocate: Bool = true ) -> [ LDKNodeId ] {
2797
+ var array = [ LDKNodeId] ( )
2798
+ for index in 0 ..< Int ( nativeType. datalen) {
2799
+ let currentEntry = nativeType. data [ index]
2800
+ /* CONVERSION_PREP */
2801
+ array. append ( currentEntry)
2802
+ }
2803
+
2804
+ if deallocate && nativeType. datalen > 0 {
2805
+ nativeType. data. deallocate ( )
2806
+ }
2807
+
2808
+ return array
2809
+ }
2810
+ /* RUST_TO_SWIFT_END */
2811
+ public class func extractNativeLDKNodeIdArray( array: [ NodeId ] ) -> [ LDKNodeId ] {
2812
+ return array. map { entry -> LDKNodeId in
2813
+ entry. danglingClone ( ) . cOpaqueStruct!
2814
+ }
2815
+ }
2816
+
2817
+ public class func wrapNativeLDKNodeIdArray( array: [ LDKNodeId ] ) -> [ NodeId ] {
2818
+ return array. map { entry -> NodeId in
2819
+ NodeId ( pointer: entry)
2820
+ }
2821
+ }
2822
+
2823
+ public class func wrapDanglingNativeLDKNodeIdArray( array: [ LDKNodeId ] ) -> [ NodeId ] {
2824
+ return array. map { entry -> NodeId in
2825
+ NodeId ( pointer: entry) . dangle ( )
2826
+ }
2827
+ }
2828
+
2829
+ internal class func cloneNativeLDKNodeIdArray( array: [ LDKNodeId ] ) -> [ LDKNodeId ] {
2830
+ return array. map { entry -> LDKNodeId in
2831
+ // create a wrapper around the native object, dangle it to make it non-destructive, clone it, and then dangle the clone
2832
+ NodeId ( pointer: entry) . dangle ( ) . clone ( ) . dangle ( ) . cOpaqueStruct!
2833
+ }
2834
+ }
2835
+
2836
+
2735
2837
/* SWIFT_TO_RUST_START */
2736
2838
public class func new_LDKCVec_OutPointZWrapper( array: [ LDKOutPoint ] ) -> LDKCVec_OutPointZWrapper {
2737
2839
/* DIMENSION_REDUCTION_PREP */
@@ -3701,6 +3803,91 @@ public class Bindings {
3701
3803
}
3702
3804
3703
3805
3806
+ /* SWIFT_TO_RUST_START */
3807
+ public class func new_LDKCVec_ThirtyTwoBytesZWrapper( array: [ [ UInt8 ] ] ) -> LDKCVec_ThirtyTwoBytesZWrapper {
3808
+
3809
+ var lowerDimension = [ LDKThirtyTwoBytes] ( )
3810
+ // var subdimensionWrapper = [LDKThirtyTwoBytesWrapper]()
3811
+ for currentEntry in array {
3812
+ let convertedEntry = new_LDKThirtyTwoBytes ( array: currentEntry)
3813
+ lowerDimension. append ( convertedEntry)
3814
+ // subdimensionWrapper.append(convertedEntry)
3815
+ }
3816
+
3817
+
3818
+ /*
3819
+ let dataContainer = lowerDimension.withUnsafeBufferPointer { (pointer: UnsafeBufferPointer<LDKThirtyTwoBytes>) -> UnsafeMutablePointer<LDKThirtyTwoBytes> in
3820
+ let mutablePointer = UnsafeMutablePointer<LDKThirtyTwoBytes>(mutating: pointer.baseAddress!)
3821
+ return mutablePointer
3822
+ }
3823
+ */
3824
+
3825
+ let dataContainer = UnsafeMutablePointer< LDKThirtyTwoBytes> . allocate( capacity: array. count)
3826
+ dataContainer. initialize ( from: lowerDimension, count: array. count)
3827
+
3828
+ let vector = LDKCVec_ThirtyTwoBytesZ ( data: dataContainer, datalen: UInt ( array. count) )
3829
+ let wrapper = LDKCVec_ThirtyTwoBytesZWrapper ( pointer: vector)
3830
+ return wrapper
3831
+ }
3832
+
3833
+ public class LDKCVec_ThirtyTwoBytesZWrapper : NativeTypeWrapper {
3834
+ private static var instanceCounter : UInt = 0
3835
+ internal let instanceNumber : UInt
3836
+
3837
+ internal var cOpaqueStruct : LDKCVec_ThirtyTwoBytesZ ?
3838
+ internal var subdimensionWrapper : [ AnyObject ] ? = nil
3839
+
3840
+ public init ( pointer: LDKCVec_ThirtyTwoBytesZ ) {
3841
+ Self . instanceCounter += 1
3842
+ self . instanceNumber = Self . instanceCounter
3843
+ self . cOpaqueStruct = pointer
3844
+ super. init ( conflictAvoidingVariableName: 0 )
3845
+ }
3846
+
3847
+ internal init ( pointer: LDKCVec_ThirtyTwoBytesZ , subdimensionWrapper: [ AnyObject ] ) {
3848
+ Self . instanceCounter += 1
3849
+ self . instanceNumber = Self . instanceCounter
3850
+ self . subdimensionWrapper = subdimensionWrapper
3851
+ self . cOpaqueStruct = pointer
3852
+ super. init ( conflictAvoidingVariableName: 0 )
3853
+ }
3854
+
3855
+ public func noOpRetain( ) { }
3856
+
3857
+ internal func dangle( dangleSubdimensions: Bool = true ) -> LDKCVec_ThirtyTwoBytesZWrapper {
3858
+ self . dangling = true
3859
+ /* SUBDIMENSION_DANGLE_PREP */
3860
+ return self
3861
+ }
3862
+
3863
+ deinit {
3864
+ if !self . dangling {
3865
+ print ( " Freeing LDKCVec_ThirtyTwoBytesZWrapper \( self . instanceNumber) . " )
3866
+ self . cOpaqueStruct!. data. deallocate ( )
3867
+ } else {
3868
+ print ( " Not freeing LDKCVec_ThirtyTwoBytesZWrapper \( self . instanceNumber) due to dangle. " )
3869
+ }
3870
+ }
3871
+ }
3872
+ /* SWIFT_TO_RUST_END */
3873
+
3874
+ /* RUST_TO_SWIFT_START */
3875
+ public class func LDKCVec_ThirtyTwoBytesZ_to_array( nativeType: LDKCVec_ThirtyTwoBytesZ , deallocate: Bool = true ) -> [ [ UInt8 ] ] {
3876
+ var array = [ [ UInt8] ] ( )
3877
+ for index in 0 ..< Int ( nativeType. datalen) {
3878
+ let currentEntry = nativeType. data [ index]
3879
+ let convertedEntry = LDKThirtyTwoBytes_to_array ( nativeType: currentEntry)
3880
+ array. append ( convertedEntry)
3881
+ }
3882
+
3883
+ if deallocate && nativeType. datalen > 0 {
3884
+ nativeType. data. deallocate ( )
3885
+ }
3886
+
3887
+ return array
3888
+ }
3889
+ /* RUST_TO_SWIFT_END */
3890
+
3704
3891
/* SWIFT_TO_RUST_START */
3705
3892
public class func new_LDKCVec_TransactionOutputsZWrapper( array: [ LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ ] ) -> LDKCVec_TransactionOutputsZWrapper {
3706
3893
/* DIMENSION_REDUCTION_PREP */
@@ -3999,18 +4186,26 @@ public class Bindings {
3999
4186
4000
4187
4001
4188
/* SWIFT_TO_RUST_START */
4002
- public class func new_LDKCVec_TxidZWrapper( array: [ LDKThirtyTwoBytes ] ) -> LDKCVec_TxidZWrapper {
4003
- /* DIMENSION_REDUCTION_PREP */
4189
+ public class func new_LDKCVec_TxidZWrapper( array: [ [ UInt8 ] ] ) -> LDKCVec_TxidZWrapper {
4190
+
4191
+ var lowerDimension = [ LDKThirtyTwoBytes] ( )
4192
+ // var subdimensionWrapper = [LDKThirtyTwoBytesWrapper]()
4193
+ for currentEntry in array {
4194
+ let convertedEntry = new_LDKThirtyTwoBytes ( array: currentEntry)
4195
+ lowerDimension. append ( convertedEntry)
4196
+ // subdimensionWrapper.append(convertedEntry)
4197
+ }
4198
+
4004
4199
4005
4200
/*
4006
- let dataContainer = array .withUnsafeBufferPointer { (pointer: UnsafeBufferPointer<LDKThirtyTwoBytes>) -> UnsafeMutablePointer<LDKThirtyTwoBytes> in
4201
+ let dataContainer = lowerDimension .withUnsafeBufferPointer { (pointer: UnsafeBufferPointer<LDKThirtyTwoBytes>) -> UnsafeMutablePointer<LDKThirtyTwoBytes> in
4007
4202
let mutablePointer = UnsafeMutablePointer<LDKThirtyTwoBytes>(mutating: pointer.baseAddress!)
4008
4203
return mutablePointer
4009
4204
}
4010
4205
*/
4011
4206
4012
4207
let dataContainer = UnsafeMutablePointer< LDKThirtyTwoBytes> . allocate( capacity: array. count)
4013
- dataContainer. initialize ( from: array , count: array. count)
4208
+ dataContainer. initialize ( from: lowerDimension , count: array. count)
4014
4209
4015
4210
let vector = LDKCVec_TxidZ ( data: dataContainer, datalen: UInt ( array. count) )
4016
4211
let wrapper = LDKCVec_TxidZWrapper ( pointer: vector)
@@ -4059,12 +4254,12 @@ public class Bindings {
4059
4254
/* SWIFT_TO_RUST_END */
4060
4255
4061
4256
/* RUST_TO_SWIFT_START */
4062
- public class func LDKCVec_TxidZ_to_array( nativeType: LDKCVec_TxidZ , deallocate: Bool = true ) -> [ LDKThirtyTwoBytes ] {
4063
- var array = [ LDKThirtyTwoBytes ] ( )
4257
+ public class func LDKCVec_TxidZ_to_array( nativeType: LDKCVec_TxidZ , deallocate: Bool = true ) -> [ [ UInt8 ] ] {
4258
+ var array = [ [ UInt8 ] ] ( )
4064
4259
for index in 0 ..< Int ( nativeType. datalen) {
4065
4260
let currentEntry = nativeType. data [ index]
4066
- /* CONVERSION_PREP */
4067
- array. append ( currentEntry )
4261
+ let convertedEntry = LDKThirtyTwoBytes_to_array ( nativeType : currentEntry )
4262
+ array. append ( convertedEntry )
4068
4263
}
4069
4264
4070
4265
if deallocate && nativeType. datalen > 0 {
@@ -5263,6 +5458,16 @@ public class Bindings {
5263
5458
5264
5459
CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok ( oPointer)
5265
5460
5461
+ }
5462
+
5463
+ }
5464
+ public class func swift_CResult_NodeAliasDecodeErrorZ_is_ok( o: Result_NodeAliasDecodeErrorZ ) -> Bool {
5465
+
5466
+
5467
+ return withUnsafePointer ( to: o. cOpaqueStruct!) { ( oPointer: UnsafePointer < LDKCResult_NodeAliasDecodeErrorZ > ) in
5468
+
5469
+ CResult_NodeAliasDecodeErrorZ_is_ok ( oPointer)
5470
+
5266
5471
}
5267
5472
5268
5473
}
@@ -6395,7 +6600,7 @@ withUnsafePointer(to: htlc.cOpaqueStruct!) { (htlcPointer: UnsafePointer<LDKHTLC
6395
6600
6396
6601
6397
6602
}
6398
- public class func swift_find_route( our_node_pubkey: [ UInt8 ] , route_params: RouteParameters , network_graph: ReadOnlyNetworkGraph , first_hops: [ ChannelDetails ] ? , logger: Logger , scorer: Score , random_seed_bytes: [ UInt8 ] ) -> Result_RouteLightningErrorZ {
6603
+ public class func swift_find_route( our_node_pubkey: [ UInt8 ] , route_params: RouteParameters , network_graph: NetworkGraph , first_hops: [ ChannelDetails ] ? , logger: Logger , scorer: Score , random_seed_bytes: [ UInt8 ] ) -> Result_RouteLightningErrorZ {
6399
6604
6400
6605
6401
6606
var first_hopsPointer : UnsafeMutablePointer < LDKCVec_ChannelDetailsZ > ? = nil
@@ -6411,7 +6616,7 @@ withUnsafePointer(to: htlc.cOpaqueStruct!) { (htlcPointer: UnsafePointer<LDKHTLC
6411
6616
}
6412
6617
6413
6618
return withUnsafePointer ( to: route_params. cOpaqueStruct!) { ( route_paramsPointer: UnsafePointer < LDKRouteParameters > ) in
6414
- withUnsafePointer ( to: network_graph. cOpaqueStruct!) { ( network_graphPointer: UnsafePointer < LDKReadOnlyNetworkGraph > ) in
6619
+ withUnsafePointer ( to: network_graph. cOpaqueStruct!) { ( network_graphPointer: UnsafePointer < LDKNetworkGraph > ) in
6415
6620
withUnsafePointer ( to: scorer. activateOnce ( ) . cOpaqueStruct!) { ( scorerPointer: UnsafePointer < LDKScore > ) in
6416
6621
withUnsafePointer ( to: Bindings . array_to_tuple32 ( array: random_seed_bytes) ) { ( random_seed_bytesPointer: UnsafePointer < ( UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 ) > ) in
6417
6622
@@ -6423,7 +6628,7 @@ withUnsafePointer(to: Bindings.array_to_tuple32(array: random_seed_bytes)) { (ra
6423
6628
}
6424
6629
6425
6630
}
6426
- public class func swift_build_route_from_hops( our_node_pubkey: [ UInt8 ] , hops: [ [ UInt8 ] ] , route_params: RouteParameters , network_graph: ReadOnlyNetworkGraph , logger: Logger , random_seed_bytes: [ UInt8 ] ) -> Result_RouteLightningErrorZ {
6631
+ public class func swift_build_route_from_hops( our_node_pubkey: [ UInt8 ] , hops: [ [ UInt8 ] ] , route_params: RouteParameters , network_graph: NetworkGraph , logger: Logger , random_seed_bytes: [ UInt8 ] ) -> Result_RouteLightningErrorZ {
6427
6632
6428
6633
6429
6634
let hopsWrapper = Bindings . new_LDKCVec_PublicKeyZWrapper ( array: hops)
@@ -6432,7 +6637,7 @@ withUnsafePointer(to: Bindings.array_to_tuple32(array: random_seed_bytes)) { (ra
6432
6637
}
6433
6638
6434
6639
return withUnsafePointer ( to: route_params. cOpaqueStruct!) { ( route_paramsPointer: UnsafePointer < LDKRouteParameters > ) in
6435
- withUnsafePointer ( to: network_graph. cOpaqueStruct!) { ( network_graphPointer: UnsafePointer < LDKReadOnlyNetworkGraph > ) in
6640
+ withUnsafePointer ( to: network_graph. cOpaqueStruct!) { ( network_graphPointer: UnsafePointer < LDKNetworkGraph > ) in
6436
6641
withUnsafePointer ( to: Bindings . array_to_tuple32 ( array: random_seed_bytes) ) { ( random_seed_bytesPointer: UnsafePointer < ( UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 , UInt8 ) > ) in
6437
6642
6438
6643
Result_RouteLightningErrorZ ( pointer: build_route_from_hops ( Bindings . new_LDKPublicKey ( array: our_node_pubkey) , hopsWrapper. dangle ( ) . cOpaqueStruct!, route_paramsPointer, network_graphPointer, logger. activate ( ) . cOpaqueStruct!, random_seed_bytesPointer) )
@@ -6717,7 +6922,7 @@ withUnsafePointer(to: Bindings.array_to_tuple32(array: random_seed_bytes)) { (ra
6717
6922
*/
6718
6923
6719
6924
public class func get_ldk_swift_bindings_version( ) -> String {
6720
- return " e3dda300a8ce01a15c2f550de4e3b2ca966127a8 "
6925
+ return " bf16d08dc0183ae1d6b43c89990a25182f754675 "
6721
6926
}
6722
6927
6723
6928
}
0 commit comments