[#1218] Add zec rocks servers
- WIP [#1218] Add zec rocks servers - UI tweaked, servers tested
This commit is contained in:
parent
e2ea411b2c
commit
55efc372dc
|
@ -6,10 +6,9 @@ directly impact users rather than highlighting other crucial architectural updat
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## 1.0.6 build 1 (2024-04-24)
|
||||
|
||||
### Changed
|
||||
- The order of servers available to switch changed and few more servers were added to the list.
|
||||
- We have added one more group of server options (zec.rocks) for increased coverage and reliability
|
||||
- zec.rocks:443 is now default wallet option
|
||||
|
||||
## 1.0.5 build 4 (2024-04-19)
|
||||
|
||||
|
|
|
@ -24,8 +24,12 @@ extension ZcashSDKEnvironment {
|
|||
public static let udCustomServerKey = "zashi_udCustomServerKey"
|
||||
}
|
||||
|
||||
case mainnet
|
||||
case globalZR
|
||||
case custom
|
||||
case naZR
|
||||
case saZR
|
||||
case euZR
|
||||
case apZR
|
||||
case lwd1
|
||||
case lwd2
|
||||
case lwd3
|
||||
|
@ -34,40 +38,29 @@ extension ZcashSDKEnvironment {
|
|||
case lwd6
|
||||
case lwd7
|
||||
case lwd8
|
||||
case naNW
|
||||
case saNW
|
||||
case euNW
|
||||
case aiNW
|
||||
|
||||
public func server() -> String {
|
||||
switch self {
|
||||
case .mainnet: return "mainnet.lightwalletd.com:9067"
|
||||
case .globalZR: return "zec.rocks:443"
|
||||
case .custom: return "custom"
|
||||
case .naZR: return "na.zec.rocks:443"
|
||||
case .saZR: return "sa.zec.rocks:443"
|
||||
case .euZR: return "eu.zec.rocks:443"
|
||||
case .apZR: return "ap.zec.rocks:443"
|
||||
case .lwd1: return "lwd1.zcash-infra.com:9067"
|
||||
case .lwd2: return "lwd1.zcash-infra.com:9067"
|
||||
case .lwd3: return "lwd1.zcash-infra.com:9067"
|
||||
case .lwd4: return "lwd1.zcash-infra.com:9067"
|
||||
case .lwd5: return "lwd1.zcash-infra.com:9067"
|
||||
case .lwd6: return "lwd1.zcash-infra.com:9067"
|
||||
case .lwd7: return "lwd1.zcash-infra.com:9067"
|
||||
case .lwd8: return "lwd1.zcash-infra.com:9067"
|
||||
case .naNW: return "na.lightwalletd.com:443"
|
||||
case .saNW: return "sa.lightwalletd.com:443"
|
||||
case .euNW: return "eu.lightwalletd.com:443"
|
||||
case .aiNW: return "ai.lightwalletd.com:443"
|
||||
case .lwd2: return "lwd2.zcash-infra.com:9067"
|
||||
case .lwd3: return "lwd3.zcash-infra.com:9067"
|
||||
case .lwd4: return "lwd4.zcash-infra.com:9067"
|
||||
case .lwd5: return "lwd5.zcash-infra.com:9067"
|
||||
case .lwd6: return "lwd6.zcash-infra.com:9067"
|
||||
case .lwd7: return "lwd7.zcash-infra.com:9067"
|
||||
case .lwd8: return "lwd8.zcash-infra.com:9067"
|
||||
}
|
||||
}
|
||||
|
||||
public func lightWalletEndpoint(_ userDefaults: UserDefaultsClient) -> LightWalletEndpoint? {
|
||||
switch self {
|
||||
case .mainnet:
|
||||
return LightWalletEndpoint(
|
||||
address: "mainnet.lightwalletd.com",
|
||||
port: 9067,
|
||||
secure: true,
|
||||
streamingCallTimeoutInMillis: ZcashSDKConstants.streamingCallTimeoutInMillis
|
||||
)
|
||||
case .naNW, .saNW, .euNW, .aiNW:
|
||||
case .globalZR, .naZR, .saZR, .euZR, .apZR:
|
||||
return LightWalletEndpoint(
|
||||
address: String(self.server().dropLast(4)),
|
||||
port: 443,
|
||||
|
@ -123,9 +116,10 @@ extension ZcashSDKEnvironment {
|
|||
}
|
||||
|
||||
public enum ZcashSDKConstants {
|
||||
static let endpointMainnetAddress = "mainnet.lightwalletd.com"
|
||||
static let endpointMainnetAddress = "zec.rocks"
|
||||
static let endpointTestnetAddress = "lightwalletd.testnet.electriccoin.co"
|
||||
static let endpointPort = 9067
|
||||
static let endpointMainnetPort = 443
|
||||
static let endpointTestnetPort = 9067
|
||||
static let mnemonicWordsMaxCount = 24
|
||||
static let requiredTransactionConfirmations = 10
|
||||
static let streamingCallTimeoutInMillis = Int64(10 * 60 * 60 * 1000) // ten hours
|
||||
|
|
|
@ -27,7 +27,7 @@ extension ZcashSDKEnvironment {
|
|||
} else {
|
||||
// Initalization of LightWalletEndpoint failed, fallback to hardcoded one,
|
||||
// setting the mainnet key to the storage to reflect that
|
||||
userDefaults.setValue(ZcashSDKEnvironment.Servers.mainnet.rawValue, udKey)
|
||||
userDefaults.setValue(ZcashSDKEnvironment.Servers.globalZR.rawValue, udKey)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ extension ZcashSDKEnvironment {
|
|||
// Hardcoded endpoint
|
||||
return LightWalletEndpoint(
|
||||
address: Self.endpointString(for: network),
|
||||
port: ZcashSDKConstants.endpointPort,
|
||||
port: network.networkType == .testnet ? ZcashSDKConstants.endpointTestnetPort : ZcashSDKConstants.endpointMainnetPort,
|
||||
secure: true,
|
||||
streamingCallTimeoutInMillis: ZcashSDKConstants.streamingCallTimeoutInMillis
|
||||
)
|
||||
|
|
|
@ -17,7 +17,7 @@ extension ZcashSDKEnvironment: TestDependencyKey {
|
|||
endpoint: {
|
||||
LightWalletEndpoint(
|
||||
address: ZcashSDKConstants.endpointTestnetAddress,
|
||||
port: ZcashSDKConstants.endpointPort,
|
||||
port: ZcashSDKConstants.endpointTestnetPort,
|
||||
secure: true,
|
||||
streamingCallTimeoutInMillis: ZcashSDKConstants.streamingCallTimeoutInMillis
|
||||
)
|
||||
|
|
|
@ -22,13 +22,13 @@ public struct ServerSetup {
|
|||
public struct State: Equatable {
|
||||
@Presents var alert: AlertState<Action>?
|
||||
var isUpdatingServer = false
|
||||
var initialServer: ZcashSDKEnvironment.Servers = .mainnet
|
||||
var server: ZcashSDKEnvironment.Servers = .mainnet
|
||||
var initialServer: ZcashSDKEnvironment.Servers = .globalZR
|
||||
var server: ZcashSDKEnvironment.Servers = .globalZR
|
||||
var customServer: String
|
||||
|
||||
public init(
|
||||
isUpdatingServer: Bool = false,
|
||||
server: ZcashSDKEnvironment.Servers = .mainnet,
|
||||
server: ZcashSDKEnvironment.Servers = .globalZR,
|
||||
customServer: String = ""
|
||||
) {
|
||||
self.isUpdatingServer = isUpdatingServer
|
||||
|
|
|
@ -21,66 +21,73 @@ public struct ServerSetupView: View {
|
|||
|
||||
public var body: some View {
|
||||
WithPerceptionTracking {
|
||||
VStack(alignment: .center) {
|
||||
Text(L10n.ServerSetup.title)
|
||||
.font(.custom(FontFamily.Inter.medium.name, size: 16))
|
||||
.foregroundColor(Asset.Colors.primary.color)
|
||||
.padding(.vertical, 25)
|
||||
|
||||
ForEach(ZcashSDKEnvironment.Servers.allCases, id: \.self) { server in
|
||||
VStack {
|
||||
HStack(spacing: 0) {
|
||||
Button {
|
||||
store.send(.someServerTapped(server))
|
||||
} label: {
|
||||
HStack(spacing: 10) {
|
||||
WithPerceptionTracking {
|
||||
if server == store.server {
|
||||
Circle()
|
||||
.fill(Asset.Colors.primary.color)
|
||||
.frame(width: 20, height: 20)
|
||||
.overlay {
|
||||
Circle()
|
||||
.fill(Asset.Colors.secondary.color)
|
||||
.frame(width: 8, height: 8)
|
||||
}
|
||||
} else {
|
||||
Circle()
|
||||
.stroke(Asset.Colors.primary.color)
|
||||
.frame(width: 20, height: 20)
|
||||
VStack(alignment: .center, spacing: 0) {
|
||||
Asset.Colors.secondary.color
|
||||
.frame(height: 1)
|
||||
|
||||
ScrollView {
|
||||
ForEach(ZcashSDKEnvironment.Servers.allCases, id: \.self) { server in
|
||||
VStack {
|
||||
HStack(spacing: 0) {
|
||||
Button {
|
||||
store.send(.someServerTapped(server))
|
||||
} label: {
|
||||
HStack(spacing: 10) {
|
||||
WithPerceptionTracking {
|
||||
if server == store.server {
|
||||
Circle()
|
||||
.fill(Asset.Colors.primary.color)
|
||||
.frame(width: 20, height: 20)
|
||||
.overlay {
|
||||
Circle()
|
||||
.fill(Asset.Colors.secondary.color)
|
||||
.frame(width: 8, height: 8)
|
||||
}
|
||||
} else {
|
||||
Circle()
|
||||
.stroke(Asset.Colors.primary.color)
|
||||
.frame(width: 20, height: 20)
|
||||
}
|
||||
}
|
||||
|
||||
Text(server.server()).tag(server)
|
||||
.font(.custom(FontFamily.Inter.medium.name, size: 14))
|
||||
.foregroundColor(Asset.Colors.shade30.color)
|
||||
}
|
||||
|
||||
Text(server.server()).tag(server)
|
||||
}
|
||||
.padding(.vertical, 6)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
|
||||
WithPerceptionTracking {
|
||||
if store.server == .custom && server == .custom {
|
||||
TextField(L10n.ServerSetup.placeholder, text: $store.customServer)
|
||||
.frame(height: 40)
|
||||
.font(.custom(FontFamily.Inter.medium.name, size: 14))
|
||||
.foregroundColor(Asset.Colors.shade30.color)
|
||||
.autocapitalization(.none)
|
||||
.multilineTextAlignment(.leading)
|
||||
.padding(.horizontal, 10)
|
||||
.overlay {
|
||||
Rectangle()
|
||||
.stroke(Asset.Colors.primary.color, lineWidth: 1)
|
||||
}
|
||||
.padding(.top, 8)
|
||||
}
|
||||
}
|
||||
.padding(.vertical, 6)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
|
||||
WithPerceptionTracking {
|
||||
if store.server == .custom && server == .custom {
|
||||
TextField(L10n.ServerSetup.placeholder, text: $store.customServer)
|
||||
.frame(height: 40)
|
||||
.font(.custom(FontFamily.Inter.medium.name, size: 14))
|
||||
.foregroundColor(Asset.Colors.shade30.color)
|
||||
.autocapitalization(.none)
|
||||
.multilineTextAlignment(.leading)
|
||||
.padding(.horizontal, 10)
|
||||
.overlay {
|
||||
Rectangle()
|
||||
.stroke(Asset.Colors.primary.color, lineWidth: 1)
|
||||
}
|
||||
.padding(.top, 8)
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 35)
|
||||
}
|
||||
.padding(.top, 20)
|
||||
}
|
||||
|
||||
|
||||
Asset.Colors.shade30.color
|
||||
.frame(maxWidth: .infinity)
|
||||
.frame(height: 1)
|
||||
.opacity(0.15)
|
||||
|
||||
Button {
|
||||
store.send(.setServerTapped)
|
||||
} label: {
|
||||
|
@ -94,22 +101,21 @@ public struct ServerSetupView: View {
|
|||
}
|
||||
}
|
||||
.zcashStyle()
|
||||
.padding(.vertical, 35)
|
||||
.padding(.top, 20)
|
||||
.padding(.bottom, 35)
|
||||
.padding(.horizontal, 70)
|
||||
.disabled(store.isUpdatingServer)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.horizontal, 30)
|
||||
.frame(maxWidth: .infinity)
|
||||
.zashiBack(store.isUpdatingServer)
|
||||
.zashiTitle {
|
||||
Asset.Assets.zashiTitle.image
|
||||
.resizable()
|
||||
.frame(width: 62, height: 17)
|
||||
Text(L10n.ServerSetup.title.uppercased())
|
||||
.font(.custom(FontFamily.Archivo.bold.name, size: 14))
|
||||
}
|
||||
.onAppear { store.send(.onAppear) }
|
||||
.alert($store.scope(state: \.alert, action: \.alert))
|
||||
}
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ public struct SyncProgressView: View {
|
|||
Text(viewStore.syncStatusMessage)
|
||||
.multilineTextAlignment(.center)
|
||||
.font(.custom(FontFamily.Inter.regular.name, size: 10))
|
||||
.padding(.horizontal, 35)
|
||||
}
|
||||
|
||||
Text(String(format: "%0.1f%%", viewStore.syncingPercentage * 100))
|
||||
|
|
Loading…
Reference in New Issue