Skip to content

Commit 587f507

Browse files
committed
Integrate LDK onchain events
1 parent c5abceb commit 587f507

File tree

12 files changed

+889
-479
lines changed

12 files changed

+889
-479
lines changed

Bitkit.xcodeproj/project.pbxproj

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
186523ED2ED7365100485B41 /* LDKNode in Frameworks */ = {isa = PBXBuildFile; productRef = 186523EC2ED7365100485B41 /* LDKNode */; };
1011
18D65E002EB964B500252335 /* VssRustClientFfi in Frameworks */ = {isa = PBXBuildFile; productRef = 18D65DFF2EB964B500252335 /* VssRustClientFfi */; };
1112
18D65E022EB964BD00252335 /* VssRustClientFfi in Frameworks */ = {isa = PBXBuildFile; productRef = 18D65E012EB964BD00252335 /* VssRustClientFfi */; };
1213
4AAB08CA2E1FE77600BA63DF /* Lottie in Frameworks */ = {isa = PBXBuildFile; productRef = 4AAB08C92E1FE77600BA63DF /* Lottie */; };
@@ -17,7 +18,6 @@
1718
96204B782DE9AA43007BAA26 /* SQLite in Frameworks */ = {isa = PBXBuildFile; productRef = 96204B772DE9AA43007BAA26 /* SQLite */; };
1819
966DE6702C51210000A7B0EF /* LightningDevKit in Frameworks */ = {isa = PBXBuildFile; productRef = 966DE66F2C51210000A7B0EF /* LightningDevKit */; };
1920
968FDF162DFAFE230053CD7F /* LDKNode in Frameworks */ = {isa = PBXBuildFile; productRef = 9613018B2C5022D700878183 /* LDKNode */; };
20-
968FE1402DFB016B0053CD7F /* LDKNode in Frameworks */ = {isa = PBXBuildFile; productRef = 968FE13F2DFB016B0053CD7F /* LDKNode */; };
2121
96DEA03A2DE8BBA1009932BF /* BitkitCore in Frameworks */ = {isa = PBXBuildFile; productRef = 96DEA0392DE8BBA1009932BF /* BitkitCore */; };
2222
96DEA03C2DE8BBAB009932BF /* BitkitCore in Frameworks */ = {isa = PBXBuildFile; productRef = 96DEA03B2DE8BBAB009932BF /* BitkitCore */; };
2323
96E20CD42CB6D91A00C24149 /* CodeScanner in Frameworks */ = {isa = PBXBuildFile; productRef = 96E20CD32CB6D91A00C24149 /* CodeScanner */; };
@@ -94,7 +94,6 @@
9494
Services/MigrationsService.swift,
9595
Services/ServiceQueue.swift,
9696
Services/VssStoreIdProvider.swift,
97-
Utilities/AddressChecker.swift,
9897
Utilities/Crypto.swift,
9998
Utilities/Errors.swift,
10099
Utilities/Keychain.swift,
@@ -118,7 +117,6 @@
118117
Services/LightningService.swift,
119118
Services/ServiceQueue.swift,
120119
Services/VssStoreIdProvider.swift,
121-
Utilities/AddressChecker.swift,
122120
Utilities/Crypto.swift,
123121
Utilities/Errors.swift,
124122
Utilities/Keychain.swift,
@@ -148,8 +146,8 @@
148146
isa = PBXFrameworksBuildPhase;
149147
buildActionMask = 2147483647;
150148
files = (
151-
968FE1402DFB016B0053CD7F /* LDKNode in Frameworks */,
152149
96DEA03C2DE8BBAB009932BF /* BitkitCore in Frameworks */,
150+
186523ED2ED7365100485B41 /* LDKNode in Frameworks */,
153151
4AFCA3722E0596D900205CAE /* Zip in Frameworks */,
154152
96E493A82C943184000E8BC2 /* secp256k1 in Frameworks */,
155153
18D65E022EB964BD00252335 /* VssRustClientFfi in Frameworks */,
@@ -241,8 +239,8 @@
241239
96E493A72C943184000E8BC2 /* secp256k1 */,
242240
96DEA03B2DE8BBAB009932BF /* BitkitCore */,
243241
4AFCA3712E0596D900205CAE /* Zip */,
244-
968FE13F2DFB016B0053CD7F /* LDKNode */,
245242
18D65E012EB964BD00252335 /* VssRustClientFfi */,
243+
186523EC2ED7365100485B41 /* LDKNode */,
246244
);
247245
productName = BitkitNotification;
248246
productReference = 961058DC2C355B5500E1F1D8 /* BitkitNotification.appex */;
@@ -383,9 +381,9 @@
383381
96E20CD22CB6D91A00C24149 /* XCRemoteSwiftPackageReference "CodeScanner" */,
384382
96DEA0382DE8BBA1009932BF /* XCRemoteSwiftPackageReference "bitkit-core" */,
385383
4AFCA36E2E05933800205CAE /* XCRemoteSwiftPackageReference "Zip" */,
386-
968FE13E2DFB016B0053CD7F /* XCRemoteSwiftPackageReference "ldk-node" */,
387384
4AAB08C82E1FE77600BA63DF /* XCRemoteSwiftPackageReference "lottie-ios" */,
388385
18D65DFE2EB9649F00252335 /* XCRemoteSwiftPackageReference "vss-rust-client-ffi" */,
386+
186523EB2ED7365100485B41 /* XCRemoteSwiftPackageReference "ldk-node" */,
389387
);
390388
productRefGroup = 96FE1F622C2DE6AA006D0C8B /* Products */;
391389
projectDirPath = "";
@@ -876,6 +874,14 @@
876874
/* End XCConfigurationList section */
877875

