Skip to content

Commit ebe05e9

Browse files
committed
added kyoto structure
1 parent 8b66948 commit ebe05e9

File tree

5 files changed

+100
-7
lines changed

5 files changed

+100
-7
lines changed

BDKSwiftExampleWallet.xcodeproj/project.pbxproj

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
77F0FDC92DA9A93D00B30E4F /* Connection+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77F0FDC82DA9A93700B30E4F /* Connection+Extensions.swift */; };
1515
77F6A9E32DE247B2003568F0 /* BDKSyncService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77F6A9E22DE247AD003568F0 /* BDKSyncService.swift */; };
1616
77F6A9E52DE24841003568F0 /* URL+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77F6A9E42DE24837003568F0 /* URL+Extensions.swift */; };
17-
77F6A9E72DE248A2003568F0 /* EsploraServerSyncService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77F6A9E62DE248A1003568F0 /* EsploraServerSyncService.swift */; };
17+
77F6A9E72DE248A2003568F0 /* EsploraService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77F6A9E62DE248A1003568F0 /* EsploraService.swift */; };
18+
77F6A9E92DE25C9C003568F0 /* KyotoService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77F6A9E82DE25C98003568F0 /* KyotoService.swift */; };
1819
A733D6D02A81113000F333B4 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = A733D6CF2A81113000F333B4 /* Localizable.xcstrings */; };
1920
A73F7A362A3B778E00B87FC6 /* Int+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A73F7A352A3B778E00B87FC6 /* Int+Extensions.swift */; };
2021
AE0C30F72A804A2D008F1EAE /* TransactionListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE0C30F62A804A2D008F1EAE /* TransactionListView.swift */; };
@@ -122,7 +123,8 @@
122123
77F0FDC82DA9A93700B30E4F /* Connection+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Connection+Extensions.swift"; sourceTree = "<group>"; };
123124
77F6A9E22DE247AD003568F0 /* BDKSyncService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BDKSyncService.swift; sourceTree = "<group>"; };
124125
77F6A9E42DE24837003568F0 /* URL+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "URL+Extensions.swift"; sourceTree = "<group>"; };
125-
77F6A9E62DE248A1003568F0 /* EsploraServerSyncService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EsploraServerSyncService.swift; sourceTree = "<group>"; };
126+
77F6A9E62DE248A1003568F0 /* EsploraService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EsploraService.swift; sourceTree = "<group>"; };
127+
77F6A9E82DE25C98003568F0 /* KyotoService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KyotoService.swift; sourceTree = "<group>"; };
126128
A733D6CF2A81113000F333B4 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = "<group>"; };
127129
A73F7A352A3B778E00B87FC6 /* Int+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Int+Extensions.swift"; sourceTree = "<group>"; };
128130
AE0C30F62A804A2D008F1EAE /* TransactionListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionListView.swift; sourceTree = "<group>"; };
@@ -255,7 +257,8 @@
255257
77F6A9E12DE247A3003568F0 /* BDKSyncService */ = {
256258
isa = PBXGroup;
257259
children = (
258-
77F6A9E62DE248A1003568F0 /* EsploraServerSyncService.swift */,
260+
77F6A9E82DE25C98003568F0 /* KyotoService.swift */,
261+
77F6A9E62DE248A1003568F0 /* EsploraService.swift */,
259262
77F6A9E22DE247AD003568F0 /* BDKSyncService.swift */,
260263
);
261264
path = BDKSyncService;
@@ -717,6 +720,7 @@
717720
774586B52DB7B2BC00A631E1 /* BalanceView.swift in Sources */,
718721
AEB905C32A7EEBF000CD0337 /* BackupInfo.swift in Sources */,
719722
AE783A072AB4F7C7005F0CBA /* FeeView.swift in Sources */,
723+
77F6A9E92DE25C9C003568F0 /* KyotoService.swift in Sources */,
720724
AE2B8C1D2A9678C900815B2F /* FeeService.swift in Sources */,
721725
AE8D001C2D19F1760029C4C9 /* UIScreen+Extensions.swift in Sources */,
722726
AEC2CF5A2ABFBA19008065E4 /* BuildTransactionViewModel.swift in Sources */,
@@ -775,7 +779,7 @@
775779
AE0C30F92A804B65008F1EAE /* OnboardingViewModel.swift in Sources */,
776780
AE3902A42A3B4CD900BEC318 /* HomeView.swift in Sources */,
777781
AE0C30FD2A804BC1008F1EAE /* ReceiveViewModel.swift in Sources */,
778-
77F6A9E72DE248A2003568F0 /* EsploraServerSyncService.swift in Sources */,
782+
77F6A9E72DE248A2003568F0 /* EsploraService.swift in Sources */,
779783
);
780784
runOnlyForDeploymentPostprocessing = 0;
781785
};

