File tree Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -9,4 +9,5 @@ import Foundation
99
1010extension Notification . Name {
1111 static let walletCreated = Notification . Name ( " walletCreated " )
12+ static let walletDidUpdate = Notification . Name ( " walletDidUpdate " )
1213}
Original file line number Diff line number Diff line change @@ -641,6 +641,7 @@ final class BDKService {
641641 throw WalletError . dbNotFound
642642 }
643643 let _ = try wallet. persist ( persister: persister)
644+ NotificationCenter . default. post ( name: . walletDidUpdate, object: nil )
644645 }
645646
646647 func fullScanWithInspector( inspector: FullScanScriptInspector ) async throws {
@@ -663,6 +664,7 @@ final class BDKService {
663664 throw WalletError . dbNotFound
664665 }
665666 let _ = try wallet. persist ( persister: persister)
667+ NotificationCenter . default. post ( name: . walletDidUpdate, object: nil )
666668 }
667669
668670 func calculateFee( tx: Transaction ) throws -> Amount {
Original file line number Diff line number Diff line change @@ -164,6 +164,19 @@ class WalletViewModel {
164164 }
165165 }
166166 }
167+
168+ NotificationCenter . default. addObserver (
169+ forName: . walletDidUpdate,
170+ object: nil ,
171+ queue: . main
172+ ) { [ weak self] _ in
173+ guard let self else { return }
174+ self . getBalance ( )
175+ self . getTransactions ( )
176+ Task {
177+ await self . getPrices ( )
178+ }
179+ }
167180 }
168181
169182 private func fullScanWithProgress( ) async {
You can’t perform that action at this time.
0 commit comments