Skip to content

Commit 7bb39e8

Browse files
RubensRubens
authored andcommitted
improv: moved Network.url: String to a better place
1 parent 51f97a9 commit 7bb39e8

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

BDKSwiftExampleWallet/Extensions/BDK+Extensions/Network+Extensions.swift

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,6 @@ extension Network {
3131
}
3232
}
3333

34-
extension Network {
35-
var url: String {
36-
switch self {
37-
case .bitcoin:
38-
Constants.Config.EsploraServerURLNetwork.Bitcoin.allValues.first ?? ""
39-
case .testnet:
40-
Constants.Config.EsploraServerURLNetwork.Testnet.allValues.first ?? ""
41-
case .signet:
42-
Constants.Config.EsploraServerURLNetwork.Signet.allValues.first ?? ""
43-
case .regtest:
44-
Constants.Config.EsploraServerURLNetwork.Regtest.allValues.first ?? ""
45-
case .testnet4:
46-
Constants.Config.EsploraServerURLNetwork.Testnet4.allValues.first ?? ""
47-
}
48-
}
49-
}
50-
5134
#if DEBUG
5235
let mockKeyClientNetwork = Network.regtest
5336
#endif

BDKSwiftExampleWallet/Utilities/Constants.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import Foundation
99
import SwiftUI
10+
import BitcoinDevKit
1011

1112
struct Constants {
1213
struct Config {
@@ -76,3 +77,20 @@ struct Constants {
7677
}
7778
}
7879
}
80+
81+
extension Network {
82+
var url: String {
83+
switch self {
84+
case .bitcoin:
85+
Constants.Config.EsploraServerURLNetwork.Bitcoin.allValues.first ?? ""
86+
case .testnet:
87+
Constants.Config.EsploraServerURLNetwork.Testnet.allValues.first ?? ""
88+
case .signet:
89+
Constants.Config.EsploraServerURLNetwork.Signet.allValues.first ?? ""
90+
case .regtest:
91+
Constants.Config.EsploraServerURLNetwork.Regtest.allValues.first ?? ""
92+
case .testnet4:
93+
Constants.Config.EsploraServerURLNetwork.Testnet4.allValues.first ?? ""
94+
}
95+
}
96+
}

0 commit comments

Comments
 (0)