Skip to content

Commit 20da6be

Browse files
committed
master as of may 28 2025
1 parent dc057ad commit 20da6be

File tree

12 files changed

+60
-31
lines changed

12 files changed

+60
-31
lines changed

BDKSwiftExampleWallet.xcodeproj/project.pbxproj

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 56;
6+
objectVersion = 60;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -59,6 +59,7 @@
5959
AE6716012A9AC089005C193F /* KeyServiceError.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE6716002A9AC089005C193F /* KeyServiceError.swift */; };
6060
AE6F34D82AA6C1800087E700 /* Network+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE6F34D72AA6C1800087E700 /* Network+Extensions.swift */; };
6161
AE6F34DA2AA6C1E00087E700 /* Balance+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE6F34D92AA6C1E00087E700 /* Balance+Extensions.swift */; };
62+
AE7053262DE79AA30091DD78 /* BitcoinDevKit in Frameworks */ = {isa = PBXBuildFile; productRef = AE7053252DE79AA30091DD78 /* BitcoinDevKit */; };
6263
AE7839FD2AB4E18D005F0CBA /* AmountView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE7839FC2AB4E18D005F0CBA /* AmountView.swift */; };
6364
AE783A012AB4E5E1005F0CBA /* BuildTransactionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE783A002AB4E5E1005F0CBA /* BuildTransactionView.swift */; };
6465
AE783A032AB4ECC2005F0CBA /* AddressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE783A022AB4ECC2005F0CBA /* AddressView.swift */; };
@@ -204,6 +205,7 @@
204205
isa = PBXFrameworksBuildPhase;
205206
buildActionMask = 2147483647;
206207
files = (
208+
AE7053262DE79AA30091DD78 /* BitcoinDevKit in Frameworks */,
207209
AE2DD83F2D6FEF3600E5F212 /* BitcoinDevKit in Frameworks */,
208210
AE187D782C9BB3B50081D0C3 /* BitcoinDevKit in Frameworks */,
209211
AE29ED0F2BBE2E7100EB9C4F /* BitcoinDevKit in Frameworks */,
@@ -595,6 +597,7 @@
595597
AE2DD8382D6FE9B000E5F212 /* BitcoinDevKit */,
596598
AE2DD83B2D6FEC3100E5F212 /* BitcoinDevKit */,
597599
AE2DD83E2D6FEF3600E5F212 /* BitcoinDevKit */,
600+
AE7053252DE79AA30091DD78 /* BitcoinDevKit */,
598601
);
599602
productName = BDKSwiftExampleWallet;
600603
productReference = AE4984782A1BBBD6009951E2 /* BDKSwiftExampleWallet.app */;
@@ -652,7 +655,7 @@
652655
AE7D5A0C2A7EE62200EAC8CE /* XCRemoteSwiftPackageReference "KeychainAccess" */,
653656
AEB735D12B2CC4B900F99DBB /* XCRemoteSwiftPackageReference "BitcoinUI" */,
654657
AEAF83B42B7BD4D10019B23B /* XCRemoteSwiftPackageReference "CodeScanner" */,
655-
AEA2DEF12D70F8840067C0EB /* XCRemoteSwiftPackageReference "bdk-swift" */,
658+
AE7053242DE79AA30091DD78 /* XCLocalSwiftPackageReference "../bdk-ffi/bdk-swift" */,
656659
);
657660
productRefGroup = AE4984792A1BBBD6009951E2 /* Products */;
658661
projectDirPath = "";
@@ -1054,6 +1057,13 @@
10541057
};
10551058
/* End XCConfigurationList section */
10561059