BDKSwiftExampleWallet/Service/BDK Service/BDKService.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import Foundation
1111
private class BDKService {
1212
static var shared: BDKService = BDKService()
1313

14-
private let service: BDKSyncService = EsploraServerSyncService()
14+
private let service: BDKSyncService = EsploraService()
1515

1616
private var balance: Balance?
1717
private var connection: Connection?

BDKSwiftExampleWallet/Service/BDKSyncService/BDKSyncService.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ extension BDKSyncService {
182182
// Optional implementation
183183
}
184184

185+
func updateNetwork(network: Network) {
186+
// Optional implementation
187+
}
188+
185189
// MARK: - Private
186190

187191
private func isDescriptor(_ param: String) -> Bool {

BDKSwiftExampleWallet/Service/BDKSyncService/EsploraServerSyncService.swift renamed to BDKSwiftExampleWallet/Service/BDKSyncService/EsploraService.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
import BitcoinDevKit
99
import Foundation
1010

11-
final class EsploraServerSyncService: BDKSyncService {
11+
final class EsploraService: BDKSyncService {
1212

13-
static let shared = EsploraServerSyncService()
13+
static let shared = EsploraService()
1414

1515
var connection: Connection?
1616
var keyClient: KeyClient
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
//
2+
// KyotoService.swift
3+
// BDKSwiftExampleWallet
4+
//
5+
// Created by Rubens Machion on 24/05/25.
6+
//
7+
8+
import BitcoinDevKit
9+
import Foundation
10+
11+
final class KyotoService: BDKSyncService {
12+
13+
static let shared = KyotoService()
14+
15+
var connection: Connection?
16+
var keyClient: KeyClient
17+
var network: Network
18+
var wallet: Wallet?
19+
20+
init(
21+
keyClient: KeyClient = .live,
22+
network: Network = .signet,
23+
connection: Connection? = nil
24+
) {
25+
self.connection = connection
26+
self.keyClient = keyClient
27+
self.network = network
28+
}
29+
30+
func createWallet(params: String?) throws {
31+
32+
}
33+
34+
func loadWallet() throws {
35+
36+
}
37+
38+
func deleteWallet() throws {
39+
40+
}
41+
42+
func startSync(progress: any SyncScriptInspector) async throws {
43+
44+
}
45+
46+
func startFullScan(progress: any FullScanScriptInspector) async throws {
47+
48+
}
49+
50+
func getTransactions() throws -> [CanonicalTx] {
51+
[]
52+
}
53+
54+
func getBalance() throws -> Balance {
55+
.mock
56+
}
57+
58+
func sentAndReceived(tx: Transaction) throws -> SentAndReceivedValues {
59+
.mock
60+
}
61+
62+
func calculateFeeRate(tx: Transaction) throws -> UInt64 {
63+
.zero
64+
}
65+
66+
func calculateFee(tx: Transaction) throws -> Amount {
67+
try .fromBtc(btc: .zero)
68+
}
69+
70+
func buildTransaction(address: String, amount: UInt64, feeRate: UInt64) throws -> Psbt {
71+
.init(noPointer: .init())
72+
}
73+
74+
func send(address: String, amount: UInt64, feeRate: UInt64) async throws {
75+
76+
}
77+
78+
func listUnspent() throws -> [LocalOutput] {
79+
[]
80+
}
81+
82+
func getAddress() throws -> String {
83+
""
84+
}
85+
}

0 commit comments

Comments
 (0)