Skip to content

Commit aa8e9ce

Browse files
authored
misc: name output (#175)
1 parent 0c48e24 commit aa8e9ce

File tree

5 files changed

+28
-28
lines changed

5 files changed

+28
-28
lines changed

BDKSwiftExampleWallet/Resources/Localizable.xcstrings

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,22 +90,22 @@
9090
"%@ sats fee" : {
9191

9292
},
93-
"%lld Transaction%@" : {
93+
"%lld Output%@" : {
9494
"localizations" : {
9595
"en" : {
9696
"stringUnit" : {
9797
"state" : "new",
98-
"value" : "%1$lld Transaction%2$@"
98+
"value" : "%1$lld Output%2$@"
9999
}
100100
}
101101
}
102102
},
103-
"%lld UTXO%@" : {
103+
"%lld Transaction%@" : {
104104
"localizations" : {
105105
"en" : {
106106
"stringUnit" : {
107107
"state" : "new",
108-
"value" : "%1$lld UTXO%2$@"
108+
"value" : "%1$lld Transaction%2$@"
109109
}
110110
}
111111
}
@@ -426,6 +426,9 @@
426426
}
427427
}
428428
}
429+
},
430+
"No Outputs" : {
431+
429432
},
430433
"No seed available" : {
431434

@@ -439,9 +442,6 @@
439442
}
440443
}
441444
}
442-
},
443-
"No UTXOs" : {
444-
445445
},
446446
"OK" : {
447447
"localizations" : {
@@ -462,6 +462,9 @@
462462
}
463463
}
464464
}
465+
},
466+
"Outputs" : {
467+
465468
},
466469
"Receive" : {
467470
"localizations" : {
@@ -684,9 +687,6 @@
684687
}
685688
}
686689
}
687-
},
688-
"UTXOs" : {
689-
690690
},
691691
"Vout: %u" : {
692692

BDKSwiftExampleWallet/View Model/Activity/ActivityListViewModel.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ class ActivityListViewModel {
1919
var progress: Float = 0.0
2020
var inspectedScripts: UInt64 = 0
2121
var totalScripts: UInt64 = 0
22-
var utxos: [LocalOutput] = []
22+
var localOutputs: [LocalOutput] = []
2323
var displayMode: DisplayMode = .transactions
2424

2525
enum DisplayMode {
2626
case transactions
27-
case utxos
27+
case outputs
2828
}
2929

3030
init(
@@ -37,9 +37,9 @@ class ActivityListViewModel {
3737
self.transactions = transactions
3838
}
3939

40-
func getUTXOs() {
40+
func listUnspent() {
4141
do {
42-
self.utxos = try bdkClient.listUnspent()
42+
self.localOutputs = try bdkClient.listUnspent()
4343
} catch let error as WalletError {
4444
self.walletViewError = .generic(message: error.localizedDescription)
4545
self.showingWalletViewErrorAlert = true

BDKSwiftExampleWallet/View/Activity/ActivityListView.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@ struct ActivityListView: View {
3030
)
3131
} else {
3232
LocalOutputListView(
33-
localOutputs: viewModel.utxos,
33+
localOutputs: viewModel.localOutputs,
3434
walletSyncState: viewModel.walletSyncState
3535
)
3636
}
3737
}
3838
.task {
3939
viewModel.getTransactions()
40-
viewModel.getUTXOs()
40+
viewModel.listUnspent()
4141
}
4242
}
4343
.navigationTitle(
4444
viewModel.displayMode == .transactions
4545
? "\(viewModel.transactions.count) Transaction\(viewModel.transactions.count == 1 ? "" : "s")"
46-
: "\(viewModel.utxos.count) UTXO\(viewModel.utxos.count == 1 ? "" : "s")"
46+
: "\(viewModel.localOutputs.count) Output\(viewModel.localOutputs.count == 1 ? "" : "s")"
4747
)
4848
.navigationBarTitleDisplayMode(.inline)
4949
.padding(.top)
@@ -59,7 +59,7 @@ struct CustomSegmentedControl: View {
5959
var body: some View {
6060
HStack(spacing: 20) {
6161
segmentButton(for: .transactions)
62-
segmentButton(for: .utxos)
62+
segmentButton(for: .outputs)
6363
Spacer()
6464
}
6565
}
@@ -68,7 +68,7 @@ struct CustomSegmentedControl: View {
6868
Button(action: {
6969
selection = mode
7070
}) {
71-
Text(mode == .transactions ? "Transactions" : "UTXOs").bold()
71+
Text(mode == .transactions ? "Transactions" : "Outputs").bold()
7272
.foregroundColor(selection == mode ? .primary : .gray)
7373
}
7474
}

BDKSwiftExampleWallet/View/Activity/LocalOutputItemView.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import BitcoinDevKit
99
import SwiftUI
1010

1111
struct LocalOutputItemView: View {
12-
let utxo: LocalOutput
12+
let output: LocalOutput
1313
let isRedacted: Bool
1414
@Environment(\.dynamicTypeSize) var dynamicTypeSize
1515

@@ -33,15 +33,15 @@ struct LocalOutputItemView: View {
3333

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

36-
Text(utxo.outpoint.txid)
36+
Text(output.outpoint.txid)
3737
.truncationMode(.middle)
3838
.lineLimit(1)
3939
.fontDesign(.monospaced)
4040
.fontWeight(.semibold)
4141
.font(.title)
4242
.foregroundColor(.primary)
4343

44-
Text("Vout: \(utxo.outpoint.vout)")
44+
Text("Vout: \(output.outpoint.vout)")
4545
.lineLimit(dynamicTypeSize.isAccessibilitySize ? 2 : 1)
4646
.font(.caption2)
4747
.fontWidth(.condensed)
@@ -54,7 +54,7 @@ struct LocalOutputItemView: View {
5454

5555
Spacer()
5656

57-
Text("\(utxo.txout.value) sats")
57+
Text("\(output.txout.value) sats")
5858
.font(.subheadline)
5959
.fontWeight(.semibold)
6060
.fontDesign(.rounded)
@@ -69,5 +69,5 @@ struct LocalOutputItemView: View {
6969
}
7070

7171
#Preview {
72-
LocalOutputItemView(utxo: .mock, isRedacted: false)
72+
LocalOutputItemView(output: .mock, isRedacted: false)
7373
}

BDKSwiftExampleWallet/View/Activity/LocalOutputListView.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ struct LocalOutputListView: View {
1515
var body: some View {
1616
List {
1717
if localOutputs.isEmpty && walletSyncState == .syncing {
18-
LocalOutputItemView(utxo: .mock, isRedacted: true)
18+
LocalOutputItemView(output: .mock, isRedacted: true)
1919
.listRowInsets(EdgeInsets())
2020
.listRowSeparator(.hidden)
2121
} else if localOutputs.isEmpty {
22-
Text("No UTXOs")
22+
Text("No Outputs")
2323
.font(.subheadline)
2424
.listRowInsets(EdgeInsets())
2525
.listRowSeparator(.hidden)
2626
} else {
27-
ForEach(localOutputs, id: \.outpoint) { utxo in
28-
LocalOutputItemView(utxo: utxo, isRedacted: false)
27+
ForEach(localOutputs, id: \.outpoint) { output in
28+
LocalOutputItemView(output: output, isRedacted: false)
2929
}
3030
.listRowInsets(EdgeInsets())
3131
.listRowSeparator(.hidden)

0 commit comments

Comments
 (0)