1060+
/* Begin XCLocalSwiftPackageReference section */
1061+
AE7053242DE79AA30091DD78 /* XCLocalSwiftPackageReference "../bdk-ffi/bdk-swift" */ = {
1062+
isa = XCLocalSwiftPackageReference;
1063+
relativePath = "../bdk-ffi/bdk-swift";
1064+
};
1065+
/* End XCLocalSwiftPackageReference section */
1066+
10571067
/* Begin XCRemoteSwiftPackageReference section */
10581068
AE7D5A0C2A7EE62200EAC8CE /* XCRemoteSwiftPackageReference "KeychainAccess" */ = {
10591069
isa = XCRemoteSwiftPackageReference;
@@ -1063,14 +1073,6 @@
10631073
version = 4.2.2;
10641074
};
10651075
};
1066-
AEA2DEF12D70F8840067C0EB /* XCRemoteSwiftPackageReference "bdk-swift" */ = {
1067-
isa = XCRemoteSwiftPackageReference;
1068-
repositoryURL = "https://github.com/bitcoindevkit/bdk-swift";
1069-
requirement = {
1070-
kind = exactVersion;
1071-
version = 1.2.0;
1072-
};
1073-
};
10741076
AEAF83B42B7BD4D10019B23B /* XCRemoteSwiftPackageReference "CodeScanner" */ = {
10751077
isa = XCRemoteSwiftPackageReference;
10761078
repositoryURL = "https://github.com/twostraws/CodeScanner.git";
@@ -1118,6 +1120,10 @@
11181120
isa = XCSwiftPackageProductDependency;
11191121
productName = BitcoinDevKit;
11201122
};
1123+
AE7053252DE79AA30091DD78 /* BitcoinDevKit */ = {
1124+
isa = XCSwiftPackageProductDependency;
1125+
productName = BitcoinDevKit;
1126+
};
11211127
AE7D5A0D2A7EE62200EAC8CE /* KeychainAccess */ = {
11221128
isa = XCSwiftPackageProductDependency;
11231129
package = AE7D5A0C2A7EE62200EAC8CE /* XCRemoteSwiftPackageReference "KeychainAccess" */;

BDKSwiftExampleWallet/Extensions/BDK+Extensions/CanonicalTx+Extensions.swift

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,25 @@ extension CanonicalTx {
1616
confirmationBlockTime: .init(
1717
blockId: .init(
1818
height: UInt32(12),
19-
hash: "hash"
19+
hash: try! BlockHash.fromBytes(
20+
bytes: Data([
21+
0xc1, 0xf9, 0xfe, 0x0d, 0x7f, 0x97, 0xc6, 0x49,
22+
0x0f, 0x83, 0x60, 0xcf, 0x71, 0xbb, 0xef, 0x15,
23+
0x1f, 0x2e, 0x73, 0x30, 0x2b, 0xd0, 0x6f, 0x16,
24+
0x90, 0xd6, 0x40, 0xb9, 0x6f, 0xb9, 0x44, 0x57,
25+
])
26+
)
2027
),
2128
confirmationTime: UInt64(21)
2229
),
23-
transitively: "c1f9fe0d7f97c6490f8360cf71bbef151f2e73302bd06f1690d640b96fb94457"
30+
transitively: try! Txid.fromBytes(
31+
bytes: Data([
32+
0xc1, 0xf9, 0xfe, 0x0d, 0x7f, 0x97, 0xc6, 0x49,
33+
0x0f, 0x83, 0x60, 0xcf, 0x71, 0xbb, 0xef, 0x15,
34+
0x1f, 0x2e, 0x73, 0x30, 0x2b, 0xd0, 0x6f, 0x16,
35+
0x90, 0xd6, 0x40, 0xb9, 0x6f, 0xb9, 0x44, 0x57,
36+
])
37+
)
2438
)
2539
)
2640
}

BDKSwiftExampleWallet/Extensions/BDK+Extensions/LocalOutput+Extensions.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,25 @@
66
//
77

88
import BitcoinDevKit
9+
import Foundation
910

