commit 336a868b01da99375931f08fa216419d2d561fc2
parent 184c2a7a1d9b244e222b5126826236667d13c40a
Author: William Casarin <jb55@jb55.com>
Date: Wed, 2 Mar 2022 11:27:49 -0800
fix bug in listfunds
sometimes we don't have short_channel_id
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
5 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/TODO b/TODO
@@ -7,3 +7,4 @@ subscriptions
alert confirmation on reset @ux
encrypt token with secure enclave @security
deterministic nodeid for more secure tokens with id restrictions @security
+(B) decodepay when paying
diff --git a/lightninglink.xcodeproj/project.pbxproj b/lightninglink.xcodeproj/project.pbxproj
@@ -525,9 +525,10 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
+ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 2;
+ CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"lightninglink/Preview Content\"";
DEVELOPMENT_TEAM = XK7H4JAB3D;
ENABLE_PREVIEWS = YES;
@@ -548,7 +549,7 @@
"$(inherited)",
"$(PROJECT_DIR)/lnsocket/target/ios",
);
- MARKETING_VERSION = 0.1;
+ MARKETING_VERSION = 0.1.2;
PRODUCT_BUNDLE_IDENTIFIER = com.jb55.lightninglink;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -564,9 +565,10 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
+ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 2;
+ CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"lightninglink/Preview Content\"";
DEVELOPMENT_TEAM = XK7H4JAB3D;
ENABLE_PREVIEWS = YES;
@@ -587,7 +589,7 @@
"$(inherited)",
"$(PROJECT_DIR)/lnsocket/target/ios",
);
- MARKETING_VERSION = 0.1;
+ MARKETING_VERSION = 0.1.2;
PRODUCT_BUNDLE_IDENTIFIER = com.jb55.lightninglink;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
diff --git a/lightninglink/RPC.swift b/lightninglink/RPC.swift
@@ -42,7 +42,6 @@ public struct Channel: Decodable {
public var peer_id: String
public var connected: Bool
public var state: String
- public var short_channel_id: String
public var channel_sat: Int64
public var channel_total_sat: Int64
public var funding_txid: String
@@ -50,8 +49,8 @@ public struct Channel: Decodable {
}
public struct ListFunds: Decodable {
- public var outputs: [Output]
- public var channels: [Channel]
+ public var outputs: [Output]?
+ public var channels: [Channel]?
public static var empty = ListFunds(outputs: [], channels: [])
}
diff --git a/lightninglink/Views/ContentView.swift b/lightninglink/Views/ContentView.swift
@@ -49,11 +49,14 @@ struct Funds {
var onchain_sats: Int64 = 0
var channel_sats: Int64 = 0
- for channel in fs.channels {
+ let channels = fs.channels ?? []
+ let outputs = fs.outputs ?? []
+
+ for channel in channels {
channel_sats += channel.channel_sat
}
- for output in fs.outputs {
+ for output in outputs {
onchain_sats += output.value
}
diff --git a/lightninglink/Views/SetupView.swift b/lightninglink/Views/SetupView.swift
@@ -216,7 +216,7 @@ func validate_connection(lnlink: LNLink, completion: @escaping (SetupResult) ->
let funds_res = rpc_listfunds(ln: ln, token: lnlink.token)
switch funds_res {
- case .failure:
+ case .failure(let err):
completion(.success(getinfo, .empty))
case .success(let listfunds):
completion(.success(getinfo, listfunds))