Skip to content

Commit 1d0feff

Browse files
committed
use new fromString added in 784
1 parent c89eb9b commit 1d0feff

File tree

3 files changed

+32
-24
lines changed

3 files changed

+32
-24
lines changed

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

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,27 @@ extension CanonicalTx {
1616
confirmationBlockTime: .init(
1717
blockId: .init(
1818
height: UInt32(12),
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-
)
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+
// )
27+
hash: try! BlockHash.fromString(hex: String.mockHashHex)
2728
),
2829
confirmationTime: UInt64(21)
2930
),
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-
)
31+
// transitively: try! Txid.fromBytes(
32+
// bytes: Data([
33+
// 0xc1, 0xf9, 0xfe, 0x0d, 0x7f, 0x97, 0xc6, 0x49,
34+
// 0x0f, 0x83, 0x60, 0xcf, 0x71, 0xbb, 0xef, 0x15,
35+
// 0x1f, 0x2e, 0x73, 0x30, 0x2b, 0xd0, 0x6f, 0x16,
36+
// 0x90, 0xd6, 0x40, 0xb9, 0x6f, 0xb9, 0x44, 0x57,
37+
// ])
38+
// )
39+
transitively: try! Txid.fromString(hex: String.mockHashHex)
3840
)
3941
)
4042
}

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ import Foundation
1212
extension LocalOutput {
1313
static var mock = LocalOutput(
1414
outpoint: OutPoint(
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-
),
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+
// ),
23+
txid: try! Txid.fromString(hex: String.mockHashHex),
2324
vout: UInt32(1)
2425
),
2526
txout: TxOut(

BDKSwiftExampleWallet/Extensions/String+Extensions.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,9 @@ extension String {
4242
static var mockTransactionHex =
4343
"01000000000101604350f234b3b4b5fde5513ff89d222e91cabf452182ba0b8d076cf08a3813a30100000000ffffffff0240420f0000000000225120c8b7757fff5ceb41908a43bfadf749afbb97b50ece0896e88f2cd14f90844d7b8df6731d00000000225120ff38f143374565d74648006f8aabef9dad548344549d8516177ff613e26f7d360140298823f597d3cb7f4934a5ef0b1814e2ca8caa9f9da0a0b59a73922d98f83ec62587add48e3fa0d0b7cf704b2fce0277e2a70f9aed8a41f2823b810b92e0421d00000000"
4444
}
45+
extension String {
46+
static var mockHashHex: String {
47+
"c1f9fe0d7f97c6490f8360cf71bbef151f2e73302bd06f1690d640b96fb94457"
48+
}
49+
}
4550
//#endif

0 commit comments

Comments
 (0)