File tree Expand file tree Collapse file tree 3 files changed +55
-5
lines changed Expand file tree Collapse file tree 3 files changed +55
-5
lines changed Original file line number Diff line number Diff line change 397
397
}
398
398
}
399
399
}
400
+ },
401
+ "Get sats from faucet" : {
402
+
400
403
},
401
404
"HomeView Error" : {
402
405
"localizations" : {
Original file line number Diff line number Diff line change @@ -12,14 +12,17 @@ import Foundation
12
12
@Observable
13
13
class TransactionListViewModel {
14
14
let bdkClient : BDKClient
15
+ let keyClient : KeyClient
15
16
16
17
var showingWalletTransactionsViewErrorAlert = false
17
18
var walletTransactionsViewError : AppError ?
18
19
19
20
init (
20
- bdkClient: BDKClient = . live
21
+ bdkClient: BDKClient = . live,
22
+ keyClient: KeyClient = . live
21
23
) {
22
24
self . bdkClient = bdkClient
25
+ self . keyClient = keyClient
23
26
}
24
27
25
28
func getSentAndReceived( tx: BitcoinDevKit . Transaction ) -> SentAndReceivedValues ? {
@@ -35,4 +38,9 @@ class TransactionListViewModel {
35
38
}
36
39
}
37
40
41
+ func getEsploraURL( ) -> String ? {
42
+ let savedEsploraURL = try ? keyClient. getEsploraURL ( )
43
+ return savedEsploraURL
44
+ }
45
+
38
46
}
Original file line number Diff line number Diff line change @@ -29,10 +29,40 @@ struct TransactionListView: View {
29
29
. listRowInsets ( EdgeInsets ( ) )
30
30
. listRowSeparator ( . hidden)
31
31
} else if transactions. isEmpty {
32
- Text ( " No Transactions " )
33
- . font ( . subheadline)
34
- . listRowInsets ( EdgeInsets ( ) )
35
- . listRowSeparator ( . hidden)
32
+
33
+ VStack ( alignment: . leading) {
34
+
35
+ Text ( " No Transactions " )
36
+ . font ( . subheadline)
37
+
38
+ let mutinyFaucetURL = URL ( string: " https://faucet.mutinynet.com " )
39
+ let signetFaucetURL = URL ( string: " https://signetfaucet.com " )
40
+
41
+ if let mutinyFaucetURL, let signetFaucetURL {
42
+
43
+ Button {
44
+ UIApplication . shared. open (
45
+ viewModel. getEsploraURL ( )
46
+ == Constants . Config. EsploraServerURLNetwork. Signet. mutiny
47
+ ? mutinyFaucetURL : signetFaucetURL
48
+ )
49
+ } label: {
50
+ HStack ( spacing: 2 ) {
51
+ Text ( " Get sats from faucet " )
52
+ Image ( systemName: " arrow.right " )
53
+ }
54
+ . font ( . caption)
55
+ . foregroundStyle ( . secondary)
56
+ . underline ( )
57
+ }
58
+ . buttonStyle ( . plain)
59
+
60
+ }
61
+
62
+ }
63
+ . listRowInsets ( EdgeInsets ( ) )
64
+ . listRowSeparator ( . hidden)
65
+
36
66
} else {
37
67
38
68
ForEach (
@@ -99,4 +129,13 @@ struct TransactionListView: View {
99
129
walletSyncState: . synced
100
130
)
101
131
}
132
+ #Preview {
133
+ TransactionListView (
134
+ viewModel: . init(
135
+ bdkClient: . mock
136
+ ) ,
137
+ transactions: [ ] ,
138
+ walletSyncState: . synced
139
+ )
140
+ }
102
141
#endif
You can’t perform that action at this time.
0 commit comments