2022-04-13 06:52:31 -07:00
|
|
|
//
|
|
|
|
// ZCashSDKEnvironment.swift
|
|
|
|
// secant-testnet
|
|
|
|
//
|
|
|
|
// Created by Lukáš Korba on 13.04.2022.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
import ZcashLightClientKit
|
|
|
|
|
|
|
|
// swiftlint:disable:next private_over_fileprivate strict_fileprivate
|
|
|
|
fileprivate enum ZcashSDKConstants {
|
|
|
|
static let endpointMainnetAddress = "lightwalletd.electriccoin.co"
|
|
|
|
static let endpointTestnetAddress = "lightwalletd.testnet.electriccoin.co"
|
|
|
|
static let endpointPort = 9067
|
|
|
|
static let defaultBlockHeight = 1_629_724
|
2022-05-26 05:47:55 -07:00
|
|
|
static let mnemonicWordsMaxCount = 24
|
2022-04-13 06:52:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
struct ZCashSDKEnvironment {
|
|
|
|
let defaultBirthday: BlockHeight
|
|
|
|
let endpoint: LightWalletEndpoint
|
|
|
|
let lightWalletService: LightWalletService
|
|
|
|
let network: ZcashNetwork
|
2022-05-26 05:47:55 -07:00
|
|
|
let mnemonicWordsMaxCount: Int
|
2022-04-13 06:52:31 -07:00
|
|
|
let isMainnet: () -> Bool
|
|
|
|
}
|
|
|
|
|
|
|
|
extension ZCashSDKEnvironment {
|
|
|
|
static let mainnet = ZCashSDKEnvironment(
|
|
|
|
defaultBirthday: BlockHeight(ZcashSDKConstants.defaultBlockHeight),
|
|
|
|
endpoint: LightWalletEndpoint(address: ZcashSDKConstants.endpointMainnetAddress, port: ZcashSDKConstants.endpointPort),
|
|
|
|
lightWalletService: LightWalletGRPCService(
|
|
|
|
endpoint: LightWalletEndpoint(address: ZcashSDKConstants.endpointMainnetAddress, port: ZcashSDKConstants.endpointPort)
|
|
|
|
),
|
|
|
|
network: ZcashNetworkBuilder.network(for: .mainnet),
|
2022-05-26 05:47:55 -07:00
|
|
|
mnemonicWordsMaxCount: ZcashSDKConstants.mnemonicWordsMaxCount,
|
2022-04-13 06:52:31 -07:00
|
|
|
isMainnet: { true }
|
|
|
|
)
|
|
|
|
|
|
|
|
static let testnet = ZCashSDKEnvironment(
|
|
|
|
defaultBirthday: BlockHeight(ZcashSDKConstants.defaultBlockHeight),
|
|
|
|
endpoint: LightWalletEndpoint(address: ZcashSDKConstants.endpointTestnetAddress, port: ZcashSDKConstants.endpointPort),
|
|
|
|
lightWalletService: LightWalletGRPCService(
|
|
|
|
endpoint: LightWalletEndpoint(address: ZcashSDKConstants.endpointTestnetAddress, port: ZcashSDKConstants.endpointPort)
|
|
|
|
),
|
|
|
|
network: ZcashNetworkBuilder.network(for: .testnet),
|
2022-05-26 05:47:55 -07:00
|
|
|
mnemonicWordsMaxCount: ZcashSDKConstants.mnemonicWordsMaxCount,
|
2022-04-13 06:52:31 -07:00
|
|
|
isMainnet: { false }
|
|
|
|
)
|
|
|
|
}
|