1011
//#if DEBUG
1112
extension LocalOutput {
1213
static var mock = LocalOutput(
1314
outpoint: OutPoint(
14-
txid: "txid",
15+
txid: try! Txid.fromBytes(
16+
bytes: Data([
17+
0xc1, 0xf9, 0xfe, 0x0d, 0x7f, 0x97, 0xc6, 0x49,
18+
0x0f, 0x83, 0x60, 0xcf, 0x71, 0xbb, 0xef, 0x15,
19+
0x1f, 0x2e, 0x73, 0x30, 0x2b, 0xd0, 0x6f, 0x16,
20+
0x90, 0xd6, 0x40, 0xb9, 0x6f, 0xb9, 0x44, 0x57,
21+
])
22+
),
1523
vout: UInt32(1)
1624
),
1725
txout: TxOut(
1826
value: UInt64(1),
19-
scriptPubkey: Script(rawOutputScript: [UInt8(1)])
27+
scriptPubkey: Script.init(rawOutputScript: Data([0x51]))
2028
),
2129
keychain: .external,
2230
isSpent: false,

BDKSwiftExampleWallet/Extensions/BDK+Extensions/Transaction+Extensions.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@
66
//
77

88
import BitcoinDevKit
9+
import Foundation
910

1011
extension Transaction {
1112
var transactionID: String {
12-
return self.computeTxid()
13+
return "\(self.computeTxid())"
1314
}
1415
}
1516

1617
//#if DEBUG
1718
extension Transaction {
1819
static var mock = try? Transaction(
19-
transactionBytes: String.mockTransactionHex.hexStringToByteArray()
20+
transactionBytes: Data(String.mockTransactionHex.hexStringToByteArray())
2021
)
2122
}
2223
//#endif

BDKSwiftExampleWallet/Service/BDK Service/BDKService.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ private class BDKService {
119119
)
120120
let descriptor = Descriptor.newBip86(
121121
secretKey: secretKey,
122-
keychain: .external,
122+
keychainKind: .external,
123123
network: network
124124
)
125125
let changeDescriptor = Descriptor.newBip86(
126126
secretKey: secretKey,
127-
keychain: .internal,
127+
keychainKind: .internal,
128128
network: network
129129
)
130130
let backupInfo = BackupInfo(
@@ -222,13 +222,13 @@ private class BDKService {
222222
let descriptor = Descriptor.newBip86Public(
223223
publicKey: descriptorPublicKey,
224224
fingerprint: fingerprint,
225-
keychain: .external,
225+
keychainKind: .external,
226226
network: network
227227
)
228228
let changeDescriptor = Descriptor.newBip86Public(
229229
publicKey: descriptorPublicKey,
230230
fingerprint: fingerprint,
231-
keychain: .internal,
231+
keychainKind: .internal,
232232
network: network
233233
)
234234

@@ -539,7 +539,7 @@ extension BDKClient {
539539
let pb64 = """
540540
cHNidP8BAIkBAAAAAeaWcxp4/+xSRJ2rhkpUJ+jQclqocoyuJ/ulSZEgEkaoAQAAAAD+////Ak/cDgAAAAAAIlEgqxShDO8ifAouGyRHTFxWnTjpY69Cssr3IoNQvMYOKG/OVgAAAAAAACJRIGnlvMwBz4Ylb6xLTe5g4ZeZCxmVH/XWG+CDlcPzzaoT8qoGAAABAStAQg8AAAAAACJRIFGGvSoLWt3hRAIwYa8KEyawiFTXoOCVWFxYtSofZuAsIRZ2b8YiEpzexWYGt8B5EqLM8BE4qxJY3pkiGw/8zOZGYxkAvh7sj1YAAIABAACAAAAAgAAAAAAEAAAAARcgdm/GIhKc3sVmBrfAeRKizPAROKsSWN6ZIhsP/MzmRmMAAQUge7cvJMsJmR56NzObGOGkm8vNqaAIJdnBXLZD2PvrinIhB3u3LyTLCZkeejczmxjhpJvLzamgCCXZwVy2Q9j764pyGQC+HuyPVgAAgAEAAIAAAACAAQAAAAYAAAAAAQUgtIFPrI2EW/+PJiAmYdmux88p0KgeAxDFLMoeQoS66hIhB7SBT6yNhFv/jyYgJmHZrsfPKdCoHgMQxSzKHkKEuuoSGQC+HuyPVgAAgAEAAIAAAACAAAAAAAIAAAAA
541541
"""
542-
return try! Psbt(psbtBase64: pb64)
542+
return try Psbt(psbtBase64: pb64)
543543
},
544544
getBackupInfo: {
545545
BackupInfo(

BDKSwiftExampleWallet/Service/Key Service/KeyService.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,12 @@ extension KeyClient {
129129
)
130130
let descriptor = Descriptor.newBip86(
131131
secretKey: secretKey,
132-
keychain: .external,
132+
keychainKind: .external,
133133
network: mockKeyClientNetwork
134134
)
135135
let changeDescriptor = Descriptor.newBip86(
136136
secretKey: secretKey,
137-
keychain: .internal,
137+
keychainKind: .internal,
138138
network: mockKeyClientNetwork
139139
)
140140
let backupInfo = BackupInfo(

BDKSwiftExampleWallet/View/Activity/LocalOutputItemView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct LocalOutputItemView: View {
3333

3434
VStack(alignment: .leading, spacing: 5) {
3535

36-
Text(output.outpoint.txid)
36+
Text(output.outpoint.txid.description)
3737
.truncationMode(.middle)
3838
.lineLimit(1)
3939
.fontDesign(.monospaced)

BDKSwiftExampleWallet/View/Activity/LocalOutputListView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct LocalOutputListView: View {
2727
.listRowInsets(EdgeInsets())
2828
.listRowSeparator(.hidden)
2929
} else {
30-
ForEach(localOutputs, id: \.outpoint) { output in
30+
ForEach(Array(localOutputs.enumerated()), id: \.offset) { index, output in
3131
LocalOutputItemView(
3232
isRedacted: false,
3333
output: output

BDKSwiftExampleWallet/View/Activity/TransactionDetailView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ struct TransactionDetailView: View {
124124
Spacer()
125125
}
126126
Button {
127-
UIPasteboard.general.string = canonicalTx.transaction.computeTxid()
127+
UIPasteboard.general.string = "\(canonicalTx.transaction.computeTxid())"
128128
isCopied = true
129129
showCheckmark = true
130130
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
@@ -133,7 +133,7 @@ struct TransactionDetailView: View {
133133
}
134134
} label: {
135135
HStack {
136-
Text(canonicalTx.transaction.computeTxid())
136+
Text("\(canonicalTx.transaction.computeTxid())")
137137
.lineLimit(1)
138138
.truncationMode(.middle)
139139
withAnimation {

BDKSwiftExampleWallet/View/Activity/TransactionItemView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct TransactionItemView: View {
5555
}
5656

5757
VStack(alignment: .leading, spacing: 5) {
58-
Text(canonicalTx.transaction.computeTxid())
58+
Text(canonicalTx.transaction.transactionID)
5959
.truncationMode(.middle)
6060
.lineLimit(1)
6161
.fontDesign(.monospaced)

BDKSwiftExampleWallet/View/Receive/ReceiveView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,6 @@ struct ReceiveView: View {
121121

122122
#if DEBUG
123123
#Preview("ReceiveView - en") {
124-
ReceiveView(viewModel: .init(bdkClient: .mock))
124+
ReceiveView(viewModel: ReceiveViewModel(bdkClient: .mock))
125125
}
126126
#endif

BDKSwiftExampleWallet/View/Send/BuildTransactionView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,12 @@ struct BuildTransactionView: View {
169169
.foregroundStyle(.green)
170170
if let transaction = viewModel.extractTransaction() {
171171
HStack {
172-
Text(transaction.computeTxid())
172+
Text("\(transaction.computeTxid())")
173173
.lineLimit(1)
174174
.truncationMode(.middle)
175175
Spacer()
176176
Button {
177-
UIPasteboard.general.string = transaction.computeTxid()
177+
UIPasteboard.general.string = "\(transaction.computeTxid())"
178178
isCopied = true
179179
showCheckmark = true
180180
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {

0 commit comments

Comments
 (0)