Skip to content

Commit 6224669

Browse files
committed
Don't prefix static methods with swift wherever avoidable.
1 parent 6828f0c commit 6224669

16 files changed

+85
-76
lines changed

ci/LDKSwift/Sources/LDKSwift/batteries/ChannelManagerConstructor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public struct ChannelManagerConstructionParameters {
5757
Bindings.print(errorString, severity: .ERROR)
5858
return .initWithErr(e: LightningError(errArg: errorString, actionArg: ErrorAction.initWithIgnoreAndLog(a: .Error)))
5959
}
60-
override func findRouteWithId(payer: [UInt8], routeParams: Bindings.RouteParameters, firstHops: [Bindings.ChannelDetails]?, inflightHtlcs: Bindings.InFlightHtlcs, PaymentHash: [UInt8], PaymentId: [UInt8]) -> Bindings.Result_RouteLightningErrorZ {
60+
override func findRouteWithId(payer: [UInt8], routeParams: Bindings.RouteParameters, firstHops: [Bindings.ChannelDetails]?, inflightHtlcs: Bindings.InFlightHtlcs, paymentHash PaymentHash: [UInt8], paymentId PaymentId: [UInt8]) -> Bindings.Result_RouteLightningErrorZ {
6161
let errorString = "Error: Router unavailable: ChannelManagerConstructor initialized without Scorer or NetworkGraph."
6262
Bindings.print(errorString, severity: .ERROR)
6363
return .initWithErr(e: LightningError(errArg: errorString, actionArg: ErrorAction.initWithIgnoreAndLog(a: .Error)))

ci/LDKSwift/Tests/LDKSwiftTests/HumanObjectPeerTestInstance.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ public class HumanObjectPeerTestInstance {
645645
do {
646646
// create invoice for 10k satoshis to pay to peer2
647647

648-
let invoiceResult = Bindings.swiftCreateInvoiceFromChannelmanager(channelmanager: peer2.channelManager, nodeSigner: peer2.explicitKeysManager.asNodeSigner(), logger: logger, network: .Bitcoin, amtMsat: SEND_MSAT_AMOUNT_A_TO_B, description: "Invoice description", invoiceExpiryDeltaSecs: 60, minFinalCltvExpiryDelta: 24)
648+
let invoiceResult = Bindings.createInvoiceFromChannelmanager(channelmanager: peer2.channelManager, nodeSigner: peer2.explicitKeysManager.asNodeSigner(), logger: logger, network: .Bitcoin, amtMsat: SEND_MSAT_AMOUNT_A_TO_B, description: "Invoice description", invoiceExpiryDeltaSecs: 60, minFinalCltvExpiryDelta: 24)
649649
if let invoiceError = invoiceResult.getError(){
650650
let creationError = invoiceError.getValueAsCreationError()
651651
print("creation error: \(creationError)")
@@ -657,7 +657,7 @@ public class HumanObjectPeerTestInstance {
657657
XCTAssertTrue(recreatedInvoice.isOk())
658658

659659
let channelManagerConstructor = peer1.constructor!
660-
let invoicePaymentResult = Bindings.swiftPayInvoice(invoice: invoice, retryStrategy: Bindings.Retry.initWithAttempts(a: 3), channelmanager: channelManagerConstructor.channelManager)
660+
let invoicePaymentResult = Bindings.payInvoice(invoice: invoice, retryStrategy: Bindings.Retry.initWithAttempts(a: 3), channelmanager: channelManagerConstructor.channelManager)
661661
XCTAssertTrue(invoicePaymentResult.isOk())
662662

663663
do {
@@ -767,15 +767,15 @@ public class HumanObjectPeerTestInstance {
767767
print("pre-payment balance A->B mSats: \(prePaymentBalanceAToB)")
768768
print("pre-payment balance B->A mSats: \(prePaymentBalanceBToA)")
769769

770-
let invoiceResult = Bindings.swiftCreateInvoiceFromChannelmanager(channelmanager: peer1.channelManager, nodeSigner: peer1.explicitKeysManager.asNodeSigner(), logger: logger, network: .Bitcoin, amtMsat: nil, description: "Second invoice description", invoiceExpiryDeltaSecs: 60, minFinalCltvExpiryDelta: 24)
770+
let invoiceResult = Bindings.createInvoiceFromChannelmanager(channelmanager: peer1.channelManager, nodeSigner: peer1.explicitKeysManager.asNodeSigner(), logger: logger, network: .Bitcoin, amtMsat: nil, description: "Second invoice description", invoiceExpiryDeltaSecs: 60, minFinalCltvExpiryDelta: 24)
771771
let invoice = invoiceResult.getValue()!
772772
print("Implicit amount invoice: \(invoice.toStr())")
773773

774774
let invoiceString = invoice.toStr()
775775
let recreatedInvoice = Invoice.fromStr(s: invoiceString)
776776
XCTAssertTrue(recreatedInvoice.isOk())
777777

778-
let invoicePaymentResult = Bindings.swiftPayZeroValueInvoice(invoice: invoice, amountMsats: SEND_MSAT_AMOUNT_B_TO_A, retryStrategy: Retry.initWithAttempts(a: 3), channelmanager: peer2.channelManager)
778+
let invoicePaymentResult = Bindings.payZeroValueInvoice(invoice: invoice, amountMsats: SEND_MSAT_AMOUNT_B_TO_A, retryStrategy: Retry.initWithAttempts(a: 3), channelmanager: peer2.channelManager)
779779
if let error = invoicePaymentResult.getError() {
780780
print("value type: \(error.getValueType())")
781781
if let routingError = error.getValueAsSending() {

ci/LDKSwift/Tests/LDKSwiftTests/LDKSwiftTests.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ class LDKSwiftTests: XCTestCase {
3030
func testVersionSanity() throws {
3131
check_get_ldk_version()
3232
check_get_ldk_bindings_version()
33+
Bindings.getLDKSwiftBindingsSerializationHash()
34+
Bindings.getLDKSwiftBindingsVersion()
35+
Bindings.getLDKSwiftBindingsCommitHash()
36+
Bindings.ldkGetCompiledVersion()
37+
Bindings.ldkCBindingsGetCompiledVersion()
3338
// check_platform()
3439
}
3540

@@ -421,7 +426,7 @@ class LDKSwiftTests: XCTestCase {
421426
let firstHops: [ChannelDetails]? = nil
422427
print("STEP B")
423428
let randomSeedBytes: [UInt8] = [UInt8](repeating: 0, count: 32)
424-
let foundRoute = Bindings.swiftFindRoute(ourNodePubkey: payerPubkey, routeParams: routeParameters, networkGraph: networkGraph, firstHops: [], logger: logger, scorer: score, randomSeedBytes: randomSeedBytes)
429+
let foundRoute = Bindings.findRoute(ourNodePubkey: payerPubkey, routeParams: routeParameters, networkGraph: networkGraph, firstHops: [], logger: logger, scorer: score, randomSeedBytes: randomSeedBytes)
425430
// let foundRoute = router.find_route(payer: payerPubkey, route_params: routeParameters, payment_hash: nil, first_hops: firstHops, inflight_htlcs: <#T##InFlightHtlcs#>)
426431

427432
if let routeError = foundRoute.getError() {

0 commit comments

Comments
 (0)