ZcashLightClientKit/Example/ZcashLightClientSample/ZcashLightClientSample/DemoAppConfig.swift

46 lines
1.5 KiB
Swift
Raw Normal View History

2019-10-31 15:43:09 -07:00
//
// DemoAppConfig.swift
// ZcashLightClientSample
//
// Created by Francisco Gindre on 10/31/19.
// Copyright © 2019 Electric Coin Company. All rights reserved.
//
import Foundation
import ZcashLightClientKit
2020-06-09 07:27:10 -07:00
import MnemonicSwift
2021-09-15 05:21:29 -07:00
// swiftlint:disable line_length force_try
enum DemoAppConfig {
2021-02-17 15:02:25 -08:00
static var host = ZcashSDK.isMainnet ? "lightwalletd.electriccoin.co" : "lightwalletd.testnet.electriccoin.co"
static var port: Int = 9067
2021-06-20 07:59:00 -07:00
static var birthdayHeight: BlockHeight = ZcashSDK.isMainnet ? 935000 : 1386000
2021-06-20 07:59:00 -07:00
static var seed = try! Mnemonic.deterministicSeedBytes(from: "live combine flight accident slow soda mind bright absent bid hen shy decade biology amazing mix enlist ensure biology rhythm snap duty soap armor")
2019-10-31 15:43:09 -07:00
static var address: String {
"\(host):\(port)"
}
static var processorConfig: CompactBlockProcessor.Configuration = {
2021-09-17 06:49:58 -07:00
CompactBlockProcessor.Configuration(
cacheDb: try! cacheDbURLHelper(),
dataDb: try! dataDbURLHelper(),
walletBirthday: Self.birthdayHeight,
network: kZcashNetwork
)
}()
static var endpoint: LightWalletEndpoint {
return LightWalletEndpoint(address: self.host, port: self.port, secure: true, streamingCallTimeoutInMillis: 10 * 60 * 60 * 1000)
}
2019-10-31 15:43:09 -07:00
}
extension ZcashSDK {
static var isMainnet: Bool {
2021-09-15 05:21:29 -07:00
switch kZcashNetwork.networkType {
2021-09-17 06:49:58 -07:00
case .mainnet: return true
case .testnet: return false
}
}
2019-10-31 15:43:09 -07:00
}