2019-10-18 11:45:19 -07:00
|
|
|
//
|
2019-11-14 06:38:54 -08:00
|
|
|
// Initializer.swift
|
2019-10-18 11:45:19 -07:00
|
|
|
// ZcashLightClientKit
|
|
|
|
//
|
|
|
|
// Created by Francisco Gindre on 13/09/2019.
|
|
|
|
// Copyright © 2019 Electric Coin Company. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
2021-09-17 06:49:58 -07:00
|
|
|
/**
|
|
|
|
Wrapper for the Rust backend. This class basically represents all the Rust-wallet
|
|
|
|
capabilities and the supporting data required to exercise those abilities.
|
|
|
|
*/
|
2019-11-14 06:38:54 -08:00
|
|
|
public enum InitializerError: Error {
|
2019-10-18 11:45:19 -07:00
|
|
|
case cacheDbInitFailed
|
|
|
|
case dataDbInitFailed
|
2019-11-01 12:59:16 -07:00
|
|
|
case accountInitFailed
|
|
|
|
case falseStart
|
2020-10-14 15:50:26 -07:00
|
|
|
case invalidViewingKey(key: String)
|
2019-10-18 11:45:19 -07:00
|
|
|
}
|
2019-11-14 06:38:54 -08:00
|
|
|
|
2020-02-26 08:54:48 -08:00
|
|
|
/**
|
2021-09-17 06:49:58 -07:00
|
|
|
Represents a lightwallet instance endpoint to connect to
|
|
|
|
*/
|
2019-11-14 06:38:54 -08:00
|
|
|
public struct LightWalletEndpoint {
|
2020-04-09 15:25:43 -07:00
|
|
|
public var host: String
|
|
|
|
public var port: Int
|
2019-11-14 06:38:54 -08:00
|
|
|
public var secure: Bool
|
2021-06-15 14:53:21 -07:00
|
|
|
public var singleCallTimeoutInMillis: Int64
|
|
|
|
public var streamingCallTimeoutInMillis: Int64
|
2019-11-14 06:38:54 -08:00
|
|
|
|
2021-09-17 06:49:58 -07:00
|
|
|
/**
|
|
|
|
initializes a LightWalletEndpoint
|
|
|
|
- Parameters:
|
2020-02-26 08:54:48 -08:00
|
|
|
- address: a String containing the host address
|
|
|
|
- port: string with the port of the host address
|
|
|
|
- secure: true if connecting through TLS. Default value is true
|
2022-07-29 06:07:08 -07:00
|
|
|
- singleCallTimeoutInMillis: timeout for single calls in Milliseconds. Default 30 seconds
|
|
|
|
- streamingCallTimeoutInMillis: timeout for streaming calls in Milliseconds. Default 100 seconds
|
2021-09-17 06:49:58 -07:00
|
|
|
*/
|
|
|
|
public init(
|
|
|
|
address: String,
|
|
|
|
port: Int,
|
|
|
|
secure: Bool = true,
|
2022-07-29 06:07:08 -07:00
|
|
|
singleCallTimeoutInMillis: Int64 = 30000,
|
2021-09-17 06:49:58 -07:00
|
|
|
streamingCallTimeoutInMillis: Int64 = 100000
|
|
|
|
) {
|
2020-04-09 15:25:43 -07:00
|
|
|
self.host = address
|
2019-11-14 06:38:54 -08:00
|
|
|
self.port = port
|
|
|
|
self.secure = secure
|
2021-06-15 14:53:21 -07:00
|
|
|
self.singleCallTimeoutInMillis = singleCallTimeoutInMillis
|
|
|
|
self.streamingCallTimeoutInMillis = streamingCallTimeoutInMillis
|
2019-11-14 06:38:54 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-04 15:18:07 -08:00
|
|
|
/**
|
2021-09-17 06:49:58 -07:00
|
|
|
Wrapper for all the Rust backend functionality that does not involve processing blocks. This
|
|
|
|
class initializes the Rust backend and the supporting data required to exercise those abilities.
|
|
|
|
The [cash.z.wallet.sdk.block.CompactBlockProcessor] handles all the remaining Rust backend
|
|
|
|
functionality, related to processing blocks.
|
|
|
|
*/
|
2019-11-14 06:38:54 -08:00
|
|
|
public class Initializer {
|
2022-08-24 08:38:42 -07:00
|
|
|
|
|
|
|
public enum InitializationResult {
|
|
|
|
case success
|
|
|
|
case seedRequired
|
|
|
|
}
|
|
|
|
|
2020-06-03 16:18:57 -07:00
|
|
|
private(set) var rustBackend: ZcashRustBackendWelding.Type
|
2020-10-14 15:50:26 -07:00
|
|
|
private(set) var alias: String
|
|
|
|
private(set) var endpoint: LightWalletEndpoint
|
|
|
|
|
2020-06-03 16:18:57 -07:00
|
|
|
private var lowerBoundHeight: BlockHeight
|
2019-11-26 14:32:20 -08:00
|
|
|
private(set) var cacheDbURL: URL
|
|
|
|
private(set) var dataDbURL: URL
|
2019-12-06 04:38:47 -08:00
|
|
|
private(set) var pendingDbURL: URL
|
2019-11-26 14:32:20 -08:00
|
|
|
private(set) var spendParamsURL: URL
|
|
|
|
private(set) var outputParamsURL: URL
|
2020-06-03 16:18:57 -07:00
|
|
|
private(set) var lightWalletService: LightWalletService
|
2020-02-26 08:54:48 -08:00
|
|
|
private(set) var transactionRepository: TransactionRepository
|
2021-04-08 10:18:16 -07:00
|
|
|
private(set) var accountRepository: AccountRepository
|
2021-06-02 14:32:05 -07:00
|
|
|
private(set) var storage: CompactBlockStorage
|
2020-02-26 08:54:48 -08:00
|
|
|
private(set) var downloader: CompactBlockDownloader
|
2021-07-28 09:59:10 -07:00
|
|
|
private(set) var network: ZcashNetwork
|
2022-06-28 15:02:02 -07:00
|
|
|
private(set) public var viewingKeys: [UnifiedFullViewingKey]
|
2022-07-29 06:33:23 -07:00
|
|
|
/// The effective birthday of the wallet based on the height provided when initializing
|
|
|
|
/// and the checkpoints available on this SDK
|
2022-07-12 12:36:12 -07:00
|
|
|
private(set) public var walletBirthday: BlockHeight
|
2021-09-17 06:49:58 -07:00
|
|
|
|
2020-02-26 08:54:48 -08:00
|
|
|
/**
|
2021-09-17 06:49:58 -07:00
|
|
|
Constructs the Initializer
|
|
|
|
- Parameters:
|
2020-02-26 08:54:48 -08:00
|
|
|
- cacheDbURL: location of the compact blocks cache db
|
|
|
|
- dataDbURL: Location of the data db
|
|
|
|
- pendingDbURL: location of the pending transactions database
|
|
|
|
- endpoint: the endpoint representing the lightwalletd instance you want to point to
|
|
|
|
- spendParamsURL: location of the spend parameters
|
|
|
|
- outputParamsURL: location of the output parameters
|
2021-09-17 06:49:58 -07:00
|
|
|
*/
|
|
|
|
convenience public init (
|
|
|
|
cacheDbURL: URL,
|
|
|
|
dataDbURL: URL,
|
|
|
|
pendingDbURL: URL,
|
|
|
|
endpoint: LightWalletEndpoint,
|
|
|
|
network: ZcashNetwork,
|
|
|
|
spendParamsURL: URL,
|
|
|
|
outputParamsURL: URL,
|
2022-06-28 15:02:02 -07:00
|
|
|
viewingKeys: [UnifiedFullViewingKey],
|
2021-09-17 06:49:58 -07:00
|
|
|
walletBirthday: BlockHeight,
|
|
|
|
alias: String = "",
|
|
|
|
loggerProxy: Logger? = nil
|
|
|
|
) {
|
2020-06-03 16:18:57 -07:00
|
|
|
let lwdService = LightWalletGRPCService(endpoint: endpoint)
|
2020-03-09 13:25:27 -07:00
|
|
|
|
2021-09-17 06:49:58 -07:00
|
|
|
self.init(
|
|
|
|
rustBackend: ZcashRustBackend.self,
|
|
|
|
lowerBoundHeight: walletBirthday,
|
|
|
|
network: network,
|
|
|
|
cacheDbURL: cacheDbURL,
|
|
|
|
dataDbURL: dataDbURL,
|
|
|
|
pendingDbURL: pendingDbURL,
|
|
|
|
endpoint: endpoint,
|
|
|
|
service: lwdService,
|
|
|
|
repository: TransactionRepositoryBuilder.build(dataDbURL: dataDbURL),
|
|
|
|
accountRepository: AccountRepositoryBuilder.build(
|
|
|
|
dataDbURL: dataDbURL,
|
|
|
|
readOnly: true,
|
|
|
|
caching: true
|
|
|
|
),
|
|
|
|
storage: CompactBlockStorage(url: cacheDbURL, readonly: false),
|
|
|
|
spendParamsURL: spendParamsURL,
|
|
|
|
outputParamsURL: outputParamsURL,
|
|
|
|
viewingKeys: viewingKeys,
|
|
|
|
walletBirthday: walletBirthday,
|
|
|
|
alias: alias,
|
|
|
|
loggerProxy: loggerProxy
|
2020-06-03 16:18:57 -07:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-09-17 06:49:58 -07:00
|
|
|
Internal for dependency injection purposes
|
|
|
|
*/
|
|
|
|
init(
|
|
|
|
rustBackend: ZcashRustBackendWelding.Type,
|
|
|
|
lowerBoundHeight: BlockHeight,
|
|
|
|
network: ZcashNetwork,
|
|
|
|
cacheDbURL: URL,
|
|
|
|
dataDbURL: URL,
|
|
|
|
pendingDbURL: URL,
|
|
|
|
endpoint: LightWalletEndpoint,
|
|
|
|
service: LightWalletService,
|
|
|
|
repository: TransactionRepository,
|
|
|
|
accountRepository: AccountRepository,
|
|
|
|
storage: CompactBlockStorage,
|
|
|
|
spendParamsURL: URL,
|
|
|
|
outputParamsURL: URL,
|
2022-06-28 15:02:02 -07:00
|
|
|
viewingKeys: [UnifiedFullViewingKey],
|
2021-09-17 06:49:58 -07:00
|
|
|
walletBirthday: BlockHeight,
|
|
|
|
alias: String = "",
|
|
|
|
loggerProxy: Logger? = nil
|
2020-06-03 16:18:57 -07:00
|
|
|
) {
|
2020-03-09 13:25:27 -07:00
|
|
|
logger = loggerProxy
|
2020-06-03 16:18:57 -07:00
|
|
|
self.rustBackend = rustBackend
|
|
|
|
self.lowerBoundHeight = lowerBoundHeight
|
2019-10-18 11:45:19 -07:00
|
|
|
self.cacheDbURL = cacheDbURL
|
2019-11-01 12:59:16 -07:00
|
|
|
self.dataDbURL = dataDbURL
|
2019-12-06 04:38:47 -08:00
|
|
|
self.pendingDbURL = pendingDbURL
|
2020-10-14 15:50:26 -07:00
|
|
|
self.endpoint = endpoint
|
2019-11-26 14:32:20 -08:00
|
|
|
self.spendParamsURL = spendParamsURL
|
|
|
|
self.outputParamsURL = outputParamsURL
|
2020-10-14 15:50:26 -07:00
|
|
|
self.alias = alias
|
2020-06-03 16:18:57 -07:00
|
|
|
self.lightWalletService = service
|
|
|
|
self.transactionRepository = repository
|
2021-04-08 10:18:16 -07:00
|
|
|
self.accountRepository = accountRepository
|
2021-06-02 14:32:05 -07:00
|
|
|
self.storage = storage
|
|
|
|
self.downloader = CompactBlockDownloader(service: service, storage: storage)
|
2021-05-05 12:08:57 -07:00
|
|
|
self.viewingKeys = viewingKeys
|
2022-07-12 12:36:12 -07:00
|
|
|
self.walletBirthday = walletBirthday
|
2021-07-26 16:22:30 -07:00
|
|
|
self.network = network
|
2019-10-18 11:45:19 -07:00
|
|
|
}
|
2021-09-17 06:49:58 -07:00
|
|
|
|
2022-10-02 19:11:17 -07:00
|
|
|
/// Initialize the wallet. The ZIP-32 seed bytes can optionally be passed to perform
|
|
|
|
/// database migrations. most of the times the seed won't be needed. If they do and are
|
|
|
|
/// not provided this will fail with `InitializationResult.seedRequired`. It could
|
|
|
|
/// be the case that this method is invoked by a wallet that does not contain the seed phrase
|
|
|
|
/// and is view-only, or by a wallet that does have the seed but the process does not have the
|
|
|
|
/// consent of the OS to fetch the keys from the secure storage, like on background tasks.
|
|
|
|
///
|
|
|
|
/// 'cache.db' and 'data.db' files are created by this function (if they
|
|
|
|
/// do not already exist). These files can be given a prefix for scenarios where multiple wallets
|
|
|
|
///
|
|
|
|
/// - Parameter seed: ZIP-32 Seed bytes for the wallet that will be initialized
|
|
|
|
/// - Throws: `InitializerError.dataDbInitFailed` if the creation of the dataDb fails
|
|
|
|
/// `InitializerError.accountInitFailed` if the account table can't be initialized.
|
2022-08-24 08:38:42 -07:00
|
|
|
public func initialize(with seed: [UInt8]?) throws -> InitializationResult {
|
2021-06-02 14:32:05 -07:00
|
|
|
do {
|
|
|
|
try storage.createTable()
|
|
|
|
} catch {
|
|
|
|
throw InitializerError.cacheDbInitFailed
|
|
|
|
}
|
2019-10-18 11:45:19 -07:00
|
|
|
|
2019-11-01 12:59:16 -07:00
|
|
|
do {
|
2022-08-24 08:38:42 -07:00
|
|
|
if case .seedRequired = try rustBackend.initDataDb(dbData: dataDbURL, seed: seed, networkType: network.networkType) {
|
|
|
|
return .seedRequired
|
|
|
|
}
|
2019-11-01 12:59:16 -07:00
|
|
|
} catch {
|
2019-11-14 06:38:54 -08:00
|
|
|
throw InitializerError.dataDbInitFailed
|
2019-10-18 11:45:19 -07:00
|
|
|
}
|
2022-07-29 06:33:23 -07:00
|
|
|
|
|
|
|
let checkpoint = Checkpoint.birthday(with: self.walletBirthday, network: network)
|
2019-11-01 12:59:16 -07:00
|
|
|
do {
|
2021-09-15 05:21:29 -07:00
|
|
|
try rustBackend.initBlocksTable(
|
|
|
|
dbData: dataDbURL,
|
2022-07-12 12:36:12 -07:00
|
|
|
height: Int32(checkpoint.height),
|
|
|
|
hash: checkpoint.hash,
|
|
|
|
time: checkpoint.time,
|
|
|
|
saplingTree: checkpoint.saplingTree,
|
2021-09-15 05:21:29 -07:00
|
|
|
networkType: network.networkType
|
|
|
|
)
|
2019-11-01 12:59:16 -07:00
|
|
|
} catch RustWeldingError.dataDbNotEmpty {
|
|
|
|
// this is fine
|
|
|
|
} catch {
|
2019-11-14 06:38:54 -08:00
|
|
|
throw InitializerError.dataDbInitFailed
|
2019-11-01 12:59:16 -07:00
|
|
|
}
|
2022-07-29 06:33:23 -07:00
|
|
|
self.walletBirthday = checkpoint.height
|
2019-11-01 12:59:16 -07:00
|
|
|
|
2022-07-12 12:36:12 -07:00
|
|
|
let lastDownloaded = (try? downloader.storage.latestHeight()) ?? walletBirthday
|
2019-11-14 06:38:54 -08:00
|
|
|
// resume from last downloaded block
|
2022-07-12 12:36:12 -07:00
|
|
|
lowerBoundHeight = max(walletBirthday, lastDownloaded)
|
2021-03-08 10:47:36 -08:00
|
|
|
|
2020-12-08 06:19:41 -08:00
|
|
|
do {
|
2021-09-17 06:49:58 -07:00
|
|
|
guard try rustBackend.initAccountsTable(
|
|
|
|
dbData: dataDbURL,
|
2022-06-28 15:02:02 -07:00
|
|
|
ufvks: viewingKeys,
|
2021-09-17 06:49:58 -07:00
|
|
|
networkType: network.networkType
|
|
|
|
) else {
|
2020-12-08 06:19:41 -08:00
|
|
|
throw rustBackend.lastError() ?? InitializerError.accountInitFailed
|
|
|
|
}
|
|
|
|
} catch RustWeldingError.dataDbNotEmpty {
|
|
|
|
// this is fine
|
2022-06-28 14:40:52 -07:00
|
|
|
} catch RustWeldingError.malformedStringInput {
|
|
|
|
throw RustWeldingError.malformedStringInput
|
2021-09-15 05:21:29 -07:00
|
|
|
} catch {
|
2019-11-14 06:38:54 -08:00
|
|
|
throw rustBackend.lastError() ?? InitializerError.accountInitFailed
|
2019-11-01 12:59:16 -07:00
|
|
|
}
|
2022-08-24 08:38:42 -07:00
|
|
|
|
2022-10-19 07:29:15 -07:00
|
|
|
let migrationManager = MigrationManager(
|
|
|
|
cacheDbConnection: SimpleConnectionProvider(path: cacheDbURL.path),
|
|
|
|
pendingDbConnection: SimpleConnectionProvider(path: pendingDbURL.path),
|
|
|
|
networkType: self.network.networkType
|
|
|
|
)
|
|
|
|
|
|
|
|
try migrationManager.performMigration()
|
|
|
|
|
2022-08-24 08:38:42 -07:00
|
|
|
return .success
|
2019-10-18 11:45:19 -07:00
|
|
|
}
|
2022-06-22 12:45:37 -07:00
|
|
|
|
|
|
|
/// get (unverified) balance from the given account index
|
|
|
|
/// - Parameter account: the index of the account
|
|
|
|
@available(*, deprecated, message: "This function will be removed soon. Use the function returning `Zatoshi` instead")
|
2019-11-26 14:32:20 -08:00
|
|
|
public func getBalance(account index: Int = 0) -> Int64 {
|
2021-07-28 09:59:10 -07:00
|
|
|
rustBackend.getBalance(dbData: dataDbURL, account: Int32(index), networkType: network.networkType)
|
2019-10-18 11:45:19 -07:00
|
|
|
}
|
2022-06-22 12:45:37 -07:00
|
|
|
|
|
|
|
|
|
|
|
/// get (unverified) balance from the given account index
|
|
|
|
/// - Parameter account: the index of the account
|
|
|
|
/// - Returns: balance in `Zatoshi`
|
|
|
|
public func getBalance(account index: Int = 0) -> Zatoshi {
|
|
|
|
Zatoshi(
|
|
|
|
rustBackend.getBalance(
|
|
|
|
dbData: dataDbURL,
|
|
|
|
account: Int32(index),
|
|
|
|
networkType: network.networkType
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
/// get verified balance from the given account index
|
|
|
|
/// - Parameter account: the index of the account
|
|
|
|
@available(*, deprecated, message: "This function will be removed soon. Use the one returning `Zatoshi` instead")
|
2020-01-14 14:25:14 -08:00
|
|
|
public func getVerifiedBalance(account index: Int = 0) -> Int64 {
|
2021-07-28 09:59:10 -07:00
|
|
|
rustBackend.getVerifiedBalance(dbData: dataDbURL, account: Int32(index), networkType: network.networkType)
|
2020-01-14 14:25:14 -08:00
|
|
|
}
|
2022-06-22 12:45:37 -07:00
|
|
|
|
|
|
|
/// get verified balance from the given account index
|
|
|
|
/// - Parameter account: the index of the account
|
|
|
|
/// - Returns: balance in `Zatoshi`
|
|
|
|
public func getVerifiedBalance(account index: Int = 0) -> Zatoshi {
|
|
|
|
Zatoshi(
|
|
|
|
rustBackend.getVerifiedBalance(
|
|
|
|
dbData: dataDbURL,
|
|
|
|
account: Int32(index),
|
|
|
|
networkType: network.networkType
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
2020-01-14 14:25:14 -08:00
|
|
|
|
2020-02-26 08:54:48 -08:00
|
|
|
/**
|
2022-08-20 15:10:22 -07:00
|
|
|
checks if the provided address is a valid sapling address
|
2021-09-17 06:49:58 -07:00
|
|
|
*/
|
2022-08-20 15:10:22 -07:00
|
|
|
public func isValidSaplingAddress(_ address: String) -> Bool {
|
2022-10-19 13:13:18 -07:00
|
|
|
rustBackend.isValidSaplingAddress(address, networkType: network.networkType)
|
2020-02-26 08:54:48 -08:00
|
|
|
}
|
2021-09-17 06:49:58 -07:00
|
|
|
|
2020-02-26 08:54:48 -08:00
|
|
|
/**
|
2021-09-17 06:49:58 -07:00
|
|
|
checks if the provided address is a transparent zAddress
|
|
|
|
*/
|
2020-02-26 08:54:48 -08:00
|
|
|
public func isValidTransparentAddress(_ address: String) -> Bool {
|
2022-10-19 13:13:18 -07:00
|
|
|
rustBackend.isValidTransparentAddress(address, networkType: network.networkType)
|
2020-02-26 08:54:48 -08:00
|
|
|
}
|
|
|
|
|
2020-10-07 16:34:55 -07:00
|
|
|
func isSpendParameterPresent() -> Bool {
|
2020-10-08 10:00:27 -07:00
|
|
|
FileManager.default.isReadableFile(atPath: self.spendParamsURL.path)
|
2020-10-07 16:34:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func isOutputParameterPresent() -> Bool {
|
2020-10-08 10:00:27 -07:00
|
|
|
FileManager.default.isReadableFile(atPath: self.outputParamsURL.path)
|
|
|
|
}
|
|
|
|
|
2022-09-13 03:19:56 -07:00
|
|
|
@discardableResult
|
|
|
|
func downloadParametersIfNeeded() async throws -> Bool {
|
2020-10-08 10:00:27 -07:00
|
|
|
let spendParameterPresent = isSpendParameterPresent()
|
|
|
|
let outputParameterPresent = isOutputParameterPresent()
|
|
|
|
|
|
|
|
if spendParameterPresent && outputParameterPresent {
|
2022-09-13 03:19:56 -07:00
|
|
|
return true
|
2020-10-08 10:00:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
let outputURL = self.outputParamsURL
|
|
|
|
let spendURL = self.spendParamsURL
|
|
|
|
|
2022-09-13 03:19:56 -07:00
|
|
|
do {
|
|
|
|
if !outputParameterPresent && !spendParameterPresent {
|
|
|
|
async let outputURLRequest = SaplingParameterDownloader.downloadOutputParameter(outputURL)
|
|
|
|
async let spendURLRequest = SaplingParameterDownloader.downloadSpendParameter(spendURL)
|
|
|
|
_ = try await [outputURLRequest, spendURLRequest]
|
|
|
|
return false
|
|
|
|
} else if !outputParameterPresent {
|
|
|
|
try await SaplingParameterDownloader.downloadOutputParameter(outputURL)
|
|
|
|
return false
|
|
|
|
} else if !spendParameterPresent {
|
|
|
|
try await SaplingParameterDownloader.downloadSpendParameter(spendURL)
|
|
|
|
return false
|
2020-10-08 10:00:27 -07:00
|
|
|
}
|
2022-09-13 03:19:56 -07:00
|
|
|
} catch {
|
|
|
|
throw error
|
2020-10-08 10:00:27 -07:00
|
|
|
}
|
2022-09-13 03:19:56 -07:00
|
|
|
return true
|
2020-10-07 16:34:55 -07:00
|
|
|
}
|
2020-02-26 08:54:48 -08:00
|
|
|
}
|
|
|
|
|
2021-09-17 06:49:58 -07:00
|
|
|
enum CompactBlockProcessorBuilder {
|
|
|
|
// swiftlint:disable:next function_parameter_count
|
2021-09-15 05:21:29 -07:00
|
|
|
static func buildProcessor(
|
|
|
|
configuration: CompactBlockProcessor.Configuration,
|
|
|
|
service: LightWalletService,
|
|
|
|
storage: CompactBlockStorage,
|
|
|
|
transactionRepository: TransactionRepository,
|
|
|
|
accountRepository: AccountRepository,
|
|
|
|
backend: ZcashRustBackendWelding.Type
|
|
|
|
) -> CompactBlockProcessor {
|
|
|
|
return CompactBlockProcessor(
|
|
|
|
service: service,
|
|
|
|
storage: storage,
|
|
|
|
backend: backend,
|
|
|
|
config: configuration,
|
|
|
|
repository: transactionRepository,
|
|
|
|
accountRepository: accountRepository
|
|
|
|
)
|
2020-02-26 08:54:48 -08:00
|
|
|
}
|
2019-10-18 11:45:19 -07:00
|
|
|
}
|