diff --git a/ZcashLightClientKit/Rust/ZcashRustBackend.swift b/ZcashLightClientKit/Rust/ZcashRustBackend.swift index 76557159..45e61c1b 100644 --- a/ZcashLightClientKit/Rust/ZcashRustBackend.swift +++ b/ZcashLightClientKit/Rust/ZcashRustBackend.swift @@ -225,6 +225,26 @@ class ZcashRustBackend: ZcashRustBackendWelding { UInt(outputParamsPath.lengthOfBytes(using: .utf8))) } + + static func shieldFunds(dbCache: URL, dbData: URL, account: Int32, tsk: String, extsk: String, memo: String?, spendParamsPath: String, outputParamsPath: String) -> Int64 { + let dbData = dbData.osStr() + let dbCache = dbCache.osStr() + let memoBytes = memo ?? "" + + return zcashlc_shield_funds(dbData.0, + dbData.1, + dbCache.0, + dbCache.1, + account, + tsk, + extsk, + memoBytes, + spendParamsPath, + UInt(spendParamsPath.lengthOfBytes(using: .utf8)), + outputParamsPath, + UInt(outputParamsPath.lengthOfBytes(using: .utf8))) + } + static func deriveExtendedFullViewingKey(_ spendingKey: String) throws -> String? { guard !spendingKey.containsCStringNullBytesBeforeStringEnding() else { diff --git a/ZcashLightClientKit/Rust/ZcashRustBackendWelding.swift b/ZcashLightClientKit/Rust/ZcashRustBackendWelding.swift index ba615bd4..886c0b62 100644 --- a/ZcashLightClientKit/Rust/ZcashRustBackendWelding.swift +++ b/ZcashLightClientKit/Rust/ZcashRustBackendWelding.swift @@ -182,7 +182,6 @@ public protocol ZcashRustBackendWelding { - dbData: URL for the Data DB - account: the account index that will originate the transaction - extsk: extended spending key string - - consensusBranchId: the current consensus ID - to: recipient address - value: transaction amount in Zatoshi - memo: the memo string for this transaction @@ -191,6 +190,20 @@ public protocol ZcashRustBackendWelding { */ static func createToAddress(dbData: URL, account: Int32, extsk: String, consensusBranchId: Int32, to: String, value: Int64, memo: String?, spendParamsPath: String, outputParamsPath: String) -> Int64 + /** + Creates a transaction to shield all found UTXOs in cache db. + - Parameters: + - dbCache: URL for the Cache DB + - dbData: URL for the Data DB + - account: the account index that will originate the transaction + - tsk: transparent Secret Key for the shielded funds. + - extsk: extended spending key string + - memo: the memo string for this transaction + - spendParamsPath: path escaped String for the filesystem locations where the spend parameters are located + - outputParamsPath: path escaped String for the filesystem locations where the output parameters are located + */ + static func shieldFunds(dbCache: URL, dbData: URL, account: Int32, tsk: String, extsk: String, memo: String?, spendParamsPath: String, outputParamsPath: String) -> Int64 + /** Derives a full viewing key from a seed - Parameter spendingKey: a string containing the spending key