Merge pull request #1004 from zcash/fix_derivation_tool_constructor
Make DerivationTool constructor public
This commit is contained in:
commit
ed87069c03
|
@ -33,7 +33,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||
|
||||
var sharedViewingKey: UnifiedFullViewingKey {
|
||||
get async {
|
||||
let derivationTool = sharedWallet.makeDerivationTool()
|
||||
let derivationTool = DerivationTool(networkType: kZcashNetwork.networkType)
|
||||
let spendingKey = try! await derivationTool
|
||||
.deriveUnifiedSpendingKey(seed: DemoAppConfig.defaultSeed, accountIndex: 0)
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ class GetUTXOsViewController: UIViewController {
|
|||
@IBAction func shieldFunds(_ sender: Any) {
|
||||
Task { @MainActor in
|
||||
do {
|
||||
let derivationTool = AppDelegate.shared.sharedWallet.makeDerivationTool()
|
||||
let derivationTool = DerivationTool(networkType: kZcashNetwork.networkType)
|
||||
|
||||
let usk = try await derivationTool.deriveUnifiedSpendingKey(seed: DemoAppConfig.defaultSeed, accountIndex: 0)
|
||||
|
||||
|
|
|
@ -218,7 +218,7 @@ class SendViewController: UIViewController {
|
|||
return
|
||||
}
|
||||
|
||||
let derivationTool = AppDelegate.shared.sharedWallet.makeDerivationTool()
|
||||
let derivationTool = DerivationTool(networkType: kZcashNetwork.networkType)
|
||||
guard let spendingKey = try? await derivationTool.deriveUnifiedSpendingKey(seed: DemoAppConfig.defaultSeed, accountIndex: 0) else {
|
||||
loggerProxy.error("NO SPENDING KEY")
|
||||
return
|
||||
|
|
|
@ -69,7 +69,7 @@ class SyncBlocksListViewController: UIViewController {
|
|||
case .stopped, .unprepared, .synced, .disconnected, .error:
|
||||
do {
|
||||
if syncStatus == .unprepared {
|
||||
let derivationTool = AppDelegate.shared.sharedWallet.makeDerivationTool()
|
||||
let derivationTool = DerivationTool(networkType: kZcashNetwork.networkType)
|
||||
let spendingKey = try await derivationTool.deriveUnifiedSpendingKey(seed: synchronizerData.seed, accountIndex: 0)
|
||||
let viewingKey = try await derivationTool.deriveUnifiedFullViewingKey(from: spendingKey)
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ class TransactionSQLDAO: TransactionRepository {
|
|||
func findReceived(offset: Int, limit: Int) async throws -> [ZcashTransaction.Received] {
|
||||
let query = transactionsView
|
||||
.filterQueryFor(kind: .received)
|
||||
.order(ZcashTransaction.Overview.Column.id.desc,(ZcashTransaction.Overview.Column.minedHeight ?? BlockHeight.max).desc )
|
||||
.order(ZcashTransaction.Overview.Column.id.desc, (ZcashTransaction.Overview.Column.minedHeight ?? BlockHeight.max).desc)
|
||||
.limit(limit, offset: offset)
|
||||
|
||||
return try execute(query) { try ZcashTransaction.Overview(row: $0) }
|
||||
|
|
|
@ -406,10 +406,6 @@ public class Initializer {
|
|||
public func isValidTransparentAddress(_ address: String) -> Bool {
|
||||
DerivationTool(networkType: network.networkType).isValidTransparentAddress(address)
|
||||
}
|
||||
|
||||
public func makeDerivationTool() -> DerivationTool {
|
||||
return DerivationTool(networkType: network.networkType)
|
||||
}
|
||||
}
|
||||
|
||||
extension InitializerError: LocalizedError {
|
||||
|
|
|
@ -64,7 +64,7 @@ public enum KeyDerivationErrors: Error {
|
|||
public class DerivationTool: KeyDeriving {
|
||||
let backend: ZcashKeyDerivationBackendWelding
|
||||
|
||||
init(networkType: NetworkType) {
|
||||
public init(networkType: NetworkType) {
|
||||
self.backend = ZcashKeyDerivationBackend(networkType: networkType)
|
||||
}
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ class PendingTransactionUpdatesTest: XCTestCase {
|
|||
let clearedTransactions = await coordinator.synchronizer
|
||||
.clearedTransactions
|
||||
|
||||
let clearedTransaction = clearedTransactions.first(where: { $0.rawID == afterStagePendingTx.rawTransactionId } )
|
||||
let clearedTransaction = clearedTransactions.first(where: { $0.rawID == afterStagePendingTx.rawTransactionId })
|
||||
|
||||
XCTAssertEqual(clearedTransaction!.value.amount + clearedTransaction!.fee!.amount, -afterStagePendingTx.value.amount)
|
||||
XCTAssertNil(supposedlyPendingUnexistingTransaction)
|
||||
|
|
|
@ -257,7 +257,7 @@ class SynchronizerOfflineTests: XCTestCase {
|
|||
let synchronizer = SDKSynchronizer(initializer: initializer)
|
||||
|
||||
do {
|
||||
let derivationTool = initializer.makeDerivationTool()
|
||||
let derivationTool = DerivationTool(networkType: network.networkType)
|
||||
let spendingKey = try await derivationTool.deriveUnifiedSpendingKey(
|
||||
seed: Environment.seedBytes,
|
||||
accountIndex: 0
|
||||
|
|
|
@ -80,7 +80,7 @@ class TestCoordinator {
|
|||
logLevel: .debug
|
||||
)
|
||||
|
||||
let derivationTool = initializer.makeDerivationTool()
|
||||
let derivationTool = DerivationTool(networkType: network.networkType)
|
||||
|
||||
self.spendingKey = try await derivationTool.deriveUnifiedSpendingKey(
|
||||
seed: Environment.seedBytes,
|
||||
|
|
|
@ -24,7 +24,7 @@ class TestsData {
|
|||
saplingParamsSourceURL: .default
|
||||
)
|
||||
}()
|
||||
lazy var derivationTools: DerivationTool = { initialier.makeDerivationTool() }()
|
||||
lazy var derivationTools: DerivationTool = { DerivationTool(networkType: networkType) }()
|
||||
let saplingAddress = SaplingAddress(validatedEncoding: "ztestsapling1ctuamfer5xjnnrdr3xdazenljx0mu0gutcf9u9e74tr2d3jwjnt0qllzxaplu54hgc2tyjdc2p6")
|
||||
let unifiedAddress = UnifiedAddress(
|
||||
validatedEncoding: """
|
||||
|
|
Loading…
Reference in New Issue