Merge pull request #1219 from LukasKorba/1218-Add-zec-rocks-servers

[#1218] Add zec rocks servers
This commit is contained in:
Lukas Korba 2024-04-26 13:25:28 +02:00 committed by GitHub
commit 17e5721ddc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 112 additions and 110 deletions

View File

@ -7,7 +7,8 @@ directly impact users rather than highlighting other crucial architectural updat
## [Unreleased]
### 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)

View File

@ -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

View File

@ -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
)

View File

@ -17,7 +17,7 @@ extension ZcashSDKEnvironment: TestDependencyKey {
endpoint: {
LightWalletEndpoint(
address: ZcashSDKConstants.endpointTestnetAddress,
port: ZcashSDKConstants.endpointPort,
port: ZcashSDKConstants.endpointTestnetPort,
secure: true,
streamingCallTimeoutInMillis: ZcashSDKConstants.streamingCallTimeoutInMillis
)

View File

@ -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

View File

@ -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)
}
}

View File

@ -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))

View File

@ -1204,7 +1204,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_ASSET_PATHS = "\"secant/Preview Content\"";
DEVELOPMENT_TEAM = RLPRR8CPQG;
@ -1217,7 +1217,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.5;
MARKETING_VERSION = 1.0.6;
OTHER_SWIFT_FLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = "co.electriccoin.secant-mainnet";
PRODUCT_NAME = "$(TARGET_NAME)";
@ -1234,7 +1234,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"secant/Preview Content\"";
DEVELOPMENT_TEAM = RLPRR8CPQG;
ENABLE_BITCODE = NO;
@ -1246,7 +1246,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.5;
MARKETING_VERSION = 1.0.6;
OTHER_SWIFT_FLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = "co.electriccoin.secant-mainnet";
PRODUCT_NAME = "$(TARGET_NAME)";
@ -1383,7 +1383,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-testnet";
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_ASSET_PATHS = "\"secant/Preview Content\"";
DEVELOPMENT_TEAM = RLPRR8CPQG;
@ -1396,7 +1396,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.5;
MARKETING_VERSION = 1.0.6;
OTHER_SWIFT_FLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = "co.electriccoin.secant-testnet";
PRODUCT_NAME = "$(TARGET_NAME)";
@ -1413,7 +1413,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-testnet";
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"secant/Preview Content\"";
DEVELOPMENT_TEAM = RLPRR8CPQG;
ENABLE_BITCODE = NO;
@ -1425,7 +1425,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.5;
MARKETING_VERSION = 1.0.6;
OTHER_SWIFT_FLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = "co.electriccoin.secant-testnet";
PRODUCT_NAME = "$(TARGET_NAME)";
@ -1539,7 +1539,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_ASSET_PATHS = "\"secant/Preview Content\"";
DEVELOPMENT_TEAM = RLPRR8CPQG;
@ -1552,7 +1552,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.5;
MARKETING_VERSION = 1.0.6;
OTHER_SWIFT_FLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = "co.electriccoin.secant-mainnet";
PRODUCT_NAME = "$(TARGET_NAME)";
@ -1569,7 +1569,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"secant/Preview Content\"";
DEVELOPMENT_TEAM = RLPRR8CPQG;
ENABLE_BITCODE = NO;
@ -1581,7 +1581,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.5;
MARKETING_VERSION = 1.0.6;
OTHER_SWIFT_FLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = "co.electriccoin.secant-mainnet";
PRODUCT_NAME = "$(TARGET_NAME)";
@ -1655,7 +1655,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-testnet";
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"secant/Preview Content\"";
DEVELOPMENT_TEAM = RLPRR8CPQG;
ENABLE_BITCODE = NO;
@ -1667,7 +1667,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.5;
MARKETING_VERSION = 1.0.6;
OTHER_SWIFT_FLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = "co.electriccoin.secant-testnet";
PRODUCT_NAME = "$(TARGET_NAME)";
@ -1684,7 +1684,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"secant/Preview Content\"";
DEVELOPMENT_TEAM = RLPRR8CPQG;
ENABLE_BITCODE = NO;
@ -1696,7 +1696,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.5;
MARKETING_VERSION = 1.0.6;
OTHER_SWIFT_FLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = "co.electriccoin.secant-mainnet";
PRODUCT_NAME = "$(TARGET_NAME)";
@ -1759,7 +1759,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"secant/Preview Content\"";
DEVELOPMENT_TEAM = RLPRR8CPQG;
ENABLE_BITCODE = NO;
@ -1771,7 +1771,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.5;
MARKETING_VERSION = 1.0.6;
OTHER_SWIFT_FLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = "co.electriccoin.secant-mainnet";
PRODUCT_NAME = "$(TARGET_NAME)";