Skip to content

Commit 4cb5360

Browse files
committed
Regenerate Swift files for 109.
1 parent aee5cc7 commit 4cb5360

19 files changed

+828
-81
lines changed

ci/LDKSwift/Sources/LDKSwift/bindings/Bindings.swift

Lines changed: 218 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2732,6 +2732,108 @@ public class Bindings {
27322732
}
27332733

27342734

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+
27352837
/* SWIFT_TO_RUST_START */
27362838
public class func new_LDKCVec_OutPointZWrapper(array: [LDKOutPoint]) -> LDKCVec_OutPointZWrapper {
27372839
/* DIMENSION_REDUCTION_PREP */
@@ -3701,6 +3803,91 @@ public class Bindings {
37013803
}
37023804

37033805

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+
37043891
/* SWIFT_TO_RUST_START */
37053892
public class func new_LDKCVec_TransactionOutputsZWrapper(array: [LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ]) -> LDKCVec_TransactionOutputsZWrapper {
37063893
/* DIMENSION_REDUCTION_PREP */
@@ -3999,18 +4186,26 @@ public class Bindings {
39994186

40004187

40014188
/* 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+
40044199

40054200
/*
4006-
let dataContainer = array.withUnsafeBufferPointer { (pointer: UnsafeBufferPointer<LDKThirtyTwoBytes>) -> UnsafeMutablePointer<LDKThirtyTwoBytes> in
4201+
let dataContainer = lowerDimension.withUnsafeBufferPointer { (pointer: UnsafeBufferPointer<LDKThirtyTwoBytes>) -> UnsafeMutablePointer<LDKThirtyTwoBytes> in
40074202
let mutablePointer = UnsafeMutablePointer<LDKThirtyTwoBytes>(mutating: pointer.baseAddress!)
40084203
return mutablePointer
40094204
}
40104205
*/
40114206

40124207
let dataContainer = UnsafeMutablePointer<LDKThirtyTwoBytes>.allocate(capacity: array.count)
4013-
dataContainer.initialize(from: array, count: array.count)
4208+
dataContainer.initialize(from: lowerDimension, count: array.count)
40144209

40154210
let vector = LDKCVec_TxidZ(data: dataContainer, datalen: UInt(array.count))
40164211
let wrapper = LDKCVec_TxidZWrapper(pointer: vector)
@@ -4059,12 +4254,12 @@ public class Bindings {
40594254
/* SWIFT_TO_RUST_END */
40604255

40614256
/* 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]]()
40644259
for index in 0..<Int(nativeType.datalen) {
40654260
let currentEntry = nativeType.data[index]
4066-
/* CONVERSION_PREP */
4067-
array.append(currentEntry)
4261+
let convertedEntry = LDKThirtyTwoBytes_to_array(nativeType: currentEntry)
4262+
array.append(convertedEntry)
40684263
}
40694264

40704265
if deallocate && nativeType.datalen > 0 {
@@ -5263,6 +5458,16 @@ public class Bindings {
52635458

52645459
CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(oPointer)
52655460

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+
52665471
}
52675472

52685473
}
@@ -6395,7 +6600,7 @@ withUnsafePointer(to: htlc.cOpaqueStruct!) { (htlcPointer: UnsafePointer<LDKHTLC
63956600

63966601

63976602
}
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 {
63996604

64006605

64016606
var first_hopsPointer: UnsafeMutablePointer<LDKCVec_ChannelDetailsZ>? = nil
@@ -6411,7 +6616,7 @@ withUnsafePointer(to: htlc.cOpaqueStruct!) { (htlcPointer: UnsafePointer<LDKHTLC
64116616
}
64126617

64136618
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
64156620
withUnsafePointer(to: scorer.activateOnce().cOpaqueStruct!) { (scorerPointer: UnsafePointer<LDKScore>) in
64166621
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
64176622

@@ -6423,7 +6628,7 @@ withUnsafePointer(to: Bindings.array_to_tuple32(array: random_seed_bytes)) { (ra
64236628
}
64246629

64256630
}
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 {
64276632

64286633

64296634
let hopsWrapper = Bindings.new_LDKCVec_PublicKeyZWrapper(array: hops)
@@ -6432,7 +6637,7 @@ withUnsafePointer(to: Bindings.array_to_tuple32(array: random_seed_bytes)) { (ra
64326637
}
64336638

64346639
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
64366641
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
64376642

64386643
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
67176922
*/
67186923

67196924
public class func get_ldk_swift_bindings_version() -> String {
6720-
return "e3dda300a8ce01a15c2f550de4e3b2ca966127a8"
6925+
return "bf16d08dc0183ae1d6b43c89990a25182f754675"
67216926
}
67226927

67236928
}

ci/LDKSwift/Sources/LDKSwift/bindings/options/EffectiveCapacity.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ EffectiveCapacity_clone(origPointer)
114114
return EffectiveCapacity(pointer: EffectiveCapacity_maximum_htlc(amount_msat));
115115
}
116116

117-
public class func total(capacity_msat: UInt64) -> EffectiveCapacity {
117+
public class func total(capacity_msat: UInt64, htlc_maximum_msat: Option_u64Z) -> EffectiveCapacity {
118118

119-
return EffectiveCapacity(pointer: EffectiveCapacity_total(capacity_msat));
119+
return EffectiveCapacity(pointer: EffectiveCapacity_total(capacity_msat, htlc_maximum_msat.danglingClone().cOpaqueStruct!));
120120
}
121121

122122
public class func infinite() -> EffectiveCapacity {
@@ -211,6 +211,10 @@ EffectiveCapacity_as_msat(this_argPointer)
211211
return self.cOpaqueStruct!.capacity_msat
212212
}
213213

214+
public func getHtlc_maximum_msat() -> Option_u64Z {
215+
return Option_u64Z(pointer: self.cOpaqueStruct!.htlc_maximum_msat, anchor: self)
216+
}
217+
214218

215219
}
216220

0 commit comments

Comments
 (0)