add shieldFunds to rustwelding

This commit is contained in:
Francisco Gindre 2020-12-22 16:44:12 -03:00
parent 77ab2ad26b
commit 085072ae55
2 changed files with 34 additions and 1 deletions

View File

@ -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 {

View File

@ -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