878876
/* Begin XCRemoteSwiftPackageReference section */
877+
186523EB2ED7365100485B41 /* XCRemoteSwiftPackageReference "ldk-node" */ = {
878+
isa = XCRemoteSwiftPackageReference;
879+
repositoryURL = "https://github.com/synonymdev/ldk-node";
880+
requirement = {
881+
branch = main;
882+
kind = branch;
883+
};
884+
};
879885
18D65DFE2EB9649F00252335 /* XCRemoteSwiftPackageReference "vss-rust-client-ffi" */ = {
880886
isa = XCRemoteSwiftPackageReference;
881887
repositoryURL = "https://github.com/synonymdev/vss-rust-client-ffi";
@@ -924,14 +930,6 @@
924930
minimumVersion = 0.0.123;
925931
};
926932
};
927-
968FE13E2DFB016B0053CD7F /* XCRemoteSwiftPackageReference "ldk-node" */ = {
928-
isa = XCRemoteSwiftPackageReference;
929-
repositoryURL = "https://github.com/synonymdev/ldk-node";
930-
requirement = {
931-
branch = main;
932-
kind = branch;
933-
};
934-
};
935933
96DEA0382DE8BBA1009932BF /* XCRemoteSwiftPackageReference "bitkit-core" */ = {
936934
isa = XCRemoteSwiftPackageReference;
937935
repositoryURL = "https://github.com/synonymdev/bitkit-core";
@@ -959,6 +957,11 @@
959957
/* End XCRemoteSwiftPackageReference section */
960958

961959
/* Begin XCSwiftPackageProductDependency section */
960+
186523EC2ED7365100485B41 /* LDKNode */ = {
961+
isa = XCSwiftPackageProductDependency;
962+
package = 186523EB2ED7365100485B41 /* XCRemoteSwiftPackageReference "ldk-node" */;
963+
productName = LDKNode;
964+
};
962965
18D65DFF2EB964B500252335 /* VssRustClientFfi */ = {
963966
isa = XCSwiftPackageProductDependency;
964967
package = 18D65DFE2EB9649F00252335 /* XCRemoteSwiftPackageReference "vss-rust-client-ffi" */;
@@ -1004,11 +1007,6 @@
10041007
package = 966DE66E2C51210000A7B0EF /* XCRemoteSwiftPackageReference "ldk-swift" */;
10051008
productName = LightningDevKit;
10061009
};
1007-
968FE13F2DFB016B0053CD7F /* LDKNode */ = {
1008-
isa = XCSwiftPackageProductDependency;
1009-
package = 968FE13E2DFB016B0053CD7F /* XCRemoteSwiftPackageReference "ldk-node" */;
1010-
productName = LDKNode;
1011-
};
10121010
96DEA0392DE8BBA1009932BF /* BitkitCore */ = {
10131011
isa = XCSwiftPackageProductDependency;
10141012
package = 96DEA0382DE8BBA1009932BF /* XCRemoteSwiftPackageReference "bitkit-core" */;

Bitkit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Bitkit/AppScene.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ struct AppScene: View {
7171
.onChange(of: currency.hasStaleData, perform: handleCurrencyStaleData)
7272
.onChange(of: wallet.walletExists, perform: handleWalletExistsChange)
7373
.onChange(of: wallet.nodeLifecycleState, perform: handleNodeLifecycleChange)
74-
.onChange(of: wallet.totalBalanceSats, perform: handleBalanceChange)
7574
.onChange(of: scenePhase, perform: handleScenePhaseChange)
7675
.environmentObject(app)
7776
.environmentObject(navigation)
@@ -215,11 +214,6 @@ struct AppScene: View {
215214
app?.handleLdkNodeEvent(lightningEvent)
216215
}
217216

218-
wallet.addOnEvent(id: "activity-sync") { [weak activity] (_: Event) in
219-
// TODO: this might not be the best for performace to sync all payments on every event. Could switch to habdling the specific event.
220-
Task { try? await activity?.syncLdkNodePayments() }
221-
}
222-
223217
if wallet.isRestoringWallet {
224218
Task {
225219
await BackupService.shared.performFullRestoreFromLatestBackup()
@@ -284,11 +278,6 @@ struct AppScene: View {
284278
}
285279
}
286280

287-
private func handleBalanceChange(_: Int) {
288-
// Anytime we receive a balance update, we should sync the payments to activity list
289-
Task { try? await activity.syncLdkNodePayments() }
290-
}
291-
292281
private func handleScenePhaseChange(_: ScenePhase) {
293282
// If PIN is enabled, lock the app when the app goes to the background
294283
if scenePhase == .background && settings.pinEnabled {

0 commit comments

Comments
 (0)