Skip to content

Commit 8c2a9d9

Browse files
committed
fix the code
1 parent 0b490db commit 8c2a9d9

File tree

5 files changed

+29
-29
lines changed

5 files changed

+29
-29
lines changed

BDKSwiftExampleWallet/Service/BDK Service/BDKService.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,12 @@ private class BDKService {
115115
try service.buildTransaction(address: address, amount: amount, feeRate: feeRate)
116116
}
117117

118-
func syncWithInspector2(progress: @escaping SyncScanProgress) async throws {
119-
try await service.startSync2(progress: progress)
118+
func syncWithInspector(progress: @escaping SyncScanProgress) async throws {
119+
try await service.startSync(progress: progress)
120120
}
121121

122-
func fullScanWithInspector2(progress: @escaping FullScanProgress) async throws {
123-
try await service.startFullScan2(progress: progress)
122+
func fullScanWithInspector(progress: @escaping FullScanProgress) async throws {
123+
try await service.startFullScan(progress: progress)
124124
}
125125

126126
func calculateFee(tx: Transaction) throws -> Amount {
@@ -187,10 +187,10 @@ extension BDKClient {
187187
transactions: { try BDKService.shared.transactions() },
188188
listUnspent: { try BDKService.shared.listUnspent() },
189189
syncScanWithSyncScanProgress: { progress in
190-
try await BDKService.shared.syncWithInspector2(progress: progress)
190+
try await BDKService.shared.syncWithInspector(progress: progress)
191191
},
192192
fullScanWithFullScanProgress: { progress in
193-
try await BDKService.shared.fullScanWithInspector2(progress: progress)
193+
try await BDKService.shared.fullScanWithInspector(progress: progress)
194194
},
195195
getAddress: { try BDKService.shared.getAddress() },
196196
send: { (address, amount, feeRate) in

BDKSwiftExampleWallet/Service/BDKSyncService/BDKSyncService.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ protocol BDKSyncService {
2020
func createWallet(params: String?) throws
2121
func loadWallet() throws
2222
func deleteWallet() throws
23-
func startSync2(progress: @escaping SyncScanProgress) async throws
24-
func startFullScan2(progress: @escaping FullScanProgress) async throws
23+
func startSync(progress: @escaping SyncScanProgress) async throws
24+
func startFullScan(progress: @escaping FullScanProgress) async throws
2525

2626
func updateNetwork(network: Network)
2727
func updateEsploraURL(_ url: String)

BDKSwiftExampleWallet/Service/BDKSyncService/EsploraService.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ final class EsploraService: BDKSyncService {
5454
self.esploraClient = .init(url: url)
5555
}
5656

57-
func startSync2(progress: @escaping SyncScanProgress) async throws {
57+
func startSync(progress: @escaping SyncScanProgress) async throws {
5858
guard let wallet = self.wallet else { throw WalletError.walletNotFound }
5959
let syncScanInspector = WalletSyncScriptInspector { scripts, total in
6060
progress(scripts, total)
@@ -74,7 +74,7 @@ final class EsploraService: BDKSyncService {
7474
let _ = try wallet.persist(connection: connection)
7575
}
7676

77-
func startFullScan2(progress: @escaping FullScanProgress) async throws {
77+
func startFullScan(progress: @escaping FullScanProgress) async throws {
7878
guard let wallet = self.wallet else { throw WalletError.walletNotFound }
7979
let fullScanInspector = WalletFullScanScriptInspector { inspected in
8080
progress(inspected)

BDKSwiftExampleWallet/Service/BDKSyncService/KyotoService.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ final class KyotoService: BDKSyncService {
4747
self.wallet = wallet
4848
}
4949

50-
func startSync2(progress: @escaping SyncScanProgress) async throws {
50+
func startSync(progress: @escaping SyncScanProgress) async throws {
5151
guard let wallet = self.wallet else {
5252
throw WalletError.walletNotFound
5353
}
@@ -60,7 +60,7 @@ final class KyotoService: BDKSyncService {
6060
try await startListen()
6161
}
6262

63-
func startFullScan2(progress: @escaping FullScanProgress) async throws {
63+
func startFullScan(progress: @escaping FullScanProgress) async throws {
6464
guard let wallet = self.wallet else {
6565
throw WalletError.walletNotFound
6666
}

BDKSwiftExampleWallet/View Model/WalletViewModel.swift

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,23 @@ class WalletViewModel {
4343
bdkClient.needsFullScan()
4444
}
4545

46-
private var updateProgress: @Sendable (UInt64, UInt64) -> Void {
47-
{ [weak self] inspected, total in
48-
DispatchQueue.main.async {
49-
self?.totalScripts = total
50-
self?.inspectedScripts = inspected
51-
self?.progress = total > 0 ? Float(inspected) / Float(total) : 0
52-
}
53-
}
54-
}
55-
56-
private var updateProgressFullScan: @Sendable (UInt64) -> Void {
57-
{ [weak self] inspected in
58-
DispatchQueue.main.async {
59-
self?.inspectedScripts = inspected
60-
}
61-
}
62-
}
46+
// private var updateProgress: @Sendable (UInt64, UInt64) -> Void {
47+
// { [weak self] inspected, total in
48+
// DispatchQueue.main.async {
49+
// self?.totalScripts = total
50+
// self?.inspectedScripts = inspected
51+
// self?.progress = total > 0 ? Float(inspected) / Float(total) : 0
52+
// }
53+
// }
54+
// }
55+
//
56+
// private var updateProgressFullScan: @Sendable (UInt64) -> Void {
57+
// { [weak self] inspected in
58+
// DispatchQueue.main.async {
59+
// self?.inspectedScripts = inspected
60+
// }
61+
// }
62+
// }
6363

6464
init(
6565
bdkClient: BDKClient = .live,

0 commit comments

Comments
 (0)