Skip to content

Commit c967bd6

Browse files
committed
refactor: broadcast sync
1 parent 8718349 commit c967bd6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

BDKSwiftExampleWallet/Service/BDK Service/BDKService.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ enum BlockchainClientType: String, CaseIterable {
1717
struct BlockchainClient {
1818
let sync: @Sendable (SyncRequest, UInt64) async throws -> Update
1919
let fullScan: @Sendable (FullScanRequest, UInt64, UInt64) async throws -> Update
20-
let broadcast: @Sendable (Transaction) async throws -> Void
20+
let broadcast: @Sendable (Transaction) throws -> Void
2121
let getUrl: @Sendable () -> String
2222
let getType: @Sendable () -> BlockchainClientType
2323
let supportsFullScan: @Sendable () -> Bool = { true }
@@ -44,7 +44,7 @@ extension BlockchainClient {
4444
static func kyoto(peer: String) -> Self {
4545
var cbfComponents: (client: CbfClient, node: CbfNode)? = nil
4646

47-
func getOrCreateComponents() async throws -> (client: CbfClient, node: CbfNode) {
47+
func getOrCreateComponents() throws -> (client: CbfClient, node: CbfNode) {
4848
if let existing = cbfComponents {
4949
return existing
5050
}
@@ -62,16 +62,16 @@ extension BlockchainClient {
6262

6363
return Self(
6464
sync: { request, _ in
65-
let components = try await getOrCreateComponents()
65+
let components = try getOrCreateComponents()
6666
return try await components.client.update()
6767
},
6868
fullScan: { request, stopGap, _ in
69-
let components = try await getOrCreateComponents()
69+
let components = try getOrCreateComponents()
7070
return try await components.client.update()
7171
},
7272
broadcast: { tx in
73-
let components = try await getOrCreateComponents()
74-
try await components.client.broadcast(transaction: tx)
73+
let components = try getOrCreateComponents()
74+
try components.client.broadcast(transaction: tx)
7575
},
7676
getUrl: { peer },
7777
getType: { .kyoto }
@@ -560,7 +560,7 @@ private class BDKService {
560560
let isSigned = try wallet.sign(psbt: psbt)
561561
if isSigned {
562562
let transaction = try psbt.extractTx()
563-
try await self.blockchainClient.broadcast(transaction)
563+
try self.blockchainClient.broadcast(transaction)
564564
} else {
565565
throw WalletError.notSigned
566566
}

0 commit comments

Comments
 (0)