diff --git a/LDKNodeMonday.xcodeproj/project.pbxproj b/LDKNodeMonday.xcodeproj/project.pbxproj index 811fceba..b52eb408 100644 --- a/LDKNodeMonday.xcodeproj/project.pbxproj +++ b/LDKNodeMonday.xcodeproj/project.pbxproj @@ -3,14 +3,13 @@ archiveVersion = 1; classes = { }; - objectVersion = 56; + objectVersion = 60; objects = { /* Begin PBXBuildFile section */ 655574802D398A750064F859 /* LoadingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6555747F2D398A750064F859 /* LoadingView.swift */; }; 655574822D3994E10064F859 /* ErrorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 655574812D3994E10064F859 /* ErrorView.swift */; }; 655C19042D42AB1500AC5F72 /* WalletClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 655C19032D42AB1500AC5F72 /* WalletClient.swift */; }; - 65875A932CCB9809000D3E70 /* LDKNode in Frameworks */ = {isa = PBXBuildFile; productRef = 65875A922CCB9809000D3E70 /* LDKNode */; }; 659EE6952CF8D4990064ED78 /* ImportWalletView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659EE6942CF8D4990064ED78 /* ImportWalletView.swift */; }; 65A406632D070CBD00EA331E /* NetworkSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65A406622D070CBD00EA331E /* NetworkSettingsView.swift */; }; AE00550E2B479EF000100797 /* OnboardingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE00550D2B479EF000100797 /* OnboardingView.swift */; }; @@ -81,6 +80,7 @@ AEBFD8B02B8A97DB0024E3F7 /* LightningServiceProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEBFD8AF2B8A97DB0024E3F7 /* LightningServiceProvider.swift */; }; AEBFD8B22B8ABF7C0024E3F7 /* AmountView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEBFD8B12B8ABF7C0024E3F7 /* AmountView.swift */; }; AEBFD8B62B8BABC00024E3F7 /* ReceiveView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEBFD8B52B8BABC00024E3F7 /* ReceiveView.swift */; }; + AED1DBF72D514609008CBD48 /* LDKNode in Frameworks */ = {isa = PBXBuildFile; productRef = AED1DBF62D514609008CBD48 /* LDKNode */; }; AEDF47F12B3FADF900145D64 /* EventService.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEDF47F02B3FADF900145D64 /* EventService.swift */; }; AEDF47F32B3FBAB900145D64 /* Notification+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEDF47F22B3FBAB900145D64 /* Notification+Extensions.swift */; }; AEDF76022B5C6863002DDEE1 /* Optional+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEDF76012B5C6863002DDEE1 /* Optional+Extensions.swift */; }; @@ -179,7 +179,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 65875A932CCB9809000D3E70 /* LDKNode in Frameworks */, + AED1DBF72D514609008CBD48 /* LDKNode in Frameworks */, AE060C382C051B59006724F1 /* LDKNode in Frameworks */, AE1D9BEC2B2A1FFD00620748 /* BitcoinUI in Frameworks */, AEE5B7652A09B1FC001E5E59 /* CodeScanner in Frameworks */, @@ -557,7 +557,7 @@ AE7C4A072B406D590061189D /* SimpleToast */, AE060C372C051B59006724F1 /* LDKNode */, AE80C2042C4AB5E4006E7193 /* LDKNode */, - 65875A922CCB9809000D3E70 /* LDKNode */, + AED1DBF62D514609008CBD48 /* LDKNode */, ); productName = LDKNodeMonday; productReference = AE17E8D629A402E30058C9C9 /* LDKNodeMonday.app */; @@ -592,7 +592,7 @@ AE01C5AE2AB3BEED00F28C7E /* XCRemoteSwiftPackageReference "KeychainAccess" */, AE1D9BEA2B2A1FFD00620748 /* XCRemoteSwiftPackageReference "BitcoinUI" */, AE7C4A062B406D590061189D /* XCRemoteSwiftPackageReference "SimpleToast" */, - 65875A912CCB9809000D3E70 /* XCRemoteSwiftPackageReference "ldk-node" */, + AED1DBF52D514609008CBD48 /* XCLocalSwiftPackageReference "../ldk-node/bindings/swift" */, ); productRefGroup = AE17E8D729A402E30058C9C9 /* Products */; projectDirPath = ""; @@ -907,15 +907,14 @@ }; /* End XCConfigurationList section */ -/* Begin XCRemoteSwiftPackageReference section */ - 65875A912CCB9809000D3E70 /* XCRemoteSwiftPackageReference "ldk-node" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/lightningdevkit/ldk-node.git"; - requirement = { - kind = exactVersion; - version = 0.4.3; - }; +/* Begin XCLocalSwiftPackageReference section */ + AED1DBF52D514609008CBD48 /* XCLocalSwiftPackageReference "../ldk-node/bindings/swift" */ = { + isa = XCLocalSwiftPackageReference; + relativePath = "../ldk-node/bindings/swift"; }; +/* End XCLocalSwiftPackageReference section */ + +/* Begin XCRemoteSwiftPackageReference section */ AE01C5AE2AB3BEED00F28C7E /* XCRemoteSwiftPackageReference "KeychainAccess" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/kishikawakatsumi/KeychainAccess.git"; @@ -951,11 +950,6 @@ /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ - 65875A922CCB9809000D3E70 /* LDKNode */ = { - isa = XCSwiftPackageProductDependency; - package = 65875A912CCB9809000D3E70 /* XCRemoteSwiftPackageReference "ldk-node" */; - productName = LDKNode; - }; AE01C5AF2AB3BEED00F28C7E /* KeychainAccess */ = { isa = XCSwiftPackageProductDependency; package = AE01C5AE2AB3BEED00F28C7E /* XCRemoteSwiftPackageReference "KeychainAccess" */; @@ -983,6 +977,10 @@ isa = XCSwiftPackageProductDependency; productName = LDKNode; }; + AED1DBF62D514609008CBD48 /* LDKNode */ = { + isa = XCSwiftPackageProductDependency; + productName = LDKNode; + }; AEE5B7642A09B1FC001E5E59 /* CodeScanner */ = { isa = XCSwiftPackageProductDependency; package = AEE5B7632A09B1FC001E5E59 /* XCRemoteSwiftPackageReference "CodeScanner" */; diff --git a/LDKNodeMonday.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/LDKNodeMonday.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index e691a046..d27e5b54 100644 --- a/LDKNodeMonday.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/LDKNodeMonday.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "3c4f831e3e2d84e3d749572be35ef446cf04910008de67451a51af6ca58e22b3", + "originHash" : "2d457a0d145c5ec561d10ae3f13d805b262d5bfda9ebf0868311848416a25b6e", "pins" : [ { "identity" : "bitcoinui", @@ -28,15 +28,6 @@ "version" : "4.2.2" } }, - { - "identity" : "ldk-node", - "kind" : "remoteSourceControl", - "location" : "https://github.com/lightningdevkit/ldk-node.git", - "state" : { - "revision" : "a5c4a44dd44f098acec6c244a63d4ebb5d794132", - "version" : "0.4.3" - } - }, { "identity" : "simpletoast", "kind" : "remoteSourceControl", diff --git a/LDKNodeMonday/Extensions/Event+Extensions.swift b/LDKNodeMonday/Extensions/Event+Extensions.swift index 039ae22a..36fc3fb2 100644 --- a/LDKNodeMonday/Extensions/Event+Extensions.swift +++ b/LDKNodeMonday/Extensions/Event+Extensions.swift @@ -14,14 +14,14 @@ extension Event: CustomStringConvertible { switch self { - case .paymentSuccessful(_, let paymentHash, _): + case .paymentSuccessful(_, let paymentHash, _, _): return "Payment Successful \(paymentHash.truncated(toLength: 10))" case .paymentFailed(_, let paymentHash, let paymentFailureReason): return "Payment Failed \(paymentFailureReason.debugDescription) \(String(describing: paymentHash?.truncated(toLength: 10)))" - case .paymentReceived(_, _, let amountMsat): + case .paymentReceived(_, _, let amountMsat, _): let formatted = amountMsat.formattedAmount() return "Payment Received \(formatted) sats" @@ -36,11 +36,26 @@ extension Event: CustomStringConvertible { return "Channel Closed \(debugReason) \(counterpartyNodeId?.truncated(toLength: 10) ?? "")" + case .paymentForwarded( + let prevChannelId, + let nextChannelId, + let prevUserChannelId, + let nextUserChannelId, + let prevNodeId, + let nextNodeId, + let totalFeeEarnedMsat, + let skimmedFeeMsat, + let claimFromOnchainTx, + let outboundAmountForwardedMsat + ): + return "Payment Forwarded" + case .paymentClaimable( let paymentId, let paymentHash, let claimableAmountMsat, - let claimDeadline + let claimDeadline, + let customRecords ): return "Payment Claimable \(paymentHash.truncated(toLength: 10))" diff --git a/LDKNodeMonday/Service/Lightning Service/LightningNodeService.swift b/LDKNodeMonday/Service/Lightning Service/LightningNodeService.swift index 62979432..86f00424 100644 --- a/LDKNodeMonday/Service/Lightning Service/LightningNodeService.swift +++ b/LDKNodeMonday/Service/Lightning Service/LightningNodeService.swift @@ -72,14 +72,26 @@ class LightningNodeService { withIntermediateDirectories: true ) + // This is what `Config` looks like now, need to find out where `logDirPath` and `logLevel` are now + + // public struct Config { + // public var storageDirPath: String + // public var network: Network + // public var listeningAddresses: [SocketAddress]? + // public var nodeAlias: NodeAlias? + // public var trustedPeers0conf: [PublicKey] + // public var probingLiquidityLimitMultiplier: UInt64 + // public var anchorChannelsConfig: AnchorChannelsConfig? + // public var sendingParameters: SendingParameters? + var config = defaultConfig() config.storageDirPath = networkPath - config.logDirPath = logPath + //config.logDirPath = logPath config.network = self.network config.trustedPeers0conf = [ Constants.Config.LiquiditySourceLsps2.Signet.lqwd.nodeId ] - config.logLevel = .trace + //config.logLevel = .trace let nodeBuilder = Builder.fromConfig(config: config) nodeBuilder.setChainSourceEsplora(serverUrl: self.server.url, config: nil) @@ -253,7 +265,7 @@ class LightningNodeService { func receiveViaJitChannel( amountMsat: UInt64, - description: String, + description: Bolt11InvoiceDescription, expirySecs: UInt32, maxLspFeeLimitMsat: UInt64? ) async throws -> Bolt11Invoice { @@ -349,7 +361,8 @@ public struct LightningNodeClient { let closeChannel: (ChannelId, PublicKey) throws -> Void let send: (String) async throws -> QrPaymentResult let receive: (UInt64, String, UInt32) async throws -> String - let receiveViaJitChannel: (UInt64, String, UInt32, UInt64?) async throws -> Bolt11Invoice + let receiveViaJitChannel: + (UInt64, Bolt11InvoiceDescription, UInt32, UInt64?) async throws -> Bolt11Invoice let listPeers: () -> [PeerDetails] let listChannels: () -> [ChannelDetails] let listPayments: () -> [PaymentDetails] diff --git a/LDKNodeMonday/Service/Lightning Service/LightningServiceError.swift b/LDKNodeMonday/Service/Lightning Service/LightningServiceError.swift index 976bd376..bcfb8dd8 100644 --- a/LDKNodeMonday/Service/Lightning Service/LightningServiceError.swift +++ b/LDKNodeMonday/Service/Lightning Service/LightningServiceError.swift @@ -164,6 +164,9 @@ func handleNodeError(_ error: NodeError) -> MondayError { case .InvalidNodeAlias(let message): return .init(title: "InvalidNodeAlias", detail: message) + case .InvalidCustomTlvs(let message): + return .init(title: "InvalidCustomTlvs", detail: message) + } } diff --git a/LDKNodeMonday/View Model/Home/Receive/JITInvoiceViewModel.swift b/LDKNodeMonday/View Model/Home/Receive/JITInvoiceViewModel.swift index 3fabe54f..fb0b8177 100644 --- a/LDKNodeMonday/View Model/Home/Receive/JITInvoiceViewModel.swift +++ b/LDKNodeMonday/View Model/Home/Receive/JITInvoiceViewModel.swift @@ -24,7 +24,7 @@ class JITInvoiceViewModel: ObservableObject { func receivePaymentViaJitChannel( amountMsat: UInt64, - description: String, + description: Bolt11InvoiceDescription, expirySecs: UInt32, maxLspFeeLimitMsat: UInt64? ) async { diff --git a/LDKNodeMonday/View/Home/Receive/JITInvoiceView.swift b/LDKNodeMonday/View/Home/Receive/JITInvoiceView.swift index 555620a5..c2125160 100644 --- a/LDKNodeMonday/View/Home/Receive/JITInvoiceView.swift +++ b/LDKNodeMonday/View/Home/Receive/JITInvoiceView.swift @@ -44,7 +44,7 @@ struct JITInvoiceView: View { let amountMsat = (UInt64(viewModel.amountMsat) ?? 0) * 1000 await viewModel.receivePaymentViaJitChannel( amountMsat: amountMsat, - description: "Monday Wallet", + description: .direct(description: "Monday Wallet"), expirySecs: UInt32(3600), maxLspFeeLimitMsat: nil ) diff --git a/LDKNodeMonday/View/Settings/Channel/ChannelDetailView.swift b/LDKNodeMonday/View/Settings/Channel/ChannelDetailView.swift index a3c80dd2..ea876b68 100644 --- a/LDKNodeMonday/View/Settings/Channel/ChannelDetailView.swift +++ b/LDKNodeMonday/View/Settings/Channel/ChannelDetailView.swift @@ -124,6 +124,9 @@ struct ChannelDetailView: View { channelId: ChannelId(stringLiteral: "channelID"), counterpartyNodeId: PublicKey(stringLiteral: "counterpartyNodeId"), fundingTxo: nil, + shortChannelId: UInt64(1_000_000), + outboundScidAlias: UInt64(1_000_000), + inboundScidAlias: UInt64(1_000_000), channelValueSats: UInt64(1_000_000), unspendablePunishmentReserve: nil, userChannelId: UserChannelId(stringLiteral: "userChannelId"),