// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "LDKSwift",
- dependencies: ["LDKCHeaders"]),
+ dependencies: ["LDKCHeaders"],
+ linkerSettings: [
+ .linkedLibrary("/root/ldk-c-bindings/lightning-c-bindings/target/debug/libldk.a"),
+ .linkedLibrary("/root/ldk-c-bindings/lightning-c-bindings/ldk_net.o")
+ ]),
.testTarget(
name: "LDKSwiftTests",
dependencies: ["LDKSwift"]),
}
self.isBound = true
var addressObject = sockaddr_in()
- addressObject.sin_len = UInt8(MemoryLayout.size(ofValue: addressObject))
addressObject.sin_family = sa_family_t(AF_INET)
- addressObject.sin_port = CFSwapInt16HostToBig(port)
+ addressObject.sin_port = port.bigEndian
addressObject.sin_addr.s_addr = inet_addr(address)
- let sin_length = addressObject.sin_len
+ let sin_length = UInt8(MemoryLayout.size(ofValue: addressObject))
let result = withUnsafePointer(to: &addressObject, { addressPointer in
public func connect(address: String, port: UInt16, theirNodeId: [UInt8]) -> Bool {
var addressObject = sockaddr_in()
- addressObject.sin_len = UInt8(MemoryLayout.size(ofValue: addressObject))
addressObject.sin_family = sa_family_t(AF_INET)
- addressObject.sin_port = CFSwapInt16HostToBig(port)
+ addressObject.sin_port = port.bigEndian
addressObject.sin_addr.s_addr = inet_addr(address)
- let sin_length = addressObject.sin_len
+ let sin_length = UInt8(MemoryLayout.size(ofValue: addressObject))
let publicKey = Bindings.new_LDKPublicKey(array: theirNodeId)
let result = withUnsafePointer(to: &addressObject, { addressPointer in
import Foundation
import LDKSwift
+import LDKCHeaders
public class HumanObjectPeerTestInstance {
fileprivate class TestPersister: Persist {
override func persist_new_channel(id: OutPoint, data: ChannelMonitor) -> Result_NoneChannelMonitorUpdateErrZ {
- var result = Result_NoneChannelMonitorUpdateErrZ()
- result.cOpaqueStruct!.result_ok = true
- return result
+ return Result_NoneChannelMonitorUpdateErrZ()
}
override func update_persisted_channel(id: OutPoint, update: ChannelMonitorUpdate, data: ChannelMonitor) -> Result_NoneChannelMonitorUpdateErrZ {
- var result = Result_NoneChannelMonitorUpdateErrZ()
- result.cOpaqueStruct!.result_ok = true
- return result
+ return Result_NoneChannelMonitorUpdateErrZ()
}
}
+++ /dev/null
-import XCTest
-@testable import LDKSwift
-@testable import LDKCHeaders
-
-final class LDKSwiftTests: XCTestCase {
- func testExample() {
- // This is an example of a functional test case.
- // Use XCTAssert and related functions to verify your tests produce the correct
- // results.
- XCTAssertEqual(check_get_ldk_version(), "Hello, World!")
- }
-}
--- /dev/null
+//
+// MyFeeEstimator.swift
+// LDKSwiftARC
+//
+// Created by Arik Sosman on 5/17/21.
+//
+
+import Foundation
+import LDKSwift
+import LDKCHeaders
+
+class MyFeeEstimator: FeeEstimator {
+
+ override func get_est_sat_per_1000_weight(confirmation_target: LDKConfirmationTarget) -> UInt32 {
+ return 253
+ }
+
+}
--- /dev/null
+//
+// MyLogger.swift
+// LDKSwiftARC
+//
+// Created by Arik Sosman on 5/17/21.
+//
+
+import Foundation
+import LDKSwift
+
+class MyLogger: Logger {
+
+ override func log(record: String?) {
+ print("record: \(record)")
+ }
+
+}