Skip to content

Commit 4b25919

Browse files
authored
Merge pull request #245 from synonymdev/feat/onchain-events
Integrate LDK onchain events
2 parents a011f09 + 4b9083d commit 4b25919

File tree

22 files changed

+1077
-502
lines changed

22 files changed

+1077
-502
lines changed

.github/workflows/integration-tests.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,11 @@ jobs:
4141
~/Library/org.swift.swiftpm
4242
Bitkit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm
4343
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
44-
restore-keys: |
45-
${{ runner.os }}-spm-
46-
47-
- name: Cache DerivedData
48-
uses: actions/cache@v4
49-
with:
50-
path: ~/Library/Developer/Xcode/DerivedData
51-
key: ${{ runner.os }}-deriveddata-${{ hashFiles('**/*.swift', '**/*.m', '**/*.h', 'Bitkit.xcodeproj/project.pbxproj') }}
52-
restore-keys: |
53-
${{ runner.os }}-deriveddata-
5444

5545
- name: Install dependencies
5646
run: |
5747
echo "⏱️ Starting dependency resolution at $(date)"
58-
xcodebuild -resolvePackageDependencies | xcbeautify
48+
xcodebuild -resolvePackageDependencies -onlyUsePackageVersionsFromResolvedFile | xcbeautify
5949
echo "✅ Dependencies resolved at $(date)"
6050
6151
- name: Pre-start simulator
@@ -64,6 +54,12 @@ jobs:
6454
xcrun simctl boot "iPhone 16" || true
6555
echo "✅ Simulator started at $(date)"
6656
57+
- name: Clean build
58+
run: |
59+
echo "⏱️ Cleaning build at $(date)"
60+
xcodebuild clean -scheme Bitkit | xcbeautify
61+
echo "✅ Build cleaned at $(date)"
62+
6763
- name: Run integration tests
6864
run: |
6965
echo "⏱️ Starting integration tests at $(date)"

.github/workflows/unit-tests.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,11 @@ jobs:
4040
~/Library/org.swift.swiftpm
4141
Bitkit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm
4242
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
43-
restore-keys: |
44-
${{ runner.os }}-spm-
45-
46-
- name: Cache DerivedData
47-
uses: actions/cache@v4
48-
with:
49-
path: ~/Library/Developer/Xcode/DerivedData
50-
key: ${{ runner.os }}-deriveddata-${{ hashFiles('**/*.swift', '**/*.m', '**/*.h', 'Bitkit.xcodeproj/project.pbxproj') }}
51-
restore-keys: |
52-
${{ runner.os }}-deriveddata-
5343

5444
- name: Install dependencies
5545
run: |
5646
echo "⏱️ Starting dependency resolution at $(date)"
57-
xcodebuild -resolvePackageDependencies | xcbeautify
47+
xcodebuild -resolvePackageDependencies -onlyUsePackageVersionsFromResolvedFile | xcbeautify
5848
echo "✅ Dependencies resolved at $(date)"
5949
6050
- name: Pre-start simulator
@@ -63,6 +53,12 @@ jobs:
6353
xcrun simctl boot "iPhone 16" || true
6454
echo "✅ Simulator started at $(date)"
6555
56+
- name: Clean build
57+
run: |
58+
echo "⏱️ Cleaning build at $(date)"
59+
xcodebuild clean -scheme Bitkit | xcbeautify
60+
echo "✅ Build cleaned at $(date)"
61+
6662
- name: Run unit tests
6763
run: |
6864
echo "⏱️ Starting unit tests at $(date)"

Bitkit.xcodeproj/project.pbxproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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,

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 {

Bitkit/Components/ToastView.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ struct ToastView: View {
4848
)
4949
.cornerRadius(8)
5050
.shadow(color: .black.opacity(0.2), radius: 8, x: 0, y: 4)
51+
.accessibilityIdentifierIfPresent(toast.accessibilityIdentifier)
5152
}
5253

5354
private var accentColor: Color {
@@ -68,7 +69,8 @@ struct ToastView: View {
6869
title: "Hey toast",
6970
description: "This is a toast message",
7071
autoHide: true,
71-
visibilityTime: 4.0
72+
visibilityTime: 4.0,
73+
accessibilityIdentifier: nil
7274
), onDismiss: {}
7375
)
7476
.preferredColorScheme(.dark)

Bitkit/Models/Toast.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ struct Toast: Equatable {
1010
let description: String?
1111
let autoHide: Bool
1212
let visibilityTime: Double
13+
let accessibilityIdentifier: String?
1314
}

Bitkit/Resources/Localization/en.lproj/Localizable.strings

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,14 @@
968968
"wallet__toast_payment_success_description" = "Your instant payment was sent successfully.";
969969
"wallet__toast_payment_failed_title" = "Payment Failed";
970970
"wallet__toast_payment_failed_description" = "Your instant payment failed. Please try again.";
971+
"wallet__toast_received_transaction_replaced_title" = "Received Transaction Replaced";
972+
"wallet__toast_received_transaction_replaced_description" = "Your received transaction was replaced by a fee bump";
973+
"wallet__toast_transaction_replaced_title" = "Transaction Replaced";
974+
"wallet__toast_transaction_replaced_description" = "Your transaction was replaced by a fee bump";
975+
"wallet__toast_transaction_unconfirmed_title" = "Transaction Unconfirmed";
976+
"wallet__toast_transaction_unconfirmed_description" = "Transaction became unconfirmed due to blockchain reorganization";
977+
"wallet__toast_transaction_removed_title" = "Transaction Removed";
978+
"wallet__toast_transaction_removed_description" = "Transaction was removed from mempool";
971979
"wallet__selection_title" = "Coin Selection";
972980
"wallet__selection_auto" = "Auto";
973981
"wallet__selection_total_required" = "Total required";
@@ -1046,6 +1054,8 @@
10461054
"wallet__activity_output" = "{count, plural, one {OUTPUT} other {OUTPUTS (#)}}";
10471055
"wallet__activity_boosted_cpfp" = "BOOSTED TRANSACTION {num} (CPFP)";
10481056
"wallet__activity_boosted_rbf" = "BOOSTED TRANSACTION {num} (RBF)";
1057+
"wallet__activity_boost_fee" = "Boost Fee";
1058+
"wallet__activity_boost_fee_description" = "Boosted incoming transaction";
10491059
"wallet__activity_explorer" = "Open Block Explorer";
10501060
"wallet__activity_successful" = "Successful";
10511061
"wallet__activity_invoice_note" = "Invoice note";

0 commit comments

Comments
 (0)